postprocess_data.readers.base_netcdf_reader module

class postprocess_data.readers.base_netcdf_reader.BaseNetCDFProcessor(options)

Bases: object

The base class to process NetCDF files for physical and biological variables.

options

Configuration options for processing files.

Type:

object

_combine_datasets(datasets)

Combine multiple datasets into one.

Parameters:

datasets (list) – List of datasets to combine.

Returns:

The combined dataset.

Return type:

Dataset

_create_dataset(ds, vars_dict, suffix)

Create a dataset with the specified variables and suffix.

Parameters:
  • ds (Dataset) – The input dataset.

  • vars_dict (dict) – Dictionary of variables to process.

  • suffix (str) – Suffix to append to variable names.

Returns:

The created dataset with processed variables.

Return type:

Dataset

_get_files(base_path, pattern)

Get files matching the pattern from the base path.

Parameters:
  • base_path (str) – The base path to search for files.

  • pattern (str) – The pattern to match files.

Returns:

A list of files matching the pattern.

Return type:

list

_interpolate_time(ds)

Interpolate the dataset over time.

Parameters:

ds (Dataset) – The input dataset.

Returns:

The interpolated dataset.

Return type:

Dataset

_process_bottom(ds, var_type)

Process the bottom dataset for the given variable type.

Parameters:
  • ds (Dataset) – The input dataset.

  • var_type (str) – The variable type (‘phys_vars’ or ‘bio_vars’).

Returns:

The processed bottom dataset.

Return type:

Dataset

_process_integrated(ds, var_type)

Process the integrated dataset for the given variable type.

Parameters:
  • ds (Dataset) – The input dataset.

  • var_type (str) – The variable type (‘phys_vars’ or ‘bio_vars’).

Returns:

The processed integrated dataset.

Return type:

Dataset

_process_surface(ds, var_type)

Process the surface dataset for the given variable type.

Parameters:
  • ds (Dataset) – The input dataset.

  • var_type (str) – The variable type (‘phys_vars’ or ‘bio_vars’).

Returns:

The processed surface dataset.

Return type:

Dataset

abstract _process_variable(ds, var, suffix)

Process a single variable from the dataset.

Parameters:
  • ds (Dataset) – The input dataset.

  • var (str) – The variable name to process.

  • suffix (str) – Suffix to append to the variable name.

Returns:

The processed variable. str: The units of the processed variable.

Return type:

DataArray

_save_all(combined_surface_ds, combined_bottom_ds, combined_integrated_ds)

Save all datasets into one file.

Parameters:
  • combined_surface_ds (dict) – Combined surface datasets.

  • combined_bottom_ds (dict) – Combined bottom datasets.

  • combined_integrated_ds (dict) – Combined integrated datasets.

_save_by_phys_bio(combined_surface_ds, combined_bottom_ds, combined_integrated_ds)

Save datasets by physical and biological types.

Parameters:
  • combined_surface_ds (dict) – Combined surface datasets.

  • combined_bottom_ds (dict) – Combined bottom datasets.

  • combined_integrated_ds (dict) – Combined integrated datasets.

_save_by_variable(combined_surface_ds, combined_bottom_ds, combined_integrated_ds)

Save datasets by variable.

Parameters:
  • combined_surface_ds (dict) – Combined surface datasets.

  • combined_bottom_ds (dict) – Combined bottom datasets.

  • combined_integrated_ds (dict) – Combined integrated datasets.

_save_by_variable_type(combined_surface_ds, combined_bottom_ds, combined_integrated_ds)

Save datasets by variable type.

Parameters:
  • combined_surface_ds (dict) – Combined surface datasets.

  • combined_bottom_ds (dict) – Combined bottom datasets.

  • combined_integrated_ds (dict) – Combined integrated datasets.

_save_netcdf(ds, filename)

Save a dataset to a NetCDF file.

Parameters:
  • ds (Dataset) – The dataset to save.

  • filename (str) – The filename to save the dataset as.

_save_output(combined_surface_ds, combined_bottom_ds, combined_integrated_ds)

Save the output datasets based on the save_option.

Parameters:
  • combined_surface_ds (dict) – Combined surface datasets.

  • combined_bottom_ds (dict) – Combined bottom datasets.

  • combined_integrated_ds (dict) – Combined integrated datasets.

_save_yearly(combined_surface_ds, combined_bottom_ds, combined_integrated_ds)

Save datasets yearly.

Parameters:
  • combined_surface_ds (dict) – Combined surface datasets.

  • combined_bottom_ds (dict) – Combined bottom datasets.

  • combined_integrated_ds (dict) – Combined integrated datasets.

abstract process_files()

Process NetCDF files for physical and biological variables.