plots.metadata.formatters

Attributes

SPECIAL_METHODS

logger

Classes

BaseFormatter

Formatter of earthkit-plots components, enabling convient titles and labels.

FigureFormatter

Formatter of earthkit-plots Charts, enabling convient titles and labels.

LayerFormatter

Formatter of earthkit-plots Layers, enabling convient titles and labels.

SourceFormatter

Formatter of earthkit-plots Layers, enabling convient titles and labels.

SubplotFormatter

Formatter of earthkit-plots Subplots, enabling convient titles and labels.

TimeFormatter

Formatter of time data, enabling convient time labels.

Functions

format_month(data)

Extract the month of the data time.

parse_time(time)

Module Contents

class plots.metadata.formatters.BaseFormatter

Bases: string.Formatter

Formatter of earthkit-plots components, enabling convient titles and labels.

STYLE_ATTRIBUTES
SUBPLOT_ATTRIBUTES
convert_field(value, conversion)

Convert a field value according to the conversion type.

Parameters:
  • value (object) – The value to be converted.

  • conversion (str) – The conversion type.

format(format_string, /, *args, **kwargs)
format_key(key)
format_keys(format_string, kwargs)

Format keys in a format string.

Parameters:
  • format_string (str) – The format string.

  • kwargs (dict) – The keyword arguments to be formatted.

class plots.metadata.formatters.FigureFormatter(subplots, unique=True)

Bases: BaseFormatter

Formatter of earthkit-plots Charts, enabling convient titles and labels.

STYLE_ATTRIBUTES
SUBPLOT_ATTRIBUTES
convert_field(value, conversion)

Convert a field value according to the conversion type.

Parameters:
  • value (object) – The value to be converted.

  • conversion (str) – The conversion type.

format(format_string, /, *args, **kwargs)
format_field(value, format_spec)
format_key(key)
format_keys(format_string, kwargs)

Format keys in a format string.

Parameters:
  • format_string (str) – The format string.

  • kwargs (dict) – The keyword arguments to be formatted.

subplots
unique = True
class plots.metadata.formatters.LayerFormatter(layer)

Bases: BaseFormatter

Formatter of earthkit-plots Layers, enabling convient titles and labels.

STYLE_ATTRIBUTES
SUBPLOT_ATTRIBUTES
convert_field(value, conversion)

Convert a field value according to the conversion type.

Parameters:
  • value (object) – The value to be converted.

  • conversion (str) – The conversion type.

format(format_string, /, *args, **kwargs)
format_field(value, format_spec)
format_key(key)
format_keys(format_string, kwargs)

Format keys in a format string.

Parameters:
  • format_string (str) – The format string.

  • kwargs (dict) – The keyword arguments to be formatted.

layer
plots.metadata.formatters.SPECIAL_METHODS
class plots.metadata.formatters.SourceFormatter(source)

Bases: BaseFormatter

Formatter of earthkit-plots Layers, enabling convient titles and labels.

STYLE_ATTRIBUTES
SUBPLOT_ATTRIBUTES
convert_field(value, conversion)

Convert a field value according to the conversion type.

Parameters:
  • value (object) – The value to be converted.

  • conversion (str) – The conversion type.

format(format_string, /, *args, **kwargs)
format_key(key)
format_keys(format_string, kwargs)

Format keys in a format string.

Parameters:
  • format_string (str) – The format string.

  • kwargs (dict) – The keyword arguments to be formatted.

source
class plots.metadata.formatters.SubplotFormatter(subplot, unique=True)

Bases: BaseFormatter

Formatter of earthkit-plots Subplots, enabling convient titles and labels.

STYLE_ATTRIBUTES
SUBPLOT_ATTRIBUTES
convert_field(value, conversion)

Convert a field value according to the conversion type.

Parameters:
  • value (object) – The value to be converted.

  • conversion (str) – The conversion type.

format(format_string, /, *args, **kwargs)
format_field(value, format_spec)
format_key(key)
format_keys(format_string, kwargs)

Format keys in a format string.

Parameters:
  • format_string (str) – The format string.

  • kwargs (dict) – The keyword arguments to be formatted.

subplot
unique = True
class plots.metadata.formatters.TimeFormatter(times, time_zone=None)

Formatter of time data, enabling convient time labels.

Parameters:
  • times (list) – The times to be formatted.

  • time_zone (str, optional) – The time zone to be used for the times.

base_time()

The base time of the data, i.e. the time of the forecast.

property lead_time

The lead time of the data, i.e. the time between the base and valid times.

property time

The most basic representation of time.

times
property utc_offset

The offset in hours from UTC.

valid_time()

The valid time of the data, i.e. the time the forecast is for.

plots.metadata.formatters.format_month(data)

Extract the month of the data time.

Parameters:

data (earthkit.maps.sources.Source) – The data source.

plots.metadata.formatters.logger
plots.metadata.formatters.parse_time(time)