From d425577235175947abdf8e735e8a740d28270a31 Mon Sep 17 00:00:00 2001 From: Nathan Collier Date: Mon, 24 Jun 2024 10:55:28 -0400 Subject: [PATCH 1/4] squash pandas warning on converting to float --- src/ILAMB/ilamblib.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ILAMB/ilamblib.py b/src/ILAMB/ilamblib.py index 641fc40..c8d722a 100644 --- a/src/ILAMB/ilamblib.py +++ b/src/ILAMB/ilamblib.py @@ -1330,7 +1330,7 @@ def AnalysisMeanStateSites(ref, com, **keywords): ] if len(val) > 0: mask.append(ILAMBregions.getMask(region, bias)) - values.append((~mask[-1]) * float(val)) + values.append((~mask[-1]) * float(val.iloc[0])) bias_score_map = deepcopy(bias) bias_score_map.data = np.ma.masked_array( np.array(values).sum(axis=0), mask=np.array(mask).all(axis=0) @@ -1380,7 +1380,7 @@ def AnalysisMeanStateSites(ref, com, **keywords): ] if len(val) > 0: mask.append(ILAMBregions.getMask(region, crmse)) - values.append((~mask[-1]) * float(val)) + values.append((~mask[-1]) * float(val.iloc[0])) rmse_score_map = deepcopy(crmse) rmse_score_map.data = np.ma.masked_array( np.array(values).sum(axis=0), mask=np.array(mask).all(axis=0) @@ -2045,7 +2045,7 @@ def AnalysisMeanStateSpace(ref, com, **keywords): ] if len(val) > 0: mask.append(ILAMBregions.getMask(region, bias)) - values.append((~mask[-1]) * float(val)) + values.append((~mask[-1]) * float(val.iloc[0])) bias_score_map = deepcopy(bias) bias_score_map.data = np.ma.masked_array( np.array(values).sum(axis=0), mask=np.array(mask).all(axis=0) @@ -2207,7 +2207,7 @@ def AnalysisMeanStateSpace(ref, com, **keywords): ] if len(val) > 0: mask.append(ILAMBregions.getMask(region, crmse)) - values.append((~mask[-1]) * float(val)) + values.append((~mask[-1]) * float(val.iloc[0])) rmse_score_map = deepcopy(crmse) rmse_score_map.data = np.ma.masked_array( np.array(values).sum(axis=0), mask=np.array(mask).all(axis=0) From 6478c8323c885b5683c64d9f35357a00329c2f55 Mon Sep 17 00:00:00 2001 From: Nathan Collier Date: Mon, 24 Jun 2024 10:56:11 -0400 Subject: [PATCH 2/4] numpy 2.0 is causing some difficulties, currently limit while packages update --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1e1f8a6..a92742b 100644 --- a/setup.py +++ b/setup.py @@ -109,7 +109,7 @@ def write_version_py(filename=os.path.join("src/ILAMB", "generated_version.py")) scripts=["bin/ilamb-run", "bin/ilamb-fetch", "bin/ilamb-mean", "bin/ilamb-setup"], zip_safe=False, install_requires=[ - "numpy>=1.11.0, != 1.24.3", + "numpy<2", "pandas>=1.0.0", "matplotlib>=2.2", "cartopy>=0.17.0", From b23de1ec272335deff76e2411904754e9057df42 Mon Sep 17 00:00:00 2001 From: Nathan Collier Date: Mon, 24 Jun 2024 11:01:01 -0400 Subject: [PATCH 3/4] remove deprecated package and replace --- src/ILAMB/ilamblib.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ILAMB/ilamblib.py b/src/ILAMB/ilamblib.py index c8d722a..ea0b0e3 100644 --- a/src/ILAMB/ilamblib.py +++ b/src/ILAMB/ilamblib.py @@ -8,7 +8,6 @@ from cf_units import Unit from mpi4py import MPI from netCDF4 import Dataset -from pkg_resources import get_distribution, parse_version from scipy.interpolate import NearestNDInterpolator from ILAMB.Regions import Regions @@ -722,7 +721,7 @@ def FromNetCDF4( """ try: dset = Dataset(filename, mode="r") - if parse_version(get_distribution("netCDF4").version) >= parse_version("1.4.1"): + if "set_always_mask" in dir(dset): dset.set_always_mask(False) if group is None: grp = dset From 69aa3612012dd32c50a38514cbfb68a7d6aeebf7 Mon Sep 17 00:00:00 2001 From: Nathan Collier Date: Mon, 24 Jun 2024 12:19:34 -0400 Subject: [PATCH 4/4] shift in site plotting to squash noisy matplotlib warnings --- src/ILAMB/Variable.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ILAMB/Variable.py b/src/ILAMB/Variable.py index 8a563fa..1ec31b5 100644 --- a/src/ILAMB/Variable.py +++ b/src/ILAMB/Variable.py @@ -1452,15 +1452,13 @@ def plot(self, ax, **keywords): transform=ccrs.PlateCarree(), ) else: - norm = colors.Normalize(vmin, vmax) - cmap = get_cmap(cmap) - clrs = cmap(norm(self.data)) p = ax.scatter( self.lon, self.lat, s=35, - color=clrs, - cmap=cmap, + c=self.data.filled(np.nan), + norm=colors.Normalize(vmin, vmax), + cmap=get_cmap(cmap), linewidths=0, transform=ccrs.PlateCarree(), )