diff --git a/asar_xarray/asar.py b/asar_xarray/asar.py index aa6f3f8..0bc1bb5 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[Any]: """ 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) 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