tsv2dict
Take tsv files and return data as dictionaries useful for creating netCDF files.
- ncas_amof_netcdf_template.tsv2dict.create_attributes_tsv_url(product: str, use_local_files: Optional[str] = None, tag: str = 'latest') str[source]
Returns URL for tsv file of global attributes specific to a given product and tag release or branch.
- Parameters:
product (str) – data product
use_local_files (str or None) – path to local directory where tsv files are stored. If “None”, read from online. Default None.
tag (str) – tagged release of definitions, or ‘latest’ to get most recent release. Ignored if use_local_files is not None. Default “latest”.
- Returns:
URL
- ncas_amof_netcdf_template.tsv2dict.create_dimensions_tsv_url(product: str, use_local_files: Optional[str] = None, tag: str = 'latest') str[source]
Returns URL for tsv file of dimensions specific to a given product and tag release or branch.
- Parameters:
product (str) – data product
use_local_files (str or None) – path to local directory where tsv files are stored. If “None”, read from online. Default None.
tag (str) – tagged release of definitions, or ‘latest’ to get most recent release. Ignored if use_local_files is not None. Default “latest”.
- Returns:
URL
- ncas_amof_netcdf_template.tsv2dict.create_variables_tsv_url(product: str, use_local_files: Optional[str] = None, tag: str = 'latest') str[source]
Returns URL for tsv file of variables specific to a given product and tag release or branch.
- Parameters:
product (str) – data product
use_local_files (str or None) – path to local directory where tsv files are stored. If “None”, read from online. Default None.
tag (str) – tagged release of definitions, or ‘latest’ to get most recent release. Ignored if use_local_files is not None. Default “latest”.
- Returns:
URL
- ncas_amof_netcdf_template.tsv2dict.instrument_dict(desired_instrument: str, loc: str = 'land', use_local_files: Optional[str] = None, tag: str = 'latest') dict[str, Union[str, list[str], dict[str, dict[str, str]]]][source]
Collect all variables, dimensions and attributes required for all data products associated with an instrument and deployment mode.
- Parameters:
desired_instrument (str) – name of instrument
loc (str) – deployment mode, one of ‘land’, ‘sea’, ‘air’, or ‘trajectory’. Default ‘land’.
use_local_files (str or None) – path to local directory where tsv files are stored. If “None”, read from online. Default None.
tag (str) – tagged release of definitions, or ‘latest’ to get most recent release. Ignored if use_local_files is not None. Default “latest”.
- Returns:
dictionary of all attributes, dimensions and variables associated with the named instrument.
- ncas_amof_netcdf_template.tsv2dict.list_all_products(use_local_files: Optional[str] = None, tag: str = 'latest')[source]
Return list of all available data products.
- Parameters:
use_local_files (str or None) – path to local directory where tsv files are stored. If “None”, read from online. Default None.
tag (str) – tagged release of definitions, or ‘latest’ to get most recent release. Ignored if use_local_files is not None. Default “latest”.
- ncas_amof_netcdf_template.tsv2dict.product_dict(desired_product: str, platform: str = '', deployment_loc: str = 'land', use_local_files: Optional[str] = None, tag: str = 'latest') dict[str, dict[str, Union[str, dict[str, dict[str, Union[str, float]]]]]][source]
Collect all variables, dimensions and attributes required for a data products and deployment mode.
- Parameters:
desired_product (str) – name of data product
platform (str) – location or observatory of instrument
deployment_loc (str) – deployment mode, one of ‘land’, ‘sea’, ‘air’, or ‘trajectory’. Default ‘land’.
use_local_files (str or None) – path to local directory where tsv files are stored. If “None”, read from online. Default None.
tag (str) – tagged release of definitions, or ‘latest’ to get most recent release. Ignored if use_local_files is not None. Default “latest”.
- Returns:
dictionary of all attributes, dimensions and variables associated with the named data product.
- ncas_amof_netcdf_template.tsv2dict.tsv2dict_attrs(tsv_file: str) dict[str, dict[str, str]][source]
For a given tsv file from https://github.com/ncasuk/AMF_CVs/tree/main/product-definitions/tsv for data global attributes, return dictionary of attributes and associated values and info.
- Parameters:
tsv_file (str) – URL to location of tsv file
- Returns:
dictionary of global attributes and associated values and info
- ncas_amof_netcdf_template.tsv2dict.tsv2dict_dims(tsv_file: str) dict[str, dict[str, str]][source]
For a given tsv file from https://github.com/ncasuk/AMF_CVs/tree/main/product-definitions/tsv for data dimensions, return dictionary of dimensions and additional info.
- Parameters:
tsv_file (str) – URL to location of tsv file
- Returns:
dictionary of dimensions and info
- ncas_amof_netcdf_template.tsv2dict.tsv2dict_instruments(tsv_file: str) dict[str, dict[str, str]][source]
For a given tsv file from https://github.com/ncasuk/AMF_CVs/tree/main/product-definitions/tsv for ncas- or community-instruments, return dictionary of instruments and associated information.
- Parameters:
tsv_file (str) – URL to location of tsv file
- Returns:
dictionary of instruments and associated information
- ncas_amof_netcdf_template.tsv2dict.tsv2dict_vars(tsv_file: str) dict[str, dict[str, Union[str, float]]][source]
For a given tsv file from https://github.com/ncasuk/AMF_CVs/tree/main/product-definitions/tsv for data variables, return dictionary of variables and their attributes.
- Parameters:
tsv_file (str) – URL to location of tsv file
- Returns:
dictionary of variables and attributes