spyfit.io.sfit4.write_reference

spyfit.io.sfit4.write_reference(dataset, filename, map_gas_id_name, var_names='reference__{}', ordering='ascending')

Export reference ZPT and gas profiles to SFIT4 ascii format.

Use this function to create ‘reference.prf’ file.

Parameters:

dataset : dict or xr.Dataset

Either a xarray dataset or a mapping that contains profile data for ZPT and gas profiles. Values of the mapping may be array-like objects or dictionaries that must at least contain a ‘data’ item.

filename : str

Name or path to the file to write.

map_gas_id_name : dict

A mapping of SFIT4 gas id (keys) and gas name or ‘OTHER’ (values).

var_names : str

Template for variable names (i.e., keys of dataset). Must at least contain one parameter ‘{}’ that will be replaced by ‘altitude’, ‘pressure’, ‘temperature’ or by the gas name.

ordering: {‘ascending’, ‘descending’}

Ordering of the atmospheric profile values (‘ascending’: from bottom to top, ‘descending’: from top to bottom).

Notes

This function also looks for the ‘description’ and ‘ordering’ attributes or items in each variable/item of dataset to write profile headers and to set the correct data ordering (ignored if these attributes/items don’t exist).