コード例 #1
0
ファイル: bufrdeco_wmo.c プロジェクト: gbvalor/bufr2synop
/*!
  \fn int bufr_read_tables_wmo (struct bufrdeco *b)
  \brief Read the tables according with bufr file data from a bufr table directory
  \param b basic struct with needed data

  The default directories where to search bufr tables are stored in \ref DEFAULT_BUFRTABLES_WMO_CSV_DIR1 and \ref DEFAULT_BUFRTABLES_WMO_CSV_DIR2
*/
int bufr_read_tables_wmo ( struct bufrdeco *b )
{

  // get tablenames
  if ( get_wmo_tablenames ( b ) )
    {
      sprintf ( b->error, "bufrdeco_read_tables_ecmwf(): Cannot find bufr tables\n" );
      return 1;
    }

  // If tables still not initialized then do it
  if ( b->tables == NULL && bufrdeco_init_tables ( & ( b->tables ) ) )
    {
      sprintf ( b->error, "bufrdeco_read_tables_ecmwf(): Cannot allocate memory for tables\n" );
      return 1;
    }

  // And now read tables
  if ( bufr_read_tableb_csv ( & ( b->tables->b ), b->error ) )
    {
      return 1;
    }

  if ( bufr_read_tablec_csv ( & ( b->tables->c ), b->error ) )
    {
      return 1;
    }

  if ( bufr_read_tabled_csv ( & ( b->tables->d ), b->error ) )
    {
      return 1;
    }
  return 0;
}
コード例 #2
0
ファイル: bufrdeco_read.c プロジェクト: ilblog/bufr2synop
/*!
  \fn int bufr_read_tables(struct bufrdeco *b, char *tables_dir)
  \brief Read the tables according with bufr file data from a bufr table directory
  \param b basic struct with needed data
  \param tables_dir complete path string for directory with ECMWF bufr tables. Must be ended with a '/' . If NULL then is the default

  The default directories where to search bufr tables are stored in \ref DEFAULT_BUFRTABLES_DIR1 and \ref DEFAULT_BUFRTABLES_DIR2
*/
int bufr_read_tables ( struct bufrdeco *b, char *tables_dir )
{

  // get tablenames
  if ( get_ecmwf_tablenames ( b, tables_dir ) )
    {
      sprintf ( b->error, "bufrdeco_read_bufr(): Cannot find bufr tebles\n" );
      return 1;
    }

  // If tables still not initialized then do it
  if ( b->tables == NULL && bufrdeco_init_tables ( & ( b->tables ) ) )
    {
      sprintf ( b->error, "bufrdeco_read_bufr(): Cannot allocate memory for tables\n" );
      return 1;
    }

  // And now read tables
  if ( bufr_read_tableb ( & ( b->tables->b ), b->error ) )
    {
      return 1;
    }
  if ( bufr_read_tablec ( & ( b->tables->c ), b->error ) )
    {
      return 1;
    }
  if ( bufr_read_tabled ( & ( b->tables->d ), b->error ) )
    {
      return 1;
    }
  return 0;
}