-
|
Hi! That looks like a great lib! 👏🏽 : I would like to read a large dataset, perform some interpolation on the data and the mask, then write the masked array back to another dataset. The way I've been doing that is the following: # Read dataset
x_array = rioxarray.open_rasterio(inputFile, masked=True, chunks = (1,'auto','auto'))
# Create a view
src_array = x_array.to_masked_array(copy=False)
# ...
# some operations to produce arr_interpolate and mask_interpolated from scr_array ...
# ...
# Create the dask masked array
interpolated = da.ma.masked_array(arr_interpolated, mask_interpolated)
# Fill the mask with nodata value for writing dataset
filled = da.ma.filled(interpolated, fill_value=source.nodata)
# I want to push that back to the writing step
filled.compute()
new_meta = source.meta
with rasterio.open(outputFile, "w", **new_meta) as dst:
dst.write(filled)The problem is that the array filled = da.ma.filled(interpolated, fill_value=source.nodata)
new_meta = source.meta
with rioxarray.open_rasterio(inputFile, "w", **new_meta) as dst:
dst.write(filled)But it fails with: How are we supposed to perform writing without having to call the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
Have you looked at these examples? |
Beta Was this translation helpful? Give feedback.
-
|
Yes I have read them! 😃 But it is still unclear how I should call the writing part? filled.rio.to_raster(outputFile, lock=threading.Lock()) |
Beta Was this translation helpful? Give feedback.
Yes I have read them! 😃 But it is still unclear how I should call the writing part?
Am I supposed to call the following?