daquinterop / Py_DSSATTools

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

Max values for Maize genetic coef #10

Closed taynaravaleriano closed 1 year ago

taynaravaleriano commented 1 year ago

When I set a value above 999, for P5 and G2 genetic coeficients I get an error and in the MZCER048.CUL created the value is like *****

IB0200 DK7220PRO4 . IB0001 275.0 0.0 ***** 800.0 6.30 38.00

daquinterop commented 1 year ago

Maximum possible values for P5 and G2 coefficients are 999.0 and 990.0 respectively. See https://github.com/DSSAT/dssat-csm-os/blob/develop/Data/Genotype/MZCER048.CUL for further detail. Furthermore, the Fortran format for those fields is F5.1, it means that the value for those parameters must fit in 5 characters with one decimal place. You can tell that the former condition can't be met when values are above 999.

taynaravaleriano commented 1 year ago

Thank you for your reply.

I got it about the maximum values. However, agronomically these values can be higher than 999, since we have new hybrids. So I would like to know if it is possible to change the code to accept this values.

daquinterop commented 1 year ago

Unfortunately making those changes is beyond my reach since it would require to change the DSSAT source code. You're right about it, in this case I'd recommend you to write to DSSAT team, they can tell you if it's possible to make those changes for a future release. However, if you are confident enough with FORTRAN, you can try to make those changes yourself. Then you can recompile the model and use that exe instead of the one provided by the DSSATTools.

Also you can try to manually modify the cultivar file providing the value you need, if DSSAT runs then I can work on the Fortran formatting part so that the library generates the cultivar file with the value you want.

taynaravaleriano commented 1 year ago

Yes, I manually modified the cultivar value in DSSAT and it worked. Could you, please, check if it is possible to manage this in fortran?