g2cdegrib2.c(3)
π g2cdegrib2.c π
okay bestie, welcome to the g2cdegrib2.c(3) page from the Library Functions Manual β¨ it's short, it's sweet, it's literally just "write a summary output to a file," but we're gonna do it thoroughly π«Ά
β¨ NAME β¨
g2cdegrib2.c β Write summary output to a file, as is done by utility grb2index. π
that's it, that's the whole assignment.
β¨ SYNOPSIS β¨
#include 'grib2_int.h'
#include <math.h>
#include <stdarg.h>
π Macros
#define G2C_DATE_TIME_LEN 25β Size of the date/time string.#define G2C_MAX_TYPE_OF_FIXED_SURFACE_LEN 40β Maximum length of Typeoffirstfixedsurface"string.
π Functions
static int format_level (char *cbuf, int ival, int scale)β Format the level string for degrib2 output.int g2c_degrib2 (int g2cid, const char *fileout)β Write a summary file like the degrib2 utility.int g2c_get_datetime (int ipdtn, long long int *ipdtmpl, short year, unsigned char month, unsigned char day, unsigned char hour, unsigned char minute, unsigned char second, char *tabbrev)β Convert date and time from GRIB2 info to string output.int g2c_get_level_desc (int ipdtn, long long int *ipdtmpl, char *level_desc)β Determine the string that describes the level information, given the GRIB2 Product Definition Template information.
π Variables
G2C_FILE_INFO_T g2c_file [G2C_MAX_FILES+1]β Global file information.G2C_CODE_TABLE_T * g2c_tableβ Pointer to the list of code tables.
β¨ Detailed Description β¨
Write summary output to a file, as is done by utility grb2index.
Author Ed Hartnett
Date Sep 17, 2022
Definition in file g2cdegrib2.c.
β¨ Macro Definition Documentation β¨
πΈ #define G2C_DATE_TIME_LEN 25
Size of the date/time string. lowkey self-explanatory but okay π
Definition at line 21 of file g2cdegrib2.c.
Referenced by g2c_get_datetime().
πΈ #define G2C_MAX_TYPE_OF_FIXED_SURFACE_LEN 40
Maximum length of "Type of first fixed surface" string.
Definition at line 19 of file g2cdegrib2.c.
Referenced by g2c_degrib2().
β¨ Function Documentation β¨
π¦ int format_level (char * cbuf, int ival, int scale) [static]
Format the level string for degrib2 output. it's giving "make the number pretty" energy β¨
Parameters
cbufβ Character buffer of length 11 which will get the formatted level description.ivalβ Integer value which may need scaling.scaleβ Scaling factor information.
Returns
G2C_NOERRORβ No error.
Author Ed Hartnett
Date 11/16/22
Definition at line 254 of file g2cdegrib2.c.
References G2C_NOERROR.
Referenced by g2c_get_level_desc().
π¦ int g2c_degrib2 (int g2cid, const char * fileout)
Write a summary file like the degrib2 utility. this is the main character of the whole page fr fr π
Parameters
g2cidβ Indentifier for the file, returned byg2c_open()org2c_create().fileoutβ Path of output file. Any existing file of this name will be overwritten.
π¨ bestie heads up: if a file already exists at fileout, it's getting overwritten. no take-backsies.
Returns
G2C_NOERRORβ No error.G2C_EINVALβ Invalid parameters.G2C_EFILEβ File I/O error.
Author Ed Hartnett
Date Sep 17, 2022
Definition at line 634 of file g2cdegrib2.c.
References g2c_message_info::bytes_in_msg, g2c_message_info::bytes_to_msg, g2c_message_info::center, g2c_section5_info::data_def, g2c_message_info::day, g2c_message_info::discipline, G2C_EBADID, G2C_EFILE, G2C_EINVAL, G2C_ENOSECTION, G2C_ERROR, g2c_file, g2c_get_datetime(), g2c_get_level_desc(), g2c_get_prod(), G2C_MAX_FILES, G2C_MAX_NOAA_ABBREV_LEN, G2C_MAX_TYPE_OF_FIXED_SURFACE_LEN, G2C_NOERROR, g2c_param_abbrev(), g2c_section3_info::grid_def, g2c_message_info::hour, g2c_section6_info::indicator, g2c_section3_info::interp_list, g2c_message_info::local_version, LOG, g2c_message_info::master_version, g2c_message_info::minute, g2c_message_info::month, g2c_section_info::msg, g2c_message_info::msg_num, g2c_message_info::next, g2c_section_info::next, g2c_section4_info::num_coord, g2c_section3_info::num_data_points, g2c_section5_info::num_data_points, g2c_message_info::num_fields, g2c_message_info::num_local, g2c_section3_info::num_opt, g2c_section3_info::optional, g2c_section_info::prev, g2c_section4_info::prod_def, g2c_message_info::sec, g2c_section_info::sec_info, g2c_section_info::sec_len, g2c_section_info::sec_num, g2c_message_info::second, g2c_message_info::sig_ref_time, g2c_section3_info::source_grid_def, g2c_message_info::status, g2c_message_info::subcenter, g2c_section_info::template, g2c_section_info::template_len, g2c_message_info::type, and g2c_message_info::year.
Referenced by main().
π¦ int g2c_get_datetime (int ipdtn, long long int * ipdtmpl, short year, unsigned char month, unsigned char day, unsigned char hour, unsigned char minute, unsigned char second, char * tabbrev)
Convert date and time from GRIB2 info to string output. πβ¨
π Note: This function is based on the prvtime() function in NCEPLIBS-grib_utils.
Parameters
ipdtnβ Product Definition Template Number (Code Table 4.0 βhttps://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-0.shtml).ipdtmplβ Array of data values for the Product Definition Template specified byipdtn.yearβ yearmonthβ monthdayβ dayhourβ hourminuteβ minutesecondβ secondtabbrevβ Character array that will get the date and time string. Must be of length 100.
Returns
G2C_NOERRORβ No error.
Author Ed Hartnett
Date Sep 28, 2022
Definition at line 49 of file g2cdegrib2.c.
References G2C_DATE_TIME_LEN, and G2C_NOERROR.
Referenced by g2c_degrib2().
π¦ int g2c_get_level_desc (int ipdtn, long long int * ipdtmpl, char * level_desc)
Determine the string that describes the level information, given the GRIB2 Product Definition Template information. This subroutine finds the "Type of first fixed surface" (see Code table 4.5 β https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-0.shtml) using the product definition template value and product template array. The location in the template array varies depending on the template number. π§ lowkey the sneaky part of the whole file ngl
Parameters
ipdtnβ Product Definition Template Number (Code Table 4.0 βhttps://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-0.shtml).ipdtmplβ Array of data values for the Product Definition Template specified byipdtn.level_descβ Character array which gets the string describing the level. Must be of length 40.
Returns
G2C_NOERRORβ No error.
Author Ed Hartnett
Date Sep 28, 2022
Definition at line 309 of file g2cdegrib2.c.
References format_level(), and G2C_NOERROR.
Referenced by g2c_degrib2().
β¨ Variable Documentation β¨
π§ G2C_FILE_INFO_T g2c_file[G2C_MAX_FILES+1] [extern]
Global file information.
Definition at line 10 of file g2cfile.c.
π§ G2C_CODE_TABLE_T* g2c_table [extern]
Pointer to the list of code tables.
Definition at line 16 of file g2ccsv.c.
β¨ Author β¨
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code. π€β¨
and that's the whole page bestie!! π tysm for reading, you ate that. this one came from NCEPLIBS-g2c, Version 2.3.0, and the footer date on the original was g2cdegrib2.c(3) β periodt. π
π¦π
π¦ where this page comes from
- ubuntu resolute: libg2c-dev 2.3.0-4 Β· LGPL-3.0-only
- ubuntu stonking: libg2c-dev 2.3.0-7 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms