Bases: cf.variablelist.VariableList
An ordered sequence of fields stored in a list-like object.
In some contexts, whether an object is a field or a field list is not known and does not matter. So to avoid ungainly type testing, some aspects of the FieldList interface are shared by a field and vice versa.
Any attribute or method belonging to a field may be used on a field list and will be applied independently to each element.
Just as it is straight forward to iterate over the fields in a field list, a field will behave like a single element field list in iterative and indexing contexts.
Initialization
Parameters : |
|
---|
Apply the coord method to each element of the list.
Note that a coordinate list is returned (as opposed to a field list).
Parameters : |
|
---|---|
Returns : | out : CoordinateList |
Return a deep copy.
Equivalent to copy.deepcopy(s).
Returns : |
|
---|
Examples
>>> s.copy()
Return the number of occurrences of a given value.
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> s
[1, 2, 3, 2, 4, 2]
>>> s.count(1)
1
>>> s.count(2)
3
Delete a public attribute from each element of the list of variables.
Return a string containing the full descriptions of each variable in the list.
True if two instances are logically equal, False otherwise.
Parameters : |
|
---|---|
Returns : |
|
Return the elements which match the given conditions.
The match conditions are passed to each element’s match method in turn.
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> f
[<>
<>]
>>> f.extract(attr={'standard_name': 'air_temperature'})
[<>]
Return a built-in list of the public attributes of each element of the list of variables.
Return a built-in list of the public attributes of each element of the list of variables.
Return the first index of a given value.
Parameters : | value : start : int, optional stop : int, optional |
---|---|
Returns : | out : int |
Raises : |
|
Examples
>>> s
[1, 2, 3, 2, 4, 2]
>>> s.index(1)
1
>>> s.index(2, start=2)
3
>>> s.index(2, start=2, stop=4)
3
Insert an object before the given index in place.
Parameters : | index : int object : |
---|---|
Returns : | None |
Examples
>>> s
[1, 2, 3]
>>> s.insert(1, 'A')
>>> s
[1, 'A', 2, 3]
Return a list of booleans showing which elements match the given conditions.
The match conditions are passed to each element’s match method in turn.
Parameters : |
|
---|---|
Returns : |
|
Examples
>>> f
[<>
<>]
>>> f.match(attr={'standard_name': 'air_temperature'})
[True, False]
Return a built-in list of the names of each element of the list of variables.
Set a public attribute from each element of the list of variables.
Apply the squeeze method to each element of the list.
Parameters : |
|
---|---|
Returns : | out : FieldList |
Apply the unsqueeze method to each element of the list.
Parameters : |
|
---|---|
Returns : | out : FieldList |
Slice each field in the list, returning a new list of fields. Slicing by indices or by coordinate values are both allowed.
Examples
>>> fl
[<CF Variable: air_temperature(73, 96)>,
<CF Variable: air_temperature(73, 96)>]
>>> fl.subset[0,0]
[<CF Variable: air_temperature(1,1)>,
<CF Variable: air_temperature(1,1)>]
>>> fl.slice(longitude=0, latitude=0)
[<CF Variable: air_temperature(1,1)>,
<CF Variable: air_temperature(1,1)>]