I am trying to upscale a raster using rasterio
but I don't know why my process gets killed.
It can print "i am arrived here"
but on the reproject()
I have as terminal output:
killed
This is the code I am trying to run:
with rasterio.open(mask) as src:
df_mask = src.read(1)
aff_mask = src.transform
profile_mask = src.profile
width = src.width
profile_esm.update( compress='lzw', dtype = 'float32' )
## using reproject with the same CRS but changing the cell size
new_df= np.empty( shape = ( round(df_mask.shape[0] * 10),
round(df_mask.shape[1] * 10 )), dtype = 'float32')
newaff = Affine(aff_mask.a / 10, aff_mask.b, aff_mask.c,
aff_mask.d, aff_mask.e / 10, aff_mask.f)
profile_mask.update( compress='lzw', dtype = 'float32')
print("i am arrived here")
reproject(
df_mask, new_df,
src_transform = aff_mask,
dst_transform = newaff,
src_crs = src.crs,
dst_crs = src.crs,
resampling = Resampling.nearest)
print("i am after")
with rasterio.open('resampling_mask.tif', 'w', **profile_mask) as dst:
reproject(
df_mask, new_df,
src_transform = aff_mask,
dst_transform = newaff,
src_crs = src.crs,
dst_crs = src.crs,
resampling = Resampling.nearest)
dst.write(new_df, indexes=1)