Problem using crop configurable parameters #82
Unanswered
atlasul-hub
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello guys,
I'm having trouble implementing configurable crop parameters in aquacrop 2.2.2, in the previous version I was able to do that.
Would you have any tips? I didn't find any information here.
Error:
AttributeError Traceback (most recent call last)
Cell In [13], line 6
4 for index, row in points.iterrows():
5 print("[I] Executa o modelo Aquacrop para o PID: ", row['token'])
----> 6 produtividade=run_model(source=source,index=index,row=row,file_error_log=file_error_log)
7 print(produtividade)
9 try:
Cell In [7], line 79, in run_model(source, index, row, file_error_log)
74 cultura="Algodão"
76 elif (cultura_id == 2):
77 # SOJA
78 #cult_crop=Crop('SoybeanGDD', planting_date=PlantingDate,harvest_date=HarvestDate)
---> 79 cult_crop=Crop('custom', planting_date=PlantingDate,harvest_date=HarvestDate, kwargs=crop_soybean['custom'])
80 fator=60
81 cultura="Soja"
File ~/work/anaconda3/envs/aquacrop/lib/python3.9/site-packages/aquacrop/entities/crop.py:181, in Crop.init(self, c_name, planting_date, harvest_date, **kwargs)
91 allowed_keys = {
92 "fshape_b",
93 "PctZmin",
(...)
174 "YldFormCD",
175 }
177 self.dict.update(
178 (k, v) for k, v in kwargs.items() if k in allowed_keys
179 )
--> 181 self.calculate_additional_params()
File ~/work/anaconda3/envs/aquacrop/lib/python3.9/site-packages/aquacrop/entities/crop.py:191, in Crop.calculate_additional_params(self)
186 '''
187 Calculate additional parameters for all self types in mix
188 '''
190 # Fractional canopy cover size at emergence
--> 191 self.CC0 = self.PlantPop * self.SeedSize * 1e-8
192 # Root extraction terms
193 SxTopQ = self.SxTopQ
AttributeError: 'Crop' object has no attribute 'PlantPop'
I did it like this:
crop_soybean={'custom': {'Aer': 5.0,
'CCx': 0.98,
'CDC': 0.0015,
'CDC_CD': 0.02778,
'CGC': 0.005,
'CGC_CD': 0.10425,
'CalendarType': 2,
'CropType': 3,
'Determinant': 1.0,
'ETadj': 1.0,
'Emergence': 200.0,
'EmergenceCD': 10.0,
'Flowering': 600.0,
'FloweringCD': 30.0,
'GDD_lo': 0,
'GDD_up': 10.0,
'GDDmethod': 3,
'HI0': 0.4,
'HIstart': 1500.0,
'HIstartCD': 72.0,
'Kcb': 1.1,
'Maturity': 2700.0,
'MaturityCD': 133.0,
'MaxRooting': 1934.0,
'MaxRootingCD': 93.0,
'Name': 'custom',
'PlantMethod': 1.0,
'PlantPop': 330000.0,
'PolColdStress': 1,
'PolHeatStress': 1,
'SeedSize': 5.0,
'Senescence': 2200.0,
'SenescenceCD': 106.0,
'SwitchGDD': 0,
'SxBotQ': 0.012,
'SxTopQ': 0.048,
'Tbase': 5.0,
'Tmax_lo': 45.0,
'Tmax_up': 40.0,
'Tmin_lo': 3.0,
'Tmin_up': 8.0,
'TrColdStress': 1,
'Tupp': 30.0,
'WP': 15.0,
'WPy': 60.0,
'YldForm': 1180.0,
'YldFormCD': 60.0,
'Zmax': 2.0,
'Zmin': 0.3,
'a_HI': -9.0,
'b_HI': 3.0,
'dHI0': 10.0,
'dHI_pre': 3.0,
'exc': 50.0,
'fage': 0.3,
'fshape_r': 1.5,
'fshape_w1': 3.0,
'fshape_w2': 3.0,
'fshape_w3': 3.0,
'fshape_w4': 1,
'fsink': 0.5,
'p_lo1': 0.65,
'p_lo2': 1,
'p_lo3': 1,
'p_lo4': 1,
'p_up1': 0.15,
'p_up2': 0.6,
'p_up3': 0.7,
'p_up4': 0.85},
}
cult_crop=Crop('custom', planting_date=PlantingDate,harvest_date=HarvestDate, kwargs=crop_soybean['custom'])
model = AquaCropModel(sim_start_time=StartTime,
sim_end_time=EndTime,
weather_df=weather,
soil=soil,
crop=cult_crop,
initial_water_content=InitWC
)
Is correct? Or is it otherwise?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions