pyfdb.pyfdb_iterator ==================== .. py:module:: pyfdb.pyfdb_iterator Attributes ---------- .. autoapisummary:: pyfdb.pyfdb_iterator.logger Classes ------- .. autoapisummary:: pyfdb.pyfdb_iterator.ListElement pyfdb.pyfdb_iterator.WipeElementType pyfdb.pyfdb_iterator.WipeElement pyfdb.pyfdb_iterator.StatusElement pyfdb.pyfdb_iterator.PurgeElement pyfdb.pyfdb_iterator.StatsElement pyfdb.pyfdb_iterator.ControlElement pyfdb.pyfdb_iterator.IndexAxis Module Contents --------------- .. py:data:: logger .. py:class:: ListElement(list_element: pyfdb._internal.ListElement, *, _internal=False) Element returned from a listing command .. py:attribute:: _element :type: pyfdb._internal.ListElement .. py:method:: has_location() -> bool Does the `ListElement` have a location :returns: `True` if this element has a location, `False` otherwise. :rtype: `bool` .. note:: Only for `ListElement`s which are on the third level of the schema. .. py:method:: offset() -> Optional[int] 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. :rtype: `Optional[int]` .. note:: Only for `ListElement`s which are on the third level of the schema. .. py:method:: length() -> Optional[int] 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. :rtype: `Optional[int]` .. note:: Only for `ListElement`s which are on the third level of the schema. .. py:method:: combined_key() -> dict[str, str] Return the MARS keys of the `ListElement` :returns: Dictionary containing all metadata for the `ListElement` :rtype: `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. .. rubric:: 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' } ... `` .. py:method:: 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 :rtype: `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. .. rubric:: 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'}] ... `` .. py:property:: data_handle :type: Optional[pyfdb.pyfdb_type.DataHandle] Access the `DataHandle` :returns: Data Handle for accessing the data of the list element :rtype: `DataHandle` .. rubric:: 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"`` .. py:property:: uri :type: Optional[pyfdb.pyfdb_type.URI] Access the URI of the list element :returns: URI of the data :rtype: `URI` .. rubric:: Examples >>> uri = list_element.uri >>> print(uri) Output: ```` .. py:method:: __repr__() -> str .. py:class:: WipeElementType Bases: :py:obj:`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. .. py:attribute:: ERROR :value: 0 .. py:attribute:: CATALOGUE_INFO .. py:attribute:: CATALOGUE .. py:attribute:: CATALOGUE_INDEX .. py:attribute:: CATALOGUE_SAFE .. py:attribute:: CATALOGUE_CONTROL .. py:attribute:: STORE .. py:attribute:: STORE_AUX .. py:attribute:: STORE_SAFE .. py:attribute:: UNKNOWN .. py:method:: _from_raw(en: pyfdb._internal.WipeElementType) :classmethod: .. py:method:: _to_raw() .. py:method:: __repr__() -> str Return repr(self). .. py:method:: __str__() -> str Return str(self). .. py:class:: WipeElement(wipe_element: str, *, _internal=False) .. py:attribute:: _element :type: pyfdb._internal.WipeElement .. py:method:: type() -> WipeElementType .. py:method:: msg() -> str .. py:method:: uris() -> list[pyfdb.pyfdb_type.URI] .. py:method:: __repr__() -> str .. py:class:: StatusElement(control_element: pyfdb._internal.ControlElement, *, _internal=False) .. py:attribute:: element :type: pyfdb._internal.ControlElement .. py:method:: __eq__(other: object, /) -> bool .. py:method:: __ne__(value: object, /) -> bool .. py:method:: location() -> pyfdb.pyfdb_type.URI .. py:method:: controlIdentifiers() -> list[pyfdb.pyfdb_type.ControlIdentifier] .. py:method:: key() -> pyfdb.pyfdb_type.MarsSelection .. py:method:: __repr__() -> str .. py:class:: PurgeElement(purge_element: str, *, _internal=False) .. py:attribute:: element :type: pyfdb._internal.PurgeElement .. py:method:: __repr__() -> str .. py:class:: StatsElement(stats_element: pyfdb._internal.StatsElement, *, _internal=False) .. py:attribute:: element :type: pyfdb._internal.StatsElement .. py:method:: db_statistics() -> str .. py:method:: index_statistics() -> str .. py:method:: __repr__() -> str .. py:class:: ControlElement(control_element: pyfdb._internal.ControlElement, *, _internal=False) .. py:attribute:: element :type: pyfdb._internal.ControlElement .. py:method:: __eq__(other: object, /) -> bool .. py:method:: __ne__(value: object, /) -> bool .. py:method:: location() -> pyfdb.pyfdb_type.URI .. py:method:: controlIdentifiers() -> list[pyfdb.pyfdb_type.ControlIdentifier] .. py:method:: key() -> pyfdb.pyfdb_type.MarsSelection .. py:method:: __repr__() -> str .. py:class:: IndexAxis(index_axis: pyfdb._internal.IndexAxis | pyfdb.pyfdb_type.MarsSelection) Bases: :py:obj:`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. .. py:method:: __repr__() -> str .. py:method:: __getitem__(key: str) -> collections.abc.Collection[str] .. py:method:: __setitem__(key, value) .. py:method:: __delitem__(key) .. py:method:: clear() .. py:method:: __len__() -> int .. py:method:: __iter__() -> collections.abc.Iterator[str] .. py:method:: __eq__(value) -> bool .. py:method:: __ne__(value: object, /) -> bool .. py:method:: has_key(k) -> bool .. py:method:: keys() -> collections.abc.KeysView[str] .. py:method:: values() -> collections.abc.ValuesView[collections.abc.Collection[str]] .. py:method:: items() -> collections.abc.ItemsView[str, collections.abc.Collection[str]] .. py:method:: __contains__(item: object)