grib_interface#

ioapps.grib_interface.cnvgribg21(in_grib_file, out_grib_file)[source]#

DESCRIPTION:

This function converts a GRIB-formatted version 2 file to a GRIB-formatted version 1 file.

Parameters:
in_grib_file: str

A Python string specifying the path to the input GRIB-formatted version 2 file.

out_grib_file: str

A Python string specifying the path to the output GRIB-formatted version 1 file.

Return type:

None

ioapps.grib_interface.get_timestamp(grib_file, grib_var=None)[source]#

DESCRIPTION:

This function parses a GRIB-formatted file and returns the unique time-stamp elements; if a variable name (grib_var) is specified, the unique time-stamp elements correspond only to those GRIB records corresponding to the respective variable.

Parameters:
grib_file: str

A Python string specifying the path to the GRIB-formatted file.

Returns:
timestamp_list: List

A Python list containing the unique time-stamp elements collected from the GRIB records.

Return type:

List

ioapps.grib_interface.grbindex(in_grib_file, out_gribidx_file, is_grib2=False)[source]#

DESCRIPTION:

This function generates a GRIB index file from an input GRIB-formatted (version 1 or 2) file.

Parameters:
in_grib_file: str

A Python string specifying the path to the GRIB-formatted (version 1 or 2) for which to generate the GRIB index file.

out_gribidx_file: str

A Python string specifying the path to the GRIB index file generated from the GRIB-formatted (version 1 or 2) input file.

Return type:

None

ioapps.grib_interface.parse_file(in_grib_file, parse_str, out_grib_file, is_grib2=False, tmp_out_path=None)[source]#

DESCRIPTION:

This function parses a GRIB-formatted (version 1 or 2) file and collects the user specified variables (parse_str) and defines/constructs a new GRIB-formatted (version 1 or 2) file; the new GRIB-formatted (version 1 or 2) file is a concatenated file created from individual files for each user specified GRIB variable and level; following concatenation, all temporary GRIB-formatted (version 1 or 2) files are removed.

Parameters:
in_grib_file: str

A Python string specifying the path to the GRIB-formatted (version 1 or 2) file to be parsed.

parse_str: str

A Python string specifying the GRIB variables to be collected to define the new GRIB-formatted (version 1 or 2) file.

out_grib_file: str

A Python string specifying the path to the GRIB-formatted (version 1 or 2) file concatenated from the temporary GRIB-formatted (version 1 or 2) files.

Return type:

None

ioapps.grib_interface.read_file(grib_file, is_4yr=True)[source]#

DESCRIPTION:

This function parses a GRIB-formatted file and returns the GRIB records within.

Parameters:
grib_file: str

A Python string specifying the path to the GRIB-formatted file.

Returns:
wgrib_out: List

A Python list containing the GRIB records from the parsed GRIB-formatted file.

Return type:

List

ioapps.grib_interface.wgrib2_remap(remap_obj, gribfile)[source]#

DESCRIPTION:

This function remaps the variables within the respective WMO GRIB version 2 formatted file to a grid projection specified by the user in the remap_obj parameter; the remapped file is named <gribfile>.remap.

Parameters:
remap_obj: object

A Python object containing the WMO GRIB version 2 formatted data remapping attributes; currently only ‘latlon’ remappings are supported.

gribfile: str

A Python string specifying the path to the WMO GRIB version 2 formatted file, containing the respective WMO GRIB version 2 formatted data, to be remapped.

Returns:
gribremap_file: str

A Python string specifying the path to the WMO GRIB version 2 formatted file containing the remapped data.

Return type:

str