credit.ocean.samudra_data#
Classes#
Functions#
|
|
|
Get the number of inference/rollout steps for the given time configuration. |
|
|
|
|
|
Compute the anomalies of a data variable. |
|
Rename variables if required. |
|
Validate the data such that we have the correct format for training/evaluation. |
Module Contents#
- credit.ocean.samudra_data.extract_wet_mask(data, outputs, hist)#
- credit.ocean.samudra_data.get_inference_steps(time_config, time_delta=5, hist=1)#
Get the number of inference/rollout steps for the given time configuration.
- Parameters:
time_config – Time configuration
time_delta – Time delta in days
hist – Number of rollout steps
- Returns:
Number of rollout steps
- Return type:
num_steps
- credit.ocean.samudra_data.convert_tensor_out_to_dict(tensor_out: torch.Tensor) Dict[str, torch.Tensor]#
- credit.ocean.samudra_data.get_norm_unnorm_dicts(data: torch.Tensor, input_type: str = 'target', prognostic_channels: int = 0, hist: int = 1)#
- credit.ocean.samudra_data.compute_anomalies(data: xarray.Dataset, var: str) xarray.Dataset#
Compute the anomalies of a data variable.
- credit.ocean.samudra_data.rename_vars(data: xarray.Dataset) xarray.Dataset#
Rename variables if required.
- credit.ocean.samudra_data.validate_data(data: xarray.Dataset, data_mean: xarray.Dataset, data_std: xarray.Dataset) Tuple[xarray.Dataset, xarray.Dataset, xarray.Dataset]#
Validate the data such that we have the correct format for training/evaluation.
- class credit.ocean.samudra_data.Normalize#
-
- classmethod init_instance(data_mean: xarray.Dataset, data_std: xarray.Dataset, prognostic_vars: str, boundary_vars: str, wet_mask: torch.Tensor) Normalize#
Initialize the singleton instance with normalization parameters.
- _initialize(data_mean: xarray.Dataset, data_std: xarray.Dataset, prognostic_vars: str, boundary_vars: str, wet_mask: torch.Tensor) None#
Store normalization parameters and pre-compute numpy arrays.
- _to_tensor(array: numpy.ndarray, device: torch.device) torch.Tensor#
Convert numpy array to tensor on specified device.
- normalize_prognostics(data: xarray.Dataset, fill_nan=True, fill_value=0.0) xarray.Dataset#
Normalize input dataset.
- normalize_boundary(data: xarray.Dataset, fill_nan=True, fill_value=0.0) xarray.Dataset#
Normalize boundary conditions.
- unnormalize_prognostics(data: xarray.Dataset) xarray.Dataset#
Unnormalize output dataset.
- normalize_tensor_prognostics(data: torch.Tensor, fill_nan=True, fill_value=0.0) torch.Tensor#
Normalize output tensor.
- unnormalize_tensor_prognostics(data: torch.Tensor) torch.Tensor#
Unnormalize output tensor.
- normalize_numpy_prognostics(data: numpy.ndarray, fill_nan=True, fill_value=0.0) numpy.ndarray#
Normalize output numpy array.
- unnormalize_numpy_prognostics(data: numpy.ndarray) numpy.ndarray#
Unnormalize output numpy array.