satrain.target#
The satrain.target module provides the TargetConfig class to configure
the loading of the retrieval reference data.
Usage#
TargetConfig objects can be passed to the satrain.evaluation.Evaluator to configure
the MRMS pixels that are used in the evaluation of the retrieval. They can also be passed to
the dataset classes defined in satrain.pytorch.datasets to exclude low-quality pixels
from the training.
Members#
- class TargetConfig(target: str = 'surface_precip', min_rqi: float = 0.5, min_valid_fraction: float = 0.5, no_snow: bool = False, no_hail: bool = False, min_gcf: float | None = None, max_gcf: float | None = None, precip_threshold: float = 0.1, heavy_precip_threshold: float = 10.0)[source]#
The TargetConfig class is used to specify quality criteria for the precipitation target data loaded for training and evaluating precipitation retrievals.
The loaded precipitation values that don’t satisfy the quality requirements, will be set to NAN. This will cause them to be ignored by the
satrain.evaluation.Evaluator.- Parameters:
target – The name of the target variable. Should be ‘surface_precip’ for gauge-corrected MRMS surface precipitation downsampled to 0.036-degree resolution or ‘surface_precip_fpavg’ for footprint-average preciptiation.
min_rqi – Pixels with radar-quality index (RQI) below this value will be masked.
min_valid_fraction – The
valid_fractionrepresents the fraction of valid native-MRMS pixels withing the downsampled 0.036-degree resolution pixels. Pixels withvalid_fractionsbelow this value will be masked.no_snow – If
True, pixels with non-zero snow fraction will be masked.no_snow – If
True, pixels with non-zero hail fraction will be masked.min_gcf – Pixels with a gauge-correction factor less than this value will be masked.
max_gcf – Pixels with a gauge-correction factor greater than this will be masked.
precip_threshold – The threshold to use to distinguish raining from non-raining pixels.
heavy_precip_threshold – The threshold to use to identify heavy precipitation.
- get_mask(target_data: Path | str | Dataset) ndarray[source]#
Get mask identifying invalid reference samples according to the target config’s settings.
- Parameters:
target_data – A Path or str pointing to a target data file or an xarray.Dataset containing the data from a loaded retrieval target file.
- Returns:
A field of bool values identifying the target samples that should be ignored.
- load_heavy_precip_mask(target_data: Path | str | Dataset) ndarray[source]#
Load mask identifying heavy precipitation identified according to the target config object’s heavy precipitation threshold.
- Parameters:
target_data – A Path or str pointing to a target data file or an xarray.Dataset containing the data from a loaded retrieval target file.
- Returns:
A boolean numpy.ndarray containing the heavy precipitation mask.
- load_precip_mask(target_data: Path | str | Dataset) ndarray[source]#
Load mask identifying precipitation identified according to the target config object’s heavy precipitation threshold.
- Parameters:
target_data – A Path or str pointing to a target data file or an xarray.Dataset containing the data from a loaded retrieval target file.
- Returns:
A boolean numpy.ndarray containing the heavy precipitation mask.
- load_reference_precip(target_data: Path | str | Dataset) ndarray[source]#
Loads reference precip field data from a target file. The method ensure that the correct target variable is selected and masks samples not satisfying the quality requirements by setting them to NAN.
- Parameters:
target_data – A Path or str pointing to a target data file or an xarray.Dataset containing the data from a loaded retrieval target file.
- Returns:
A numpy.ndarray containing the loaded target data.