-
|
Hi, Is there a way to read GeoTIFF properties like compression, blockxsize, etc? For instance, I would like to create a new raster using the block (tile) size of another one. With rasterio I use profiles, but I haven't found an equivalent for rioxarray. |
Beta Was this translation helpful? Give feedback.
Answered by
scottyhq
Apr 14, 2025
Replies: 1 comment
-
|
Since rasterio is a dependency of rioxarray I typically just stick with rasterio for this: import rasterio
url = 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/M/YB/2020/8/S2A_36MYB_20200814_0_L2A/B04.tif'
with rasterio.open(url) as src:
print(src.profile)
{'driver': 'GTiff', 'dtype': 'uint16', 'nodata': 0.0, 'width': 10980, 'height': 10980, 'count': 1, 'crs': CRS.from_epsg(32736), 'transform': Affine(10.0, 0.0, 699960.0,
0.0, -10.0, 9700000.0), 'blockxsize': 1024, 'blockysize': 1024, 'tiled': True, 'compress': 'deflate', 'interleave': 'band'}For blocksize (but I don't think compression type) you could also look at the import rioxarray
da = rioxarray.open_rasterio(url)
da.encoding
{'grid_mapping': 'spatial_ref',
'preferred_chunks': {'y': 1024, 'x': 1024, 'band': 1},
'source': 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/M/YB/2020/8/S2A_36MYB_20200814_0_L2A/B04.tif',
'rasterio_dtype': 'uint16'} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
snowman2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since rasterio is a dependency of rioxarray I typically just stick with rasterio for this:
For blocksize (but I don't think compression type) you could also look at the
encodingattribute of the Data…