esmvaltool/preprocessor/_io.py
def _write_ncl_metadata(output_dir, metadata):
    """Write NCL metadata files to output_dir."""
    variables = copy.deepcopy(list(metadata.values()))

    for variable in variables:
        fx_files = variable.pop('fx_files', {})
        for fx_type in fx_files:
            variable[fx_type] = fx_files[fx_type]

    info = {'input_file_info': variables}

    # Split input_file_info into dataset and variable properties
    # dataset keys and keys with non-identical values will be stored
    # in dataset_info, the rest in variable_info
    variable_info = {}
    info['variable_info'] = [variable_info]
    info['dataset_info'] = []
    for variable in variables:
        dataset_info = {}
        info['dataset_info'].append(dataset_info)
        for key in variable:
            dataset_specific = any(
                variable[key] != var.get(key, object()) for var in variables)
            if ((dataset_specific or key in DATASET_KEYS)
                    and key not in VARIABLE_KEYS):
                dataset_info[key] = variable[key]
            else:
                variable_info[key] = variable[key]

    filename = os.path.join(output_dir,
                            variable_info['short_name'] + '_info.ncl')
    write_ncl_settings(info, filename)

    return filename
Write NCL metadata files to output_dir.
Write NCL metadata files to output_dir.
Write NCL metadata files to output_dir .
def _write_ncl_metadata(output_dir, metadata):
    variables = copy.deepcopy(list(metadata.values()))
    for variable in variables:
        fx_files = variable.pop('fx_files', {})
        for fx_type in fx_files:
            variable[fx_type] = fx_files[fx_type]
    info = {'input_file_info': variables}
    variable_info = {}
    info['variable_info'] = [variable_info]
    info['dataset_info'] = []
    for variable in variables:
        dataset_info = {}
        info['dataset_info'].append(dataset_info)
        for key in variable:
            dataset_specific = any(
                variable[key] != var.get(key, object()) for var in variables)
            if ((dataset_specific or key in DATASET_KEYS)
                    and key not in VARIABLE_KEYS):
                dataset_info[key] = variable[key]
            else:
                variable_info[key] = variable[key]
    filename = os.path.join(output_dir,
                            variable_info['short_name'] + '_info.ncl')
    write_ncl_settings(info, filename)
    return filename
def _write_ncl_metadata ( output_dir , metadata ) : variables = copy . deepcopy ( list ( metadata . values ( ) ) ) for variable in variables : fx_files = variable . pop ( 'fx_files' , { } ) for fx_type in fx_files : variable [ fx_type ] = fx_files [ fx_type ] info = { 'input_file_info' : variables } variable_info = { } info [ 'variable_info' ] = [ variable_info ] info [ 'dataset_info' ] = [ ] for variable in variables : dataset_info = { } info [ 'dataset_info' ] . append ( dataset_info ) for key in variable : dataset_specific = any ( variable [ key ] != var . get ( key , object ( ) ) for var in variables ) if ( ( dataset_specific or key in DATASET_KEYS ) and key not in VARIABLE_KEYS ) : dataset_info [ key ] = variable [ key ] else : variable_info [ key ] = variable [ key ] filename = os . path . join ( output_dir , variable_info [ 'short_name' ] + '_info.ncl' ) write_ncl_settings ( info , filename ) return filename
Write NCL metadata files to output_dir.
Write NCL metadata files to output_dir .
"""Write NCL metadata files to output_dir.""" # Split input_file_info into dataset and variable properties # dataset keys and keys with non-identical values will be stored # in dataset_info, the rest in variable_info
output_dir
metadata