Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
2c41b24
Initial plan
Copilot Feb 6, 2026
13a373a
Add transposed output support to eamxx IO
Copilot Feb 6, 2026
b9c376b
Add documentation for transpose output feature
Copilot Feb 6, 2026
80a9525
Fix transpose helper field lookup bug and refactor
Copilot Feb 6, 2026
7e82c6f
Fix typo and add clarifying comment
Copilot Feb 6, 2026
50c4135
Add data type to transposed helper field naming
Copilot Feb 6, 2026
a26fa57
Add unit test for transposed output with all averaging types
Copilot Feb 6, 2026
faa0c31
Update io_transpose test to use compare-nc-files script
Copilot Feb 6, 2026
28ad3a1
Skip decomposition stride check for transposed output
Copilot Feb 6, 2026
99450a4
Skip units check in transpose when either field has invalid units
Copilot Feb 6, 2026
0121704
Update compare-nc-files script to accomodate transposed files.
AaronDonahue Feb 9, 2026
d0bff0a
Add --allow_transpose flag to io_transpose test comparisons
Copilot Feb 9, 2026
40a15d8
Fix decomposition offset calculation for transposed output
Copilot Feb 9, 2026
ad7313b
Fix transposed output decomposition and optimize sync_to_host
Copilot Feb 13, 2026
16ebe68
Fix transposed decomposition to iterate in correct memory order
Copilot Feb 13, 2026
0697de6
Add data validation to io_transpose test
Copilot Feb 13, 2026
4b62739
Fix build errors in io_transpose test
Copilot Feb 13, 2026
bd3e8f2
MPAS-framework: add attribute validation fns for XML stream parsing
matthewhoffman Feb 26, 2026
798a696
MPAS-framework: add child tag validation fns for XML stream parsing
matthewhoffman Feb 26, 2026
aba7b23
MPAS-framework: add fn to validate root element of streams XML
matthewhoffman Feb 26, 2026
4a35878
MPAS-logger: subtle adjustment to var declaration
matthewhoffman Feb 26, 2026
cdf5848
Fix tolerance handling in compare-nc-files script
Copilot Feb 27, 2026
f9596db
Initial plan
Copilot Mar 6, 2026
4ba9170
Fix timer mismatch in EcosystemDynMod.F90: use t_stop_lnd instead of …
Copilot Mar 6, 2026
f4bfe9b
ELM-side changes for outputting biophysics variables by land use type
ckoven May 9, 2025
1e7de5c
update allvars to be alphabetically sorted with one variable per line
glemieux Feb 28, 2026
2493a63
update allvars elm user namelist with new inactive variables
glemieux Feb 28, 2026
f4f3d6d
update LUH2 testmod variable list to be alphabetical and one variable…
glemieux Feb 28, 2026
434a746
add fates testmod variables to luh2 user namelist def
glemieux Mar 1, 2026
905f3b5
add TRENDY luh2 specific history outputs to testmod
glemieux Mar 1, 2026
3e070f2
remove invalid output for this testmod
glemieux Mar 2, 2026
772f270
Replace t_start_lnd/t_stop_lnd with t_startf/t_stopf in all ELM files
Copilot Mar 10, 2026
dd041d4
Update physical constants from PhysicalConstantsDictionary
github-actions[bot] Mar 12, 2026
bcb5499
Initial plan
Copilot Mar 13, 2026
c569418
Fix HOMME CMake for Intel LLVM compilers and add pm-cpu BFB machine file
Copilot Mar 13, 2026
41da870
Fix ICE with oneapi-ifx v2025.2.0 on Chrysalis
amametjanov Mar 13, 2026
4394fa4
Apply copilot suggestion
amametjanov Mar 14, 2026
e5fd84f
Initial plan
Copilot Mar 16, 2026
0569901
update fates commit hash to sci.1.91.1_api.43.1.0
glemieux Mar 16, 2026
7cb6a02
EAMxx: Field default constructor creates a Field with a valid header
Copilot Mar 16, 2026
0a6d6aa
Use ZEN3 instead of ZEN2 kokkos arch for these AMDs to avoid compiler…
ndkeen Mar 17, 2026
4be6ebb
add wav2ice remap files
erinethomas Dec 16, 2025
ce575ca
add wave-ice namelist settings
erinethomas Dec 16, 2025
dc99232
wave-ice coupling vars in ice_comp_mct
erinethomas Dec 16, 2025
1df14d1
wave-ice coupling for mpassi_cpl_indices.F
erinethomas Dec 16, 2025
1880be6
wave-ice coupling mods for Registry
erinethomas Dec 16, 2025
c8a96e1
wav-ice Registry_incremental_remapping
erinethomas Dec 16, 2025
4d282cb
wave-ice couplign for mpas_seaice_icepack.F
erinethomas Dec 17, 2025
f5f1dee
WW3 namlist settings for wav-ice coup
erinethomas Dec 17, 2025
1d3299d
ice vars in wav_comp_mct.F90 + ww3_cpl_indices.f90
erinethomas Dec 17, 2025
17aa767
change wav_ice flag to "twoway"
erinethomas Dec 17, 2025
59c0f0f
add wav to ice smap
erinethomas Dec 17, 2025
159ab76
add wav2ice smap to namelist_definition_drv.xml
erinethomas Dec 17, 2025
331ba5f
wav-ice coupling to cime_comp_mod.F90
erinethomas Dec 17, 2025
f48f51f
wav ice coupling infrastucture in driver mct
erinethomas Dec 17, 2025
2333f10
fixes to seq_flds_mod.F90 for wav-ice coupling
erinethomas Dec 17, 2025
c149321
add shr_wave_mode for freq calculation
erinethomas Dec 17, 2025
40ac782
rebase cleanup
erinethomas Dec 18, 2025
b60f4c1
PR cleanup for waveice coupling using icepack 1.5.0
erinethomas Feb 28, 2026
600ee2d
clean up WaveIceCoupling PR
erinethomas Feb 28, 2026
0f51cc4
wav_ice_coup fix
erinethomas Mar 7, 2026
9b77a8c
bug fix for wav_ice_coup = oneway
erinethomas Mar 10, 2026
c2f511e
wave coupling for icepack version 150
erinethomas Mar 11, 2026
8c280ca
patch for one-way wave-ice coupling (WW3 should not recieve floe sizes)
erinethomas Mar 11, 2026
555728a
fix ice_comp_mct wave variables - to match the new ix2 framework
erinethomas Mar 17, 2026
9720803
Update EKAT submodule
bartgol Mar 17, 2026
16ad6f1
EAMxx: change assumptions of mask fields
bartgol Mar 17, 2026
37d1b5f
EAMxx: turn sunlit_mask field into an int-valued field
bartgol Mar 17, 2026
711966e
EAMxx: minor changes to horiz remapper related to masks
bartgol Mar 17, 2026
8cd0606
EAMxx: fix flawed method in AbstractRemapper
bartgol Mar 17, 2026
fb442da
EAMxx: propagate mask to subfields
bartgol Mar 17, 2026
9296a59
EAMxx: reinstate a couple of "may_be_filled" flags
bartgol Mar 17, 2026
9724201
EAMxx: avoid dangling refs in horiz remapper when processing masks
bartgol Mar 18, 2026
cc01a08
EAMxx: remove lazy/unnecessary assumption in FieldManager
bartgol Mar 18, 2026
bd561ba
EAMxx: fix issue when adding postcondition nan checks
bartgol Mar 18, 2026
1ea27cd
for SHOC 1p5 TKE option revert the length scale formulation back to d…
Feb 19, 2026
19abe29
update tests to remove specific length scale for 1p5 tke
Feb 19, 2026
9ef4b21
bug fixes for length scale inputs
Feb 23, 2026
36d8330
revert eddy diffusivities back to default definition to maintain stab…
Feb 23, 2026
3a3eed8
fixes so that property tests compile, run, and pass
Feb 23, 2026
b0cfca0
change IOP subsidence calculation from finite centered to semi lagran…
May 30, 2025
efce74c
spacing issue
May 30, 2025
b13d8e9
move where lininterp is established
May 30, 2025
64da9b5
sl subsidence with inline linear interpolation routine
May 31, 2025
aff7d6c
update comments for SL iop routine
Jun 3, 2025
49798dd
add draft of revised routine that compiles but does not run
Feb 24, 2026
8c21fea
commit before refactor
Feb 25, 2026
90e7e14
save mods before experimentation
Feb 26, 2026
613f81f
commit version that is compiling but bailing out on the first time st…
Feb 27, 2026
f387a89
commit for version that is compiling but seg faulting
Mar 2, 2026
fa404e9
clean up and small refactor
Mar 3, 2026
db5110f
clean up
Mar 3, 2026
257cd4d
line spacing fix, reduce number of allocated workspace, and initializ…
Mar 3, 2026
f59823a
fix to setup linear interpolation, as well as implmentation, reduce n…
Mar 4, 2026
0e9da3e
remove unneed inputs from iop_subsidence call
Mar 5, 2026
55691d0
remove unneeded team barriers and clean up a comment
Mar 10, 2026
4f219e6
Merge branch 'bogensch/dpxx_subsidence_SL' (PR #7413)
tcclevenger Mar 18, 2026
44fd178
Merge branch E3SM-Project/copilot/ndkhommefix-cmake-logic-for-intel (…
ndkeen Mar 18, 2026
fc81d91
Merge branch 'bogensch/eamxx/shoc_1p5_revision' (PR #8106)
tcclevenger Mar 18, 2026
af69f06
Merge branch 'copilot/fix-field-default-constructor' (PR #8186)
bartgol Mar 18, 2026
958963c
EAMxx: fix sunlit masks in cosp for tauctp/taucth fields
bartgol Mar 18, 2026
6990c72
EAMxx: improved error msg in Field::get_view
bartgol Mar 18, 2026
18fc869
Fix for CI ZM non bfb issues with cape routines
jgfouca Mar 19, 2026
8aea4d7
Merge branch 'update-pcd-constants-20260312-162859' (PR #8165)
rljacob Mar 19, 2026
a1d8de8
EAMxx: add support for int-valued fields in bfb hash
bartgol Mar 19, 2026
afec87c
Fix markdown linting error: use descriptive link text
Copilot Mar 19, 2026
c181c41
Merge branch 'jgfouca/another_fix_for_zm_bfb_cap' into master (PR #8198)
jgfouca Mar 19, 2026
a7d4074
Stubs
jgfouca Mar 12, 2026
313c039
AI attempt
jgfouca Mar 12, 2026
ddfa356
buidsl
jgfouca Mar 12, 2026
b2f9150
Move constants to zm struct for constants
jgfouca Mar 13, 2026
94b0ebf
Improve parallelism
jgfouca Mar 13, 2026
61c5337
Better input vals and local_freq fix
jgfouca Mar 13, 2026
7ee3414
Make sure to use TeamVectorRange
jgfouca Mar 17, 2026
faab5d0
Fix implicit this capture
jgfouca Mar 17, 2026
a09be64
Fix more implicit this cap
jgfouca Mar 17, 2026
e356b18
Add bfb sin and use it in mcsp_tend
jgfouca Mar 17, 2026
d14254d
Add runtime_format to the list of streams attributes
jonbob Mar 19, 2026
e61291f
Fix ocean streams attribute error found in testing this branch
jonbob Mar 19, 2026
455a4ae
Add some approxes due to sum reductions
jgfouca Mar 20, 2026
9935c39
Fix valgrind/mem mistake, zmid was no longer used
jgfouca Mar 20, 2026
0a021f4
Change mcsp_freq to a LOr reduction
jgfouca Mar 20, 2026
0053a69
Merge branch 'copilot/fix-timer-mismatch-bgc' (PR #8146)
peterdschwartz Mar 20, 2026
48b0bcb
Merge branch 'bartgol/eamxx/mask-field-rework-1' (PR #8190)
bartgol Mar 23, 2026
e719a70
Extend atmchange --reset to support resetting a specific XML node
Copilot Mar 23, 2026
038a4fb
atm_manip: add doctests for reset node filtering logic
Copilot Mar 23, 2026
984bb76
atm_manip: remove try/except from get_changes_for_node loop
Copilot Mar 23, 2026
db3cba2
Merge branch 'jgfouca/port_zm_conv_mcsp_tend' into master (PR #8205)
jgfouca Mar 23, 2026
e02e38e
Update WW3 submodule: #45079f45cbad6497fc4d5c68d81274f926873adc
erinethomas Mar 23, 2026
d755868
EAMxx: qol operator overload for FieldLayout
bartgol Mar 24, 2026
fe8bb3b
EAMxx: fix compiler warning in VerticalRemapper
bartgol Mar 24, 2026
52bf438
EAMxx: fix nano-bug in VerticalRemapper
bartgol Mar 24, 2026
8ea37c8
EAMxx: fix comment typo
bartgol Mar 24, 2026
951756a
Merge branch 'bartgol/eamxx/fix-vremap-mask-bug' (PR #8211)
bartgol Mar 24, 2026
daf77a9
Merge branch 'matthewhoffman/mpas-framework/stream-syntax-check' (PR …
jonbob Mar 24, 2026
80df69b
Merge branch 'azamat/oneapi-ifx/fix-ice' (PR #8173)
amametjanov Mar 24, 2026
30c5170
EAMxx: change name of FieldIdentifier method
bartgol Mar 24, 2026
910b99f
EAMxx: add in-place modifiers for FieldIdentifier members
bartgol Mar 24, 2026
29d73e2
Merge branch 'copilot/implement-transposed-output' (PR #8041)
tcclevenger Mar 24, 2026
129a390
Merge branch 'bartgol/eamxx/field-qol-api' (PR #8216)
bartgol Mar 24, 2026
d72fcbc
Merge branch 'fates_pr_1407' (PR #7783)
peterdschwartz Mar 25, 2026
c0f20f4
Merge branch 'copilot/extend-reset-capability' (PR #8206)
bartgol Mar 25, 2026
d72d836
Set config_nFloeCategories = 1
sbrus89 Mar 25, 2026
e8b7da4
Merge branch 'erinethomas/seaice/wave_ice_coupling' (PR #7958)
sbrus89 Mar 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cime_config/config_grids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3944,7 +3944,8 @@
<required_gridmap grid1="ocn_grid" grid2="wav_grid">OCN2WAV_SMAPNAME</required_gridmap>
<required_gridmap grid1="ocn_grid" grid2="wav_grid">WAV2OCN_SMAPNAME</required_gridmap>
<required_gridmap grid1="ocn_grid" grid2="wav_grid">WAV2OCN_FMAPNAME</required_gridmap>
<required_gridmap grid1="ocn_grid" grid2="wav_grid">ICE2WAV_SMAPNAME</required_gridmap> <!-- ??? -->
<required_gridmap grid1="ocn_grid" grid2="wav_grid">ICE2WAV_SMAPNAME</required_gridmap>
<required_gridmap grid1="ocn_grid" grid2="wav_grid">WAV2ICE_SMAPNAME</required_gridmap>
<!-- <required_gridmap grid1="ocn_grid" grid2="rof_grid" not_compset="_POP">ROF2OCN_FMAPNAME</required_gridmap> ?? -->
<required_gridmap grid1="ocn_grid" grid2="rof_grid">ROF2OCN_LIQ_RMAPNAME</required_gridmap>
<required_gridmap grid1="ocn_grid" grid2="rof_grid">ROF2OCN_ICE_RMAPNAME</required_gridmap>
Expand Down Expand Up @@ -5591,20 +5592,23 @@
<map name="WAV2OCN_SMAPNAME">cpl/gridmaps/wQU225EC60to30/map_wQU225EC60to30_TO_oEC60to30v3_blin.20210428.nc</map>
<map name="OCN2WAV_SMAPNAME">cpl/gridmaps/wQU225EC60to30/map_oEC60to30v3_TO_wQU225EC60to30_blin.20210428.nc</map>
<map name="ICE2WAV_SMAPNAME">cpl/gridmaps/wQU225EC60to30/map_oEC60to30v3_TO_wQU225EC60to30_blin.20210428.nc</map>
<map name="WAV2ICE_SMAPNAME">cpl/gridmaps/wQU225EC60to30/map_wQU225EC60to30_TO_oEC60to30v3_blin.20210428.nc</map>
</gridmap>

<gridmap ocn_grid="EC30to60E2r2" wav_grid="wQU225EC30to60E2r2">
<map name="WAV2OCN_SMAPNAME">cpl/gridmaps/wQU225EC30to60E2r2/map_wQU225EC30to60E2r2_TO_EC30to60E2r2_blin.20220222.nc</map>
<map name="WAV2OCN_FMAPNAME">cpl/gridmaps/wQU225EC30to60E2r2/map_wQU225EC30to60E2r2_TO_EC30to60E2r2_aave.20220222.nc</map>
<map name="OCN2WAV_SMAPNAME">cpl/gridmaps/wQU225EC30to60E2r2/map_EC30to60E2r2_TO_wQU225EC30to60E2r2_blin.20220222.nc</map>
<map name="ICE2WAV_SMAPNAME">cpl/gridmaps/wQU225EC30to60E2r2/map_EC30to60E2r2_TO_wQU225EC30to60E2r2_blin.20220222.nc</map>
<map name="WAV2ICE_SMAPNAME">cpl/gridmaps/wQU225EC30to60E2r2/map_wQU225EC30to60E2r2_TO_EC30to60E2r2_blin.20220222.nc</map>
</gridmap>

<gridmap ocn_grid="IcoswISC30E3r5" wav_grid="wQU225Icos30E3r5">
<map name="WAV2OCN_SMAPNAME">cpl/gridmaps/wQU225Icos30E3r5/map_wQU225Icos30E3r5_to_IcoswISC30E3r5_esmfbilin.20240910.nc</map>
<map name="WAV2OCN_FMAPNAME">cpl/gridmaps/wQU225Icos30E3r5/map_wQU225Icos30E3r5_to_IcoswISC30E3r5_esmfaave.20240910.nc</map>
<map name="OCN2WAV_SMAPNAME">cpl/gridmaps/wQU225Icos30E3r5/map_IcoswISC30E3r5_to_wQU225Icos30E3r5_esmfbilin.20240910.nc</map>
<map name="ICE2WAV_SMAPNAME">cpl/gridmaps/wQU225Icos30E3r5/map_IcoswISC30E3r5_to_wQU225Icos30E3r5_esmfbilin.20240910.nc</map>
<map name="WAV2ICE_SMAPNAME">cpl/gridmaps/wQU225Icos30E3r5/map_wQU225Icos30E3r5_to_IcoswISC30E3r5_esmfbilin.20240910.nc</map>
</gridmap>

<gridmap atm_grid="CFSv2" wav_grid="wQU225EC60to30">
Expand Down
8 changes: 8 additions & 0 deletions cime_config/machines/cmake_macros/chrysalis_oneapi-ifx.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@

string(APPEND CMAKE_EXE_LINKER_FLAGS " -L/gpfs/fs1/soft/chrysalis/spack-latest/opt/spack/linux-rhel8-x86_64/gcc-8.5.0/gcc-11.3.0-jkpmtgq/lib64 -lstdc++")

# Workaround for oneapi ifx v2025.2.0 (and earlier than 2025.3.0):
# use -mllvm -disable-hir-temp-cleanup to avoid ICE
# See: https://github.com/argonne-lcf/AuroraBugTracking/issues/64
if (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM"
AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "2025.3.0")
string(APPEND CMAKE_Fortran_FLAGS " -mllvm -disable-hir-temp-cleanup")
endif()

2 changes: 2 additions & 0 deletions components/eam/src/physics/cam/bfb_math.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# define bfb_expm1(val) (exp(val) - 1)
# define bfb_tanh(val) tanh(val)
# define bfb_cos(val) cos(val)
# define bfb_sin(val) sin(val)
# define bfb_sqrt(val) sqrt(val)
# define bfb_erf(val) erf(val)
#else
Expand All @@ -40,6 +41,7 @@
# define bfb_expm1(val) scream_expm1(val)
# define bfb_tanh(val) scream_tanh(val)
# define bfb_cos(val) scream_cos(val)
# define bfb_sin(val) scream_sin(val)
# define bfb_erf(val) scream_erf(val)
#endif

Expand Down
11 changes: 7 additions & 4 deletions components/eam/src/physics/cam/zm/zm_conv_mcsp.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "bfb_math.inc"

module zm_conv_mcsp
!----------------------------------------------------------------------------
! Purpose: methods for mesoscale coherent structure parameterization (MCSP)
Expand Down Expand Up @@ -29,6 +31,7 @@ module zm_conv_mcsp
!----------------------------------------------------------------------------
#ifdef SCREAM_CONFIG_IS_CMAKE
use zm_eamxx_bridge_params, only: r8
use physics_share_f2c, only: scream_sin, scream_cos
#else
use shr_kind_mod, only: r8=>shr_kind_r8
use cam_abortutils, only: endrun
Expand Down Expand Up @@ -270,10 +273,10 @@ subroutine zm_conv_mcsp_tend( pcols, ncol, pver, pverp, &
pdepth_total = state_pint(i,pver+1) - state_pmid(i,jctop(i))

! specify the assumed vertical structure
if (do_mcsp_t) mcsp_tend_s(i,k) = -1*zm_param%mcsp_t_coeff * sin(2.0_r8*zm_const%pi*(pdepth_mid_k/pdepth_total))
if (do_mcsp_q) mcsp_tend_q(i,k) = -1*zm_param%mcsp_q_coeff * sin(2.0_r8*zm_const%pi*(pdepth_mid_k/pdepth_total))
if (do_mcsp_u) mcsp_tend_u(i,k) = zm_param%mcsp_u_coeff * (cos(zm_const%pi*(pdepth_mid_k/pdepth_total)))
if (do_mcsp_v) mcsp_tend_v(i,k) = zm_param%mcsp_v_coeff * (cos(zm_const%pi*(pdepth_mid_k/pdepth_total)))
if (do_mcsp_t) mcsp_tend_s(i,k) = -1*zm_param%mcsp_t_coeff * bfb_sin(2.0_r8*zm_const%pi*(pdepth_mid_k/pdepth_total))
if (do_mcsp_q) mcsp_tend_q(i,k) = -1*zm_param%mcsp_q_coeff * bfb_sin(2.0_r8*zm_const%pi*(pdepth_mid_k/pdepth_total))
if (do_mcsp_u) mcsp_tend_u(i,k) = zm_param%mcsp_u_coeff * (bfb_cos(zm_const%pi*(pdepth_mid_k/pdepth_total)))
if (do_mcsp_v) mcsp_tend_v(i,k) = zm_param%mcsp_v_coeff * (bfb_cos(zm_const%pi*(pdepth_mid_k/pdepth_total)))

! scale the vertical structure by the ZM heating/drying tendencies
if (do_mcsp_t) mcsp_tend_s(i,k) = zm_avg_tend_s(i) * mcsp_tend_s(i,k)
Expand Down
1 change: 1 addition & 0 deletions components/eamxx/cmake/tpls/CsmShare.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ macro (CreateCsmShareTarget)
target_compile_definitions(csm_share PUBLIC
$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CXX_COMPILER_ID:GNU>>:CPRGNU>
$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CXX_COMPILER_ID:Intel>>:CPRINTEL>
$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CXX_COMPILER_ID:IntelLLVM>>:CPRINTEL>
$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CXX_COMPILER_ID:Clang>>:CPRCRAY>
$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CXX_COMPILER_ID:clang>>:CPRCRAY>
EAMXX_STANDALONE)
Expand Down
7 changes: 6 additions & 1 deletion components/eamxx/docs/user/model_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ EAMxx allows the user to configure the desired model output via
with each YAML file associated to a different output stream (i.e., a file).
In order to add an output stream,
one needs to run `atmchange output_yaml_files+=/path/to/my/output/yaml`
(more information on how to use `atmchange` can be found [here](#changing-model-inputs-atmchange)).
(more information on how to use `atmchange` can be found in the
[atmchange documentation](#changing-model-inputs-atmchange)).
During the `buildnml` phase of the case management system, these YAML files
will be copied into the RUNDIR/data folder.
During this process, the files will be parsed, and any CIME-related
Expand Down Expand Up @@ -432,6 +433,10 @@ in the run directory.
- `frequency_units`: units of the output frequency.
- Valid options are `nsteps` (the number of atmosphere time steps),
`nsecs`, `nmins`, `nhours`, `ndays`, `nmonths`, `nyears`.
- `transpose`: optional boolean flag to enable transposed output (default: `false`).
- When set to `true`, all field dimensions will be reversed in the output file.
- For example, a field with layout `(ncol, nlev)` will be written as `(nlev, ncol)`.
- This can be useful for post-processing tools that expect a specific dimension ordering.

## Diagnostic output

Expand Down
90 changes: 90 additions & 0 deletions components/eamxx/scripts/atm_manip.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,96 @@ def reset_buffer():
###############################################################################
run_cmd_no_fail(f"./xmlchange {ATMCHANGE_BUFF_XML_NAME}=''")

###############################################################################
def get_changes_for_node(xml_root, node_name, changes):
###############################################################################
"""
Return the subset of changes from `changes` that do NOT target the given
XML node or any of its descendants. This is the filtering kernel used by
reset_node_changes and can be called directly for testing.

NOTE: `changes` is a list of already-unescaped change strings
(commas are NOT escaped with backslash).

>>> xml = '''
... <root>
... <foo type="integer">0</foo>
... <bar type="integer">10</bar>
... <sub>
... <child1 type="integer">1</child1>
... <child2 type="integer">2</child2>
... </sub>
... </root>
... '''
>>> import xml.etree.ElementTree as ET
>>> tree = ET.fromstring(xml)
>>> ################ ERROR: node not found #######################
>>> get_changes_for_node(tree, 'nonexistent', ['foo=5'])
Traceback (most recent call last):
SystemExit: ERROR: 'nonexistent' did not match any node in the XML file
>>> ################ Reset leaf node (foo), keep bar change #####
>>> get_changes_for_node(tree, 'foo', ['foo=5', 'bar=2'])
['bar=2']
>>> ################ Reset leaf node (foo), no matching change ##
>>> get_changes_for_node(tree, 'foo', ['bar=2', 'sub::child1=99'])
['bar=2', 'sub::child1=99']
>>> ################ Reset non-leaf node (sub), removes children
>>> get_changes_for_node(tree, 'sub', ['sub::child1=99', 'bar=3'])
['bar=3']
>>> ################ Reset child only, keep sibling change #######
>>> get_changes_for_node(tree, 'sub::child1', ['sub::child1=99', 'sub::child2=5', 'bar=3'])
['sub::child2=5', 'bar=3']
>>> ################ Empty changes list ##########################
>>> get_changes_for_node(tree, 'foo', [])
[]
"""
reset_targets = get_xml_nodes(xml_root, node_name)
expect(len(reset_targets) > 0,
f"'{node_name}' did not match any node in the XML file")

if not changes:
return []

parent_map = create_parent_map(xml_root)

filtered_changes = []
for chg in changes:
chg_node_name, _, _, _ = parse_change(chg)
chg_nodes = get_xml_nodes(xml_root, chg_node_name)
# is_anchestor_of(A, B, ...) returns True when A == B too, so
# this covers both direct matches and descendant matches.
affects_reset = any(
is_anchestor_of(reset_target, chg_node, parent_map)
for chg_node in chg_nodes
for reset_target in reset_targets
)
if not affects_reset:
filtered_changes.append(chg)

return filtered_changes

###############################################################################
def reset_node_changes(xml_root, node_name):
###############################################################################
"""
Remove from the SCREAM_ATMCHANGE_BUFFER all changes that target
the given node or any of its descendants.
"""
# Get current buffered changes
buff_str = run_cmd_no_fail(f"./xmlquery {ATMCHANGE_BUFF_XML_NAME} --value")
changes = []
for item in buff_str.split(ATMCHANGE_SEP):
if item.strip():
changes.append(item.replace(r"\,", ",").strip())

# Filter changes (also validates node_name exists in xml_root)
filtered_changes = get_changes_for_node(xml_root, node_name, changes)

# Reset buffer and write back the filtered changes
run_cmd_no_fail(f"./xmlchange {ATMCHANGE_BUFF_XML_NAME}=''")
if filtered_changes:
buffer_changes(filtered_changes)

###############################################################################
def get_xml_nodes(xml_root, name):
###############################################################################
Expand Down
20 changes: 15 additions & 5 deletions components/eamxx/scripts/atmchange
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sys.path.append(os.path.dirname(os.path.realpath(__file__)))

from eamxx_buildnml_impl import check_value, is_array_type
from eamxx_buildnml import create_raw_xml_file
from atm_manip import atm_config_chg_impl, buffer_changes, reset_buffer, get_xml_nodes, parse_change
from atm_manip import atm_config_chg_impl, buffer_changes, reset_buffer, reset_node_changes, get_xml_nodes, parse_change
from utils import run_cmd_no_fail, expect, GoodFormatter

# Add path to cime
Expand Down Expand Up @@ -47,9 +47,17 @@ def atm_config_chg(changes, reset=False, buffer_only=False):
expect(not reset, "Makes no sense for buffer_only and reset to both be on")

if reset:
reset_buffer()
print("All buffered atmchanges have been removed.")
hack_xml = run_cmd_no_fail("./xmlquery SCREAM_HACK_XML --value")
if reset is True:
reset_buffer()
print("All buffered atmchanges have been removed.")
else:
with open("namelist_scream.xml", "r") as fd:
tree = ET.parse(fd)
root = tree.getroot()
reset_node_changes(root, reset)
print(f"Buffered atmchanges for '{reset}' have been removed.")

if hack_xml == "TRUE":
print("SCREAM_HACK_XML is on. Removing namelist_scream.xml to force regen")
os.remove("namelist_scream.xml")
Expand Down Expand Up @@ -118,8 +126,10 @@ OR
parser.add_argument(
"-r", "--reset",
default=False,
action="store_true",
help="Forget all previous atmchanges",
nargs="?",
const=True,
metavar="NODE",
help="Forget all previous atmchanges (if NODE is given, only forget changes targeting that XML node)",
)

parser.add_argument(
Expand Down
7 changes: 6 additions & 1 deletion components/eamxx/scripts/compare-nc-files
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ OR
parser.add_argument("-c","--compare",nargs='+', default=[],
help="Compare variables from src file against variables from tgt file")

# Allow the test to continue if variables are transposes of each other.
parser.add_argument("-a","--allow_transpose",action="store_true", default=False,
help="Whether to allow comparison between variables that are transposed")

return parser.parse_args(args[1:])

###############################################################################
Expand All @@ -62,7 +66,8 @@ def _main_func(description):
print (f" **** Comparing nc files **** \n"
f" src file: {pncf._src_file}\n"
f" tgt file: {pncf._tgt_file}\n"
f" comparisons: {cmp_str}")
f" comparisons: {cmp_str}"
f" allow transpose: {pncf._allow_transpose}")
success = pncf.run()

print("Comparisons result: {}".format("SUCCESS" if success else "FAIL"))
Expand Down
Loading