plots.metadata.formatters ========================= .. py:module:: plots.metadata.formatters Attributes ---------- .. autoapisummary:: plots.metadata.formatters.SPECIAL_METHODS plots.metadata.formatters.logger Classes ------- .. autoapisummary:: plots.metadata.formatters.BaseFormatter plots.metadata.formatters.FigureFormatter plots.metadata.formatters.LayerFormatter plots.metadata.formatters.SourceFormatter plots.metadata.formatters.SubplotFormatter plots.metadata.formatters.TimeFormatter Functions --------- .. autoapisummary:: plots.metadata.formatters.format_month plots.metadata.formatters.parse_time Module Contents --------------- .. py:class:: BaseFormatter Bases: :py:obj:`string.Formatter` Formatter of earthkit-plots components, enabling convient titles and labels. .. py:attribute:: STYLE_ATTRIBUTES .. py:attribute:: SUBPLOT_ATTRIBUTES .. py:method:: convert_field(value, conversion) Convert a field value according to the conversion type. :param value: The value to be converted. :type value: object :param conversion: The conversion type. :type conversion: str .. py:method:: format(format_string, /, *args, **kwargs) .. py:method:: format_key(key) .. py:method:: format_keys(format_string, kwargs) Format keys in a format string. :param format_string: The format string. :type format_string: str :param kwargs: The keyword arguments to be formatted. :type kwargs: dict .. py:class:: FigureFormatter(subplots, unique=True) Bases: :py:obj:`BaseFormatter` Formatter of earthkit-plots `Charts`, enabling convient titles and labels. .. py:attribute:: STYLE_ATTRIBUTES .. py:attribute:: SUBPLOT_ATTRIBUTES .. py:method:: convert_field(value, conversion) Convert a field value according to the conversion type. :param value: The value to be converted. :type value: object :param conversion: The conversion type. :type conversion: str .. py:method:: format(format_string, /, *args, **kwargs) .. py:method:: format_field(value, format_spec) .. py:method:: format_key(key) .. py:method:: format_keys(format_string, kwargs) Format keys in a format string. :param format_string: The format string. :type format_string: str :param kwargs: The keyword arguments to be formatted. :type kwargs: dict .. py:attribute:: subplots .. py:attribute:: unique .. py:class:: LayerFormatter(layer) Bases: :py:obj:`BaseFormatter` Formatter of earthkit-plots `Layers`, enabling convient titles and labels. .. py:attribute:: STYLE_ATTRIBUTES .. py:attribute:: SUBPLOT_ATTRIBUTES .. py:method:: convert_field(value, conversion) Convert a field value according to the conversion type. :param value: The value to be converted. :type value: object :param conversion: The conversion type. :type conversion: str .. py:method:: format(format_string, /, *args, **kwargs) .. py:method:: format_key(key) .. py:method:: format_keys(format_string, kwargs) Format keys in a format string. :param format_string: The format string. :type format_string: str :param kwargs: The keyword arguments to be formatted. :type kwargs: dict .. py:attribute:: layer .. py:data:: SPECIAL_METHODS .. py:class:: SourceFormatter(source) Bases: :py:obj:`BaseFormatter` Formatter of earthkit-plots `Layers`, enabling convient titles and labels. .. py:attribute:: STYLE_ATTRIBUTES .. py:attribute:: SUBPLOT_ATTRIBUTES .. py:method:: convert_field(value, conversion) Convert a field value according to the conversion type. :param value: The value to be converted. :type value: object :param conversion: The conversion type. :type conversion: str .. py:method:: format(format_string, /, *args, **kwargs) .. py:method:: format_key(key) .. py:method:: format_keys(format_string, kwargs) Format keys in a format string. :param format_string: The format string. :type format_string: str :param kwargs: The keyword arguments to be formatted. :type kwargs: dict .. py:attribute:: source .. py:class:: SubplotFormatter(subplot, unique=True) Bases: :py:obj:`BaseFormatter` Formatter of earthkit-plots `Subplots`, enabling convient titles and labels. .. py:attribute:: STYLE_ATTRIBUTES .. py:attribute:: SUBPLOT_ATTRIBUTES .. py:method:: convert_field(value, conversion) Convert a field value according to the conversion type. :param value: The value to be converted. :type value: object :param conversion: The conversion type. :type conversion: str .. py:method:: format(format_string, /, *args, **kwargs) .. py:method:: format_field(value, format_spec) .. py:method:: format_key(key) .. py:method:: format_keys(format_string, kwargs) Format keys in a format string. :param format_string: The format string. :type format_string: str :param kwargs: The keyword arguments to be formatted. :type kwargs: dict .. py:attribute:: subplot .. py:attribute:: unique .. py:class:: TimeFormatter(times, time_zone=None) Formatter of time data, enabling convient time labels. :param times: The times to be formatted. :type times: list :param time_zone: The time zone to be used for the times. :type time_zone: str, optional .. py:method:: base_time() The base time of the data, i.e. the time of the forecast. .. py:property:: lead_time The lead time of the data, i.e. the time between the base and valid times. .. py:property:: time The most basic representation of time. .. py:attribute:: times .. py:property:: utc_offset The offset in hours from UTC. .. py:method:: valid_time() The valid time of the data, i.e. the time the forecast is for. .. py:function:: format_month(data) Extract the month of the data time. :param data: The data source. :type data: earthkit.maps.sources.Source .. py:data:: logger .. py:function:: parse_time(time)