Dataset Processor Module

dataset_processor.ensemble(datasets)

Generate a single dataset which is the mean of the input datasets

Parameters:datasets – Datasets to be used to compose the ensemble dataset from.

Note - All Datasets must be the same shape :type datasets: List of OCW Dataset Objects

Returns:New Dataset with a name of ‘Dataset Ensemble’
Return type:OCW Dataset Object
dataset_processor.normalize_dataset_datetimes(dataset, timestep)

Normalize Dataset datetime values.

Force daily to an hour time value of 00:00:00. Force monthly data to the first of the month at midnight.

Parameters:
  • dataset (Dataset) – The Dataset which will have its’ time value normalized.
  • timestep (String) – The timestep of the Dataset’s values. Either ‘daily’ or ‘monthly’.
Returns:

A new Dataset with normalized datetimes.

dataset_processor.safe_subset(subregion, target_dataset)

Safely subset given dataset with subregion information

A standard subset requires that the provided subregion be entirely contained within the datasets bounds. safe_subset returns the overlap of the subregion and dataset without returning an error.

Parameters:
  • subregion (ocw.dataset.Bounds) – The Bounds with which to subset the target Dataset.
  • target_dataset (ocw.dataset.Dataset) – The Dataset object to subset.
Returns:

The subset-ed Dataset object

Return type:

Dataset

dataset_processor.spatial_regrid(target_dataset, new_latitudes, new_longitudes)

Regrid a Dataset using the new latitudes and longitudes

Parameters:
  • target_dataset (Open Climate Workbench Dataset Object) – Dataset object that needs temporal regridding applied
  • new_latitudes (1d Numpy Array) – Array of latitudes
  • new_longitudes (1d Numpy Array) – Array of longitudes
Returns:

A new spatially regridded Dataset

Return type:

Open Climate Workbench Dataset Object

dataset_processor.subset(subregion, target_dataset)

Subset given dataset(s) with subregion information

Parameters:
  • subregion (Bounds) – The Bounds with which to subset the target Dataset.
  • target_dataset (Dataset) – The Dataset object to subset.
Returns:

The subset-ed Dataset object

Return type:

Dataset

Raises:

ValueError

dataset_processor.temporal_rebin(target_dataset, temporal_resolution)

Rebin a Dataset to a new temporal resolution

Parameters:
  • target_dataset (Open Climate Workbench Dataset Object) – Dataset object that needs temporal regridding
  • temporal_resolution (Python datetime.timedelta object) – The new temporal bin size
Returns:

A new temporally rebinned Dataset

Return type:

Open Climate Workbench Dataset Object

dataset_processor.write_netcdf(dataset, path, compress=True)

Write a dataset to a NetCDF file.

Parameters:
  • dataset (ocw.dataset.Dataset) – The dataset to write.
  • path (string) – The output file path.

Previous topic

Dataset Module

Next topic

Evaluation Module

This Page