Skip to content

Discrepancy between clip methods #310

@remi-braun

Description

@remi-braun

Code Sample, a copy-pastable example if possible

Shapes:
raster_mask.zip

Raster:
raster.zip

>>> xda = rioxarray.open_rasterio("raster.tif")
>>> shapes = gpd.read_file("raster_mask.geojson")
>>> A = xda.rio.clip(shapes.geometry, from_disk=True)
>>> B = xda.rio.clip(shapes.geometry, from_disk=False)
>>> A.shape
(1, 321, 363)
>>> B.shape
(1, 320, 361)

Problem description

The rasterio mask method gives another result than the default clip behavior.
The discrepancy stands in the border, 1 (or 0) pixels are added with the rasterio method:
2021-04-21_11h50_08

Expected Output

Same shape

Environment Information

rioxarray (0.3.1) deps:
rasterio: 1.2.3
xarray: 0.17.0
GDAL: 3.2.2
Other python deps:
scipy: 1.6.2
pyproj: 3.0.1
System:
python: 3.7.0 | packaged by conda-forge | (default, Nov 12 2018, 20:47:31) [MSC v.1900 64 bit (AMD64)]
executable: C:\Users\rbraun\Anaconda3\envs\sertit\python.exe
machine: Windows-10-10.0.19041-SP0

Installation method

  • pypi

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationDocumentation related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions