I have a custom Landsat cloud mask based on QA band with values 0 and 1 and a Landsat panchromatic band. When I try to match cloud mask to a resolution of a panchromatic band with odc.reproject, 0's in a mask are replaced with -1's.
mask_pan = mask.odc.reproject(pan.odc.geobox).persist()
mask.rio.nodata == None # True (nodata is not set)
mask_pan.rio.nodata == None # True (nodata is not set)
mask.data[0][2000][2000].compute() # 0 (0 - data, 1 - cloud)
mask_pan.data[0][4000][4000].compute() # -1 (panchromatic band is 2x larger than the others)
np.unique(mask) # array([0, 1])
np.unique(mask_pan) # array([-1, 1])
But, for example, if we set a nodata in mask, or pass dst_nodata=-1 arg, then 0's are not replaced.
Also, it happens only if data is integer, and everything works correctly if data is float.
I have a custom Landsat cloud mask based on QA band with values 0 and 1 and a Landsat panchromatic band. When I try to match cloud mask to a resolution of a panchromatic band with
odc.reproject
, 0's in a mask are replaced with -1's.But, for example, if we set a nodata in
mask
, or passdst_nodata=-1
arg, then 0's are not replaced.Also, it happens only if data is integer, and everything works correctly if data is float.
P.S. Here is also a notebook with minimum examples that shows the cases when this bug occurs and when it does not. https://colab.research.google.com/drive/1MPoYkNOsBAZ6CBOSitYxtR1mhwn1QMU5?usp=sharing