Do not impose mask dtype to be bool
Currently, mask in the SITS
class need to be bool
(i.e., 0 or 1). In some cases it can be usefull to allow for non-binary mask: e.g., when using probabilistic values of having a cloud/shadow.
In the current state of SITS
class, to allow for non binary mask, some modifications are required
-
Remove assert in the init function -
In to
method: handle casting -
In pad_acquisition_time
, pass the right type of value (true or 1) toconstant_pad_end
-
In subset_doy_monomodal_sits
: check actual mask dtype for initout_mask
tensor -
In sits_where
: handle thelogical_and
properly
Futhermore, others methods based on SITS
assume mask dtype is boolean (e.g., mutan and linear_gapfilling) and does not check it (delegates it to SITS constructor). I am wondering what is the best solution to allow non binary initialization: add a flag that desactivate the assert ? Something like
class SITS:
"""
Base class for SITS data
"""
def __init__(
self, data: torch.Tensor, doy: torch.Tensor, mask: None | torch.Tensor = None, require_boolean_mask: bool=True,
):
assert mask.dtype == torch.bool or require_boolean_mask == False
Edited by FAUVEL Mathieu