Skip to content

New design for SITS classes

MICHEL Julien requested to merge refactor_time_series into master

In order to address concerns expressed by @jordi.inglada , and because I need a proper sits modelling for another project, I tried to derive a new design which better suits our cases.

The MonoModalSITS class requires doy with same batch and time dim as data, and mask with same dims as data except for channel dimension. It can be used to represent mono-modal sits (e.g. the Sentinel-2 part of PASTIS-R) without having to reshape everything and increase memory usage.

The MultiModalSITS has the requirements of the former SITS class (e.g. same shape for data, doy and mask). It can be used when we need full flexibility (e.g. joint time-series of S1 and S2).

MonoModalSITS has a as_multimodal() method that does the conversion.

I also provide a free function to concatenate MultiModalSITS along the channel dimension

So reading S2 and S1 separately and mergin then should be as easy as:

s2_mono_sits = MonoModalSITS(s2_data, s2_doy, s2_mask)
s1_mono_sits = MonoModalSITS(s1_data, s1_doy, s1_mask)
joint_sits = cat_multimodal_sits([s1_mono_sits.as_multimodal(), s2_mono_sits.as_multimodal()])

Which we can do wherever we want in the pipeline (for instance after transfer to GPU)

SITS class stays and becomes a base class that factors methods such as shape(), dim(), or to(...).

I also added a handy SITS.pad_acquisition_time() method (name to be discussed) that allows to align the time dimension to a user-defined padding in the time dimension.

This is only a proposal, let me know what you think.

Edited by MICHEL Julien

Merge request reports

Loading