E3SM-Project / e3sm_diags

E3SM Diagnostics package
https://e3sm-project.github.io/e3sm_diags
BSD 3-Clause "New" or "Revised" License
38 stars 31 forks source link

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

Open tomvothecoder opened 2 months ago

tomvothecoder commented 2 months ago

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:

https://github.com/E3SM-Project/e3sm_diags/blob/c8404ab0f5523fee80cda396357f307b7ad1ff5b/e3sm_diags/driver/utils/general.py#L246-L254

Minimal Complete Verifiable Example (MVCE)

No response

Relevant log output

No response

Anything else we need to know?

No response

Environment

main branch