Merged feature/EFAS_development

This commit is contained in:
Shahram Najm 2018-07-17 13:59:50 +01:00
commit f9c7e87c2f
10 changed files with 63 additions and 36 deletions

View File

@ -16306,12 +16306,12 @@ dist_definitionsmars_DATA = \
mars/grib.edmo.cl.def\
mars/grib.edmo.fc.def\
mars/grib.edmo.ssd.def\
mars/grib.efas.an.def\
mars/grib.efas.cf.def\
mars/grib.efas.fc.def\
mars/grib.efas.fu.def\
mars/grib.efas.go.def\
mars/grib.efas.pf.def\
mars/grib.efas.sfo.def\
mars/grib.efhc.cf.def\
mars/grib.efhc.icp.def\
mars/grib.efhc.pf.def\

View File

@ -43,6 +43,7 @@ unsigned[2] anoffsetFrequency = missing(): dump, can_be_missing;
# Boolean
transient is_efas = 1;
transient lsdate_bug = 1: hidden; # See ECC-707
# Note: the key typeOfPostProcessing is in the PDTNs 70, 71, 72 and 73
concept efas_post_proc {

View File

@ -1,19 +0,0 @@
# EFAS Analysis (Water Balance)
alias mars.step = startStep;
# See ECC-683
#alias mars.date = dateOfForecast;
#alias mars.time = timeOfForecast;
meta valDate validity_date(dataDate,dataTime,endStep,stepUnits): no_copy;
meta valTime validity_time(dataDate,dataTime,endStep,stepUnits): no_copy;
alias mars.date = valDate;
alias mars.time = valTime;
#meta efas_suite_name sprintf("%s_%s_%s", inputOriginatingCentre, efas_forecast, efas_post_proc) : no_copy;
alias mars.origin = inputOriginatingCentre;
alias mars.anoffset=anoffset;
# We need this because 'efas_post_proc' is defined later
meta efas_model sprintf("%s", efas_post_proc) : no_copy;
alias mars.model = efas_model;

View File

@ -1,5 +1,7 @@
# EFAS Fullup
alias mars.step = startStep;
# EFAS Fill-up
# ECC-701
alias mars.step = endStep;
alias mars.date = dateOfForecast;
alias mars.time = timeOfForecast;

View File

@ -1,13 +1,14 @@
# EFAS Gridded observations
alias mars.step = startStep;
# See ECC-683
#alias mars.date = dateOfForecast;
#alias mars.time = timeOfForecast;
meta valDate validity_date(dataDate,dataTime,endStep,stepUnits): no_copy;
meta valTime validity_time(dataDate,dataTime,endStep,stepUnits): no_copy;
alias mars.date = valDate;
alias mars.time = valTime;
# ECC-701
alias mars.step = endStep;
alias mars.date = dateOfForecast;
alias mars.time = timeOfForecast;
#meta valDate validity_date(dataDate,dataTime,endStep,stepUnits): no_copy;
#meta valTime validity_time(dataDate,dataTime,endStep,stepUnits): no_copy;
#alias mars.date = valDate;
#alias mars.time = valTime;
alias mars.origin = inputOriginatingCentre;

View File

@ -0,0 +1,21 @@
# Simulation forced with observations (EFAS)
# Water Balance
# ECC-701
alias mars.step = endStep;
alias mars.date = dateOfForecast;
alias mars.time = timeOfForecast;
#meta valDate validity_date(dataDate,dataTime,endStep,stepUnits): no_copy;
#meta valTime validity_time(dataDate,dataTime,endStep,stepUnits): no_copy;
#alias mars.date = valDate;
#alias mars.time = valTime;
#meta efas_suite_name sprintf("%s_%s_%s", inputOriginatingCentre, efas_forecast, efas_post_proc) : no_copy;
alias mars.origin = inputOriginatingCentre;
alias mars.anoffset=anoffset;
# We need this because 'efas_post_proc' is defined later
meta efas_model sprintf("%s", efas_post_proc) : no_copy;
alias mars.model = efas_model;

View File

@ -55,7 +55,8 @@
65 cv Calibration/Validation forecast
70 or Ocean reanalysis
71 fx Flux forcing
72 fu EFAS Fillup
72 fu Fill-up
73 sfo Simulation forced with observations
80 fcmean Forecast mean
81 fcmax Forecast maximum
82 fcmin Forecast minimum

View File

@ -369,7 +369,8 @@ static int extra_set(grib_accessor* a,long val)
break;
case 70: /* Ocean reanalysis (or) */
case 71: /* Flux forcing (fx) */
case 72: /* EFAS Fillup (fu) */
case 72: /* Fill-up (fu) */
case 73: /* Simulation forced with observations (sfo) */
case 80: /* Forecast mean (fcmean) */
case 81: /* Forecast maximum (fcmax) */
case 82: /* Forecast minimum (fcmin) */

View File

@ -65,12 +65,13 @@ ${tools_dir}/grib_set -s setLocalDefinition=1,localDefinitionNumber=41,yearOfFor
grib_check_key_equals $temp1 anoffset 25
grib_check_key_equals $temp1 anoffsetFirst,anoffsetLast,anoffsetFrequency "MISSING MISSING MISSING"
# ECC-663: MARS step
types="an fu go"
# MARS step
types="sfo fu go"
for t in $types; do
${tools_dir}/grib_set -s setLocalDefinition=1,localDefinitionNumber=41,type=$t,stepType=accum,stepRange=12-36,paramId=260268 \
$sample $temp1
grib_check_key_equals $temp1 mars.step 12 # start step
grib_check_key_equals $temp1 mars.step 36 # end step (ECC-701)
grib_check_key_exists $temp1 mars.anoffset
#${tools_dir}/grib_dump -Da $temp1 | grep mars.step
done

View File

@ -813,6 +813,17 @@ void grib_skip_check(grib_runtime_options* options,grib_handle* h)
}
}
/* See ECC-707 */
static int fix_for_lsdate_needed(grib_handle* h)
{
long lsdate_bug = 0;
int err = grib_get_long(h, "lsdate_bug", &lsdate_bug);
if (!err && lsdate_bug == 1) {
return 1;
}
return 0;
}
void grib_print_key_values(grib_runtime_options* options, grib_handle* h)
{
int i=0;
@ -864,15 +875,22 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h)
}
} else {
/* Other products e.g. GRIB */
const int fix_lsdate = (fix_for_lsdate_needed(h) && options->name_space && strcmp(options->name_space,"ls")==0);
if (grib_is_missing(h,options->print_keys[i].name,&ret) && ret==GRIB_SUCCESS) {
sprintf(value,"MISSING");
}
else if ( ret == GRIB_SUCCESS ) {
const char* pName = NULL;
if (options->print_keys[i].type == GRIB_TYPE_UNDEFINED)
grib_get_native_type(h,options->print_keys[i].name,&(options->print_keys[i].type));
switch (options->print_keys[i].type) {
case GRIB_TYPE_STRING:
ret=grib_get_string( h,options->print_keys[i].name,value,&len);
pName = options->print_keys[i].name;
if (fix_lsdate && strcmp(pName, "date")==0) { /* ECC-707 */
pName = "ls.date";
}
ret=grib_get_string( h,pName,value,&len);
break;
case GRIB_TYPE_DOUBLE:
ret=grib_get_double( h,options->print_keys[i].name,&dvalue);