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

Attributes#

Exceptions#

TranslatorError

Generic Exception for the Translator classes

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.

BarpaTranslator

Barpa Translator for translating metadata from the NCI BARPA intake datastores.

CordexTranslator

Cordex Translator for translating metadata from the NCI CORDEX intake datastores.

Era5Translator

Era5 Translator for translating metadata from the NCI ERA5 intake datastores.

CcamTranslator

Ccam Translator for translating metadata from the NCI CCAM intake datastores.

NarclimTranslator

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

Functions#

trace_failure(func)

Decorator that wraps a function and prints a message if it raises an exception

Module Contents#

access_nri_intake.catalog.translators.FREQUENCY_TRANSLATIONS#
access_nri_intake.catalog.translators.trace_failure(func)#

Decorator that wraps a function and prints a message if it raises an exception

exception access_nri_intake.catalog.translators.TranslatorError#

Bases: Exception

Generic Exception for the Translator classes

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

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)

source#
columns#
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.

set_dispatch(core_colname, func, input_name=None)#
Set a dispatch function for a column. Typically only required when either:
  1. core_colname != input_name

  2. A custom translation function (func) is required.

Parameters:
core_colname: str

The core column name to translate to

input_name: str, optional

The name of the column in the source. If not provided, this defaults to none, and no translation will occur

func: callable

The function to translate the column

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)

source#
columns#
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.

set_dispatch(core_colname, func, input_name=None)#
Set a dispatch function for a column. Typically only required when either:
  1. core_colname != input_name

  2. A custom translation function (func) is required.

Parameters:
core_colname: str

The core column name to translate to

input_name: str, optional

The name of the column in the source. If not provided, this defaults to none, and no translation will occur

func: callable

The function to translate the column

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)

source#
columns#
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.

set_dispatch(core_colname, func, input_name=None)#
Set a dispatch function for a column. Typically only required when either:
  1. core_colname != input_name

  2. A custom translation function (func) is required.

Parameters:
core_colname: str

The core column name to translate to

input_name: str, optional

The name of the column in the source. If not provided, this defaults to none, and no translation will occur

func: callable

The function to translate the column

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

Bases: DefaultTranslator

Barpa Translator for translating metadata from the NCI BARPA intake datastores.

Initialise a BarpaTranslator

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

The NCI BARPA intake-esm datastore

columns: list of str

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

source#
columns#
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.

set_dispatch(core_colname, func, input_name=None)#
Set a dispatch function for a column. Typically only required when either:
  1. core_colname != input_name

  2. A custom translation function (func) is required.

Parameters:
core_colname: str

The core column name to translate to

input_name: str, optional

The name of the column in the source. If not provided, this defaults to none, and no translation will occur

func: callable

The function to translate the column

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

Bases: DefaultTranslator

Cordex Translator for translating metadata from the NCI CORDEX intake datastores.

Initialise a CordexTranslator

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

The NCI CORDEX intake-esm datastore

columns: list of str

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

source#
columns#
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.

set_dispatch(core_colname, func, input_name=None)#
Set a dispatch function for a column. Typically only required when either:
  1. core_colname != input_name

  2. A custom translation function (func) is required.

Parameters:
core_colname: str

The core column name to translate to

input_name: str, optional

The name of the column in the source. If not provided, this defaults to none, and no translation will occur

func: callable

The function to translate the column

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

Bases: DefaultTranslator

Era5 Translator for translating metadata from the NCI ERA5 intake datastores.

Initialise a Era5Translator

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

The NCI ERA5 intake-esm datastore

columns: list of str

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

source#
columns#
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.

set_dispatch(core_colname, func, input_name=None)#
Set a dispatch function for a column. Typically only required when either:
  1. core_colname != input_name

  2. A custom translation function (func) is required.

Parameters:
core_colname: str

The core column name to translate to

input_name: str, optional

The name of the column in the source. If not provided, this defaults to none, and no translation will occur

func: callable

The function to translate the column

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

Bases: DefaultTranslator

Ccam Translator for translating metadata from the NCI CCAM intake datastores.

Initialise a CcamTranslator

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

The NCI CCAM intake-esm datastore

columns: list of str

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

source#
columns#
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.

set_dispatch(core_colname, func, input_name=None)#
Set a dispatch function for a column. Typically only required when either:
  1. core_colname != input_name

  2. A custom translation function (func) is required.

Parameters:
core_colname: str

The core column name to translate to

input_name: str, optional

The name of the column in the source. If not provided, this defaults to none, and no translation will occur

func: callable

The function to translate the column

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

Bases: DefaultTranslator

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

Initialise a BarpaTranslator

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

The NCI BARPA intake-esm datastore

columns: list of str

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

source#
columns#
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.

set_dispatch(core_colname, func, input_name=None)#
Set a dispatch function for a column. Typically only required when either:
  1. core_colname != input_name

  2. A custom translation function (func) is required.

Parameters:
core_colname: str

The core column name to translate to

input_name: str, optional

The name of the column in the source. If not provided, this defaults to none, and no translation will occur

func: callable

The function to translate the column