Open tomvothecoder opened 10 months ago
I think what is happening is that the variable's climatology is being calculated with "ANN", which collapses the time dimension.
In hybrid_to_plevs()
, there is no call to genutil.grower()
to align the axes:
In line 158 of pressure_to_plevs()
, there is a call to genutil.grower()
to align the axes:
https://github.com/E3SM-Project/e3sm_diags/blob/6aaa7c27dcf65393dd07e258ef2e7da21a660e87/e3sm_diags/driver/utils/general.py#L149-L171
The fix is to update hybrid_to_plevs()
with a call to genutil.grower()
in the main
branch and xr.broadcast()
(or something similar) in #677. I tested this and the hybrid_to_plevs()
function now works.
UPDATE: Root cause and solution below in this comment.
Call stack:
Get the variables: "ANN" climatology -- collapses time dimension
Convert either hybrid or pressure to pressure levels
Convert hybrid to pressure levels:
Raises cdms2.error.CDMSError: axis length 129 does not match corresponding dimension 36
ex1.py
run in Ryan’s NERSC directory hybrid_to_plevs()
never popped up in the integration tests.
all-sets.cfg
and all-sets-modified.cfg
uses climatology datasets for the reference and test files. Using time series files like in ex1.py results in this issue because:
We need the axes for the climatology variable and the hybrid variables to align. This means we should calculate the climatologies for the hybrid variables beforehand.
All variables fed into convert_to_pressure_levels()
, hybrid_to_plevs()
and pressure_to_plevs()
should not have a time axis.
In PR #677, I am doing a complete run of ex1.py to make sure all of the metrics and plots are successfully generated. The last remaining issue is an
xgcm
error that is raised with the variables "U", "V", "OMEGA", and "Z3".Overview
I switched back to the
main
branch to see how the original code was handling this situation and noticed it breaks there too.The
lat_lon_driver.py
tries to regrid the variables "U", "V", "OMEGA", and "Z3" using pressure levels reconstructed from hybrid. The issue is that these variables have already been regridded to 19 pressure levels (source) and no longer have a time axis. Since the variable and pressure level variable (has time axis) do not have matching dimensions, regridding does not work on the variable.This error is raised:
cdms2.error.CDMSError: axis length 129 does not match corresponding dimension 36
.Related code: https://github.com/E3SM-Project/e3sm_diags/blob/6aaa7c27dcf65393dd07e258ef2e7da21a660e87/e3sm_diags/driver/utils/general.py#L132-L146
Possible Solutions
From this comment:
We need the axes for the climatology variable and the hybrid variables to align. This means we should calculate the climatologies for the hybrid variables beforehand.
All variables fed into convert_to_pressure_levels(), hybrid_to_plevs() and pressure_to_plevs() should not have a time axis.
Steps to Reproduce (NERSC machine)
main
branchlat_lon_model_vs_model.cfg
to only run one of related variables (e.g., "U")Update result paths and run ex1.py (attached below for convenience)
Traceback: