Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23247

Storing multiple GeoTiffs in HDF5 file in Python

$
0
0

I want to store multiple GeoTiff files in one HDF5 file to use it for further analysis since the function I am supposed to use can just deal with HDF5 (so basically like a raster stack in R but stored in a HDF5). I have to use Python. I am relatively new to HDF5 format (and geoanalysis in Python generally) and don't really know how to approach this issue. Especially keeping the geolocation/projection inforation seems tricky to me. So far I tried:

import h5pyimport rasterior1 = rasterio.open("filename.tif")r2 = rasterio.open("filename2.tif")with h5py.File('path/test.h5', 'w') as hdf:    hdf.create_dataset('GeoTiff1', data=r1)    hdf.create_dataset('GeoTiff2', data=r2)

Yielding the following errror:

TypeError: Object dtype dtype('O') has no native HDF5 equivalent

I am pretty sure this not at all the correct approach and I'm happy about any suggestions.


Viewing all articles
Browse latest Browse all 23247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>