cf.Coordinate

class cf.Coordinate(properties={})

Bases: cf.variable.Variable

A CF dimension or auxiliary coordinate construct.

The coordinate array’s bounds (if present) are stored in the bounds attribute. The climatology CF property indicates if the bounds are intervals of climatological time.

If the coordinate is connected to one or more transform constructs then pointers to the transformations are stored in the transforms attribute.

Initialization

Parameters :
properties : dict, optional

Initialize a new instance with CF properties from the dictionary’s key/value pairs. Values are deep copied.

Coordinate CF properties

add_offset The add_offset CF property.
axis The axis CF property.
calendar The calendar CF property.
comment The comment CF property.
_FillValue The _FillValue CF property.
history The history CF property.
leap_month The leap_month CF property.
leap_year The leap_year CF property.
long_name The long_name CF property.
missing_value The missing_value CF property.
month_lengths The month_lengths CF property.
positive The positive CF property.
scale_factor The scale_factor CF property.
standard_name The standard_name CF property.
units The units CF property.
valid_max The valid_max CF property.
valid_min The valid_min CF property.
valid_range The valid_range CF property.

Coordinate data attributes

array A numpy array deep copy of the data array.
Data The Data object containing the data array.
dtype Numpy data-type of the data array.
_FillValue The _FillValue CF property.
first_datum The first element of the data array.
hardmask Whether the mask is hard (True) or soft (False).
isscalar True if and only if the data array is a scalar array.
last_datum The last element of the data array.
mask The mask of the data array.
ndim Number of dimensions in the data array.
shape Tuple of the data array’s dimension sizes.
size Number of elements in the data array.
Units The Units object containing the units of the data array.
varray Return a numpy view of the data.

Coordinate miscellaneous attributes

bounds The CoordinateBounds object containing the data array’s cell bounds.
climatology Indicator for the coordinate array’s bounds representing climatological time intervals.
hasData True if and only if there is a data array.
isbounded True if and only if the coordiante has cell bounds.
properties A dictionary of the CF properties.
cf.Coordinate.transform

Coordinate methods

binary_mask Return a binary missing data mask of the data array.
chunk
contiguous Return True if a coordinate is contiguous.
copy Return a deep copy.
cos Take the trigonometric cosine of the data array and bounds in place.
delprop Delete a CF property.
dump Return a string containing a full description of the coordinate.
equals True if two variables are logically equal, False otherwise.
expand_dims axis is an integer
flip Flip dimensions of the data array and bounds in place.
getprop Get a CF property.
hasprop Return True if the variable has a CF property.
identity Return the variable’s identity.
match Determine whether or not a variable satisfies conditions.
name Return a name for the variable.
override_units Override the data array units in place.
setitem Set selected elements of the data array in place.
setmask Set selected elements of the data array’s mask in place.
setprop Set a CF property.
sin Take the trigonometric sine of the data array and bounds in place.
squeeze Remove size 1 dimensions from the data array and bounds in place.
subset Return the instance if it matches the given conditions.
subspace Return a new coordinate whose data and bounds are subspaced in a consistent manner.
transpose Permute the dimensions of the data array and bounds in place.
binary_mask()

Return a binary missing data mask of the data array.

The binary mask’s data array comprises dimensionless 32-bit integers and has 0 where the data array has missing data and 1 otherwise.

Returns :
out : Variable

The binary mask.

Examples

>>> print f.mask.array
[[ True  False  True False]]
>>> b = f.binary_mask().array
>>> print b.array
[[0 1 0 1]]
chunk(chunksize=None, extra_boundaries=None, pdim=None)
clip(a_min, a_max, units=None)

Clip (limit) the values in the data array and its bounds in place.

Given an interval, values outside the interval are clipped to the interval edges.

Parameters :

a_min : scalar

a_max : scalar

units : str or Units

Returns :None

Examples

contiguous(overlap=True)

Return True if a coordinate is contiguous.

