95 if ( ( r = calloc ( 1,
sizeof (
struct temp_raw_data ) ) ) == NULL )
97 sprintf ( err,
"bufr2tac: parse_subset_as_temp(): Cannot allocate memory for raw data" );
103 sprintf ( err,
"bufr2tac: parse_subset_as_temp(): Cannot allocate memory for raw data" );
104 free ( (
void * ) ( r ) );
116 sprintf ( err,
"bufr2tac: parse_subset_as_temp(): '%s' reports still not decoded in this software", s->
type_report );
117 free ( (
void * ) ( r ) );
118 free ( (
void * ) ( w ) );
129 for ( is = 0; is < sq->nd; is++ )
132 s->
ival = ( int ) sq->sequence[is].val;
133 s->
val = sq->sequence[is].val;
134 s->
a = &sq->sequence[is];
137 s->
a1 = &sq->sequence[is - 1];
141 if ( sq->sequence[is].desc.x == 8 )
146 switch ( sq->sequence[is].desc.x )
151 free ( (
void * ) ( r ) );
152 free ( (
void * ) ( w ) );
160 free ( (
void * ) ( r ) );
161 free ( (
void * ) ( w ) );
169 free ( (
void * ) ( r ) );
170 free ( (
void * ) ( w ) );
178 free ( (
void * ) ( r ) );
179 free ( (
void * ) ( w ) );
187 free ( (
void * ) ( r ) );
188 free ( (
void * ) ( w ) );
196 free ( (
void * ) ( r ) );
197 free ( (
void * ) ( w ) );
205 free ( (
void * ) ( r ) );
206 free ( (
void * ) ( w ) );
214 free ( (
void * ) ( r ) );
215 free ( (
void * ) ( w ) );
223 free ( (
void * ) ( r ) );
224 free ( (
void * ) ( w ) );
232 free ( (
void * ) ( r ) );
233 free ( (
void * ) ( w ) );
241 free ( (
void * ) ( r ) );
242 free ( (
void * ) ( w ) );
250 free ( (
void * ) ( r ) );
251 free ( (
void * ) ( w ) );
259 free ( (
void * ) ( r ) );
260 free ( (
void * ) ( w ) );
280 sprintf ( err,
"bufr2tac: parse_subset_as_temp(): lack of mandatory descriptor in sequence" );
281 free ( (
void * ) ( r ) );
282 free ( (
void * ) ( w ) );
306 else if ( t->
a.
s1.
D_D[0] )
314 else if ( t->
a.
s1.
Ula[0] )
324 sprintf ( err,
"bufr2tac: parse_subset_as_temp(): Unknown type TEMP report" );
325 free ( (
void * ) ( r ) );
326 free ( (
void * ) ( w ) );
345 if ( strlen ( t->
a.
s1.
II ) )
350 else if ( strlen ( t->
a.
s1.
D_D ) )
354 else if ( strlen ( t->
a.
s1.
IIIII ) )
386 sprintf ( err,
"bufr2tac: parse_temp_raw_data(): Too much significant points" );
387 free ( (
void * ) ( r ) );
388 free ( (
void * ) ( w ) );
394 free ( (
void * ) ( r ) );
395 free ( (
void * ) ( w ) );
406 size_t i, j, isa = 0, isc = 0, ita = 0, itc = 0;
407 size_t iwxa = 0, iwxc = 0, itb = 0, itd = 0;
408 size_t iwd = 0, iwb = 0;
409 size_t isav = 0, iscv = 0;
412 if ( t == NULL || r == NULL )
425 for ( i = 0; i < r->
n; i++ )
429 if ( d->
p < 10000.0 )
450 ix = ( int ) ( d->
p * 0.01 + 0.5 );
451 ix = ( ix / 10 ) % 100;
454 sprintf ( t->
c.
s2.
std[isc].
PnPn,
"%02d", ix );
458 sprintf ( t->
a.
s2.
std[isa].
PnPn,
"%02d", ix );
461 ix = ( int ) ( d->
h + 0.5 );
462 if ( d->
p <= 50000.0 )
466 sprintf ( t->
c.
s2.
std[isc].
hnhnhn,
"%03d", ( ( ix + 5 ) / 10 ) % 1000 );
470 sprintf ( t->
a.
s2.
std[isa].
hnhnhn,
"%03d", ( ( ix + 5 ) / 10 ) % 1000 );
485 sprintf ( t->
a.
s2.
std[isa].
hnhnhn,
"%03d", ( -ix + 500 ) % 1000 );
545 ix = ( int ) ( d->
p * 0.1 + 0.5 );
560 ix = ( int ) ( d->
p * 0.01 + 0.5 );
580 ix = ( int ) ( d->
p * 0.1 + 0.5 );
584 for ( j = i + 1; j < r->
n ; j++ )
602 ix = ( int ) ( d->
p * 0.01 + 0.5 );
605 for ( j = i + 1; j < r->
n ; j++ )
628 sprintf ( t->
d.
s5.
th[itd].
nini,
"%d%d", ( (
int ) itd ) %9 + 1, ( (
int ) itd ) %9 + 1 );
629 ix = ( int ) ( d->
p * 0.1 + 0.5 );
649 sprintf ( t->
b.
s5.
th[itb].
nini,
"%d%d", ( (
int ) itb - 1 ) %9 + 1, ( (
int ) itb - 1 ) %9 + 1 );
651 ix = ( int ) ( d->
p * 0.01 + 0.5 );
652 sprintf ( t->
b.
s5.
th[itb].
PnPnPn,
"%03d", ix % 1000 );
670 sprintf ( t->
d.
s6.
wd[iwd].
nini,
"%d%d", ( (
int ) iwd ) %9 + 1, ( (
int ) iwd ) %9 + 1 );
671 ix = ( int ) ( d->
p * 0.1 + 0.5 );
691 sprintf ( t->
b.
s6.
wd[iwb].
nini,
"%d%d", ( (
int ) iwb - 1 ) %9 + 1, ( (
int ) iwb - 1 ) %9 + 1 );
693 ix = ( int ) ( d->
p * 0.01 + 0.5 );
694 sprintf ( t->
b.
s6.
wd[iwb].
PnPnPn,
"%03d", ix % 1000 );
765 if ( t == NULL || w == NULL )
775 for ( i = 0; i < w->
n; i++ )
779 if ( d->
p < 10000.0 )
791 if ( t ->c.s4.n == 0 )
796 ix = ( int ) ( d->
p * 0.1 + 0.5 );
797 sprintf ( aux,
"%03d", ix % 1000 );
800 for ( j = 0 ; j < t->
c.
s4.
n ; j++ )
818 if ( t ->a.s4.n == 0 )
822 ix = ( int ) ( d->
p * 0.01 + 0.5 );
823 sprintf ( aux,
"%03d", ix % 1000 );
825 for ( j = 0 ; j < t->
a.
s4.
n ; j++ )
Include header file for binary bufr2tac.
#define SUBSET_MASK_HAVE_MONTH
Bit mask to mark a struct bufr_subset_sequence_data having observation month.
char * met_datetime_to_YYGG(char *target, struct met_datetime *t)
Get YYGG from a struct met_datetime.
int temp_parse_x33(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 33.
#define SUBSET_MASK_HAVE_COUNTRY
Bit mask to mark a struct bufr_subset_sequence_data having country name.
char * dewpoint_depression_to_DnDn(char *target, double T, double Td)
Set DnDn (dewpoint depression)
void bufr2tac_clean_temp_chunks(struct temp_chunks *t)
cleans a buoy_chunks struct
int temp_parse_x11(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 11.
int temp_parse_x05(struct temp_chunks *t, struct bufr2tac_subset_state *s)
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)
#define SUBSET_MASK_HAVE_MINUTE
Bit mask to mark a struct bufr_subset_sequence_data having observation minute.
char * kelvin_to_TTTa(char *target, double T)
Set temperature TTTa.
#define SUBSET_MASK_HAVE_NAME
Bit mask to mark a struct bufr_subset_sequence_data having station name.
#define bufr_subset_sequence_data
To use bufrdeco library with legacy old code using ECMWF library which is not used currently.
char * wind_to_dndnfnfnfn(char *target, double dd, double ff)
char * pascal_to_pnpnpn(char *target, double P)
#define SUBSET_MASK_HAVE_ALTITUDE
Bit mask to mark a struct bufr_subset_sequence_data having altitude.
int temp_parse_x07(struct temp_chunks *t, struct bufr2tac_subset_state *s)
int temp_parse_x04(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 04.
int temp_parse_x20(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 20.
int temp_parse_x12(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 12.
#define SUBSET_MASK_HAVE_YEAR
Bit mask to mark a struct bufr_subset_sequence_data having observation year.
int YYYYMMDDHHmm_to_met_datetime(struct met_datetime *t, const char *source)
Parse the string YYYYMMDDHHmm[ss] and set a struct met_datetime.
int temp_parse_x31(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 31.
int round_met_datetime_to_hour(struct met_datetime *target, struct met_datetime *source)
int temp_parse_x01(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 01.
int temp_parse_x22(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 22.
int temp_parse_x02(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 02.
#define SUBSET_MASK_HAVE_LONGITUDE
Bit mask to mark a struct bufr_subset_sequence_data having longitude.
int temp_parse_x06(struct temp_chunks *t, struct bufr2tac_subset_state *s)
#define SUBSET_MASK_HAVE_LATITUDE
Bit mask to mark a struct bufr_subset_sequence_data having latitude.
int temp_parse_x08(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 08.
int temp_parse_x10(struct temp_chunks *t, struct bufr2tac_subset_state *s)
Parse a expanded descriptor with X = 10.
#define SUBSET_MASK_HAVE_DAY
Bit mask to mark a struct bufr_subset_sequence_data having observation day in a month.
#define SUBSET_MASK_HAVE_HOUR
Bit mask to mark a struct bufr_subset_sequence_data having observation hour.
int parse_temp_raw_data(struct temp_chunks *t, struct temp_raw_data *r)
parse a struct temp_raw_data to fill chunks in a struct temp_chunks
int parse_subset_as_temp(struct metreport *m, struct bufr2tac_subset_state *s, struct bufr_subset_sequence_data *sq, char *err)
int parse_temp_raw_wind_shear_data(struct temp_chunks *t, struct temp_raw_wind_shear_data *w)
char * guess_WMO_region_temp(struct temp_chunks *t)
#define MISSING_REAL
The missing default value for real values.
#define TEMP_POINT_MASK_SIGNIFICANT_TEMPERATURE_LEVEL
#define TEMP_SEC_6
mask bit meaning sec 6 of a part of TEMP report parsed with success
#define TEMP_NTROP_MAX
Maximum number of standard levels in any part of a TEMP report.
#define TEMP_POINT_MASK_MAXIMUM_WIND_LEVEL
#define TEMP_SEC_4
mask bit meaning sec 4 of a part of TEMP report parsed with success
#define TEMP_SEC_5
mask bit meaning sec 5 of a part of TEMP report parsed with success
#define TEMP_POINT_MASK_TROPOPAUSE_LEVEL
#define TEMP_SEC_2
mask bit meaning sec 2 of a part of TEMP report parsed with success
#define TEMP_POINT_MASK_SIGNIFICANT_WIND_LEVEL
#define TEMP_POINT_MASK_SURFACE
#define TEMP_NMAX_POINTS
maximum number of significant points
#define TEMP_POINT_MASK_SIGNIFICANT_HUMIDITY_LEVEL
#define TEMP_SEC_3
mask bit meaning sec 3 of a part of TEMP report parsed with success
#define TEMP_NSTAND_MAX
Maximum number of standard levels in any part of a TEMP report.
#define TEMP_NMAXWIND_MAX
Maximum number of mwx wind level in any part of a TEMP report.
#define TEMP_POINT_MASK_STANDARD_LEVEL
stores information needed to parse a sequential list of expanded descriptors for a subset
struct temp_raw_wind_shear_data * w
struct bufr_atom_data * a1
struct bufr_atom_data * a
stores date and time reference of a report, commonly the observation time
all the information for a meteorological report in WMO text format from a BUFR file
struct temp_main_level_data lev0
struct temp_std_level_data std[TEMP_NSTAND_MAX]
struct temp_main_level_data trop[TEMP_NTROP_MAX]
struct temp_max_wind_data windx[TEMP_NMAXWIND_MAX]
struct temp_th_point th[TEMP_NMAX_POINTS]
struct temp_wind_point wd[TEMP_NMAX_POINTS]
struct temp_std_level_data std[TEMP_NSTAND_MAX]
Store the whole TEMP report.
Stores the array of all data profile points as it in bufr sequence.
struct temp_raw_point_data raw[TEMP_NMAX_POINTS *4]
Stores data of a sounding profile in raw format, as given in bufr.
array of Wind shear data points at a pressure level
struct temp_raw_wind_shear_point raw[TEMP_NMAX_POINTS]
Wind shear data point at a pressure level.
WIGOS station identifier.