Skip to content

Incompatibility with recent xarray #92

@avalentino

Description

@avalentino

Apparently there is an incompatibility with recent xarray version.
Please find below the test results that I get on Debian with xarray v2025.12.0:

python3.13 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.13.11, pytest-9.0.2, pluggy-1.6.0
rootdir: /build/sarsen-0.9.5+ds/.pybuild/cpython3_3.13/build
configfile: pyproject.toml
plugins: typeguard-4.4.4
collected 35 items

tests/test_00_version.py .                                               [  2%]
tests/test_10_chunking.py ...                                            [ 11%]
tests/test_10_datamodel.py .                                             [ 14%]
tests/test_10_orbit.py .....                                             [ 28%]
tests/test_10_scene.py FxFF                                              [ 40%]
tests/test_20_geocoding.py .EE                                           [ 48%]
tests/test_20_sentinel1.py ...                                           [ 57%]
tests/test_30_radiometry.py E                                            [ 60%]
tests/test_50_apps.py ssssssssssss                                       [ 94%]
tests/test_60_main.py X                                                  [ 97%]
tests/test_90_sarsen.py .                                                [100%]

==================================== ERRORS ====================================
_________ ERROR at setup of test_zero_doppler_plane_distance_velocity __________

dem_raster = <xarray.DataArray 'dem' (y: 0, x: 360)> Size: 0B
[0 values with dtype=float32]
Coordinates:
  * y            (y) float...
    spatial_ref  int64 8B ...
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation

    @pytest.fixture
    def dem_ecef(dem_raster: xr.DataArray) -> xr.DataArray:
        from sarsen import scene
    