A coordinate is contiguous if its cell boundaries match up, or overlap, with the boundaries of adjacent cells.

In general, it is only possible for 1 or 0 dimensional coordinates with bounds to be contiguous, but size 1 coordinates with any number of dimensions are always contiguous.

An exception occurs if the coordinate is multdimensional and has more than one element.

Parameters :
overlap : bool, optional

If False then overlapping cell boundaries are not considered contiguous. By default cell boundaries are considered contiguous.

Returns :
out : bool

Whether or not the coordinate is contiguous.

Raises :
ValueError :

If the coordinate has more than one dimension.

Examples

>>> c.isbounded
False
>>> c.contiguous()
False
>>> print c.bounds[:, 0]
[  0.5   1.5   2.5   3.5 ]
>>> print c.bounds[:, 1]
[  1.5   2.5   3.5   4.5 ]
>>> c.contiuous()
True
>>> print c.bounds[:, 0]
[  0.5   1.5   2.5   3.5 ]
>>> print c.bounds[:, 1]
[  2.5   3.5   4.5   5.5 ]
>>> c.contiuous()
True
>>> c.contiuous(overlap=False)
False
copy(_omit_Data=False)

Return a deep copy.

Equivalent to copy.deepcopy(c).

Returns :
out :

The deep copy.

Examples

>>> d = c.copy()
cos()

Take the trigonometric cosine of the data array and bounds in place.

Units are accounted for in the calcualtion, so that the the cosine of 90 degrees_east is 0.0, as is the sine of 1.57079632 radians. If the units are not equivalent to radians (such as Kelvin) then they are treated as if they were radians.

The Units are changed to ‘1’ (nondimensionsal).

Returns :None

Examples

>>> c.Units
<CF Units: degrees_east>
>>> print c.array
[[-90 0 90 --]]
>>> c.cos()
>>> c.Units
<CF Units: 1>
>>> print c.array
[[0.0 1.0 0.0 --]]
>>> c.Units
<CF Units: m s-1>
>>> print c.array
[[1 2 3 --]]
>>> c.cos()
>>> c.Units
<CF Units: 1>
>>> print c.array
[[0.540302305868 -0.416146836547 -0.9899924966 --]]
delprop(prop)

Delete a CF property.

Parameters :
prop : str

The name of the property to delete.

Returns :

None

Raises :
AttributeError :

If the variable does not have the named CF property.

Examples

>>> f.delprop('standard_name')
>>> f.delprop('foo')
AttributeError: Field doesn't have CF property 'foo'
dump(id=None, omit=())

Return a string containing a full description of the coordinate.

Parameters :
id: str, optional

Set the common prefix of variable component names. By default the instance’s class name is used.

omit : sequence of strs

Omit the given CF properties from the description.

Returns :
out : str

A string containing the description.

Examples

>>> x = c.dump()
>>> print c.dump()
>>> print c.dump(id='time_coord')
>>> print c.dump(omit=('long_name',))
equals(other, rtol=None, atol=None, traceback=False, ignore=())

True if two variables are logically equal, False otherwise.

Parameters :
other :

The object to compare for equality.

atol : float, optional

The absolute tolerance for all numerical comparisons, By default the value returned by the ATOL function is used.

rtol : float, optional

The relative tolerance for all numerical comparisons, By default the value returned by the RTOL function is used.

traceback : bool, optional

If True then print a traceback highlighting where the two instances differ.

ignore : iterable, optional

Omit these CF properties from the comparison.

Returns :
out : bool

Whether or not the two instances are equal.

Examples

>>> f.equals(f)
True
>>> g = f + 1
>>> f.equals(g)
False
>>> g -= 1
>>> f.equals(g)
True
>>> f.setprop('name', 'name0')
>>> g.setprop('name', 'name1')
>>> f.equals(g)
False
>>> f.equals(g, ignore=set('name',))
True
expand_dims(axis, dim, direction)

axis is an integer dim is a string direction is a boolean

flip(axes=None)

