dtcenter / MET

Model Evaluation Tools
https://dtcenter.org/community-code/model-evaluation-tools-met
Apache License 2.0
78 stars 24 forks source link

Create unit test for GRIB_lvl_typ, GRIB_lvl_val1, and GRIB_lvl_val2 support #840

Closed dwfncar closed 7 years ago

dwfncar commented 7 years ago

There currently aren't any unit tests for indicating GRIB levels via GRIB_lvl_typ, GRIB_lvl_val1, and GRIB_lvl_val2, which is common to all MET configuration files. [MET-840] created by minnawin

dwfncar commented 7 years ago

Add AF grib tables to MET repository. by johnhg

dwfncar commented 7 years ago

copied GALWEM (production) and GALWEM-GPP (post production, new model) data for 06/10/2017 FH 00 and FH18 to 'dakota':/d3/projects/MET/MET_test_data/unit_test/model_data/grib2/galwem and /d3/projects/MET/MET_test_data/unit_test/model_data/grib2/galwem-gpp by minnawin

dwfncar commented 7 years ago

AF grib tables were added to the MET svn repo during AF work (first/second week of August).

by minnawin

dwfncar commented 7 years ago

Checked in config file: GridStatConfig_GRIB_lvl_typ_val and updated unit test file: unit_grid_stat.xml to svn repository.


Invoking the test produces the expected files and results. by minnawin

dwfncar commented 7 years ago

Incorrect, the AF grib tables were NOT checked in as stated in comment above. Now the AF_FY17 updates have been incorporated into the grib1_af_131_57.txt and grib2_galwem.txt files.
by minnawin

dwfncar commented 7 years ago

Documentation update needed. Update the README that accompanies the User's Manual: data/config/README and doc/MET_Users_Guide/READMEs/README. Modify the first and copy to the doc/MET_Users_Guide/READMEs location.


Description of grib2 columns follows wgrib2, found in github:
https://github.com/erget/wgrib2/blob/master/wgrib2/wgrib2.h



struct gribtable_s {
  int disc; / Section 0 Discipline/
  int mtab_set; / Section 1 Master Tables Version Number used by set_var /
  int mtab_low; / Section 1 Master Tables Version Number low range of tables /
  int mtab_high; / Section 1 Master Tables Version Number high range of tables /
  int cntr; / Section 1 originating centre, used for local tables /
  int ltab; / Section 1 Local Tables Version Number /
  int pcat; / Section 4 Template 4.0 Parameter category /
  int pnum; / Section 4 Template 4.0 Parameter number /
  const char name;
  const char
desc;
  const char *unit;
};


For grib1 table, download the wgrib.tar tarball from http://www.cpc.ncep.noaa.gov/products/wesley/wgrib.html and look at gribtable.c:
static int user_center = 0, user_subcenter = 0, user_ptable = 0;
static enum {filled, not_found, not_checked, no_file, init} status = init;


struct ParmTable parm_table_user[256];


...omitted intermediate code...


   user_center = center;
    user_subcenter = subcenter;
    user_ptable = ptable;


    / free any used memory /
    for (i = 0; i < 256; i++) {
        if (parm_table_user[i].name != NULL) free(parm_table_user[i].name);
        if (parm_table_user[i].comment != NULL) free(parm_table_user[i].comment);
        parm_table_user[i].name = parm_table_user[i].comment = NULL;
    }


    / read definitions /


    for (;;) {
        if (fgets(line, 299, input) == NULL) break;
        if ((i = atoi(line)) == START) break;
        line[299] = 0;


        / find the colons and end-of-line /
        for (c0 = 0; line[c0] != ':' && line[c0] != 0; c0++) ;
        / skip blank lines /
        if (line[c0] == 0) continue;


        for (c1 = c0 + 1; line[c1] != ':' && line[c1] != 0; c1++) ;
        c2 = strlen(line);
        if (line[c2-1] == '\n') line[--c2] = '\0';
        if (c2 <= c1) {
            fprintf(stderr,"illegal gribtab line:%s\n", line);
            continue;
        }
        line[c0] = 0;
        line[c1] = 0;





by minnawin