From db3d595e4a66c11c0934afd579cd78c02a141841 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 16 Oct 2019 13:02:50 -0300 Subject: [PATCH 1/4] fix deprecation --- ioos_tools/tardis.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ioos_tools/tardis.py b/ioos_tools/tardis.py index 8dc4d1a..82f4039 100644 --- a/ioos_tools/tardis.py +++ b/ioos_tools/tardis.py @@ -28,7 +28,6 @@ def is_model(cube): Examples -------- >>> import iris - >>> iris.FUTURE.netcdf_promote = True >>> url = "http://thredds.cencoos.org/thredds/dodsC/CENCOOS_CA_ROMS_FCST.nc" >>> cubes = iris.load_raw(url, 'sea_water_potential_temperature') >>> [is_model(cube) for cube in cubes] From f420350d0d1502ac90f0b82605adcdab6c6d748f Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 16 Oct 2019 13:03:15 -0300 Subject: [PATCH 2/4] adpat code for latest pandas --- ioos_tools/skill_score.py | 13 +++++++++++-- requirements.txt | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ioos_tools/skill_score.py b/ioos_tools/skill_score.py index e2de83f..33514cf 100644 --- a/ioos_tools/skill_score.py +++ b/ioos_tools/skill_score.py @@ -79,9 +79,17 @@ def r2(x, y): return r2_score(x, y) +def _get_df(dfs, station): + ret = {} + for k, v in dfs.items(): + ret.update({k: v[station]}) + return DataFrame.from_dict(ret) + + def apply_skill(dfs, function, remove_mean=True, filter_tides=False): skills = {} - for station, df in dfs.iteritems(): + for station in dfs["OBS_DATA"].columns: + df = _get_df(dfs, station) if filter_tides: df = df.apply(low_pass) skill = {} @@ -90,7 +98,8 @@ def apply_skill(dfs, function, remove_mean=True, filter_tides=False): # No observations. skills.update({station: np.NaN}) continue - for model, y in df.iteritems(): + for model in df.columns: + y = df[model] # No models. if y.isnull().all(): skills.update({station: np.NaN}) diff --git a/requirements.txt b/requirements.txt index ebcb79c..1749a1c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,16 +2,16 @@ beautifulsoup4 cftime folium iris +jupyter matplotlib netcdf4 numpy oceans owslib -pandas>=0.20 +pandas>=0.25.1 pytz requests retrying scikit-learn scipy timeout-decorator -jupyter \ No newline at end of file From f0361d39b2e9a1aac9b26291a5ff0a6634e566c1 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 16 Oct 2019 13:03:43 -0300 Subject: [PATCH 3/4] adpat code for latest pandas and fix lints --- ioos_tools/ioos.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ioos_tools/ioos.py b/ioos_tools/ioos.py index eb24487..f0dd8c3 100644 --- a/ioos_tools/ioos.py +++ b/ioos_tools/ioos.py @@ -535,11 +535,11 @@ def _sanitize(name): """ Examples -------- - >>> _sanitize('ROMS/TOMS') + >>> _sanitize("ROMS/TOMS") 'ROMS_TOMS' - >>> _sanitize('USEAST model') + >>> _sanitize("USEAST model") 'USEAST_model' - >>> _sanitize('GG1SST, SST') + >>> _sanitize("GG1SST, SST") 'GG1SST_SST' """ @@ -576,7 +576,7 @@ def get_model_name(url): return mod_name -@timeout_decorator.timeout(20, use_signals=False) +@timeout_decorator.timeout(40, use_signals=False) def is_station(url): from netCDF4 import Dataset @@ -651,17 +651,15 @@ def load_ncs(config): else: model = os.path.splitext(os.path.split(fname)[-1])[0].split("-")[ -1 - ] # noqa + ] df = nc2df(fname, columns_name="station_code") # FIXME: Horrible work around duplicate times. if len(df.index.values) != len(np.unique(df.index.values)): kw = {"subset": "index", "take_last": True} df = df.reset_index().drop_duplicates(**kw).set_index("index") kw = {"method": "time", "limit": 2} - df = df.reindex(index).interpolate(**kw).ix[index] + df = df.reindex(index).interpolate(**kw).loc[index] dfs.update({model: df}) - kw = {"orient": "items", "intersect": False} - dfs = pd.Panel.from_dict(dfs, **kw).swapaxes(0, 2) return dfs From 315a80ea96173babb555ca53fde443e0aec772cd Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 17 Oct 2019 10:00:07 -0300 Subject: [PATCH 4/4] add lxml --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 1749a1c..982796a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,3 +15,4 @@ retrying scikit-learn scipy timeout-decorator +lxml