Flip dimensions of the data array and bounds in place.

The trailing dimension of the bounds is flipped if and only if the coordinate is 1 or 0 dimensional.

Parameters :
axes : int or sequence of ints

Flip the dimensions whose positions are given. By default all dimensions are flipped.

Returns :
out : list of ints

The axes which were flipped, in arbitrary order.

Examples

>>> c.flip()
>>> c.flip(1)
>>> d = c.subspace[::-1, :, ::-1, :]
>>> c.flip([2, 0]).equals(d)
True
getprop(prop, *default)

Get a CF property.

When a default argument is given, it is returned when the attribute doesn’t exist; without it, an exception is raised in that case.

Parameters :
prop : str

The name of the property to get.

default : optional

Return default if and only if the variable does not have the named property.

Returns :
out :

The value of the named property, or the default value.

Raises :
AttributeError :

If the variable does not have the named property and a default value has not been set.

Examples

>>> f.getprop('standard_name')
>>> f.getprop('standard_name', None)
>>> f.getprop('foo')
AttributeError: Field doesn't have CF property 'foo'
>>> f.getprop('foo', 'bar')
'bar'
hasprop(prop)

Return True if the variable has a CF property.

Parameters :
prop : str

The name of the property.

Returns :
out : bool

True if the instance has the property.

Examples

>>> f.hasprop('standard_name')
True
>>> f.hasprop('foo')
False
identity(default=None)

Return the variable’s identity.

The idendity is the value of the standard_name property or, if that does not exist, the id attribute.

Parameters :
default : optional

If neither the standard_name nor id attributes exist then return default. By default, default is None.

Returns :
out :

The identity.

Examples

>>> f.standard_name = 'Kelvin'
>>> f.identity
'Kelvin'
>>> del f.standard_name
>>> f.id = 'foo'
>>> f.identity
'foo'
>>> del f.id
>>> f.identity()
None
>>> f.identity('bar')
'bar'
match(prop={}, attr={})

Determine whether or not a variable satisfies conditions.

Conditions may be specified on the variable’s CF properties and attributes.

Parameters :
prop : dict, optional

Dictionary for which each key/value pair is a CF property name and a condition for the property to be tested against. If the value is a sequence of conditions then the attribute matches if at least one of the conditions is passed.

In general, a condition is any object and it is passed if the attribute is equal to the object, with the following exception:

  • If the property is string-valued, then the condition may be a regular expression pattern recognised by the re module and the condition is passed if the property matches the regular expression. Special characters for the start and end of the string are assumed and need not be included. For example, ‘.*wind’ is equivalent to ‘^.*wind$’.
attr : dict, optional

Dictionary for which each key/value pair is an attribute name and a condition for the attribute to be tested against. If the value is a sequence of conditions then the attribute matches if at least one of the conditions is passed.

In general, a condition behaves as for attr, with the following exception:

  • For the Units attribute, the condition is passed if the attribute is equivalent (rather than equal) to the object. (Note that this behaviour does not apply to the units attribute.)
Returns :
out : bool

Whether or not the variable matches the given criteria.

Examples

name(long_name=False, ncvar=False, default=None)

Return a name for the variable.

Returns the standard_name, long_name (if requested) or netCDF variable name (if requested), whichever it finds first, otherwise returns a default name.

Parameters :

long_name : bool, optional

If True, return the long_name if standard_name does not exist.

ncvar : bool, optional

If True, return ncvar if neither the standard_name nor long_name has already been returned.

default : str, optional

Return default if neither standard_name, long_name nor ncvar has already been returned.

Returns :
name : str

The name of the variable.

override_units(new_units)

Override the data array units in place.

Not to be confused with setting the Units attribute to units which are equivalent to the original units.

This is different to setting the Units attribute, as the new units need not be equivalent to the original ones and the data array elements will not be changed to reflect the new units.

Parameters :
new_units : str or Units

The new units for the data array.

Returns :

None

Examples

