Closed mohseniaref closed 3 months ago
bounding_box=tr1.rio.bounds() min_lon, min_lat, max_lon, max_lat = bounding_box # Amount to add to each coordinate degree_changea= 0.0002778181877900465*256 degree_changeo= 0.0002778181877900465*256 # New bounding box coordinates after adding 0.3 degrees new_min_lon = min_lon - degree_changeo new_min_lat = min_lat - degree_changea new_max_lon = max_lon + degree_changeo new_max_lat = max_lat + degree_changea padded_box=(new_min_lon, new_min_lat, new_max_lon, new_max_lat) padded_box=(new_min_lon, new_min_lat, new_max_lon, new_max_lat) tr=tr1.rio.pad_box(*padded_box) tr2=tr.rio.clip_box(*bounding_box)
tr.shape (86, 7427, 8565) tr1.shape (86, 6913, 8051) tr2.shape (86, 6913, 8052)
I expect after padding and croping to same bounding box ,I end up same array size which seems one pixel more!
tr1.shape (86, 6913, 8051) tr2.shape (86, 6913, 8051)
rioxarray (0.15.0) deps: rasterio: 1.3.9 xarray: 2023.12.0 GDAL: 3.6.4 GEOS: 3.11.1 PROJ: 9.0.1 PROJ DATA: /raid-manaslu/maref/Software/anaconda3/envs/sp/share/proj GDAL DATA: /raid-manaslu/maref/Software/anaconda3/envs/sp/share/gdal
Other python deps: scipy: 1.11.4 pyproj: 3.6.1
System: python: 3.10.0 | packaged by conda-forge | (default, Nov 20 2021, 02:24:10) [GCC 9.4.0] executable: /raid-manaslu/maref/Software/anaconda3/envs/sp/bin/python machine: Linux-5.4.0-156-generic-x86_64-with-glibc2.31
$ conda list | grep -E "rasterio|xarray|gdal"
Details about conda and system ( conda info ):
conda
conda info
Related #155
Thanks!
tr.shape (86, 7427, 8565) tr1.shape (86, 6913, 8051) tr2.shape (86, 6913, 8052)
Problem description
I expect after padding and croping to same bounding box ,I end up same array size which seems one pixel more!
Expected Output
tr1.shape (86, 6913, 8051) tr2.shape (86, 6913, 8051)
Environment Information
rioxarray (0.15.0) deps: rasterio: 1.3.9 xarray: 2023.12.0 GDAL: 3.6.4 GEOS: 3.11.1 PROJ: 9.0.1 PROJ DATA: /raid-manaslu/maref/Software/anaconda3/envs/sp/share/proj GDAL DATA: /raid-manaslu/maref/Software/anaconda3/envs/sp/share/gdal
Other python deps: scipy: 1.11.4 pyproj: 3.6.1
System: python: 3.10.0 | packaged by conda-forge | (default, Nov 20 2021, 02:24:10) [GCC 9.4.0] executable: /raid-manaslu/maref/Software/anaconda3/envs/sp/bin/python machine: Linux-5.4.0-156-generic-x86_64-with-glibc2.31
Details about
conda
and system (conda info
):