daquinterop / Py_DSSATTools

A Python library for crop modeling using DSSAT
GNU General Public License v3.0
45 stars 16 forks source link

Corn simulation using irrigation schedules that do not accept irrigation data correctly #42

Open wuyanwanwu opened 6 days ago

wuyanwanwu commented 6 days ago

Hello, when I use DSSATTools for corn simulation, I found that the parameter name of the timetable is different from the example, there is a parameter “IRVAL” in the example, but the value is wrong at runtime, I checked the source code and found that it is now “IVAL”, I made the corresponding modification, and the code can be run normally. But the output result “SoilWat” in the “IR#C” and “IRRC” value are 0. Using the code version of 2.1.3 and the code to produce a schedule is as follows. By the way, I would like to ask you how the GSTDs of corn fertility are represented by codes in the output “PlantGro”, and how they are related to the fertility.

Code: schedule = pd.read_excel("Rain-Runoff.xlsx") schedule = pd.concat([schedule, pd.DataFrame({"Date": ['2024-06-09'], "Depth": [30]})]) schedule['IROP'] = 'IR001'
schedule.columns = ['IDATE', 'IVAL', 'IROP'] schedule = schedule[['IDATE', 'IROP', 'IVAL']] schedule["IDATE"] = pd.to_datetime(schedule["IDATE"]) schedule["IDATE"] = schedule["IDATE"].dt.strftime('%Y%j') schedule.sort_values(by="IDATE", inplace=True, ascending=True) schedule = schedule.reset_index(drop=True)

# Man
date = pd.to_datetime("2024-06-09")
man = Management(
    planting_date=date,
)
# Modify harvest to Maturity
man.simulation_controls['HARVS'] = 'M'
# Set the irrigation schedule
man.irrigation['table'] = TabularSubsection(schedule)
# Set irrigation control as reported schedule
man.simulation_controls['IRRIG'] = 'R'
daquinterop commented 5 days ago

Hi. Yes, in some of the DSSAT Experimental files the Irrigation amount is on the "IVAL" column and in others is on the "IRVAL". Now I'm working in a new version that would support both as the DSSAT GUI does. About the output result, can you also check the OVERVIEW file? The total irrigation amount you set must be reflected in that file. I did not understand you last question, what do you mean by GSTDs of corn fertility?

wuyanwanwu commented 18 hours ago

Thanks you! I found the OverView file in the temporary process folder, which has the explicit fertility name and time data I need.