>>> f.Units
<CF Units: hPa>
>>> f.first_datum
100000.0
>>> f.override_units('km')
>>> f.Units
<CF Units: km>
>>> f.first_datum
100000.0
>>> f.override_units(cf.Units('watts'))
>>> f.Units
<CF Units: watts>
>>> f.first_datum
100000.0
setitem(value, indices=Ellipsis, condition=None, masked=None, other_mask=None, hardmask=None)

Set selected elements of the data array in place.

The value to which the selected elements of the data array will be set may be any object which is broadcastable across the selected elements.

Note the following:

  • f.setitem(value) is equivalent to f.subspace[...]=value.
  • f.setitem(value, indices) is equivalent to f.subspace[indices]=value.
  • If and only if the value to be assigned is the scalar cf.masked (or numpy.ma.masked) then the selected elements of data array’s mask will be set to True (masked). For example, f.setitem(cf.masked, indices) is equivalent to f.setmask(True, indices). This is consistent with the behaviour of numpy masked arrays.
Parameters :
value : array-like

The value to which the selected elements of the data array will be set. Must be an object which is broadcastable across the selected elements.

indices : optional

Any indices as would be accepted by f.subspace. Only elements of the data array described by the indices, and where other criteria (if any) are met, are set to value. By default, the entire data array is considered. How masked elements of the data array are treated depends on the hardmask parameter. The value must be any object broadcastable across the shape implied by indices. Note that f.setitem(value, indices) is equivalent to f.subspace[indices]=value.

condition : scalar or Comparison, optional

A condition applied to each element of the data array specified by indices which determines whether or not that element is set to the logically scalar value. The condition is evaluated by checking if each element equals the condition, and if it does then that element is set to value. How masked elements of the data array are treated depends on the hardmask parameter. Note that if condition is a scalar, x, then this is equivalent to the Comparison object cf.eq(x).

masked : bool, optional

If False then each unmasked element of the data array specified by indices is set to the logically scalar value. If True then each unmasked element of the data array specified by indices is unmasked and set to the logically scalar value, regardless of the hardmask is parameter.

other_mask : array-like, optional

Each element of the data array specified by indices and which corresponds to an element which evaluates to False from other_mask is set to the logically scalar value. other_mask may be any object which is broadcastable across the shape implied by indices. How masked elements of the data array are treated depends on the hardmask parameter.

hardmask : bool, optional

If True then any selected elements of the data array which are masked will not be unmasked and assigned to. If False then any selected elements of the data array which are masked will be unmasked and assigned to. By default, the value of the instance’s hardmask attribute is used.

Returns :

None

Examples

setmask(value, indices=Ellipsis)

Set selected elements of the data array’s mask in place.

The value to which the selected elements of the mask will be set may be any object which is broadcastable across the selected elements. The broadcasted value may be of any data type but will be evaluated as boolean.

Unmasked elements are set to the fill value.

The mask may be effectively removed by setting every element to False with f.setmask(False).

Note that if and only if the value to be assigned is logically scalar and evaluates to True then f.setmask(value, indices) is equivalent to f.setitem(cf.masked, indices). This is consistent with the behaviour of numpy masked arrays.

Parameters :
value : array-like

The value to which the selected element s of the mask will be set. Must be an object which is broadcastable across the selected elements.

indices : optional

Indices of the data array. Only elements of the mask described by the indices are set to value. By default, the entire mask is considered.

Returns :

None

Examples

setprop(prop, value)

Set a CF property.

Parameters :
prop : str

The name of the property to set.

value :

The value for the property.

Returns :

None

Examples

>>> f.setprop('standard_name', 'time')
>>> f.setprop('foo', 12.5)
sin()

Take the trigonometric sine of the data array and bounds in place.

Units are accounted for in the calculation. For example, the the sine of 90 degrees_east is 1.0, as is the sine of 1.57079632 radians. If the units are not equivalent to radians (such as Kelvin) then they are treated as if they were radians.

