Skip to content

Commit

Permalink
Merge pull request #93 from rubisco-sfa/versions
Browse files Browse the repository at this point in the history
FIX: limit numpy version <2 and squelch warnings
  • Loading branch information
nocollier authored Jun 24, 2024
2 parents c0aecd5 + 69aa361 commit 818957f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 3 additions & 5 deletions src/ILAMB/Variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
Expand Down
11 changes: 5 additions & 6 deletions src/ILAMB/ilamblib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1330,7 +1329,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)
Expand Down Expand Up @@ -1380,7 +1379,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)
Expand Down Expand Up @@ -2045,7 +2044,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)
Expand Down Expand Up @@ -2207,7 +2206,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)
Expand Down

0 comments on commit 818957f

Please sign in to comment.