Added: climate/site/trunk/content/api/1.1.0/ocw/dataset.html URL: http://svn.apache.org/viewvc/climate/site/trunk/content/api/1.1.0/ocw/dataset.html?rev=1754320&view=auto ============================================================================== --- climate/site/trunk/content/api/1.1.0/ocw/dataset.html (added) +++ climate/site/trunk/content/api/1.1.0/ocw/dataset.html Wed Jul 27 17:45:26 2016 @@ -0,0 +1,280 @@ + + + + + + + + Dataset Module — Apache Open Climate Workbench 1.1.0 documentation + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+

Dataset Module¶

+
+

Bounds¶

+
+
+class dataset.Bounds(lat_min, lat_max, lon_min, lon_max, start=None, end=None)¶
+

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.datetime) – An optional datetime object for the starting +datetime bound.
  • +
  • end (datetime.datetime) – An optional datetime object for the ending datetime bound.
  • +
+
Raises:

ValueError

+
+
+ +
+
+

Dataset¶

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

Container for a dataset’s attributes and data.

+

Default Dataset constructor

+ +++ + + + + + +
Parameters:
    +
  • lats (numpy.ndarray) – One dimensional numpy array of unique latitude values.
  • +
  • lons (numpy.ndarray) – One dimensional numpy array of unique longitude values.
  • +
  • times (numpy.ndarray) – One dimensional numpy array of unique python datetime +objects.
  • +
  • values (numpy.ndarray) – Three dimensional numpy array of parameter values with +shape [timesLength, latsLength, lonsLength].
  • +
  • variable (string) – Name of the value variable.
  • +
  • units (string) – Name of the value units
  • +
  • name (string) – An optional string name for the Dataset.
  • +
  • origin (dict) – An optional object used to specify information on where +this dataset was loaded from.
  • +
+
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:tuple() of the form (float, float, +float, float).
+
+ +
+
+spatial_resolution()¶
+

Calculate the latitudinal and longitudinal spatial resolution.

+
+
If self.lats and self.lons are from curvilinear coordinates, +the output resolutions are approximate values.
+ +++ + + + + + +
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:tuple() of the form (datetime.datetime, +datetime.datetime)
+
+ +
+ +
+
+ + +
+
+
+ +
+
+ + + + + + + \ No newline at end of file Added: climate/site/trunk/content/api/1.1.0/ocw/dataset_processor.html URL: http://svn.apache.org/viewvc/climate/site/trunk/content/api/1.1.0/ocw/dataset_processor.html?rev=1754320&view=auto ============================================================================== --- climate/site/trunk/content/api/1.1.0/ocw/dataset_processor.html (added) +++ climate/site/trunk/content/api/1.1.0/ocw/dataset_processor.html Wed Jul 27 17:45:26 2016 @@ -0,0 +1,449 @@ + + + + + + + + Dataset Processor Module — Apache Open Climate Workbench 1.1.0 documentation + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+

Dataset Processor Module¶

+
+
+dataset_processor.ensemble(datasets)¶
+

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

+

An ensemble datasets combines input datasets assuming the all have +similar shape, dimensions, and units.

+ +++ + + + + + +
Parameters:datasets – Datasets to be used to compose the ensemble dataset from. +All Datasets must be the same shape.
Return type:dataset.Dataset
+
+ +
+
+dataset_processor.mask_missing_data(dataset_array)¶
+

Check missing values in observation and model datasets. +If any of dataset in dataset_array has missing values at a grid point, +the values at the grid point in all other datasets are masked. +:param dataset_array: an array of OCW datasets

+
+ +
+
+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.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 datetime values.

+
Return type:

dataset.Dataset

+
+
+ +
+
+dataset_processor.safe_subset(subregion, target_dataset, subregion_name=None)¶
+

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 (dataset.Bounds) – The Bounds with which to subset the target Dataset.
  • +
  • target_dataset (dataset.Dataset) – The Dataset object to subset.
  • +
  • subregion_name (string) – The subset-ed Dataset name
  • +
+
Returns:

The subset-ed Dataset object

+
Return type:

dataset.Dataset

+
+
+ +
+
+dataset_processor.spatial_regrid(target_dataset, new_latitudes, new_longitudes, boundary_check=True)¶
+

Regrid a Dataset using the new latitudes and longitudes

+ +++ + + + + + + + +
Parameters:
    +
  • target_dataset (dataset.Dataset) – Dataset object that needs spatially regridded
  • +
  • new_latitudes (numpy.ndarray) – Array of latitudes
  • +
  • new_longitudes (numpy.ndarray) – Array of longitudes
  • +
  • boundary_check (:class:’bool’) – Check if the regriding domain’s boundaries +are outside target_dataset’s domain
  • +
+
Returns:

A new spatially regridded Dataset

