Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for parameter i/o and checks #136

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
5 changes: 3 additions & 2 deletions rvic/core/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion rvic/core/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions rvic/core/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion rvic/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down