Skip to content

Commit 7c2ee15

Browse files
authored
fix: decrease numpy version (#55)
* Decrease numpy version to <2.0 * Fix typing after version change
1 parent b2ce707 commit 7c2ee15

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

asar_xarray/asar.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from xarray.core.types import ReadBuffer
1313
from asar_xarray import reader, utils, envisat_direct
1414
from loguru import logger
15+
from numpy.typing import NDArray
1516

1617
from asar_xarray.derived_subdatasets_metadata import process_derived_subdatasets_metadata
1718
from asar_xarray.general_metadata import process_general_metadata
@@ -36,7 +37,7 @@ def get_metadata(gdal_dataset: gdal.Dataset) -> Dict[str, Any]:
3637

3738

3839
def open_asar_dataset(filename_or_obj: str | os.PathLike[Any] | ReadBuffer[
39-
Any] | bytes | memoryview | AbstractDataStore,
40+
Any] | bytes | memoryview | AbstractDataStore,
4041
polarization: str | None = None) -> xr.Dataset:
4142
"""
4243
Open an ASAR dataset and converts it into an xarray Dataset.
@@ -296,7 +297,7 @@ def compute_azimuth_time(
296297
product_first_line_utc_time: np.datetime64,
297298
product_last_line_utc_time: np.datetime64,
298299
number_of_lines: int
299-
) -> np.ndarray:
300+
) -> NDArray[Any]:
300301
"""
301302
Compute an array of azimuth times for each line in the ASAR product.
302303

asar_xarray/envisat_direct.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import math
66
import pathlib
77
import numpy as np
8+
from numpy.typing import NDArray
89

910

1011
def parse_int(s: str) -> int:
@@ -113,7 +114,7 @@ def parse_direct(path: str, gdal_metadata: dict[str, Any], polarization: str) ->
113114

114115
# antenna gain
115116
n_samp = gdal_metadata["line_length"]
116-
spreading_loss: np.ndarray[Any] = np.array([])
117+
spreading_loss: NDArray[Any] = np.array([])
117118
if gdal_metadata["sample_type"] == "DETECTED":
118119
gain_arr = np.ones(n_samp)
119120
spreading_loss = np.ones(n_samp)

environment.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ channels:
33
- conda-forge
44
dependencies:
55
- python>=3.12
6-
- gdal>=3.10
6+
- gdal>=3.5.0
77
- libgdal>=3.10
8-
- numpy>=2.2.0
8+
- numpy<2.0
99
- xarray>=2025.1.0
1010
- pip
1111
- requests>=2.32.0
1212
- boto3>=1.37.0
13-
- boto3-stubs>=1.37.0
13+
- boto3-stubs>=1.37.0 # type hints
1414
- lxml>=5.3.0
1515
- mypy>=1.15.0
1616
- loguru>=0.7.0
17-
- pandas-stubs >=2.0.0
17+
- pandas-stubs >=2.0.0 # type hints
18+
- rasterio>=1.4.0
19+
- rioxarray>=0.19.0
1820
- pip:
19-
- pytest-stub>=1.1.0
20-
- rasterio>=1.4.0
21-
- rioxarray>=0.19.0
21+
- pytest-stub>=1.1.0 # type hints

0 commit comments

Comments
 (0)