diff --git a/rvic/core/history.py b/rvic/core/history.py index df11bec..4037c0f 100644 --- a/rvic/core/history.py +++ b/rvic/core/history.py @@ -90,8 +90,9 @@ def __init__(self, time_ord, caseid, rvar, tape_num=0, # ------------------------------------------------------------ # # Get Grid Lons/Lats if outtype is grid if outtype.lower() == 'grid': + check_types = (np.ndarray,np.ma.MaskedArray) self._out_data_shape = self._grid_shape - if type(grid_lons) == np.ndarray and type(grid_lats) == np.ndarray: + if isinstance(grid_lons,check_types) and isinstance(grid_lats,check_types): self._grid_lons = grid_lons self._grid_lats = grid_lats else: @@ -669,7 +670,7 @@ def __write_array(self): outlet_x_ind[:] = self._outlet_x_ind outlet_y_ind[:] = self._outlet_y_ind outlet_decomp_ind[:] = self._outlet_decomp_ind - onm[:, :] = char_names + onm[:, :] = np.squeeze(char_names) for key, val in iteritems(share.outlet_lon): if val: diff --git a/rvic/core/plots.py b/rvic/core/plots.py index 902f66a..83d4e47 100644 --- a/rvic/core/plots.py +++ b/rvic/core/plots.py @@ -7,6 +7,7 @@ from .log import LOG_NAME import numpy as np from datetime import date +import copy try: import matplotlib matplotlib.use('Agg') @@ -57,7 +58,7 @@ def _fractions_grid(data, dom_x, dom_y, title, case_id, plot_dir): mask = data <= 0.0 data = np.ma.array(data, mask=mask) - cmap = matplotlib.cm.cool + cmap = copy.copy(matplotlib.cm.cool) cmap.set_bad(color='w') fig = plt.figure() diff --git a/rvic/core/utilities.py b/rvic/core/utilities.py index 66dbd1b..37c3f57 100644 --- a/rvic/core/utilities.py +++ b/rvic/core/utilities.py @@ -29,11 +29,11 @@ def latlon2yx(plats, plons, glats, glons): # use astronomical conventions for longitude # (i.e. negative longitudes to the east of 0) - if (glons.max() > 180): + if (np.max(glons) > 180): posinds = np.nonzero(glons > 180) glons[posinds] -= 360 log.info('adjusted grid lon to astronomical conventions') - if (plons.max() > 180): + if (np.max(plons) > 180): posinds = np.nonzero(plons > 180) plons[posinds] -= 360 log.info('adjusted point lon to astronomical conventions') diff --git a/rvic/parameters.py b/rvic/parameters.py index e98c7aa..9ec5c77 100644 --- a/rvic/parameters.py +++ b/rvic/parameters.py @@ -191,7 +191,7 @@ def gen_uh_init(config): if 'names' in pour_points: pour_points.fillna(inplace=True, value='unknown') for i, name in enumerate(pour_points.names): - pour_points.ix[i, 'names'] = strip_invalid_char(name) + pour_points.loc[pour_points['names']==name, 'names'] = strip_invalid_char(name) pour_points.drop_duplicates(inplace=True) pour_points.dropna() diff --git a/setup.py b/setup.py index d1fb387..7067c89 100644 --- a/setup.py +++ b/setup.py @@ -115,7 +115,7 @@ def write_version_py(filename=None): 'Topic :: Scientific/Engineering'], install_requires=['scipy >= 0.13', 'numpy >= 1.8', 'netCDF4 >= 1.0.6', 'matplotlib >= 1.3.1', - 'pandas >= 0.15.1'], + 'pandas>=1.0,<1.2'], tests_require=['pytest >= 2.5.2'], url='https://github.com/UW-Hydro/RVIC', packages=['rvic', 'rvic.core'],