Skip to content

Commit

Permalink
Merge pull request #216 from umr-lops/numpypinbelow2
Browse files Browse the repository at this point in the history
bump `xsar` to be compatible with numpy>=2.0.0
  • Loading branch information
agrouaze authored Jul 30, 2024
2 parents a7107b3 + 8c29386 commit c9e87e3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/xsar/base_dataset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pdb
import warnings
from abc import ABC
from datetime import datetime
Expand Down Expand Up @@ -300,10 +301,12 @@ def _local_gcps(self):
# lon_s = lon_s.values
# lat_s = lat_s.values
cpt = 0
for line in line_decimated:
for sample in sample_decimated:
for line in line_decimated.astype(int):
for sample in sample_decimated.astype(int):
irow = np.argmin(np.abs(self.dataset.line.values - line))
irow = int(irow)
icol = np.argmin(np.abs(self.dataset.sample.values - sample))
icol = int(icol)
# if self.s1meta.product == 'SLC':
# #lon, lat = self.coords2ll_SLC(line,sample)
# lon = lon_s[cpt]
Expand Down
2 changes: 1 addition & 1 deletion src/xsar/radarsat2_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def __init__(self, dataset_id, resolution=None,
# dataset no-pol template for function evaluation on coordinates (*no* values used)
# what's matter here is the shape of the image, not the values.
with warnings.catch_warnings():
warnings.simplefilter("ignore", np.ComplexWarning)
# warnings.simplefilter("ignore", np.ComplexWarning)
self._da_tmpl = xr.DataArray(
dask.array.empty_like(
self._dataset.digital_number.isel(pol=0).drop('pol'),
Expand Down
2 changes: 1 addition & 1 deletion src/xsar/rcm_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def __init__(self, dataset_id, resolution=None,
# dataset no-pol template for function evaluation on coordinates (*no* values used)
# what's matter here is the shape of the image, not the values.
with warnings.catch_warnings():
warnings.simplefilter("ignore", np.ComplexWarning)
# warnings.simplefilter("ignore", np.ComplexWarning)
self._da_tmpl = xr.DataArray(
dask.array.empty_like(
self._dataset.digital_number.isel(pol=0).drop('pol'),
Expand Down
2 changes: 1 addition & 1 deletion src/xsar/sentinel1_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def __init__(self, dataset_id, resolution=None,
# dataset no-pol template for function evaluation on coordinates (*no* values used)
# what's matter here is the shape of the image, not the values.
with warnings.catch_warnings():
warnings.simplefilter("ignore", np.ComplexWarning)
# warnings.simplefilter("ignore", np.ComplexWarning) # deprecated in numpy>=2.0.0
if self.sar_meta._bursts['burst'].size != 0:
# SLC TOPS, tune the high res grid because of bursts overlapping
# line_time = self._burst_azitime
Expand Down

0 comments on commit c9e87e3

Please sign in to comment.