fsurdat_modifier should fail if subgrid_fractions section is incomplete
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 6d 6h
- Merged PRs (30d)
- 8
Description
Presently, it's possible to have an `fsurdat_modifier` config file with this specification:
```
[modify_fsurdat_subgrid_fractions]
PCT_CROP = 100.0
PCT_NATVEG = 0.0
PCT_GLACIER = 0.0
PCT_LAKE = 0.0
PCT_URBAN = 0.0 0.0 0.0
```
`fsurdat_modifier` will happily set all those and leave the missing item, `PCT_WETLAND`, alone. If `PCT_WETLAND` is nonzero anywhere on the original file, this will eventually cause a "weights do not sum to 100" error in the CESM run.
`fsurdat_modifier` only checks that the _provided_ `PCT_` variables sum to 100. I think it would make more sense for it to also fail if any `PCT_` variable is missing from the configuration file (if the `modify_fsurdat_subgrid_fractions` section is present, that is). Is there a reason this isn't the case?
For future-proofing, `fsurdat_modifier` could derive [`valid_list`](https://github.com/ESCOMP/CTSM/blob/c030c2342dac53d30ed419aca262db8fa7213ee6/python/ctsm/modify_input_files/fsurdat_modifier.py#L113) from the input surface dataset, rather than the list being hard-coded and needing an update with every CTSM version.
(This arose in @slevis-lmwg's testing of the RXCROPMATURITY SystemTest with CTSM5.2, which splits `PCT_OCEAN` out of `PCT_WETLAND`. [As you can see](https://github.com/ESCOMP/CTSM/blob/c030c2342dac53d30ed419aca262db8fa7213ee6/cime_config/SystemTests/rxcropmaturity.py#L325), RXCROPMATURITY didn't include `PCT_OCEAN`.)
Contributor guide
Assessment
This issue has not been assessed yet.