cf.FieldList

class cf.FieldList(fields=None)[source]

Bases: cf.utils.List

An ordered sequence of fields.

Each element of a field list is a cf.Field object.

A field list has all of the callable methods, reserved attributes and reserved CF properties that a field object has. When used with a field list, a callable method or a reserved attribute or CF property is applied independently to each field and, unless a method (or assignment to a reserved attribute or CF property) carries out an in-place change to each field, a sequence of the results is returned. The type of sequence that may be returned will either be a new cf.FieldList object or else a cf.List object.

In addition, a field list supports the python list-like operations (such as indexing and methods like append), but not the python list arithmetic and comparison behaviours. Any field list arithmetic and comparison operation is applied independently to each field element, so all of the operators defined for a field are allowed.

Initialization

Parameters :
fields : (sequence of) cf.Field, optional

Create a new field list with these fields.

Examples

>>> fl = cf.FieldList()
>>> len(fl)
0
>>> f
<CF Field: air_temperature() K>
>>> fl = cf.FieldList(f)
>>> len(fl
1
>>> fl = cf.FieldList([f, f])
>>> len(fl)
2
>>> fl = cf.FieldList(cf.FieldList([f] * 3))
>>> len(fl)
3

FieldList CF Properties

add_offset The add_offset CF property of each field.
calendar The calendar CF property of each field.
cell_methods The cell_methods CF property of each field.
comment The comment CF property of each field.
Conventions The Conventions CF property of each field.
_FillValue The _FillValue CF property of each field.
flag_masks The flag_masks CF property of each field.
flag_meanings The flag_meanings CF property of each field.
flag_values The flag_values CF property of each field.
history The history CF property of each field.
institution The institution CF property of each field.
leap_month The leap_month CF property of each field.
leap_year The leap_year CF property of each field.
long_name The long_name CF property of each field.
missing_value The missing_value CF property of each field.
month_lengths The month_lengths CF property of each field.
references The references CF property of each field.
scale_factor The scale_factor CF property of each field.
source The source CF property of each field.
standard_error_multiplier The standard_error_multiplier CF property of each field.
standard_name The standard_name CF property of each field.
title The title CF property of each field.
units The units CF property of each field.
valid_max The valid_max CF property of each field.
valid_min The valid_min CF property of each field.
valid_range The valid_range CF property of each field.

FieldList attributes

ancillary_variables The ancillary_variables attribute of each field.
array The array attribute for each field.
attributes The attributes attribute of each field.
data The data attribute of each field.
day The day of each data array element of each field.
domain The domain attribute of each field.
dtarray The dtarray attribute for each field.
dtvarray The dtvarray attribute for each field.
dtype The dtype attribute for each field.
hardmask The hardmask attribute of each field.
hour The hour of each data array element of each field.
isscalar The isscalar attribute of each field.
Flags The Flags attribute of each field.
mask The mask attribute of each field.
max The minimum of the data array for each field.
mid_range The mid-range of the data array for each field.
min The minimum of the data array for each field.
minute The minute of each data array element of each field.
month The minute of each data array element of each field.
ndim The ndim attribute for each field.
properties The properties attribute of each field.
second The minute of each data array element of each field.
subspace Subspace each field in the list, returning a new list of fields.
shape The shape attribute for each field.
size The size attribute for each field.
sum The sum of the data array for each field.
unique The unique elements of the data array for each field.
Units The Units attribute of each field.
varray The varray attribute for each field.
year The year of each data array element of each field.

FieldList methods

all Test whether all data array elements evaluate to True for each field.
anchor Roll a cyclic axis of each field so that the given value lies in the first coordinate cell.
any Test whether any data array elements evaluate to True for each field.
aux Return an auxiliary coordinate object, or its domain identifier, from each field.
auxs Return auxiliary coordinate objects from each field.
axes Return domain axis identifiers from each field.
binary_mask Return a binary (0 and 1) missing data mask for each field.
chunk Partition the data array for each field.
clip Clip (limit) the values in the data array for each field.
close Close all referenced open data files from each field.
cm Return a cell measure object, or its domain identifier, from each field.
cms Return cell measure objects from each field.
coord Return a dimension or auxiliary coordinate object, or its domain identifier, from each field.
coords Return dimension or auxiliary coordinate objects from each field.
copy Return a deep copy.
cos Take the trigonometric cosine of the data array for each field.
cyclic Set the cyclicity of an axis for each field.
data_axes Return the axes of a domain item from each field.
datum Return an element of the data array for each field as a standard Python
delattr Delete a named attribute on each element of the list.
delprop Delete a CF property from each field.
dim Return a dimension coordinate object, or its domain identifier, from each field.
dims Return dimension coordinate objects from each field.
dump Return a full description of each the field.
equals Whether or not two field lists are pair-wise equal.
expand_dims Insert a size 1 axis into the data array of each field .
fill_value Return the data array missing data value for each field.
flip Flip axes of the data array for each field.
getattr Get a named attribute from each element of the list.
getprop Get a CF property from each field.
hasattr Return whether an attribute exists for each element of the list.
hasprop For each field, return True if a CF property exists, otherise False.
identity Return the identity of each field.
indices For each field, return the data array indices which correspond to item values.
insert_data Insert a new data array into the only field in place.
iscyclic Whether or not a particular axis is cyclic for each field.
item Return a domain item, or its domain identifier, from each field.
item_axes Return the axes of a domain item from each field.
items Return domain items from each field.
iter Return an iterator over the results of a method applied to the field list.
mask_invalid Mask the data array of each field where invalid values occur (NaNs or
match Test whether or not each field satisfies the given conditions.
method Return the results of a method applied to each field.
name Return a name for each field.
override_units Override the data array units in place.
remove_axes Remove and return axes from each field.
remove_axis Remove and return an axis from each field.
remove_data Remove and return the data array from each field.
remove_item Remove and return a domain item from each field.
remove_items Remove and return domain items from each field.
roll Roll each field along a cylcic axis.
select Return the fields which satisfy the given conditions.
set_equals True if two instances are set-wise equal, False otherwise.
setattr Set a named attribute on each element of the list.
setdata Set data array elements depending on a condition.
setprop Set a CF property on each field.
sin Take the trigonometric sine of the data array of each field.
squeeze Insert size 1 axes into the data array of each field.
subspace Subspace each field in the list, returning a new list of fields.
transform Return a transform object, or its domain identifier, from each field.
transforms Return transform objects from each field.
transpose Permute the dimensions of the data array of each field in place.
unsqueeze Insert size 1 axes into the data array of each field.

FieldList list-like methods

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

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

append
count Return the number of occurrences of a value
extend
index Return the first index of a value.
insert
pop
reverse
sort Sort the fields in place.

FieldList arithmetic and comparison operations

Any arithmetic, bitwise or comparison operation is applied independently to each field element, so all of operators defined for a field are allowed.

In particular, the usual list-like operator behaviours do not apply. For example, the + operator will concatenate two built-in lists, but adding 2 to a field list will add 2 to the data array of each of its fields.