UERRA: Merge changes from Mladek's tigge_check_uerra branch

This commit is contained in:
Shahram Najm 2016-05-23 18:43:42 +01:00
parent eb6b68329b
commit 68257583d8
3 changed files with 268 additions and 163 deletions

View File

@ -86,9 +86,10 @@ int valueflg = 0;
const char* param = "unknown";
int warnflg = 0;
int zeroflg = 0;
int is_lam =0;
int is_s2s =0;
int is_s2s_refcst =0;
int is_lam = 0;
int is_s2s = 0;
int is_s2s_refcst = 0;
int is_uerra = 0;
const char* good = NULL;
const char* bad = NULL;
@ -403,21 +404,14 @@ static void point_in_time(grib_handle* h,const parameter* p,double min,double ma
break;
}
if (!is_lam)
if (is_uerra)
{
if(get(h,"indicatorOfUnitOfTimeRange") == 11) /* six hours */
if(get(h,"indicatorOfUnitOfTimeRange") == 1) /* hourly */
{
/* Six hourly is OK */
;
}
else
{
CHECK(eq(h,"indicatorOfUnitOfTimeRange",1));/* Hours */
CHECK((get(h,"forecastTime") % 6) == 0); /* Every six hours */
CHECK((eq(h,"forecastTime",1)||eq(h,"forecastTime",2)||eq(h,"forecastTime",4)||eq(h,"forecastTime",5))||(get(h,"forecastTime") % 3) == 0);
}
}
else
{
else if (is_lam) {
if(get(h,"indicatorOfUnitOfTimeRange") == 10 ) /* three hours */
{
/* Three hourly is OK */
@ -428,6 +422,17 @@ static void point_in_time(grib_handle* h,const parameter* p,double min,double ma
CHECK(eq(h,"indicatorOfUnitOfTimeRange",1));/* Hours */
CHECK((get(h,"forecastTime") % 3) == 0); /* Every three hours */
}
} else {
if(get(h,"indicatorOfUnitOfTimeRange") == 11) /* six hours */
{
/* Six hourly is OK */
;
}
else
{
CHECK(eq(h,"indicatorOfUnitOfTimeRange",1));/* Hours */
CHECK((get(h,"forecastTime") % 6) == 0); /* Every six hours */
}
}
check_range(h,p,min,max);
@ -513,6 +518,10 @@ static void statistical_process(grib_handle* h,const parameter* p,double min,dou
{
switch(get(h,"typeOfProcessedData"))
{
case 0: /* UERRA Analysis xxx double check!! */
CHECK(eq(h,"productDefinitionTemplateNumber",0));
break;
case 2: /* Analysis and forecast products */
CHECK(eq(h,"productDefinitionTemplateNumber",8));
break;
@ -647,8 +656,11 @@ static void from_start(grib_handle* h,const parameter* p,double min,double max)
statistical_process(h,p,min,max);
CHECK(eq(h,"startStep",0));
if(step == 0)
if(step == 0){
if(!is_uerra){
CHECK(min == 0 && max == 0);
}
}
else
{
check_range(h,p,min/step,max/step);
@ -1028,28 +1040,42 @@ static void verify(grib_handle* h)
CHECK(eq(h,"second",0));
CHECK(ge(h,"startStep",0));
if (!is_s2s){
CHECK(eq(h,"productionStatusOfProcessedData",4)||eq(h,"productionStatusOfProcessedData",5)); /* TIGGE prod||test */
CHECK(le(h,"endStep",30*24));
}
else
{
if (is_s2s){
CHECK(eq(h,"productionStatusOfProcessedData",6)||eq(h,"productionStatusOfProcessedData",7)); /* S2S prod||test */
CHECK(le(h,"endStep",100*24));
}
if (!is_lam){
CHECK((get(h,"step") % 6) == 0);
else if (is_uerra){
CHECK(eq(h,"productionStatusOfProcessedData",9)||eq(h,"productionStatusOfProcessedData",10)); /* UERRA prod||test */
CHECK(le(h,"endStep",30));
}
else
{
CHECK((get(h,"step") % 3) == 0);
CHECK(eq(h,"productionStatusOfProcessedData",4)||eq(h,"productionStatusOfProcessedData",5)); /* TIGGE prod||test */
CHECK(le(h,"endStep",30*24));
}
if (is_uerra){
CHECK((eq(h,"step",1)||eq(h,"step",2)||eq(h,"step",4)||eq(h,"step",5))||(get(h,"step") % 3) == 0);
}
else if (is_lam){
CHECK((get(h,"step") % 3) == 0);
}
else
{
CHECK((get(h,"step") % 6) == 0);
}
if (is_uerra){
/* 0 = analysis , 2 = analysis or forecast */
CHECK(eq(h,"typeOfProcessedData",0)||eq(h,"typeOfProcessedData",2));
}
else
{
/* 2 = analysis or forecast , 3 = control forecast, 4 = perturbed forecast */
CHECK(eq(h,"typeOfProcessedData",2)||eq(h,"typeOfProcessedData",3)||eq(h,"typeOfProcessedData",4));
}
/* TODO: validate local usage. Empty for now */
/* TODO: validate local usage. Empty for now xxx*/
/* CHECK(eq(h,"section2.sectionLength",5)); */
/* Section 3 */
@ -1063,6 +1089,11 @@ static void verify(grib_handle* h)
latlon_grid(h);
break;
case 30: /*Lambert conformal*/
/*lambert_grid(h); # TODO xxx*/
printf("Lambert grid - geometry checking not implemented yet!\n");
break;
case 40: /* gaussian grid (regular or reduced) */
gaussian_grid(h);
break;
@ -1227,6 +1258,10 @@ int main(int argc, char** argv)
is_s2s_refcst=1;
break;
case 'u':
is_uerra=1;
break;
default:
usage();
break;

View File

@ -1762,7 +1762,7 @@ warning: s2s.z_tigge_c_kwbc_20090829000000_ncep_prod_pf_sl_0024_003_0000_tcw.gri
},
/*
s2s/rums warning: s2s.z_s2s_c_rhmc_20150819000000_glob_prod_0336_017.sl.grib2, field 4 [surface_air_temperature_sfc.glob]: surface_air_temperature_sfc.glob minimum value 177.17 is not in [180,290]
s2s/rums warning: s2s.z_s2s_c_rhmc_20150819000000_glob_prod_0336_017.sl.grib2, field 4 [surface_air_temperature_sfc.glob]: surface_air_temperature_sfc.glob minimum value 177.17 is not in [180,290]
s2s/ammc: warning: s2s.2t_20151224_26.grib2, field 12 [surface_air_temperature_sfc.glob.s2]: surface_air_temperature_sfc.glob.s2 maximum value 353.017 is not in [270,350]
*/
@ -2309,5 +2309,75 @@ s2s/ammc/enfo:s2s.tcc_20151004_9.grib2, field 21 [total_cloud_cover_sfc.glob]: t
{&daily_average, &predefined_level},
},
/* UERRA */
{
"total_cloud_cover_sfc.ur",
0,
1e-10,
0.9999,
100.00001,
{
{"class", GRIB_TYPE_STRING, 0, "ur"},
{"discipline", GRIB_TYPE_LONG, 0},
{"parameterCategory", GRIB_TYPE_LONG, 6},
{"parameterNumber", GRIB_TYPE_LONG, 1},
{"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1},
{"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8},
{NULL, },
},
{&point_in_time, &predefined_thickness},
},
{
"high_cloud_cover_sfc.ur",
0,
1e-10,
0.9999,
100.00001,
{
{"class", GRIB_TYPE_STRING, 0, "ur"},
{"discipline", GRIB_TYPE_LONG, 0},
{"parameterCategory", GRIB_TYPE_LONG, 6},
{"parameterNumber", GRIB_TYPE_LONG, 5},
{"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1},
{"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8},
{NULL, },
},
{&point_in_time, &predefined_thickness},
},
{
"medium_cloud_cover_sfc.ur",
0,
1e-10,
0.9999,
100.00001,
{
{"class", GRIB_TYPE_STRING, 0, "ur"},
{"discipline", GRIB_TYPE_LONG, 0},
{"parameterCategory", GRIB_TYPE_LONG, 6},
{"parameterNumber", GRIB_TYPE_LONG, 4},
{"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1},
{"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8},
{NULL, },
},
{&point_in_time, &predefined_thickness},
},
{
"low_cloud_cover_sfc.ur",
0,
1e-10,
0.9999,
100.00001,
{
{"class", GRIB_TYPE_STRING, 0, "ur"},
{"discipline", GRIB_TYPE_LONG, 0},
{"parameterCategory", GRIB_TYPE_LONG, 6},
{"parameterNumber", GRIB_TYPE_LONG, 3},
{"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1},
{"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8},
{NULL, },
},
{&point_in_time, &predefined_thickness},
}
};