-
Notifications
You must be signed in to change notification settings - Fork 358
alpha-ctsm5.4.CMIP7.18.ctsm5.3.082: fsurdat validation tool #3612
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
Merged
slevis-lmwg
merged 2 commits into
ESCOMP:alpha-ctsm5.4.CMIP7
from
slevis-lmwg:fsurdat_validation_tool
Nov 18, 2025
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Validation/verification of new fsurdat files | ||
| # -------------------------------------------- | ||
| # WRITTEN by slevis after discussions with ekluzek. | ||
| # DATE of original script 2025/11/11. | ||
| # | ||
| # LOCATION: I first used this script in the directory | ||
| # .../inputdata/lnd/clm2/surfdata_esmf/ctsm5.4.0/validation | ||
|
slevis-lmwg marked this conversation as resolved.
|
||
| # | ||
| # CAVEAT: For new CTSM versions, use this script as a template with the | ||
| # understanding that aspects of the code will need to change. | ||
| # | ||
| # PURPOSE and DETAILS | ||
| # ------------------- | ||
| # This script | ||
| # 1) uses cprnc to compare ctsm5.4 versus ctsm5.3 files by generating | ||
| # cprnc.out files. | ||
| # 2) greps for fields with differences (RMS or NORMALIZED) that are >=1. | ||
| # The strictest grep threshold that I found isolates potentially | ||
| # unexpected changes is E-03. I determined this empirically using two | ||
| # types of problematic fsurdat files from the recent past: | ||
| # - No LAI, SAI, and heights for pfts 15 and 16. | ||
| # - No soil textures in parts of the world in unstructured grids. | ||
| # These "unexpected" fields appear alongside expected diffs (discussed | ||
| # below) when grepping for E+. Grepping for less than E-03 starts to | ||
| # capture fields with smaller differences and is likely to miss | ||
| # unexpected problematic fields. | ||
| # | ||
| # Step after running the script | ||
| # ----------------------------- | ||
| # Interactively and iteratively build this grep command to confirm that | ||
| # all fields in the script's grep output are expected. This list of | ||
| # fields is ctsm5.4-specific: | ||
| # >>> grep NORM grep_E+_surfdata_cprnc.out | grep -v ROOF | grep -v WALL | grep -v URBAN | grep -v BUILDING | grep -v abm | grep -v CANYON | grep -v CONST_HARVEST | grep -v ROAD | grep -v UNREPRESENTED_PFT | grep -v PCT_NATVEG | ||
|
slevis-lmwg marked this conversation as resolved.
|
||
| # | ||
| # If the grep command reveals unexpected fields, investigate. | ||
| # | ||
| # ----------------------------- | ||
| # | ||
| # Separate subjective comparison | ||
| # ------------------------------ | ||
| # >>> ncdiff surfdata_new.nc surfdata_old.nc surfdata_new_vs_old.nc | ||
| # >>> ncview surfdata_new_vs_old.nc | ||
| # Focus on fields with larger RMS diffs in the cprnc output. | ||
| # For ctsm5.4 I got approval for expected diffs from | ||
|
slevis-lmwg marked this conversation as resolved.
Outdated
|
||
| # - Keith Oleson for diffs in urban fields | ||
| # - Peter Lawrence for diffs in const_harvest, unrep_pft, pct_natveg, pct_nat_pft | ||
| # - Fang Li (a few months ago) for diffs in abm. | ||
| # ncvis works like ncview for unstructured grids (e.g. ne30), though it | ||
| # seems to crash when I give it a "diff" file generated by ncdiff. | ||
| # | ||
| # Another validation step | ||
| # ----------------------- | ||
| # Run mksurfdata_esmf with a different number of processors and confirm | ||
| # bit-for-bit same results. | ||
|
|
||
| echo "starting grids loop" | ||
|
|
||
| # The first loop of grids has different ctsm5.3 date stamp. | ||
|
slevis-lmwg marked this conversation as resolved.
Outdated
|
||
| # Skip ne3np4.pg2 as present only in ctsm5.4. | ||
| grids=("ne3np4") | ||
|
|
||
|
slevis-lmwg marked this conversation as resolved.
|
||
| for grid in "${grids[@]}" | ||
|
|
||
| do /glade/campaign/cesm/cesmdata/cseg/tools/cime/tools/cprnc/cprnc ../surfdata_$grid\_hist_1850_78pfts_c251022.nc ../../ctsm5.3.0/surfdata_$grid\_hist_1850_78pfts_c240925.nc >& surfdata_$grid\_hist_1850_78pfts_ctsm5.4v5.3.cprnc.out | ||
|
slevis-lmwg marked this conversation as resolved.
Outdated
|
||
| /glade/campaign/cesm/cesmdata/cseg/tools/cime/tools/cprnc/cprnc ../surfdata_$grid\_hist_2000_78pfts_c251022.nc ../../ctsm5.3.0/surfdata_$grid\_hist_2000_78pfts_c240925.nc >& surfdata_$grid\_hist_2000_78pfts_ctsm5.4v5.3.cprnc.out | ||
| echo "done $grid" | ||
|
|
||
| done | ||
|
|
||
| # Second loop of grids. | ||
|
slevis-lmwg marked this conversation as resolved.
|
||
| grids=("4x5" "10x15" "0.9x1.25" "1.9x2.5" "mpasa120" "mpasa480" "ne16np4.pg3" "ne120np4.pg3" "ne3np4.pg3" "ne30np4" "ne30np4.pg2" "ne30np4.pg3") | ||
| for grid in "${grids[@]}" | ||
|
|
||
|
slevis-lmwg marked this conversation as resolved.
|
||
| do /glade/campaign/cesm/cesmdata/cseg/tools/cime/tools/cprnc/cprnc ../surfdata_$grid\_hist_1850_78pfts_c251022.nc ../../ctsm5.3.0/surfdata_$grid\_hist_1850_78pfts_c240908.nc >& surfdata_$grid\_hist_1850_78pfts_ctsm5.4v5.3.cprnc.out | ||
| /glade/campaign/cesm/cesmdata/cseg/tools/cime/tools/cprnc/cprnc ../surfdata_$grid\_hist_2000_78pfts_c251022.nc ../../ctsm5.3.0/surfdata_$grid\_hist_2000_78pfts_c240908.nc >& surfdata_$grid\_hist_2000_78pfts_ctsm5.4v5.3.cprnc.out | ||
|
slevis-lmwg marked this conversation as resolved.
Outdated
|
||
| echo "done $grid" | ||
|
|
||
| done | ||
|
|
||
| # Third loop of grids. | ||
|
slevis-lmwg marked this conversation as resolved.
|
||
| # Skip mpasa30 as present only in ctsm5.4. | ||
|
slevis-lmwg marked this conversation as resolved.
Outdated
|
||
| # Skip 1850 as only 2000 is present. | ||
| grids=("mpasa3p75" "mpasa15" "mpasa60") | ||
| for grid in "${grids[@]}" | ||
|
|
||
| do /glade/campaign/cesm/cesmdata/cseg/tools/cime/tools/cprnc/cprnc ../surfdata_$grid\_hist_2000_16pfts_c251022.nc ../../ctsm5.3.0/surfdata_$grid\_hist_2000_16pfts_c240908.nc >& surfdata_$grid\_hist_2000_78pfts_ctsm5.4v5.3.cprnc.out | ||
| echo "done $grid" | ||
|
|
||
| done | ||
|
|
||
| # grep for E+ to catch larger diffs. | ||
| for file in surfdata_*cprnc.out | ||
| do grep -H NORM $file | grep 'E+' >> grep_E+_surfdata_cprnc.out | ||
| done | ||
|
|
||
| exit | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.