+
Return type:

dataset.Dataset

+
+
+ +
+
+dataset_processor.subset(subregion, target_dataset, subregion_name=None)¶
+

Subset given dataset(s) with subregion information

+ +++ + + + + + + + + + +
Parameters:
    +
  • subregion (dataset.Bounds) – The Bounds with which to subset the target Dataset.
  • +
  • target_dataset (dataset.Dataset) – The Dataset object to subset.
  • +
  • subregion_name (string) – The subset-ed Dataset name
  • +
+
Returns:

The subset-ed Dataset object

+
Return type:

dataset.Dataset

+
Raises:

ValueError

+
+
+ +
+
+dataset_processor.temperature_unit_conversion(dataset)¶
+

Convert temperature units as necessary

+

Automatically convert Celcius to Kelvin in the given dataset.

+ +++ + + + +
Parameters:dataset – The dataset for which units should be updated.
+

:type dataset; dataset.Dataset

+ +++ + + + + + +
Returns:The dataset with (potentially) updated units.
Return type:dataset.Dataset
+
+ +
+
+dataset_processor.temporal_rebin(target_dataset, temporal_resolution)¶
+

Rebin a Dataset to a new temporal resolution

+ +++ + + + + + + + +
Parameters:
    +
  • target_dataset (dataset.Dataset) – Dataset object that needs temporal rebinned
  • +
  • temporal_resolution (string) – The new temporal resolution
  • +
+
Returns:

A new temporally rebinned Dataset

+
Return type:

dataset.Dataset

+
+
+ +
+
+dataset_processor.temporal_rebin_with_time_index(target_dataset, nt_average)¶
+

Rebin a Dataset to a new temporal resolution

+ +++ + + + + + + + +
Parameters:
    +
  • target_dataset (dataset.Dataset) – Dataset object that needs temporal rebinned
  • +
  • nt_average – Time resolution for the output datasets. +It is the same as the number of time indicies to be averaged. +length of time dimension in the rebinned dataset) = +(original time dimension length/nt_average)
  • +
+
Returns:

A new temporally rebinned Dataset

+
Return type:

dataset.Dataset

+
+
+ +
+
+dataset_processor.temporal_slice(start_time_index, end_time_index, target_dataset)¶
+

Temporally slice given dataset(s) with subregion information. This does not +spatially subset the target_Dataset

+ +++ + + + + + + + + + +
Parameters:
    +
  • start_time_index (:class:’int’) – time index of the start time
  • +
  • end_time_index (:class:’int’) – time index of the end time
  • +
  • target_dataset (dataset.Dataset) – The Dataset object to subset.
  • +
+
Returns:

The subset-ed Dataset object

+
Return type:

dataset.Dataset

+
Raises:

ValueError

+
+
+ +
+
+dataset_processor.temporal_subset(month_start, month_end, target_dataset, average_each_year=False)¶
+

Temporally subset data given month_index.

+ +++ + + + + + + + +
Parameters:
    +
  • month_start (int) – An integer for beginning month (Jan=1)
  • +
  • month_end (int) – An integer for ending month (Jan=1)
  • +
  • target_dataset (Open Climate Workbench Dataset Object) – Dataset object that needs temporal subsetting
  • +
  • average_each_year (:class:’boolean’) – If True, output dataset is averaged for each year
  • +
+
Returns:

A temporal subset OCW Dataset

+
Return type:

Open Climate Workbench Dataset Object

+
+
+ +
+
+dataset_processor.variable_unit_conversion(dataset)¶
+

Convert water flux or temperature variables units as necessary

+

For water flux variables, convert full SI units water flux units +to more common units. +For temperature, convert Celcius to Kelvin.

+ +++ + + + + + + + +
Parameters:dataset (dataset.Dataset) – The dataset to convert.
Returns:A Dataset with values converted to new units.
Return type:dataset.Dataset
+
+ +
+
+dataset_processor.water_flux_unit_conversion(dataset)¶
+

Convert water flux variables units as necessary

+

Convert full SI units water flux units to more common units.

+ +++ + + + + + + + +
Parameters:dataset (dataset.Dataset) – The dataset to convert.
Returns:A Dataset with values converted to new units.
Return type:dataset.Dataset
+
+ +
+
+dataset_processor.write_netcdf(dataset, path, compress=True)¶
+

Write a dataset to a NetCDF file.

+ +++ + + + +
Parameters: +
+
+ +
+ + +
+
+
+ +
+
+ + + + + + + \ No newline at end of file Added: climate/site/trunk/content/api/1.1.0/ocw/evaluation.html URL: http://svn.apache.org/viewvc/climate/site/trunk/content/api/1.1.0/ocw/evaluation.html?rev=1754320&view=auto ============================================================================== --- climate/site/trunk/content/api/1.1.0/ocw/evaluation.html (added) +++ climate/site/trunk/content/api/1.1.0/ocw/evaluation.html Wed Jul 27 17:45:26 2016 @@ -0,0 +1,292 @@ + + + + + + + + Evaluation Module — Apache Open Climate Workbench 1.1.0 documentation + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+

