Skip to content

Commit

Permalink
fix the problem with testing type of prefix (#83)
Browse files Browse the repository at this point in the history
* fix python2/3 compatibilty issue for string test

* no need for extra line

* Fixing style errors.
  • Loading branch information
raphaeldussin authored and rabernat committed Jun 22, 2018
1 parent 0ca23c2 commit 14c7338
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion xmitgcm/mds_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import inspect
import xarray as xr
import dask.array as da
import sys

# we keep the metadata in its own module to keep this one cleaner
from .variables import dimensions, \
Expand All @@ -25,10 +26,17 @@

from .utils import parse_meta_file, read_mds, parse_available_diagnostics

# Python2/3 compatibility
if (sys.version_info > (3, 0)):
stringtypes = [str]
else:
stringtypes = [str, unicode]

# should we hard code this?
LLC_NUM_FACES = 13
LLC_FACE_DIMNAME = 'face'


def open_mdsdataset(data_dir, grid_dir=None,
iters='all', prefix=None, read_grid=True,
delta_t=1, ref_date=None, calendar='gregorian',
Expand Down Expand Up @@ -120,7 +128,7 @@ def open_mdsdataset(data_dir, grid_dir=None,
raise ValueError("If swap_dims==True, read_grid must be True.")

# if prefix is passed as a string, force it to be a list
if type(prefix) is str or unicode:
if type(prefix) in stringtypes:
prefix = [prefix]
else:
pass
Expand Down

0 comments on commit 14c7338

Please sign in to comment.