cdm_reader_mapper.cdm_mapper.codes package

Common Data Model (CDM) mapper code tables.

Subpackages

Submodules

cdm_reader_mapper.cdm_mapper.codes.codes module

Created on Thu Apr 11 13:45:38 2019.

Module to handle data models mappings to C3S Climate Data Store Common Data Model (CMD) tables within the cdm tool.

@author: iregon

cdm_reader_mapper.cdm_mapper.codes.codes.get_code_table(data_model, *sub_models, code_table=None)[source]

Load code tables into dictionary.

Combine JSON code table files from a specified data model, optional submodels, and common code tables.

Parameters:
  • data_model (str) – The main data model name, e.g., icoads.

  • *sub_models (str) – Optional submodel names, e.g. r300, d721.

  • code_table (str) – Name of the code table to load. If None, return empty dictionary.

Return type:

dict[str, dict[str, Any]]

Returns:

dict – Combined dictionary of code tables. Nested tables are merged recursively.

cdm_reader_mapper.cdm_mapper.codes.codes.open_code_table(ifile)[source]

Open code table from json file on disk.

Parameters:

ifile (str or Path-like) – Path to the JSON file containing the code table.

Return type:

Any

Returns:

Any – Parsed JSON content with integer range keys expanded into explicit keys.