Skip to content

Commit

Permalink
Fix unit tests and add comment about mask var
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvothecoder committed Feb 19, 2025
1 parent c0e5e29 commit fe3f2aa
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
ds_a = xc.open_dataset("/lcrc/group/e3sm/public_html/cdat-migration-fy24/25-02-14-branch-930-polar-after/polar/GPCP_v3.2/test.nc")
ds_b = xc.open_dataset("/lcrc/group/e3sm/public_html/cdat-migration-fy24/25-02-14-branch-930-polar-after/polar/GPCP_v3.2/ref.nc")

ds_a = ds_a.rename({'nbnd': 'bnds'})

# 1. Check the bounds dimension names
print("Bounds in ds_a:", ds_a["lon_bnds"].dims, ds_a["lat_bnds"].dims)
print("Bounds in ds_b:", ds_b["lon_bnds"].dims, ds_b["lat_bnds"].dims)
Expand All @@ -27,6 +29,9 @@
Notice how the bounds dimensions are different ('nbnd' vs. 'bnd'.). This
seems to affect results when regridding.
"""
# 2. Check if bounds values are equal
np.testing.assert_allclose(ds_a["lon_bnds"].values, ds_b["lon_bnds"].values)
np.testing.assert_allclose(ds_a["lat_bnds"].values, ds_b["lat_bnds"].values)

# 2. Regrid with pre-existing lat/lon bounds. -- This one produces larger diffs compared to CDAT
output_grid = ds_a.regridder.grid
Expand Down

0 comments on commit fe3f2aa

Please sign in to comment.