Skip to content

Commit

Permalink
fixes #42 (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
rabernat authored Mar 28, 2017
1 parent 4a2a9b0 commit 8c3f8a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions xmitgcm/mds_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,13 @@ def _guess_model_dimensions(data_dir, is_llc=False):
raise IOError("Couldn't find RC.meta file to infer nz.")
try:
xc_meta = parse_meta_file(os.path.join(data_dir, 'XC.meta'))
nx = xc_meta['dimList'][0][0]
ny = xc_meta['dimList'][1][0]
nx = int(xc_meta['dimList'][0][0])
ny = int(xc_meta['dimList'][1][0])
except IOError:
raise IOError("Couldn't find XC.meta file to infer nx and ny.")
if is_llc:
nface = LLC_NUM_FACES
ny /= nface
ny //= nface
else:
nface = None
return nz, nface, ny, nx
Expand Down
7 changes: 6 additions & 1 deletion xmitgcm/test/test_mds_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ def test_open_mdsdataset_minimal(all_mds_datadirs):
ds_expected = xr.Dataset(coords=coords)
assert ds_expected.equals(ds)

# check that the datatypes are correct
for key in coords:
assert ds[key].dtype == np.int64

# check for comodo metadata needed by xgcm
assert ds['i'].attrs['axis'] == 'X'
assert ds['i_g'].attrs['axis'] == 'X'
Expand Down Expand Up @@ -505,7 +509,8 @@ def test_swap_dims(all_mds_datadirs):
iters=None, read_grid=False, geometry=expected['geometry'])
if expected['geometry'] in ('llc', 'curvilinear'):
# make sure swapping is not the default
assert 'i' in xmitgcm.open_mdsdataset(dirname, **kwargs)
ds = xmitgcm.open_mdsdataset(dirname, **kwargs)
assert 'i' in ds
# and is impossible
with pytest.raises(ValueError) as excinfo:
ds = xmitgcm.open_mdsdataset(
Expand Down

0 comments on commit 8c3f8a1

Please sign in to comment.