Low sand values cause the model to generate NA values in RZSW

237 views
Skip to first unread message

Carlos Alberto Arnillas

unread,
Mar 15, 2021, 9:43:02 AM3/15/21
to EPIC / APEX Modeling Forum
Hello
I have been fitting an APEX model in a Canadian farm, and had some trouble running it. The model was generating no out flow. After some try-and-error, I noticed that the problem occurred in a particular soil type when plants grow. In fact, the problem was generated by low values of SAN in the layers 3 and 4 of that particular soil type (less than 13, and less than 10, respectively). However, according the Canadian soil survey, sand fraction for those soil types should be 8 and 4 percent, respectively.
Below is the original .SOL file, highlighting the two values that I had to change for the model to run.
Any idea about what could be generating the problem or how to solve it?
Thanks in advance

Carlos Alberto


ONSMF~~~~~A
    0.02    4.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
   10.00    0.00   50.00    2.00    0.10    0.00    0.00    0.00    0.00        
    0.20    0.39    0.78    1.00
    1.16    1.39    1.47    1.49
    0.14    0.19    0.35    0.34
    0.43    0.37    0.36    0.35
   23.00   23.00    8.00    4.00
   54.00   50.00   30.00   37.00
    0.00    0.00    0.00    0.00
    5.90    5.80    6.20    7.00
    0.00    0.00    0.00    0.00
    3.10    0.50    0.20    0.30
    0.00    0.00    0.00    0.00
   39.00   27.00   54.00   52.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    5.11    3.12    2.05    1.92
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
    0.00    0.00    0.00    0.00
       A       B       B       C
  140.00  140.00  140.00  140.00
    0.60    0.60    0.60    0.60
    0.01    0.01    0.01    0.01

Luca

unread,
Mar 15, 2021, 9:59:57 AM3/15/21
to EPIC / APEX Modeling Forum
Dear Carlos Alberto,
The APEX model should be able to simulate soils with low soil sand content but it is possible that a combination of input variables is creating the error. I made a simulation using your soil file and I was not able to recreate the error. Would you be able to share with me all the input files that are giving you the error along with the output files and the executable you are using. I will run the model on my computer to understand what is creating the error.

Best,
Luca

Carlos Alberto Arnillas

unread,
Mar 15, 2021, 5:35:14 PM3/15/21
to EPIC / APEX Modeling Forum
Thanks for your reply!
Please, find the files in this link

Carlos Alberto

Luca

unread,
Mar 18, 2021, 4:34:47 PM3/18/21
to EPIC / APEX Modeling Forum
I have downloaded your files and I will let you know as soon as possible.

Luca

Luca

unread,
Mar 22, 2021, 10:06:58 AM3/22/21
to EPIC / APEX Modeling Forum
Dear Carlos,

I worked with your files and the problem occurs during the estimation of the field capacity and wilting point. I have two solutions for you. The first one is to change the option used for the estimation of the field capacity and wilting point (ISW) in the control table. Currently, you are using option 0 which is the Rawls method to estimate and dynamically change the field capacity and wilting point during the simulation. Changing to option 1 seems to solve the problem. Option 1 of ISW still uses the Rawls method to dynamically change the field capacity and wilting point during the simulation but, their values to begin the simulation are taken from the soil file instead of being estimated with the Rawls method and this avoid the error that is causing the NA in the output files.
The second option is to change the code of the model. In fact, the line of code that is giving you the problem has been modified in a more updated version of the model. Unfortunately, that version is not compatible with ArcAPEX (which is the interface you are using, I guess) but I think I could be able to modify the code of a version that is compatible with the ArcAPEX interface.

Please, first test option 1 for ISW and let me know if this solution works for you.
Best,
Luca

Carlos Alberto Arnillas

unread,
Mar 22, 2021, 3:01:50 PM3/22/21
to EPIC / APEX Modeling Forum
Thanks Luca
Indeed, I am using ArcAPEX interface to generate the files, but I later adjust them using an R code, because using ArcAPEX was very difficult to integrate our soil and weather data. However, if ArcAPEX does not work with the latest version of APEX, is there an alternative to it? I explored APEXeditor and winapex, and both seem good to work with individual fields, but I didn't notice any interface to integrate spatial data (e.g., shapefiles with field delineation). I would like to use the latest version of APEX instead of an older one.
In terms of the two options that you suggested, I am curious about the implications of using option 1 instead of 0. I inputted the wilting point (UW) and field capacity (FC) in the .SOL files. If I use the option 0, is APEX using those values or estimating its own? Also, for some soil layers, the data indicate UW = FC, would that cause a problem?

