Dataset Module

Bounds

class dataset.Bounds(lat_min, lat_max, lon_min, lon_max, start, end)

Container for holding spatial and temporal bounds information.

Certain operations require valid bounding information to be present for correct functioning. Bounds guarantees that a function receives well formed information without the need to do the validation manually.

Spatial and temporal bounds must follow the following guidelines.

  • Latitude values must be in the range [-90, 90]
  • Longitude values must be in the range [-180, 180]
  • Lat/Lon Min values must be less than the corresponding Lat/Lon Max values.
  • Temporal bounds must a valid datetime object

Default Bounds constructor

Parameters:
  • lat_min (float) – The minimum latitude bound.
  • lat_max (float) – The maximum latitude bound.
  • lon_min (float) – The minimum longitude bound.
  • lon_max (float) – The maximum longitude bound.
  • start (datetime) – The starting datetime bound.
  • end (datetime) – The ending datetime bound.
Raises:

ValueError

Dataset

class dataset.Dataset(lats, lons, times, values, variable=None, name='')

Container for a dataset’s attributes and data.

Default Dataset constructor

Parameters:
  • lats (numpy array) – One dimensional numpy array of unique latitude values.
  • lons (numpy array) – One dimensional numpy array of unique longitude values.
  • times (numpy array) – One dimensional numpy array of unique python datetime objects.
  • values (numpy array) – Three dimensional numpy array of parameter values with shape [timesLength, latsLength, lonsLength].
  • variable (string) – Name of the value variable.
  • name – An optional string name for the Dataset.
Raises:

ValueError

spatial_boundaries()

Calculate the spatial boundaries.

Returns:The Dataset’s bounding latitude and longitude values as a tuple in the form (min_lat, max_lat, min_lon, max_lon)
Return type:(float, float, float, float)
spatial_resolution()

Calculate the latitudinal and longitudinal spatial resolution.

Warning

This only works with properly gridded data.

Returns:The Dataset’s latitudinal and longitudinal spatial resolution as a tuple of the form (lat_resolution, lon_resolution).
Return type:(float, float)
temporal_resolution()

Calculate the temporal resolution.

Raises ValueError:
 If timedelta.days as calculated from the sorted list of times is an unrecognized value a ValueError is raised.
Returns:The temporal resolution.
Return type:string
time_range()

Calculate the temporal range

Returns:The start and end date of the Dataset’s temporal range as a tuple in the form (start_time, end_time).
Return type:(datetime, datetime)

Table Of Contents

Previous topic

Welcome to Apache Open Climate Workbench’s documentation!

Next topic

Dataset Processor Module

This Page