E3SM-Project/e3sm_diags

[Bug]: Figure out why `TREFHT` regridded reference variable is not regridding on `main` with ESMF bilinear

Opened this issue · 0 comments

What happened?

In PR #815:

This PR validates the replication of the slice flag feature added in PR #750 to fix #759.

I re-ran ex1.py and found that all .nc files produced are now within the relative tolerance.

For metrics, all but one is within the relative tolerance. This single metric is related to the regridded reference data for "TREFHT" with the land region. In trefht.py, I compare the .nc file for the regridded reference data between xCDAT/xESMF and CDAT/ESMF. I found that CDAT/ESMF doesn't seem to actually regrid the data since the original and regridded reference variables are the same, as noted in this PR review comment. I think this is leading to the large diffs along the coast lines, as shown below.

xCDAT CDAT Diff
debug_TREFHT_actual debug_TREFHT_expected debug_TREFHT_diff

In PR #794, I noticed how bilinear regridding with xCDAT/xESMF produces nan location mismatches when comparing land sea masks to CDAT/ESMF. I think we should move forward for now and debug this more later on in a separate PR.

What did you expect to happen? Are there are possible answers you came across?

The reference TREFHT variable should be regridded since the mv2.regrid is called below:

# use nlat to decide data resolution, higher number means higher data
# resolution. For the difference plot, regrid toward lower resolution
if len(axes1[1]) <= len(axes2[1]):
mv_grid = mv1.getGrid()
mv1_reg = mv1
mv2_reg = mv2.regrid(
mv_grid, regridTool=regrid_tool, regridMethod=regrid_method
)
mv2_reg.units = mv2.units

Minimal Complete Verifiable Example (MVCE)

No response

Relevant log output

No response

Anything else we need to know?

No response

Environment

main branch