cf.Transform

class cf.Transform(name=None, type=None, coord_terms=None, coords=None, **kwargs)[source]

Bases: cf.utils.Dict

A CF transform construct.

A transform construct defines a mapping from one set of coordinates which can not geo-locate the field construct’s data to another set of coordinates that can geo-locate the field construct’s data.

Transform constructs correspond to the functions of the CF-netCDF attributes formula_terms, which describes how to compute a vertical auxiliary coordinate variable from components and grid_mapping, which describes how to compute true latitude and longitude auxiliary coordinate variables from horizontal projection dimension coordinates, or describes the figure of earth for true latitude and longitude coordinate variables.

A transform is a dictionary-like object for which each key/value pair comprises the name of a term of the transform and its corresponding variable. A term that is omitted is assumed to be zero.

The each variable is one of the following:

Variable Notes
Pointer to coordinate A domain’s coordinate identifier; or a coordinate’s identity, as a defined by the coordinate’s identity method.
Python numeric scalar  
cf.Data Must have an array size of 1
cf.Field  
None Indicates that the term is unset. Note that this is different than the term being missing, as in this case there is no assumption of a value of zero.

Attributes

Attribute Type Description
coords set A set of pointers to coordinate objects (may be empty)
grid_mapping bool True if and only if the transform is a grid_mapping
name str The identity of the transform (such as 'ocean_sigma_coordinate' or 'rotated_latitude_longitude')

Examples

>>> t
<CF Transform: rotated_latitude_longitude>
>>> print t.dump()
Transform: rotated_latitude_longitude
    grid_north_pole_latitude = 38.0
    grid_north_pole_longitude = 190.0
>>> print t.dump()
Transform: atmosphere_hybrid_height_coordinate
    a = 'aux0'
    b = 'aux1'
    orog = <CF Field: surface_altitude(grid_longitude(96), grid_latitude(73)) m>

Initialization

Parameters :
kwargs :

Keys and values are initialized exactly as keyword arguments for a built-in dict. In general, keys are transform parameter names (such as 'grid_north_pole_latitude' or 'sigma') with appropriate values, with three exceptions:

  • If the key 'standard_name' then its value is the identity for a formula_terms-type transform and no term is created.
  • If the key 'grid_mapping_name' is specified then its value is the identity for a grid_mapping-type transform and no term is created.
  • If the key 'coords' is specified then its value is a sequence of coordinate pointers for all of the inputs to the transform which do not have dedicated terms.

One of the keys 'standard_name' and 'grid_mapping_name' must be specified, but 'coords' is optional.

Examples

>>> t = cf.Transform(name='rotated_latitude_longitude',
...                  grid_north_pole_latitude=38.0, 
...                  grid_north_pole_longitude=190)
>>> t = cf.Transform(name='atmosphere_ln_pressure_coordinate',
...                  p0=1000, lev='dim1', 
>>> t = cf.Transform(name='atmosphere_ln_pressure_coordinate',
...                  p0=cf.Data(100000, 'Pa'),
...                  lev='atmosphere_ln_pressure_coordinate')

Transform methods

close Close all files referenced by transform values.
copy Return a deep copy.
dump Return a string containing a full description of the transform.
equals True if two instances are equal, False otherwise.
equivalent True if two transforms are logically equal, False otherwise.
identity Return the identity of the transform.
match Test whether or not the transform satisfies the given conditions.
remove_all_pointers Remove all all pointers to coordinates.
cf.Transform.remove_pointer
cf.Transform.rename_pointer

Transform dict-like methods

These methods provide functionality similar to that of a built-in dict.

Undocumented methods behave exactly as their counterparts in a built-in dict.

clear
get
has_key
items
iteritems
iterkeys
itervalues
keys
pop
popitem
setdefault
update
values

Table Of Contents

Previous topic

cf.Flags.sort

Next topic

cf.Transform.close

This Page