The Units are changed to ‘1’ (nondimensionsal).

Returns :None

Examples

>>> c.Units
<CF Units: degrees_north>
>>> print c.array
[[-90 0 90 --]]
>>> c.sin()
>>> c.Units
<CF Units: 1>
>>> print c.array
[[-1.0 0.0 1.0 --]]
>>> c.Units
<CF Units: m s-1>
>>> print c.array
[[1 2 3 --]]
>>> c.sin()
>>> c.Units
<CF Units: 1>
>>> print c.array
[[0.841470984808 0.909297426826 0.14112000806 --]]
squeeze(axes=None)

Remove size 1 dimensions from the data array and bounds in place.

Parameters :
axes : int or sequence of ints, optional

The size 1 axes to remove. By default, all size 1 axes are removed. Size 1 axes for removal may be identified by the integer positions of dimensions in the data array.

Returns :

None

Examples

>>> c.squeeze()
>>> c.squeeze(1)
>>> c.squeeze([1, 2])
subset(*args, **kwargs)

Return the instance if it matches the given conditions.

Equivalent to:

def subset(f, *args, **kwargs):
    if f.match(*args, **kwargs):
        return f
    raise ValueError('')
Parameters :
args, kwargs :

As for the match method.

Returns :
out :

The variable as an object identity, if it matches the given conditions.

Raises :
ValueError :

If the variable does not match the conditions.

transpose(axes=None)

Permute the dimensions of the data array and bounds in place.

Parameters :
axes : sequence of ints, optional

The new order of the data array. By default, reverse the dimensions’ order, otherwise the axes are permuted according to the values given. The values of the sequence comprise the integer positions of the dimensions in the data array in the desired order.

Returns :

None

Examples

>>> c.transpose()
>>> c.ndim
3
>>> c.transpose([1, 2, 0])
Data

The Data object containing the data array.

Examples

>>> f.Data
<CF Data: >
Units

The Units object containing the units of the data array.

add_offset

The add_offset CF property.

This property is only used when writing to a file on disk.

Examples

>>> f.add_offset = -4.0
>>> f.add_offset
-4.0
>>> del f.add_offset
>>> f.setprop('add_offset', 10.5)
>>> f.getprop('add_offset')
10.5
>>> f.delprop('add_offset')
array

A numpy array deep copy of the data array.

Changing the returned numpy array does not change the data array.

Examples

>>> a = f.array
>>> type(a)
<type 'numpy.ndarray'>
>>> print a
[0 1 2 3 4]
>>> a[0] = 999
>>> print a
[999 1 2 3 4]
>>> print f.array
[0 1 2 3 4]
axis

The axis CF property.

Examples

>>> c.axis = 'Y'
>>> c.axis
'Y'
>>> del c.axis
>>> f.setprop('axis', 'T')
>>> f.getprop('axis')
'T'
>>> f.delprop('axis')
bounds

The CoordinateBounds object containing the data array’s cell bounds.

Examples

>>> c.bounds
<CF CoordinateBounds: >
calendar

The calendar CF property.

This property is a mirror of the calendar stored in the Units attribute.

Examples

>>> c.calendar = 'noleap'
>>> c.calendar
'noleap'
>>> del c.calendar
>>> f.setprop('calendar', 'proleptic_gregorian')
>>> f.getprop('calendar')
'proleptic_gregorian'
>>> f.delprop('calendar')
climatology

Indicator for the coordinate array’s bounds representing climatological time intervals.

If not set then bounds are assumed to not represent climatological time intervals.

Examples

>>> c.climatology = True
>>> c.climatology
True
>>> del c.climatology
comment

The comment CF property.

Examples

>>> f.comment = 'a comment'
>>> f.comment
'a comment'
>>> del f.comment
>>> f.setprop('comment', 'a comment')
>>> f.getprop('comment')
'a comment'
>>> f.delprop('comment')
dtype

Numpy data-type of the data array.

Examples

