cf.load_stash2standard_name¶
- cf.load_stash2standard_name(table=None, delimiter='!', merge=True, reset=False)[source]¶
Load a STASH to standard name conversion table from a file.
This used when reading PP and UM fields files.
Each mapping is defined by a separate line in a text file. Each line contains nine
!-delimited entries:ID: UM sub model identifier (1 = atmosphere, 2 = ocean, etc.)
STASH: STASH code (e.g. 3236)
STASHmaster description:STASH name as given in the STASHmaster files
Units: Units of this STASH code (e.g. ‘kg m-2’)
Valid from: This STASH valid from this UM version (e.g. 405)
Valid to: This STASH valid to this UM version (e.g. 501)
CF standard name: The CF standard name
CF info: Anything useful (such as standard name modifiers)
PP conditions: PP conditions which need to be satisfied for this translation
Only entries “ID”, “STASH”, and “CF standard name” are mandatory, all other entries may be left blank. For example,
1!999!!!!!ultraviolet_index!!is a valid mapping from atmosphere STASH code 999 to the standard name ultraviolet_index.If the “Valid from” and “Valid to” entries are omitted then the stash mapping is assumed to apply to all UM versions.
See also
- Parameters:
- table:
strorNone, optional Use the conversion table at this file location. By default the default table of the
umfivelibrary will be loaded.- delimiter:
str, optional The delimiter of the table columns. By default,
!is taken as the delimiter.- merge:
bool, optional If False then the table is updated to only contain the mappings defined by the table parameter. By default the mappings defined by the table parameter are incorporated into the existing table, overwriting any entries which already exist.
- reset:
bool, optional If True then clear all entries and re-load the default table.
- table:
- Returns:
dictThe new STASH to standard name conversion table.
Examples
>>> cf.load_stash2standard_name() >>> cf.load_stash2standard_name('my_table.txt') >>> cf.load_stash2standard_name('my_table2.txt', ',') >>> cf.load_stash2standard_name('my_table3.txt', merge=True) >>> cf.load_stash2standard_name('my_table4.txt', merge=False)