cdm.lib.mappings.mappings_hdlr

Created on Thu Apr 11 13:45:38 2019

Module to handle data models mappers or imodel’s use to map meteorological variables to the C3S Climate Data Store Common Data Model (CMD) tables. This module handles all mappers contained inside the tool

@author: iregon

Module Contents

Classes

smart_dict

Gets items from nested dictionaries.

Functions

dict_depth()

Finds the depth of a python dictionary

expand_integer_range_key(d)

NEEDS DOCUMENTING

get_functions_module_path(imodel, log_level='INFO')

NEEDS DOCUMENTING

load_code_tables_maps(imodel, codes_subset=None, log_level='INFO')

NEEDS DOCUMENTING

load_tables_maps(imodel, cdm_subset=None, log_level='INFO')

NEEDS DOCUMENTING

Attributes

tool_name

module_path

module_tree

tool_name = cdm[source]
module_path[source]
module_tree[source]
dict_depth()[source]

Finds the depth of a python dictionary

Returns

Return type

maximum dict depth

class smart_dict(*args, **kwargs)[source]

Bases: dict

Gets items from nested dictionaries.

Parameters

dict (python dictionary.) –

  • For simple dictionaries: smart_dict(dict)[key]

  • For nested dictionaries up to n levels

  1. First level: can declare key as single element or in list

    e.g. smart_dict(dict)[[key]], smart_dict(dict)[key]

  2. Successive levels: keys in list from outer to inner, up to desired level

    e.g. smart_dict(dict)[[key1, key2,key3]], smart_dict(dict)[[key1, key2,key3,..keyn]]

Returns

None

Return type

if key or combination not found

__getitem__(self, key)[source]

NEEDS DOCUMENTING

Parameters
  • self

  • key

Returns

Return type

val

expand_integer_range_key(d)[source]

NEEDS DOCUMENTING

Parameters

d

get_functions_module_path(imodel, log_level='INFO')[source]

NEEDS DOCUMENTING

Parameters
  • imodel

  • log_level

Returns

  • logger.error

  • imodel_functions

load_code_tables_maps(imodel, codes_subset=None, log_level='INFO')[source]

NEEDS DOCUMENTING

Parameters
  • imodel

  • codes_subset

  • log_level

Returns

  • logger.error

  • codes

load_tables_maps(imodel, cdm_subset=None, log_level='INFO')[source]

NEEDS DOCUMENTING

Parameters
  • imodel

  • cdm_subset

  • log_level

Returns

  • logger.error

  • maps