Skip to content

Commit

Permalink
Merge pull request #23 from jkrasting/cmip-fix
Browse files Browse the repository at this point in the history
Fixes issue with CMIP convention data
  • Loading branch information
jkrasting authored Nov 9, 2021
2 parents dfa1f61 + 1a14b91 commit ca9f408
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def construct_tripolar_grid(
ds_in = pkgr.resource_filename("mdtf_test_data", "resources/ocean_static_5deg.nc")
ds_in = xr.open_dataset(ds_in)

# -- if CMIP format is requested, use CESM version as output
attr_fmt = "ncar" if attr_fmt == "cmip" else attr_fmt

if point_type == "t":
lat = ds_in["geolat"]
lon = ds_in["geolon"]
Expand Down
5 changes: 3 additions & 2 deletions mdtf_test_data/tests/test_construct_tripolar_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ def test_construct_tripolar_grid_c(retain_coords):
assert result.wet_c.sum() == 1426.0


def test_construct_tripolar_grid_ncar():
@pytest.mark.parametrize("attr_fmt", [("ncar"), ("cmip")])
def test_construct_tripolar_grid_ncar(attr_fmt):
result = construct_tripolar_grid(
attr_fmt="ncar", add_attrs=True, retain_coords=True
attr_fmt=attr_fmt, add_attrs=True, retain_coords=True
)
assert sorted(list(result.coords)) == ["nlat", "nlon"]
assert sorted(list(result.dims)) == ["nlat", "nlon"]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = mdtf_test_data
version = 1.0.4
version = 1.0.5.post1
description = Tools for working with MDTF Diagnostics test data sets
url = https://github.com/jkrasting/mdtf_test_data
author = MDTF Development Team
Expand Down

0 comments on commit ca9f408

Please sign in to comment.