>>> c.dtype
dtype('float64')
>>> import numpy
>>> c.dtype = numpy.dtype('float32')
first_datum

The first element of the data array.

Examples

>>> print f.array
[[1 2 3 4]]
>>> f.first_datum
1
>>> print f.array
[[-- 2 3 4]]
>>> f.first_datum
--
hardmask

Whether the mask is hard (True) or soft (False).

When the mask is hard, masked entries of the data array can not be unmasked by assignment.

By default, the mask is hard.

Examples

>>> f.hardmask = False
>>> f.hardmask
False
hasData

True if and only if there is a data array.

Examples

>>> hasattr(f, 'Data')
True
>>> f.hasData
True
>>> del f.Data
>>> f.hasData
False
history

The history CF property.

Examples

>>> f.history = 'created on 2012/10/01'
>>> f.history
'created on 2012/10/01'
>>> del f.history
>>> f.setprop('history', 'created on 2012/10/01')
>>> f.getprop('history')
'created on 2012/10/01'
>>> f.delprop('history')
isbounded

True if and only if the coordiante has cell bounds.

Examples

>>> if c.isbounded:
...    print c.bounds
isscalar

True if and only if the data array is a scalar array.

Examples

>>> print f.array
2
>>> f.isscalar
True
>>> print f.array
[2]
>>> f.isscalar
False
>>> print f.array
[[2, 3]]
>>> f.isscalar
False
>>> f.hasData
False
>>> f.isscalar
False
last_datum

The last element of the data array.

Examples

>>> print f.array
[[1 2 3 4]]
>>> f.last_datum
4
>>> print f.array
[[1 2 3 --]]
>>> f.last_datum
--
leap_month

The leap_month CF property.

Examples

>>> f.leap_month = 2
>>> f.leap_month
2
>>> del f.leap_month
>>> f.setprop('leap_month', 2)
>>> f.getprop('leap_month')
2
>>> f.delprop('leap_month')
leap_year

The leap_year CF property.

Examples

>>> f.leap_year = 1984
>>> f.leap_year
1984
>>> del f.leap_year
>>> f.setprop('leap_year', 1984)
>>> f.getprop('leap_year')
1984
>>> f.delprop('leap_year')
long_name

The long_name CF property.

Examples

>>> f.long_name = 'zonal_wind'
>>> f.long_name
'zonal_wind'
>>> del f.long_name
>>> f.setprop('long_name', 'surface air temperature')
>>> f.getprop('long_name')
'surface air temperature'
>>> f.delprop('long_name')
mask

The mask of the data array.

Examples

>>> f.shape
(12, 73, 96)
>>> m = f.mask
<CF Field: mask()>
>>> m.shape
(12, 73, 96)
>>> m.dtype
dtype('bool')
missing_value

The missing_value CF property.

This property is forced to be consistent with the _FillValue property as follows:

  • Assigning a value to missing_value also assigns the same value to _FillValue whether the latter has been previously set or not.
  • Assigning a value to _FillValue also assigns the same value to missing_value, but only if the latter has previously been defined.

Examples

>>> f.missing_value = 1e30
>>> f.missing_value
1e30
>>> f._FillValue
1e30
>>> del f.missing_value
>>> f._FillValue
1e30
month_lengths

The month_lengths CF property.

Stored as a tuple but may be set as any array-like object.

Examples

>>> f.month_lengths = numpy.array([34, 31, 32, 30, 29, 27, 28, 28, 28, 32, 32, 34])
>>> f.month_lengths
(34, 31, 32, 30, 29, 27, 28, 28, 28, 32, 32, 34)
>>> del f.month_lengths
>>> f.setprop('month_lengths', [34, 31, 32, 30, 29, 27, 28, 28, 28, 32, 32, 34])
>>> f.getprop('month_lengths')
(34, 31, 32, 30, 29, 27, 28, 28, 28, 32, 32, 34)
>>> f.delprop('month_lengths')
ndim

Number of dimensions in the data array.

Examples

