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

Don't write keywords with a None value to the files #661

Closed
tim-vd-aardweg opened this issue Jul 4, 2024 · 1 comment · Fixed by #663
Closed

Don't write keywords with a None value to the files #661

tim-vd-aardweg opened this issue Jul 4, 2024 · 1 comment · Fixed by #663
Labels
priority: high type: enhancement Improvements to existing functionality
Milestone

Comments

@tim-vd-aardweg
Copy link
Contributor

Until now, I thought that if a keywords is Optional and has a None value, that HYDROLIB-core would not write these keywords to the mdu file. However, recently we have added a lot of new research keywords that are all optional and have a default value of None. It turns out that if the user uses one research keywords, then all new research keywords will be written the mdu file. This is unwanted behaviour.

We then checked the behaviour for non-research keywords and we found that there are still a lot of regular keywords that do not have a default value. That problem will be tackled in #648.

In this issue we will change that HYDROLIB-core will no longer write keywords with a None value to the MDU file. The exception is for FileModels as they can't have a default value.

@tim-vd-aardweg tim-vd-aardweg added type: enhancement Improvements to existing functionality priority: high labels Jul 4, 2024
@tim-vd-aardweg tim-vd-aardweg added this to the Release 1.0 milestone Jul 4, 2024
@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Jul 4, 2024

To avoid that non-research keywords are not printed to the mdu, I looked up the default values in the FM kernel code for the keywords for which HYDROLIB-core sets None as a default.

Numerics > Comments > qhrelax: "Relaxation on Q-h open boundaries" (keyword not present in *.f90 files, deprecated?)
Numerics > fixedweirtopfrictcoef: -999 (src/dflowfm_data/m_flowparameters.f90)
Physics > itcap: 0 (src/dflowfm_data/m_flowparameters.f90)
Time > autotimestep: 1 (difficult to find in code, seems to be ja_timestep_auto in src/dflowfm_data/m_flowtimes.f90)
Time > startdatetime: ' ' (src/dflowfm_data/m_flowtimes.f90)
Time > stopdatetime: ' ' (src/dflowfm_data/m_flowtimes.f90)
Restart > restartdatetime: ' ' (src/dflowfm_data/m_flowtimes.f90)
ExternalForcing > rainfall: None (jarain in src/dflowfm_data/m_wind.f90, but keep consistent with windext)
ExternalForcing > qext: None (no search results, probably deprecated)
ExternalForcing > evaporation: None (jaevap in src/dflowfm_data/m_wind.f90, but keep consistent with windext)
ExternalForcing > windext: None (jawind=0 in src/dflowfm_data/m_wind.f90, but leads to unexpected results when not providing wind via ext file)
Trachytopes > trtmxr: 8 (md_mxrtrach in src/dflowfm_data/unstruc_model.f90)
Geometry > Comments uniformwidth1d: "Uniform width for channel profiles not specified by profloc" (src/dflowfm_data/unstruc_model.f90)
Geometry > uniformwidth1d: 2 (wu1Duni in src/dflowfm_data/m_flowgeom.f90)
Geometry > dztop: -999 (src/dflowfm_data/m_flow.f90)
Geometry > floorlevtoplay: -999 (src/dflowfm_data/m_flow.f90)
Geometry > dztopuniabovez: -999 (src/dflowfm_data/m_flow.f90)
Groundwater > Comments > groundwater: "0=No (horizontal) groundwater flow, 1=With groundwater flow"
Groundwater > Comments > hinterceptionlayer: "Intercept this amount of rain (m)"
Groundwater > hinterceptionlayer: 0? (no default value set)
Groundwater > bgrwuni: -999 (src/dflowfm_data/m_grw.f90)
Groundwater > sgrwini: -999 (src/dflowfm_data/m_grw.f90)
Processes > Comments > dtmassbalance: "waq mass balance output time step" >> deprecated keyword according to src/dflowfm_data/fm_deprecated_keywords.f90 

filepaths (indirectly in src/dflowfm_data/unstruc_model.f90)
should None not be replaced with this, just like for flowgeomfile and many others?
default_factory=lambda: DiskOnlyFileModel(None)

ExternalForcing > extforcefile (md_extfile)
ExternalForcing > extforcefilenew (md_extfile_new)
Trachytopes > trtdef: 
Trachytopes > trtl: 
Output > obsfile: 
Output > crsfile: 
Geometry > bathymetryfile:
Geometry > inifieldfile:
Geometry > thindamfile: 
Geometry > fixedweirfile: 
Geometry > pillarfile: 
Geometry > vertplizfile: 
Geometry > frictfile: 
Geometry > crossdeffile: 
Geometry > crosslocfile: 
Geometry > storagenodefile: 
Geometry > partitionfile: 
Geometry > gridenclosurefile:
Geometry > roofsfile:
Geometry > gulliesfile:
Particles > particlesfile:

And some outputdirs, might be best to set the defaults as ' ' instead of None or diskonlyfilemodel:

Output > outputdir: 
Output > waqoutputdir: 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high type: enhancement Improvements to existing functionality
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants