Replies: 1 comment 2 replies
-
https://corteva.github.io/rioxarray/stable/getting_started/manage_information_loss.html |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
im quite new to this and looking for some advice. Following this example from the rioxarray documentation using dask to parallelize reading/writing large datasets:
with LocalCluster() as cluster, Client(cluster) as client:
xds = rioxarray.open_rasterio(
"../../test/test_data/compare/small_dem_3m_merged.tif",
chunks=True,
lock=False,
# lock=Lock("rio-read", client=client), # when too many file handles open
)
xds.rio.to_raster(
"dask_multiworker.tif",
tiled=True,
lock=Lock("rio", client=client),
)
I am trying to load multiple single band tiffs into dask arrays and concatenate them to one 3-D dask array. However the resulting array does not have the rio attribute anymore, which makes it impossible calling rio.to_raster() to write the stack on disk.
Any advice why that might be and how I could circumvent the issue? Thanks a lot!
Actual code:
f = 'filename...'
sList = []
sTags = {'date': dList}
for band, layer in enumerate(fList, start=1):
load single band rasters
dLayer = rioxarray.open_rasterio(layer, chunks='auto', lock=False,)
sList.append(dLayer)
concatenate array list to new 3-D dask array
stackLAI = da.concatenate(sList, axis=0)
write 3-D dask array to disk as multi band GeoTiff
stackLAI.rio.to_raster(f, tiled=True, tags=sTags, driver='GTiff', dtype='float32', lock=Lock("rio", client=client),)
Beta Was this translation helpful? Give feedback.
All reactions