Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileX is not written correctly #31

Open
aarojas20 opened this issue Jun 2, 2022 · 1 comment
Open

FileX is not written correctly #31

aarojas20 opened this issue Jun 2, 2022 · 1 comment

Comments

@aarojas20
Copy link
Contributor

aarojas20 commented Jun 2, 2022

Describe the bug
The writing of a fileX does not follow the strict formatting rules for DSSAT data input. I am looking for guidance on how to best update the package to address this issue.

To Reproduce
Steps to reproduce the behavior:

  1. Minimalistic example (the shortest complete code that causes the mistake)
  • Read the fileX and get the emergence data.
from tradssat.exper import exper_file
mzx_file = exper_file.ExpFile("../data/Maize/IUAF9901.MZX")
mzx_file.get_value("EDATE")

> array([-99, -99, -99, -99])

  • Change the emergence date.
mzx_file.set_value("EDATE", 99154)
mzx_file.get_value("EDATE")

> array([99154, 99154, 99154, 99154])

  • Write a new fileX with the updated emergence date.
    mzx_file.write("../data/Maize_Iowa_tradssat/IUAF9901.MZX")
  1. Version of traDSSAT (tradssat.__version__) and operating system (Linux, Windows, Mac, ...)
  • traDSSAT version is 0.1.5
  • My OS is MacOS Catalina Version 10.15.7
  1. A copy of any DSSAT input file(s) involved

Expected behavior
The newly written .MZX file does not match the one that is provided by DSSAT. The formatting is off. (I have provided a few screen shots to illustrate this where the left one shows the original MZX and the file on the right shows the one that is re-written with tradssat.) As a result, the DSSAT software cannot read the newly written file correctly, and a simulation is terminated.

Additional context
I performed a similar exercise for a .WTH file, and I was successfully able to use the newly written .WTH in a DSSAT simulation.
I attached the original .MZX file (saving it as a .txt file bc github doesn't allow me to upload a .mzx file)
Screen Shot 2022-06-02 at 12 38 37 PM
Screen Shot 2022-06-02 at 12 39 32 PM
GHWA0401.txt
Below, I show the warning and error outputs from the DSSAT simulation. Somehow, it is having trouble recognizing the FIELD section.
Screen Shot 2022-06-02 at 1 05 21 PM

@julienmalard
Copy link
Owner

Many thanks @aarojas20 for the very complete error report! I will be away from the internet for a few days but will look into this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants