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

FIX: limit numpy version <2 and squelch warnings #93

Merged
merged 4 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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