corteva / rioxarray

geospatial xarray extension powered by rasterio
https://corteva.github.io/rioxarray
Other
517 stars 82 forks source link

Wrong data value after reprojection #697

Closed zxdawn closed 1 year ago

zxdawn commented 1 year ago
import rioxarray
import xarray as xr

ds_dem_test = xr.open_dataset("dem_test.tif", engine="rasterio")
data_reproj = ds_dem_test['band_data'].rio.reproject("EPSG:32645")

Problem description

Original data (link) ds_dem_test['band_data']:

array([[[ 579.,  582., ..., 2029., 2040.],
        [ 595.,  603., ..., 1995., 2010.],
        ...,
        [ 530.,  532., ...,  446.,  437.],
        [ 520.,  519., ...,  450.,  447.]]], dtype=float32)

Reprojected data data_reproj:

array([[[3.4028235e+38, 3.4028235e+38, 3.4028235e+38, ...,
         3.4028235e+38, 3.4028235e+38, 3.4028235e+38],
        [3.4028235e+38, 3.4028235e+38, 3.4028235e+38, ...,
         3.4028235e+38, 3.4028235e+38, 3.4028235e+38],
        [3.4028235e+38, 3.4028235e+38, 3.4028235e+38, ...,
         3.4028235e+38, 3.4028235e+38, 3.4028235e+38],
        ...,
        [3.4028235e+38, 3.4028235e+38, 3.4028235e+38, ...,
         3.4028235e+38, 3.4028235e+38, 3.4028235e+38],
        [3.4028235e+38, 3.4028235e+38, 3.4028235e+38, ...,
         3.4028235e+38, 3.4028235e+38, 3.4028235e+38],
        [3.4028235e+38, 3.4028235e+38, 3.4028235e+38, ...,
         3.4028235e+38, 3.4028235e+38, 3.4028235e+38]]], dtype=float32)

Expected Output

Tha values should be similar

Environment Information

Installation method

Conda environment information (if you installed with conda):


Environment (conda list):

``` $ conda list | grep -E "rasterio|xarray|gdal" gdal 3.6.3 py310h0b34360_1 conda-forge jupyter_server_xarray_leaflet 0.2.3 pyhd8ed1ab_0 conda-forge large-image-source-gdal 1.23.5 pyhd8ed1ab_0 conda-forge libgdal 3.6.3 h0216b51_1 conda-forge pyvista-xarray 0.1.3 pyhd8ed1ab_0 conda-forge rasterio 1.3.6 py310h2630d6e_0 conda-forge rioxarray 0.15.0 pyhd8ed1ab_0 conda-forge xarray 2023.4.2 pyhd8ed1ab_0 conda-forge xarray_leaflet 0.2.3 pyhd8ed1ab_0 conda-forge ```
zxdawn commented 1 year ago

Ha, these large values are fill_value: data_reproj.where(data_reproj!=data_reproj.rio.nodata).plot(): image