Thanks,

Carlos Alberto

Luca

unread,
Mar 22, 2021, 7:25:28 PM3/22/21
to EPIC / APEX Modeling Forum
Carlos,
ArcAPEX is the only interface that works with spatial data. We are working to update ArcAPEX in order to be used with a more recent version of APEX but honestly, I do not when it will be ready. I can keep you updated on this.
On the Blackland Research and Extension Center website, it is possible to download a more recent version of APEX (https://epicapex.tamu.edu/model-executables/). I can see that the source of this version has been slightly modified compared to the version you are using now, but I did not have the time to test with your data to be sure that it solves the error you encountered. Also, I am not sure if it is compatible with some of the input files you have already created. I am thinking of the control table and the subarea file.

In terms of the two options, you will see some difference between the two of them but in my test, they were minor (in fact, you are using the Rawls method in both cases). If you use option 0, APEX will estimate FC and UW even if you have provided that information in the soil file. Also, if you have UW = FC for all the soil layers, it can create some problems. For instance, the plant available water is estimated as FC - UW resulting in zero. This can create errors during the simulation. You should be relatively safe if UW = FC only in some soil layers.

Let me know how you would like to proceed.
Best,
Luca

Carlos Alberto Arnillas

unread,
Mar 22, 2021, 8:52:08 PM3/22/21
to EPIC / APEX Modeling Forum
Yes please, let me know whenever the newer version of ArcAPEX is available. 
About that: Is it possible to edit the ArcAPEX text files to make it work with the newer version of APEX? If so, where can I find the documentation?
meanwhile, I will try changing the parameter to 1.
Thanks

Carlos Alberto

Luca

unread,
Mar 24, 2021, 9:59:31 AM3/24/21
to EPIC / APEX Modeling Forum
Yes, it is possible to edit the text files generated by ArcAPEX to work with the latest version of the APEX model. At the moment we do not have any specific documentation and the only way I can think of is to use the information reported in the ArcAPEX and APEX1501 user's manual.
I can also do a check using the source code (thinking about it I think there might be differences in the subarea, control table, and, possibly, parameters files) and let you know. I have to complete some tasks and then I will be able to get back to you with this information.

Luca

Carlos Alberto Arnillas

unread,
Mar 24, 2021, 10:28:50 AM3/24/21
to EPIC / APEX Modeling Forum
That will be extremely helpful.
Thanks a lot.

Carlos Alberto

Carlos Alberto Arnillas

unread,
Apr 23, 2021, 10:27:06 AM4/23/21
to EPIC / APEX Modeling Forum
Dear Luca
Did you have a chance to review what were the parameters that changed between the two APEX versions? 
Something that it is unclear to me: is the documentation in the APEX1501 user's manual (Sept. 2018) consistent with the APEX version distributed with ArcAPEX or with the latest version downloadable from the webpage?
Thanks again

Carlos Alberto

On Wednesday, March 24, 2021 at 9:59:31 AM UTC-4 Luca wrote:
Yes, it is possible to edit the text files generated by ArcAPEX to work with the latest version of the APEX model. At the moment we do not have any specific documentation and the only way I can think of is to use the information reported in the ArcAPEX and APEX1501 user's manual.
I can also do a check using the source code (thinking about it I think there might be differences in the subarea, control table, and, possibly, parameters files) and let you know. I have to complete some tasks and then I will be able to get back to you with this information.

Luca

Luca

unread,
Apr 23, 2021, 11:16:17 AM4/23/21
to EPIC / APEX Modeling Forum
Dear Carlos,
To be honest, I did not have time to compare the two versions and I still have this task in my "to do" list on my whiteboard. I am sorry if it is taking this long.
I am not sure that the information in the APEX1501 user's manual is consistent with the version distributed with ArcAPEX and actually or with the version available on the website. I doubt they are 100% accurate and up to date. You should have the ArcAPEX user's manual with the ArcAPEX installation. it is located in C:\APEX\ArcAPEX\ArcAPEXHelp (C is the default drive but it can be different in your case).

Hopefully, during the coming week, I will be able to compare the input data of the two versions of the model.
Best,
Luca

Carlos Alberto Arnillas

unread,
May 4, 2021, 12:13:27 AM5/4/21
to EPIC / APEX Modeling Forum
Dear Luca
I started comparing some of the input files in both version using the examples provided and the APEX1501-release note.doc document.
I managed to identify a couple of differences and adjust them, so the model now at least starts running.
However, I got an error message referring to GCOW (pasted below), and no reference to any variable named GCOW in any of the manuals.
Any idea what could be wrong? 
Thanks again

Carlos Alberto

forrtl: severe (408): fort: (3): Subscript #1 of the array GCOW has value 0 which is less than the lower bound of 1

Image              PC        Routine            Line        Source
APEX1501.exe       00B905CF  Unknown               Unknown  Unknown
APEX1501.exe       0083E770  _TGRAZ                     18  TGRAZ.f90
APEX1501.exe       005CA7CB  _TLOP                     262  TLOP.f90
APEX1501.exe       0053B2B0  _BSUB                     571  BSUB.f90
APEX1501.exe       0038DF23  _BSIM                     469  BSIM.f90
APEX1501.exe       009D3D22  _MAIN__                  3761  MAIN_1501.f90
APEX1501.exe       00C31C3F  Unknown               Unknown  Unknown
APEX1501.exe       00C327DE  Unknown               Unknown  Unknown
APEX1501.exe       00C326C7  Unknown               Unknown  Unknown
APEX1501.exe       00C3256D  Unknown               Unknown  Unknown
APEX1501.exe       00C32848  Unknown               Unknown  Unknown
KERNEL32.DLL       75BB6359  Unknown               Unknown  Unknown
ntdll.dll          77D087A4  Unknown               Unknown  Unknown
ntdll.dll          77D08774  Unknown               Unknown  Unknown

Luca

unread,
May 4, 2021, 9:26:27 AM5/4/21
to EPIC / APEX Modeling Forum
Dear Carlos Alberto,
The error is related to the simulation of grazing activity. I am not sure if you are simulating grazing or not and I don't know the setup of this specific run but, you should be able to solve the problem by setting the first NY in the subarea file (NY is the eleventh line of each individual subarea you have in the subarea file) to one.

Also, I am working on the differences between 1501 and 1905 and creating an Excel file and soon I should be able to share it with you.

Luca

Carlos Alberto Arnillas

unread,
May 4, 2021, 11:19:51 AM5/4/21
to EPIC / APEX Modeling Forum

Thanks Luca!
I'm looking into the NY parameter and grazing operations. I am not simulating grazing, so I changed the HERD1501 to include an empty line (and later a zero line), as suggested in the manual, but it didn't help. I changed the numbers to 1 in the sub file, and now that problem is fixed, but I got a different error message.
"forrtl: severe (408): fort: (2): Subscript #1 of the array RFDT has value 2 which is greater than the upper bound of 1"
which seems to be related to the extreme storm events. As in the case of herds, I don't recall activating sub-daily weather simulations.

Just in case, when comparing the APEXCONT file generated by ArcAPEX 1501.10_3.5   with the APEXCONT provided with the APEX1501 downloaded from the web I found two main differences: the one generated with ArcAPEX does not have the IHAY, or the QPQ parameters (documented in the apexeditor excel file distributed with the APEX1501 downloaded independently). Maybe the question here is: which one is more updated? (the APEX1501 distributed with ArcAPEX or the one distributed independently?)

Finally, where can I download APEX1905?

Sorry for so many questions, and thanks a lot for all your help.

Carlos Alberto

Luca

unread,
May 5, 2021, 10:07:15 AM5/5/21
to EPIC / APEX Modeling Forum
YOu should be able to solve the problem with RFDT editing the ninth value of the APEXDIM file. My guess is that it is set to one so, you can bring it up to 1000. Because I don't know how you are running the model (from the interface or directly from the executable) I have to give you two options. If you are running the model from the executable, you can edit the APEXDIM.DAT file in the project folder. If you are running the model using an interface, you have to follow a different procedure according to the interface you are using. If you are running the model using WinAPEX, you can edit the table called "APEX_DIMENSIONS" in the Access database. Look for the variable MHP and increase it to 1000. If you are running ArcAPEX, the APEXDIM file you have to modify is located in the ArcAPEX/Databases folder. Also in this case, you can increase the value of the ninth variable to 1000.

Of the two versions you are comparing, the one that comes with the standalone APEX1501 and that includes IHAY and QPQ is the most updated version.

The 1905 version is under testing (by mistake, I mentioned it instead of the ArcAPEX version because I was working on it) but, I might be able to share a version soon. Please remind me about it in the next few days.

Best,
Luca

Carlos Alberto Arnillas

unread,
May 5, 2021, 12:53:10 PM5/5/21
to EPIC / APEX Modeling Forum
Thanks Luca!
I fixed the dimension and the model run. I'm going back to testing the model outputs.

looking forward for the new APEX version! Will the input/output files change or will they follow the same structure?
Best,

Carlos Alberto

Luca

unread,
May 6, 2021, 9:48:33 AM5/6/21
to EPIC / APEX Modeling Forum
The format of the input/output files in APEX1905 will be the same (text files organized in the same way) but some new variables and files will be included in 1905.
I will let you know as soon as possible (please, remind me on his tread if you don't receive any news from me, thanks).

Best,
Luca

Luca

unread,
May 10, 2021, 12:09:15 PM5/10/21
to EPIC / APEX Modeling Forum
Carlos,
With the time available, I worked to compare the variables included in the files used by the different versions of APEX. I am attaching here an early version of the file I am working on. I covered almost all the variables but I still need to investigate a little bit more for some of them.
Let me know if you need more information or if you see something that doesn't look right in the file I am including here.

Best,
Luca
APEX1501 vs 1905.xlsx

Carlos Alberto Arnillas

unread,
May 10, 2021, 1:19:25 PM5/10/21
to EPIC / APEX Modeling Forum
Thanks Luca!
This is extremely helpful, as it helps to visualize not just the differences, also to get a better picture of the variables.
From a quick review, I noticed that the PARAM file description doesn't match what I see in the PARAM1501.DAT file generated by ArcAPEX (see below). In the PARM file I also noticed some values have gaps (e.g., PARAM(30)), but there is no gap in the text file copied below, does it mean that the ArcAPEX code does not consider that parameters or that meaning of the values do not match?
I will compare it with my other notes and will get back to you if I find anything else.
One quick question: I noticed that the parameters are only described by file name, line number and number position: does it mean that we do not really need the specific location of the number (e.g., 17-24) and that now all the values space-delimited?
Again, this is extremely helpful!

Carlos Alberto



PARM1501.DAT file generated by ArcAPEX:
   90.05   99.95
   10.50  100.95
   50.10   95.95
    0.00    0.00
    1.20    6.95
    5.10  100.95
    5.25   50.95
   20.50   80.99
    1.10   10.99
   10.05  100.90
    5.01   20.90
    5.05  100.50
    1.80    3.99
    5.10   20.95
   10.10  100.95
    3.10   20.99
   20.10   50.95
    5.10   50.30
   10.01   25.95
  400.05  600.90
   10.50  100.90
  100.01 1000.90
    1.50    3.99
    3.25   15.95
   10.10   55.90
   10.10   75.95
    5.01   50.99
    0.00    0.00
    0.00    0.00
     70.     30.
    1.50      2.      .5  0.9000  0.5000   0.500   0.990  20.000  20.000  20.000
 -100.00     2.5  2.0000      1.  0.0000   1.000      .5   1.500   0.003   0.200
   10.00    0.05  0.0032  0.1000  0.0000   0.000   0.300   5.000     .01   1.100
    0.30    1.00  2.5000      0.  0.9900      0.   0.200   1.000     .01     .99
    0.50    0.40  0.1500  2.0000  3.0000   0.500   1.000   0.000   0.000   0.100
    0.00   10.00  0.9000  0.6000  0.2000   0.900   1.000   0.600   0.100   7.000
    0.20    0.25  1.1000  1.0000  0.0010   3.000  10.000   0.500   0.500      1.
    1.15     .05  0.5000  0.2000  0.8000     .05   0.000  10.000   1.000      .5
    0.00      3.  0.5100  0.0001  0.0001   0.010   0.010   0.001   0.100   1.000
      .1      1.      1.      1.      1.      1.      .9      1.      1. .000548
 .000012   .0667      .2      .3   .0667      .2   .0075      2.      1.      1.    
   0.044  31.000   0.510   0.570  10.000
    5.00      .5     .01     .01   
    
    
    
    
    0.01    0.80  1.0000  1.0000  1.0000  10.000   0.000   0.000   0.000   0.000
    0.05   31.00  1.0000 50.0000  0.0000   0.000   0.000   0.000   0.000   0.000

Luca

unread,
May 10, 2021, 6:23:44 PM5/10/21
to EPIC / APEX Modeling Forum
The parameters that are not marked, are not used in the source code I used for this comparison. I have seen that they are listed in the user manual but, since they are not in the code, they are not used. I think you can do a quick test comparing the results of simulations done with different values for those parameters.
About the placement of each variable, because of the limited time available, I have not included that information in the file. Please, follow the format of the files you have now, refer to the user manual to have information on the format of each file, or contact me if you need some specific information.

Luca

Carlos Alberto Arnillas

unread,
May 10, 2021, 6:38:27 PM5/10/21
to EPIC / APEX Modeling Forum
That makes sense.
Thanks again!

Carlos Alberto Arnillas

unread,
May 12, 2021, 9:14:49 PM5/12/21
to EPIC / APEX Modeling Forum
Dear Luca
I managed to add some comments to the file you sent me before to incorporate the changes that I found were needed to make the model run, in case anybody else needs to update ArcAPEX to run the newer version.
Just in case, some discrepancies that I found running ArcAPEX, disappeared or decreased when running APEX1501. In particular, the error reported in the balance decreased significantly.
Best,

Carlos Alberto

APEX1501 vs 1905.xlsx

Luca

unread,
May 14, 2021, 9:27:34 AM5/14/21
to EPIC / APEX Modeling Forum
Dear Carlos,
I am working to include some new information in the file I shared with you and I will send it your way as soon as I will have a new version ready.
My guess is that the discrepancies you found running APEX1501 and using the ArcAPEX interface are created by the APEX version. You know that ArcAPEX is just an interface to run the APEX model but, the version of APEX1501 included in ArcAPEX must be different from the version you are running as a stand-alone program. What I usually do when I have to work on a large area is to use ArcAPEX only for the watershed and subarea delineation but then I run APEX outside ArcGIS adjusting the input files when needed.

Luca

Carlos Alberto Arnillas

unread,
May 14, 2021, 10:20:59 AM5/14/21
to EPIC / APEX Modeling Forum
yes. that is my guess too.
Thanks again, and looking forward for the updated version of the excel file.
Also, when is the newer version (1905) going to be released?
Regards,

Carlos Alberto

minfeng tang

unread,
May 14, 2021, 10:25:24 AM5/14/21
to EPIC / APEX Modeling Forum
Dear Luca,

I have a similar question you mentioned here. May I ask what's the size of a large area in your definition? I am using a HUC12 subwatershed and its area is 37406.15 acres. It looks like it is complicated to apply the delineation method as shown in the WinAPEX manual (page12) to manually define subarea for this watershed. Thank you!

Sincerely,
Minfeng

Luca

unread,
May 14, 2021, 12:12:10 PM5/14/21
to EPIC / APEX Modeling Forum
Minfeng,

Honestly, I cannot define a hard boundary to define a large area. I think it comes to the level of detail needed and the homogeneity of the area of interest. But, for the area you are simulating, probably I would use ArcAPEX instead of WinAPEX especially if the landscape is hilly. In fact, with a quite large area to simulate, and complex topography, it can be hard to manually design the network of subareas required.

Luca

minfeng tang

unread,
May 17, 2021, 9:57:25 AM5/17/21
to EPIC / APEX Modeling Forum
Dear Luca,

Thank you for the information!

Sincerely,
Minfeng

Luca

unread,
May 17, 2021, 11:31:24 AM5/17/21
to EPIC / APEX Modeling Forum
Carlos,
here is an updated version of the Excel file I shared previously. I corrected some errors (for some reason, the indication of the parameters used in ArcAPEX was missing from a certain point. It is where you have added the red points) and added the information about how the different versions of the model read the input files.

Let me know if you have any other questions.
Luca
APEX1501 vs 1905 v2.xlsx

Carlos Alberto Arnillas

unread,
May 17, 2021, 11:36:38 AM5/17/21
to EPIC / APEX Modeling Forum
Thanks Luca!
I will look at it shortly

Carlos Alberto

Reply all
Reply to author
Forward
0 new messages