GRIB2 legacy ECMWF parameters: Added definitions files. Only supports paramId 210

This commit is contained in:
Shahram Najm 2020-03-20 20:38:29 +00:00
parent e4fa0d0c98
commit aa7685d431
9 changed files with 84 additions and 35 deletions

View File

@ -0,0 +1,6 @@
#Surface net solar radiation, clear sky
'surface_net_downward_shortwave_flux_assuming_clear_sky' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 210 ;
}

View File

@ -0,0 +1,6 @@
#Surface net solar radiation, clear sky
'ssrc' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 210 ;
}

View File

@ -0,0 +1,6 @@
#Surface net solar radiation, clear sky
'Surface net solar radiation, clear sky' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 210 ;
}

View File

@ -0,0 +1,6 @@
#Surface net solar radiation, clear sky
'210' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 210 ;
}

View File

@ -0,0 +1,6 @@
#Surface net solar radiation, clear sky
'ssrc' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 210 ;
}

View File

@ -0,0 +1,6 @@
#Surface net solar radiation, clear sky
'J m**-2' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 210 ;
}

View File

@ -5,24 +5,29 @@ constant conceptsMasterDir="grib2" : hidden;
constant conceptsLocalDirAll="grib2/localConcepts/[centre:s]" : hidden;
constant conceptsLocalDirECMF="grib2/localConcepts/ecmf" : hidden;
concept paramIdECMF (defaultParameter,"paramId.def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy;
concept paramIdLegacyECMF(defaultParameter,"paramId.98.def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy,hidden;
concept paramIdECMF (paramIdLegacyECMF,"paramId.def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy;
concept paramId (paramIdECMF,"paramId.def",conceptsMasterDir,conceptsLocalDirAll): long_type;
# transient pid = paramId : hidden;
concept shortNameECMF (defaultShortName,"shortName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,dump;
concept ls.shortName (shortNameECMF,"shortName.def",conceptsMasterDir,conceptsLocalDirAll) : no_copy,dump;
concept shortNameLegacyECMF(defaultShortName,"shortName.98.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,dump,hidden;
concept shortNameECMF (shortNameLegacyECMF,"shortName.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,dump;
concept ls.shortName (shortNameECMF,"shortName.def",conceptsMasterDir,conceptsLocalDirAll): no_copy,dump;
concept unitsECMF (defaultName,"units.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy;
concept units (unitsECMF,"units.def",conceptsMasterDir,conceptsLocalDirAll) : no_copy;
concept unitsLegacyECMF(defaultName,"units.98.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden;
concept unitsECMF (unitsLegacyECMF,"units.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy;
concept units (unitsECMF,"units.def",conceptsMasterDir,conceptsLocalDirAll): no_copy;
concept nameECMF (defaultName,"name.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,dump;
concept name (nameECMF,"name.def",conceptsMasterDir,conceptsLocalDirAll) : no_copy,dump;
concept nameLegacyECMF(defaultName,"name.98.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,dump,hidden;
concept nameECMF(nameLegacyECMF,"name.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,dump;
concept name(nameECMF,"name.def",conceptsMasterDir,conceptsLocalDirAll): no_copy,dump;
concept cfNameECMF (defaultShortName,"cfName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,dump;
concept cfName (cfNameECMF,"cfName.def",conceptsMasterDir,conceptsLocalDirAll) : no_copy,dump;
concept cfNameLegacyECMF(defaultShortName,"cfName.98.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,dump,hidden;
concept cfNameECMF(cfNameLegacyECMF,"cfName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,dump;
concept cfName(cfNameECMF,"cfName.def",conceptsMasterDir,conceptsLocalDirAll) : no_copy,dump;
concept cfVarNameECMF (defaultShortName,"cfVarName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,dump;
concept cfVarName (cfVarNameECMF,"cfVarName.def",conceptsMasterDir,conceptsLocalDirAll) : no_copy,dump;
concept cfVarNameLegacyECMF(defaultShortName,"cfVarName.98.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,dump,hidden;
concept cfVarNameECMF (cfVarNameLegacyECMF,"cfVarName.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,dump;
concept cfVarName (cfVarNameECMF,"cfVarName.def",conceptsMasterDir,conceptsLocalDirAll): no_copy,dump;
# modelName: Contribution from Daniel Lee @ DWD
concept modelName (defaultName,"modelName.def",conceptsMasterDir,conceptsLocalDirAll): no_copy,dump,read_only;

View File

@ -461,6 +461,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
return ret;
}
#if 0
static long guess_paramId(grib_handle* h)
{
int err = 0;
@ -499,6 +500,7 @@ static long get_ECMWF_local_paramId(grib_accessor* a, grib_handle* h)
}
return -1;
}
#endif
static int unpack_long(grib_accessor* a, long* val, size_t* len)
{
@ -506,13 +508,13 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
if (!p) {
grib_handle* h = grib_handle_of_accessor(a);
const long pid = get_ECMWF_local_paramId(a, h);
if (pid != -1) {
grib_context_log(h->context, GRIB_LOG_DEBUG, "ECMWF local grib2: paramId guessed to be %ld", pid);
*val = pid;
*len = 1;
return GRIB_SUCCESS;
}
//const long pid = get_ECMWF_local_paramId(a, h);
//if (pid != -1) {
// grib_context_log(h->context, GRIB_LOG_DEBUG, "ECMWF local grib2: paramId guessed to be %ld", pid);
// *val = pid;
// *len = 1;
// return GRIB_SUCCESS;
//}
if (a->creator->defaultkey)
return grib_get_long_internal(h, a->creator->defaultkey, val);
@ -559,6 +561,7 @@ static void destroy(grib_context* c, grib_accessor* a)
*/
}
#if 0
static int is_local_ecmwf_grib2_param_key(grib_accessor* a, long edition, long centre)
{
if (edition == 2 && centre == 98) {
@ -572,21 +575,24 @@ static char* get_legacy_param_info(const char* key_name, long paramId)
{
if (strcmp(key_name, "modelName") == 0)
return "unknown";
if (paramId == 210) {
if (strcmp(key_name, "paramId") == 0)
return "210";
if (strcmp(key_name, "shortName") == 0)
return "ssrc";
if (strcmp(key_name, "units") == 0)
return "J m**-2";
if (strcmp(key_name, "name") == 0)
return "Surface net solar radiation, clear sky";
if (strcmp(key_name, "cfVarName") == 0)
return "ssrc";
if (strncmp(key_name, "cfName", 6) == 0)
return "surface_net_downward_shortwave_flux_assuming_clear_sky";
}
else if (paramId == 211) {
/*
* if (paramId == 210) {
* if (strcmp(key_name, "paramId") == 0)
* return "210";
* if (strcmp(key_name, "shortName") == 0)
* return "ssrc";
* if (strcmp(key_name, "units") == 0)
* return "J m**-2";
* if (strcmp(key_name, "name") == 0)
* return "Surface net solar radiation, clear sky";
* if (strcmp(key_name, "cfVarName") == 0)
* return "ssrc";
* if (strncmp(key_name, "cfName", 6) == 0)
* return "surface_net_downward_shortwave_flux_assuming_clear_sky";
* }
* else
*/
if (paramId == 211) {
if (strcmp(key_name, "paramId") == 0)
return "211";
if (strcmp(key_name, "shortName") == 0)
@ -650,6 +656,7 @@ static const char* get_ECMWF_local_parameter(grib_accessor* a, grib_handle* h)
}
return NULL;
}
#endif
static int unpack_string(grib_accessor* a, char* val, size_t* len)
{
@ -658,7 +665,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
if (!p) {
grib_handle* h = grib_handle_of_accessor(a);
p = get_ECMWF_local_parameter(a, h);
//p = get_ECMWF_local_parameter(a, h);
if (!p) {
if (a->creator->defaultkey)
return grib_get_string_internal(h, a->creator->defaultkey, val, len);

View File

@ -727,6 +727,7 @@ static int parse(grib_context* gc, const char* filename)
GRIB_MUTEX_UNLOCK(&mutex_parse);
return GRIB_FILE_NOT_FOUND;
}
//printf("parse:: grib_yyparse on %s\n", filename);
err = grib_yyparse();
parse_file = 0;