pyfdb.pyfdb_iterator#

Attributes#

Classes#

ListElement

Element returned from a listing command

WipeElementType

Values

WipeElement

StatusElement

PurgeElement

StatsElement

ControlElement

IndexAxis

IndexAxis class representing axes and their extent. The class implements all Dictionary

Module Contents#

logger#
class ListElement(list_element: pyfdb._internal.ListElement, *, _internal=False)#

Element returned from a listing command

_element: pyfdb._internal.ListElement#
has_location() bool#

Does the ListElement have a location

Returns:

True if this element has a location, False otherwise.

Return type:

bool

Note

Only for `ListElement`s which are on the third level of the schema.

offset() int | None#

Offset within the file associated with the ListElement

Returns:

Offset in bytes in the data file of the FDB, if ListElement is on level 3, None otherwise.

Return type:

Optional[int]

Note

Only for `ListElement`s which are on the third level of the schema.

length() int | None#

Size of the ListElement within the file associated.

Returns:

Size in bytes in the data file of the FDB, if ListElement is on level 3, None otherwise.

Return type:

Optional[int]

Note

Only for `ListElement`s which are on the third level of the schema.

combined_key() dict[str, str]#

Return the MARS keys of the ListElement

Returns:

Dictionary containing all metadata for the ListElement

Return type:

dict[str, str]

Note

Depending on the level specified in the list command, the returned dictionary contains all available keys from schema levels up to and including the requested level; keys that exist only at deeper levels are omitted.

Examples

>>> list_iterator = fdb.list(selection, level=3)
>>> assert list_iterator
>>> elements = list(list_iterator)
>>> for element in elements:
>>>     print(element.combined_key())

Output:

``#

{ ‘class’: ‘ea’, ‘date’: ‘20200104’, … , ‘type’: ‘an’ } … ``

keys() list[dict[str, str]]#

Return the MARS keys of the ListElement separated by their level in the schema.

Returns:

List containing MARS keys and their values for the ListElement. The keys are split by their level in the schema

Return type:

list[dict[str, str]]

Note

Depending on the level specified in the list command, the returned dictionary contains all available keys from schema levels up to and including the requested level; keys that exist only at deeper levels are omitted.

Examples

>>> list_iterator = fdb.list(selection, level=3)
>>> assert list_iterator
>>> elements = list(list_iterator)
>>> for element in elements:
>>>     print(element.keys())

Output:

``#

[{‘class’: ‘ea’, … , ‘time’: ‘2100’}, {‘levtype’: ‘sfc’, ‘type’: ‘an’}, {‘param’: ‘167’, ‘step’: ‘0’}] … ``

property data_handle: pyfdb.pyfdb_type.DataHandle | None#

Access the DataHandle

Returns:

Data Handle for accessing the data of the list element

Return type:

DataHandle

Examples

>>> data_handle = list_element.data_handle
>>> if data_handle is not None:
>>>     data_handle.open()
>>>     data_handle.read(4)
>>>     data_handle.close()

Output:

b"GRIB"

property uri: pyfdb.pyfdb_type.URI | None#

Access the URI of the list element

Returns:

URI of the data

Return type:

URI

Examples

>>> uri = list_element.uri
>>> print(uri)

Output:

<path/to/data_file>

__repr__() str#
class WipeElementType#

Bases: enum.IntEnum

Values#

  • ERROR

  • CATALOGUE_INFO

  • CATALOGUE

  • CATALOGUE_INDEX

  • CATALOGUE_SAFE

  • CATALOGUE_CONTROL

  • STORE

  • STORE_AUX

  • STORE_SAFE

  • UNKNOWN

Initialize self. See help(type(self)) for accurate signature.

ERROR = 0#
CATALOGUE_INFO#
CATALOGUE#
CATALOGUE_INDEX#
CATALOGUE_SAFE#
CATALOGUE_CONTROL#
STORE#
STORE_AUX#
STORE_SAFE#
UNKNOWN#
classmethod _from_raw(en: pyfdb._internal.WipeElementType)#
_to_raw()#
__repr__() str#

Return repr(self).

__str__() str#

Return str(self).

class WipeElement(wipe_element: str, *, _internal=False)#
_element: pyfdb._internal.WipeElement#
type() WipeElementType#
msg() str#
uris() list[pyfdb.pyfdb_type.URI]#
__repr__() str#
class StatusElement(control_element: pyfdb._internal.ControlElement, *, _internal=False)#
element: pyfdb._internal.ControlElement#
__eq__(other: object, /) bool#
__ne__(value: object, /) bool#
location() pyfdb.pyfdb_type.URI#
controlIdentifiers() list[pyfdb.pyfdb_type.ControlIdentifier]#
key() pyfdb.pyfdb_type.MarsSelection#
__repr__() str#
class PurgeElement(purge_element: str, *, _internal=False)#
element: pyfdb._internal.PurgeElement#
__repr__() str#
class StatsElement(stats_element: pyfdb._internal.StatsElement, *, _internal=False)#
element: pyfdb._internal.StatsElement#
db_statistics() str#
index_statistics() str#
__repr__() str#
class ControlElement(control_element: pyfdb._internal.ControlElement, *, _internal=False)#
element: pyfdb._internal.ControlElement#
__eq__(other: object, /) bool#
__ne__(value: object, /) bool#
location() pyfdb.pyfdb_type.URI#
controlIdentifiers() list[pyfdb.pyfdb_type.ControlIdentifier]#
key() pyfdb.pyfdb_type.MarsSelection#
__repr__() str#
class IndexAxis(index_axis: pyfdb._internal.IndexAxis | pyfdb.pyfdb_type.MarsSelection)#

Bases: pyfdb._internal.pyfdb_internal.InternalMarsSelection

IndexAxis class representing axes and their extent. The class implements all Dictionary functionalities. Key are the corresponding FDB keys (axes) and values are the values defining the extent of an axis.

__repr__() str#
__getitem__(key: str) collections.abc.Collection[str]#
__setitem__(key, value)#
__delitem__(key)#
clear()#
__len__() int#
__iter__() collections.abc.Iterator[str]#
__eq__(value) bool#
__ne__(value: object, /) bool#
has_key(k) bool#
keys() collections.abc.KeysView[str]#
values() collections.abc.ValuesView[collections.abc.Collection[str]]#
items() collections.abc.ItemsView[str, collections.abc.Collection[str]]#
__contains__(item: object)#