cf.Data.cfa_update_file_substitutions

Data.cfa_update_file_substitutions(substitutions)[source]

Set CFA-netCDF file name substitutions.

New in version 3.15.0.

Parameters
substitutions: dict

The substitution definitions in a dictionary whose key/value pairs are the file name parts to be substituted and their corresponding substitution text.

Each substitution definition may be specified with or without the ${...} syntax. For instance, the following are equivalent: {'base': 'sub'}, {'${base}': 'sub'}.

Returns

None

Examples

>>> f.cfa_update_file_substitutions({'base': 'file:///data/'})
>>> f.cfa_has_file_substitutions()
True
>>> f.cfa_file_substitutions()
{'${base}': 'file:///data/'}
>>> f.cfa_update_file_substitutions({'${base2}': '/home/data/'})
>>> f.cfa_file_substitutions()
{'${base}': 'file:///data/', '${base2}': '/home/data/'}
>>> f.cfa_update_file_substitutions({'${base}': '/new/location/'})
>>> f.cfa_file_substitutions()
{'${base}': '/new/location/', '${base2}': '/home/data/'}
>>> f.cfa_del_file_substitution('${base}')
{'${base}': '/new/location/'}
>>> f.cfa_clear_file_substitutions()
{'${base2}': '/home/data/'}
>>> f.cfa_has_file_substitutions()
False
>>> f.cfa_file_substitutions()
{}
>>> f.cfa_clear_file_substitutions()
{}
>>> print(f.cfa_del_file_substitution('base', None))
None