-
Notifications
You must be signed in to change notification settings - Fork 13
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
Unable to add new variables to create an input file from scratch #28
Comments
Hello, Thanks for this suggestion! This would indeed be an important functionality. If you would like to work on a PR, that would be very much appreciated...at the same time I have been wondering whether this might be a good time to re-work traDSSAT a bit to use pandas as internal storage for data. If you think that using pandas internally could make this pull request easier, perhaps we could collaborate on getting this (probably inevitable, in the long run!) change done? |
Thanks @julienmalard , Here is an excerpt,
where
I am not sure to whether to be concerned about the first empty section, as a result of instantiating from an empty .SOL file. Moving forward with a PR:
|
Hello, Looks good to me! Which empty section in particular are you referring to - do you mean the It would of course be much better to have a standard (non-hack) way of doing this with a special function. If you can make a PR along those lines (ideally with a test case in the test suite - please let me know if you would need pointers on that) I would be really grateful. Regarding pandas, I think that having each subsection as a dataframe would make the most sense. We would still have to keep the initial variable definitions, etc. in order to parse and write correctly to each DSSAT file (so the dataframe would be for internal purposes only, but would probably make maintaining and improving the code much easier). What do you think? |
Hi @julienmalard , Thanks for the solution to removing the empty section! Thanks for the feedback as well. That sounds good; I'll work on a PR to integrate the above. If I have any follow-up questions I'll let you know. |
Thanks @aarojas20 ; I'll look forward to your PR then. |
Hi @julienmalard, I've been working on this in between other projects, and it has taken me longer than expected as a result. I was able to create a new .SOL, .WTH, and a new fileX from scratch; however, the FileX was not recognized by DSSAT. I tried a more simple exercise with an existing fileX provided by DSSAT, and I found that the newly written fileX was not recognized by DSSAT. I have outlined this new issue: #31 |
Describe the bug
Hello, I would like to create a .SOL input file from scratch, ie from other experimental data or databases. From what I can understand, I can only edit values from an existing .SOL file. Is there a way to write a .SOL file from scratch, or perhaps I am missing how?
To Reproduce
SoilFile
object from an empty file with an asterisk in it. (Note, github does not allow me to upload the .SOL file here; hence, I am uploading a .txt file,empty.txt
. One can change this back toempty.SOL
)soil._values.add_section("field_id")
soil._values.set_value("SALB", 0.2, sect="field_id")
self._values
, it cannot add the variable:ValueSection.set_value
in tradssat/tmpl/vals.py258 if not success:
--> 259 raise ValueError('Variable "{}" not found.'.format(var))
empty.txt
Expected behavior
Given the known allowable variables, ie
SoilFile.variables()
, it would be great to add values to an input soil file. Please let me know if this enabled or if you can you provide guidelines on how to include this. Happy to work on a subsequent PR if that helps.The text was updated successfully, but these errors were encountered: