ncas_amof_netcdf_template.util

Reasonably helpful functions that can be often used.

Functions

add_metadata_from_dict(ncfile, metadata_dict)

Take metadata from dictionary and add to global attributes in netCDF file.

add_metadata_to_netcdf(ncfile[, ...])

Reads metadata from csv file using get_metadata, adds values to global attributes in netCDF file.

change_qc_flags(ncfile, ncfile_varname[, ...])

Change the flag meanings and flag values in a quality control variable from the default options.

check_float(value)

Returns True if value can be converted to float, otherwise returns False.

check_int(value)

Returns True if value can be converted to integer, otherwise returns False.

check_type_convert(value, dtype)

Returns True if value can be converted to type dtype, otherwise returns False.

get_metadata(metafile[, file_format])

Returns a dict from of metadata from file.

get_times(dt_times)

Returns all time units for AMOF netCDF files from series of datetime objects.

read_csv_metadata(metafile)

Returns a dict from a csv with metadata.

read_json_metadata(metafile)

Returns a dict from a JSON with metadata.

read_xml_metadata(metafile)

Returns a dict from a XML with metadata.

read_yaml_metadata(metafile)

Returns a dict from a YAML with metadata.

update_variable(ncfile, ncfile_varname, data)

Adds data to variable, and updates valid_min and valid_max

zero_pad_number(n)

Returns single digit number n as '0n' Returns multiple digit number n as 'n' Used for date or month strings