lib.api

Module Contents

lib.api.has_cdms = True
lib.api.degrees2radians(data, radianLimit)

Converts data from deg to radians

If no data is outside the range -radianLimit to + radianLimit, assume data is already in radians and do nothing

Example:
>>> data = nominal_resolution.degrees2radians(data)
Parameters:
  • data (cdms2.tvariable.TransientVariable) – array to potentially convert from degrees to radians
  • radianLimit (`float`_) – If the magnitude of any data value exceeds radianLimit, convert data from deg to rad.
Returns:

The same data converted from degrees to radians

Return type:

`cdms2.tvariable.TransientVariable`_

lib.api.mean_resolution(cellarea, latitude_bounds, longitude_bounds, convertdeg2rad, returnMaxDistance=False)

Computes mean nominal resolution

formula from: https://en.wikipedia.org/wiki/Great-circle_distance

Example:
>>> mean = nominal_resolution.mean_resolution(cellarea, latitude_bounds, longitude_bounds,
                                              convertdeg2rad, returnMaxDistance=False)
Parameters:
  • cellarea (`cdms2.tvariable.TransientVariable`_) – simple array, python masked array, or cdms2 variable containing area of each cell
  • latitude_bounds (`numpy.ndarray`_) – 2D numpy-like array containing latitudes vertices (ncell, nvertices). If None is passed and cdms2 is available, will try to obtain from cellarea grid
  • longitude_bounds (`numpy.ndarray`_) – 2D numpy-like array containing longitudes vertices (ncell, nvertices). If None is passed and cdms2 is available, will try to obtain from cellarea grid
  • convertdeg2rad (`bool`_) – set to True if lat/lon in degrees; set to false if in radians
  • returnMaxDistance (`bool`_) – Returns an array representing the maximum distance (in km) between vertices for each cell
Returns:

the mean nominal resolution in km and optionally the maximum distance array

Return type:

`float [,cdms2.tvariable.TransientVariable]`_

lib.api.nominal_resolution(mean_resolution)

Compute nominal resolution based on: https://docs.google.com/document/d/1h0r8RZr_f3-8egBMMh7aqLwy3snpD6_MrDz1q8n5XUk/edit#bookmark=id.ibeh7ad2gpdi

# Link date: Apr 19th, 2018 at 15:43

Example:
>>> nom = nominal_resolution.nominal_resolution(mean_resolution)
param mean_resolution:
 

The computed mean resolution for the model’s grid

type mean_resolution:
 

`float`_

return:

The nominal resolution

rtype:

`str`_