Evaluation Module¶

+
+
+class evaluation.Evaluation(reference, targets, metrics, subregions=None)¶
+

Container for running an evaluation

+

An Evaluation is the running of one or more metrics on one or more +target datasets and a (possibly optional) reference dataset. Evaluation +can handle two types of metrics, unary and binary. The validity +of an Evaluation is dependent upon the number and type of metrics as well +as the number of datasets.

+

A unary metric is a metric that runs over a single dataset. If you add +a unary metric to the Evaluation you are only required to add a +reference dataset or a target dataset. If there are multiple datasets +in the evaluation then the unary metric is run over all of them.

+

A binary metric is a metric that runs over a reference dataset and +target dataset. If you add a binary metric you are required to add a +reference dataset and at least one target dataset. The binary metrics +are run over every (reference dataset, target dataset) pair in the +Evaluation.

+

An Evaluation must have at least one metric to be valid.

+

Default Evaluation constructor.

+ +++ + + + + + +
Parameters:
    +
  • reference (dataset.Dataset) – The reference Dataset for the evaluation.
  • +
  • targets (list of dataset.Dataset) – A list of one or more target datasets for the +evaluation.
  • +
  • metrics (list of metrics) – A list of one or more Metric instances to run +in the evaluation.
  • +
  • subregions (list of dataset.Bounds) – (Optional) Subregion information to use in the +evaluation. A subregion is specified with a Bounds object.
  • +
+
Raises:

ValueError

+
+
+
+add_dataset(target_dataset)¶
+

Add a Dataset to the Evaluation.

+

A target Dataset is compared against the reference dataset when the +Evaluation is run with one or more metrics.

+ +++ + + + + + + +
Parameters:target_dataset (dataset.Dataset) – The target Dataset to add to the Evaluation.
Raises ValueError:
 If a dataset to add isn’t an instance of Dataset.
+
+ +
+
+add_datasets(target_datasets)¶
+

Add multiple Datasets to the Evaluation.

+ +++ + + + + + + +
Parameters:target_datasets (list of dataset.Dataset) – The list of datasets that should be added to +the Evaluation.
Raises ValueError:
 If a dataset to add isn’t an instance of Dataset.
+
+ +
+
+add_metric(metric)¶
+

Add a metric to the Evaluation.

+

A metric is an instance of a class which inherits from metrics.Metric.

+ +++ + + + + + + +
Parameters:metric (metrics) – The metric instance to add to the Evaluation.
Raises ValueError:
 If the metric to add isn’t a class that inherits +from metrics.Metric.
+
+ +
+
+add_metrics(metrics)¶
+

Add multiple metrics to the Evaluation.

+

A metric is an instance of a class which inherits from metrics.Metric.

+ +++ + + + + + + +
Parameters:metrics (list of metrics) – The list of metric instances to add to the Evaluation.
Raises ValueError:
 If a metric to add isn’t a class that inherits +from metrics.Metric.
+
+ +
+
+metrics = None¶
+

The list of “binary” metrics (A metric which takes two Datasets) +that the Evaluation should use.

+
+ +
+
+results = None¶
+

A list containing the results of running regular metric evaluations. +The shape of results is (num_target_datasets, num_metrics) if +the user doesn’t specify subregion information. Otherwise the shape +is (num_target_datasets, num_metrics, num_subregions).

+
+ +
+
+run()¶
+

Run the evaluation.

+

There are two phases to a run of the Evaluation. First, if there are +any “binary” metrics they are run through the evaluation. Binary +metrics are only run if there is a reference dataset and at least one +target dataset.

+

If there is subregion information provided then each dataset is subset +before being run through the binary metrics.

+

..note:: Only the binary metrics are subset with subregion information.

+

Next, if there are any “unary” metrics they are run. Unary metrics are +only run if there is at least one target dataset or a reference dataset.

+
+ +
+
+target_datasets = None¶
+

The target dataset(s) which should each be compared with +the reference dataset when the evaluation is run.

+
+ +
+
+unary_metrics = None¶
+

The list of “unary” metrics (A metric which takes one Dataset) that +the Evaluation should use.

+
+ +
+
+unary_results = None¶
+

A list containing the results of running the unary metric +evaluations. The shape of unary_results is +(num_targets, num_metrics) where num_targets = +num_target_ds + (1 if ref_dataset != None else 0

+
+ +
+ +
+ + +
+
+
+ +
+
+ + + + + + + \ No newline at end of file