>>> f.shape
(73, 96)
>>> f.ndim
2
positive

The positive CF property.

Examples

>>> c.positive = 'up'
>>> c.positive
'up'
>>> del c.positive
>>> f.setprop('positive', 'down')
>>> f.getprop('positive')
'down'
>>> f.delprop('positive')
properties

A dictionary of the CF properties.

Note that modifying the returned dictionary will not change the CF properties.

Examples

>>> f.properties
{'_FillValue': 1e+20,
 'foo': 'bar',
 'long_name': 'Surface Air Temperature',
 'standard_name': 'air_temperature',
 'units': 'K'}
scale_factor

The scale_factor CF property.

This property is only used when writing to a file on disk.

Examples

>>> f.scale_factor = 10.0
>>> f.scale_factor
10.0
>>> del f.scale_factor
>>> f.setprop('scale_factor', 10.0)
>>> f.getprop('scale_factor')
10.0
>>> f.delprop('scale_factor')
shape

Tuple of the data array’s dimension sizes.

Examples

>>> f.shape
(73, 96)
size

Number of elements in the data array.

Examples

>>> f.shape
(73, 96)
>>> f.size
7008
standard_name

The standard_name CF property.

Examples

>>> f.standard_name = 'time'
>>> f.standard_name
'time'
>>> del f.standard_name
>>> f.setprop('standard_name', 'time')
>>> f.getprop('standard_name')
'time'
>>> f.delprop('standard_name')
subspace

Return a new coordinate whose data and bounds are subspaced in a consistent manner.

This attribute may be indexed to select a subspace from dimension index values.

Subspacing by indexing

Subspacing by dimension indices uses an extended Python slicing syntax, which is similar numpy array indexing. There are two extensions to the numpy indexing functionality:

  • Size 1 dimensions are never removed.

    An integer index i takes the i-th element but does not reduce the rank of the output array by one.

  • When advanced indexing is used on more than one dimension, the advanced indices work independently.

    When more than one dimension’s slice is a 1-d boolean array or 1-d sequence of integers, then these indices work independently along each dimension (similar to the way vector subscripts work in Fortran), rather than by their elements.

Examples

transforms

Pointer to the coordinate’s transforms.

units

The units CF property.

This property is a mirror of the units stored in the Units attribute.

Examples

>>> c.units = 'degrees_east'
>>> c.units
'degree_east'
>>> del c.units
>>> f.setprop('units', 'days since 2004-06-01')
>>> f.getprop('units')
'days since 2004-06-01'
>>> f.delprop('units')
valid_max

The valid_max CF property.

Examples

>>> f.valid_max = 100.0
>>> f.valid_max
100.0
>>> del f.valid_max
>>> f.setprop('valid_max', 100.0)
>>> f.getprop('valid_max')
100.0
>>> f.delprop('valid_max')
valid_min

The valid_min CF property.

Examples

>>> f.valid_min = 100.0
>>> f.valid_min
100.0
>>> del f.valid_min
>>> f.setprop('valid_min', 100.0)
>>> f.getprop('valid_min')
100.0
>>> f.delprop('valid_min')
valid_range

The valid_range CF property.

Stored as a tuple but may be set as any array-like object.

Examples

>>> f.valid_range = numpy.array([100., 400.])
>>> f.valid_range
(100.0, 400.0)
>>> del f.valid_range
>>> f.setprop('valid_range', [100.0, 400.0])
>>> f.getprop('valid_range')
(100.0, 400.0)
>>> f.delprop('valid_range')
varray

Return a numpy view of the data.

Making changes to elements of the returned view changes the underlying data. Refer to numpy.ndarray.view.

Examples

>>> a = c.varray
>>> type(a)
<type 'numpy.ndarray'>
>>> a
array([0, 1, 2, 3, 4])
>>> a[0] = 999
>>> c.varray
array([999, 1, 2, 3, 4])

Previous topic

cf.CellMethods

Next topic

cf.CoordinateBounds

This Page