bufr2synop 0.24.0
|
file with the utility routines for binary bufr2tac More...
#include "bufr2tac.h"
Go to the source code of this file.
Functions | |
unsigned int | three_bytes_to_uint (const unsigned char *source) |
returns the integer value from an array of three bytes, most significant first More... | |
int | integer_to_descriptor (struct bufr_descriptor *d, int id) |
parse an integer with a descriptor fom bufr ECWMF libary More... | |
int | descriptor_to_integer (int *id, struct bufr_descriptor *d) |
parse a descriptor and sets an integer in the decimal formas fxxyyy More... | |
uint32_t | get_flag_value (uint8_t width, uint8_t index) |
char * | charray_to_string (char *s, unsigned char *buf, size_t size) |
get a null termitated c-string from an array of unsigned chars More... | |
char * | adjust_string (char *s) |
Supress trailing blanks of a string. More... | |
size_t | tokenize_string (char *tk[], size_t ntk, char *target, size_t len, char *blanks) |
Split the report string into tokens. More... | |
int | YYYYMMDDHHmm_to_met_datetime (struct met_datetime *t, const char *source) |
Parse the string YYYYMMDDHHmm[ss] and set a struct met_datetime. More... | |
char * | met_datetime_to_YYGG (char *target, struct met_datetime *t) |
Get YYGG from a struct met_datetime. More... | |
int | round_met_datetime_to_hour (struct met_datetime *target, struct met_datetime *source) |
char * | guess_WMO_region (char *A1, char *Reg, const char *II, const char *iii) |
get WMO region A1 and Reg items from II and iii (WMO index) More... | |
int | check_date_from_future (struct metreport *m) |
Check a estructure metreport not from future. More... | |
int | guess_gts_header (struct gts_header *h, const char *f) |
Guess the WMO GTS header from filename. More... | |
file with the utility routines for binary bufr2tac
Definition in file bufr2tac_utils.c.
char * adjust_string | ( | char * | s | ) |
Supress trailing blanks of a string.
s | string to process |
Definition at line 99 of file bufr2tac_utils.c.
Referenced by buoy_parse_x01(), climat_parse_x01(), syn_parse_x01(), and temp_parse_x01().
char * charray_to_string | ( | char * | s, |
unsigned char * | buf, | ||
size_t | size | ||
) |
get a null termitated c-string from an array of unsigned chars
s | resulting string |
buf | pointer to first element in array |
size | number of chars in array |
Definition at line 85 of file bufr2tac_utils.c.
int check_date_from_future | ( | struct metreport * | m | ) |
Check a estructure metreport not from future.
m | pointer to a struct metreport to check about date and time |
It resturns 1 if date/time is from future, and likely wrong Returns 0 otherwise
Definition at line 292 of file bufr2tac_utils.c.
References metreport::t, and met_datetime::t.
Referenced by parse_subset_as_climat(), and parse_subset_as_synop().
int descriptor_to_integer | ( | int * | id, |
struct bufr_descriptor * | d | ||
) |
parse a descriptor and sets an integer in the decimal formas fxxyyy
id | pointer to target integer |
d | pointer to a struct bufr_descriptor with the source |
Definition at line 58 of file bufr2tac_utils.c.
References bufr_descriptor::f, bufr_descriptor::x, and bufr_descriptor::y.
Referenced by bufrtotac_parse_subset_sequence().
uint32_t get_flag_value | ( | uint8_t | width, |
uint8_t | index | ||
) |
Definition at line 66 of file bufr2tac_utils.c.
int guess_gts_header | ( | struct gts_header * | h, |
const char * | f | ||
) |
Guess the WMO GTS header from filename.
h | pointer to a struct gts_header where to set the results |
f | pathname of bufrfile |
It returns 1 if guessed, 0 otherwise
This routine assume the filename format of a bufr file is YYYYMMDDHHmmss_BULLNN_ICAO_YYGGgg_ORD.bufr where YYYYMMDDHHmmss is the timestamp (UTC) of the file in GTS (as example, in NOAA gateway) BULLNN is the bulletin identifier in GTS. It is a six chars lenght in the form T1 T2 A1 A2 N1 N2 For observations, T1 is 'I' Possible values of T2 for T1 = 'I' are O Oceanographic/limnographic (water properties) P Pictorial S Surface/sea level T Text (plain language information) U Upper air X Other data types Z Mixed data types For T1T2 = 'IS' Then A1: IS A 01–29 Routinely scheduled observations for n/a 000/006 distribution from automatic (fixed or mobile) land stations (e.g. 0000, 0100, … or 0220, 0240, 0300, …, or 0715, 0745, ... UTC) IS A 30–59 N-minute observations from automatic (fixed n/a 000/007 or mobile) land stations IS B Radar reports (parts A and B) RADOB 006/003 IS C 01–45 Climatic observations from land stations CLIMAT 000/020 IS C 46–59 Climatic observations from marine stations CLIMAT SHIP 001/0202009 edition ATTACHmENT II-5 I IS D Radiological observation RADREP 010/001 IS E Ozone measurement at surface n/a 008/000 IS F Source of atmospherics SFAZI, SFLOC, SFAZU 000/030 IS I 01–45 Intermediate synoptic observations from fixed SYNOP (SIxx) 000/001 land stations 000/051 IS I 46–59 Intermediate synoptic observations from mobile SYNOP mOBIL 000/004 land stations IS M 01–45 Main synoptic observations from fixed land SYNOP (SMxx) 000/002 stations 000/052 IS M 46–59 Main synoptic observations from mobile land SYNOP mOBIL 000/005 stations IS N 01–45 Synoptic observations from fixed land stations SYNOP (SNxx) 000/000 at non-standard time (i.e. 0100, 0200, 0400, 000/050 0500, ... UTC) IS N 46–59 Synoptic observations from mobile land stations SYNOP mOBIL 000/003 at non-standard time (i.e. 0100, 0200, 0400, 0500, ... UTC) IS R Hydrologic reports HYDRA 000/040 IS S 01–19 Synoptic observations from marine stations SHIP 001/000 IS S 20–39 One-hour observations from automatic marine n/a 001/006 stations IS S 40–59 N-minute observations from automatic marine n/a 001/007 stations IS T 01–19 Tide gauge observations n/a 001/030 IS T 20–39 Observed water level time series n/a 001/031 IS V Special aeronautical observations (SPECI) SPECI 000/011 IS W Aviation routine weather observations (mETAR) mETAR 000/010 IS X Other surface data IAC, IAC FLEET For T1T2 = 'IU' then A1: IU A Single level aircraft reports (automatic) AmDAR 004/000 IU A Single level aircraft reports (manual) AIREP/PIREP 004/001 IU B Single level balloon reports n/a IU C (used for single level satellite-derived SAREP/SATOB 005/000 reports – see Note 3) IU D Dropsonde/Dropwindsondes TEmP DROP 002/007 IU E Ozone vertical sounding n/a 008/001 IU I Dispersal and transport analysis n/a 009/000 IU J 01–19 Upper wind from fixed land stations (entire PILOT (parts A, 002/001 sounding) B, C, D) IU J 20–39 Upper wind from mobile land stations (entire PILOT mOBIL 002/003 sounding) (parts A, B, C, D) IU J 40–59 Upper wind from marine stations (entire PILOT SHIP 002/002 sounding) (parts A, B, C, D) IU K 01–19 Radio soundings from fixed land stations TEmP (parts A, B) 002/004 (up to 100 hPa) IU K 20–39 Radio soundings from mobile land stations TEmP mOBIL 002/006 (up to 100 hPa) (parts A, B) IU K 40–59 Radio soundings from marine stations TEmP SHIP (parts A, B) 002/005 (up to 100 hPa) IU M Model derived sondes IU N Rocketsondes IU O Profiles of aircraft observations in ascending/ AmDAR 002/020 descending IU P Profilers PILOT 002/010 IU Q RASS temperature profilers TEmP 002/011 IU R (used for radiance data – see Note 3) IU S 01–19 Radiosondes/pibal reports from fixed land TEmP (parts A, B, C, D) 002/004 stations (entire sounding) IU S 20–39 Radio soundings from mobile land stations TEmP mOBIL (parts A, 002/006 (entire sounding) B, C, D) IU S 40–59 Radio soundings from marine stations TEmP SHIP (parts A, 002/005 (entire sounding) B, C, D) IU T (used for satellite-derived sondes – see Note 3) SATEm, SARAD, SATOB IU U 01–45 Monthly statistics of data from upper-air stations CLImAT TEmP 002/025 IU U 46–59 Monthly statistics of data from marine stations CLImAT TEmP, SHIP 002/026 IU W 01–19 Upper wind from fixed land stations (up to PILOT (parts A, B) 002/001 100 hPa) IU W 20–39 Upper wind from mobile land stations (up to PILOT mOBIL 002/003 100 hPa) (parts A, B) IU W 40–59 Upper wind from marine stations (up to PILOT SHIP 002/002 100 hPa) (parts A, B) IU X Other upper-air reports for T1T2 = 'IO' then A1: IO B Buoy observations BUOY 001/025 IO I Sea ice IO P Sub-surface profiling floats TESAC 031/004 IO R Sea surface observations TRACKOB 031/001 IO S Sea surface and below soundings BATHY, TESAC 031/005 IO T Sea surface temperature IO W Sea surface waves WAVEOB 031/002 IO X Other sea environmental About A2 A 0 - 90W northern hemisphere B 90W - 180 northern hemisphere C 180 - 90E northern hemisphere D 90E - 0 northern hemisphere E 0 - 90W tropical belt F 90W - 180 tropical belt G 180 - 90E tropical belt H 90E - 0 tropical belt I 0 - 90W southern hemisphere J 90W - 180 southern hemisphere K 180 - 90E southern hemisphere L 90E - 0 southern hemisphere M Lower left 10S 100E/upper right 70N 110W N Northern hemisphere P Area between 64.69N - 136.76W, 55.61N - 13.43W 64.69N - 156.76W, 55.61N - 33.43W S Southern hemisphere T 45W - 180 northern hemisphere U Area between 21.0N - 128.1W, 36.0N - 130.9W 21.1N - 113.0W, 36.2N - 110.5W V Area between 30.3N - 83.7W, 51.0N - 68.9W 19.8N - 64.5W, 33.3N - 47.1W X Global Area (area not definable) ICAO is the ICAO index for release center. YYGGgg is the nominal release time (day, hour, minute) UTC ORD is the order sequence as RRA, RRB, CCA .... is optional
Definition at line 466 of file bufr2tac_utils.c.
References gts_header::bname, gts_header::center, gts_header::dtrel, gts_header::filename, gts_header::order, gts_header::timestamp, and tokenize_string().
Referenced by main().
char * guess_WMO_region | ( | char * | A1, |
char * | Reg, | ||
const char * | II, | ||
const char * | iii | ||
) |
get WMO region A1 and Reg items from II and iii (WMO index)
A1 | string woth resulting A1 |
Reg | string with resulting Reg |
II | WMO block number |
iii | WMO number |
Definition at line 211 of file bufr2tac_utils.c.
Referenced by guess_WMO_region_synop(), guess_WMO_region_temp(), and syn_parse_x01().
int integer_to_descriptor | ( | struct bufr_descriptor * | d, |
int | id | ||
) |
parse an integer with a descriptor fom bufr ECWMF libary
d | pointer to a struct bufr_descriptor where to set the result on output |
id | integer with the descriptor from ewcwf |
Definition at line 41 of file bufr2tac_utils.c.
References bufr_descriptor::c, bufr_descriptor::f, bufr_descriptor::x, and bufr_descriptor::y.
char * met_datetime_to_YYGG | ( | char * | target, |
struct met_datetime * | t | ||
) |
Get YYGG from a struct met_datetime.
target | string with result as output |
t | pointer to source struct met_datetime |
Definition at line 180 of file bufr2tac_utils.c.
References met_datetime::t.
Referenced by parse_subset_as_temp().
int round_met_datetime_to_hour | ( | struct met_datetime * | target, |
struct met_datetime * | source | ||
) |
Definition at line 194 of file bufr2tac_utils.c.
References met_datetime::datime, met_datetime::t, and met_datetime::tim.
Referenced by parse_subset_as_temp().
unsigned int three_bytes_to_uint | ( | const unsigned char * | source | ) |
returns the integer value from an array of three bytes, most significant first
Definition at line 30 of file bufr2tac_utils.c.
Referenced by read_bufr().
int tokenize_string | ( | char * | tk[], |
size_t | ntk, | ||
char * | target, | ||
size_t | len, | ||
char * | blanks | ||
) |
Split the report string into tokens.
tk | array of strings. Memory have to be allocated previously by caller |
ntk | max amount of elements in tk array. |
target | string which is the report to split |
len | lenght of target string |
blanks | string with the character considered as blanks. If null the default " =\n\r\v\t" is considered Returns the number of tokens target has been splitted into. Retuns 0 in case of a void or too large target. NOTE: target is changed after calling this routine. In fact, the pointers in tk[] are linking to some char in string target |
Definition at line 121 of file bufr2tac_utils.c.
Referenced by guess_gts_header().
int YYYYMMDDHHmm_to_met_datetime | ( | struct met_datetime * | t, |
const char * | source | ||
) |
Parse the string YYYYMMDDHHmm[ss] and set a struct met_datetime.
source | string with date in YYYYMMDDHHmm[ss] format |
t | pointer to a struct met_datetime where to set the results |
Definition at line 156 of file bufr2tac_utils.c.
References met_datetime::datime, met_datetime::t, and met_datetime::tim.
Referenced by parse_subset_as_buoy(), parse_subset_as_climat(), parse_subset_as_synop(), and parse_subset_as_temp().