From a773196186a397c45a334f2f92d2d977eae5f841 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 17 Mar 2014 14:44:27 +0000 Subject: [PATCH] Merge in changes from master --- definitions/Makefile.am | 15 + definitions/grib1/0.rjtd.table | 5 + definitions/grib1/2.34.200.table | 1 + definitions/grib1/3.table | 2 - definitions/grib1/5.table | 8 +- definitions/grib1/local.34.def | 2 +- definitions/grib1/local/ecmf/3.table | 53 + definitions/grib1/local/rjtd/252.table | 16 + definitions/grib1/local/rjtd/3.table | 58 + definitions/grib1/local/rjtd/5.table | 27 + .../grib1/localConcepts/ecmf/stepType.def | 30 + .../grib1/localConcepts/ecmf/typeOfLevel.def | 3 + .../grib1/localConcepts/rjtd/cfVarName.def | 5 + definitions/grib1/localConcepts/rjtd/name.def | 5 + .../grib1/localConcepts/rjtd/paramId.def | 5 + .../grib1/localConcepts/rjtd/shortName.def | 5 + .../grib1/localConcepts/rjtd/stepType.def | 23 + .../grib1/localConcepts/rjtd/typeOfLevel.def | 43 + .../grib1/localConcepts/rjtd/units.def | 5 + definitions/grib1/section.1.def | 87 +- definitions/grib1/stepType.def | 26 + definitions/grib1/typeOfLevel.def | 79 +- src/action_class_concept.c | 462 +++--- src/grib_accessor_class_g1step_range.c | 30 +- src/grib_accessor_class_statistics.c | 32 +- tigge/tigge_check.c | 226 +-- tigge/tigge_check.h | 1318 ++++++++++++++--- tools/grib_histogram.c | 6 +- tools/grib_ls.c | 6 +- 29 files changed, 1906 insertions(+), 677 deletions(-) create mode 100644 definitions/grib1/0.rjtd.table create mode 100644 definitions/grib1/local/ecmf/3.table create mode 100644 definitions/grib1/local/rjtd/252.table create mode 100644 definitions/grib1/local/rjtd/3.table create mode 100644 definitions/grib1/local/rjtd/5.table create mode 100644 definitions/grib1/localConcepts/ecmf/stepType.def mode change 100644 => 100755 definitions/grib1/localConcepts/ecmf/typeOfLevel.def create mode 100644 definitions/grib1/localConcepts/rjtd/stepType.def create mode 100644 definitions/grib1/localConcepts/rjtd/typeOfLevel.def create mode 100644 definitions/grib1/stepType.def diff --git a/definitions/Makefile.am b/definitions/Makefile.am index 740aba2d9..b1548b541 100644 --- a/definitions/Makefile.am +++ b/definitions/Makefile.am @@ -30,6 +30,7 @@ definitionsgrib1dir = @GRIB_DEFINITION_PATH@/grib1 dist_definitionsgrib1_DATA = \ grib1/0.ecmf.table\ grib1/0.eswi.table\ + grib1/0.rjtd.table\ grib1/0.table\ grib1/1.table\ grib1/10.table\ @@ -244,10 +245,21 @@ dist_definitionsgrib1_DATA = \ grib1/section.5.def\ grib1/sensitive_area_domain.def\ grib1/shortName.def\ + grib1/stepType.def\ grib1/tube_domain.def\ grib1/typeOfLevel.def\ grib1/units.def +definitionsgrib1_local_ecmfdir = @GRIB_DEFINITION_PATH@/grib1/local/ecmf +dist_definitionsgrib1_local_ecmf_DATA = \ + grib1/local/ecmf/3.table + +definitionsgrib1_local_rjtddir = @GRIB_DEFINITION_PATH@/grib1/local/rjtd +dist_definitionsgrib1_local_rjtd_DATA = \ + grib1/local/rjtd/252.table\ + grib1/local/rjtd/3.table\ + grib1/local/rjtd/5.table + definitionsgrib1_localConcepts_ammcdir = @GRIB_DEFINITION_PATH@/grib1/localConcepts/ammc dist_definitionsgrib1_localConcepts_ammc_DATA = \ grib1/localConcepts/ammc/name.def\ @@ -269,6 +281,7 @@ dist_definitionsgrib1_localConcepts_ecmf_DATA = \ grib1/localConcepts/ecmf/name.def\ grib1/localConcepts/ecmf/paramId.def\ grib1/localConcepts/ecmf/shortName.def\ + grib1/localConcepts/ecmf/stepType.def\ grib1/localConcepts/ecmf/typeOfLevel.def\ grib1/localConcepts/ecmf/units.def @@ -337,6 +350,8 @@ dist_definitionsgrib1_localConcepts_rjtd_DATA = \ grib1/localConcepts/rjtd/name.def\ grib1/localConcepts/rjtd/paramId.def\ grib1/localConcepts/rjtd/shortName.def\ + grib1/localConcepts/rjtd/stepType.def\ + grib1/localConcepts/rjtd/typeOfLevel.def\ grib1/localConcepts/rjtd/units.def definitionsgrib1_localConcepts_sbsjdir = @GRIB_DEFINITION_PATH@/grib1/localConcepts/sbsj diff --git a/definitions/grib1/0.rjtd.table b/definitions/grib1/0.rjtd.table new file mode 100644 index 000000000..ba292579f --- /dev/null +++ b/definitions/grib1/0.rjtd.table @@ -0,0 +1,5 @@ +# identification of subcenters for Japan +0 none No sub-centre +207 207 Syowa +240 240 Kiyose +241 241 Reanalysis Project diff --git a/definitions/grib1/2.34.200.table b/definitions/grib1/2.34.200.table index a3e7876f4..ca22ae86b 100644 --- a/definitions/grib1/2.34.200.table +++ b/definitions/grib1/2.34.200.table @@ -181,4 +181,5 @@ 249 249 VDFMRHBL Vertical diffusion moistening rate (kg kg**-1 per day) 250 250 SWHRHBL Solar radiative heating rate (K per day) 251 251 LWHRHBL Long wave radiative heating rate (K per day) +252 252 Type of vegetation (Code Table JMA-252) 253 253 LRGMRHBL Large scale moistening rate (kg kg**-1 per day) diff --git a/definitions/grib1/3.table b/definitions/grib1/3.table index 767213f12..17bf1dff2 100644 --- a/definitions/grib1/3.table +++ b/definitions/grib1/3.table @@ -48,6 +48,4 @@ # 202-209 Reserved 210 pl Isobaric surface (Pa) (ECMWF extension) # 211-254 Reserved for local use -211 wv Ocean wave level (ECMWF extension) -212 oml Ocean mixed layer (ECMWF extension) 255 255 Indicates a missing value diff --git a/definitions/grib1/5.table b/definitions/grib1/5.table index d6768cb33..b5e720f26 100644 --- a/definitions/grib1/5.table +++ b/definitions/grib1/5.table @@ -5,13 +5,17 @@ 3 3 Average (reference time + P1 to reference time + P2) 4 4 Accumulation (reference time + P1 to reference time + P2) product considered valid at reference time + P2 5 5 Difference (reference time + P2 minus reference time + P1) product considered valid at reference time + P2 -10 10 P1 occupies octets 19 and 20; product valid at reference time + P1 -51 51 Climatological Mean Value: +6 6 Average (reference time - P1 to reference time - P2) +7 7 Average (reference time - P1 to reference time + P2) +10 10 P1 occupies octets 19 and 20; product valid at reference time + P1 +51 51 Climatological Mean Value: 113 113 Average of N forecasts (or initialized analyses); each product has forecast period of P1 (P1=0 for initialized analyses); products have reference times at intervals of P2, beginning at the given reference time. 114 114 Accumulation of N forecasts (or initialized analyses); each product has forecast period of P1 (P1=0 for initialized analyses); products have reference times at intervals of P2, beginning at the given reference time. 115 115 Average of N forecasts, all with the same reference time; the first has a forecast period of P1, the remaining forecasts follow at intervals of P2. 116 116 Accumulation of N forecasts, all with the same reference time; the first has a forecast period of P1, the remaining follow at intervals of P2. 117 117 Average of N forecasts, the first has a period of P1, the subsequent ones have forecast periods reduced from the previous one by an interval of P2; the reference time for the first is given in octets 13- 17, the subsequent ones have reference times increased from the previous one by an interval of P2. Thus all the forecasts have the same valid time, given by the initial reference time + P1. 118 118 Temporal variance, or covariance, of N initialized analyses; each product has forecast period P1=0; products have reference times at intervals of P2, beginning at the given reference time. +119 119 Standard deviation of N forecasts, all with the same reference time with respect to the time average of forecasts; the first forecast has a forecast period of P1, the remaining forecasts follow at intervals of P2 123 123 Average of N uninitialized analyses, starting at the reference time, at intervals of P2. 124 124 Accumulation of N uninitialized analyses, starting at the reference time, at intervals of P2. +125 125 Standard deviation of N forecasts, all with the same reference time with respect to time average of the time tendency of forecasts; the first forecast has a forecast period of P1, the remaining forecasts follow at intervals of P2 diff --git a/definitions/grib1/local.34.def b/definitions/grib1/local.34.def index deabff083..2203d9823 100644 --- a/definitions/grib1/local.34.def +++ b/definitions/grib1/local.34.def @@ -1,4 +1,4 @@ label "JMA - extension"; - +# Japanese Meteorological Agency codetable[1] localDefinitionNumber 'grib1/localDefinitionNumber.34.table' = 1 : dump; template localDefinition "grib1/local.34.[localDefinitionNumber:l].def"; diff --git a/definitions/grib1/local/ecmf/3.table b/definitions/grib1/local/ecmf/3.table new file mode 100644 index 000000000..767213f12 --- /dev/null +++ b/definitions/grib1/local/ecmf/3.table @@ -0,0 +1,53 @@ +# CODE TABLE 3 Fixed levels or layers for which the data are included +0 0 Reserved +1 sfc Surface (of the Earth, which includes sea surface) +2 sfc Cloud base level +3 sfc Cloud top level +4 sfc 0 deg (C) isotherm level +5 5 Adiabatic condensation level (parcel lifted from surface) +6 6 Maximum wind speed level +7 7 Tropopause level +8 sfc Nominal top of atmosphere +9 9 Sea bottom +# 10-19 Reserved +20 20 Isothermal level Temperature in 1/100 K +# 21-99 Reserved +100 pl Isobaric level pressure in hectoPascals (hPa) (2 octets) +101 101 Layer between two isobaric levels pressure of top (kPa) pressure of bottom (kPa) +102 sfc Mean sea level 0 0 +103 103 Fixed height level height above mean sea level (MSL) in meters +104 104 Layer between two specfied altitudes above mean sea level - altitude of top, altitude of bottom (hm) +105 sfc Fixed height above ground height in meters (2 octets) +106 106 Layer between two height levels above ground - height of top, height of bottom (hm) +107 107 Sigma level sigma value in 1/10000 (2 octets) +108 108 Layer between two sigma levels sigma value at top in 1/100 sigma value at bottom in 1/100 +109 ml Hybrid level level number (2 octets) +110 ml Layer between two hybrid levels level number of top level number of bottom +111 sfc Depth below land surface centimeters (2 octets) +112 sfc Layer between two depths below land surface - depth of upper surface, depth of lower surface (cm) +113 pt Isentropic (theta) level Potential Temp. degrees K (2 octets) +114 114 Layer between two isentropic levels 475K minus theta of top in Deg. K 475K minus theta of bottom in Deg. K +115 115 Level at specified pressure difference from ground to level hPa (2 octets) +116 116 Layer between two levels at specified pressure differences from ground to levels pressure difference from ground to top level hPa pressure difference from ground to bottom level hPa +117 pv Potential vorticity surface 10-9 K m2 kg-1 s-1 +# 118 Reserved +119 119 ETA level: ETA value in 1/10000 (2 octets) +120 120 Layer between two ETA levels: ETA value at top of layer in 1/100, ETA value at bottom of layer in 1/100 +121 121 Layer between two isobaric surfaces (high precision) 1100 hPa minus pressure of top, in hPa 1100 hPa minus pressure of bottom, in hPa +# 122-124 Reserved +125 125 Height level above ground (high precision) centimeters (2 octets) +# 126-127 Reserved +128 128 Layer between two sigma levels (high precision) 1.1 minus sigma of top, in 1/1000 of sigma 1.1 minus sigma of bottom, in 1/1000 of sigma +# 129-140 Reserved +141 141 Layer between two isobaric surfaces (mixed precision) pressure of top, in kPa 1100hPa minus pressure of bottom, in hPa +# 142-159 Reserved +160 dp Depth below sea level meters (2 octets) +# 161-199Reserved +200 sfc Entire atmosphere considered as a single layer 0 (2 octets) +201 201 Entire ocean considered as a single layer 0 (2 octets) +# 202-209 Reserved +210 pl Isobaric surface (Pa) (ECMWF extension) +# 211-254 Reserved for local use +211 wv Ocean wave level (ECMWF extension) +212 oml Ocean mixed layer (ECMWF extension) +255 255 Indicates a missing value diff --git a/definitions/grib1/local/rjtd/252.table b/definitions/grib1/local/rjtd/252.table new file mode 100644 index 000000000..b271d2dfc --- /dev/null +++ b/definitions/grib1/local/rjtd/252.table @@ -0,0 +1,16 @@ +# Code table JMA-252 - type of vegetation +# +0 0 Sea or inland water +1 1 Broadleaf-evergreen trees +2 2 Broadleaf-deciduous trees +3 3 Broadleaf and needleleaf trees +4 4 Needleleaf-evergreen trees +5 5 Needleleaf-deciduous trees +6 6 Broadleaf trees with groundcover +7 7 Groundcover +8 8 Broadleaf shrubs with groundcover +9 9 Broadleaf shrubs with bare soil +10 10 Dwarf trees and shrubs with groundcover (tundra) +11 11 No vegetation: bare soil +12 12 Broadleaf-deciduous trees with winter wheat +13 13 Perennial land ice diff --git a/definitions/grib1/local/rjtd/3.table b/definitions/grib1/local/rjtd/3.table new file mode 100644 index 000000000..b22887d87 --- /dev/null +++ b/definitions/grib1/local/rjtd/3.table @@ -0,0 +1,58 @@ +# CODE TABLE 3 Fixed levels or layers for which the data are included +# For JMA - Japanese Meteorological Agency +0 0 Reserved +1 sfc Surface (of the Earth, which includes sea surface) +2 sfc Cloud base level +3 sfc Cloud top level +4 sfc 0 deg (C) isotherm level +5 5 Adiabatic condensation level (parcel lifted from surface) +6 6 Maximum wind speed level +7 7 Tropopause level +8 sfc Nominal top of atmosphere +9 9 Sea bottom +# 10-19 Reserved +20 20 Isothermal level Temperature in 1/100 K +# 21-99 Reserved +100 pl Isobaric level pressure in hectoPascals (hPa) (2 octets) +101 101 Layer between two isobaric levels pressure of top (kPa) pressure of bottom (kPa) +102 sfc Mean sea level 0 0 +103 103 Fixed height level height above mean sea level (MSL) in meters +104 104 Layer between two specfied altitudes above mean sea level - altitude of top, altitude of bottom (hm) +105 sfc Fixed height above ground height in meters (2 octets) +106 106 Layer between two height levels above ground - height of top, height of bottom (hm) +107 107 Sigma level sigma value in 1/10000 (2 octets) +108 108 Layer between two sigma levels sigma value at top in 1/100 sigma value at bottom in 1/100 +109 ml Hybrid level level number (2 octets) +110 ml Layer between two hybrid levels level number of top level number of bottom +111 sfc Depth below land surface centimeters (2 octets) +112 sfc Layer between two depths below land surface - depth of upper surface, depth of lower surface (cm) +113 pt Isentropic (theta) level Potential Temp. degrees K (2 octets) +114 114 Layer between two isentropic levels 475K minus theta of top in Deg. K 475K minus theta of bottom in Deg. K +115 115 Level at specified pressure difference from ground to level hPa (2 octets) +116 116 Layer between two levels at specified pressure differences from ground to levels pressure difference from ground to top level hPa pressure difference from ground to bottom level hPa +117 pv Potential vorticity surface 10-9 K m2 kg-1 s-1 +# 118 Reserved +119 119 ETA level: ETA value in 1/10000 (2 octets) +120 120 Layer between two ETA levels: ETA value at top of layer in 1/100, ETA value at bottom of layer in 1/100 +121 121 Layer between two isobaric surfaces (high precision) 1100 hPa minus pressure of top, in hPa 1100 hPa minus pressure of bottom, in hPa +# 122-124 Reserved +125 125 Height level above ground (high precision) centimeters (2 octets) +# 126-127 Reserved +128 128 Layer between two sigma levels (high precision) 1.1 minus sigma of top, in 1/1000 of sigma 1.1 minus sigma of bottom, in 1/1000 of sigma +# 129-140 Reserved +141 141 Layer between two isobaric surfaces (mixed precision) pressure of top, in kPa 1100hPa minus pressure of bottom, in hPa +# 142-159 Reserved +160 dp Depth below sea level meters (2 octets) +# 161-199Reserved +200 sfc Entire atmosphere considered as a single layer 0 (2 octets) +201 201 Entire ocean considered as a single layer 0 (2 octets) +# 202-209 Reserved +210 pl Isobaric surface (Pa) (ECMWF extension) + +# 211-254 Reserved for local use +# JRA55 levels +211 sfc Entire soil (considered as a single layer) +212 sfc The bottom of land surface model +213 sfc Underground layer number of land surface model + +255 255 Indicates a missing value diff --git a/definitions/grib1/local/rjtd/5.table b/definitions/grib1/local/rjtd/5.table new file mode 100644 index 000000000..d98dbc59c --- /dev/null +++ b/definitions/grib1/local/rjtd/5.table @@ -0,0 +1,27 @@ +# CODE TABLE 5 Time Range Indicator +0 0 Forecast product valid at reference time + P1 (P1>0) +1 1 Initialized analysis product for reference time (P1=0). +2 2 Product with a valid time ranging between reference time + P1 and reference time + P2 +3 3 Average (reference time + P1 to reference time + P2) +4 4 Accumulation (reference time + P1 to reference time + P2) product considered valid at reference time + P2 +5 5 Difference (reference time + P2 minus reference time + P1) product considered valid at reference time + P2 +6 6 Average (reference time - P1 to reference time - P2) +7 7 Average (reference time - P1 to reference time + P2) +10 10 P1 occupies octets 19 and 20; product valid at reference time + P1 +51 51 Climatological Mean Value: +113 113 Average of N forecasts (or initialized analyses); each product has forecast period of P1 (P1=0 for initialized analyses); products have reference times at intervals of P2, beginning at the given reference time. +114 114 Accumulation of N forecasts (or initialized analyses); each product has forecast period of P1 (P1=0 for initialized analyses); products have reference times at intervals of P2, beginning at the given reference time. +115 115 Average of N forecasts, all with the same reference time; the first has a forecast period of P1, the remaining forecasts follow at intervals of P2. +116 116 Accumulation of N forecasts, all with the same reference time; the first has a forecast period of P1, the remaining follow at intervals of P2. +117 117 Average of N forecasts, the first has a period of P1, the subsequent ones have forecast periods reduced from the previous one by an interval of P2; the reference time for the first is given in octets 13- 17, the subsequent ones have reference times increased from the previous one by an interval of P2. Thus all the forecasts have the same valid time, given by the initial reference time + P1. +118 118 Temporal variance, or covariance, of N initialized analyses; each product has forecast period P1=0; products have reference times at intervals of P2, beginning at the given reference time. +119 119 Standard deviation of N forecasts, all with the same reference time with respect to the time average of forecasts; the first forecast has a forecast period of P1, the remaining forecasts follow at intervals of P2 +123 123 Average of N uninitialized analyses, starting at the reference time, at intervals of P2. +124 124 Accumulation of N uninitialized analyses, starting at the reference time, at intervals of P2. +125 125 Standard deviation of N forecasts, all with the same reference time with respect to time average of the time tendency of forecasts; the first forecast has a forecast period of P1, the remaining forecasts follow at intervals of P2 +# For JRA55 +128 128 Average of N forecast products with a valid time ranging between reference time + P1 and reference time + P2; products have reference times at Intervals of 24 hours, beginning at the given reference time +129 129 Temporal variance of N forecasts; each product has valid time ranging between reference time + P1 and reference time + P2; products have reference times at intervals of 24 hours, beginning at the given reference time; unit of measurement is square of that in Code Table 2 +130 130 Average of N forecast products; valid time of the first product ranges between R + P1 and R + P2, where R is reference time given in octets 13 to 17, then subsequent products have valid time range at interval of P2 - P1; thus all N products cover continuous time span; products have reference times at intervals of P2 - P1, beginning at the given reference time +131 131 Temporal variance of N forecasts; valid time of the first product ranges between R + P1 and R + P2, where R is reference time given in octets 13 to 17, then subsequent products have valid time range at interval of P2 - P1; thus all N products cover continuous time span; products have reference times at intervals of P2 - P1, beginning at the given reference time; unit of measurement is square of that in Code Table 2 +132 132 Temporal variance of N uninitialized analyses [P1 = 0] or instantaneous forecasts [P1 > 0]; each product has valid time at the reference time + P1; products have reference times at intervals of P2, beginning at the given reference time; unit of measurement is square of that in Code Table 2 diff --git a/definitions/grib1/localConcepts/ecmf/stepType.def b/definitions/grib1/localConcepts/ecmf/stepType.def new file mode 100644 index 000000000..5fd395d47 --- /dev/null +++ b/definitions/grib1/localConcepts/ecmf/stepType.def @@ -0,0 +1,30 @@ +# Concept stepType for ECMWF +# set uses the FIRST one +# get returns the LAST match + +"instant" = {timeRangeIndicator=0;} +"instant" = {timeRangeIndicator=10;} +"instant" = {timeRangeIndicator=1;} +"instant" = {timeRangeIndicator=14;} # Fields from DWD in MARS + +"avg" = {timeRangeIndicator=3;} + +"avgd" = {timeRangeIndicator=113;} +"avgfc" = {timeRangeIndicator=113;} + +"accum" = {timeRangeIndicator=4;} +"accum" = {timeRangeIndicator=2;} + +# Since grib1 has not min/max, we had to use our own convention +# therefore we set the centre to ECMWF (98) +"min" = {timeRangeIndicator=2;centre=98;} +"min" = {timeRangeIndicator=119;} +"max" = {timeRangeIndicator=2;centre=98;} +"max" = {timeRangeIndicator=118;} + +"diff" = {timeRangeIndicator=5;} +"rms" = {timeRangeIndicator=120;} +"sd" = {timeRangeIndicator=121;} +"cov" = {timeRangeIndicator=122;} +"avgua" = {timeRangeIndicator=123;} +"avgia" = {timeRangeIndicator=124;} diff --git a/definitions/grib1/localConcepts/ecmf/typeOfLevel.def b/definitions/grib1/localConcepts/ecmf/typeOfLevel.def old mode 100644 new mode 100755 index 8757dd86c..2c253e798 --- a/definitions/grib1/localConcepts/ecmf/typeOfLevel.def +++ b/definitions/grib1/localConcepts/ecmf/typeOfLevel.def @@ -1,3 +1,6 @@ +# ECMWF concept type of level +#set uses the last one +#get returns the first match 'surface' = {indicatorOfTypeOfLevel=1;} 'cloudBase' = {indicatorOfTypeOfLevel=2;} 'cloudTop' = {indicatorOfTypeOfLevel=3;} diff --git a/definitions/grib1/localConcepts/rjtd/cfVarName.def b/definitions/grib1/localConcepts/rjtd/cfVarName.def index 74b9948f8..4348fe064 100644 --- a/definitions/grib1/localConcepts/rjtd/cfVarName.def +++ b/definitions/grib1/localConcepts/rjtd/cfVarName.def @@ -444,6 +444,11 @@ table2Version = 200 ; indicatorOfParameter = 253 ; } +#Type of vegetation +'tovg' = { + table2Version = 200 ; + indicatorOfParameter = 252 ; + } #Virtual temperature 'vtmp' = { table2Version = 200 ; diff --git a/definitions/grib1/localConcepts/rjtd/name.def b/definitions/grib1/localConcepts/rjtd/name.def index a658f171d..2b5a1f92b 100644 --- a/definitions/grib1/localConcepts/rjtd/name.def +++ b/definitions/grib1/localConcepts/rjtd/name.def @@ -444,6 +444,11 @@ table2Version = 200 ; indicatorOfParameter = 253 ; } +#Type of vegetation +'Type of vegetation' = { + table2Version = 200 ; + indicatorOfParameter = 252 ; + } #Virtual temperature 'Virtual temperature' = { table2Version = 200 ; diff --git a/definitions/grib1/localConcepts/rjtd/paramId.def b/definitions/grib1/localConcepts/rjtd/paramId.def index c5a51ed74..0f8440515 100644 --- a/definitions/grib1/localConcepts/rjtd/paramId.def +++ b/definitions/grib1/localConcepts/rjtd/paramId.def @@ -444,6 +444,11 @@ table2Version = 200 ; indicatorOfParameter = 253 ; } +#Type of vegetation +'260643' = { + table2Version = 200 ; + indicatorOfParameter = 252 ; + } #Virtual temperature '300012' = { table2Version = 200 ; diff --git a/definitions/grib1/localConcepts/rjtd/shortName.def b/definitions/grib1/localConcepts/rjtd/shortName.def index 9e91f31b1..6bdefb2d9 100644 --- a/definitions/grib1/localConcepts/rjtd/shortName.def +++ b/definitions/grib1/localConcepts/rjtd/shortName.def @@ -444,6 +444,11 @@ table2Version = 200 ; indicatorOfParameter = 253 ; } +#Type of vegetation +'tovg' = { + table2Version = 200 ; + indicatorOfParameter = 252 ; + } #Virtual temperature 'vtmp' = { table2Version = 200 ; diff --git a/definitions/grib1/localConcepts/rjtd/stepType.def b/definitions/grib1/localConcepts/rjtd/stepType.def new file mode 100644 index 000000000..75956a310 --- /dev/null +++ b/definitions/grib1/localConcepts/rjtd/stepType.def @@ -0,0 +1,23 @@ +# stepType for JMA +# set uses the FIRST one +# get returns the LAST match + +"instant" = {timeRangeIndicator=1;} +"instant" = {timeRangeIndicator=10;} +"instant" = {timeRangeIndicator=0;} +"avg" = {timeRangeIndicator=3;} +"avgfc" = {timeRangeIndicator=113;} +"avgd" = {timeRangeIndicator=113;} +"accum" = {timeRangeIndicator=2;} +"accum" = {timeRangeIndicator=4;} +"diff" = {timeRangeIndicator=5;} +"avgua" = {timeRangeIndicator=123;} +"avgia" = {timeRangeIndicator=124;} + +# Specific to JMA +"avgas" = {timeRangeIndicator=128;} +"avgad" = {timeRangeIndicator=130;} + +"varas" = {timeRangeIndicator=129;} +"varad" = {timeRangeIndicator=131;} +"vari" = {timeRangeIndicator=132;} diff --git a/definitions/grib1/localConcepts/rjtd/typeOfLevel.def b/definitions/grib1/localConcepts/rjtd/typeOfLevel.def new file mode 100644 index 000000000..bf9f35ff1 --- /dev/null +++ b/definitions/grib1/localConcepts/rjtd/typeOfLevel.def @@ -0,0 +1,43 @@ +# Concepts for JMA levels +# +'surface' = {indicatorOfTypeOfLevel=1;} +'cloudBase' = {indicatorOfTypeOfLevel=2;} +'cloudTop' = {indicatorOfTypeOfLevel=3;} +'isothermZero' = {indicatorOfTypeOfLevel=4;} +'adiabaticCondensation' = {indicatorOfTypeOfLevel=5;} +'maxWind' = {indicatorOfTypeOfLevel=6;} +'tropopause' = {indicatorOfTypeOfLevel=7;} +'nominalTop' = {indicatorOfTypeOfLevel=8;} +'seaBottom' = {indicatorOfTypeOfLevel=9;} +'isobaricInhPa' = {indicatorOfTypeOfLevel=100;} +'isobaricInPa' = {indicatorOfTypeOfLevel=210;} +'isobaricLayer' = {indicatorOfTypeOfLevel=101;} +'meanSea' = {indicatorOfTypeOfLevel=102;} +'isobaricLayerHighPrecision' = {indicatorOfTypeOfLevel=121;} +'isobaricLayerMixedPrecision' = {indicatorOfTypeOfLevel=141;} +'heightAboveSea' = {indicatorOfTypeOfLevel=103;} +'heightAboveSeaLayer' = {indicatorOfTypeOfLevel=104;} +'heightAboveGroundHighPrecision' = {indicatorOfTypeOfLevel=125;} +'heightAboveGround' = {indicatorOfTypeOfLevel=105;} +'heightAboveGroundLayer' = {indicatorOfTypeOfLevel=106;} +'sigma' = {indicatorOfTypeOfLevel=107;} +'sigmaLayer' = {indicatorOfTypeOfLevel=108;} +'sigmaLayerHighPrecision' = {indicatorOfTypeOfLevel=128;} +'hybrid' = {indicatorOfTypeOfLevel=109;} +'hybridLayer' = {indicatorOfTypeOfLevel=110;} +'depthBelowLand' = {indicatorOfTypeOfLevel=111;} +'depthBelowLandLayer' = {indicatorOfTypeOfLevel=112;} +'theta' = {indicatorOfTypeOfLevel=113;} +'thetaLayer' = {indicatorOfTypeOfLevel=114;} +'pressureFromGround' = {indicatorOfTypeOfLevel=115;} +'pressureFromGroundLayer' = {indicatorOfTypeOfLevel=116;} +'potentialVorticity' = {indicatorOfTypeOfLevel=117;} +'depthBelowSea' = {indicatorOfTypeOfLevel=160;} +'entireAtmosphere' = {indicatorOfTypeOfLevel=200;level=0;} +'entireOcean' = {indicatorOfTypeOfLevel=201;level=0;} +# +# The following are specific to JMA +# +'deepSoil' = {indicatorOfTypeOfLevel=211;} +'subSurface' = {indicatorOfTypeOfLevel=212;} +'threeLayers' = {indicatorOfTypeOfLevel=213;} diff --git a/definitions/grib1/localConcepts/rjtd/units.def b/definitions/grib1/localConcepts/rjtd/units.def index 7ed2aa04a..2ab5b25fe 100644 --- a/definitions/grib1/localConcepts/rjtd/units.def +++ b/definitions/grib1/localConcepts/rjtd/units.def @@ -444,6 +444,11 @@ table2Version = 200 ; indicatorOfParameter = 253 ; } +#Type of vegetation +'Code Table JMA-252' = { + table2Version = 200 ; + indicatorOfParameter = 252 ; + } #Virtual temperature 'K' = { table2Version = 200 ; diff --git a/definitions/grib1/section.1.def b/definitions/grib1/section.1.def index 4934d7b31..bd19c0bf6 100644 --- a/definitions/grib1/section.1.def +++ b/definitions/grib1/section.1.def @@ -13,6 +13,10 @@ constant WMO= 0; constant conceptsMasterDir="grib1" : hidden; constant conceptsLocalDirECMF="grib1/localConcepts/ecmf" : hidden; constant conceptsLocalDirAll="grib1/localConcepts/[centre:s]" : hidden; + +constant tablesMasterDir="grib1" : hidden; +constant tablesLocalDir="grib1/local/[centre:s]" : hidden; + transient productionStatusOfProcessedData=0; position offsetSection1; length[3] section1Length ; @@ -51,52 +55,13 @@ codetable[1] indicatorOfParameter 'grib1/2.[centreForTable2:l].[table2Version:l] meta parameterName codetable_title(indicatorOfParameter); meta parameterUnits codetable_units(indicatorOfParameter); -codetable[1] indicatorOfTypeOfLevel 'grib1/3.table' : edition_specific,no_copy,dump,string_type; +codetable[1] indicatorOfTypeOfLevel ('3.table',tablesMasterDir,tablesLocalDir) : edition_specific,no_copy,dump,string_type; alias levelType=indicatorOfTypeOfLevel; transient pressureUnits="hPa"; -concept_nofail vertical.typeOfLevel (unknown) { -#set uses the last one -#get returns the first match - 'surface' = {indicatorOfTypeOfLevel=1;} - 'cloudBase' = {indicatorOfTypeOfLevel=2;} - 'cloudTop' = {indicatorOfTypeOfLevel=3;} - 'isothermZero' = {indicatorOfTypeOfLevel=4;} - 'adiabaticCondensation' = {indicatorOfTypeOfLevel=5;} - 'maxWind' = {indicatorOfTypeOfLevel=6;} - 'tropopause' = {indicatorOfTypeOfLevel=7;} - 'nominalTop' = {indicatorOfTypeOfLevel=8;} - 'seaBottom' = {indicatorOfTypeOfLevel=9;} - 'isobaricInhPa' = {indicatorOfTypeOfLevel=100;} - 'isobaricInPa' = {indicatorOfTypeOfLevel=210;} - 'isobaricLayer' = {indicatorOfTypeOfLevel=101;} - 'meanSea' = {indicatorOfTypeOfLevel=102;} - 'isobaricLayerHighPrecision' = {indicatorOfTypeOfLevel=121;} - 'isobaricLayerMixedPrecision' = {indicatorOfTypeOfLevel=141;} - 'heightAboveSea' = {indicatorOfTypeOfLevel=103;} - 'heightAboveSeaLayer' = {indicatorOfTypeOfLevel=104;} - 'heightAboveGroundHighPrecision' = {indicatorOfTypeOfLevel=125;} - 'heightAboveGround' = {indicatorOfTypeOfLevel=105;} - 'heightAboveGroundLayer' = {indicatorOfTypeOfLevel=106;} - 'sigma' = {indicatorOfTypeOfLevel=107;} - 'sigmaLayer' = {indicatorOfTypeOfLevel=108;} - 'sigmaLayerHighPrecision' = {indicatorOfTypeOfLevel=128;} - 'hybrid' = {indicatorOfTypeOfLevel=109;} - 'hybridLayer' = {indicatorOfTypeOfLevel=110;} - 'depthBelowLand' = {indicatorOfTypeOfLevel=111;} - 'depthBelowLandLayer' = {indicatorOfTypeOfLevel=112;} - 'theta' = {indicatorOfTypeOfLevel=113;} - 'thetaLayer' = {indicatorOfTypeOfLevel=114;} - 'pressureFromGround' = {indicatorOfTypeOfLevel=115;} - 'pressureFromGroundLayer' = {indicatorOfTypeOfLevel=116;} - 'potentialVorticity' = {indicatorOfTypeOfLevel=117;} - 'depthBelowSea' = {indicatorOfTypeOfLevel=160;} - 'entireAtmosphere' = {indicatorOfTypeOfLevel=200;level=0;} - 'entireOcean' = {indicatorOfTypeOfLevel=201;level=0;} - 'oceanWave' = {indicatorOfTypeOfLevel=211;} - 'oceanMixedLayer' = {indicatorOfTypeOfLevel=212;} -} +concept_nofail typeOfLevelECMF (unknown, "typeOfLevel.def",conceptsMasterDir,conceptsLocalDirECMF); +concept_nofail vertical.typeOfLevel (typeOfLevelECMF, "typeOfLevel.def",conceptsMasterDir,conceptsLocalDirAll); when ( typeOfLevel is "isobaricInPa" ) { set pressureUnits="Pa"; } else { set pressureUnits="hPa";} @@ -163,7 +128,7 @@ unsigned[1] P1 : edition_specific; unsigned[1] P2 : edition_specific; -codetable[1] timeRangeIndicator 'grib1/5.table' = 1 : dump,edition_specific; +codetable[1] timeRangeIndicator ('5.table',tablesMasterDir,tablesLocalDir) = 1 : dump,edition_specific; unsigned[2] numberIncludedInAverage; @@ -216,31 +181,7 @@ meta julianDay julian_day(dataDate,hour,minute,second) : edition_specific; codetable[1] stepUnits 'stepUnits.table' = 1 : transient,dump,no_copy; -concept stepType (timeRangeIndicator) { -#set uses the last one -#get returns the first match - "instant" = {timeRangeIndicator=14;} # Fields from DWD in MARS - "instant" = {timeRangeIndicator=1;} - "instant" = {timeRangeIndicator=10;} - "instant" = {timeRangeIndicator=0;} - "avg" = {timeRangeIndicator=3;} - "avgfc" = {timeRangeIndicator=113;} - "avgd" = {timeRangeIndicator=113;} - "accum" = {timeRangeIndicator=2;} - "accum" = {timeRangeIndicator=4;} - # Since grib1 has not min/max, we had to use our own convention - # therefore we set the centre to ECMWF (98) - "max" = {timeRangeIndicator=118;} - "max" = {timeRangeIndicator=2;centre=98;} - "min" = {timeRangeIndicator=119;} - "min" = {timeRangeIndicator=2;centre=98;} - "diff" = {timeRangeIndicator=5;} - "rms" = {timeRangeIndicator=120;} - "sd" = {timeRangeIndicator=121;} - "cov" = {timeRangeIndicator=122;} - "avgua" = {timeRangeIndicator=123;} - "avgia" = {timeRangeIndicator=124;} -} +concept_nofail stepType (timeRangeIndicator, "stepType.def", conceptsMasterDir, conceptsLocalDirAll) #alias stepTypeInternal=stepType; #alias lengthOfTimeRange=numberIncludedInAverage; @@ -286,6 +227,16 @@ alias mars.time = dataTime; meta marsParam mars_param(paramId,gribTablesVersionNo,indicatorOfParameter): read_only,dump; alias mars.param = marsParam; +# JRA55 stepTypes +#if (stepType is "avgas" || +# stepType is "avgad" || +# stepType is "varas" || +# stepType is "varad") +#{ +# alias mars.step = stepRange; +#} + + meta time.validityDate validity_date(dataDate,dataTime,step,stepUnits); meta time.validityTime validity_time(dataDate,dataTime,step,stepUnits); diff --git a/definitions/grib1/stepType.def b/definitions/grib1/stepType.def new file mode 100644 index 000000000..c8e138725 --- /dev/null +++ b/definitions/grib1/stepType.def @@ -0,0 +1,26 @@ +# Concept stepType +# set uses the FIRST one +# get returns the LAST match + +"instant" = {timeRangeIndicator=0;} +"instant" = {timeRangeIndicator=10;} +"instant" = {timeRangeIndicator=1;} + +"avg" = {timeRangeIndicator=3;} + +"avgd" = {timeRangeIndicator=113;} +"avgfc" = {timeRangeIndicator=113;} + +"accum" = {timeRangeIndicator=4;} +"accum" = {timeRangeIndicator=2;} + +# Since grib1 has not min/max, we had to use our own convention +# therefore we set the centre to ECMWF (98) +"min" = {timeRangeIndicator=2;centre=98;} +"min" = {timeRangeIndicator=119;} +"max" = {timeRangeIndicator=2;centre=98;} +"max" = {timeRangeIndicator=118;} + +"diff" = {timeRangeIndicator=5;} +"avgua" = {timeRangeIndicator=123;} +"avgia" = {timeRangeIndicator=124;} diff --git a/definitions/grib1/typeOfLevel.def b/definitions/grib1/typeOfLevel.def index 6c6717d99..1faa342a4 100644 --- a/definitions/grib1/typeOfLevel.def +++ b/definitions/grib1/typeOfLevel.def @@ -1,49 +1,38 @@ -######################### -# -# author: Sebastien Villaume -# created: 6 Oct 2011 -# modified: 20 Feb 2014 -# -######################### -# -# this file is needed when ecmwf conventions are desactivated -# note that it is only an extraction of a portion of section.1.def -# minus the ecmwf specific additions. -# The version including ecmwf specifics is proposed to be included -# in their local concepts. -# -# -'surface' = {indicatorOfTypeOfLevel=1;} -'cloudBase' = {indicatorOfTypeOfLevel=2;} -'cloudTop' = {indicatorOfTypeOfLevel=3;} -'isothermZero' = {indicatorOfTypeOfLevel=4;} -'adiabaticCondensation' = {indicatorOfTypeOfLevel=5;} -'maxWind' = {indicatorOfTypeOfLevel=6;} -'tropopause' = {indicatorOfTypeOfLevel=7;} -'nominalTop' = {indicatorOfTypeOfLevel=8;} -'seaBottom' = {indicatorOfTypeOfLevel=9;} -'isobaricInhPa' = {indicatorOfTypeOfLevel=100;} -'isobaricLayer' = {indicatorOfTypeOfLevel=101;} -'meanSea' = {indicatorOfTypeOfLevel=102;} -'isobaricLayerHighPrecision' = {indicatorOfTypeOfLevel=121;} +# ECMWF concept type of level +#set uses the last one +#get returns the first match +'surface' = {indicatorOfTypeOfLevel=1;} +'cloudBase' = {indicatorOfTypeOfLevel=2;} +'cloudTop' = {indicatorOfTypeOfLevel=3;} +'isothermZero' = {indicatorOfTypeOfLevel=4;} +'adiabaticCondensation' = {indicatorOfTypeOfLevel=5;} +'maxWind' = {indicatorOfTypeOfLevel=6;} +'tropopause' = {indicatorOfTypeOfLevel=7;} +'nominalTop' = {indicatorOfTypeOfLevel=8;} +'seaBottom' = {indicatorOfTypeOfLevel=9;} +'isobaricInhPa' = {indicatorOfTypeOfLevel=100;} +'isobaricInPa' = {indicatorOfTypeOfLevel=210;} +'isobaricLayer' = {indicatorOfTypeOfLevel=101;} +'meanSea' = {indicatorOfTypeOfLevel=102;} +'isobaricLayerHighPrecision' = {indicatorOfTypeOfLevel=121;} 'isobaricLayerMixedPrecision' = {indicatorOfTypeOfLevel=141;} -'heightAboveSea' = {indicatorOfTypeOfLevel=103;} -'heightAboveSeaLayer' = {indicatorOfTypeOfLevel=104;} +'heightAboveSea' = {indicatorOfTypeOfLevel=103;} +'heightAboveSeaLayer' = {indicatorOfTypeOfLevel=104;} 'heightAboveGroundHighPrecision' = {indicatorOfTypeOfLevel=125;} -'heightAboveGround' = {indicatorOfTypeOfLevel=105;} -'heightAboveGroundLayer' = {indicatorOfTypeOfLevel=106;} -'sigma' = {indicatorOfTypeOfLevel=107;} -'sigmaLayer' = {indicatorOfTypeOfLevel=108;} +'heightAboveGround' = {indicatorOfTypeOfLevel=105;} +'heightAboveGroundLayer' = {indicatorOfTypeOfLevel=106;} +'sigma' = {indicatorOfTypeOfLevel=107;} +'sigmaLayer' = {indicatorOfTypeOfLevel=108;} 'sigmaLayerHighPrecision' = {indicatorOfTypeOfLevel=128;} -'hybrid' = {indicatorOfTypeOfLevel=109;} -'hybridLayer' = {indicatorOfTypeOfLevel=110;} -'depthBelowLand' = {indicatorOfTypeOfLevel=111;} -'depthBelowLandLayer' = {indicatorOfTypeOfLevel=112;} -'theta' = {indicatorOfTypeOfLevel=113;} -'thetaLayer' = {indicatorOfTypeOfLevel=114;} -'pressureFromGround' = {indicatorOfTypeOfLevel=115;} +'hybrid' = {indicatorOfTypeOfLevel=109;} +'hybridLayer' = {indicatorOfTypeOfLevel=110;} +'depthBelowLand' = {indicatorOfTypeOfLevel=111;} +'depthBelowLandLayer' = {indicatorOfTypeOfLevel=112;} +'theta' = {indicatorOfTypeOfLevel=113;} +'thetaLayer' = {indicatorOfTypeOfLevel=114;} +'pressureFromGround' = {indicatorOfTypeOfLevel=115;} 'pressureFromGroundLayer' = {indicatorOfTypeOfLevel=116;} -'potentialVorticity' = {indicatorOfTypeOfLevel=117;} -'depthBelowSea' = {indicatorOfTypeOfLevel=160;} -'entireAtmosphere' = {indicatorOfTypeOfLevel=200;} -'entireOcean' = {indicatorOfTypeOfLevel=201;} +'potentialVorticity' = {indicatorOfTypeOfLevel=117;} +'depthBelowSea' = {indicatorOfTypeOfLevel=160;} +'entireAtmosphere' = {indicatorOfTypeOfLevel=200;} +'entireOcean' = {indicatorOfTypeOfLevel=201;} diff --git a/src/action_class_concept.c b/src/action_class_concept.c index 0b2144a3a..a221499b2 100644 --- a/src/action_class_concept.c +++ b/src/action_class_concept.c @@ -97,294 +97,298 @@ static void init_class(grib_action_class* c) static grib_concept_value* get_concept(grib_handle* h,grib_action_concept* self); grib_action* grib_action_create_concept( grib_context* context, - const char* name, - grib_concept_value* concept, - const char* basename,const char* name_space,const char* defaultkey, - const char* masterDir,const char* localDir,const char* ecmfDir,int flags,int nofail ) + const char* name, + grib_concept_value* concept, + const char* basename,const char* name_space,const char* defaultkey, + const char* masterDir,const char* localDir,const char* ecmfDir,int flags,int nofail ) { - grib_action_concept* a=NULL ; - grib_action_class* c = grib_action_class_concept; - grib_action* act = (grib_action*)grib_context_malloc_clear_persistent(context,c->size); - act->op = grib_context_strdup_persistent(context,"concept"); + grib_action_concept* a=NULL ; + grib_action_class* c = grib_action_class_concept; + grib_action* act = (grib_action*)grib_context_malloc_clear_persistent(context,c->size); + act->op = grib_context_strdup_persistent(context,"concept"); - act->cclass = c; - a=(grib_action_concept*)act ; - act->context = context; - act->flags = flags; + act->cclass = c; + a=(grib_action_concept*)act ; + act->context = context; + act->flags = flags; - if (name_space) - act->name_space = grib_context_strdup_persistent(context,name_space); + if (name_space) + act->name_space = grib_context_strdup_persistent(context,name_space); - if (basename) - a->basename= grib_context_strdup_persistent(context,basename); - else a->basename=NULL; - - if (masterDir) - a->masterDir= grib_context_strdup_persistent(context,masterDir); - else a->masterDir=NULL; + if (basename) + a->basename= grib_context_strdup_persistent(context,basename); + else a->basename=NULL; - if (localDir) - a->localDir= grib_context_strdup_persistent(context,localDir); - else a->localDir=NULL; + if (masterDir) + a->masterDir= grib_context_strdup_persistent(context,masterDir); + else a->masterDir=NULL; - if (defaultkey) - act->defaultkey = grib_context_strdup_persistent(context,defaultkey); + if (localDir) + a->localDir= grib_context_strdup_persistent(context,localDir); + else a->localDir=NULL; - a->concept = concept; - if (concept) { - grib_concept_value* c=concept; - grib_trie* index=grib_trie_new(context); - while (c) { - c->index=index; - grib_trie_insert_no_replace(index,c->name,c); - c=c->next; - } - } - act->name = grib_context_strdup_persistent(context,name); + if (defaultkey) + act->defaultkey = grib_context_strdup_persistent(context,defaultkey); - a->nofail=nofail; + a->concept = concept; + if (concept) { + grib_concept_value* c=concept; + grib_trie* index=grib_trie_new(context); + while (c) { + c->index=index; + grib_trie_insert_no_replace(index,c->name,c); + c=c->next; + } + } + act->name = grib_context_strdup_persistent(context,name); - return act; + a->nofail=nofail; + + return act; } static void dump(grib_action* act, FILE* f, int lvl) { - int i = 0; + int i = 0; - for (i=0;icontext,f," "); + for (i=0;icontext,f," "); - printf("concept(%s) { ",act->name); - printf("\n"); + printf("concept(%s) { ",act->name); + printf("\n"); - for (i=0;icontext,f," "); - printf("}\n"); + for (i=0;icontext,f," "); + printf("}\n"); } static void destroy(grib_context* context,grib_action* act) { - grib_action_concept* self = (grib_action_concept*) act; + grib_action_concept* self = (grib_action_concept*) act; - grib_concept_value * v = self->concept; - if (v) grib_trie_delete(v->index); - while(v) - { - grib_concept_value* n = v->next; - grib_concept_value_delete(context,v); - v = n; - } - grib_context_free_persistent(context, self->masterDir); - grib_context_free_persistent(context, self->localDir); - grib_context_free_persistent(context, self->basename); + grib_concept_value * v = self->concept; + if (v) grib_trie_delete(v->index); + while(v) + { + grib_concept_value* n = v->next; + grib_concept_value_delete(context,v); + v = n; + } + grib_context_free_persistent(context, self->masterDir); + grib_context_free_persistent(context, self->localDir); + grib_context_free_persistent(context, self->basename); } static grib_concept_value* get_concept(grib_handle* h,grib_action_concept* self) { - char buf[1024]={0,}; - char master[1024]={0,}; - char local[1024]={0,}; - char masterDir[1024]={0,}; - size_t lenMasterDir=1024; - char localDir[1024]={0,}; - size_t lenLocalDir=1024; - char key[1024]={0,}; - char* full=0; - int id; + char buf[1024]={0,}; + char master[1024]={0,}; + char local[1024]={0,}; + char masterDir[1024]={0,}; + size_t lenMasterDir=1024; + char localDir[1024]={0,}; + size_t lenLocalDir=1024; + char key[1024]={0,}; + char* full=0; + int id; - grib_context* context=((grib_action*)self)->context; - grib_concept_value* c=NULL; + grib_context* context=((grib_action*)self)->context; + grib_concept_value* c=NULL; - if (self->concept != NULL) - return self->concept; + if (self->concept != NULL) + return self->concept; - Assert(self->masterDir); - grib_get_string(h,self->masterDir,masterDir,&lenMasterDir); + Assert(self->masterDir); + grib_get_string(h,self->masterDir,masterDir,&lenMasterDir); - sprintf(buf,"%s/%s",masterDir,self->basename); + sprintf(buf,"%s/%s",masterDir,self->basename); - grib_recompose_name(h,NULL, buf, master,1); - - if (self->localDir) { - grib_get_string(h,self->localDir,localDir,&lenLocalDir); - sprintf(buf,"%s/%s",localDir,self->basename); - grib_recompose_name(h,NULL, buf, local,1); - } + grib_recompose_name(h,NULL, buf, master,1); - sprintf(key,"%s%s",master,local); - - id=grib_itrie_get_id(h->context->concepts_index,key); - if ((c=h->context->concepts[id])!=NULL) return c; + if (self->localDir) { + grib_get_string(h,self->localDir,localDir,&lenLocalDir); + sprintf(buf,"%s/%s",localDir,self->basename); + grib_recompose_name(h,NULL, buf, local,1); + } - if (*local && (full=grib_context_full_defs_path(context,local))!=NULL) { - c=grib_parse_concept_file(context,full); - grib_context_log(h->context,GRIB_LOG_DEBUG, - "Loading concept %s from %s",((grib_action*)self)->name,full); - } + sprintf(key,"%s%s",master,local); - if ((full=grib_context_full_defs_path(context,master))==NULL) { - grib_context_log(h->context,GRIB_LOG_ERROR, - "Loading %s: Unable to find definition file %s in %s\nDefinition files path=\"%s\"", - ((grib_action*)self)->name, - self->basename, master, context->grib_definition_files_path); - return NULL; - } - - if(c) { - grib_concept_value* last=c; - while (last->next) last=last->next; - last->next=grib_parse_concept_file(context,full); - } else - c=grib_parse_concept_file(context,full); - - grib_context_log(h->context,GRIB_LOG_DEBUG, - "Loading concept %s from %s",((grib_action*)self)->name,full); + id=grib_itrie_get_id(h->context->concepts_index,key); + if ((c=h->context->concepts[id])!=NULL) return c; - h->context->concepts[id]=c; - if (c) { - grib_trie* index=grib_trie_new(context); - while (c) { - c->index=index; - grib_trie_insert_no_replace(index,c->name,c); - c=c->next; - } - } + if (*local && (full=grib_context_full_defs_path(context,local))!=NULL) { + c=grib_parse_concept_file(context,full); + grib_context_log(h->context,GRIB_LOG_DEBUG, + "Loading concept %s from %s",((grib_action*)self)->name,full); + } - return h->context->concepts[id]; + full=grib_context_full_defs_path(context,master); + + if(c) { + grib_concept_value* last=c; + while (last->next) last=last->next; + if (full) { + last->next=grib_parse_concept_file(context,full); + } + } else if (full) { + c=grib_parse_concept_file(context,full); + } else { + grib_context_log(context,GRIB_LOG_FATAL, + "unable to find definition file %s in %s:%s\nDefinition files path=\"%s\"", + self->basename,master,local,context->grib_definition_files_path); + return NULL; + } + + if (full) { + grib_context_log(h->context,GRIB_LOG_DEBUG, + "Loading concept %s from %s",((grib_action*)self)->name,full); + } + + h->context->concepts[id]=c; + if (c) { + grib_trie* index=grib_trie_new(context); + while (c) { + c->index=index; + grib_trie_insert_no_replace(index,c->name,c); + c=c->next; + } + } + + return h->context->concepts[id]; } const char* grib_concept_evaluate(grib_handle* h,grib_action* act) { - grib_action_concept* self = (grib_action_concept*) act; - grib_concept_value* c = get_concept(h,self); - int match = 0; - const char* best = 0; - const char* prev = 0; + grib_action_concept* self = (grib_action_concept*) act; + grib_concept_value* c = get_concept(h,self); + int match = 0; + const char* best = 0; + const char* prev = 0; - while(c) - { - grib_concept_condition* e = c->conditions; - int cnt = 0; - while(e) + while(c) { - long lval; - double dval; - long lres=0; - double dres=0.0; - const char *cval; - char buf[80]; - char tmp[80]; - size_t len = sizeof(buf); - size_t size=sizeof(tmp); - int err=0; - int ok = 0; - int type = grib_expression_native_type(h,e->expression); + grib_concept_condition* e = c->conditions; + int cnt = 0; + while(e) + { + long lval; + double dval; + long lres=0; + double dres=0.0; + const char *cval; + char buf[80]; + char tmp[80]; + size_t len = sizeof(buf); + size_t size=sizeof(tmp); + int err=0; + int ok = 0; + int type = grib_expression_native_type(h,e->expression); - switch(type) - { - case GRIB_TYPE_LONG: - grib_expression_evaluate_long(h,e->expression,&lres); - ok = (grib_get_long(h,e->name,&lval) == GRIB_SUCCESS) && - (lval == lres); - break; + switch(type) + { + case GRIB_TYPE_LONG: + grib_expression_evaluate_long(h,e->expression,&lres); + ok = (grib_get_long(h,e->name,&lval) == GRIB_SUCCESS) && + (lval == lres); + break; - case GRIB_TYPE_DOUBLE: - grib_expression_evaluate_double(h,e->expression,&dres); - ok = (grib_get_double(h,e->name,&dval) == GRIB_SUCCESS) && - (dval == dres); - break; + case GRIB_TYPE_DOUBLE: + grib_expression_evaluate_double(h,e->expression,&dres); + ok = (grib_get_double(h,e->name,&dval) == GRIB_SUCCESS) && + (dval == dres); + break; - case GRIB_TYPE_STRING: - ok = (grib_get_string(h,e->name,buf,&len) == GRIB_SUCCESS) && - ((cval = grib_expression_evaluate_string(h,e->expression,tmp,&size,&err)) != NULL) && - (err==0) && (strcmp(buf,cval) == 0); - break; + case GRIB_TYPE_STRING: + ok = (grib_get_string(h,e->name,buf,&len) == GRIB_SUCCESS) && + ((cval = grib_expression_evaluate_string(h,e->expression,tmp,&size,&err)) != NULL) && + (err==0) && (strcmp(buf,cval) == 0); + break; - default: - /* TODO: */ - break; - } + default: + /* TODO: */ + break; + } - if(!ok) - break; + if(!ok) + break; - e = e->next; - cnt++; + e = e->next; + cnt++; + } + + if(e == NULL) + { + if(cnt >= match) { + prev = (cnt > match) ? NULL : best; + match = cnt; + best = c->name; + } + } + + c = c->next; } - if(e == NULL) - { - if(cnt >= match) { - prev = (cnt > match) ? NULL : best; - match = cnt; - best = c->name; - } - } - - c = c->next; - } - - return best; + return best; } int grib_concept_apply(grib_handle* h,grib_action* act,const char* name) { - long lres=0; - double dres=0.0; - int err=0; - size_t count = 0; - size_t size; - grib_concept_condition* e=NULL; - grib_values values[1024]; - char tmp[80][1024]; - grib_action_concept* self = (grib_action_concept*) act; - grib_concept_value* concepts = get_concept(h,self); - grib_concept_value* c=NULL; + long lres=0; + double dres=0.0; + int err=0; + size_t count = 0; + size_t size; + grib_concept_condition* e=NULL; + grib_values values[1024]; + char tmp[80][1024]; + grib_action_concept* self = (grib_action_concept*) act; + grib_concept_value* concepts = get_concept(h,self); + grib_concept_value* c=NULL; Assert(concepts!=NULL); - c=grib_trie_get(concepts->index,name); + c=grib_trie_get(concepts->index,name); - if (!c) c=grib_trie_get(concepts->index,"default"); - - if (!c){ - err= self->nofail ? GRIB_SUCCESS : GRIB_CONCEPT_NO_MATCH; - if (err) grib_context_log(h->context,GRIB_LOG_ERROR, - "concept: no match for %s=%s", act->name,name); - return err; - } - - e = c->conditions; - while(e) - { - Assert(count<1024); - values[count].name = e->name; + if (!c) c=grib_trie_get(concepts->index,"default"); - values[count].type = grib_expression_native_type(h,e->expression); - switch(values[count].type) - { - case GRIB_TYPE_LONG: - grib_expression_evaluate_long(h,e->expression,&lres); - values[count].long_value = lres; - break; - case GRIB_TYPE_DOUBLE: - grib_expression_evaluate_double(h,e->expression,&dres); - values[count].double_value = dres; - break; - case GRIB_TYPE_STRING: - size = sizeof(tmp[count]); - values[count].string_value = - grib_expression_evaluate_string(h,e->expression,tmp[count],&size,&err); - break; + if (!c){ + err= self->nofail ? GRIB_SUCCESS : GRIB_CONCEPT_NO_MATCH; + if (err) grib_context_log(h->context,GRIB_LOG_ERROR, + "concept: no match for %s=%s", act->name,name); + return err; + } - default: - return GRIB_NOT_IMPLEMENTED; - break; - } + e = c->conditions; + while(e) + { + Assert(count<1024); + values[count].name = e->name; - count++; - e = e->next; - } + values[count].type = grib_expression_native_type(h,e->expression); + switch(values[count].type) + { + case GRIB_TYPE_LONG: + grib_expression_evaluate_long(h,e->expression,&lres); + values[count].long_value = lres; + break; + case GRIB_TYPE_DOUBLE: + grib_expression_evaluate_double(h,e->expression,&dres); + values[count].double_value = dres; + break; + case GRIB_TYPE_STRING: + size = sizeof(tmp[count]); + values[count].string_value = + grib_expression_evaluate_string(h,e->expression,tmp[count],&size,&err); + break; - return grib_set_values(h,values,count); + default: + return GRIB_NOT_IMPLEMENTED; + break; + } + + count++; + e = e->next; + } + + return grib_set_values(h,values,count); } diff --git a/src/grib_accessor_class_g1step_range.c b/src/grib_accessor_class_g1step_range.c index 6aa7ec39b..54bb04731 100644 --- a/src/grib_accessor_class_g1step_range.c +++ b/src/grib_accessor_class_g1step_range.c @@ -219,7 +219,8 @@ static int u2s[] = { }; -int grib_g1_step_get_steps(grib_accessor* a,long* start,long* theEnd) { +int grib_g1_step_get_steps(grib_accessor* a,long* start,long* theEnd) +{ grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; int err = 0; long p1 = 0,p2 = 0,unit = 0,timeRangeIndicator=0,timeRangeIndicatorFromStepRange=0; @@ -291,7 +292,8 @@ int grib_g1_step_get_steps(grib_accessor* a,long* start,long* theEnd) { return 0; } -static int unpack_string(grib_accessor* a, char* val, size_t *len) { +static int unpack_string(grib_accessor* a, char* val, size_t *len) +{ grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; char buf[100]; size_t size=0; @@ -350,8 +352,12 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len) { (strcmp(stepType,"min") == 0) || (strcmp(stepType,"max") == 0) || (strcmp(stepType,"rms") == 0) || - (strcmp(stepType,"diff") == 0) - ) + (strcmp(stepType,"diff") == 0) || + (strcmp(stepType,"avgas") == 0) || + (strcmp(stepType,"avgad") == 0) || + (strcmp(stepType,"varas") == 0) || + (strcmp(stepType,"varad") == 0) || + (strcmp(stepType,"vari") == 0) ) { if(start == theEnd) { sprintf(buf,"%ld",theEnd); @@ -379,7 +385,8 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len) { int grib_g1_step_apply_units(long *start,long *theEnd,long* step_unit, long *P1,long *P2,long* unit, - const int max,const int instant) { + const int max,const int instant) +{ int j=0; long start_sec,end_sec; int index=0; @@ -430,7 +437,8 @@ int grib_g1_step_apply_units(long *start,long *theEnd,long* step_unit, return GRIB_WRONG_STEP; } -static int pack_string(grib_accessor* a, const char* val, size_t *len){ +static int pack_string(grib_accessor* a, const char* val, size_t *len) +{ grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; grib_handle* h=a->parent->h; long timeRangeIndicator=0,P1=0,P2=0; @@ -647,12 +655,14 @@ static int pack_long(grib_accessor* a, const long* val, size_t *len) return pack_string( a,buff,&bufflen); default : Assert(self->pack_index<2); + break; } return GRIB_INTERNAL_ERROR; } -static int unpack_long(grib_accessor* a, long* val, size_t *len) { +static int unpack_long(grib_accessor* a, long* val, size_t *len) +{ grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; char buff[100]; size_t bufflen=100; @@ -679,11 +689,13 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len) { return 0; } -static int get_native_type(grib_accessor* a){ +static int get_native_type(grib_accessor* a) +{ return GRIB_TYPE_STRING; } -static void destroy(grib_context* c,grib_accessor* a) { +static void destroy(grib_context* c,grib_accessor* a) +{ grib_accessor_g1step_range *self = (grib_accessor_g1step_range*)a; grib_context_free(c,self->v); } diff --git a/src/grib_accessor_class_statistics.c b/src/grib_accessor_class_statistics.c index 98ed25f83..cfa7bb933 100644 --- a/src/grib_accessor_class_statistics.c +++ b/src/grib_accessor_class_statistics.c @@ -161,8 +161,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len) grib_accessor_statistics* self = (grib_accessor_statistics*)a; int ret = 0,i=0; double* values; - size_t size=0; - double max,min,avg,sd,value,skew,kurt,x; + size_t size=0, real_size=0; + double max,min,avg,sd,value,skew,kurt, m2=0,m3=0,m4=0; double missing=0; size_t number_of_missing=0; grib_context* c=a->parent->h->context; @@ -209,17 +209,25 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len) sd=0; skew=0; kurt=0; for (i=0;idirty=0; grib_context_free(c,values); @@ -241,8 +249,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len) static int value_count(grib_accessor* a,long* count) { grib_accessor_statistics* self = (grib_accessor_statistics*)a; - *count=self->number_of_elements; - return 0; + *count=self->number_of_elements; + return 0; } static void destroy(grib_context* c,grib_accessor* a) diff --git a/tigge/tigge_check.c b/tigge/tigge_check.c index 1ae21857c..d8a832cf2 100755 --- a/tigge/tigge_check.c +++ b/tigge/tigge_check.c @@ -18,6 +18,7 @@ #include #include #include +#include #define CHECK(a) check(#a,a) #define WARN(a) warn(#a,a) @@ -25,7 +26,9 @@ typedef struct pair { const char* key; - long value; + int key_type; + long value_long; + char* value_string; } pair; typedef struct parameter parameter; @@ -312,6 +315,7 @@ void gaussian_grid(grib_handle* h) } + static void check_range(grib_handle* h,const parameter* p,double min,double max) { if(!valueflg) @@ -349,15 +353,18 @@ static void point_in_time(grib_handle* h,const parameter* p,double min,double ma case 3: /* Control forecast products */ CHECK(eq(h,"productDefinitionTemplateNumber",1)); - CHECK(eq(h,"perturbationNumber",0)); + CHECK(eq(h,"perturbationNumber",0)); CHECK(ne(h,"numberOfForecastsInEnsemble",0)); break; case 4: /* Perturbed forecast products */ + CHECK(ne(h,"perturbationNumber",0)); + CHECK(ne(h,"numberOfForecastsInEnsemble",0)); CHECK(eq(h,"productDefinitionTemplateNumber",1)); if (is_lam) { CHECK(le(h,"perturbationNumber",get(h,"numberOfForecastsInEnsemble"))); } else { + /* Is there always cf in tigge global datasets?? */ CHECK(le(h,"perturbationNumber",get(h,"numberOfForecastsInEnsemble")-1)); } break; @@ -581,7 +588,7 @@ static void given_level(grib_handle* h,const parameter* p,double min,double max) CHECK(eq(h,"typeOfSecondFixedSurface",255)); CHECK(missing(h,"scaleFactorOfSecondFixedSurface")); - CHECK(missing(h,"scaleFactorOfSecondFixedSurface")); + CHECK(missing(h,"scaledValueOfSecondFixedSurface")); } static void predefined_level(grib_handle* h,const parameter* p,double min,double max) @@ -592,7 +599,7 @@ static void predefined_level(grib_handle* h,const parameter* p,double min,double CHECK(eq(h,"typeOfSecondFixedSurface",255)); CHECK(missing(h,"scaleFactorOfSecondFixedSurface")); - CHECK(missing(h,"scaleFactorOfSecondFixedSurface")); + CHECK(missing(h,"scaledValueOfSecondFixedSurface")); } static void predefined_thickness(grib_handle* h,const parameter* p,double min,double max) @@ -603,7 +610,7 @@ static void predefined_thickness(grib_handle* h,const parameter* p,double min,do CHECK(ne(h,"typeOfSecondFixedSurface",255)); CHECK(missing(h,"scaleFactorOfSecondFixedSurface")); - CHECK(missing(h,"scaleFactorOfSecondFixedSurface")); + CHECK(missing(h,"scaledValueOfSecondFixedSurface")); } static void given_thickness(grib_handle* h,const parameter* p,double min,double max) @@ -614,7 +621,7 @@ static void given_thickness(grib_handle* h,const parameter* p,double min,double CHECK(ne(h,"typeOfSecondFixedSurface",255)); CHECK(!missing(h,"scaleFactorOfSecondFixedSurface")); - CHECK(!missing(h,"scaleFactorOfSecondFixedSurface")); + CHECK(!missing(h,"scaledValueOfSecondFixedSurface")); } void latlon_grid(grib_handle* h) @@ -733,7 +740,7 @@ void latlon_grid(grib_handle* h) void check_parameter(grib_handle* h,double min,double max) { - int i; + int i, err; int best = -1; int match = -1; @@ -744,11 +751,34 @@ void check_parameter(grib_handle* h,double min,double max) while(parameters[i].pairs[j].key != NULL) { long val = -1; - if(grib_get_long(h,parameters[i].pairs[j].key,&val) == GRIB_SUCCESS) - if(parameters[i].pairs[j].value == val) - matches++; - /* printf("%s %ld val -> %ld\n",parameters[i].pairs[j].key,parameters[i].pairs[j].value,val); */ + const int ktype = parameters[i].pairs[j].key_type; + if (ktype == GRIB_TYPE_LONG) { + if(grib_get_long(h,parameters[i].pairs[j].key,&val) == GRIB_SUCCESS) { + if(parameters[i].pairs[j].value_long == val) { + matches++; + } + } + } + else if (ktype == GRIB_TYPE_STRING) { + char strval[256]={0,}; + size_t len = 256; + if (strcasecmp(parameters[i].pairs[j].value_string,"MISSING")==0) { + int is_miss = grib_is_missing(h, parameters[i].pairs[j].key, &err); + if (err == GRIB_SUCCESS && is_miss) { + matches++; + } + } + else if(grib_get_string(h,parameters[i].pairs[j].key,strval,&len) == GRIB_SUCCESS) { + if(strcmp(parameters[i].pairs[j].value_string, strval) == 0) { + matches++; + } + } + } + else { + assert(!"Unknown key type"); + } j++; + /* printf("%s %ld val -> %d %d %ld %d\n",parameters[i].pairs[j].key,parameters[i].pairs[j].value,val,matches,j,best); */ } if(matches == j && matches > best) @@ -761,15 +791,26 @@ void check_parameter(grib_handle* h,double min,double max) if(match >= 0) { + /*int j = 0;*/ param = parameters[match].name; i = 0; while(parameters[match].checks[i]) (*parameters[match].checks[i++])(h,¶meters[match],min,max); - +/* + printf("=========================\n"); + printf("%s -> %d %d\n",param, match, best); + while(parameters[match].pairs[j].key != NULL) + { + printf("%s val -> %ld %d\n",parameters[match].pairs[j].key,parameters[match].pairs[j].value,j); + j++; + } + printf("matched parameter: %s\n", param); +*/ } else { printf("%s, field %d [%s]: cannot match parameter\n",file,field,param); + X(origin); X(discipline); X(parameterCategory); X(parameterNumber); @@ -784,6 +825,7 @@ void check_parameter(grib_handle* h,double min,double max) } } + void verify(grib_handle* h) { double min = 0,max = 0; @@ -791,82 +833,6 @@ void verify(grib_handle* h) CHECK(eq(h,"editionNumber",2)); CHECK(missing(h,"reserved") || eq(h,"reserved",0)); - /* Section 1 */ - - CHECK(ge(h,"gribMasterTablesVersionNumber",4)); - CHECK(eq(h,"versionNumberOfGribLocalTables",0)); /* Local tables not used */ - - CHECK(eq(h,"significanceOfReferenceTime",1)); /* Start of forecast */ - - /* Check if the date is OK */ - { - long date = get(h,"date"); - /* CHECK(date > 20060101); */ - - CHECK( (date / 10000) == get(h,"year")); - CHECK( ((date % 10000) / 100) == get(h,"month")); - CHECK( ((date % 100)) == get(h,"day")); - } - - /* Only 00, 06 12 and 18 Cycle OK */ - CHECK(eq(h,"hour",0) || eq(h,"hour",6) || eq(h,"hour",12) || eq(h,"hour",18)); - CHECK(eq(h,"minute",0)); - CHECK(eq(h,"second",0)); - - CHECK(eq(h,"productionStatusOfProcessedData",4)||eq(h,"productionStatusOfProcessedData",5)); /* TIGGE Operational */ - - if (!is_lam){ - CHECK((get(h,"step") % 6) == 0); - } - else - { - CHECK((get(h,"step") % 3) == 0); - } - CHECK(ge(h,"startStep",0)); - CHECK(le(h,"endStep",30*24)); - - /* 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 */ - /* CHECK(eq(h,"section2.sectionLength",5)); */ - - /* Section 3 */ - - CHECK(eq(h,"sourceOfGridDefinition",0)); /* Specified in Code table 3.1 */ - - switch(get(h,"gridDefinitionTemplateNumber")) - { - case 0: - case 1: /*rotated latlon*/ - latlon_grid(h); - break; - - case 40: - gaussian_grid(h); - break; - - - default: - printf("%s, field %d [%s]: Unsupported gridDefinitionTemplateNumber %ld\n", - file,field,param, - get(h,"gridDefinitionTemplateNumber")); - error++; - return; - break; - } - - /* If there is no bitmap, this should be true */ - /* CHECK(eq(h,"bitMapIndicator",255));*/ - - if(eq(h,"bitMapIndicator",255)) - CHECK(get(h,"numberOfValues") == get(h,"numberOfDataPoints")); - else - CHECK(get(h,"numberOfValues") <= get(h,"numberOfDataPoints")); - - /* Check values */ - CHECK(eq(h,"typeOfOriginalFieldValues",0)); /* Floating point */ - if (valueflg) { @@ -933,8 +899,92 @@ void verify(grib_handle* h) } free(values); } + check_parameter(h,min,max); + /* Section 1 */ + + CHECK(ge(h,"gribMasterTablesVersionNumber",4)); + CHECK(eq(h,"versionNumberOfGribLocalTables",0)); /* Local tables not used */ + + CHECK(eq(h,"significanceOfReferenceTime",1)); /* Start of forecast */ + + /* Check if the date is OK */ + { + long date = get(h,"date"); + /* CHECK(date > 20060101); */ + + CHECK( (date / 10000) == get(h,"year")); + CHECK( ((date % 10000) / 100) == get(h,"month")); + CHECK( ((date % 100)) == get(h,"day")); + } + + /* Only 00, 06 12 and 18 Cycle OK */ + if (!is_lam){ + CHECK(eq(h,"hour",0) || eq(h,"hour",6) || eq(h,"hour",12) || eq(h,"hour",18)); + } + else + { + CHECK(eq(h,"hour",0) || eq(h,"hour",3) || eq(h,"hour",6) || eq(h,"hour",9) || eq(h,"hour",12) || eq(h,"hour",15) || eq(h,"hour",18) || eq(h,"hour",21)); + } + CHECK(eq(h,"minute",0)); + CHECK(eq(h,"second",0)); + + CHECK(eq(h,"productionStatusOfProcessedData",4)||eq(h,"productionStatusOfProcessedData",5)); /* TIGGE Operational */ + + if (!is_lam){ + CHECK((get(h,"step") % 6) == 0); + } + else + { + CHECK((get(h,"step") % 3) == 0); + } + CHECK(ge(h,"startStep",0)); + CHECK(le(h,"endStep",30*24)); + + /* 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 */ + /* CHECK(eq(h,"section2.sectionLength",5)); */ + + /* Section 3 */ + + CHECK(eq(h,"sourceOfGridDefinition",0)); /* Specified in Code table 3.1 */ + + switch(get(h,"gridDefinitionTemplateNumber")) + { + case 0: + case 1: /*rotated latlon*/ + latlon_grid(h); + break; + + case 40: + gaussian_grid(h); + break; + + + default: + printf("%s, field %d [%s]: Unsupported gridDefinitionTemplateNumber %ld\n", + file,field,param, + get(h,"gridDefinitionTemplateNumber")); + error++; + return; + break; + } + + /* If there is no bitmap, this should be true */ + /* CHECK(eq(h,"bitMapIndicator",255));*/ + + if(eq(h,"bitMapIndicator",255)) + CHECK(get(h,"numberOfValues") == get(h,"numberOfDataPoints")); + else + CHECK(get(h,"numberOfValues") <= get(h,"numberOfDataPoints")); + + /* Check values */ + CHECK(eq(h,"typeOfOriginalFieldValues",0)); /* Floating point */ + + } void validate(const char* path) diff --git a/tigge/tigge_check.h b/tigge/tigge_check.h index 65ca1b7e5..527ed940c 100644 --- a/tigge/tigge_check.h +++ b/tigge/tigge_check.h @@ -7,72 +7,327 @@ * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ + parameter parameters[] = { { - "10_meter_u_velocity_sfc", + "10_meter_u_velocity_sfc.glob", -100, -1, 1, 100, { - {"discipline", 0}, - {"parameterCategory", 2}, - {"parameterNumber", 2}, - {"scaleFactorOfFirstFixedSurface", 0}, - {"scaledValueOfFirstFixedSurface", 10}, - {"typeOfFirstFixedSurface", 103}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 2}, + + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, {NULL, }, }, {&point_in_time, &given_level}, }, { - "10_meter_v_velocity_sfc", + "10_meter_u_velocity_sfc.lam", -100, -1, 1, 100, { - {"discipline", 0}, - {"parameterCategory", 2}, - {"parameterNumber", 3}, - {"scaleFactorOfFirstFixedSurface", 0}, - {"scaledValueOfFirstFixedSurface", 10}, - {"typeOfFirstFixedSurface", 103}, + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 165}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 2}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + +/* + MOGREPS (origin = 1(mogreps-mo-eua)) + 2014-01-10: minimum limit for 10_meter_u_velocity_sfc changed to <-100,5> because of 2014010715_00+0000 +*/ + { + "10_meter_u_velocity_sfc.lam.mogreps-mo-eua", + -100, + 5, + 1, + 100, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 1, "mogreps-mo-eua"}, + + {"paramId", GRIB_TYPE_LONG, 165}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 2}, + + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, {NULL, }, }, {&point_in_time, &given_level}, }, { - "convective_available_potential_energy_sfc", + "10_meter_v_velocity_sfc.glob", + -100, + -1, + 1, + 100, + { + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 3}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + + { + "10_meter_v_velocity_sfc.lam", + -100, + -1, + 1, + 100, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 166}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 3}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + +/* + MOGREPS (origin = 1(mogreps-mo-eua)) set up for 10_meter_u_velocity_sfc + 2014-01-08: minimum limit for 10_meter_v_velocity_sfc changed to <-100,10> because of one early January forecast.. +*/ + { + "10_meter_v_velocity_sfc.lam.mogreps-mo-eua", + -100, + 10, + 1, + 100, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 1, "mogreps-mo-eua"}, + + {"paramId", GRIB_TYPE_LONG, 166}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 3}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + + { + "convective_available_potential_energy_sfc.glob", 0, - 0.1, + 10, 0, 17000, { - {"discipline", 0}, - {"parameterCategory", 7}, - {"parameterNumber", 6}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfSecondFixedSurface", 8}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 7}, + {"parameterNumber", GRIB_TYPE_LONG, 6}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8}, {NULL, }, }, {&point_in_time, &predefined_thickness}, }, { - "convective_inhibition_sfc", - -1800, + "convective_available_potential_energy_sfc.lam", + 0, + 10, + 0, + 17000, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 59}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 7}, + {"parameterNumber", GRIB_TYPE_LONG, 6}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &predefined_thickness}, + }, + + { + "convective_inhibition_sfc.glob", + -60000, 0, -10, + 5, + { + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 7}, + {"parameterNumber", GRIB_TYPE_LONG, 7}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8}, + {NULL, }, + }, + {&point_in_time, &predefined_thickness}, + }, + + { + "convective_inhibition_sfc.lam", + -60000, + 0, + -10, + 5, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 228001}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 7}, + {"parameterNumber", GRIB_TYPE_LONG, 7}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &predefined_thickness}, + }, + +/* + eggr (centre=74, model=1) cin max ~ -30000 + aladinhuneps-omsz-eu (origin=12) cin max ~ <-60000,1> + aladinlaef-zamg-eu (origin=) cin max ~ <-...,1> +*/ +/* + cosmodeeps-dwd-eu (origin=7) +*/ + + { + "convective_inhibition_sfc.lam.cosmodeeps-dwd-eu", + 0, + 10, + 0, 2000, { - {"discipline", 0}, - {"parameterCategory", 7}, - {"parameterNumber", 7}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfSecondFixedSurface", 8}, + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 7, "cosmodeeps-dwd-eu"}, + + {"paramId", GRIB_TYPE_LONG, 228001}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 7}, + {"parameterNumber", GRIB_TYPE_LONG, 7}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &predefined_thickness}, + }, + +/* + cosmoleps-arpasimc-eu (origin=4) +*/ + + { + "convective_inhibition_sfc.lam.cosmoleps-arpasimc-eu", + -0.5, + 10, + 0, + 2000, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 4, "cosmoleps-arpasimc-eu"}, + + {"paramId", GRIB_TYPE_LONG, 228001}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 7}, + {"parameterNumber", GRIB_TYPE_LONG, 7}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, {NULL, }, }, {&point_in_time, &predefined_thickness}, @@ -85,15 +340,16 @@ parameter parameters[] = { 99, -99, { - {"discipline", 2}, - {"parameterCategory", 3}, - {"parameterNumber", 12}, - {"scaleFactorOfFirstFixedSurface", 0}, - {"scaleFactorOfSecondFixedSurface", 1}, - {"scaledValueOfFirstFixedSurface", 0}, - {"scaledValueOfSecondFixedSurface", 2}, - {"typeOfFirstFixedSurface", 106}, - {"typeOfSecondFixedSurface", 106}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 2}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 12}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_LONG, 2}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 106}, + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 106}, {NULL, }, }, {&point_in_time, &given_thickness, &has_bitmap}, @@ -106,63 +362,278 @@ parameter parameters[] = { 320, 22000, { - {"discipline", 0}, - {"parameterCategory", 3}, - {"parameterNumber", 5}, - {"typeOfFirstFixedSurface", 100}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 5}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 100}, {NULL, }, }, {&point_in_time, &given_level, &pressure_level}, }, { - "land_sea_mask_sfc", + "land_sea_mask_sfc.glob", 0, 0, 1, 1, { - {"discipline", 2}, - {"parameterCategory", 0}, - {"parameterNumber", 0}, - {"typeOfFirstFixedSurface", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 2}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&point_in_time, &predefined_level}, }, { - "mean_sea_level_pressure_sfc", + "land_sea_mask_sfc.lam", + 0, + 0, + 1, + 1, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 172}, + + {"discipline", GRIB_TYPE_LONG, 2}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &predefined_level}, + }, + + { + "land_sea_mask_sfc.lam.hirlam-dmi-eu", + -0.001, + 0, + 1, + 1, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 11, "hirlam-dmi-eu"}, + + {"paramId", GRIB_TYPE_LONG, 172}, + + {"discipline", GRIB_TYPE_LONG, 2}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &predefined_level}, + }, + + { + "mean_sea_level_pressure_sfc.glob", 91000, - 102000, + 103000, 99000, 107000, { - {"discipline", 0}, - {"parameterCategory", 3}, - {"parameterNumber", 0}, - {"typeOfFirstFixedSurface", 101}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 101}, {NULL, }, }, {&point_in_time, &predefined_level}, }, { - "orography_sfc", + "mean_sea_level_pressure_sfc.lam", + 91000, + 103000, + 99000, + 107000, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 151}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 101}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {NULL, }, + }, + {&point_in_time, &predefined_level}, + }, + +/* + MOGREPS (origin = 1(mogreps-mo-eua)) + 2014-02-06:21UTC mean_sea_level_pressure_sfc maximum value 98852 is not in [99000,107000] +*/ + { + "mean_sea_level_pressure_sfc.lam.mogreps-mo-eua", + 91000, + 103000, + 98000, + 107000, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 1, "mogreps-mo-eua"}, + + {"paramId", GRIB_TYPE_LONG, 151}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 101}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &predefined_level}, + }, + + { + "orography_sfc.glob", -1300, 0, 2000, 8888, { - {"discipline", 0}, - {"parameterCategory", 3}, - {"parameterNumber", 5}, - {"typeOfFirstFixedSurface", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 5}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&point_in_time, &predefined_level}, }, + { + "orography_sfc.lam", + -1300, + 0, + 2000, + 8888, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 228002}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 5}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &predefined_level}, + }, + +/* + MOGREPS (origin = 1(mogreps-mo-eua)) + 2014-01-08: limits for orog changed to <1000,8888> +*/ + { + "orography_sfc.lam.mogreps-mo-eua", + -1300, + 0, + 1000, + 8888, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 1, "mogreps-mo-eua"}, + + {"paramId", GRIB_TYPE_LONG, 228002}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 5}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &predefined_level}, + }, +/* + DMI-EPS (origin = 11(hirlam-dmi-eu)) + 2014-01-15: limits for orog changed to <1500,8888> +*/ + { + "orography_sfc.lam.hirlam-dmi-eu", + -1300, + 0, + 1800, + 2500, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 11, "hirlam-dmi-eu"}, + + {"paramId", GRIB_TYPE_LONG, 228002}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 5}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &predefined_level}, + }, + { "potential_temperature_pv", 220, @@ -170,10 +641,11 @@ parameter parameters[] = { 380, 1200, { - {"discipline", 0}, - {"parameterCategory", 0}, - {"parameterNumber", 2}, - {"typeOfFirstFixedSurface", 109}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 2}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 109}, {NULL, }, }, {&point_in_time, &given_level, &potential_vorticity_level}, @@ -186,12 +658,13 @@ parameter parameters[] = { 1e-6, 0.002, { - {"discipline", 0}, - {"parameterCategory", 2}, - {"parameterNumber", 14}, - {"scaleFactorOfFirstFixedSurface", 0}, - {"scaledValueOfFirstFixedSurface", 320}, - {"typeOfFirstFixedSurface", 107}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 14}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 320}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 107}, {NULL, }, }, {&point_in_time, &given_level, &potential_temperature_level}, @@ -204,10 +677,11 @@ parameter parameters[] = { 320, 355, { - {"discipline", 0}, - {"parameterCategory", 0}, - {"parameterNumber", 17}, - {"typeOfFirstFixedSurface", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 17}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&point_in_time, &predefined_level}, @@ -220,10 +694,11 @@ parameter parameters[] = { 12000, 15000, { - {"discipline", 0}, - {"parameterCategory", 1}, - {"parameterNumber", 60}, - {"typeOfFirstFixedSurface", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 1}, + {"parameterNumber", GRIB_TYPE_LONG, 60}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&point_in_time, &predefined_level}, @@ -236,11 +711,12 @@ parameter parameters[] = { 3.5, 3.5, { - {"discipline", 0}, - {"parameterCategory", 1}, - {"parameterNumber", 53}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfStatisticalProcessing", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 1}, + {"parameterNumber", GRIB_TYPE_LONG, 53}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&from_start, &predefined_level}, @@ -253,15 +729,16 @@ parameter parameters[] = { 450, 500, { - {"discipline", 2}, - {"parameterCategory", 0}, - {"parameterNumber", 22}, - {"scaleFactorOfFirstFixedSurface", 0}, - {"scaleFactorOfSecondFixedSurface", 1}, - {"scaledValueOfFirstFixedSurface", 0}, - {"scaledValueOfSecondFixedSurface", 2}, - {"typeOfFirstFixedSurface", 106}, - {"typeOfSecondFixedSurface", 106}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 2}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 22}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_LONG, 2}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 106}, + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 106}, {NULL, }, }, {&point_in_time, &given_thickness, &has_bitmap}, @@ -274,15 +751,16 @@ parameter parameters[] = { 310, 350, { - {"discipline", 2}, - {"parameterCategory", 0}, - {"parameterNumber", 2}, - {"scaleFactorOfFirstFixedSurface", 0}, - {"scaleFactorOfSecondFixedSurface", 1}, - {"scaledValueOfFirstFixedSurface", 0}, - {"scaledValueOfSecondFixedSurface", 2}, - {"typeOfFirstFixedSurface", 106}, - {"typeOfSecondFixedSurface", 106}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 2}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 2}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_LONG, 2}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 106}, + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 106}, {NULL, }, }, {&point_in_time, &given_thickness}, @@ -295,10 +773,11 @@ parameter parameters[] = { 0.0001, 0.050, { - {"discipline", 0}, - {"parameterCategory", 1}, - {"parameterNumber", 0}, - {"typeOfFirstFixedSurface", 100}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 1}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 100}, {NULL, }, }, {&point_in_time, &given_level, &pressure_level}, @@ -311,43 +790,222 @@ parameter parameters[] = { 3600.00000001, 3600.00000001, { - {"discipline", 0}, - {"parameterCategory", 6}, - {"parameterNumber", 24}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfStatisticalProcessing", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 6}, + {"parameterNumber", GRIB_TYPE_LONG, 24}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&from_start, &predefined_level}, }, { - "surface_air_temperature_sfc", + "surface_air_temperature_sfc.glob", 180, 290, 270, 350, { - {"discipline", 0}, - {"parameterCategory", 0}, - {"parameterNumber", 0}, - {"typeOfFirstFixedSurface", 103}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, {NULL, }, }, {&point_in_time, &given_level}, }, { - "surface_air_dew_point_temperature_sfc", + "surface_air_temperature_sfc.lam", 180, 290, 270, 350, { - {"discipline", 0}, - {"parameterCategory", 0}, - {"parameterNumber", 6}, - {"typeOfFirstFixedSurface", 103}, + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 167}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 2}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + + { + "surface_air_temperature_sfc.lam.mogreps-mo-eua", + 180, + 290, + 270, + 350, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 1, "mogreps-mo-eua"}, + + {"paramId", GRIB_TYPE_LONG, 167}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 15}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + +/* + cosmodeeps-dwd-eu (origin=7) + 2014-01-08: minimum limit for surface_air_temperature_sfc changed to <140,290> +*/ + { + "surface_air_temperature_sfc.lam.cosmodeeps-dwd-eu", + 140, + 290, + 270, + 350, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 7, "cosmodeeps-dwd-eu"}, + + {"paramId", GRIB_TYPE_LONG, 167}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 2}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + + { + "surface_air_dew_point_temperature_sfc.glob", + 175, + 290, + 270, + 350, + { + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 6}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + + { + "surface_air_dew_point_temperature_sfc.lam", + 175, + 290, + 270, + 350, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 168}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 6}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 2}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + + { + "surface_air_dew_point_temperature_sfc.lam.mogreps-mo-eua", + 175, + 290, + 270, + 350, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 1, "mogreps-mo-eua"}, + + {"paramId", GRIB_TYPE_LONG, 168}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 6}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 15}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&point_in_time, &given_level}, + }, + +/* + cosmodeeps-dwd-eu (origin=7) + 2014-01-08: minimum limit for surface_air_dew_point_temperature_sfc changed to <160,290> +*/ + { + "surface_air_dew_point_temperature_sfc.lam.cosmodeeps-dwd-eu", + 160, + 290, + 270, + 350, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 7, "cosmodeeps-dwd-eu"}, + + {"paramId", GRIB_TYPE_LONG, 168}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 6}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 2}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, {NULL, }, }, {&point_in_time, &given_level}, @@ -360,11 +1018,12 @@ parameter parameters[] = { 310, 330, { - {"discipline", 0}, - {"parameterCategory", 0}, - {"parameterNumber", 0}, - {"typeOfFirstFixedSurface", 103}, - {"typeOfStatisticalProcessing", 2}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 2}, {NULL, }, }, {&six_hourly, &given_level}, @@ -377,11 +1036,12 @@ parameter parameters[] = { 310, 320, { - {"discipline", 0}, - {"parameterCategory", 0}, - {"parameterNumber", 0}, - {"typeOfFirstFixedSurface", 103}, - {"typeOfStatisticalProcessing", 3}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 3}, {NULL, }, }, {&six_hourly, &given_level}, @@ -395,10 +1055,11 @@ parameter parameters[] = { 103000, 110000, { - {"discipline", 0}, - {"parameterCategory", 3}, - {"parameterNumber", 0}, - {"typeOfFirstFixedSurface", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 3}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&point_in_time, &predefined_level}, @@ -411,10 +1072,11 @@ parameter parameters[] = { 230, 330, { - {"discipline", 0}, - {"parameterCategory", 0}, - {"parameterNumber", 0}, - {"typeOfFirstFixedSurface", 100}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 0}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 100}, {NULL, }, }, {&point_in_time, &given_level, &pressure_level}, @@ -427,11 +1089,12 @@ parameter parameters[] = { -300000, -300000, { - {"discipline", 0}, - {"parameterCategory", 5}, - {"parameterNumber", 5}, - {"typeOfFirstFixedSurface", 8}, - {"typeOfStatisticalProcessing", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 5}, + {"parameterNumber", GRIB_TYPE_LONG, 5}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 8}, + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&from_start, &predefined_level}, @@ -444,11 +1107,12 @@ parameter parameters[] = { 700000, 700000, { - {"discipline", 0}, - {"parameterCategory", 0}, - {"parameterNumber", 10}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfStatisticalProcessing", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 10}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&from_start, &predefined_level}, @@ -461,11 +1125,12 @@ parameter parameters[] = { 4e+6, 4e+6, { - {"discipline", 0}, - {"parameterCategory", 4}, - {"parameterNumber", 9}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfStatisticalProcessing", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 4}, + {"parameterNumber", GRIB_TYPE_LONG, 9}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&from_start, &predefined_level}, @@ -478,11 +1143,12 @@ parameter parameters[] = { 700000, 700000, { - {"discipline", 0}, - {"parameterCategory", 5}, - {"parameterNumber", 5}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfStatisticalProcessing", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 5}, + {"parameterNumber", GRIB_TYPE_LONG, 5}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&from_start, &predefined_level}, @@ -495,11 +1161,12 @@ parameter parameters[] = { 1.5e+6, 1.5e+6, { - {"discipline", 0}, - {"parameterCategory", 0}, - {"parameterNumber", 11}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfStatisticalProcessing", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 11}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, {NULL, }, }, {&from_start, &predefined_level}, @@ -512,11 +1179,12 @@ parameter parameters[] = { 100, 100.00001, { - {"discipline", 0}, - {"parameterCategory", 6}, - {"parameterNumber", 1}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfSecondFixedSurface", 8}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"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}, @@ -529,30 +1197,104 @@ parameter parameters[] = { 75, 150, { - {"discipline", 0}, - {"parameterCategory", 1}, - {"parameterNumber", 51}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfSecondFixedSurface", 8}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 1}, + {"parameterNumber", GRIB_TYPE_LONG, 51}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 8}, {NULL, }, }, {&point_in_time, &predefined_thickness}, }, -/*hourly extreems for cumulated parameters! */ -/* 133 because of cosmo-de boundary effects when coupled with IFS */ +/* + hourly extreems for cumulated parameters! + + - TBD: the problem is that for tigge/tigge-lam there are cumulated parameters from step 0 and + the limits for e.g. 0-3 period should be very different to ones for e.g. 0-120 even + the value is divided by the period lenght in hours! +*/ + { - "total_precipitation_sfc", + "total_precipitation_sfc.glob", + -0.05, + 0.1, + 0., + 100., + { + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 1}, + {"parameterNumber", GRIB_TYPE_LONG, 52}, + + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {NULL, }, + }, + {&from_start, &predefined_level}, + }, + + { + "total_precipitation_sfc.lam", + -0.05, + 0.1, + 0., + 100., + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 228228}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 1}, + {"parameterNumber", GRIB_TYPE_LONG, 52}, + + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&from_start, &predefined_level}, + }, + +/* + cosmodeeps-dwd-eu (origin=7) + 2013-??-??: maximum changed to <0,133> because of cosmo-de boundary effects when coupled with IFS .. + */ + { + "total_precipitation_sfc.lam.cosmodeeps-dwd-eu", -0.05, 0.1, 0., 133., { - {"discipline", 0}, - {"parameterCategory", 1}, - {"parameterNumber", 52}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfStatisticalProcessing", 1}, + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 7, "cosmodeeps-dwd-eu"}, + + {"paramId", GRIB_TYPE_LONG, 228228}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 1}, + {"parameterNumber", GRIB_TYPE_LONG, 52}, + + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, {NULL, }, }, {&from_start, &predefined_level}, @@ -560,17 +1302,52 @@ parameter parameters[] = { /*hourly extreems for cumulated parameters! */ { - "large_scale_precipitation_sfc", + "large_scale_precipitation_sfc.glob", -0.05, 0.1, 0.0, 100., { - {"discipline", 0}, - {"parameterCategory", 1}, - {"parameterNumber", 54}, - {"typeOfFirstFixedSurface", 1}, - {"typeOfStatisticalProcessing", 1}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 1}, + {"parameterNumber", GRIB_TYPE_LONG, 54}, + + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {NULL, }, + }, + {&from_start, &predefined_level}, + }, + + { + "large_scale_precipitation_sfc.lam", + -0.05, + 0.1, + 0.0, + 100., + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 3062}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 1}, + {"parameterNumber", GRIB_TYPE_LONG, 54}, + + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 1}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, {NULL, }, }, {&from_start, &predefined_level}, @@ -583,10 +1360,11 @@ parameter parameters[] = { 20, 120, { - {"discipline", 0}, - {"parameterCategory", 2}, - {"parameterNumber", 2}, - {"typeOfFirstFixedSurface", 100}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 2}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 100}, {NULL, }, }, {&point_in_time, &given_level, &pressure_level}, @@ -599,10 +1377,11 @@ parameter parameters[] = { 70, 120, { - {"discipline", 0}, - {"parameterCategory", 2}, - {"parameterNumber", 2}, - {"typeOfFirstFixedSurface", 109}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 2}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 109}, {NULL, }, }, {&point_in_time, &given_level, &potential_vorticity_level}, @@ -615,10 +1394,11 @@ parameter parameters[] = { 20, 120, { - {"discipline", 0}, - {"parameterCategory", 2}, - {"parameterNumber", 3}, - {"typeOfFirstFixedSurface", 100}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 3}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 100}, {NULL, }, }, {&point_in_time, &given_level, &pressure_level}, @@ -631,10 +1411,11 @@ parameter parameters[] = { 55, 120, { - {"discipline", 0}, - {"parameterCategory", 2}, - {"parameterNumber", 3}, - {"typeOfFirstFixedSurface", 109}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 3}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 109}, {NULL, }, }, {&point_in_time, &given_level, &potential_vorticity_level}, @@ -647,32 +1428,137 @@ parameter parameters[] = { 99, -99, { - {"discipline", 2}, - {"parameterCategory", 0}, - {"parameterNumber", 26}, - {"scaleFactorOfFirstFixedSurface", 0}, - {"scaleFactorOfSecondFixedSurface", 1}, - {"scaledValueOfFirstFixedSurface", 0}, - {"scaledValueOfSecondFixedSurface", 2}, - {"typeOfFirstFixedSurface", 106}, - {"typeOfSecondFixedSurface", 106}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + {"discipline", GRIB_TYPE_LONG, 2}, + {"parameterCategory", GRIB_TYPE_LONG, 0}, + {"parameterNumber", GRIB_TYPE_LONG, 26}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_LONG, 1}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_LONG, 2}, + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 106}, + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 106}, {NULL, }, }, {&point_in_time, &given_thickness, &has_bitmap}, }, + { - "maximum_wind_gust", + "maximum_wind_gust.glob", 0, 10, 0, 100, { - {"discipline", 0}, - {"parameterCategory", 2}, - {"parameterNumber", 22}, - {"scaleFactorOfFirstFixedSurface", 0}, - {"scaledValueOfFirstFixedSurface", 10}, - {"typeOfFirstFixedSurface", 103}, + {"model", GRIB_TYPE_STRING, 0, "glob"}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 22}, + + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 2}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {NULL, }, + }, + {&three_hourly, &given_level}, + }, + + { + "maximum_wind_gust.lam", + 0, + 10, + 0, + 100, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 228028}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 22}, + + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 2}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&three_hourly, &given_level}, + }, + + { + "maximum_wind_gust.lam", + 0, + 10, + 0, + 100, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + + {"paramId", GRIB_TYPE_LONG, 228028}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 22}, + + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 2}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {NULL, }, + }, + {&three_hourly, &given_level}, + }, + +/* + MOGREPS (origin = 1(mogreps-mo-eua)) + 2014-01-08 minimum limit for maximum_wind_gust changed to <0,12> because of mogreps data from 2014010203_03+0033 + 2014-01-10 maximum limit for maximum_wind_gust changed to <0,200> because of mogreps data from 2014010403_06+0033 + 2014-01-10 maximum limit for maximum_wind_gust changed to <0,333> because of mogreps data from 2014010821_11+0033 + 2014-01-27 minimum limit for maximum_wind_gust changed to <0,15> because of mogreps data from 2014012521_09+0018 + 2014-02-20 maximum limit for maximum_wind_gust changed to <0,500> because of mogreps data from 2014022009_02+0021 +*/ + { + "maximum_wind_gust.lam.mogreps-mo-eua", + 0, + 15, + 0, + 500, + { + {"model", GRIB_TYPE_STRING, 0, "lam"}, + {"suiteName", GRIB_TYPE_STRING, 1, "mogreps-mo-eua"}, + + {"paramId", GRIB_TYPE_LONG, 228028}, + + {"discipline", GRIB_TYPE_LONG, 0}, + {"parameterCategory", GRIB_TYPE_LONG, 2}, + {"parameterNumber", GRIB_TYPE_LONG, 22}, + + {"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 2}, + + {"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103}, + {"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0}, + {"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10}, + + {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, + {"scaleFactorOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, + {"scaledValueOfSecondFixedSurface", GRIB_TYPE_STRING, 0, "missing"}, {NULL, }, }, {&three_hourly, &given_level}, diff --git a/tools/grib_histogram.c b/tools/grib_histogram.c index 65e9034c2..74e43bdde 100644 --- a/tools/grib_histogram.c +++ b/tools/grib_histogram.c @@ -98,7 +98,8 @@ int main(int argc, const char *argv[]) { if(values[j] != missing) { - int x = (values[j] - min)/delta * (count-1) + 0.5; + int x = (values[j] - min)/delta * count; + if(x==count) x=x-1; /*handle the absolute maximum*/ intervals[x]++; } } @@ -117,7 +118,8 @@ int main(int argc, const char *argv[]) for(j = 0; j < size; j++) { - int x = (values[j] - min)/delta * (count-1) + 0.5; + int x = (values[j] - min)/delta * count; + if(x==count) x=x-1; /*handle the absolute maximum*/ intervals[x]++; } } diff --git a/tools/grib_ls.c b/tools/grib_ls.c index 4e789c7f1..4f36ca742 100644 --- a/tools/grib_ls.c +++ b/tools/grib_ls.c @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) } /* - This is executed before processing the options with i + This is executed before processing the options with getopt and therefore it is the right place for hacking the arguments if needed */ @@ -326,13 +326,13 @@ int grib_tool_skip_handle(grib_runtime_options* options, grib_handle* h) return 0; } -/* key values can be printed in this function. Headers are already printed if requested.*/ +/* key values can be printed here. Headers are already printed if requested */ void grib_tool_print_key_values(grib_runtime_options* options,grib_handle* h) { grib_print_key_values(options,h); } -/* this is executed after the last message in the last file is processed */ +/* This is executed after the last message in the last file is processed */ int grib_tool_finalise_action(grib_runtime_options* options) { int i=0;