NCAR / wrf_hydro_py

Python API for the WRF-Hydro model
59 stars 43 forks source link

switching between the namelist options requires a re compile #227

Open arezoorn opened 3 years ago

arezoorn commented 3 years ago

When I added a new namelist configuration to the json files, I had to recompile. Compilation should be independent of the json files except from the compile json file, but I do not think they are. I usually recompile with every change in the json files to be cautious but sometime I forget and I get into trouble.

rcabell commented 3 years ago

You should be able to cd to an empty directory and re-run compose on the simulation object. That being said, a recompose option would be nice to have!

arezoorn commented 3 years ago

The experiment directory should always be non existing, otherwise it will complain that the directory exists. But I am not sure if you mean that by your comment.

rcabell commented 3 years ago

You can use os.mkdir() and/or os.chdir() to create or switch to an empty directory and then rerun compose. That should work, in theory. If it doesn't, then there should be a code change to support that.

On Sat, Nov 28, 2020 at 10:46 arezoorn notifications@github.com wrote:

The experiment directory should always be non existing, otherwise it will complain that the directory exists. But I am not sure if you mean that by your comment.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NCAR/wrf_hydro_py/issues/227#issuecomment-735268400, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHEYLTZJBUQ5WYB3UXHYVWDSSEZOFANCNFSM4UFRJCQQ .

jmccreight commented 3 years ago

The heart of the matter is that the (run-time) model-side namelist goes into the model object and when it is restored, the model-side namelist from compile-time is restored.

I think the most elegant way to handle this is a Model.restore() method which takes an optional model-side namelist path and warns when it is not supplied.

In the mean time, one can manually edit this but it's not very elegant.

jmccreight commented 3 years ago

Simply recomposing wont solve the problem which is that a pickled model object has a previous model-side name list. Alternatively, pickling the model object could remove that namelist and then the namelist path i suggested previously would be required. There are pros and cons.

I'd have to look, but I'm not sure you can compose twice (without starting over). IE, I think that compose flags something in the simulation object like is_composed.

Composed is a bad term (joe and I argued over this), because the solution is to "recompose" the simulation object (start it over) and then compose to a new/fresh dir.