48 sprintf ( target,
"%s%c%03d%05d%05d%03d%03d.TXT", bufrtables_dir, type, ksec1[13], ksec1[15], ksec1[2], ksec1[14], ksec1[7] );
50 sprintf ( target,
"%s%c000%05d00000%03d%03d.TXT", bufrtables_dir, type, ksec1[15], ksec1[14], ksec1[7] );
55 sprintf ( target,
"%s%c0000000000000019000.TXT", bufrtables_dir, type );
74 if ( ( t = fopen ( file,
"r" ) ) == NULL )
76 fprintf ( stderr,
"Unable to open table C file '%s'\n", file );
83 if ( ( c = strrchr ( tablec[i],
'\n' ) ) != NULL )
110 for ( i = 0; i < nlines_tablec; i++ )
112 if ( tablec[i][0] != d->
c[0] ||
113 tablec[i][1] != d->
c[1] ||
114 tablec[i][2] != d->
c[2] ||
115 tablec[i][3] != d->
c[3] ||
116 tablec[i][4] != d->
c[4] ||
117 tablec[i][5] != d->
c[5] )
123 if ( i == nlines_tablec )
131 if ( tablec[i][7] !=
' ' )
132 nv = strtol ( &tablec[i][7], &c, 10 );
137 for ( j = 0; ( long ) j < nv && i < nlines_tablec ; i++ )
139 if ( tablec[i][12] !=
' ' )
141 v = strtol ( &tablec[i][12], &c, 10 );
149 if ( (
long ) j == nv || i == nlines_tablec )
153 nl = strtol ( &tablec[i][21], &c, 10 );
157 strcpy ( expl, &tablec[i][24] );
160 for ( nv = 1 ; nv < nl; nv++ )
161 if ( ( strlen ( expl ) + strlen ( &tablec[i + nv][22] ) ) < dim )
162 strcat ( expl, &tablec[i + nv][22] );
184 unsigned long test, test0;
185 unsigned long nb, nx, v, nl;
189 for ( i = 0; i < nlines_tablec; i++ )
191 if ( tablec[i][0] != d->
c[0] ||
192 tablec[i][1] != d->
c[1] ||
193 tablec[i][2] != d->
c[2] ||
194 tablec[i][3] != d->
c[3] ||
195 tablec[i][4] != d->
c[4] ||
196 tablec[i][5] != d->
c[5] )
202 if ( i == nlines_tablec )
210 if ( tablec[i][7] !=
' ' )
211 nb = strtol ( &tablec[i][7], &c, 10 );
219 for ( j = 0, test0 = 2; j < nb && i < nlines_tablec ; i++ )
221 if ( tablec[i][12] !=
' ' )
223 v = strtol ( &tablec[i][12], &c, 10 );
232 nl = strtol ( &tablec[i][21], &c, 10 );
233 if ( strlen ( expl ) && ( strlen ( expl ) + 1 ) < dim )
234 s += sprintf ( s,
"|" );
235 s += sprintf ( s,
"%s", &tablec[i][24] );
238 for ( nx = 1 ; nx < nl; nx++ )
239 if ( ( strlen ( expl ) + strlen ( &tablec[i + nx][22] ) ) < dim )
241 s += sprintf ( s,
"%s", &tablec[i + nx][22] );
248 test = test0 << ( nb - v );
250 if ( v && ( test & ival ) != 0 )
254 nl = strtol ( &tablec[i][21], &c, 10 );
255 if ( strlen ( expl ) && ( strlen ( expl ) + 1 ) < dim )
256 s += sprintf ( s,
"|" );
257 s += sprintf ( s,
"%s", &tablec[i][24] );
260 for ( nx = 1 ; nx < nl; nx++ )
261 if ( ( strlen ( expl ) + strlen ( &tablec[i + nx][22] ) ) < dim )
263 s += sprintf ( s,
"%s", &tablec[i + nx][22] );
Include header file for binary bufr2tac.
char * get_ecmwf_tablename(char *target, char type, char *bufrtables_dir, int ksec1[40])
Get the complete pathname of a table file needed by a bufr message.
char * get_explained_flag_val(char *expl, size_t dim, char tablec[MAXLINES_TABLEC][92], size_t nlines_tablec, struct bufr_descriptor *d, unsigned long ival)
int read_table_c(char tablec[MAXLINES_TABLEC][92], size_t *nlines_tablec, char *bufrtables_dir, int ksec1[40])
char * get_explained_table_val(char *expl, size_t dim, char tablec[MAXLINES_TABLEC][92], size_t nlines_tablec, struct bufr_descriptor *d, int ival)
#define MAXLINES_TABLEC
The maximum expected lines in a Table C file, legacy def used from ECMWF.