access_nri_intake.catalog.translators#

Tools for translating metadata in an intake source into a metadata table to use in an intake-dataframe-catalog like the ACCESS-NRI catalog

Module Contents#

Classes#

DefaultTranslator

Default Translator for translating metadata in an intake datastore into a DataFrame

Cmip6Translator

CMIP6 Translator for translating metadata from the NCI CMIP6 intake datastores.

Cmip5Translator

CMIP5 Translator for translating metadata from the NCI CMIP5 intake datastores.

EraiTranslator

ERAI Translator for translating metadata from the NCI ERA-Interim intake datastore.

exception access_nri_intake.catalog.translators.TranslatorError#

Bases: Exception

Generic Exception for the Translator classes

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

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class access_nri_intake.catalog.translators.DefaultTranslator(source, columns)#

Default Translator for translating metadata in an intake datastore into a DataFrame of metadata for use in an intake-dataframe-catalog.

Initialise a DefaultTranslator. This Translator works as follows:

  • If the input source is an intake-esm datastore, the translator will first look for the column in the esmcat.df attribute, casting iterable columns to tuples. If the source is not an intake-esm datastore, this step is skipped.

  • If that fails, the translator will then look for the column name as an attribute on the source itself

  • If that fails, the translator will then look for the column name in the metadata attribute of the source

Parameters:
source: :py:class:`~intake.DataSource`

The source to translate from

columns: list of str

The columns to translate to (these are the core columns in the intake-dataframe-catalog)

translate(groupby=None)#

Return the translated DataFrame of metadata and merge into set of set of rows with unique values of the columns specified.

Parameters:
groupby: list of str, optional

Core metadata columns to group by before merging metadata across remaining core columns.

class access_nri_intake.catalog.translators.Cmip6Translator(source, columns)#

Bases: DefaultTranslator

CMIP6 Translator for translating metadata from the NCI CMIP6 intake datastores.

Initialise a Cmip6Translator

Parameters:
source: :py:class:`~intake.DataSource`

The NCI CMIP6 intake-esm datastore

columns: list of str

The columns to translate to (these are the core columns in the intake-dataframe-catalog)

translate(groupby=None)#

Return the translated DataFrame of metadata and merge into set of set of rows with unique values of the columns specified.

Parameters:
groupby: list of str, optional

Core metadata columns to group by before merging metadata across remaining core columns.

class access_nri_intake.catalog.translators.Cmip5Translator(source, columns)#

Bases: DefaultTranslator

CMIP5 Translator for translating metadata from the NCI CMIP5 intake datastores.

Initialise a Cmip5Translator

Parameters:
source: :py:class:`~intake.DataSource`

The NCI CMIP5 intake-esm datastore

columns: list of str

The columns to translate to (these are the core columns in the intake-dataframe-catalog)

translate(groupby=None)#

Return the translated DataFrame of metadata and merge into set of set of rows with unique values of the columns specified.

Parameters:
groupby: list of str, optional

Core metadata columns to group by before merging metadata across remaining core columns.

class access_nri_intake.catalog.translators.EraiTranslator(source, columns)#

Bases: DefaultTranslator

ERAI Translator for translating metadata from the NCI ERA-Interim intake datastore.

Initialise a EraiTranslator

Parameters:
source: :py:class:`~intake.DataSource`

The NCI ERA-Interim intake-esm datastore

columns: list of str

The columns to translate to (these are the core columns in the intake-dataframe-catalog)

translate(groupby=None)#

Return the translated DataFrame of metadata and merge into set of set of rows with unique values of the columns specified.

Parameters:
groupby: list of str, optional

Core metadata columns to group by before merging metadata across remaining core columns.