cf.FieldList¶
-
class
cf.
FieldList
(fields=None)[source]¶ Bases:
list
An ordered sequence of fields.
Each element of a field list is a field construct.
A field list supports the python list-like operations (such as indexing and methods like
append
).>>> fl = cf.FieldList() >>> len(fl) 0 >>> f <CF Field: air_temperaturetime(12), latitude(73), longitude(96) 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 >>> len(fl + fl) 6
These methods provide functionality similar to that of a built-in list. The main difference is that when a field element needs to be assesed for equality its
equals
method is used, rather than the==
operator.Initialization
- Parameters
- fields: (sequence of)
Field
, optional Create a new field list with these fields.
- fields: (sequence of)
Selecting¶
Select field constructs by metadata constructs. |
|
Select field constructs by identity. |
|
Select field constructs by property. |
|
Select field constructs by netCDF variable name. |
|
Select field constructs by property. |
|
Select field constructs by the number of domain axis constructs. |
|
Select field constructs by units. |
|
Alias of |
|
Select a unique field construct by its identity. |
|
Alias for |
Miscellaneous¶
Close all files referenced by each field construct. |
|
Join the sequence of fields together. |
|
Return a deep copy. |
Aliases¶
Alias of |
|
Alias for |
List-like operations¶
These methods provide functionality identical to that of a Python
list
, with one exception:
When a field construct element needs to be assesed for equality, its
equals
method is used, rather than the==
operator. This affects thecount
,index
,remove
,__contains__
,__eq__
and__ne__
methods.
For example
>>> fl.count(x)
is equivalent to
>>> sum(f.equals(x) for f in fl)
Append object to the end of the list. |
|
Remove all items from list. |
|
Return number of occurrences of value |
|
Extend list by appending elements from the iterable. |
|
Return first index of value. |
|
Insert object before index. |
|
Remove and return item at index (default last). |
|
Remove first occurrence of value. |
|
Reverse IN PLACE. |
|
Sort of the field list in place. |
|
The binary arithmetic operation |
|
Called to implement membership test operators. |
|
The rich comparison operator |
|
Return self>=value. |
|
Called to implement evaluation of f[index] |
|
Called to implement evaluation of f[i:j] |
|
Return self>value. |
|
Implement iter(self). |
|
Implement self+=value. |
|
Implement self*=value. |
|
Return self<=value. |
|
Return len(self). |
|
Return self<value. |
|
The binary arithmetic operation |
|
The rich comparison operator |
|
Called by the |
|
Return value*self. |
|
Set self[key] to value. |
|
Return str(self). |
Special methods¶
Alias for |
|
Called by the |