mod_stat module

mod_stat.bin_data(ds, output_file, lon_out=numpy.arange, lat_out=numpy.arange, freq_out='1D', method_name=' ')

Aggregate gridded data to a larger bin grid and calculate statistics.

Parameters:
  • ds (xarray.Dataset) – Dataset containing gridded data to be binned.

  • output_file (str) – Filepath to save binned data to.

  • lon_out (array_like, optional) – Array of longitude values for the output grid, by default np.arange(0, 360, 1).

  • lat_out (array_like, optional) – Array of latitude values for the output grid, by default np.arange(-90, 90, 1).

  • freq_out (str, optional) – Time frequency for temporal aggregation, by default ‘1D’.

  • method_name (str, optional) – Name of the method used, by default ‘ ‘.

Return type:

None

Notes

This function aggregates gridded data to a larger bin grid and calculates statistics, including mean, variance, and root mean square error (RMSE), for different datasets and timeseries. The results are saved to a NetCDF file.

Examples

>>> data = xr.open_dataset("gridded_data.nc")
>>> output_file = "binned_data.nc"
>>> bin_data(data, output_file)
mod_stat.bin_data_uv(ds, output_file, lon_out=numpy.arange, lat_out=numpy.arange, freq_out='1D', method_name='')

Bin and compute statistical measures for oceanographic current data.

Parameters:
  • ds (xarray.Dataset) – Input dataset containing oceanographic current data.

  • output_file (str) – Output file path for saving the results.

  • lon_out (numpy.ndarray, optional) – Longitudes for binning. Default is a range from 0 to 360 with step 1.

  • lat_out (numpy.ndarray, optional) – Latitudes for binning. Default is a range from -90 to 90 with step 1.

  • freq_out (str, optional) – Resampling frequency for time series data. Default is ‘1D’.

  • method_name (str, optional) – Name of the method used for computation. Default is an empty string.

Return type:

None

mod_stat.compute_stat_scores(ds_interp, lambda_min, lambda_max, output_file, method_name=' ')

Compute statistical scores for interpolation results.

Parameters:
  • ds_interp (xarray.Dataset) – Interpolated dataset containing ‘sla_interpolated’, ‘sla_unfiltered’, ‘lwe’, and ‘msla_interpolated’.

  • lambda_min (float) – Minimum wavelength for bandpass filter.

  • lambda_max (float) – Maximum wavelength for bandpass filter.

  • output_file (str) – Filepath to save computed statistics to.

  • method_name (str, optional) – Name of the method used, by default ‘ ‘.

Return type:

None

Notes

This function computes statistical scores for interpolation results, including mapping error, bandpass filtering, and binning statistics. The results are saved to a NetCDF file.

Examples

>>> interpolated_data = xr.open_dataset("interpolated_data.nc")
>>> output_file = "statistical_scores.nc"
>>> compute_stat_scores(interpolated_data, 10, 100, output_file)
mod_stat.compute_stat_scores_by_regimes(ds_interp, output_file)

Compute statistical scores by oceanic regimes.

Parameters:
  • ds_interp (xarray.Dataset) – Interpolated dataset containing ‘sla_interpolated’, ‘sla_unfiltered’, ‘lwe’, ‘msla_interpolated’, and ‘mask’.

  • output_file (str) – Filepath to save computed statistics by regimes to.

Return type:

None

Notes

This function computes statistical scores for interpolation results based on oceanic regimes. It masks the input data and calculates statistics for each regime separately. The results are saved to a NetCDF file.

Examples

>>> interpolated_data = xr.open_dataset("interpolated_data.nc")
>>> output_file = "regime_scores.nc"
>>> compute_stat_scores_by_regimes(interpolated_data, output_file)
mod_stat.compute_stat_scores_uv(ds_interp, output_file, method_name='')

Compute mapping errors and statistical measures for oceanographic current data.

Parameters:
  • ds_interp (xarray.Dataset) – Interpolated oceanographic current dataset.

  • output_file (str) – Output file path for saving the results.

  • method_name (str, optional) – Name of the method used for computation. Default is an empty string.

Return type:

None

mod_stat.compute_stat_scores_uv_by_regimes(ds_interp, output_file)

Compute statistical scores for oceanographic current data based on different oceanic regimes.

Parameters:
  • ds_interp (xarray.Dataset) – Interpolated oceanographic current dataset.

  • output_file (str) – Output file path for saving the results.

Return type:

None