From f652ffb5c19d8d860f2fccaad2a31f348aa8577d Mon Sep 17 00:00:00 2001 From: Anton Perepelenko Date: Thu, 25 Sep 2025 13:24:09 +0300 Subject: [PATCH 1/3] Decrease numpy version --- environment.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/environment.yml b/environment.yml index c6137f8..3ba687d 100644 --- a/environment.yml +++ b/environment.yml @@ -3,19 +3,19 @@ channels: - conda-forge dependencies: - python>=3.12 - - gdal>=3.10 + - gdal>=3.5.0 - libgdal>=3.10 - - numpy>=2.2.0 + - numpy<2.0 - xarray>=2025.1.0 - pip - requests>=2.32.0 - boto3>=1.37.0 - - boto3-stubs>=1.37.0 + - boto3-stubs>=1.37.0 # type hints - lxml>=5.3.0 - mypy>=1.15.0 - loguru>=0.7.0 - - pandas-stubs >=2.0.0 + - pandas-stubs >=2.0.0 # type hints + - rasterio>=1.4.0 + - rioxarray>=0.19.0 - pip: - - pytest-stub>=1.1.0 - - rasterio>=1.4.0 - - rioxarray>=0.19.0 + - pytest-stub>=1.1.0 # type hints From 95fc35b5b56258d73ca8122716d07bd6d8404892 Mon Sep 17 00:00:00 2001 From: Anton Perepelenko Date: Thu, 25 Sep 2025 13:41:09 +0300 Subject: [PATCH 2/3] fix typing --- asar_xarray/asar.py | 5 +++-- asar_xarray/envisat_direct.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/asar_xarray/asar.py b/asar_xarray/asar.py index aa6f3f8..235721c 100644 --- a/asar_xarray/asar.py +++ b/asar_xarray/asar.py @@ -12,6 +12,7 @@ from xarray.core.types import ReadBuffer from asar_xarray import reader, utils, envisat_direct from loguru import logger +from numpy.typing import NDArray from asar_xarray.derived_subdatasets_metadata import process_derived_subdatasets_metadata from asar_xarray.general_metadata import process_general_metadata @@ -36,7 +37,7 @@ def get_metadata(gdal_dataset: gdal.Dataset) -> Dict[str, Any]: def open_asar_dataset(filename_or_obj: str | os.PathLike[Any] | ReadBuffer[ - Any] | bytes | memoryview | AbstractDataStore, + Any] | bytes | memoryview | AbstractDataStore, polarization: str | None = None) -> xr.Dataset: """ Open an ASAR dataset and converts it into an xarray Dataset. @@ -296,7 +297,7 @@ def compute_azimuth_time( product_first_line_utc_time: np.datetime64, product_last_line_utc_time: np.datetime64, number_of_lines: int -) -> np.ndarray: +) -> NDArray: """ Compute an array of azimuth times for each line in the ASAR product. diff --git a/asar_xarray/envisat_direct.py b/asar_xarray/envisat_direct.py index 8db8cf3..69ef382 100644 --- a/asar_xarray/envisat_direct.py +++ b/asar_xarray/envisat_direct.py @@ -5,6 +5,7 @@ import math import pathlib import numpy as np +from numpy.typing import NDArray def parse_int(s: str) -> int: @@ -113,7 +114,7 @@ def parse_direct(path: str, gdal_metadata: dict[str, Any], polarization: str) -> # antenna gain n_samp = gdal_metadata["line_length"] - spreading_loss: np.ndarray[Any] = np.array([]) + spreading_loss: NDArray[Any] = np.array([]) if gdal_metadata["sample_type"] == "DETECTED": gain_arr = np.ones(n_samp) spreading_loss = np.ones(n_samp) From 9d23e5a465986a2792b83e0392a292e21f80a959 Mon Sep 17 00:00:00 2001 From: Anton Perepelenko Date: Thu, 25 Sep 2025 13:44:28 +0300 Subject: [PATCH 3/3] fix typing --- asar_xarray/asar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asar_xarray/asar.py b/asar_xarray/asar.py index 235721c..0bc1bb5 100644 --- a/asar_xarray/asar.py +++ b/asar_xarray/asar.py @@ -297,7 +297,7 @@ def compute_azimuth_time( product_first_line_utc_time: np.datetime64, product_last_line_utc_time: np.datetime64, number_of_lines: int -) -> NDArray: +) -> NDArray[Any]: """ Compute an array of azimuth times for each line in the ASAR product.