cf.FieldList¶
-
class
cf.
FieldList
(fields=None)[source]¶ Bases:
list
An ordered sequence of fields.
Each element of a field list is a
cf.Field
object.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
- fields: (sequence of)
Mathematical functions¶
Trigonometry
cos |
|
sin |
|
tan |
Exponents and logarithms
cf.FieldList.exp |
|
cf.FieldList.log |
Rounding
ceil |
|
cf.FieldList.floor |
|
cf.FieldList.rint |
|
cf.FieldList.trunc |
Statistics
collapse |
Miscellaneous mathematical functions
cf.FieldList.clip |
Data array operations¶
Data array mask
cf.FieldList.binary_mask |
|
cf.FieldList.mask |
Order and number of dimensions
expand_dims |
|
squeeze |
|
transpose |
|
unsqueeze |
Rearranging elements
anchor |
|
flip |
|
roll |
Logic functions¶
Comparison
equals |
True if two field lists are equal, False otherwise. |
cf.FieldList.equivalent |
|
cf.FieldList.equivalent_data |
|
cf.FieldList.equivalent_domain |
Miscellaneous¶
cf.FieldList.binary_mask |
|
cf.FieldList.chunk |
|
close |
|
cf.FieldList.concatenate |
Join a sequence of fields together. |
cf.FieldList.convert_reference_time |
|
copy |
Return a deep copy. |
cf.FieldList.datum |
|
dump |
A full description of each field. |
cf.FieldList.fill_value |
|
cf.FieldList.identity |
|
cf.FieldList.insert_data |
|
cf.FieldList.mask_invalid |
|
cf.FieldList.match |
|
cf.FieldList.name |
|
cf.FieldList.override_units |
|
cf.FieldList.override_calendar |
|
cf.FieldList.promote |
|
cf.FieldList.remove_data |
|
select |
Return the fields that satisfy the given conditions. |
weights |
|
where |
List-like operations¶
These methods provide functionality similar to that of a built-in list.
append |
L.append(object) – append object to end |
count |
L.count(value) – return number of occurrences of value |
extend |
L.extend(iterable) – extend list by appending elements from the iterable |
index |
L.index(value, [start, [stop]]) – return first index of value. |
insert |
L.insert(index, object) – insert object before index |
pop |
Raises IndexError if list is empty or index is out of range. |
reverse |
L.reverse() – reverse IN PLACE |
sort |
L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; |
__contains__ |
Called to implement membership test operators. |
__getitem__ |
Called to implement evaluation of f[index] |
__len__ |
|
__setitem__ |
x.__setitem__(i, y) <==> x[i]=y |
Arithmetic and comparison operations¶
Any arithmetic, bitwise or comparison operation is applied independently to each field element of the field list
In particular, the built-in list
arithmetic and comparison
operator behaviours do not apply. For example, adding 2
to a field
list will add 2
to the data array of each of its fields, but the
+
operator will concatenate two built-in lists.
Comparison operators
__lt__ |
x.__lt__(y) <==> x<y |
__le__ |
x.__le__(y) <==> x<=y |
__eq__ |
x.__eq__(y) <==> x==y |
__ne__ |
x.__ne__(y) <==> x!=y |
__gt__ |
x.__gt__(y) <==> x>y |
__ge__ |
x.__ge__(y) <==> x>=y |
Binary arithmetic operators
__add__ |
Called to implement evaluation of f + x |
cf.FieldList.__sub__ |
|
__mul__ |
Called to implement evaluation of f* x |
cf.FieldList.__div__ |
|
cf.FieldList.__truediv__ |
|
cf.FieldList.__floordiv__ |
|
cf.FieldList.__pow__ |
|
cf.FieldList.__mod__ |
Binary arithmetic operators with reflected (swapped) operands
cf.FieldList.__radd__ |
|
cf.FieldList.__rsub__ |
|
__rmul__ |
x.__rmul__(n) <==> n*x |
cf.FieldList.__rdiv__ |
|
cf.FieldList.__rtruediv__ |
|
cf.FieldList.__rfloordiv__ |
|
cf.FieldList.__rpow__ |
|
cf.FieldList.__rmod__ |
Augmented arithmetic assignments
__iadd__ |
x.__iadd__(y) <==> x+=y |
cf.FieldList.__isub__ |
|
__imul__ |
x.__imul__(y) <==> x*=y |
cf.FieldList.__idiv__ |
|
cf.FieldList.__itruediv__ |
|
cf.FieldList.__ifloordiv__ |
|
cf.FieldList.__ipow__ |
|
cf.FieldList.__imod__ |
Unary arithmetic operators
cf.FieldList.__neg__ |
|
cf.FieldList.__pos__ |
|
cf.FieldList.__abs__ |
Binary bitwise operators
cf.FieldList.__and__ |
|
cf.FieldList.__or__ |
|
cf.FieldList.__xor__ |
|
cf.FieldList.__lshift__ |
|
cf.FieldList.__rshift__ |
Binary bitwise operators with reflected (swapped) operands
cf.FieldList.__rand__ |
|
cf.FieldList.__ror__ |
|
cf.FieldList.__rxor__ |
|
cf.FieldList.__rlshift__ |
|
cf.FieldList.__rrshift__ |
Augmented bitwise assignments
cf.FieldList.__iand__ |
|
cf.FieldList.__ior__ |
|
cf.FieldList.__ixor__ |
|
cf.FieldList.__ilshift__ |
|
cf.FieldList.__irshift__ |
Unary bitwise operators
cf.FieldList.__invert__ |
Special methods¶
__deepcopy__ |
Called by the copy.deepcopy standard library function. |
__repr__ |
Called by the repr built-in function. |
__str__ |
Called by the str built-in function. |