Writing wrsto and wrsen in output file

Thought that maybe it would be interesting to also include wrsto and wrsen in for example the flux output files generated?

in solution.py file --> add function to calculate psen an psto
def water_stressp(Crop,InitCond,Dr,TAW,Et0,beta):
## Calculate psto and psen##
nstress = len(Crop.p_up)
# Store stress thresholds
p_up = np.ones(nstress)*Crop.p_up

if Crop.ETadj == 1:
    # Adjust stress thresholds for Et0 on currentbeta day (don't do this for
    # pollination water stress coefficient)

    for ii in range(3):
        fAdj = (np.exp(InitCond.TrRatio * Crop.fshape_ex) - 1) / (np.exp(Crop.fshape_ex) - 1)
        p_up[ii] = p_up[ii]+fAdj*(0.04*(5-Et0))*(np.log10(10-9*p_up[ii]))
# Adjust senescence threshold if early sensescence is triggered
if (beta == True) and (InitCond.tEarlySen > 0):
    p_up[2] = p_up[2]*(1-Crop.beta/100)
# Limit values
p_up = np.maximum(p_up,np.zeros(4))
p_up = np.minimum(p_up,np.ones(4))

# Limit values
return p_sto, p_sen

in timestep.py file --> in timestep calculate the wrsen and wrsto
#calculation of wrsto and wrsen
p_sto, p_sen = water_stressp(Crop,NewCond,_Dr.Rz,_TAW.Rz,Et0,Crop.beta)
Wrsen =(Wr+_Dr.Rz)- _TAW.Rz * p_sen

the wrsto and wrsen can then be added to the flux output files
all the best,

Hi @astridv

Sure improving the output files was definitely something I have thought about. If we open an issue and pull request we can also think about other outputs we can include at the same time


hi @tom,

I did an attempt to create the pull request just now. [https://github.com/aquacropos/aquacrop/pulls]
All the best,