g2ccsv.c(3)
β¨ g2ccsv.c(3) β¨
okay bestie, welcome to the Library Functions Manual π this is the page for g2ccsv.c and it's literally the girl who reads the GRIB2 CSV files for you. no cap. she's part of NCEPLIBS-g2c and she's serving tables. π
πΈ NAME πΈ
g2ccsv.c β This file reads the GRIB2 CSV files.
π¦ SYNOPSIS π¦
#include 'grib2_int.h'
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
π Functions
int g2c_csv_init()β Initialize tables from CodeFlag.txt". (yes the quote is staying exactly like that, i don't make the rules π )static char * g2c_csv_strsep(char **stringp, const char *delim)β Implementation of strsep for code portability.int g2c_find_desc(char *title, int code, char *desc)β Given a table title and an integer code, find a description.int g2c_find_desc_str(char *title, char *code, char *desc)β Given a table title and a code, find a description.G2C_CODE_ENTRY_T * g2c_find_entry(char *desc, G2C_CODE_TABLE_T *table)β Find an entry in a table given a description.G2C_CODE_TABLE_T * g2c_find_table(char *key)β Find a table given a key.void g2c_free_tables()β Free table memory.void g2c_print_tables()β Print the table data.
π Variables
FILE * docβ Contains the parsed CSV document.G2C_CODE_TABLE_T * g2c_table = NULLβ Pointer to the list of code tables.
π Detailed Description π
This file reads the GRIB2 CSV files. that's the whole vibe, and honestly? iconic. π₯
Author
Ed Hartnett
Date
8/25/22
Definition in file g2ccsv.c.
π Function Documentation π
β¨ int g2c_csv_init() β¨
Initialize tables from "CodeFlag.txt".
Returns
G2C_NOERRORNo error.
Author
Alyson Stahl
Date
8/2/24
Definition at line 215 of file g2ccsv.c.
References doc, g2c_csv_strsep(), G2C_ECSV, G2C_ENAMETOOLONG, G2C_ENOMEM, g2c_find_table(), G2C_MAX_GRIB_CODE_LEN, G2C_MAX_GRIB_DESC_LEN, G2C_MAX_GRIB_LEVEL_DESC_LEN, G2C_MAX_GRIB_STATUS_LEN, G2C_MAX_GRIB_TITLE_LEN, G2C_NOERROR, and g2c_table.
Referenced by g2c_log_file(), and g2c_log_section1().
β¨ char * g2c_csv_strsep(char ** stringp, const char * delim) [static] β¨
Implementation of strsep for code portability. Extracts first token in string given a delimiter.
Parameters
- stringp β The address of a pointer to string to be separated. This value is overwritten with the value past the delimiter.
- delim β Characters that delimit the tokens.
Author
Alyson Stahl
Date
11/6/24
Returns
a pointer to the original value of stringp
Definition at line 192 of file g2ccsv.c.
Referenced by g2c_csv_init().
β¨ int g2c_find_desc(char * title, int code, char * desc) β¨
Given a table title and an integer code, find a description.
Parameters
- title β Title of table.
- code β Code to search for as an int.
- desc β Pointer that gets a copy of the description. Must be allocated to
G2C_MAX_GRIB_DESC_LEN + 1.
Author
Ed Hartnett
Date
8/28/22
Returns
0 for success, error code otherwise.
Definition at line 131 of file g2ccsv.c.
References g2c_find_desc_str(), and G2C_MAX_GRIB_CODE_LEN.
Referenced by g2c_log_section1().
β¨ int g2c_find_desc_str(char * title, char * code, char * desc) β¨
Given a table title and a code, find a description.
Parameters
- title β Title of table.
- code β Code to search for.
- desc β Pointer that gets a copy of the description. Must be allocated to
G2C_MAX_GRIB_DESC_LEN + 1.
Author
Ed Hartnett
Date
8/28/22
Returns
0 for success, error code otherwise.
Definition at line 84 of file g2ccsv.c.
References G2C_EINVAL, G2C_ENOTFOUND, G2C_MAX_GRIB_CODE_LEN, G2C_MAX_GRIB_TITLE_LEN, G2C_NOERROR, and g2c_table.
Referenced by g2c_find_desc().
β¨ G2C_CODE_ENTRY_T * g2c_find_entry(char * desc, G2C_CODE_TABLE_T * table) β¨
Find an entry in a table given a description.
Parameters
- desc β The description of the entry to find.
- table β A pointer to the table to search.
Author
Ed Hartnett
Date
8/29/22
Returns
a pointer to the matching entry, or NULL if not found.
Definition at line 169 of file g2ccsv.c.
References G2C_MAX_GRIB_DESC_LEN.
β¨ G2C_CODE_TABLE_T * g2c_find_table(char * key) β¨
Find a table given a key.
Parameters
- key β The table title to find.
Author
Ed Hartnett
Date
8/28/22
Returns
a pointer to the matching code table, or NULL if not found.
Definition at line 148 of file g2ccsv.c.
References G2C_MAX_GRIB_TITLE_LEN, and g2c_table.
Referenced by g2c_csv_init().
β¨ void g2c_free_tables() β¨
Free table memory. be free bestie π¦
Author
Ed Hartnett
Date
8/28/22
Definition at line 42 of file g2ccsv.c.
References g2c_table.
Referenced by g2c_log_file().
β¨ void g2c_print_tables() β¨
Print the table data.
Author
Ed Hartnett
Date
8/28/22
Definition at line 23 of file g2ccsv.c.
References g2c_table.
π§ Variable Documentation π§
β¨ FILE* doc β¨
Contains the parsed CSV document.
Definition at line 13 of file g2ccsv.c.
Referenced by g2c_csv_init().
β¨ G2C_CODE_TABLE_T* g2c_table = NULL β¨
Pointer to the list of code tables.
Definition at line 16 of file g2ccsv.c.
Referenced by g2c_csv_init(), g2c_find_desc_str(), g2c_find_table(), g2c_free_tables(), g2c_log_file(), and g2c_print_tables().
π Author π
Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.
and that's the whole page, no notes π she was Version 2.3.0 of NCEPLIBS-g2c, and that's the tea bestie, 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