Problems with low soil water content as initial conditions

Hello Tom,

Thank you very much for the great effort developing this tool. It is wonderful to have AquaCrop on Python.

I have the following problem that I could not find a solution: I am not able to replicate results from Windows AquaCrop when setting low soil water content as initial conditions. For example, starting from Exercise 7.3 from the documentation, I modify the initial water content setting it to equal the WP and the resulting Yield differs in more than 1 kg/ha respect to Windows AC.
For higher initial water content it replicates well, but I cannot find why it is not doing the same for lower values. I tried setting the same values manually, through the ‘Num’ option, getting the same result. Python’s result seems quite affected by this setting, since the Yield drops a lot respect to the original Exercise 7.3 settings. On the other hand, when doing the same on Windows AC, the results show small differences.

The code I used was this:

wdf = prepare_weather(get_filepath('tunis_climate.txt'))
sandy_loam = SoilClass('SandyLoam')
crop = CropClass('Wheat',PlantingDate= '10/15')
# iwc = InitWCClass('Pct','Layer',[1],[30]) # original from Exercise 7.3
iwc = InitWCClass(Method='Layer',value=['WP'])
model = AquaCropModel('1979/01/01','2002/05/31',wdf,sandy_loam, crop,InitWC=iwc)
model.initialize()
model.step(till_termination=True)

For windows AquaCrop I used version 6.1, with the files Tunis.CLI, WheatGDD.CRO and SandyLoam.SOL that are included in its DATA folder. Start growing cycle was set to 15th October, and Simulation period from 1st of January of 1979. For the Initial conditions file, I created one within the same section of the program, just selecting ‘for specific layer’ and clicking on ‘Put soil profile at… Wilting Point’. The .SW0 created contains the following:

6.1   : AquaCrop Version (May 2018)
   -9.00  : initial canopy cover that can be reached without water stress will be used as default
0.000 : biomass (ton/ha) produced before the start of the simulation period
   -9.00  : initial effective rooting depth that can be reached without water stress will be used as default
0.0   : water layer (mm) stored between soil bunds (if present)
0.00  : electrical conductivity (dS/m) of water layer stored between soil bunds (if present)
0     : soil water content specified for specific layers
1     : number of layers considered

Thickness layer (m)     Water content (vol%)     ECe(dS/m)
==============================================================
     4.00                10.00                  0.00

Thanks in advance for any help you could provide me, I ran out of ideas…

PS: I could not compare with Matlab’s AquaCropOS, since I could not access to Matlab

Hi @pegaca

Thanks for this, I’ll be able to take a look next week.

Tom

Thank you very much for your time. I really appreciate any help.

Hi I believe i have found the main issue. AquaCrop-OSPy currently resets the intial water content back to Initial water content (or whatever you specify) at the start of each growing season including the first season (unless you set ClockStruct.SimOffSeason==True). AquaCrop-Windows on the other hand resets the water content at the start of all seasons except the first one (as we start the sim in january instead of when the crop is planted) (Figure 1 and Figure 2). So there is a big difference in Yield on the first season (Figure 3) but not the later seasons.

Figure 1

Figure 2

Figure 3

So in the next update I will add a change maybe around this part of the code inside timestep.reset_initial_conditions to not reset the water content if the simulation start date is before the planting date:

    ## Reset soil water conditions (if not running off-season) ##
if ClockStruct.SimOffSeason==False:
    # Reset water content to starting conditions
    InitCond.th = InitCond.thini
    # Reset surface storage
    if (FieldMngt.Bunds) and (FieldMngt.zBund > 0.001):
        # Get initial storage between surface bunds
        InitCond.SurfaceStorage = min(FieldMngt.BundWater,FieldMngt.zBund)
    else:
        # No surface bunds
        InitCond.SurfaceStorage = 0

Then finally in case this kind of issue happens to anyone else again, what i did to diagnose the problem (once i saw that season 1 was the problem from Figure 3) was compare the water content output files from Windows and Python (Figure 4). By comparing these you can see that as we switch from season 0 to season 1, the water content in Python resets but Windows does not. Then its just a case of finding where in the code does this happen.

Figure 4

Hopefully this helped, let me know if you have any more questions or issues.

Tom

Great! Thank you very much Tom. I made the modifications that you indicated and now the results are the same in all seasons. Problem solved!
Also thank you for the method to find the source of a problem. I will use it if I need it before posting.
Thanks again!!