aquacropos / aquacrop

AquaCrop-OSPy: Python implementation of AquaCrop-OS
https://aquacropos.github.io/aquacrop/
Apache License 2.0
102 stars 73 forks source link

Error when modifying planting date #181

Open cgalea15 opened 1 month ago

cgalea15 commented 1 month ago

I'm trying to apply changes in planting and harvesting dates with the following configuration in the model:

"Climate input lars_fp=get_filepath('SG02_software.dat') base=pd.read_csv(lars_fp, sep='\t', engine='python') base['Date']=pd.to_datetime(base['Date']) Crop input crop=Crop('BarleyGDD',planting_date='02/01', CalendarType=2) Soil input soil=Soil('SandyLoam') Initial water condition input init_wc = InitialWaterContent('FC') # default is field capacity. Maybe we can play with this values to adapt it to the actual yield

model=AquaCropModel('2001/01/01','2023/04/30',base,soil,crop,init_wc) model.run_model(till_termination=True)"

It works if the planting date is 05/x but it returns the following error when changing it:

"File ~\anaconda3\Lib\site-packages\aquacrop\solution\biomass_accumulation.py:104 in biomass_accumulation dB = WPadj * (Tr / et0)"

I printed et0 and Tr values in this line and most Tr are 0 and some et0 are 0 too. I imagine that it has something to do with the calculation of Tr maaybe because of the climate data but I wanted to share it in case someone could help me. Thanks

cgalea15 commented 1 month ago

I forgot to include the actual error that python returns

ZeroDivisionError: float division by zero