cf.FieldList


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

Bases: cf.mixin.fielddomainlist.FieldDomainList, cf.constructlist.ConstructList

An ordered sequence of field constructs.

A field list supports the python list-like operations (such as indexing and methods like append). These methods provide functionality similar to that of a built-in list. The main difference is that when a field construct element needs to be assessed for equality its equals method is used, rather than the == operator.

Initialisation

Parameters
fields: (sequence of) Field, optional

Create a new list with these field constructs.

Selecting

select_by_construct

Select elements by their metadata constructs.

select_by_identity

Select list elements constructs by identity.

select_by_naxes

Select field constructs by property.

select_by_ncvar

Select list elements by netCDF variable name.

select_by_property

Select list elements by property.

select_by_rank

Select list elements by the number of domain axis constructs.

select_by_units

Select field constructs by units.

select

Alias of cf.FieldList.select_by_identity.

select_field

Select a unique field construct by its identity.

__call__

Alias for cf.FieldList.select_by_identity.

Comparison

equals

Whether two lists are the same.

Miscellaneous

close

Close all files referenced by each construct in the list.

concatenate

Join the sequence of fields within the field list together.

copy

Return a deep copy.

Aliases

select

Alias of cf.FieldList.select_by_identity.

__call__

Alias for cf.FieldList.select_by_identity.

List-like operations

These methods provide functionality identical to that of a Python list, with one exception:

For example

>>> fl.count(x)

is equivalent to

>>> sum(f.equals(x) for f in fl)

append

Append object to the end of the list.

clear

Remove all items from list.

count

Return number of occurrences of value.

extend

Extend list by appending elements from the iterable.

index

Return first index of value.

insert

Insert object before index.

pop

Remove and return item at index (default last).

remove

Remove first occurrence of value.

reverse

Reverse IN PLACE.

sort

Sort of the list in place.

__add__

The binary arithmetic operation +

__contains__

Called to implement membership test operators.

__eq__

The rich comparison operator ==

__ge__

Return self>=value.

__getitem__

Called to implement evaluation of f[index]

__getslice__

Called to implement evaluation of f[i:j]

__gt__

Return self>value.

__iter__

Implement iter(self).

__iadd__

Implement self+=value.

__imul__

Implement self*=value.

__le__

Return self<=value.

__len__

Return len(self).

__lt__

Return self<value.

__mul__

The binary arithmetic operation *

__ne__

The rich comparison operator !=

__repr__

Called by the repr built-in function.

__rmul__

Return value*self.

__setitem__

Set self[key] to value.

__str__

Called by the str built-in function.

Special methods

__call__

Alias for cf.FieldList.select_by_identity.

__deepcopy__

Called by the copy.deepcopy standard library function.

Deprecated

Methods

select1

Deprecated at version 3.0.0.

set_equals

Deprecated at version 3.0.0.