From 082d57e89e648a66057838d849bc07624191ced0 Mon Sep 17 00:00:00 2001 From: kmarkert Date: Fri, 2 Apr 2021 13:54:13 -0500 Subject: [PATCH 1/8] updated pour point parsing to use pandas > v1.0 --- rvic/parameters.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rvic/parameters.py b/rvic/parameters.py index e98c7aa..8fc116d 100644 --- a/rvic/parameters.py +++ b/rvic/parameters.py @@ -191,7 +191,9 @@ 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) + + log.info(pour_points) pour_points.drop_duplicates(inplace=True) pour_points.dropna() From d610d0a1ff88fb2087186a090f08ca7130661d79 Mon Sep 17 00:00:00 2001 From: kmarkert Date: Fri, 2 Apr 2021 15:40:10 -0500 Subject: [PATCH 2/8] add additional checks to allow for masked arrays for geo dims --- rvic/core/history.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rvic/core/history.py b/rvic/core/history.py index df11bec..035353b 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: From 3fe23d31a38d71c5acd30fc829de4f869edc2819 Mon Sep 17 00:00:00 2001 From: kmarkert Date: Fri, 2 Apr 2021 16:12:05 -0500 Subject: [PATCH 3/8] squeezing outlet name array to drop extra added dimesion --- rvic/core/history.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rvic/core/history.py b/rvic/core/history.py index 035353b..4037c0f 100644 --- a/rvic/core/history.py +++ b/rvic/core/history.py @@ -670,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: From 922cccb3702c2218d78d29b78c88c70114b409c8 Mon Sep 17 00:00:00 2001 From: kmarkert Date: Fri, 2 Apr 2021 16:13:22 -0500 Subject: [PATCH 4/8] changing pandas version requirement to align with changes in 082d57e --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d1fb387..557e9d1 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'], tests_require=['pytest >= 2.5.2'], url='https://github.com/UW-Hydro/RVIC', packages=['rvic', 'rvic.core'], From c91176d6ff21a3a297898b5db376e2c4cc454b6d Mon Sep 17 00:00:00 2001 From: kmarkert Date: Fri, 2 Apr 2021 16:32:05 -0500 Subject: [PATCH 5/8] fixed bug in latlon2xy where trying to use max method on scalar float values --- rvic/core/utilities.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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') From ddf59b9153d06c03861932ecb6a139d2fd65f815 Mon Sep 17 00:00:00 2001 From: kmarkert Date: Fri, 2 Apr 2021 16:33:29 -0500 Subject: [PATCH 6/8] removing debug logging --- rvic/parameters.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/rvic/parameters.py b/rvic/parameters.py index 8fc116d..9ec5c77 100644 --- a/rvic/parameters.py +++ b/rvic/parameters.py @@ -193,8 +193,6 @@ def gen_uh_init(config): for i, name in enumerate(pour_points.names): pour_points.loc[pour_points['names']==name, 'names'] = strip_invalid_char(name) - log.info(pour_points) - pour_points.drop_duplicates(inplace=True) pour_points.dropna() except Exception as e: From 58a497fa54bea83bc54368f23b7b82cb4f0ab9bc Mon Sep 17 00:00:00 2001 From: kmarkert Date: Mon, 5 Apr 2021 12:12:03 -0500 Subject: [PATCH 7/8] bookending pandas version requirement to prevent install errors --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 557e9d1..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 >= 1.0'], + 'pandas>=1.0,<1.2'], tests_require=['pytest >= 2.5.2'], url='https://github.com/UW-Hydro/RVIC', packages=['rvic', 'rvic.core'], From bbfdd5b9c656f08f69262f5ae61da451ca5f0f62 Mon Sep 17 00:00:00 2001 From: kmarkert Date: Wed, 23 Jun 2021 00:24:01 -0500 Subject: [PATCH 8/8] fixing matplotlib calls to recent version api --- rvic/core/plots.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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()