Rethinking (variables in) h2 files for GDD-generating workflow
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 6d 6h
- Merged PRs (30d)
- 8
Description
The GDD-Generating phase of the RXCROPMATURITY test requests two variables, `GDDACCUM` and `GDDHARV`, on its h2 tape(s). From ctsm5.3.062:
https://github.com/ESCOMP/CTSM/blob/400bfa03d3b97da2422235c468c2c8ac30afde23/cime_config/SystemTests/rxcropmaturity.py#L134-L149
Those variables are used to generate crop growing degree-day requirement files to be used in the second part of the test. That happens via a Python script that, before the split-up of accumulated vs. instantaneous files in ctsm5.3.062, were looking for a file with `.h2.` in it. From the tag before that:
https://github.com/ESCOMP/CTSM/blob/4c379f215c93180f374445b3da00ab26843c66e7/python/ctsm/crop_calendars/generate_gdds_functions.py#L567-L569
Both of those variables are time-averaged by default:
https://github.com/ESCOMP/CTSM/blob/400bfa03d3b97da2422235c468c2c8ac30afde23/src/biogeochem/CropType.F90#L288-L291
https://github.com/ESCOMP/CTSM/blob/400bfa03d3b97da2422235c468c2c8ac30afde23/src/biogeochem/CNVegStateType.F90#L329-L331
I thus expected that, for ctsm5.3.062, the Python script would need to be changed to look for `.h2a.` in the filenames. However, during that work (PR #2445), @slevis-lmwg noticed that didn't solve the problem—only `.h2i.` worked.
This was pretty confusing until I had a look at the `user_nl_clm` file. I noticed that, far above the `hist_fincl3 = 'GDDACCUM', 'GDDHARV'` line requested by RXCROPMATURITY, there was `hist_avgflag_pertape(3) = 'I'`. This is because the RXCROPMATURITY tests in `aux_clm` use the `cropMonthOutput` testmod, which inherits from `crop`, which has this in its `user_nl_clm`:
https://github.com/ESCOMP/CTSM/blob/400bfa03d3b97da2422235c468c2c8ac30afde23/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm#L12-L20
Initially, I thought I would just add another line to the RXCROPMATURITY GDD-Generating phase `user_nl_clm` changing it back:
```
hist_avgflag_pertape(3) = 'A'
```
Then I realized that it might actually be better for `GDDACCUM` to be instantaneous in the GDD-generating workflow, to represent the accumulated growing degree-days from planting to the end of the output timestep (rather than the average of that value for all model timesteps in the output timestep). It doesn't make much difference for this test, since the outputs are daily, and anyway we don't care about the scientific correctness for a pass/fail test. But we do care about the correctness of the real workflow, even though the difference would probably be small there too.
THEN I realized that `GDDHARV` (growing degree-days required for the crop to reach maturity) is in the exact same situation. It's useful for this workflow to have it synced with `GDDACCUM`, and thus it should be instantaneous too.
(I went on a long sojourn where I thought maybe these should be instantaneous *by default*, but I realized it's really just this uncommon workflow where instantaneous is useful.)
So here's what I think I should do:
1. Test setting `hist_avgflag_pertape(3) = 'I'` vs. `'A'` in real GDD-generating runs (not just in this test). Does it break things? It should make just a slight difference. **The difference is slight; see #3320.**
If it's a big difference, that bears more investigation. If it's only a slight difference:
2. Change the default GDD requirement files for CTSM to use the `I` results, because I'm pretty sure I didn't set `hist_avgflag_pertape(3) = 'I'` before. (I also never generated GDD requirements based on CRU-JRA! So this will serve that purpose as well.)
3. Add an explicit `hist_avgflag_pertape(3) = 'I'` in `user_nl_clm` for the GDD-Generating phase of RXCROPMATURITY tests (to avoid relying on the inheritance from the `crop` testdef), and add comments in various places explaining it.
4. Update the [documentation of the GDD-generating workflow](https://escomp.github.io/CTSM/users_guide/running-special-cases/Running-with-custom-crop-calendars.html#generating-maturity-requirements) to include that line as well.
5. Try deleting `hist_avgflag_pertape(3) = 'I'` from the `crop` testdef's `user_nl_clm` (after #3314 is merged).
Contributor guide
Assessment
This issue has not been assessed yet.