:mod:`lib.api` ============== .. py:module:: lib.api Module Contents --------------- .. data:: has_cdms :annotation: = True .. function:: 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: .. doctest:: >>> data = nominal_resolution.degrees2radians(data) :param data: array to potentially convert from degrees to radians :type data: cdms2.tvariable.TransientVariable :param radianLimit: If the magnitude of any data value exceeds radianLimit, convert data from deg to rad. :type radianLimit: `float`_ :return: The same data converted from degrees to radians :rtype: `cdms2.tvariable.TransientVariable`_ .. function:: 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: .. doctest:: >>> mean = nominal_resolution.mean_resolution(cellarea, latitude_bounds, longitude_bounds, convertdeg2rad, returnMaxDistance=False) :param cellarea: simple array, python masked array, or cdms2 variable containing area of each cell :type cellarea: `cdms2.tvariable.TransientVariable`_ :param latitude_bounds: 2D numpy-like array containing latitudes vertices (ncell, nvertices). If None is passed and cdms2 is available, will try to obtain from cellarea grid :type latitude_bounds: `numpy.ndarray`_ :param longitude_bounds: 2D numpy-like array containing longitudes vertices (ncell, nvertices). If None is passed and cdms2 is available, will try to obtain from cellarea grid :type longitude_bounds: `numpy.ndarray`_ :param convertdeg2rad: set to True if lat/lon in degrees; set to false if in radians :type convertdeg2rad: `bool`_ :param returnMaxDistance: Returns an array representing the maximum distance (in km) between vertices for each cell :type returnMaxDistance: `bool`_ :return: the mean nominal resolution in km and optionally the maximum distance array :rtype: `float [,cdms2.tvariable.TransientVariable]`_ .. function:: 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: .. doctest:: >>> 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`_