>       return scene.convert_to_dem_ecef(dem_raster, source_crs=dem_raster.rio.crs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/conftest.py:61: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
sarsen/scene.py:109: in convert_to_dem_ecef
    dem_3d = convert_to_dem_3d(dem_raster, x=x, y=y)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sarsen/scene.py:42: in convert_to_dem_3d
    _, dem_raster_x = xr.broadcast(dem_raster, dem_raster.coords[x].astype(dtype))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:1297: in broadcast
    args = align(*args, join="outer", copy=False, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:967: in align
    aligner.align()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:667: in align
    self.reindex_all()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:638: in reindex_all
    self.results = tuple(
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:627: in _reindex_one
    return obj._reindex_callback(
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:1968: in _reindex_callback
    ds = self._to_temp_dataset()
         ^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:582: in _to_temp_dataset
    return self._to_dataset_whole(name=_THIS_ARRAY, shallow_copy=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:649: in _to_dataset_whole
    return Dataset._construct_direct(variables, coord_names, indexes=indexes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataset.py:853: in _construct_direct
    dims = calculate_dimensions(variables)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'x': <xarray.IndexVariable 'x' (x: 360)> Size: 3kB
array([12.45    , 12.450278, 12.450556, ..., 12.549167, 12.549444,...[0 values with dtype=float32]
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation}

    def calculate_dimensions(variables: Mapping[Any, Variable]) -> dict[Hashable, int]:
        """Calculate the dimensions corresponding to a set of variables.
    
        Returns dictionary mapping from dimension names to sizes. Raises ValueError
        if any of the dimension sizes conflict.
        """
        dims: dict[Hashable, int] = {}
        last_used = {}
        scalar_vars = {k for k, v in variables.items() if not v.dims}
        for k, var in variables.items():
            for dim, size in zip(var.dims, var.shape, strict=True):
                if dim in scalar_vars:
                    raise ValueError(
                        f"dimension {dim!r} already exists as a scalar variable"
                    )
                if dim not in dims:
                    dims[dim] = size
                    last_used[dim] = k
                elif dims[dim] != size:
>                   raise ValueError(
                        f"conflicting sizes for dimension {dim!r}: "
                        f"length {size} on {k!r} and length {dims[dim]} on {last_used!r}"
                    )
E                   ValueError: conflicting sizes for dimension 'y': length 0 on <this-array> and length 360 on {'x': 'x', 'y': 'y'}

/usr/lib/python3/dist-packages/xarray/core/variable.py:3143: ValueError
___________________ ERROR at setup of test_backward_geocode ____________________

dem_raster = <xarray.DataArray 'dem' (y: 0, x: 360)> Size: 0B
[0 values with dtype=float32]
Coordinates:
  * y            (y) float...
    spatial_ref  int64 8B ...
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation

    @pytest.fixture
    def dem_ecef(dem_raster: xr.DataArray) -> xr.DataArray:
        from sarsen import scene
    
>       return scene.convert_to_dem_ecef(dem_raster, source_crs=dem_raster.rio.crs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/conftest.py:61: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
sarsen/scene.py:109: in convert_to_dem_ecef
    dem_3d = convert_to_dem_3d(dem_raster, x=x, y=y)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sarsen/scene.py:42: in convert_to_dem_3d
    _, dem_raster_x = xr.broadcast(dem_raster, dem_raster.coords[x].astype(dtype))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:1297: in broadcast
    args = align(*args, join="outer", copy=False, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:967: in align
    aligner.align()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:667: in align
    self.reindex_all()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:638: in reindex_all
    self.results = tuple(
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:627: in _reindex_one
    return obj._reindex_callback(
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:1968: in _reindex_callback
    ds = self._to_temp_dataset()
         ^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:582: in _to_temp_dataset
    return self._to_dataset_whole(name=_THIS_ARRAY, shallow_copy=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:649: in _to_dataset_whole
    return Dataset._construct_direct(variables, coord_names, indexes=indexes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataset.py:853: in _construct_direct
    dims = calculate_dimensions(variables)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'x': <xarray.IndexVariable 'x' (x: 360)> Size: 3kB
array([12.45    , 12.450278, 12.450556, ..., 12.549167, 12.549444,...[0 values with dtype=float32]
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation}

    def calculate_dimensions(variables: Mapping[Any, Variable]) -> dict[Hashable, int]:
        """Calculate the dimensions corresponding to a set of variables.
    
        Returns dictionary mapping from dimension names to sizes. Raises ValueError
        if any of the dimension sizes conflict.
        """
        dims: dict[Hashable, int] = {}
        last_used = {}
        scalar_vars = {k for k, v in variables.items() if not v.dims}
        for k, var in variables.items():
            for dim, size in zip(var.dims, var.shape, strict=True):
                if dim in scalar_vars:
                    raise ValueError(
                        f"dimension {dim!r} already exists as a scalar variable"
                    )
                if dim not in dims:
                    dims[dim] = size
                    last_used[dim] = k
                elif dims[dim] != size:
>                   raise ValueError(
                        f"conflicting sizes for dimension {dim!r}: "
                        f"length {size} on {k!r} and length {dims[dim]} on {last_used!r}"
                    )
E                   ValueError: conflicting sizes for dimension 'y': length 0 on <this-array> and length 360 on {'x': 'x', 'y': 'y'}

/usr/lib/python3/dist-packages/xarray/core/variable.py:3143: ValueError
__________________ ERROR at setup of test_compute_gamma_area ___________________

dem_raster = <xarray.DataArray 'dem' (y: 0, x: 360)> Size: 0B
[0 values with dtype=float32]
Coordinates:
  * y            (y) float...
    spatial_ref  int64 8B ...
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation

    @pytest.fixture
    def dem_ecef(dem_raster: xr.DataArray) -> xr.DataArray:
        from sarsen import scene
    
>       return scene.convert_to_dem_ecef(dem_raster, source_crs=dem_raster.rio.crs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/conftest.py:61: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
sarsen/scene.py:109: in convert_to_dem_ecef
    dem_3d = convert_to_dem_3d(dem_raster, x=x, y=y)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sarsen/scene.py:42: in convert_to_dem_3d
    _, dem_raster_x = xr.broadcast(dem_raster, dem_raster.coords[x].astype(dtype))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:1297: in broadcast
    args = align(*args, join="outer", copy=False, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:967: in align
    aligner.align()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:667: in align
    self.reindex_all()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:638: in reindex_all
    self.results = tuple(
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:627: in _reindex_one
    return obj._reindex_callback(
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:1968: in _reindex_callback
    ds = self._to_temp_dataset()
         ^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:582: in _to_temp_dataset
    return self._to_dataset_whole(name=_THIS_ARRAY, shallow_copy=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:649: in _to_dataset_whole
    return Dataset._construct_direct(variables, coord_names, indexes=indexes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataset.py:853: in _construct_direct
    dims = calculate_dimensions(variables)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'x': <xarray.IndexVariable 'x' (x: 360)> Size: 3kB
array([12.45    , 12.450278, 12.450556, ..., 12.549167, 12.549444,...[0 values with dtype=float32]
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation}

    def calculate_dimensions(variables: Mapping[Any, Variable]) -> dict[Hashable, int]:
        """Calculate the dimensions corresponding to a set of variables.
    
        Returns dictionary mapping from dimension names to sizes. Raises ValueError
        if any of the dimension sizes conflict.
        """
        dims: dict[Hashable, int] = {}
        last_used = {}
        scalar_vars = {k for k, v in variables.items() if not v.dims}
        for k, var in variables.items():
            for dim, size in zip(var.dims, var.shape, strict=True):
                if dim in scalar_vars:
                    raise ValueError(
                        f"dimension {dim!r} already exists as a scalar variable"
                    )
                if dim not in dims:
                    dims[dim] = size
                    last_used[dim] = k
                elif dims[dim] != size:
>                   raise ValueError(
                        f"conflicting sizes for dimension {dim!r}: "
                        f"length {size} on {k!r} and length {dims[dim]} on {last_used!r}"
                    )
E                   ValueError: conflicting sizes for dimension 'y': length 0 on <this-array> and length 360 on {'x': 'x', 'y': 'y'}

/usr/lib/python3/dist-packages/xarray/core/variable.py:3143: ValueError
=================================== FAILURES ===================================
____________________________ test_convert_to_dem_3d ____________________________

dem_raster = <xarray.DataArray 'dem' (y: 0, x: 360)> Size: 0B
[0 values with dtype=float32]
Coordinates:
  * y            (y) float...
    spatial_ref  int64 8B ...
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation

    def test_convert_to_dem_3d(dem_raster: xr.DataArray) -> None:
>       res = scene.convert_to_dem_3d(dem_raster)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/test_10_scene.py:9: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
sarsen/scene.py:42: in convert_to_dem_3d
    _, dem_raster_x = xr.broadcast(dem_raster, dem_raster.coords[x].astype(dtype))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:1297: in broadcast
    args = align(*args, join="outer", copy=False, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:967: in align
    aligner.align()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:667: in align
    self.reindex_all()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:638: in reindex_all
    self.results = tuple(
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:627: in _reindex_one
    return obj._reindex_callback(
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:1968: in _reindex_callback
    ds = self._to_temp_dataset()
         ^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:582: in _to_temp_dataset
    return self._to_dataset_whole(name=_THIS_ARRAY, shallow_copy=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:649: in _to_dataset_whole
    return Dataset._construct_direct(variables, coord_names, indexes=indexes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataset.py:853: in _construct_direct
    dims = calculate_dimensions(variables)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'x': <xarray.IndexVariable 'x' (x: 360)> Size: 3kB
array([12.45    , 12.450278, 12.450556, ..., 12.549167, 12.549444,...[0 values with dtype=float32]
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation}

    def calculate_dimensions(variables: Mapping[Any, Variable]) -> dict[Hashable, int]:
        """Calculate the dimensions corresponding to a set of variables.
    
        Returns dictionary mapping from dimension names to sizes. Raises ValueError
        if any of the dimension sizes conflict.
        """
        dims: dict[Hashable, int] = {}
        last_used = {}
        scalar_vars = {k for k, v in variables.items() if not v.dims}
        for k, var in variables.items():
            for dim, size in zip(var.dims, var.shape, strict=True):
                if dim in scalar_vars:
                    raise ValueError(
                        f"dimension {dim!r} already exists as a scalar variable"
                    )
                if dim not in dims:
                    dims[dim] = size
                    last_used[dim] = k
                elif dims[dim] != size:
>                   raise ValueError(
                        f"conflicting sizes for dimension {dim!r}: "
                        f"length {size} on {k!r} and length {dims[dim]} on {last_used!r}"
                    )
E                   ValueError: conflicting sizes for dimension 'y': length 0 on <this-array> and length 360 on {'x': 'x', 'y': 'y'}

/usr/lib/python3/dist-packages/xarray/core/variable.py:3143: ValueError
________________________________ test_upsample _________________________________

dem_raster = <xarray.DataArray 'dem' (y: 0, x: 360)> Size: 0B
[0 values with dtype=float32]
Coordinates:
  * y            (y) float...
    spatial_ref  int64 8B ...
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation

    def test_upsample(dem_raster: xr.DataArray) -> None:
>       res = scene.upsample(dem_raster, x=2)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/test_10_scene.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
sarsen/scene.py:103: in upsample
    return data.interp(coords, kwargs={"fill_value": "extrapolate"})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:2414: in interp
    ds = self._to_temp_dataset().interp(
         ^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:582: in _to_temp_dataset
    return self._to_dataset_whole(name=_THIS_ARRAY, shallow_copy=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:649: in _to_dataset_whole
    return Dataset._construct_direct(variables, coord_names, indexes=indexes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataset.py:853: in _construct_direct
    dims = calculate_dimensions(variables)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'x': <xarray.IndexVariable 'x' (x: 360)> Size: 3kB
array([12.45    , 12.450278, 12.450556, ..., 12.549167, 12.549444,...[0 values with dtype=float32]
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation}

    def calculate_dimensions(variables: Mapping[Any, Variable]) -> dict[Hashable, int]:
        """Calculate the dimensions corresponding to a set of variables.
    
        Returns dictionary mapping from dimension names to sizes. Raises ValueError
        if any of the dimension sizes conflict.
        """
        dims: dict[Hashable, int] = {}
        last_used = {}
        scalar_vars = {k for k, v in variables.items() if not v.dims}
        for k, var in variables.items():
            for dim, size in zip(var.dims, var.shape, strict=True):
                if dim in scalar_vars:
                    raise ValueError(
                        f"dimension {dim!r} already exists as a scalar variable"
                    )
                if dim not in dims:
                    dims[dim] = size
                    last_used[dim] = k
                elif dims[dim] != size:
>                   raise ValueError(
                        f"conflicting sizes for dimension {dim!r}: "
                        f"length {size} on {k!r} and length {dims[dim]} on {last_used!r}"
                    )
E                   ValueError: conflicting sizes for dimension 'y': length 0 on <this-array> and length 360 on {'x': 'x', 'y': 'y'}

/usr/lib/python3/dist-packages/xarray/core/variable.py:3143: ValueError
________________________ test_compute_dem_oriented_area ________________________

dem_raster = <xarray.DataArray 'dem' (y: 0, x: 360)> Size: 0B
[0 values with dtype=float32]
Coordinates:
  * y            (y) float...
    spatial_ref  int64 8B ...
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation

    def test_compute_dem_oriented_area(dem_raster: xr.DataArray) -> None:
>       dem_3d = scene.convert_to_dem_3d(dem_raster)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/test_10_scene.py:46: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
sarsen/scene.py:42: in convert_to_dem_3d
    _, dem_raster_x = xr.broadcast(dem_raster, dem_raster.coords[x].astype(dtype))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:1297: in broadcast
    args = align(*args, join="outer", copy=False, exclude=exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:967: in align
    aligner.align()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:667: in align
    self.reindex_all()
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:638: in reindex_all
    self.results = tuple(
/usr/lib/python3/dist-packages/xarray/structure/alignment.py:627: in _reindex_one
    return obj._reindex_callback(
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:1968: in _reindex_callback
    ds = self._to_temp_dataset()
         ^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:582: in _to_temp_dataset
    return self._to_dataset_whole(name=_THIS_ARRAY, shallow_copy=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataarray.py:649: in _to_dataset_whole
    return Dataset._construct_direct(variables, coord_names, indexes=indexes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/xarray/core/dataset.py:853: in _construct_direct
    dims = calculate_dimensions(variables)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'x': <xarray.IndexVariable 'x' (x: 360)> Size: 3kB
array([12.45    , 12.450278, 12.450556, ..., 12.549167, 12.549444,...[0 values with dtype=float32]
Attributes:
    AREA_OR_POINT:  Area
    units:          m
    long_name:      elevation}

    def calculate_dimensions(variables: Mapping[Any, Variable]) -> dict[Hashable, int]:
        """Calculate the dimensions corresponding to a set of variables.
    
        Returns dictionary mapping from dimension names to sizes. Raises ValueError
        if any of the dimension sizes conflict.
        """
        dims: dict[Hashable, int] = {}
        last_used = {}
        scalar_vars = {k for k, v in variables.items() if not v.dims}
        for k, var in variables.items():
            for dim, size in zip(var.dims, var.shape, strict=True):
                if dim in scalar_vars:
                    raise ValueError(
                        f"dimension {dim!r} already exists as a scalar variable"
                    )
                if dim not in dims:
                    dims[dim] = size
                    last_used[dim] = k
                elif dims[dim] != size:
>                   raise ValueError(
                        f"conflicting sizes for dimension {dim!r}: "
                        f"length {size} on {k!r} and length {dims[dim]} on {last_used!r}"
                    )
E                   ValueError: conflicting sizes for dimension 'y': length 0 on <this-array> and length 360 on {'x': 'x', 'y': 'y'}

/usr/lib/python3/dist-packages/xarray/core/variable.py:3143: ValueError
=============================== warnings summary ===============================
tests/test_20_sentinel1.py::test_Sentinel1SarProduct[data_path0-IW/VV]
tests/test_20_sentinel1.py::test_Sentinel1SarProduct[data_path0-IW/VV]
tests/test_20_sentinel1.py::test_Sentinel1SarProduct[data_path0-IW/VV]
tests/test_20_sentinel1.py::test_Sentinel1SarProduct[data_path1-IW1/VV]
tests/test_20_sentinel1.py::test_Sentinel1SarProduct[data_path1-IW1/VV]
tests/test_20_sentinel1.py::test_Sentinel1SarProduct[data_path1-IW1/VV]
tests/test_20_sentinel1.py::test_product_info
  /usr/lib/python3/dist-packages/xarray_sentinel/sentinel1.py:411: DeprecationWarning: Arrays of 2-dimensional vectors are deprecated. Use arrays of 3-dimensional vectors instead. (deprecated in NumPy 2.0)
    return float(np.cross(poly[1] - start, poly[2] - start)) < 0

tests/test_20_sentinel1.py::test_Sentinel1SarProduct[data_path0-IW/VV]
tests/test_20_sentinel1.py::test_Sentinel1SarProduct[data_path0-IW/VV]
tests/test_20_sentinel1.py::test_Sentinel1SarProduct[data_path0-IW/VV]
  /usr/lib/python3/dist-packages/rioxarray/_io.py:1143: NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix will be returned.
    warnings.warn(str(rio_warning.message), type(rio_warning.message))  # type: ignore

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_10_scene.py::test_convert_to_dem_3d - ValueError: conflicti...
FAILED tests/test_10_scene.py::test_upsample - ValueError: conflicting sizes ...
FAILED tests/test_10_scene.py::test_compute_dem_oriented_area - ValueError: c...
ERROR tests/test_20_geocoding.py::test_zero_doppler_plane_distance_velocity
ERROR tests/test_20_geocoding.py::test_backward_geocode - ValueError: conflic...
ERROR tests/test_30_radiometry.py::test_compute_gamma_area - ValueError: conf...
= 3 failed, 15 passed, 12 skipped, 1 xfailed, 1 xpassed, 10 warnings, 3 errors in 14.01s =

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions