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.
- in_grib_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.
- grib_file:
- Keywords:
- grib_var:
str, optional A Python string specifying the variable name for which to retrive time-stamp elements.
- grib_var:
- Returns:
- timestamp_list:
List A Python list containing the unique time-stamp elements collected from the GRIB records.
- timestamp_list:
- 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.
- in_grib_file:
- Keywords:
- is_grib2:
bool, optional A Python boolean valued variable specifying whether to generate the index file using GRIB version 2 index file application.
- is_grib2:
- 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.
- in_grib_file:
- Keywords:
- is_grib2:
bool, optional A Python boolean valued variable specifying whether to parse the respective input GRIB-formatted version 2 file using the wgrib2 applications.
- tmp_out_path:
str, optional A Python string specifying the path to the output GRIB-formatted (version 1 or 2) file; if not specified, the output file will be written to the directory in which this function was called.
- is_grib2:
- 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.
- grib_file:
- Keywords:
- is_4yr:
bool, optional A Python boolean valued variables specifying whether to format the respective GRIB record time-stamps using a 4-digit year value.
- is_4yr:
- Returns:
- wgrib_out:
List A Python list containing the GRIB records from the parsed GRIB-formatted file.
- wgrib_out:
- 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.
- remap_obj:
- Returns:
- gribremap_file:
str A Python string specifying the path to the WMO GRIB version 2 formatted file containing the remapped data.
- gribremap_file:
- Return type:
str