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

Develop a tool for generating SLIM surface datasets (surdat files) #71

Merged
merged 48 commits into from
May 24, 2023

Conversation

slevis-lmwg
Copy link
Collaborator

@slevis-lmwg slevis-lmwg commented Mar 8, 2023

Fixes #36

As of opening this PR, my code reads a ctsm history file and outputs a file that contains:
glc_mask
lsmlon
lsmlat

Note that I started this branch from my surdat_modifier branch to avoid repeating a bunch of shared python work between that branch and this one.

I need to check with @marysa what calculations I need to include to generate a surdat file.

I happened to start with the version sitting in my new_rawpftlai branch
with git describe
alpha-ctsm5.2.mksrf.14_ctsm5.1.dev111-5-gb1204ca46
SLIM's usermods_dirs/global_uniform uses this file:
/glade/p/cesmdata/cseg/inputdata/lnd/slim/surdat/globalconst_alpha0.2_soilcv2e6_hc0.1_rs100.0_glc_hc0.01_f19_cdf5_20211105.nc
and I looked at it for guidance in selecting idealized defaults.
make stest and make utest run 2 and 7 tests respectively and complete
successfully
@slevis-lmwg slevis-lmwg self-assigned this Mar 8, 2023
Resolved conflicts:
tools/README
Used as a template the jupyter notebook that Marysa recommended
@slevis-lmwg
Copy link
Collaborator Author

slevis-lmwg commented Mar 21, 2023

I need to add metadata to the surdat variables (see suggestion in this post)

@slevis-lmwg
Copy link
Collaborator Author

I generated this file with the jupyter notebook:
/glade/work/slevis/git_slim/surdat_modifier/python/slim/mksurdat/surdat_20230323.nc
...and ran this case successfully:
/glade/u/home/slevis/cases_slim/slim_cam5_som_f09_g16_example

To review this work, others (@ekluzek, @marysa?, @islasimpson?) could look at and/or run this jupyter notebook draft by checking out my branch and following the instructions in /glade/work/slevis/git_slim/surdat_modifier/tools/mksurdat/README.mksurdat

@ekluzek we can discuss in more detail at Stand-up tomorrow.

@marysa
Copy link
Collaborator

marysa commented Mar 24, 2023

Taking a look at these notebooks now!

@slevis-lmwg
Copy link
Collaborator Author

slevis-lmwg commented Mar 24, 2023

Thank you @marysa!
In the last couple of days I have had trouble starting up a jupyter notebook on a casper login, but no trouble on a cheyenne login node. Mentioning in case you encounter the same.

Oh, also I should mention that your comments are welcome, though I will not respond for a few weeks due to travel.

@marysa
Copy link
Collaborator

marysa commented Mar 24, 2023

No luck yet; I'm confused on a few fronts:

  1. a) Is there a notebook somewhere, or should I be following the instructions in the README in tools/modify_input_files to run the .py files in python/slim/modify_input_files/ ?

  2. b) if there is a notebook, where do I find it?

  3. If I follow the README.surdat_modifier in tools/modify_input_files, I run into problems partway through step 1, because I can't find ./py_env_create , and from there can't activate the slim_pylib environment. Without that, I haven't tried to move on to step 2 yet, though I'm sure I can make an environment with the right packages by checking the .py scripts - but before doing that, I want to make sure I should be doing it this way, and not via a notebook somewhere that I haven't found yet.

@marysa
Copy link
Collaborator

marysa commented Mar 24, 2023

oooooh possibly scratch that, I see the .ipynb in your folder, just didn't have them in the copy I pulled from github. I'll copy yours and give it a go!

@ekluzek ekluzek marked this pull request as ready for review May 3, 2023 20:23
@ekluzek
Copy link
Collaborator

ekluzek commented May 3, 2023

@slevisconsulting and I talked about this. This can come in when it's ready. It's completion updates the minor version number of SLIM as it makes SLIM into a complete package. The PR I'm working on is on a different branch, and orthogonal to this, so the order doesn't matter.

This will need to be updated and conflicts resolved to make it compatible with the latest cesm2_1_slim branch. That update will make it easier to see what this actually brings in.

@ekluzek ekluzek self-requested a review May 3, 2023 20:27
@ekluzek ekluzek added the enhancement New feature or request label May 3, 2023
Copy link
Collaborator

@ekluzek ekluzek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a rough review. And we went over it together.

We should probably update that review when this is updated to the latest cesm2_1_slim branch, as that will affect what's actually here on the branch.

Modify the test mods so that fewer can be used. compsets set the scenario for most cases, and only use test mods if needed. Also add prealpha, prebeta and slim_sci test lists. Work on the README files a bit. Also don't remove all the history fields and add a list, just use the default list.

Resolved conflicts:
python/Makefile
python/README.md
python/pyproject.toml
python/slim/.pylintrc
python/slim/path_utils.py
python/slim/utils.py
I generally kept the mods from the slim0.2.002_release-cesm2.1.4 tag.
However in python/slim/utils.py I added back a couple of functions
and a few imports so that "make test" would pass. Test resutls:
make test  PASS
make black PASS
make lint gives this error:
slim/modify_input_files/modify_surdat.py:169:19: E0602: Undefined variable 'os' (undefined-variable)
I will resolve this when I finalize PR ESCOMP#69 which pertains to
modify_surdat.py
@slevis-lmwg
Copy link
Collaborator Author

In addition to the performed tests that I listed in the last commit notes, I also reran the python notebook from this PR and got bit-for-bit the same surdat file from it as before (last file I had generated in March).

@slevis-lmwg
Copy link
Collaborator Author

slevis-lmwg commented May 12, 2023

Running the test-suites.

Cheyenne gnu OK except in some tests I get this NLCOMP difference. @ekluzek is it a problem?

Comparison failed between '/glade/work/slevis/git_slim/surdat_modifier/cime/scripts/cases/SMS_D_Lm1_PS.f19_f19_mg17.I2000SlimRsGs.cheyenne_gnu.slim-Monthly.GC.20230512_122012_eb062g/CaseDocs/atm_modelio.nml' with '/glade/p/cgd/tss/ctsm_baselines/slim0.2.002_release-cesm2.1.4/SMS_D_Lm1_PS.f19_f19_mg17.I2000SlimRsGs.cheyenne_gnu.slim-Monthly/CaseDocs/atm_modelio.nml'
  BASE: pio_typename = 'netcdf'
  COMP: pio_typename = 'pnetcdf'

Cheyenne intel OK
Izumi OK

This test passed when I reran it:
ERS_D_Ld5_PS.f45_f45_mg37.I2000SlimRsGs.izumi_gnu.slim-default

@ekluzek
Copy link
Collaborator

ekluzek commented May 12, 2023

@slevis-lmwg I see those differences on occasion as well. I'm not sure why they happen. It's just changing the PIO type so should be identical. We do want to be using pnetcdf, and my baseline is the one without pnetcdf, so yours is correct anyway. Maybe there is a hidden environment variable that is different between the two of us?

@slevis-lmwg slevis-lmwg merged commit 3ccea41 into ESCOMP:cesm2_1_slim May 24, 2023
@slevis-lmwg slevis-lmwg deleted the mksurdat_iss36 branch May 24, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add metadata to mml_surdat files, ideally using a mksurdat tool than can also generate such files
3 participants