I have a collection of raster stored in a directory. They are rasters of glaciers in same region. When I remove no data using rioxarray.where
method on individual rasters it works. But when I use this method on the merged
product generated using rioxarray.merge.merge_arrays
method, it does not remove the no data value (which is -9999). Below is the code. I apologize that I was not able to provide a reproducible example.
import rioxarray as rxr
from rioxarray import merge
import xarray as xr
import numpy as np
import glob
import matplotlib.pyplot as plt
path = r'ice_thickness_pandit/*.tif'
files = glob.glob(path)
files
elements = []
for item in files:
elements.append(rxr.open_rasterio(item))
merged = merge.merge_arrays(elements, nodata=-9999)
merged = merged.where(merged != -9999, drop = False)