diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f11896b00..17873147b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: uses: ecmwf-actions/downstream-ci/.github/workflows/downstream-ci.yml@main with: eccodes: ecmwf/eccodes@${{ github.event.pull_request.head.sha || github.sha }} + codecov_upload: true secrets: inherit # Run CI of private downstream packages on self-hosted runners @@ -74,15 +75,6 @@ jobs: event_type: downstream-ci-hpc payload: '{"eccodes": "ecmwf/eccodes@${{ github.event.pull_request.head.sha || github.sha }}"}' - codecov: - name: code-coverage - if: ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }} - uses: ./.github/workflows/reusable-ci.yml - with: - eccodes: ecmwf/eccodes@${{ github.event.pull_request.head.sha || github.sha }} - codecov: true - secrets: inherit - notify: runs-on: ubuntu-latest needs: @@ -90,8 +82,7 @@ jobs: - private-downstream-ci - downstream-ci-hpc - private-downstream-ci-hpc - - codecov - if: always() && ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }} + if: ${{ always() && !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }} steps: - name: Trigger Teams notification uses: ecmwf-actions/notify-teams@v1 diff --git a/.gitignore b/.gitignore index bfdfd9434..8791994fc 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ grib_api.pc grib_api_f90.pc *.analyzerinfo *.snalyzerinfo +tags +src/convert_*.sh # compiled source # ################### @@ -72,3 +74,4 @@ data/bufr/*test build/ *.back +trash diff --git a/VERSION b/VERSION index c819688d6..3a05135cd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.35.3 +2.36.0 diff --git a/definitions/bufr/section.1.3.def b/definitions/bufr/section.1.3.def index 84ac947b0..811b0955a 100644 --- a/definitions/bufr/section.1.3.def +++ b/definitions/bufr/section.1.3.def @@ -20,7 +20,8 @@ unsigned[1] localTablesVersionNumber : dump; transient typicalCentury=21; unsigned[1] typicalYearOfCentury : dump; -transient typicalYear = (typicalCentury - 1) * 100 + typicalYearOfCentury : no_copy; +# ECC-1840: Use the 'evaluate' accessor so typicalYear is updated if user changes typicalCentury +meta typicalYear evaluate( (typicalCentury - 1) * 100 + typicalYearOfCentury ) : no_copy; unsigned[1] typicalMonth : dump; unsigned[1] typicalDay : dump; diff --git a/definitions/check_grib_defs.pl b/definitions/check_grib_defs.pl index dba8c0e27..d011680f3 100755 --- a/definitions/check_grib_defs.pl +++ b/definitions/check_grib_defs.pl @@ -204,6 +204,7 @@ sub process { } elsif ($this =~ /'(.*)' *= *{/) { $concept = $1; + die "File: $filename, line: $lineNum: Value is empty." if ($concept eq ''); die "File: $filename, line: $lineNum: Value contains invalid characters." if (non_printable($concept)); if ($filename eq 'cfVarName.def') { #if ($concept =~ /^[0-9]/) { diff --git a/definitions/common/c-1.table b/definitions/common/c-1.table index c50d48251..2d9954a38 100644 --- a/definitions/common/c-1.table +++ b/definitions/common/c-1.table @@ -64,7 +64,7 @@ 96 96 Athens 97 97 European Space Agency (ESA) 98 ecmf European Centre for Medium-Range Weather Forecasts -99 99 DeBilt, Netherlands +99 knmi DeBilt, Netherlands 110 110 Hong-Kong 160 160 US NOAA/NESDIS 173 nasa US National Aeronautics and Space Administration (NASA) @@ -84,10 +84,10 @@ 233 eidb Dublin 235 ingv INGV 239 crfc CERFAX -244 vuwien VUWien -245 knmi KNMI -246 ifmk IfM-Kiel -247 hadc Hadley Centre +244 244 The former Yugoslav Republic of Macedonia (NMC) +245 245 Ukraine (NMC) +246 246 Republic of Moldova (NMC) +247 247 Operational Programme for the Exchange of weather RAdar information (OPERA) - EUMETNET 250 cosmo COnsortium for Small scale MOdelling (COSMO) 251 251 Meteorological Cooperation on Operational NWP (MetCoOp) 252 mpim Max Planck Institute for Meteorology (MPI-M) diff --git a/definitions/common/c-11.table b/definitions/common/c-11.table index 778001045..d96d7e267 100644 --- a/definitions/common/c-11.table +++ b/definitions/common/c-11.table @@ -23,6 +23,7 @@ 22 22 ACMAD 23 23 Mozambique (NMC) 24 fapr Pretoria (RSMC) +25 25 La Reunion (RSMC) 26 26 Khabarovsk (RSMC) 28 vabb New Delhi (IMD) 29 dems New Delhi (NCMRWF) @@ -58,12 +59,14 @@ 64 64 Honolulu 65 65 Darwin (RSMC) 67 67 Melbourne (RSMC) +# 68 Reserved 69 nzkl Wellington (RSMC/RAFC) 71 71 Nadi (RSMC) 72 72 Singapore 73 73 Malaysia (NMC) 74 egrr U.K. Met Office - Exeter 76 76 Moscow (RSMC/RAFC) +# 77 Reserved 78 edzw Offenbach (RSMC) 80 cnmc Rome (RSMC) 82 eswi Norrkoping @@ -82,7 +85,7 @@ 96 96 Athens 97 97 European Space Agency (ESA) 98 ecmf European Centre for Medium-Range Weather Forecasts -99 99 DeBilt, Netherlands +99 knmi DeBilt, Netherlands 100 100 Brazzaville 101 101 Abidjan 102 102 Libya (NMC) @@ -93,15 +96,68 @@ 107 107 Uganda (NMC) 108 108 United Republic of Tanzania (NMC) 109 109 Zimbabwe (NMC) -110 110 Hong-Kong +110 110 Hong Kong +111 111 Afghanistan (NMC) +112 112 Bahrain (NMC) +113 113 Bangladesh (NMC) +114 114 Bhutan (NMC) +115 115 Cambodia (NMC) +116 116 Democratic People's Republic of Korea (NMC) +117 117 Islamic Republic of Iran (NMC) +118 118 Iraq (NMC) +119 119 Kazakhstan (NMC) +120 120 Kuwait (NMC) +121 121 Kyrgyzstan (NMC) +122 122 Lao People's Democratic Republic (NMC) +123 123 "Macao China" +124 124 Maldives (NMC) +125 125 Myanmar (NMC) +126 126 Nepal (NMC) +127 127 Oman (NMC) +128 128 Pakistan (NMC) +129 129 Qatar (NMC) +130 130 Yemen (NMC) +131 131 Sri Lanka (NMC) +132 132 Tajikistan (NMC) +133 133 Turkmenistan (NMC) +134 134 United Arab Emirates (NMC) +135 135 Uzbekistan (NMC) +136 136 Viet Nam (NMC) +# 137-139 Reserved for other centres +140 140 Bolivia (Plurinational State of) (NMC) +141 141 Guyana (NMC) +142 142 Paraguay (NMC) +143 143 Suriname (NMC) +144 144 Uruguay (NMC) 145 145 French Guiana 146 146 Brazilian Navy Hydrographic Centre 147 147 National Commission on Space Activities (CONAE) - Argentina 148 148 Brazilian Department of Airspace Control - DECEA +# 149 Reserved for other centres +150 150 Antigua and Barbuda (NMC) +151 151 Bahamas (NMC) +152 152 Barbados (NMC) +153 153 Belize (NMC) +154 154 British Caribbean Territories Centre +155 155 San Jose +156 156 Cuba (NMC) +157 157 Dominica (NMC) +158 158 Dominican Republic (NMC) +159 159 El Salvador (NMC) 160 160 US NOAA/NESDIS 161 161 US NOAA Office of Oceanic and Atmospheric Research +162 162 Guatemala (NMC) +163 163 Haiti (NMC) +164 164 Honduras (NMC) +165 165 Jamaica (NMC) +166 166 Mexico +167 167 Curacao and Sint Maarten (NMC) +168 168 Nicaragua (NMC) +169 169 Panama (NMC) +170 170 Saint Lucia (NMC) +171 171 Trinidad and Tobago (NMC) +172 172 French Departments in RA IV 173 nasa US National Aeronautics and Space Administration (NASA) - 174 174 Integrated Science Data Management/Marine Environmental Data Service (ISDM/MEDS - Canada) 175 175 University Corporation for Atmospheric Research (UCAR) - United States 176 176 Cooperative Institute for Meteorological Satellite Studies (CIMSS) - United States @@ -110,9 +166,23 @@ 179 179 GeoOptics, Inc. 180 180 PlanetiQ 181 181 Atmospheric and Environmental Research (AER) - +# 182-189 Reserved for other centres +190 190 Cook Islands (NMC) +191 191 French Polynesia (NMC) +192 192 Tonga (NMC) +193 193 Vanuatu (NMC) +194 194 Brunei Darussalam (NMC) 195 wiix Indonesia (NMC) +196 196 Kiribati (NMC) +197 197 Federated States of Micronesia (NMC) +198 198 New Caledonia (NMC) +199 199 Niue +200 200 Papua New Guinea (NMC) +201 201 Philippines (NMC) +202 202 Samoa (NMC) +203 203 Solomon Islands (NMC) 204 niwa National Institute of Water and Atmospheric Research (NIWA - New Zealand) +# 205-209 Reserved for other centres 210 210 Frascati (ESA/ESRIN) 211 211 Lannion 212 212 Lisboa @@ -139,18 +209,24 @@ 233 eidb Dublin 234 234 Israel (NMC) 235 ingv INGV +236 236 Latvia (NMC) +237 237 Lebanon (NMC) 238 238 Lithuania (NMC) 239 crfc CERFAX 240 240 Malta (NMC) 241 241 Monaco 242 242 Romania (NMC) -244 vuwien VUWien -245 knmi KNMI -246 ifmk IfM-Kiel -247 hadc Hadley Centre +243 243 Syrian Arab Republic (NMC) +244 244 The former Yugoslav Republic of Macedonia (NMC) +245 245 Ukraine (NMC) +246 246 Republic of Moldova (NMC) +247 247 Operational Programme for the Exchange of weather RAdar information (OPERA) - EUMETNET +248 248 Montenegro (NMC) +249 249 Barcelona Dust Forecast Center 250 cosmo COnsortium for Small scale MOdelling (COSMO) 251 251 Meteorological Cooperation on Operational NWP (MetCoOp) 252 mpim Max Planck Institute for Meteorology (MPI-M) +253 253 Alfred Wegener Institute (AWI) 254 eums EUMETSAT Operation Centre 255 consensus Consensus 256 256 Angola (NMC) @@ -184,9 +260,10 @@ 284 284 Sierra Leone (NMC) 285 285 Somalia (NMC) 286 286 Sudan (NMC) -287 287 Swaziland (NMC) +287 287 Eswatini (NMC) 288 288 Togo (NMC) 289 289 Zambia (NMC) +290 290 EUMETNET E-Profile 291 anso Alliance of International Science Organizations (Beijing, China) 292 ufz Helmholtz Centre for Environmental Research 293 293 University of Bremen @@ -196,4 +273,28 @@ 297 297 The Nanjing Institute of Environmental Sciences (NIES) 298 298 Dynamic Meteorology Laboratory (LMD) 299 299 The Rutherford Appleton Laboratory (RAL) +300 300 Greek Atomic Energy Commission (Greece) +301 301 United Stated Environmental Protection Agency (USA) +302 302 Autralian Radiation Protection and Nuclear Safety (Australia) +303 303 Authority for Nuclear Safety and Radiation Protection (The Netherlands) +304 304 Autorite de Surete Nucleaire (France) +305 305 Bundesamt für Strahlenschutz (Germany) +306 306 National Commission for Nuclear Activities Control (Romania) +307 307 Consejo de Seguridad Nuclear (Spain) +308 308 Danish Emergency Management Agency (Denmark) +309 309 Norwegian Radiation Protection Agency (Norway) +310 310 Federal Agency for Nuclear Control (Belgium) +311 311 Institute of Radiation Protection and Dosimetry (Brazil) +312 312 National Inspectorate for Nuclear Safety and Radiation Protection (Italy) +313 313 Nuclear Regulatory Authority (Turkiye) +314 314 Nuclear Regulation Authority (Japan) +315 315 Nuclear Regulatory Agency (Bulgaria) +316 316 Ukrainian Radiation Protection Institute (Ukriane) +317 317 Health Canada Radio Protection Bureau (Canada) +318 318 Portuguese Society for Radiation Protection (Portugal) +319 319 Swedish Radiation Safety Authority (Sweden) +320 320 Radiation and Nuclear Safety Authority (Finland) +321 321 State Office for Nuclear Safety (Czechia) +322 322 Nuclear Regulation Authority (Slovakia) +# 323-65534 Reserved for other centres 65535 65535 Missing value diff --git a/definitions/grib1/cfVarName.def b/definitions/grib1/cfVarName.def index 50489e1a6..94c685c22 100644 --- a/definitions/grib1/cfVarName.def +++ b/definitions/grib1/cfVarName.def @@ -1148,36 +1148,6 @@ table2Version = 1 ; indicatorOfParameter = 48 ; } -#U-component of current -'ucurr' = { - table2Version = 3 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'ucurr' = { - table2Version = 2 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'ucurr' = { - table2Version = 1 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'vcurr' = { - table2Version = 3 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'vcurr' = { - table2Version = 2 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'vcurr' = { - table2Version = 1 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio 'mixr' = { table2Version = 3 ; diff --git a/definitions/grib1/localConcepts/ecmf/cfName.def b/definitions/grib1/localConcepts/ecmf/cfName.def index 48b023899..f1377da79 100644 --- a/definitions/grib1/localConcepts/ecmf/cfName.def +++ b/definitions/grib1/localConcepts/ecmf/cfName.def @@ -909,12 +909,12 @@ table2Version = 151 ; indicatorOfParameter = 130 ; } -#Eastward sea water velocity +#Eastward surface sea water velocity 'eastward_sea_water_velocity' = { table2Version = 151 ; indicatorOfParameter = 131 ; } -#Northward sea water velocity +#Northward surface sea water velocity 'northward_sea_water_velocity' = { table2Version = 151 ; indicatorOfParameter = 132 ; diff --git a/definitions/grib1/localConcepts/ecmf/cfVarName.def b/definitions/grib1/localConcepts/ecmf/cfVarName.def index f652e0ac8..e3d757597 100644 --- a/definitions/grib1/localConcepts/ecmf/cfVarName.def +++ b/definitions/grib1/localConcepts/ecmf/cfVarName.def @@ -13024,12 +13024,12 @@ table2Version = 151 ; indicatorOfParameter = 130 ; } -#Eastward sea water velocity +#Eastward surface sea water velocity 'uoe' = { table2Version = 151 ; indicatorOfParameter = 131 ; } -#Northward sea water velocity +#Northward surface sea water velocity 'von' = { table2Version = 151 ; indicatorOfParameter = 132 ; @@ -13244,7 +13244,7 @@ table2Version = 151 ; indicatorOfParameter = 174 ; } -#Average salinity in the upper 300m +#Average sea water practical salinity in the upper 300m 'sav300' = { table2Version = 151 ; indicatorOfParameter = 175 ; diff --git a/definitions/grib1/localConcepts/ecmf/name.def b/definitions/grib1/localConcepts/ecmf/name.def index c6600060a..77d5535a7 100644 --- a/definitions/grib1/localConcepts/ecmf/name.def +++ b/definitions/grib1/localConcepts/ecmf/name.def @@ -13024,13 +13024,13 @@ table2Version = 151 ; indicatorOfParameter = 130 ; } -#Eastward sea water velocity -'Eastward sea water velocity' = { +#Eastward surface sea water velocity +'Eastward surface sea water velocity' = { table2Version = 151 ; indicatorOfParameter = 131 ; } -#Northward sea water velocity -'Northward sea water velocity' = { +#Northward surface sea water velocity +'Northward surface sea water velocity' = { table2Version = 151 ; indicatorOfParameter = 132 ; } @@ -13244,8 +13244,8 @@ table2Version = 151 ; indicatorOfParameter = 174 ; } -#Average salinity in the upper 300m -'Average salinity in the upper 300m' = { +#Average sea water practical salinity in the upper 300m +'Average sea water practical salinity in the upper 300m' = { table2Version = 151 ; indicatorOfParameter = 175 ; } diff --git a/definitions/grib1/localConcepts/ecmf/paramId.def b/definitions/grib1/localConcepts/ecmf/paramId.def index 25b2986ec..0ea5b7ea3 100644 --- a/definitions/grib1/localConcepts/ecmf/paramId.def +++ b/definitions/grib1/localConcepts/ecmf/paramId.def @@ -13024,12 +13024,12 @@ table2Version = 151 ; indicatorOfParameter = 130 ; } -#Eastward sea water velocity +#Eastward surface sea water velocity '151131' = { table2Version = 151 ; indicatorOfParameter = 131 ; } -#Northward sea water velocity +#Northward surface sea water velocity '151132' = { table2Version = 151 ; indicatorOfParameter = 132 ; @@ -13244,7 +13244,7 @@ table2Version = 151 ; indicatorOfParameter = 174 ; } -#Average salinity in the upper 300m +#Average sea water practical salinity in the upper 300m '151175' = { table2Version = 151 ; indicatorOfParameter = 175 ; diff --git a/definitions/grib1/localConcepts/ecmf/paramIdForConversion.def b/definitions/grib1/localConcepts/ecmf/paramIdForConversion.def new file mode 100644 index 000000000..07b7d5a83 --- /dev/null +++ b/definitions/grib1/localConcepts/ecmf/paramIdForConversion.def @@ -0,0 +1,37 @@ +# Concept paramIdForConversion for ECMWF +# See ECC-1806 + +# 55 +228004 = {gribTablesVersionNo=128; indicatorOfParameter=55; centre=98;} +# 56 +235168 = {gribTablesVersionNo=128; indicatorOfParameter=56; centre=98;} +# 130232 +235135 = {gribTablesVersionNo=130; indicatorOfParameter=232; centre=98;} +# 151163 +262104 = {gribTablesVersionNo=151; indicatorOfParameter=163; centre=98;} +# 151145 +262124 = {gribTablesVersionNo=151; indicatorOfParameter=145; centre=98;} +# 172146 +235033 = {gribTablesVersionNo=172; indicatorOfParameter=146; centre=98;} +# 172147 +235034 = {gribTablesVersionNo=172; indicatorOfParameter=147; centre=98;} +# 172169 +235035 = {gribTablesVersionNo=172; indicatorOfParameter=169; centre=98;} +# 172175 +235036 = {gribTablesVersionNo=172; indicatorOfParameter=175; centre=98;} +# 172176 +235037 = {gribTablesVersionNo=172; indicatorOfParameter=176; centre=98;} +# 172177 +235038 = {gribTablesVersionNo=172; indicatorOfParameter=177; centre=98;} +# 172178 +235039 = {gribTablesVersionNo=172; indicatorOfParameter=178; centre=98;} +# 172179 +235040 = {gribTablesVersionNo=172; indicatorOfParameter=179; centre=98;} +# 174098 +262000 = {gribTablesVersionNo=174; indicatorOfParameter=98; centre=98;} +# 151175 +262118 = {gribTablesVersionNo=151; indicatorOfParameter=175; centre=98;} +# 151132 +262139 = {gribTablesVersionNo=151; indicatorOfParameter=132; centre=98;} +# 151131 +262140 = {gribTablesVersionNo=151; indicatorOfParameter=131; centre=98;} diff --git a/definitions/grib1/localConcepts/ecmf/shortName.def b/definitions/grib1/localConcepts/ecmf/shortName.def index 70ccd9973..4eb5e6f67 100644 --- a/definitions/grib1/localConcepts/ecmf/shortName.def +++ b/definitions/grib1/localConcepts/ecmf/shortName.def @@ -13024,12 +13024,12 @@ table2Version = 151 ; indicatorOfParameter = 130 ; } -#Eastward sea water velocity +#Eastward surface sea water velocity 'ocu' = { table2Version = 151 ; indicatorOfParameter = 131 ; } -#Northward sea water velocity +#Northward surface sea water velocity 'ocv' = { table2Version = 151 ; indicatorOfParameter = 132 ; @@ -13244,7 +13244,7 @@ table2Version = 151 ; indicatorOfParameter = 174 ; } -#Average salinity in the upper 300m +#Average sea water practical salinity in the upper 300m 'sav300' = { table2Version = 151 ; indicatorOfParameter = 175 ; diff --git a/definitions/grib1/localConcepts/ecmf/stepTypeForConversion.def b/definitions/grib1/localConcepts/ecmf/stepTypeForConversion.def index e74860061..25aae31d8 100644 --- a/definitions/grib1/localConcepts/ecmf/stepTypeForConversion.def +++ b/definitions/grib1/localConcepts/ecmf/stepTypeForConversion.def @@ -1,11 +1,9 @@ # Concept stepTypeForConversion for ECMWF -# set uses the FIRST one -# get returns the LAST match -# ECC-457: ECMWF Total Precipitation -"accum" = {timeRangeIndicator=0;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} -"accum" = {timeRangeIndicator=1;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} -"accum" = {timeRangeIndicator=10;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} +# ECC-457: total precipitation +"accum"={timeRangeIndicator=0;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} +"accum"={timeRangeIndicator=1;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} +"accum"={timeRangeIndicator=10;indicatorOfParameter=228;gribTablesVersionNo=128;centre=98;} # sro "accum"={gribTablesVersionNo=128;indicatorOfParameter=8;centre=98;} @@ -198,3 +196,25 @@ "accum"={gribTablesVersionNo=162;indicatorOfParameter=112;centre=98;} # vtpha "accum"={gribTablesVersionNo=162;indicatorOfParameter=113;centre=98;} +# mvv +"avg"={gribTablesVersionNo=130;indicatorOfParameter=232;centre=98;} +# msshfl +"avg"={gribTablesVersionNo=172;indicatorOfParameter=146;centre=98;} +# mslhfl +"avg"={gribTablesVersionNo=172;indicatorOfParameter=147;centre=98;} +# mean2t24 +"avg"={gribTablesVersionNo=128;indicatorOfParameter=55;centre=98;} +# mn2d24 +"avg"={gribTablesVersionNo=128;indicatorOfParameter=56;centre=98;} +# msdsrf +"avg"={gribTablesVersionNo=172;indicatorOfParameter=169;centre=98;} +# msdtrf +"avg"={gribTablesVersionNo=172;indicatorOfParameter=175;centre=98;} +# msnsrf +"avg"={gribTablesVersionNo=172;indicatorOfParameter=176;centre=98;} +# msntrf +"avg"={gribTablesVersionNo=172;indicatorOfParameter=177;centre=98;} +# mtnsrf +"avg"={gribTablesVersionNo=172;indicatorOfParameter=178;centre=98;} +# mtntrf +"avg"={gribTablesVersionNo=172;indicatorOfParameter=179;centre=98;} diff --git a/definitions/grib1/localConcepts/ecmf/units.def b/definitions/grib1/localConcepts/ecmf/units.def index 7fe4b06ee..bc63e7cd7 100644 --- a/definitions/grib1/localConcepts/ecmf/units.def +++ b/definitions/grib1/localConcepts/ecmf/units.def @@ -195,12 +195,12 @@ indicatorOfParameter = 28 ; } #Type of low vegetation -'(code table 4.234)' = { +'(Code table 4.234)' = { table2Version = 128 ; indicatorOfParameter = 29 ; } #Type of high vegetation -'(code table 4.234)' = { +'(Code table 4.234)' = { table2Version = 128 ; indicatorOfParameter = 30 ; } @@ -265,7 +265,7 @@ indicatorOfParameter = 42 ; } #Soil type -'~' = { +'(Code table 4.213)' = { table2Version = 128 ; indicatorOfParameter = 43 ; } @@ -13024,12 +13024,12 @@ table2Version = 151 ; indicatorOfParameter = 130 ; } -#Eastward sea water velocity +#Eastward surface sea water velocity 'm s**-1' = { table2Version = 151 ; indicatorOfParameter = 131 ; } -#Northward sea water velocity +#Northward surface sea water velocity 'm s**-1' = { table2Version = 151 ; indicatorOfParameter = 132 ; @@ -13244,7 +13244,7 @@ table2Version = 151 ; indicatorOfParameter = 174 ; } -#Average salinity in the upper 300m +#Average sea water practical salinity in the upper 300m 'psu' = { table2Version = 151 ; indicatorOfParameter = 175 ; diff --git a/definitions/grib1/localConcepts/rjtd/cfVarName.def b/definitions/grib1/localConcepts/rjtd/cfVarName.def index 5b95ee846..a41399122 100644 --- a/definitions/grib1/localConcepts/rjtd/cfVarName.def +++ b/definitions/grib1/localConcepts/rjtd/cfVarName.def @@ -665,16 +665,6 @@ table2Version = 200 ; indicatorOfParameter = 48 ; } -#U-component of current -'ucurr' = { - table2Version = 200 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'vcurr' = { - table2Version = 200 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio 'mixr' = { table2Version = 200 ; diff --git a/definitions/grib1/localConcepts/rjtd/name.def b/definitions/grib1/localConcepts/rjtd/name.def index 50010a10d..d23af9d8e 100644 --- a/definitions/grib1/localConcepts/rjtd/name.def +++ b/definitions/grib1/localConcepts/rjtd/name.def @@ -665,16 +665,6 @@ table2Version = 200 ; indicatorOfParameter = 48 ; } -#U-component of current -'U-component of current' = { - table2Version = 200 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'V-component of current' = { - table2Version = 200 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio 'Humidity mixing ratio' = { table2Version = 200 ; diff --git a/definitions/grib1/localConcepts/rjtd/paramId.def b/definitions/grib1/localConcepts/rjtd/paramId.def index 589e86e05..d08f41247 100644 --- a/definitions/grib1/localConcepts/rjtd/paramId.def +++ b/definitions/grib1/localConcepts/rjtd/paramId.def @@ -665,16 +665,6 @@ table2Version = 200 ; indicatorOfParameter = 48 ; } -#U-component of current -'3049' = { - table2Version = 200 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'3050' = { - table2Version = 200 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio '3053' = { table2Version = 200 ; diff --git a/definitions/grib1/localConcepts/rjtd/shortName.def b/definitions/grib1/localConcepts/rjtd/shortName.def index 109414b94..10b57b914 100644 --- a/definitions/grib1/localConcepts/rjtd/shortName.def +++ b/definitions/grib1/localConcepts/rjtd/shortName.def @@ -665,16 +665,6 @@ table2Version = 200 ; indicatorOfParameter = 48 ; } -#U-component of current -'ucurr' = { - table2Version = 200 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'vcurr' = { - table2Version = 200 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio 'mixr' = { table2Version = 200 ; diff --git a/definitions/grib1/localConcepts/rjtd/units.def b/definitions/grib1/localConcepts/rjtd/units.def index 93e7b0e56..8e177dd35 100644 --- a/definitions/grib1/localConcepts/rjtd/units.def +++ b/definitions/grib1/localConcepts/rjtd/units.def @@ -486,7 +486,7 @@ indicatorOfParameter = 253 ; } #Type of vegetation -'Code Table JMA-252' = { +'(Code table JMA-252)' = { table2Version = 200 ; indicatorOfParameter = 252 ; } @@ -665,16 +665,6 @@ table2Version = 200 ; indicatorOfParameter = 48 ; } -#U-component of current -'m s**-1' = { - table2Version = 200 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'m s**-1' = { - table2Version = 200 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio 'kg kg**-1' = { table2Version = 200 ; diff --git a/definitions/grib1/name.def b/definitions/grib1/name.def index 7d9a3f84b..e7352f034 100644 --- a/definitions/grib1/name.def +++ b/definitions/grib1/name.def @@ -1148,36 +1148,6 @@ table2Version = 1 ; indicatorOfParameter = 48 ; } -#U-component of current -'U-component of current' = { - table2Version = 3 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'U-component of current' = { - table2Version = 2 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'U-component of current' = { - table2Version = 1 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'V-component of current' = { - table2Version = 3 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'V-component of current' = { - table2Version = 2 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'V-component of current' = { - table2Version = 1 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio 'Humidity mixing ratio' = { table2Version = 3 ; diff --git a/definitions/grib1/paramId.def b/definitions/grib1/paramId.def index f3031f392..425fa489d 100644 --- a/definitions/grib1/paramId.def +++ b/definitions/grib1/paramId.def @@ -1148,36 +1148,6 @@ table2Version = 1 ; indicatorOfParameter = 48 ; } -#U-component of current -'3049' = { - table2Version = 3 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'3049' = { - table2Version = 2 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'3049' = { - table2Version = 1 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'3050' = { - table2Version = 3 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'3050' = { - table2Version = 2 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'3050' = { - table2Version = 1 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio '3053' = { table2Version = 3 ; diff --git a/definitions/grib1/paramIdForConversion.def b/definitions/grib1/paramIdForConversion.def new file mode 100644 index 000000000..8cd3ea212 --- /dev/null +++ b/definitions/grib1/paramIdForConversion.def @@ -0,0 +1,3 @@ +# Concept paramIdForConversion +# See ECC-1806 +0 = {dummy=0;} diff --git a/definitions/grib1/scanning_mode.def b/definitions/grib1/scanning_mode.def index 31a56e27d..19a7f8167 100644 --- a/definitions/grib1/scanning_mode.def +++ b/definitions/grib1/scanning_mode.def @@ -9,8 +9,8 @@ flagbit jScansPositively(scanningMode,6) : dump; flagbit jPointsAreConsecutive(scanningMode,5) : dump; constant alternativeRowScanning=0 : dump; -transient iScansPositively = !iScansNegatively : constraint; -transient jScansNegatively = !jScansPositively : constraint; +transient iScansPositively = !iScansNegatively : constraint, read_only; +transient jScansNegatively = !jScansPositively : constraint, read_only; alias geography.iScansNegatively=iScansNegatively; alias geography.jScansPositively=jScansPositively; diff --git a/definitions/grib1/section.1.def b/definitions/grib1/section.1.def index 2bda52ec7..d62300f27 100644 --- a/definitions/grib1/section.1.def +++ b/definitions/grib1/section.1.def @@ -325,3 +325,6 @@ if (stepTypeForConversion is "accum" || stepTypeForConversion is "max" || stepTy meta md5Section1 md5(offsetSection1,section1Length); # md5(start,length,blacklisted1,blacklisted2,...); meta md5Product md5(offsetSection1,section1Length,gridDefinition,section1Flags,decimalScaleFactor); + +# ECC-1806 +concept_nofail paramIdForConversion(zero, "paramIdForConversion.def", conceptsDir2, conceptsDir1) : long_type,read_only; diff --git a/definitions/grib1/shortName.def b/definitions/grib1/shortName.def index d78bf0d39..e2153ff94 100644 --- a/definitions/grib1/shortName.def +++ b/definitions/grib1/shortName.def @@ -1148,36 +1148,6 @@ table2Version = 1 ; indicatorOfParameter = 48 ; } -#U-component of current -'ucurr' = { - table2Version = 3 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'ucurr' = { - table2Version = 2 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'ucurr' = { - table2Version = 1 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'vcurr' = { - table2Version = 3 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'vcurr' = { - table2Version = 2 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'vcurr' = { - table2Version = 1 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio 'mixr' = { table2Version = 3 ; diff --git a/definitions/grib1/units.def b/definitions/grib1/units.def index a8a949696..4ad5faeaa 100644 --- a/definitions/grib1/units.def +++ b/definitions/grib1/units.def @@ -1148,36 +1148,6 @@ table2Version = 1 ; indicatorOfParameter = 48 ; } -#U-component of current -'m s**-1' = { - table2Version = 3 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'m s**-1' = { - table2Version = 2 ; - indicatorOfParameter = 49 ; - } -#U-component of current -'m s**-1' = { - table2Version = 1 ; - indicatorOfParameter = 49 ; - } -#V-component of current -'m s**-1' = { - table2Version = 3 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'m s**-1' = { - table2Version = 2 ; - indicatorOfParameter = 50 ; - } -#V-component of current -'m s**-1' = { - table2Version = 1 ; - indicatorOfParameter = 50 ; - } #Humidity mixing ratio 'kg kg**-1' = { table2Version = 3 ; diff --git a/definitions/grib2/boot.def b/definitions/grib2/boot.def index d2c44fb74..b92116397 100644 --- a/definitions/grib2/boot.def +++ b/definitions/grib2/boot.def @@ -11,7 +11,7 @@ # See https://community.wmo.int/activity-areas/wmo-codes/manual-codes/latest-version constant tablesVersionLatestOfficial = 32 : edition_specific; # If this is different from the official version, then it is the pre-operational version -constant tablesVersionLatest = 32 : edition_specific; +constant tablesVersionLatest = 33 : edition_specific; constant false = 0 : hidden; constant true = 1 : hidden; @@ -53,3 +53,6 @@ concept isTemplateDeprecated(false) { concept isTemplateExperimental(false) { 1 = { template_is_experimental = 1; } } + +# ECC-1806 +transient paramIdForConversion = 0; diff --git a/definitions/grib2/cfName.def b/definitions/grib2/cfName.def index 3ff5e57ac..c48900633 100644 --- a/definitions/grib2/cfName.def +++ b/definitions/grib2/cfName.def @@ -282,12 +282,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Depth of 20 C isotherm 'depth_of_isosurface_of_sea_water_potential_temperature' = { @@ -318,12 +312,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Heat flux correction 'heat_flux_correction' = { @@ -343,20 +331,6 @@ parameterCategory = 1 ; parameterNumber = 10 ; } -#Eastward sea water velocity -'eastward_sea_water_velocity' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - typeOfFirstFixedSurface = 160 ; - } -#Northward sea water velocity -'northward_sea_water_velocity' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - } #Nitrogen dioxide mass mixing ratio 'mass_fraction_of_nitrogen_dioxide_in_air' = { discipline = 0 ; diff --git a/definitions/grib2/cfVarName.def b/definitions/grib2/cfVarName.def index f6131186b..59d5cb399 100644 --- a/definitions/grib2/cfVarName.def +++ b/definitions/grib2/cfVarName.def @@ -4795,28 +4795,28 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean snow density -'mrsn' = { +'avg_rsn' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 61 ; typeOfStatisticalProcessing = 0 ; } #Time-mean low vegetation cover -'mcvl' = { +'avg_cvl' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 53 ; typeOfStatisticalProcessing = 0 ; } #Time-mean high vegetation cover -'mcvh' = { +'avg_cvh' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 54 ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea ice area fraction -'mci' = { +'avg_ci' = { discipline = 10 ; parameterCategory = 2 ; parameterNumber = 0 ; @@ -4824,7 +4824,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean sea surface temperature -'msst' = { +'avg_sst' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 0 ; @@ -4832,21 +4832,21 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean leaf area index, low vegetation -'mlai_lv' = { +'avg_lai_lv' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 55 ; typeOfStatisticalProcessing = 0 ; } #Time-mean leaf area index, high vegetation -'mlai_hv' = { +'avg_lai_hv' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 56 ; typeOfStatisticalProcessing = 0 ; } #Time-mean total column liquid water -'mtclw' = { +'avg_tclw' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 69 ; @@ -4855,7 +4855,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean total column cloud ice water -'mtciw' = { +'avg_tciw' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 70 ; @@ -4864,7 +4864,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean 2 metre specific humidity -'m2sh' = { +'avg_2sh' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 0 ; @@ -4875,7 +4875,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean lake mix-layer temperature -'mlmlt' = { +'avg_lmlt' = { discipline = 1 ; parameterCategory = 2 ; parameterNumber = 1 ; @@ -4884,7 +4884,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean lake mix-layer depth -'mlmld' = { +'avg_lmld' = { discipline = 1 ; parameterCategory = 2 ; parameterNumber = 0 ; @@ -4893,7 +4893,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean 2 metre relative humidity -'m2r' = { +'avg_2r' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 1 ; @@ -4903,56 +4903,98 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean fraction of snow cover -'mfscov' = { +'avg_fscov' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 121 ; typeOfStatisticalProcessing = 0 ; } #Time-mean soil temperature -'msot' = { +'avg_sot' = { discipline = 2 ; parameterCategory = 3 ; parameterNumber = 18 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean wind speed +'avg_ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean pressure +'avg_pres' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean potential vorticity +'avg_pv' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific rain water content +'avg_crwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific snow water content +'avg_cswc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eta-coordinate vertical velocity +'avg_etadot' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean geopotential -'mz' = { +'avg_z' = { discipline = 0 ; parameterCategory = 3 ; parameterNumber = 4 ; typeOfStatisticalProcessing = 0 ; } #Time-mean temperature -'mt' = { +'avg_t' = { discipline = 0 ; parameterCategory = 0 ; parameterNumber = 0 ; typeOfStatisticalProcessing = 0 ; } #Time-mean U component of wind -'mu' = { +'avg_u' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 2 ; typeOfStatisticalProcessing = 0 ; } #Time-mean V component of wind -'mv' = { +'avg_v' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 3 ; typeOfStatisticalProcessing = 0 ; } #Time-mean specific humidity -'mq' = { +'avg_q' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 0 ; typeOfStatisticalProcessing = 0 ; } #Time-mean surface pressure -'msp' = { +'avg_sp' = { discipline = 0 ; parameterCategory = 3 ; parameterNumber = 0 ; @@ -4960,14 +5002,14 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean vertical velocity -'mw' = { +'avg_w' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 8 ; typeOfStatisticalProcessing = 0 ; } #Time-mean total column water -'mtcw' = { +'avg_tcw' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 51 ; @@ -4976,7 +5018,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean total column vertically-integrated water vapour -'mtcwv' = { +'avg_tcwv' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 64 ; @@ -4984,30 +5026,44 @@ typeOfSecondFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean vorticity (relative) +'avg_vo' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean mean sea level pressure -'mmsl' = { +'avg_msl' = { discipline = 0 ; parameterCategory = 3 ; parameterNumber = 0 ; typeOfFirstFixedSurface = 101 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean divergence +'avg_d' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean relative humidity -'mr' = { +'avg_r' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 1 ; typeOfStatisticalProcessing = 0 ; } #Time-mean boundary layer height -'mblh' = { +'avg_blh' = { discipline = 0 ; parameterCategory = 3 ; parameterNumber = 18 ; typeOfStatisticalProcessing = 0 ; } #Time-mean 10 metre U wind component -'m10u' = { +'avg_10u' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 2 ; @@ -5017,7 +5073,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean 10 metre V wind component -'m10v' = { +'avg_10v' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 3 ; @@ -5027,7 +5083,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean 2 metre dewpoint temperature -'m2d' = { +'avg_2d' = { discipline = 0 ; parameterCategory = 0 ; parameterNumber = 6 ; @@ -5036,15 +5092,22 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean ozone mass mixing ratio +'avg_o3' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean temperature of snow layer -'mtsn' = { +'avg_tsn' = { discipline = 2 ; parameterCategory = 3 ; parameterNumber = 28 ; typeOfStatisticalProcessing = 0 ; } #Time-mean forecast surface roughness -'mfsr' = { +'avg_fsr' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 1 ; @@ -5052,13 +5115,159 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean forecast logarithm of surface roughness for heat -'mflsr' = { +'avg_flsr' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 54 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean specific cloud liquid water content +'avg_clwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific cloud ice water content +'avg_ciwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of cloud cover +'avg_cc' = { + discipline = 0 ; + parameterCategory = 6 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean K index +'avg_kx' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total totals index +'avg_totalx' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 4 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean clear air turbulence (CAT) +'avg_cat' = { + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 29 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean discharge from rivers or streams +'avg_dis' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (total layer) +'avg_swit' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (root zone) +'avg_swir' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 167 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index(layer) +'avg_swil' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 151 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain depth +'avg_flddep' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded fraction +'avg_fldffr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded area +'avg_fldfar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river fraction +'avg_rivfr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river area +'avg_rivar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of river coverage plus river related flooding +'avg_rivcffr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean area of river coverage plus river related flooding +'avg_rivcfar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-maximum volumetric soil moisture +'max_vsw' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 2 ; + } +#Time-minimum volumetric soil moisture +'min_vsw' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 3 ; + } +#Time-standard-deviation volumetric soil moisture +'std_vsw' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 6 ; + } #Cross sectional area of flow in channel 'chcross' = { discipline = 1 ; @@ -5125,26 +5334,6 @@ parameterCategory = 0 ; parameterNumber = 15 ; } -#Mean discharge in the last 6 hours -'dis06' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 6 ; - } -#Mean discharge in the last 24 hours -'dis24' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 24 ; - } #Snow depth at elevation bands 'sd_elev' = { discipline = 2 ; @@ -5197,6 +5386,48 @@ parameterCategory = 0 ; parameterNumber = 19 ; } +#Floodplain depth +'flddep' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Floodplain flooded fraction +'fldffr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } +#Floodplain flooded area +'fldfar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + } +#River fraction +'rivfr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + } +#River area +'rivar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + } +#Fraction of river coverage plus river related flooding +'rivcffr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + } +#Area of river coverage plus river related flooding +'rivcfar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + } #Latitude 'lat' = { discipline = 0 ; @@ -7154,6 +7385,48 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Standardised Precipitation Index (SPI) +'spi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 0 ; + } +#Standardised Precipitation Evapotranspiration Index (SPEI) +'spei' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 1 ; + } +#Standardised Streamflow Index (SSFI) +'ssfi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 2 ; + } +#Standardised Reservoir Supply Index (SRSI) +'srsi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 3 ; + } +#Standardised Water-level Index (SWI) +'swi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 4 ; + } +#Standardised Snowmelt and Rain Index (SMRI) +'smri' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 5 ; + } +#Streamflow Drought Index (SDI) +'sdi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 6 ; + } #Universal thermal climate index 'utci' = { discipline = 20 ; @@ -7291,12 +7564,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea ice area fraction 'siconc' = { @@ -7561,12 +7828,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea surface temperature 'tos' = { @@ -7657,36 +7918,18 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Northward surface stress 'tauvon' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface stress 'tauuoe' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Y-component of surface stress 'tauvo' = { @@ -7849,12 +8092,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Steric change in sea surface height 'stheig' = { @@ -8029,24 +8266,12 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface sea water velocity 'sve' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Heat Content surface to 26C isotherm 'hct26' = { @@ -8095,12 +8320,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Vertically integrated sea water practical salinity in the upper 300 m 'sc300v' = { @@ -8401,12 +8620,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea ice area fraction @@ -8694,12 +8907,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea surface temperature @@ -8798,12 +9005,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean northward surface stress @@ -8811,12 +9012,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface stress @@ -8824,12 +9019,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time mean Y-component of surface stress @@ -9006,12 +9195,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean steric change in sea surface height @@ -9201,12 +9384,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface sea water velocity @@ -9214,12 +9391,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean heat content surface to 26C isotherm @@ -9273,12 +9444,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean vertically integrated sea water practical salinity in the upper 300 m @@ -10018,6 +10183,44 @@ is_chemical_srcsink = 1 ; sourceSinkChemicalPhysicalProcess = 7 ; } +#Aerosol optical depth +'aod' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 102 ; + } +#Single scattering albedo +'ssa' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 103 ; + } +#Asymmetry Factor +'asymf' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 104 ; + } +#Aerosol backscatter from top of atmosphere +'aerbscattoa' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 107 ; + typeOfFirstFixedSurface = 8 ; + } +#Aerosol backscatter from ground +'aerbscatgnd' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 108 ; + typeOfFirstFixedSurface = 1 ; + } +#Aerosol extinction coefficient +'aerext' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 105 ; + } #Pressure tendency 'ptend' = { discipline = 0 ; @@ -10180,18 +10383,6 @@ parameterCategory = 2 ; parameterNumber = 16 ; } -#U-component of current -'ucurr' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - } -#V-component of current -'vcurr' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - } #Precipitable water 'pwat' = { discipline = 0 ; @@ -10558,19 +10749,11 @@ parameterCategory = 0 ; parameterNumber = 44 ; } -#Eastward sea water velocity -'uoe' = { +#Wave spectral peakedness +'wsp' = { discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - typeOfFirstFixedSurface = 160 ; - } -#Northward sea water velocity -'von' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; + parameterCategory = 0 ; + parameterNumber = 98 ; } #Skin reservoir content 'srcrea' = { diff --git a/definitions/grib2/local/ecmf/section4_extras.def b/definitions/grib2/local/ecmf/section4_extras.def new file mode 100644 index 000000000..0727c4b9a --- /dev/null +++ b/definitions/grib2/local/ecmf/section4_extras.def @@ -0,0 +1,12 @@ +# (C) Copyright 2005- ECMWF. + +# See ECC-1846 +if (centre is "ecmf" or datasetForLocal is "era6") { + concept_nofail modelName(unknown, "modelNameConcept.def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump, read_only; + + if (!(modelName is "unknown")) { + concept_nofail modelVersion(unknown, "modelVersionConcept_[modelName].def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump, read_only; + # alias ls.model = modelName; + # alias mars.model = modelName; + } +} diff --git a/definitions/grib2/localConcepts/cerise/cfVarName.def b/definitions/grib2/localConcepts/cerise/cfVarName.def index 4fc979f27..9d88fb46e 100644 --- a/definitions/grib2/localConcepts/cerise/cfVarName.def +++ b/definitions/grib2/localConcepts/cerise/cfVarName.def @@ -153,21 +153,21 @@ typeOfStatisticalProcessing = 1 ; } #Time-mean snow depth -'msde' = { +'avg_sde' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 11 ; typeOfStatisticalProcessing = 0 ; } #Time-mean snow cover -'msnowc' = { +'avg_snowc' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 42 ; typeOfStatisticalProcessing = 0 ; } #Time-mean snow depth -'msd_m' = { +'avg_sd_m' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 1 ; @@ -175,7 +175,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean low cloud cover -'mlcc_frac' = { +'avg_lcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -183,7 +183,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean medium cloud cover -'mmcc_frac' = { +'avg_mcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -191,7 +191,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean high cloud cover -'mhcc_frac' = { +'avg_hcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -199,7 +199,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean forecast albedo -'mfal_frac' = { +'avg_fal_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 19 ; diff --git a/definitions/grib2/localConcepts/cerise/shortName.def b/definitions/grib2/localConcepts/cerise/shortName.def index 4fc979f27..9d88fb46e 100644 --- a/definitions/grib2/localConcepts/cerise/shortName.def +++ b/definitions/grib2/localConcepts/cerise/shortName.def @@ -153,21 +153,21 @@ typeOfStatisticalProcessing = 1 ; } #Time-mean snow depth -'msde' = { +'avg_sde' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 11 ; typeOfStatisticalProcessing = 0 ; } #Time-mean snow cover -'msnowc' = { +'avg_snowc' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 42 ; typeOfStatisticalProcessing = 0 ; } #Time-mean snow depth -'msd_m' = { +'avg_sd_m' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 1 ; @@ -175,7 +175,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean low cloud cover -'mlcc_frac' = { +'avg_lcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -183,7 +183,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean medium cloud cover -'mmcc_frac' = { +'avg_mcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -191,7 +191,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean high cloud cover -'mhcc_frac' = { +'avg_hcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -199,7 +199,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean forecast albedo -'mfal_frac' = { +'avg_fal_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 19 ; diff --git a/definitions/grib2/localConcepts/cnmc/modelName.def b/definitions/grib2/localConcepts/cnmc/modelName.def deleted file mode 100644 index e7a85ed1f..000000000 --- a/definitions/grib2/localConcepts/cnmc/modelName.def +++ /dev/null @@ -1,7 +0,0 @@ -# modelName: Contribution from Daniel Lee @ DWD - -# defintions for Roma (COSMO LEPS) -'cosmo-leps' = { - subCentre=98; - grib2LocalSectionNumber=28; -} diff --git a/definitions/grib2/localConcepts/ecmf/cfVarName.def b/definitions/grib2/localConcepts/ecmf/cfVarName.def index 801bd6b5d..957489177 100644 --- a/definitions/grib2/localConcepts/ecmf/cfVarName.def +++ b/definitions/grib2/localConcepts/ecmf/cfVarName.def @@ -224,18 +224,6 @@ typeOfStatisticalProcessing = 3 ; lengthOfTimeRange = 24 ; } -#Mean temperature at 2 metres in the last 24 hours -'mean2t24' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours -'mn2d24' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 56 ; - } #Observation count 'obct' = { discipline = 192 ; @@ -13844,15 +13832,23 @@ typeOfStatisticalProcessing = 1 ; } #Time-mean snow depth -'msd_m' = { +'avg_sd_m' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 1 ; parameterNumber = 254 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean logarithm of surface pressure +'avg_lnsp' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean low cloud cover -'mlcc_frac' = { +'avg_lcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -13860,7 +13856,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean medium cloud cover -'mmcc_frac' = { +'avg_mcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -13868,7 +13864,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean high cloud cover -'mhcc_frac' = { +'avg_hcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -13876,7 +13872,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean forecast albedo -'mfal_frac' = { +'avg_fal_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 19 ; @@ -14443,18 +14439,6 @@ parameterCategory = 129 ; parameterNumber = 54 ; } -#Mean 2 metre temperature in the last 24 hours gradient -'mean2t24grd' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours gradient -'mn2d24grd' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 56 ; - } #Downward UV radiation at the surface gradient 'uvbgrd' = { discipline = 192 ; @@ -15727,12 +15711,6 @@ parameterCategory = 130 ; parameterNumber = 231 ; } -#Mean vertical velocity -'mvv' = { - discipline = 192 ; - parameterCategory = 130 ; - parameterNumber = 232 ; - } #2m temperature anomaly of at least +2K 't2ag2' = { discipline = 192 ; @@ -16631,42 +16609,12 @@ parameterCategory = 140 ; parameterNumber = 200 ; } -#Standard deviation wave height -'sdhs' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 240 ; - } -#Mean of 10 metre wind speed -'mu10' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 241 ; - } -#Mean wind direction -'mdwi' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 242 ; - } -#Standard deviation of 10 metre wind speed -'sdu' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 243 ; - } #2D wave spectra (multiple) 'd2sp' = { discipline = 192 ; parameterCategory = 140 ; parameterNumber = 250 ; } -#Wave spectral peakedness -'wsp' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 254 ; - } #Indicates a missing value 'p255.140' = { discipline = 192 ; @@ -18848,18 +18796,6 @@ parameterCategory = 172 ; parameterNumber = 145 ; } -#Mean surface sensible heat flux -'msshfl' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 146 ; - } -#Mean surface latent heat flux -'mslhfl' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 147 ; - } #Mean short-wave heating rate 'mswhr' = { discipline = 192 ; @@ -18872,54 +18808,6 @@ parameterCategory = 172 ; parameterNumber = 154 ; } -#Mean surface downward solar radiation flux -'msdsrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 169 ; - } -#Mean surface downward thermal radiation flux -'msdtrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 175 ; - } -#Mean surface net solar radiation flux -'msnsrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 176 ; - } -#Mean surface net thermal radiation flux -'msntrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 177 ; - } -#Mean top net solar radiation flux -'mtnsrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 178 ; - } -#Mean top net thermal radiation flux -'mtntrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 179 ; - } -#East-West surface stress rate of accumulation -'ewssra' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 180 ; - } -#North-South surface stress rate of accumulation -'nsssra' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 181 ; - } #Evaporation 'erate' = { localTablesVersion = 1 ; @@ -18962,36 +18850,6 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } -#Top net solar radiation, clear sky -'p208.172' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 208 ; - } -#Top net thermal radiation, clear sky -'p209.172' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 209 ; - } -#Surface net solar radiation, clear sky -'p210.172' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 210 ; - } -#Surface net thermal radiation, clear sky -'p211.172' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 211 ; - } -#Solar insolation rate of accumulation -'soira' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 212 ; - } #Mean total precipitation rate 'tprate' = { localTablesVersion = 1 ; diff --git a/definitions/grib2/localConcepts/ecmf/cfVarName.legacy.def b/definitions/grib2/localConcepts/ecmf/cfVarName.legacy.def index 4af98e981..cb38cc6e2 100644 --- a/definitions/grib2/localConcepts/ecmf/cfVarName.legacy.def +++ b/definitions/grib2/localConcepts/ecmf/cfVarName.legacy.def @@ -1627,3 +1627,153 @@ parameterCategory = 162 ; parameterNumber = 215 ; } +#Mean vertical velocity +'mvv' = { + discipline = 192 ; + parameterCategory = 130 ; + parameterNumber = 232 ; +} +#Mean surface sensible heat flux +'msshfl' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 146 ; +} +#Mean surface latent heat flux +'mslhfl' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 147 ; +} +#Mean temperature at 2 metres in the last 24 hours +'mean2t24' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 55 ; +} +#Mean 2 metre temperature in the last 24 hours gradient +'mean2t24grd' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 55 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours +'mn2d24' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 56 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours gradient +'mn2d24grd' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 56 ; +} +#Mean surface downward solar radiation flux +'msdsrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 169 ; +} +#Mean surface downward thermal radiation flux +'msdtrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 175 ; +} +#Mean surface net solar radiation flux +'msnsrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 176 ; +} +#Mean surface net thermal radiation flux +'msntrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 177 ; +} +#Mean top net solar radiation flux +'mtnsrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 178 ; +} +#Mean top net thermal radiation flux +'mtntrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 179 ; +} +#East-West surface stress rate of accumulation +'ewssra' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 180 ; +} +#North-South surface stress rate of accumulation +'nsssra' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 181 ; +} +#Standard deviation wave height +'sdhs' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 240 ; +} +#Mean of 10 metre wind speed +'mu10' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 241 ; +} +#Mean wind direction +'mdwi' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 242 ; +} +#Standard deviation of 10 metre wind speed +'sdu' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 243 ; +} +#Top net solar radiation, clear sky +'p208.172' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 208 ; +} +#Top net thermal radiation, clear sky +'p209.172' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 209 ; +} +#Surface net solar radiation, clear sky +'p210.172' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 210 ; +} +#Surface net thermal radiation, clear sky +'p211.172' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 211 ; +} +#Solar insolation rate of accumulation +'soira' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 212 ; +} +#Wave spectral peakedness +'wsp' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 254 ; +} diff --git a/definitions/grib2/localConcepts/ecmf/modelNameConcept.def b/definitions/grib2/localConcepts/ecmf/modelNameConcept.def new file mode 100644 index 000000000..5a7742c41 --- /dev/null +++ b/definitions/grib2/localConcepts/ecmf/modelNameConcept.def @@ -0,0 +1,6 @@ +'IFS' = { + backgroundProcess = 255; +} +'AIFS' = { + backgroundProcess = 1; +} diff --git a/definitions/grib2/localConcepts/ecmf/modelVersionConcept_AIFS.def b/definitions/grib2/localConcepts/ecmf/modelVersionConcept_AIFS.def new file mode 100644 index 000000000..b06e75f21 --- /dev/null +++ b/definitions/grib2/localConcepts/ecmf/modelVersionConcept_AIFS.def @@ -0,0 +1,2 @@ +'v1' = { generatingProcessIdentifier = 1; } +'v2' = { generatingProcessIdentifier = 2; } diff --git a/definitions/grib2/localConcepts/ecmf/modelVersionConcept_IFS.def b/definitions/grib2/localConcepts/ecmf/modelVersionConcept_IFS.def new file mode 100644 index 000000000..8445b7489 --- /dev/null +++ b/definitions/grib2/localConcepts/ecmf/modelVersionConcept_IFS.def @@ -0,0 +1,10 @@ +'cy49r1' = { generatingProcessIdentifier = 155; } +'cy48r1' = { generatingProcessIdentifier = 154; } +'cy47r3' = { generatingProcessIdentifier = 153; } +'cy47r2' = { generatingProcessIdentifier = 152; } +'cy47r1' = { generatingProcessIdentifier = 151; } +'cy46r1' = { generatingProcessIdentifier = 150; } +'cy45r1' = { generatingProcessIdentifier = 149; } +'cy43r3' = { generatingProcessIdentifier = 148; } +'cy43r1' = { generatingProcessIdentifier = 147; } +'cy41r2' = { generatingProcessIdentifier = 146; } diff --git a/definitions/grib2/localConcepts/ecmf/name.def b/definitions/grib2/localConcepts/ecmf/name.def index d615c6e98..2f7444e2a 100644 --- a/definitions/grib2/localConcepts/ecmf/name.def +++ b/definitions/grib2/localConcepts/ecmf/name.def @@ -224,18 +224,6 @@ typeOfStatisticalProcessing = 3 ; lengthOfTimeRange = 24 ; } -#Mean temperature at 2 metres in the last 24 hours -'Mean temperature at 2 metres in the last 24 hours' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours -'Mean 2 metre dewpoint temperature in the last 24 hours' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 56 ; - } #Observation count 'Observation count' = { discipline = 192 ; @@ -13851,6 +13839,14 @@ parameterNumber = 254 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean logarithm of surface pressure +'Time-mean logarithm of surface pressure' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean low cloud cover 'Time-mean low cloud cover' = { localTablesVersion = 1 ; @@ -14443,18 +14439,6 @@ parameterCategory = 129 ; parameterNumber = 54 ; } -#Mean 2 metre temperature in the last 24 hours gradient -'Mean 2 metre temperature in the last 24 hours gradient' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours gradient -'Mean 2 metre dewpoint temperature in the last 24 hours gradient' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 56 ; - } #Downward UV radiation at the surface gradient 'Downward UV radiation at the surface gradient' = { discipline = 192 ; @@ -15727,12 +15711,6 @@ parameterCategory = 130 ; parameterNumber = 231 ; } -#Mean vertical velocity -'Mean vertical velocity' = { - discipline = 192 ; - parameterCategory = 130 ; - parameterNumber = 232 ; - } #2m temperature anomaly of at least +2K '2m temperature anomaly of at least +2K' = { discipline = 192 ; @@ -16631,42 +16609,12 @@ parameterCategory = 140 ; parameterNumber = 200 ; } -#Standard deviation wave height -'Standard deviation wave height' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 240 ; - } -#Mean of 10 metre wind speed -'Mean of 10 metre wind speed' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 241 ; - } -#Mean wind direction -'Mean wind direction' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 242 ; - } -#Standard deviation of 10 metre wind speed -'Standard deviation of 10 metre wind speed' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 243 ; - } #2D wave spectra (multiple) '2D wave spectra (multiple)' = { discipline = 192 ; parameterCategory = 140 ; parameterNumber = 250 ; } -#Wave spectral peakedness -'Wave spectral peakedness' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 254 ; - } #Indicates a missing value 'Indicates a missing value' = { discipline = 192 ; @@ -18848,18 +18796,6 @@ parameterCategory = 172 ; parameterNumber = 145 ; } -#Mean surface sensible heat flux -'Mean surface sensible heat flux' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 146 ; - } -#Mean surface latent heat flux -'Mean surface latent heat flux' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 147 ; - } #Mean short-wave heating rate 'Mean short-wave heating rate' = { discipline = 192 ; @@ -18872,54 +18808,6 @@ parameterCategory = 172 ; parameterNumber = 154 ; } -#Mean surface downward solar radiation flux -'Mean surface downward solar radiation flux' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 169 ; - } -#Mean surface downward thermal radiation flux -'Mean surface downward thermal radiation flux' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 175 ; - } -#Mean surface net solar radiation flux -'Mean surface net solar radiation flux' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 176 ; - } -#Mean surface net thermal radiation flux -'Mean surface net thermal radiation flux' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 177 ; - } -#Mean top net solar radiation flux -'Mean top net solar radiation flux' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 178 ; - } -#Mean top net thermal radiation flux -'Mean top net thermal radiation flux' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 179 ; - } -#East-West surface stress rate of accumulation -'East-West surface stress rate of accumulation' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 180 ; - } -#North-South surface stress rate of accumulation -'North-South surface stress rate of accumulation' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 181 ; - } #Evaporation 'Evaporation' = { localTablesVersion = 1 ; @@ -18962,36 +18850,6 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } -#Top net solar radiation, clear sky -'Top net solar radiation, clear sky' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 208 ; - } -#Top net thermal radiation, clear sky -'Top net thermal radiation, clear sky' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 209 ; - } -#Surface net solar radiation, clear sky -'Surface net solar radiation, clear sky' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 210 ; - } -#Surface net thermal radiation, clear sky -'Surface net thermal radiation, clear sky' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 211 ; - } -#Solar insolation rate of accumulation -'Solar insolation rate of accumulation' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 212 ; - } #Mean total precipitation rate 'Mean total precipitation rate' = { localTablesVersion = 1 ; diff --git a/definitions/grib2/localConcepts/ecmf/name.legacy.def b/definitions/grib2/localConcepts/ecmf/name.legacy.def index 42f558b37..28b2586ef 100644 --- a/definitions/grib2/localConcepts/ecmf/name.legacy.def +++ b/definitions/grib2/localConcepts/ecmf/name.legacy.def @@ -1627,3 +1627,153 @@ parameterCategory = 162 ; parameterNumber = 215 ; } +#Mean vertical velocity +'Mean vertical velocity' = { + discipline = 192 ; + parameterCategory = 130 ; + parameterNumber = 232 ; +} +#Mean surface sensible heat flux +'Mean surface sensible heat flux' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 146 ; +} +#Mean surface latent heat flux +'Mean surface latent heat flux' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 147 ; +} +#Mean temperature at 2 metres in the last 24 hours +'Mean temperature at 2 metres in the last 24 hours' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 55 ; +} +#Mean 2 metre temperature in the last 24 hours gradient +'Mean 2 metre temperature in the last 24 hours gradient' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 55 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours +'Mean 2 metre dewpoint temperature in the last 24 hours' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 56 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours gradient +'Mean 2 metre dewpoint temperature in the last 24 hours gradient' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 56 ; +} +#Mean surface downward solar radiation flux +'Mean surface downward solar radiation flux' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 169 ; +} +#Mean surface downward thermal radiation flux +'Mean surface downward thermal radiation flux' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 175 ; +} +#Mean surface net solar radiation flux +'Mean surface net solar radiation flux' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 176 ; +} +#Mean surface net thermal radiation flux +'Mean surface net thermal radiation flux' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 177 ; +} +#Mean top net solar radiation flux +'Mean top net solar radiation flux' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 178 ; +} +#Mean top net thermal radiation flux +'Mean top net thermal radiation flux' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 179 ; +} +#East-West surface stress rate of accumulation +'East-West surface stress rate of accumulation' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 180 ; +} +#North-South surface stress rate of accumulation +'North-South surface stress rate of accumulation' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 181 ; +} +#Standard deviation wave height +'Standard deviation wave height' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 240 ; +} +#Mean of 10 metre wind speed +'Mean of 10 metre wind speed' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 241 ; +} +#Mean wind direction +'Mean wind direction' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 242 ; +} +#Standard deviation of 10 metre wind speed +'Standard deviation of 10 metre wind speed' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 243 ; +} +#Top net solar radiation, clear sky +'Top net solar radiation, clear sky' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 208 ; +} +#Top net thermal radiation, clear sky +'Top net thermal radiation, clear sky' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 209 ; +} +#Surface net solar radiation, clear sky +'Surface net solar radiation, clear sky' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 210 ; +} +#Surface net thermal radiation, clear sky +'Surface net thermal radiation, clear sky' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 211 ; +} +#Solar insolation rate of accumulation +'Solar insolation rate of accumulation' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 212 ; +} +#Wave spectral peakedness +'Wave spectral peakedness' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 254 ; +} diff --git a/definitions/grib2/localConcepts/ecmf/paramId.def b/definitions/grib2/localConcepts/ecmf/paramId.def index 46c8cd040..109f9f001 100644 --- a/definitions/grib2/localConcepts/ecmf/paramId.def +++ b/definitions/grib2/localConcepts/ecmf/paramId.def @@ -224,18 +224,6 @@ typeOfStatisticalProcessing = 3 ; lengthOfTimeRange = 24 ; } -#Mean temperature at 2 metres in the last 24 hours -'55' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours -'56' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 56 ; - } #Observation count '62' = { discipline = 192 ; @@ -13851,6 +13839,14 @@ parameterNumber = 254 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean logarithm of surface pressure +'235152' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean low cloud cover '235186' = { localTablesVersion = 1 ; @@ -14443,18 +14439,6 @@ parameterCategory = 129 ; parameterNumber = 54 ; } -#Mean 2 metre temperature in the last 24 hours gradient -'129055' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours gradient -'129056' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 56 ; - } #Downward UV radiation at the surface gradient '129057' = { discipline = 192 ; @@ -15727,12 +15711,6 @@ parameterCategory = 130 ; parameterNumber = 231 ; } -#Mean vertical velocity -'130232' = { - discipline = 192 ; - parameterCategory = 130 ; - parameterNumber = 232 ; - } #2m temperature anomaly of at least +2K '131001' = { discipline = 192 ; @@ -16631,42 +16609,12 @@ parameterCategory = 140 ; parameterNumber = 200 ; } -#Standard deviation wave height -'140240' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 240 ; - } -#Mean of 10 metre wind speed -'140241' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 241 ; - } -#Mean wind direction -'140242' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 242 ; - } -#Standard deviation of 10 metre wind speed -'140243' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 243 ; - } #2D wave spectra (multiple) '140250' = { discipline = 192 ; parameterCategory = 140 ; parameterNumber = 250 ; } -#Wave spectral peakedness -'140254' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 254 ; - } #Indicates a missing value '140255' = { discipline = 192 ; @@ -18848,18 +18796,6 @@ parameterCategory = 172 ; parameterNumber = 145 ; } -#Mean surface sensible heat flux -'172146' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 146 ; - } -#Mean surface latent heat flux -'172147' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 147 ; - } #Mean short-wave heating rate '172153' = { discipline = 192 ; @@ -18872,54 +18808,6 @@ parameterCategory = 172 ; parameterNumber = 154 ; } -#Mean surface downward solar radiation flux -'172169' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 169 ; - } -#Mean surface downward thermal radiation flux -'172175' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 175 ; - } -#Mean surface net solar radiation flux -'172176' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 176 ; - } -#Mean surface net thermal radiation flux -'172177' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 177 ; - } -#Mean top net solar radiation flux -'172178' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 178 ; - } -#Mean top net thermal radiation flux -'172179' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 179 ; - } -#East-West surface stress rate of accumulation -'172180' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 180 ; - } -#North-South surface stress rate of accumulation -'172181' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 181 ; - } #Evaporation '172182' = { localTablesVersion = 1 ; @@ -18962,36 +18850,6 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } -#Top net solar radiation, clear sky -'172208' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 208 ; - } -#Top net thermal radiation, clear sky -'172209' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 209 ; - } -#Surface net solar radiation, clear sky -'172210' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 210 ; - } -#Surface net thermal radiation, clear sky -'172211' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 211 ; - } -#Solar insolation rate of accumulation -'172212' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 212 ; - } #Mean total precipitation rate '172228' = { localTablesVersion = 1 ; diff --git a/definitions/grib2/localConcepts/ecmf/paramId.legacy.def b/definitions/grib2/localConcepts/ecmf/paramId.legacy.def index 082896fc5..df813254f 100644 --- a/definitions/grib2/localConcepts/ecmf/paramId.legacy.def +++ b/definitions/grib2/localConcepts/ecmf/paramId.legacy.def @@ -1627,3 +1627,153 @@ parameterCategory = 162 ; parameterNumber = 215 ; } +#Mean vertical velocity +'130232' = { + discipline = 192 ; + parameterCategory = 130 ; + parameterNumber = 232 ; +} +#Mean surface sensible heat flux +'172146' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 146 ; +} +#Mean surface latent heat flux +'172147' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 147 ; +} +#Mean temperature at 2 metres in the last 24 hours +'55' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 55 ; +} +#Mean 2 metre temperature in the last 24 hours gradient +'129055' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 55 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours +'56' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 56 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours gradient +'129056' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 56 ; +} +#Mean surface downward solar radiation flux +'172169' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 169 ; +} +#Mean surface downward thermal radiation flux +'172175' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 175 ; +} +#Mean surface net solar radiation flux +'172176' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 176 ; +} +#Mean surface net thermal radiation flux +'172177' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 177 ; +} +#Mean top net solar radiation flux +'172178' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 178 ; +} +#Mean top net thermal radiation flux +'172179' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 179 ; +} +#East-West surface stress rate of accumulation +'172180' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 180 ; +} +#North-South surface stress rate of accumulation +'172181' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 181 ; +} +#Standard deviation wave height +'140240' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 240 ; +} +#Mean of 10 metre wind speed +'140241' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 241 ; +} +#Mean wind direction +'140242' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 242 ; +} +#Standard deviation of 10 metre wind speed +'140243' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 243 ; +} +#Top net solar radiation, clear sky +'172208' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 208 ; +} +#Top net thermal radiation, clear sky +'172209' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 209 ; +} +#Surface net solar radiation, clear sky +'172210' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 210 ; +} +#Surface net thermal radiation, clear sky +'172211' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 211 ; +} +#Solar insolation rate of accumulation +'172212' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 212 ; +} +#Wave spectral peakedness +'140254' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 254 ; +} diff --git a/definitions/grib2/localConcepts/ecmf/shortName.def b/definitions/grib2/localConcepts/ecmf/shortName.def index 563048c1b..0c36a8dd0 100644 --- a/definitions/grib2/localConcepts/ecmf/shortName.def +++ b/definitions/grib2/localConcepts/ecmf/shortName.def @@ -224,18 +224,6 @@ typeOfStatisticalProcessing = 3 ; lengthOfTimeRange = 24 ; } -#Mean temperature at 2 metres in the last 24 hours -'mean2t24' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours -'mn2d24' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 56 ; - } #Observation count 'obct' = { discipline = 192 ; @@ -13844,15 +13832,23 @@ typeOfStatisticalProcessing = 1 ; } #Time-mean snow depth -'msd_m' = { +'avg_sd_m' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 1 ; parameterNumber = 254 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean logarithm of surface pressure +'avg_lnsp' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean low cloud cover -'mlcc_frac' = { +'avg_lcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -13860,7 +13856,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean medium cloud cover -'mmcc_frac' = { +'avg_mcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -13868,7 +13864,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean high cloud cover -'mhcc_frac' = { +'avg_hcc_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 6 ; @@ -13876,7 +13872,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean forecast albedo -'mfal_frac' = { +'avg_fal_frac' = { localTablesVersion = 1 ; discipline = 0 ; parameterCategory = 19 ; @@ -14443,18 +14439,6 @@ parameterCategory = 129 ; parameterNumber = 54 ; } -#Mean 2 metre temperature in the last 24 hours gradient -'mean2t24grd' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours gradient -'mn2d24grd' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 56 ; - } #Downward UV radiation at the surface gradient 'uvbgrd' = { discipline = 192 ; @@ -15727,12 +15711,6 @@ parameterCategory = 130 ; parameterNumber = 231 ; } -#Mean vertical velocity -'mvv' = { - discipline = 192 ; - parameterCategory = 130 ; - parameterNumber = 232 ; - } #2m temperature anomaly of at least +2K '2tag2' = { discipline = 192 ; @@ -16631,42 +16609,12 @@ parameterCategory = 140 ; parameterNumber = 200 ; } -#Standard deviation wave height -'sdhs' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 240 ; - } -#Mean of 10 metre wind speed -'mu10' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 241 ; - } -#Mean wind direction -'mdwi' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 242 ; - } -#Standard deviation of 10 metre wind speed -'sdu' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 243 ; - } #2D wave spectra (multiple) '2dsp' = { discipline = 192 ; parameterCategory = 140 ; parameterNumber = 250 ; } -#Wave spectral peakedness -'wsp' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 254 ; - } #Indicates a missing value '~' = { discipline = 192 ; @@ -18848,18 +18796,6 @@ parameterCategory = 172 ; parameterNumber = 145 ; } -#Mean surface sensible heat flux -'msshfl' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 146 ; - } -#Mean surface latent heat flux -'mslhfl' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 147 ; - } #Mean short-wave heating rate 'mswhr' = { discipline = 192 ; @@ -18872,54 +18808,6 @@ parameterCategory = 172 ; parameterNumber = 154 ; } -#Mean surface downward solar radiation flux -'msdsrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 169 ; - } -#Mean surface downward thermal radiation flux -'msdtrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 175 ; - } -#Mean surface net solar radiation flux -'msnsrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 176 ; - } -#Mean surface net thermal radiation flux -'msntrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 177 ; - } -#Mean top net solar radiation flux -'mtnsrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 178 ; - } -#Mean top net thermal radiation flux -'mtntrf' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 179 ; - } -#East-West surface stress rate of accumulation -'ewssra' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 180 ; - } -#North-South surface stress rate of accumulation -'nsssra' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 181 ; - } #Evaporation 'erate' = { localTablesVersion = 1 ; @@ -18962,36 +18850,6 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } -#Top net solar radiation, clear sky -'~' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 208 ; - } -#Top net thermal radiation, clear sky -'~' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 209 ; - } -#Surface net solar radiation, clear sky -'~' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 210 ; - } -#Surface net thermal radiation, clear sky -'~' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 211 ; - } -#Solar insolation rate of accumulation -'soira' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 212 ; - } #Mean total precipitation rate 'tprate' = { localTablesVersion = 1 ; diff --git a/definitions/grib2/localConcepts/ecmf/shortName.legacy.def b/definitions/grib2/localConcepts/ecmf/shortName.legacy.def index a09f11b7f..498f6a3c1 100644 --- a/definitions/grib2/localConcepts/ecmf/shortName.legacy.def +++ b/definitions/grib2/localConcepts/ecmf/shortName.legacy.def @@ -1627,3 +1627,153 @@ parameterCategory = 162 ; parameterNumber = 215 ; } +#Mean vertical velocity +'mvv' = { + discipline = 192 ; + parameterCategory = 130 ; + parameterNumber = 232 ; +} +#Mean surface sensible heat flux +'msshfl' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 146 ; +} +#Mean surface latent heat flux +'mslhfl' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 147 ; +} +#Mean temperature at 2 metres in the last 24 hours +'mean2t24' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 55 ; +} +#Mean 2 metre temperature in the last 24 hours gradient +'mean2t24grd' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 55 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours +'mn2d24' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 56 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours gradient +'mn2d24grd' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 56 ; +} +#Mean surface downward solar radiation flux +'msdsrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 169 ; +} +#Mean surface downward thermal radiation flux +'msdtrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 175 ; +} +#Mean surface net solar radiation flux +'msnsrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 176 ; +} +#Mean surface net thermal radiation flux +'msntrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 177 ; +} +#Mean top net solar radiation flux +'mtnsrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 178 ; +} +#Mean top net thermal radiation flux +'mtntrf' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 179 ; +} +#East-West surface stress rate of accumulation +'ewssra' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 180 ; +} +#North-South surface stress rate of accumulation +'nsssra' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 181 ; +} +#Standard deviation wave height +'sdhs' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 240 ; +} +#Mean of 10 metre wind speed +'mu10' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 241 ; +} +#Mean wind direction +'mdwi' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 242 ; +} +#Standard deviation of 10 metre wind speed +'sdu' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 243 ; +} +#Top net solar radiation, clear sky +'~' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 208 ; +} +#Top net thermal radiation, clear sky +'~' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 209 ; +} +#Surface net solar radiation, clear sky +'~' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 210 ; +} +#Surface net thermal radiation, clear sky +'~' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 211 ; +} +#Solar insolation rate of accumulation +'soira' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 212 ; +} +#Wave spectral peakedness +'wsp' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 254 ; +} diff --git a/definitions/grib2/localConcepts/ecmf/units.def b/definitions/grib2/localConcepts/ecmf/units.def index 6adc93e89..8a166eaa4 100644 --- a/definitions/grib2/localConcepts/ecmf/units.def +++ b/definitions/grib2/localConcepts/ecmf/units.def @@ -224,18 +224,6 @@ typeOfStatisticalProcessing = 3 ; lengthOfTimeRange = 24 ; } -#Mean temperature at 2 metres in the last 24 hours -'K' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours -'K' = { - discipline = 192 ; - parameterCategory = 128 ; - parameterNumber = 56 ; - } #Observation count '~' = { discipline = 192 ; @@ -13851,6 +13839,14 @@ parameterNumber = 254 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean logarithm of surface pressure +'Numeric' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean low cloud cover '(0 - 1)' = { localTablesVersion = 1 ; @@ -14443,18 +14439,6 @@ parameterCategory = 129 ; parameterNumber = 54 ; } -#Mean 2 metre temperature in the last 24 hours gradient -'K' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 55 ; - } -#Mean 2 metre dewpoint temperature in the last 24 hours gradient -'K' = { - discipline = 192 ; - parameterCategory = 129 ; - parameterNumber = 56 ; - } #Downward UV radiation at the surface gradient 'J m**-2' = { discipline = 192 ; @@ -15727,12 +15711,6 @@ parameterCategory = 130 ; parameterNumber = 231 ; } -#Mean vertical velocity -'Pa s**-1' = { - discipline = 192 ; - parameterCategory = 130 ; - parameterNumber = 232 ; - } #2m temperature anomaly of at least +2K '%' = { discipline = 192 ; @@ -16631,42 +16609,12 @@ parameterCategory = 140 ; parameterNumber = 200 ; } -#Standard deviation wave height -'m' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 240 ; - } -#Mean of 10 metre wind speed -'m s**-1' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 241 ; - } -#Mean wind direction -'degrees' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 242 ; - } -#Standard deviation of 10 metre wind speed -'m s**-1' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 243 ; - } #2D wave spectra (multiple) 'm**2 s radian**-1' = { discipline = 192 ; parameterCategory = 140 ; parameterNumber = 250 ; } -#Wave spectral peakedness -'dimensionless' = { - discipline = 192 ; - parameterCategory = 140 ; - parameterNumber = 254 ; - } #Indicates a missing value '~' = { discipline = 192 ; @@ -18848,18 +18796,6 @@ parameterCategory = 172 ; parameterNumber = 145 ; } -#Mean surface sensible heat flux -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 146 ; - } -#Mean surface latent heat flux -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 147 ; - } #Mean short-wave heating rate 'K s**-1' = { discipline = 192 ; @@ -18872,54 +18808,6 @@ parameterCategory = 172 ; parameterNumber = 154 ; } -#Mean surface downward solar radiation flux -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 169 ; - } -#Mean surface downward thermal radiation flux -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 175 ; - } -#Mean surface net solar radiation flux -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 176 ; - } -#Mean surface net thermal radiation flux -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 177 ; - } -#Mean top net solar radiation flux -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 178 ; - } -#Mean top net thermal radiation flux -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 179 ; - } -#East-West surface stress rate of accumulation -'N m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 180 ; - } -#North-South surface stress rate of accumulation -'N m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 181 ; - } #Evaporation 'm of water equivalent s**-1' = { localTablesVersion = 1 ; @@ -18962,36 +18850,6 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } -#Top net solar radiation, clear sky -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 208 ; - } -#Top net thermal radiation, clear sky -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 209 ; - } -#Surface net solar radiation, clear sky -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 210 ; - } -#Surface net thermal radiation, clear sky -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 211 ; - } -#Solar insolation rate of accumulation -'W m**-2' = { - discipline = 192 ; - parameterCategory = 172 ; - parameterNumber = 212 ; - } #Mean total precipitation rate 'm s**-1' = { localTablesVersion = 1 ; diff --git a/definitions/grib2/localConcepts/ecmf/units.legacy.def b/definitions/grib2/localConcepts/ecmf/units.legacy.def index 6094190f0..d7675c4d6 100644 --- a/definitions/grib2/localConcepts/ecmf/units.legacy.def +++ b/definitions/grib2/localConcepts/ecmf/units.legacy.def @@ -1627,3 +1627,153 @@ parameterCategory = 162 ; parameterNumber = 215 ; } +#Mean vertical velocity +'Pa s**-1' = { + discipline = 192 ; + parameterCategory = 130 ; + parameterNumber = 232 ; +} +#Mean surface sensible heat flux +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 146 ; +} +#Mean surface latent heat flux +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 147 ; +} +#Mean temperature at 2 metres in the last 24 hours +'K' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 55 ; +} +#Mean 2 metre temperature in the last 24 hours gradient +'K' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 55 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours +'K' = { + discipline = 192 ; + parameterCategory = 128 ; + parameterNumber = 56 ; +} +#Mean 2 metre dewpoint temperature in the last 24 hours gradient +'K' = { + discipline = 192 ; + parameterCategory = 129 ; + parameterNumber = 56 ; +} +#Mean surface downward solar radiation flux +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 169 ; +} +#Mean surface downward thermal radiation flux +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 175 ; +} +#Mean surface net solar radiation flux +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 176 ; +} +#Mean surface net thermal radiation flux +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 177 ; +} +#Mean top net solar radiation flux +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 178 ; +} +#Mean top net thermal radiation flux +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 179 ; +} +#East-West surface stress rate of accumulation +'N m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 180 ; +} +#North-South surface stress rate of accumulation +'N m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 181 ; +} +#Standard deviation wave height +'m' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 240 ; +} +#Mean of 10 metre wind speed +'m s**-1' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 241 ; +} +#Mean wind direction +'degrees' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 242 ; +} +#Standard deviation of 10 metre wind speed +'m s**-1' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 243 ; +} +#Top net solar radiation, clear sky +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 208 ; +} +#Top net thermal radiation, clear sky +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 209 ; +} +#Surface net solar radiation, clear sky +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 210 ; +} +#Surface net thermal radiation, clear sky +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 211 ; +} +#Solar insolation rate of accumulation +'W m**-2' = { + discipline = 192 ; + parameterCategory = 172 ; + parameterNumber = 212 ; +} +#Wave spectral peakedness +'dimensionless' = { + discipline = 192 ; + parameterCategory = 140 ; + parameterNumber = 254 ; +} diff --git a/definitions/grib2/localConcepts/edzw/modelName.def b/definitions/grib2/localConcepts/edzw/modelName.def deleted file mode 100644 index 5af6fb6e6..000000000 --- a/definitions/grib2/localConcepts/edzw/modelName.def +++ /dev/null @@ -1,107 +0,0 @@ -# modelName: Contribution from Daniel Lee @ DWD - -# definitions for Offenbach -'cosmo_eu' = { - generatingProcessIdentifier=131; -} -'cosmo_eu' = { - generatingProcessIdentifier=132; -} -'cosmo_eu' = { - generatingProcessIdentifier=134; -} -'cosmo_eu' = { - generatingProcessIdentifier=135; -} -'cosmo_de' = { - generatingProcessIdentifier=137; -} -'cosmo_de' = { - generatingProcessIdentifier=138; -} -'cosmo_de-eps' = { - generatingProcessIdentifier=137; - typeOfEnsembleForecast=192; -} -'cosmo_de-eps' = { - generatingProcessIdentifier=138; - typeOfEnsembleForecast=192; -} - -#DWD model names for ICON -'icogl' = { - gridDefinitionTemplateNumber=101; - generatingProcessIdentifier=1; -} -'icogl130' = { - numberOfGridUsed=26; - generatingProcessIdentifier=1; -} -'icogl130l90' = { - numberOfGridUsed=26; - nlev=91; - generatingProcessIdentifier=1; -} -'icogl130p' = { - numberOfGridUsed=26; - typeOfFirstFixedSurface=100; - generatingProcessIdentifier=1; -} -'icoeu'= { - gridDefinitionTemplateNumber=101; - generatingProcessIdentifier=2; -} -'icoeu065' = { - numberOfGridUsed=27; - generatingProcessIdentifier=2; -} -'icoeu065l60' = { - numberOfGridUsed=27; - nlev=61; - generatingProcessIdentifier=2; -} -'icreu' = { - gridDefinitionTemplateNumber=0; - generatingProcessIdentifier=2; -} -'icreu_0.625' = { - gridDefinitionTemplateNumber=0; - Dx=62500; - Dy=62500; - generatingProcessIdentifier=2; -} -'icreu_0.625l60' = { - gridDefinitionTemplateNumber=0; - Dx=62500; - Dy=62500; - nlev=61; - generatingProcessIdentifier=2; -} -'icreu_0.625p' = { - gridDefinitionTemplateNumber=0; - Dx=62500; - Dy=62500; - typeOfFirstFixedSurface=100; - generatingProcessIdentifier=2; -} -'icreu_0.625z' = { - gridDefinitionTemplateNumber=0; - Dx=62500; - Dy=62500; - typeOfFirstFixedSurface=102; - generatingProcessIdentifier=2; -} -'icrde' = { - gridDefinitionTemplateNumber=0; - generatingProcessIdentifier=3; -} -'icrgl' = { - gridDefinitionTemplateNumber=0; - generatingProcessIdentifier=1; -} -'icrgl_0.25' = { - gridDefinitionTemplateNumber=0; - Dx=250000; - Dy=250000; - generatingProcessIdentifier=1; -} diff --git a/definitions/grib2/localConcepts/era/cfName.def b/definitions/grib2/localConcepts/era/cfName.def index f4a8abea5..8292efdd2 100644 --- a/definitions/grib2/localConcepts/era/cfName.def +++ b/definitions/grib2/localConcepts/era/cfName.def @@ -27,6 +27,27 @@ parameterNumber = 8 ; typeOfStatisticalProcessing = 0 ; } +#Vorticity (relative) +'atmosphere_relative_vorticity' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } +#Divergence +'divergence_of_wind' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } +#Ozone mass mixing ratio +'mass_fraction_of_ozone_in_air' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Snow depth 'lwe_thickness_of_surface_snow_amount' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/era/name.def b/definitions/grib2/localConcepts/era/name.def index 78a476de6..82944f3b2 100644 --- a/definitions/grib2/localConcepts/era/name.def +++ b/definitions/grib2/localConcepts/era/name.def @@ -1,4 +1,25 @@ # Automatically generated by ./create_def.pl, do not edit +#Specific rain water content +'Specific rain water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific snow water content +'Specific snow water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } +#Eta-coordinate vertical velocity +'Eta-coordinate vertical velocity' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Geopotential 'Geopotential' = { discipline = 0 ; @@ -27,6 +48,13 @@ parameterNumber = 8 ; typeOfStatisticalProcessing = 0 ; } +#Vorticity (relative) +'Vorticity (relative)' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } #Logarithm of surface pressure 'Logarithm of surface pressure' = { discipline = 0 ; @@ -34,6 +62,49 @@ parameterNumber = 25 ; typeOfFirstFixedSurface = 105 ; } +#Logarithm of surface pressure +'Logarithm of surface pressure' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; + } +#Divergence +'Divergence' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } +#Ozone mass mixing ratio +'Ozone mass mixing ratio' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud liquid water content +'Specific cloud liquid water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud ice water content +'Specific cloud ice water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } +#Fraction of cloud cover +'Fraction of cloud cover' = { + discipline = 0 ; + parameterCategory = 6 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Temperature difference 'Temperature difference' = { discipline = 192 ; @@ -479,6 +550,13 @@ parameterCategory = 228 ; parameterNumber = 103 ; } +#Precipitation type +'Precipitation type' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } #Snow cover 'Snow cover' = { discipline = 0 ; @@ -486,6 +564,20 @@ parameterNumber = 42 ; typeOfStatisticalProcessing = 0 ; } +#K index +'K index' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Total totals index +'Total totals index' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 4 ; + typeOfStatisticalProcessing = 0 ; + } #Sea water potential temperature 'Sea water potential temperature' = { discipline = 192 ; diff --git a/definitions/grib2/localConcepts/era/paramId.def b/definitions/grib2/localConcepts/era/paramId.def index 31219cfa9..b4c978e14 100644 --- a/definitions/grib2/localConcepts/era/paramId.def +++ b/definitions/grib2/localConcepts/era/paramId.def @@ -1,4 +1,25 @@ # Automatically generated by ./create_def.pl, do not edit +#Specific rain water content +'75' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific snow water content +'76' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } +#Eta-coordinate vertical velocity +'77' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Geopotential '129' = { discipline = 0 ; @@ -27,6 +48,13 @@ parameterNumber = 8 ; typeOfStatisticalProcessing = 0 ; } +#Vorticity (relative) +'138' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } #Logarithm of surface pressure '152' = { discipline = 0 ; @@ -34,6 +62,49 @@ parameterNumber = 25 ; typeOfFirstFixedSurface = 105 ; } +#Logarithm of surface pressure +'152' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; + } +#Divergence +'155' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } +#Ozone mass mixing ratio +'203' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud liquid water content +'246' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud ice water content +'247' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } +#Fraction of cloud cover +'248' = { + discipline = 0 ; + parameterCategory = 6 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Temperature difference '200130' = { discipline = 192 ; @@ -479,6 +550,13 @@ parameterCategory = 228 ; parameterNumber = 103 ; } +#Precipitation type +'260015' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } #Snow cover '260038' = { discipline = 0 ; @@ -486,6 +564,20 @@ parameterNumber = 42 ; typeOfStatisticalProcessing = 0 ; } +#K index +'260121' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Total totals index +'260123' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 4 ; + typeOfStatisticalProcessing = 0 ; + } #Sea water potential temperature '151129' = { discipline = 192 ; diff --git a/definitions/grib2/localConcepts/era/shortName.def b/definitions/grib2/localConcepts/era/shortName.def index beb0f3d79..088ae3b62 100644 --- a/definitions/grib2/localConcepts/era/shortName.def +++ b/definitions/grib2/localConcepts/era/shortName.def @@ -1,4 +1,25 @@ # Automatically generated by ./create_def.pl, do not edit +#Specific rain water content +'crwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific snow water content +'cswc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } +#Eta-coordinate vertical velocity +'etadot' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Geopotential 'z' = { discipline = 0 ; @@ -27,6 +48,13 @@ parameterNumber = 8 ; typeOfStatisticalProcessing = 0 ; } +#Vorticity (relative) +'vo' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } #Logarithm of surface pressure 'lnsp' = { discipline = 0 ; @@ -34,6 +62,49 @@ parameterNumber = 25 ; typeOfFirstFixedSurface = 105 ; } +#Logarithm of surface pressure +'lnsp' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; + } +#Divergence +'d' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } +#Ozone mass mixing ratio +'o3' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud liquid water content +'clwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud ice water content +'ciwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } +#Fraction of cloud cover +'cc' = { + discipline = 0 ; + parameterCategory = 6 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Temperature difference 'tdiff' = { discipline = 192 ; @@ -479,6 +550,13 @@ parameterCategory = 228 ; parameterNumber = 103 ; } +#Precipitation type +'ptype' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } #Snow cover 'snowc' = { discipline = 0 ; @@ -486,6 +564,20 @@ parameterNumber = 42 ; typeOfStatisticalProcessing = 0 ; } +#K index +'kx' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Total totals index +'totalx' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 4 ; + typeOfStatisticalProcessing = 0 ; + } #Sea water potential temperature 'thetao' = { discipline = 192 ; diff --git a/definitions/grib2/localConcepts/era/units.def b/definitions/grib2/localConcepts/era/units.def index 95c5b4af8..28ac983af 100644 --- a/definitions/grib2/localConcepts/era/units.def +++ b/definitions/grib2/localConcepts/era/units.def @@ -1,4 +1,25 @@ # Automatically generated by ./create_def.pl, do not edit +#Specific rain water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific snow water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } +#Eta-coordinate vertical velocity +'s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Geopotential 'm**2 s**-2' = { discipline = 0 ; @@ -27,6 +48,13 @@ parameterNumber = 8 ; typeOfStatisticalProcessing = 0 ; } +#Vorticity (relative) +'s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } #Logarithm of surface pressure 'Numeric' = { discipline = 0 ; @@ -34,6 +62,49 @@ parameterNumber = 25 ; typeOfFirstFixedSurface = 105 ; } +#Logarithm of surface pressure +'Numeric' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; + } +#Divergence +'s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } +#Ozone mass mixing ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud liquid water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud ice water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } +#Fraction of cloud cover +'(0 - 1)' = { + discipline = 0 ; + parameterCategory = 6 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Temperature difference 'K' = { discipline = 192 ; @@ -479,6 +550,13 @@ parameterCategory = 228 ; parameterNumber = 103 ; } +#Precipitation type +'(Code table 4.201)' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } #Snow cover '%' = { discipline = 0 ; @@ -486,6 +564,20 @@ parameterNumber = 42 ; typeOfStatisticalProcessing = 0 ; } +#K index +'K' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Total totals index +'K' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 4 ; + typeOfStatisticalProcessing = 0 ; + } #Sea water potential temperature 'deg C' = { discipline = 192 ; diff --git a/definitions/grib2/localConcepts/era6/cfName.def b/definitions/grib2/localConcepts/era6/cfName.def index b4593411b..e86ee85d4 100644 --- a/definitions/grib2/localConcepts/era6/cfName.def +++ b/definitions/grib2/localConcepts/era6/cfName.def @@ -1,4 +1,40 @@ # Automatically generated by ./create_def.pl, do not edit +#U component of wind +'eastward_wind' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#U component of wind +'eastward_wind' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'northward_wind' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'northward_wind' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } #Snow depth 'lwe_thickness_of_surface_snow_amount' = { localTablesVersion = 1 ; @@ -42,6 +78,14 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Albedo (climatological) +'surface_albedo' = { + localTablesVersion = 1 ; + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 193 ; + typeOfGeneratingProcess = 9 ; + } #Evaporation 'lwe_thickness_of_water_evaporation_amount' = { localTablesVersion = 1 ; diff --git a/definitions/grib2/localConcepts/era6/modelNameConcept.def b/definitions/grib2/localConcepts/era6/modelNameConcept.def new file mode 100644 index 000000000..5a7742c41 --- /dev/null +++ b/definitions/grib2/localConcepts/era6/modelNameConcept.def @@ -0,0 +1,6 @@ +'IFS' = { + backgroundProcess = 255; +} +'AIFS' = { + backgroundProcess = 1; +} diff --git a/definitions/grib2/localConcepts/era6/modelVersionConcept_AIFS.def b/definitions/grib2/localConcepts/era6/modelVersionConcept_AIFS.def new file mode 100644 index 000000000..b06e75f21 --- /dev/null +++ b/definitions/grib2/localConcepts/era6/modelVersionConcept_AIFS.def @@ -0,0 +1,2 @@ +'v1' = { generatingProcessIdentifier = 1; } +'v2' = { generatingProcessIdentifier = 2; } diff --git a/definitions/grib2/localConcepts/era6/modelVersionConcept_IFS.def b/definitions/grib2/localConcepts/era6/modelVersionConcept_IFS.def new file mode 100644 index 000000000..38757a209 --- /dev/null +++ b/definitions/grib2/localConcepts/era6/modelVersionConcept_IFS.def @@ -0,0 +1,2 @@ +'cy48r1' = { generatingProcessIdentifier = 154; } +'cy47r3' = { generatingProcessIdentifier = 153; } diff --git a/definitions/grib2/localConcepts/era6/name.def b/definitions/grib2/localConcepts/era6/name.def index a716f4abd..af79f7845 100644 --- a/definitions/grib2/localConcepts/era6/name.def +++ b/definitions/grib2/localConcepts/era6/name.def @@ -17,6 +17,24 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#Wind speed +'Wind speed' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#Wind speed +'Wind speed' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } #UV visible albedo for direct radiation (climatological) 'UV visible albedo for direct radiation (climatological)' = { localTablesVersion = 1 ; @@ -74,6 +92,42 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#U component of wind +'U component of wind' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#U component of wind +'U component of wind' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'V component of wind' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'V component of wind' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } #Snow depth 'Snow depth' = { localTablesVersion = 1 ; @@ -124,6 +178,14 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Albedo (climatological) +'Albedo (climatological)' = { + localTablesVersion = 1 ; + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 193 ; + typeOfGeneratingProcess = 9 ; + } #Evaporation 'Evaporation' = { localTablesVersion = 1 ; @@ -400,4 +462,12 @@ constituentType = 3 ; typeOfStatisticalProcessing = 0 ; is_chemical = 1 ; + } +#Time-mean logarithm of surface pressure +'Time-mean logarithm of surface pressure' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; } diff --git a/definitions/grib2/localConcepts/era6/paramId.def b/definitions/grib2/localConcepts/era6/paramId.def index 48ebc11f2..efa120d15 100644 --- a/definitions/grib2/localConcepts/era6/paramId.def +++ b/definitions/grib2/localConcepts/era6/paramId.def @@ -17,6 +17,24 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#Wind speed +'10' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#Wind speed +'10' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } #UV visible albedo for direct radiation (climatological) '15' = { localTablesVersion = 1 ; @@ -74,6 +92,42 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#U component of wind +'131' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#U component of wind +'131' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'132' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'132' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } #Snow depth '141' = { localTablesVersion = 1 ; @@ -124,6 +178,14 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Albedo (climatological) +'174' = { + localTablesVersion = 1 ; + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 193 ; + typeOfGeneratingProcess = 9 ; + } #Evaporation '182' = { localTablesVersion = 1 ; @@ -400,4 +462,12 @@ constituentType = 3 ; typeOfStatisticalProcessing = 0 ; is_chemical = 1 ; + } +#Time-mean logarithm of surface pressure +'235152' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; } diff --git a/definitions/grib2/localConcepts/era6/shortName.def b/definitions/grib2/localConcepts/era6/shortName.def index 02efcff3c..118656c0f 100644 --- a/definitions/grib2/localConcepts/era6/shortName.def +++ b/definitions/grib2/localConcepts/era6/shortName.def @@ -17,6 +17,24 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#Wind speed +'ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#Wind speed +'ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } #UV visible albedo for direct radiation (climatological) 'aluvp' = { localTablesVersion = 1 ; @@ -74,6 +92,42 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#U component of wind +'u' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#U component of wind +'u' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'v' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'v' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } #Snow depth 'sd' = { localTablesVersion = 1 ; @@ -124,6 +178,14 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Albedo (climatological) +'al' = { + localTablesVersion = 1 ; + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 193 ; + typeOfGeneratingProcess = 9 ; + } #Evaporation 'e' = { localTablesVersion = 1 ; @@ -400,4 +462,12 @@ constituentType = 3 ; typeOfStatisticalProcessing = 0 ; is_chemical = 1 ; + } +#Time-mean logarithm of surface pressure +'avg_lnsp' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; } diff --git a/definitions/grib2/localConcepts/era6/units.def b/definitions/grib2/localConcepts/era6/units.def index 828da275e..edd86225f 100644 --- a/definitions/grib2/localConcepts/era6/units.def +++ b/definitions/grib2/localConcepts/era6/units.def @@ -17,6 +17,24 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#Wind speed +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#Wind speed +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } #UV visible albedo for direct radiation (climatological) '(0 - 1)' = { localTablesVersion = 1 ; @@ -74,6 +92,42 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } +#U component of wind +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#U component of wind +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + } +#V component of wind +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + } #Snow depth 'm of water equivalent' = { localTablesVersion = 1 ; @@ -124,6 +178,14 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Albedo (climatological) +'(0 - 1)' = { + localTablesVersion = 1 ; + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 193 ; + typeOfGeneratingProcess = 9 ; + } #Evaporation 'm of water equivalent' = { localTablesVersion = 1 ; @@ -400,4 +462,12 @@ constituentType = 3 ; typeOfStatisticalProcessing = 0 ; is_chemical = 1 ; + } +#Time-mean logarithm of surface pressure +'Numeric' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 25 ; + typeOfFirstFixedSurface = 105 ; + typeOfStatisticalProcessing = 0 ; } diff --git a/definitions/grib2/localConcepts/hydro/cfVarName.def b/definitions/grib2/localConcepts/hydro/cfVarName.def index 19b565498..a0f1b1f69 100644 --- a/definitions/grib2/localConcepts/hydro/cfVarName.def +++ b/definitions/grib2/localConcepts/hydro/cfVarName.def @@ -1,4 +1,24 @@ # Automatically generated by ./create_def.pl, do not edit +#Mean discharge in the last 6 hours +'dis06' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 6 ; + } +#Mean discharge in the last 24 hours +'dis24' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 24 ; + } #Total precipitation in the last 6 hours 'tp06' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/hydro/name.def b/definitions/grib2/localConcepts/hydro/name.def index 5390805f1..8becdbb9b 100644 --- a/definitions/grib2/localConcepts/hydro/name.def +++ b/definitions/grib2/localConcepts/hydro/name.def @@ -1,4 +1,24 @@ # Automatically generated by ./create_def.pl, do not edit +#Mean discharge in the last 6 hours +'Mean discharge in the last 6 hours' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 6 ; + } +#Mean discharge in the last 24 hours +'Mean discharge in the last 24 hours' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 24 ; + } #Total precipitation in the last 6 hours 'Total precipitation in the last 6 hours' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/hydro/paramId.def b/definitions/grib2/localConcepts/hydro/paramId.def index dfd704793..6f29e63ed 100644 --- a/definitions/grib2/localConcepts/hydro/paramId.def +++ b/definitions/grib2/localConcepts/hydro/paramId.def @@ -1,4 +1,24 @@ # Automatically generated by ./create_def.pl, do not edit +#Mean discharge in the last 6 hours +'240023' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 6 ; + } +#Mean discharge in the last 24 hours +'240024' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 24 ; + } #Total precipitation in the last 6 hours '260267' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/hydro/shortName.def b/definitions/grib2/localConcepts/hydro/shortName.def index 19b565498..a0f1b1f69 100644 --- a/definitions/grib2/localConcepts/hydro/shortName.def +++ b/definitions/grib2/localConcepts/hydro/shortName.def @@ -1,4 +1,24 @@ # Automatically generated by ./create_def.pl, do not edit +#Mean discharge in the last 6 hours +'dis06' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 6 ; + } +#Mean discharge in the last 24 hours +'dis24' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 24 ; + } #Total precipitation in the last 6 hours 'tp06' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/hydro/units.def b/definitions/grib2/localConcepts/hydro/units.def index 60d462f2d..11078673a 100644 --- a/definitions/grib2/localConcepts/hydro/units.def +++ b/definitions/grib2/localConcepts/hydro/units.def @@ -1,4 +1,24 @@ # Automatically generated by ./create_def.pl, do not edit +#Mean discharge in the last 6 hours +'m**3 s**-1' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 6 ; + } +#Mean discharge in the last 24 hours +'m**3 s**-1' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfFirstFixedSurface = 1 ; + indicatorOfUnitForTimeRange = 1 ; + typeOfStatisticalProcessing = 0 ; + lengthOfTimeRange = 24 ; + } #Total precipitation in the last 6 hours 'kg m**-2' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/lssw/modelName.def b/definitions/grib2/localConcepts/lssw/modelName.def deleted file mode 100644 index 6413c0d1c..000000000 --- a/definitions/grib2/localConcepts/lssw/modelName.def +++ /dev/null @@ -1,17 +0,0 @@ -# modelName: Contribution from Daniel Lee @ DWD -# definitions for Zurich -'cosmo-1' = { - generatingProcessIdentifier=101; -} -'cosmo-2' = { - generatingProcessIdentifier=102; -} -'cosmo-7' = { - generatingProcessIdentifier=107; -} -'cosmo-e' = { - generatingProcessIdentifier=103; -} -'cosmo-e' = { - generatingProcessIdentifier=130; -} diff --git a/definitions/grib2/localConcepts/s2s/cfName.def b/definitions/grib2/localConcepts/s2s/cfName.def index bcf3dbc72..76e473557 100644 --- a/definitions/grib2/localConcepts/s2s/cfName.def +++ b/definitions/grib2/localConcepts/s2s/cfName.def @@ -56,6 +56,22 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Eastward surface sea water velocity +'eastward_sea_water_velocity' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } +#Northward surface sea water velocity +'northward_sea_water_velocity' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } #Sea surface height 'sea_surface_height_above_geoid' = { discipline = 10 ; diff --git a/definitions/grib2/localConcepts/s2s/cfVarName.def b/definitions/grib2/localConcepts/s2s/cfVarName.def index 7b1815490..551609168 100644 --- a/definitions/grib2/localConcepts/s2s/cfVarName.def +++ b/definitions/grib2/localConcepts/s2s/cfVarName.def @@ -173,6 +173,22 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Eastward surface sea water velocity +'ocu' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } +#Northward surface sea water velocity +'ocv' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } #Sea surface height 'zos' = { discipline = 10 ; @@ -199,7 +215,7 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } -#Average salinity in the upper 300m +#Average sea water practical salinity in the upper 300m 'sav300' = { discipline = 10 ; parameterCategory = 4 ; diff --git a/definitions/grib2/localConcepts/s2s/name.def b/definitions/grib2/localConcepts/s2s/name.def index 8f16d165e..cf970208c 100644 --- a/definitions/grib2/localConcepts/s2s/name.def +++ b/definitions/grib2/localConcepts/s2s/name.def @@ -173,6 +173,22 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Eastward surface sea water velocity +'Eastward surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } +#Northward surface sea water velocity +'Northward surface sea water velocity' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } #Sea surface height 'Sea surface height' = { discipline = 10 ; @@ -199,8 +215,8 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } -#Average salinity in the upper 300m -'Average salinity in the upper 300m' = { +#Average sea water practical salinity in the upper 300m +'Average sea water practical salinity in the upper 300m' = { discipline = 10 ; parameterCategory = 4 ; parameterNumber = 21 ; diff --git a/definitions/grib2/localConcepts/s2s/paramId.def b/definitions/grib2/localConcepts/s2s/paramId.def index 9443ada3a..bfc1c9ee1 100644 --- a/definitions/grib2/localConcepts/s2s/paramId.def +++ b/definitions/grib2/localConcepts/s2s/paramId.def @@ -173,6 +173,22 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Eastward surface sea water velocity +'151131' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } +#Northward surface sea water velocity +'151132' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } #Sea surface height '151145' = { discipline = 10 ; @@ -199,7 +215,7 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } -#Average salinity in the upper 300m +#Average sea water practical salinity in the upper 300m '151175' = { discipline = 10 ; parameterCategory = 4 ; diff --git a/definitions/grib2/localConcepts/s2s/shortName.def b/definitions/grib2/localConcepts/s2s/shortName.def index 4722e59a4..135b5992a 100644 --- a/definitions/grib2/localConcepts/s2s/shortName.def +++ b/definitions/grib2/localConcepts/s2s/shortName.def @@ -173,6 +173,22 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Eastward surface sea water velocity +'ocu' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } +#Northward surface sea water velocity +'ocv' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } #Sea surface height 'zos' = { discipline = 10 ; @@ -199,7 +215,7 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } -#Average salinity in the upper 300m +#Average sea water practical salinity in the upper 300m 'sav300' = { discipline = 10 ; parameterCategory = 4 ; diff --git a/definitions/grib2/localConcepts/s2s/units.def b/definitions/grib2/localConcepts/s2s/units.def index a2bd46e5d..a37997b56 100644 --- a/definitions/grib2/localConcepts/s2s/units.def +++ b/definitions/grib2/localConcepts/s2s/units.def @@ -173,6 +173,22 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } +#Eastward surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 2 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } +#Northward surface sea water velocity +'m s**-1' = { + discipline = 10 ; + parameterCategory = 1 ; + parameterNumber = 3 ; + typeOfFirstFixedSurface = 160 ; + typeOfStatisticalProcessing = 0 ; + } #Sea surface height 'm' = { discipline = 10 ; @@ -199,7 +215,7 @@ scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } -#Average salinity in the upper 300m +#Average sea water practical salinity in the upper 300m 'psu' = { discipline = 10 ; parameterCategory = 4 ; diff --git a/definitions/grib2/localConcepts/uerra/cfVarName.def b/definitions/grib2/localConcepts/uerra/cfVarName.def index 2242d96a0..f7f2d915c 100644 --- a/definitions/grib2/localConcepts/uerra/cfVarName.def +++ b/definitions/grib2/localConcepts/uerra/cfVarName.def @@ -17,6 +17,33 @@ scaledValueOfFirstFixedSurface = 200 ; scaleFactorOfFirstFixedSurface = 0 ; } +#Wind speed +'ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } #Sea ice area fraction 'ci' = { discipline = 10 ; @@ -75,6 +102,34 @@ indicatorOfUnitForTimeRange = 1 ; typeOfStatisticalProcessing = 2 ; } +#Pressure +'pres' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Potential vorticity +'pv' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific rain water content +'crwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific snow water content +'cswc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } #Total column cloud liquid water 'tclw' = { discipline = 0 ; @@ -287,6 +342,20 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Specific cloud liquid water content +'clwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud ice water content +'ciwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } #2 metre specific humidity 'sh2' = { discipline = 0 ; @@ -298,6 +367,13 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Precipitation type +'ptype' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } #Total column integrated water vapour 'tciwv' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/uerra/name.def b/definitions/grib2/localConcepts/uerra/name.def index 59a55bdf5..da1a828b1 100644 --- a/definitions/grib2/localConcepts/uerra/name.def +++ b/definitions/grib2/localConcepts/uerra/name.def @@ -17,6 +17,33 @@ scaledValueOfFirstFixedSurface = 200 ; scaleFactorOfFirstFixedSurface = 0 ; } +#Wind speed +'Wind speed' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'Wind speed' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'Wind speed' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } #Sea ice area fraction 'Sea ice area fraction' = { discipline = 10 ; @@ -75,6 +102,34 @@ indicatorOfUnitForTimeRange = 1 ; typeOfStatisticalProcessing = 2 ; } +#Pressure +'Pressure' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Potential vorticity +'Potential vorticity' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific rain water content +'Specific rain water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific snow water content +'Specific snow water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } #Total column cloud liquid water 'Total column cloud liquid water' = { discipline = 0 ; @@ -287,6 +342,20 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Specific cloud liquid water content +'Specific cloud liquid water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud ice water content +'Specific cloud ice water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } #2 metre specific humidity '2 metre specific humidity' = { discipline = 0 ; @@ -298,6 +367,13 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Precipitation type +'Precipitation type' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } #Total column integrated water vapour 'Total column integrated water vapour' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/uerra/paramId.def b/definitions/grib2/localConcepts/uerra/paramId.def index 8db696b0d..729478df6 100644 --- a/definitions/grib2/localConcepts/uerra/paramId.def +++ b/definitions/grib2/localConcepts/uerra/paramId.def @@ -17,6 +17,33 @@ scaledValueOfFirstFixedSurface = 200 ; scaleFactorOfFirstFixedSurface = 0 ; } +#Wind speed +'10' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'10' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'10' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } #Sea ice area fraction '31' = { discipline = 10 ; @@ -75,6 +102,34 @@ indicatorOfUnitForTimeRange = 1 ; typeOfStatisticalProcessing = 2 ; } +#Pressure +'54' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Potential vorticity +'60' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific rain water content +'75' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific snow water content +'76' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } #Total column cloud liquid water '78' = { discipline = 0 ; @@ -287,6 +342,20 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Specific cloud liquid water content +'246' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud ice water content +'247' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } #2 metre specific humidity '174096' = { discipline = 0 ; @@ -298,6 +367,13 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Precipitation type +'260015' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } #Total column integrated water vapour '260057' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/uerra/shortName.def b/definitions/grib2/localConcepts/uerra/shortName.def index 9eefdd1fe..b16b48100 100644 --- a/definitions/grib2/localConcepts/uerra/shortName.def +++ b/definitions/grib2/localConcepts/uerra/shortName.def @@ -17,6 +17,33 @@ scaledValueOfFirstFixedSurface = 200 ; scaleFactorOfFirstFixedSurface = 0 ; } +#Wind speed +'ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } #Sea ice area fraction 'ci' = { discipline = 10 ; @@ -75,6 +102,34 @@ indicatorOfUnitForTimeRange = 1 ; typeOfStatisticalProcessing = 2 ; } +#Pressure +'pres' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Potential vorticity +'pv' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific rain water content +'crwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific snow water content +'cswc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } #Total column cloud liquid water 'tclw' = { discipline = 0 ; @@ -287,6 +342,20 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Specific cloud liquid water content +'clwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud ice water content +'ciwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } #2 metre specific humidity '2sh' = { discipline = 0 ; @@ -298,6 +367,13 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Precipitation type +'ptype' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } #Total column integrated water vapour 'tciwv' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/uerra/units.def b/definitions/grib2/localConcepts/uerra/units.def index 1abfdfd20..f86099f59 100644 --- a/definitions/grib2/localConcepts/uerra/units.def +++ b/definitions/grib2/localConcepts/uerra/units.def @@ -17,6 +17,33 @@ scaledValueOfFirstFixedSurface = 200 ; scaleFactorOfFirstFixedSurface = 0 ; } +#Wind speed +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 100 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Wind speed +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfFirstFixedSurface = 103 ; + scaledValueOfFirstFixedSurface = 200 ; + scaleFactorOfFirstFixedSurface = 0 ; + typeOfStatisticalProcessing = 0 ; + } #Sea ice area fraction '(0 - 1)' = { discipline = 10 ; @@ -75,6 +102,34 @@ indicatorOfUnitForTimeRange = 1 ; typeOfStatisticalProcessing = 2 ; } +#Pressure +'Pa' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Potential vorticity +'K m**2 kg**-1 s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific rain water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific snow water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } #Total column cloud liquid water 'kg m**-2' = { discipline = 0 ; @@ -287,6 +342,20 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Specific cloud liquid water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Specific cloud ice water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } #2 metre specific humidity 'kg kg**-1' = { discipline = 0 ; @@ -298,6 +367,13 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Precipitation type +'(Code table 4.201)' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } #Total column integrated water vapour 'kg m**-2' = { discipline = 0 ; diff --git a/definitions/grib2/modelName.def b/definitions/grib2/modelName.def deleted file mode 100644 index 25b89c3d1..000000000 --- a/definitions/grib2/modelName.def +++ /dev/null @@ -1,43 +0,0 @@ -# modelName: Contribution from Daniel Lee @ DWD - -# COSMO -# general definition -'cosmo' = { originatingCentre=250; } -'cosmo' = { subCentre=250; } - -# definitions for ARPA-SIMC -'cosmo-i2' = { originatingCentre=200; - generatingProcessIdentifier=36; } -'cosmo-i2' = { originatingCentre=200; - generatingProcessIdentifier=139; } -'cosmo-i2' = { originatingCentre=200; - generatingProcessIdentifier=144; } -'cosmo-i2' = { originatingCentre=200; - generatingProcessIdentifier=148; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=31; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=32; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=34; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=38; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=42; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=46; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=131; } -# definitions for Moscow -'cosmo_ru' = { originatingCentre=76; - generatingProcessIdentifier=135; } -'cosmo_ru-eps' = { originatingCentre=76; - generatingProcessIdentifier=235;} - -# definitions for Athens -'cosmo-greece' = { originatingCentre=96;} -# definitions for Warsaw / Poland -'cosmo-poland' = { originatingCentre=220;} -# definitions for Romania -'cosmo-romania' = { originatingCentre=242;} - diff --git a/definitions/grib2/modelNameConcept.def b/definitions/grib2/modelNameConcept.def new file mode 100644 index 000000000..6c68ab7da --- /dev/null +++ b/definitions/grib2/modelNameConcept.def @@ -0,0 +1 @@ +"unknown" = {dummy=0;} diff --git a/definitions/grib2/name.def b/definitions/grib2/name.def index a7a37c891..1ebf330ac 100644 --- a/definitions/grib2/name.def +++ b/definitions/grib2/name.def @@ -4916,6 +4916,48 @@ parameterNumber = 18 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean wind speed +'Time-mean wind speed' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean pressure +'Time-mean pressure' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean potential vorticity +'Time-mean potential vorticity' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific rain water content +'Time-mean specific rain water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific snow water content +'Time-mean specific snow water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eta-coordinate vertical velocity +'Time-mean eta-coordinate vertical velocity' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean geopotential 'Time-mean geopotential' = { discipline = 0 ; @@ -4984,6 +5026,13 @@ typeOfSecondFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean vorticity (relative) +'Time-mean vorticity (relative)' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean mean sea level pressure 'Time-mean mean sea level pressure' = { discipline = 0 ; @@ -4992,6 +5041,13 @@ typeOfFirstFixedSurface = 101 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean divergence +'Time-mean divergence' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean relative humidity 'Time-mean relative humidity' = { discipline = 0 ; @@ -5036,6 +5092,13 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean ozone mass mixing ratio +'Time-mean ozone mass mixing ratio' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean temperature of snow layer 'Time-mean temperature of snow layer' = { discipline = 2 ; @@ -5059,6 +5122,152 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean specific cloud liquid water content +'Time-mean specific cloud liquid water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific cloud ice water content +'Time-mean specific cloud ice water content' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of cloud cover +'Time-mean fraction of cloud cover' = { + discipline = 0 ; + parameterCategory = 6 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean K index +'Time-mean K index' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total totals index +'Time-mean total totals index' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 4 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean clear air turbulence (CAT) +'Time-mean clear air turbulence (CAT)' = { + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 29 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean discharge from rivers or streams +'Time-mean discharge from rivers or streams' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (total layer) +'Time-mean soil wetness index (total layer)' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (root zone) +'Time-mean soil wetness index (root zone)' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 167 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index(layer) +'Time-mean soil wetness index(layer)' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 151 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain depth +'Time-mean floodplain depth' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded fraction +'Time-mean floodplain flooded fraction' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded area +'Time-mean floodplain flooded area' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river fraction +'Time-mean river fraction' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river area +'Time-mean river area' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of river coverage plus river related flooding +'Time-mean fraction of river coverage plus river related flooding' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean area of river coverage plus river related flooding +'Time-mean area of river coverage plus river related flooding' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-maximum volumetric soil moisture +'Time-maximum volumetric soil moisture' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 2 ; + } +#Time-minimum volumetric soil moisture +'Time-minimum volumetric soil moisture' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 3 ; + } +#Time-standard-deviation volumetric soil moisture +'Time-standard-deviation volumetric soil moisture' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 6 ; + } #Cross sectional area of flow in channel 'Cross sectional area of flow in channel' = { discipline = 1 ; @@ -5125,26 +5334,6 @@ parameterCategory = 0 ; parameterNumber = 15 ; } -#Mean discharge in the last 6 hours -'Mean discharge in the last 6 hours' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 6 ; - } -#Mean discharge in the last 24 hours -'Mean discharge in the last 24 hours' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 24 ; - } #Snow depth at elevation bands 'Snow depth at elevation bands' = { discipline = 2 ; @@ -5197,6 +5386,48 @@ parameterCategory = 0 ; parameterNumber = 19 ; } +#Floodplain depth +'Floodplain depth' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Floodplain flooded fraction +'Floodplain flooded fraction' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } +#Floodplain flooded area +'Floodplain flooded area' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + } +#River fraction +'River fraction' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + } +#River area +'River area' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + } +#Fraction of river coverage plus river related flooding +'Fraction of river coverage plus river related flooding' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + } +#Area of river coverage plus river related flooding +'Area of river coverage plus river related flooding' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + } #Latitude 'Latitude' = { discipline = 0 ; @@ -7154,6 +7385,48 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Standardised Precipitation Index (SPI) +'Standardised Precipitation Index (SPI)' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 0 ; + } +#Standardised Precipitation Evapotranspiration Index (SPEI) +'Standardised Precipitation Evapotranspiration Index (SPEI)' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 1 ; + } +#Standardised Streamflow Index (SSFI) +'Standardised Streamflow Index (SSFI)' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 2 ; + } +#Standardised Reservoir Supply Index (SRSI) +'Standardised Reservoir Supply Index (SRSI)' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 3 ; + } +#Standardised Water-level Index (SWI) +'Standardised Water-level Index (SWI)' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 4 ; + } +#Standardised Snowmelt and Rain Index (SMRI) +'Standardised Snowmelt and Rain Index (SMRI)' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 5 ; + } +#Streamflow Drought Index (SDI) +'Streamflow Drought Index (SDI)' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 6 ; + } #Universal thermal climate index 'Universal thermal climate index' = { discipline = 20 ; @@ -7291,12 +7564,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea ice area fraction 'Sea ice area fraction' = { @@ -7561,12 +7828,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea surface temperature 'Sea surface temperature' = { @@ -7657,36 +7918,18 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Northward surface stress 'Northward surface stress' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface stress 'Eastward surface stress' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Y-component of surface stress 'Y-component of surface stress' = { @@ -7849,12 +8092,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Steric change in sea surface height 'Steric change in sea surface height' = { @@ -8029,24 +8266,12 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface sea water velocity 'Eastward surface sea water velocity' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Heat Content surface to 26C isotherm 'Heat Content surface to 26C isotherm' = { @@ -8095,12 +8320,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Vertically integrated sea water practical salinity in the upper 300 m 'Vertically integrated sea water practical salinity in the upper 300 m' = { @@ -8401,12 +8620,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea ice area fraction @@ -8694,12 +8907,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea surface temperature @@ -8798,12 +9005,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean northward surface stress @@ -8811,12 +9012,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface stress @@ -8824,12 +9019,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time mean Y-component of surface stress @@ -9006,12 +9195,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean steric change in sea surface height @@ -9201,12 +9384,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface sea water velocity @@ -9214,12 +9391,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean heat content surface to 26C isotherm @@ -9273,12 +9444,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean vertically integrated sea water practical salinity in the upper 300 m @@ -10018,6 +10183,44 @@ is_chemical_srcsink = 1 ; sourceSinkChemicalPhysicalProcess = 7 ; } +#Aerosol optical depth +'Aerosol optical depth' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 102 ; + } +#Single scattering albedo +'Single scattering albedo' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 103 ; + } +#Asymmetry Factor +'Asymmetry Factor' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 104 ; + } +#Aerosol backscatter from top of atmosphere +'Aerosol backscatter from top of atmosphere' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 107 ; + typeOfFirstFixedSurface = 8 ; + } +#Aerosol backscatter from ground +'Aerosol backscatter from ground' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 108 ; + typeOfFirstFixedSurface = 1 ; + } +#Aerosol extinction coefficient +'Aerosol extinction coefficient' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 105 ; + } #Pressure tendency 'Pressure tendency' = { discipline = 0 ; @@ -10180,18 +10383,6 @@ parameterCategory = 2 ; parameterNumber = 16 ; } -#U-component of current -'U-component of current' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - } -#V-component of current -'V-component of current' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - } #Precipitable water 'Precipitable water' = { discipline = 0 ; @@ -10558,19 +10749,11 @@ parameterCategory = 0 ; parameterNumber = 44 ; } -#Eastward sea water velocity -'Eastward sea water velocity' = { +#Wave spectral peakedness +'Wave spectral peakedness' = { discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - typeOfFirstFixedSurface = 160 ; - } -#Northward sea water velocity -'Northward sea water velocity' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; + parameterCategory = 0 ; + parameterNumber = 98 ; } #Skin reservoir content 'Skin reservoir content' = { diff --git a/definitions/grib2/paramId.def b/definitions/grib2/paramId.def index 28efe0568..440df8d15 100644 --- a/definitions/grib2/paramId.def +++ b/definitions/grib2/paramId.def @@ -4916,6 +4916,48 @@ parameterNumber = 18 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean wind speed +'235097' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean pressure +'235098' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean potential vorticity +'235100' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific rain water content +'235101' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific snow water content +'235102' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eta-coordinate vertical velocity +'235103' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean geopotential '235129' = { discipline = 0 ; @@ -4984,6 +5026,13 @@ typeOfSecondFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean vorticity (relative) +'235138' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean mean sea level pressure '235151' = { discipline = 0 ; @@ -4992,6 +5041,13 @@ typeOfFirstFixedSurface = 101 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean divergence +'235155' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean relative humidity '235157' = { discipline = 0 ; @@ -5036,6 +5092,13 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean ozone mass mixing ratio +'235203' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean temperature of snow layer '235238' = { discipline = 2 ; @@ -5059,6 +5122,152 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean specific cloud liquid water content +'235246' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific cloud ice water content +'235247' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of cloud cover +'235248' = { + discipline = 0 ; + parameterCategory = 6 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean K index +'235257' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total totals index +'235258' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 4 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean clear air turbulence (CAT) +'235262' = { + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 29 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean discharge from rivers or streams +'235270' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (total layer) +'235271' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (root zone) +'235272' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 167 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index(layer) +'235273' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 151 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain depth +'235274' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded fraction +'235275' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded area +'235276' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river fraction +'235277' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river area +'235278' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of river coverage plus river related flooding +'235279' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean area of river coverage plus river related flooding +'235280' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-maximum volumetric soil moisture +'237077' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 2 ; + } +#Time-minimum volumetric soil moisture +'238077' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 3 ; + } +#Time-standard-deviation volumetric soil moisture +'239077' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 6 ; + } #Cross sectional area of flow in channel '240011' = { discipline = 1 ; @@ -5125,26 +5334,6 @@ parameterCategory = 0 ; parameterNumber = 15 ; } -#Mean discharge in the last 6 hours -'240023' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 6 ; - } -#Mean discharge in the last 24 hours -'240024' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 24 ; - } #Snow depth at elevation bands '240026' = { discipline = 2 ; @@ -5197,6 +5386,48 @@ parameterCategory = 0 ; parameterNumber = 19 ; } +#Floodplain depth +'240035' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Floodplain flooded fraction +'240036' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } +#Floodplain flooded area +'240037' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + } +#River fraction +'240038' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + } +#River area +'240039' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + } +#Fraction of river coverage plus river related flooding +'240040' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + } +#Area of river coverage plus river related flooding +'240041' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + } #Latitude '250001' = { discipline = 0 ; @@ -7154,6 +7385,48 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Standardised Precipitation Index (SPI) +'260658' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 0 ; + } +#Standardised Precipitation Evapotranspiration Index (SPEI) +'260659' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 1 ; + } +#Standardised Streamflow Index (SSFI) +'260660' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 2 ; + } +#Standardised Reservoir Supply Index (SRSI) +'260661' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 3 ; + } +#Standardised Water-level Index (SWI) +'260662' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 4 ; + } +#Standardised Snowmelt and Rain Index (SMRI) +'260663' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 5 ; + } +#Streamflow Drought Index (SDI) +'260664' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 6 ; + } #Universal thermal climate index '261001' = { discipline = 20 ; @@ -7291,12 +7564,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea ice area fraction '262001' = { @@ -7561,12 +7828,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea surface temperature '262101' = { @@ -7657,36 +7918,18 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Northward surface stress '262109' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface stress '262110' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Y-component of surface stress '262111' = { @@ -7849,12 +8092,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Steric change in sea surface height '262125' = { @@ -8029,24 +8266,12 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface sea water velocity '262140' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Heat Content surface to 26C isotherm '262141' = { @@ -8095,12 +8320,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Vertically integrated sea water practical salinity in the upper 300 m '262146' = { @@ -8401,12 +8620,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea ice area fraction @@ -8694,12 +8907,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea surface temperature @@ -8798,12 +9005,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean northward surface stress @@ -8811,12 +9012,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface stress @@ -8824,12 +9019,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time mean Y-component of surface stress @@ -9006,12 +9195,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean steric change in sea surface height @@ -9201,12 +9384,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface sea water velocity @@ -9214,12 +9391,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean heat content surface to 26C isotherm @@ -9273,12 +9444,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean vertically integrated sea water practical salinity in the upper 300 m @@ -10018,6 +10183,44 @@ is_chemical_srcsink = 1 ; sourceSinkChemicalPhysicalProcess = 7 ; } +#Aerosol optical depth +'457000' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 102 ; + } +#Single scattering albedo +'458000' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 103 ; + } +#Asymmetry Factor +'459000' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 104 ; + } +#Aerosol backscatter from top of atmosphere +'460000' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 107 ; + typeOfFirstFixedSurface = 8 ; + } +#Aerosol backscatter from ground +'461000' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 108 ; + typeOfFirstFixedSurface = 1 ; + } +#Aerosol extinction coefficient +'462000' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 105 ; + } #Pressure tendency '3003' = { discipline = 0 ; @@ -10180,18 +10383,6 @@ parameterCategory = 2 ; parameterNumber = 16 ; } -#U-component of current -'3049' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - } -#V-component of current -'3050' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - } #Precipitable water '3054' = { discipline = 0 ; @@ -10558,19 +10749,11 @@ parameterCategory = 0 ; parameterNumber = 44 ; } -#Eastward sea water velocity -'151131' = { +#Wave spectral peakedness +'140254' = { discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - typeOfFirstFixedSurface = 160 ; - } -#Northward sea water velocity -'151132' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; + parameterCategory = 0 ; + parameterNumber = 98 ; } #Skin reservoir content '160198' = { diff --git a/definitions/grib2/parameters.def b/definitions/grib2/parameters.def index 6ffe2fe0d..0ddf9f901 100644 --- a/definitions/grib2/parameters.def +++ b/definitions/grib2/parameters.def @@ -27,9 +27,6 @@ concept cfVarNameLegacyECMF(defaultShortName,"cfVarName.legacy.def",conceptsMast concept cfVarNameECMF (cfVarNameLegacyECMF,"cfVarName.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy; concept cfVarName (cfVarNameECMF,"cfVarName.def",conceptsDir2,conceptsDir1): no_copy,dump; -# modelName: Contribution from Daniel Lee @ DWD -concept modelName (defaultName,"modelName.def",conceptsDir2,conceptsDir1): no_copy,dump,read_only; - template_nofail names "grib2/products_[productionStatusOfProcessedData].def"; meta ifsParam ifs_param(paramId,type); diff --git a/definitions/grib2/section.1.def b/definitions/grib2/section.1.def index 88fd55b80..c4e3c21f1 100644 --- a/definitions/grib2/section.1.def +++ b/definitions/grib2/section.1.def @@ -6,7 +6,7 @@ meta section1Pointer section_pointer(offsetSection1,section1Length,1); unsigned[1] numberOfSection = 1 :read_only; -codetable[2] centre 'common/c-11.table' : dump,string_type; +codetable[2] centre 'common/c-11.table' : dump,string_type; alias identificationOfOriginatingGeneratingCentre=centre; meta centreDescription codetable_title(centre); @@ -14,7 +14,7 @@ alias parameter.centre=centre; alias ls.centre=centre; alias originatingCentre=centre; -unsigned[2] subCentre : dump; +unsigned[2] subCentre : dump; _if (subCentre==98 ) { alias centreForLocal=subCentre; @@ -54,20 +54,20 @@ unsigned[1] hour; unsigned[1] minute; unsigned[1] second; -meta dataDate g2date(year,month,day) : dump; +meta dataDate g2date(year,month,day) : dump; alias mars.date = dataDate; alias ls.date = dataDate; meta julianDay julian_day(dataDate,hour,minute,second) : edition_specific; -meta dataTime time(hour,minute,second) : dump; +meta dataTime time(hour,minute,second) : dump; alias mars.time = dataTime; # Production status of processed data in this GRIB message codetable[1] productionStatusOfProcessedData ('1.3.table',masterDir,localDir) : dump; # Type of processed data in this GRIB message -codetable[1] typeOfProcessedData ('1.4.table',masterDir,localDir) = 255 : dump,string_type,no_fail; +codetable[1] typeOfProcessedData ('1.4.table',masterDir,localDir) = 255 : dump,string_type,no_fail; alias ls.dataType=typeOfProcessedData; diff --git a/definitions/grib2/section.4.def b/definitions/grib2/section.4.def index 0c45720b1..c40709877 100644 --- a/definitions/grib2/section.4.def +++ b/definitions/grib2/section.4.def @@ -77,6 +77,9 @@ if (defined(marsStream) && defined(marsType)) { template parameters "grib2/parameters.def"; +# Hook for local extras +template_nofail extras "grib2/local/[centre]/section4_extras.def"; + # Detect if this is for Generalized vertical height coordinates if (defined(typeOfFirstFixedSurface)) { if (typeOfFirstFixedSurface == 150) { diff --git a/definitions/grib2/shortName.def b/definitions/grib2/shortName.def index 6b968b21d..c49d61bba 100644 --- a/definitions/grib2/shortName.def +++ b/definitions/grib2/shortName.def @@ -4795,28 +4795,28 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean snow density -'mrsn' = { +'avg_rsn' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 61 ; typeOfStatisticalProcessing = 0 ; } #Time-mean low vegetation cover -'mcvl' = { +'avg_cvl' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 53 ; typeOfStatisticalProcessing = 0 ; } #Time-mean high vegetation cover -'mcvh' = { +'avg_cvh' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 54 ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea ice area fraction -'mci' = { +'avg_ci' = { discipline = 10 ; parameterCategory = 2 ; parameterNumber = 0 ; @@ -4824,7 +4824,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean sea surface temperature -'msst' = { +'avg_sst' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 0 ; @@ -4832,21 +4832,21 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean leaf area index, low vegetation -'mlai_lv' = { +'avg_lai_lv' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 55 ; typeOfStatisticalProcessing = 0 ; } #Time-mean leaf area index, high vegetation -'mlai_hv' = { +'avg_lai_hv' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 56 ; typeOfStatisticalProcessing = 0 ; } #Time-mean total column liquid water -'mtclw' = { +'avg_tclw' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 69 ; @@ -4855,7 +4855,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean total column cloud ice water -'mtciw' = { +'avg_tciw' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 70 ; @@ -4864,7 +4864,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean 2 metre specific humidity -'m2sh' = { +'avg_2sh' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 0 ; @@ -4875,7 +4875,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean lake mix-layer temperature -'mlmlt' = { +'avg_lmlt' = { discipline = 1 ; parameterCategory = 2 ; parameterNumber = 1 ; @@ -4884,7 +4884,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean lake mix-layer depth -'mlmld' = { +'avg_lmld' = { discipline = 1 ; parameterCategory = 2 ; parameterNumber = 0 ; @@ -4893,7 +4893,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean 2 metre relative humidity -'m2r' = { +'avg_2r' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 1 ; @@ -4903,56 +4903,98 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean fraction of snow cover -'mfscov' = { +'avg_fscov' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 121 ; typeOfStatisticalProcessing = 0 ; } #Time-mean soil temperature -'msot' = { +'avg_sot' = { discipline = 2 ; parameterCategory = 3 ; parameterNumber = 18 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean wind speed +'avg_ws' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean pressure +'avg_pres' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean potential vorticity +'avg_pv' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific rain water content +'avg_crwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific snow water content +'avg_cswc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eta-coordinate vertical velocity +'avg_etadot' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean geopotential -'mz' = { +'avg_z' = { discipline = 0 ; parameterCategory = 3 ; parameterNumber = 4 ; typeOfStatisticalProcessing = 0 ; } #Time-mean temperature -'mt' = { +'avg_t' = { discipline = 0 ; parameterCategory = 0 ; parameterNumber = 0 ; typeOfStatisticalProcessing = 0 ; } #Time-mean U component of wind -'mu' = { +'avg_u' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 2 ; typeOfStatisticalProcessing = 0 ; } #Time-mean V component of wind -'mv' = { +'avg_v' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 3 ; typeOfStatisticalProcessing = 0 ; } #Time-mean specific humidity -'mq' = { +'avg_q' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 0 ; typeOfStatisticalProcessing = 0 ; } #Time-mean surface pressure -'msp' = { +'avg_sp' = { discipline = 0 ; parameterCategory = 3 ; parameterNumber = 0 ; @@ -4960,14 +5002,14 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean vertical velocity -'mw' = { +'avg_w' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 8 ; typeOfStatisticalProcessing = 0 ; } #Time-mean total column water -'mtcw' = { +'avg_tcw' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 51 ; @@ -4976,7 +5018,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean total column vertically-integrated water vapour -'mtcwv' = { +'avg_tcwv' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 64 ; @@ -4984,30 +5026,44 @@ typeOfSecondFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean vorticity (relative) +'avg_vo' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean mean sea level pressure -'mmsl' = { +'avg_msl' = { discipline = 0 ; parameterCategory = 3 ; parameterNumber = 0 ; typeOfFirstFixedSurface = 101 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean divergence +'avg_d' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean relative humidity -'mr' = { +'avg_r' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 1 ; typeOfStatisticalProcessing = 0 ; } #Time-mean boundary layer height -'mblh' = { +'avg_blh' = { discipline = 0 ; parameterCategory = 3 ; parameterNumber = 18 ; typeOfStatisticalProcessing = 0 ; } #Time-mean 10 metre U wind component -'m10u' = { +'avg_10u' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 2 ; @@ -5017,7 +5073,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean 10 metre V wind component -'m10v' = { +'avg_10v' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 3 ; @@ -5027,7 +5083,7 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean 2 metre dewpoint temperature -'m2d' = { +'avg_2d' = { discipline = 0 ; parameterCategory = 0 ; parameterNumber = 6 ; @@ -5036,15 +5092,22 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean ozone mass mixing ratio +'avg_o3' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean temperature of snow layer -'mtsn' = { +'avg_tsn' = { discipline = 2 ; parameterCategory = 3 ; parameterNumber = 28 ; typeOfStatisticalProcessing = 0 ; } #Time-mean forecast surface roughness -'mfsr' = { +'avg_fsr' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 1 ; @@ -5052,13 +5115,159 @@ typeOfStatisticalProcessing = 0 ; } #Time-mean forecast logarithm of surface roughness for heat -'mflsr' = { +'avg_flsr' = { discipline = 0 ; parameterCategory = 2 ; parameterNumber = 54 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean specific cloud liquid water content +'avg_clwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific cloud ice water content +'avg_ciwc' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of cloud cover +'avg_cc' = { + discipline = 0 ; + parameterCategory = 6 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean K index +'avg_kx' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total totals index +'avg_totalx' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 4 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean clear air turbulence (CAT) +'avg_cat' = { + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 29 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean discharge from rivers or streams +'avg_dis' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (total layer) +'avg_swit' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (root zone) +'avg_swir' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 167 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index(layer) +'avg_swil' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 151 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain depth +'avg_flddep' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded fraction +'avg_fldffr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded area +'avg_fldfar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river fraction +'avg_rivfr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river area +'avg_rivar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of river coverage plus river related flooding +'avg_rivcffr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean area of river coverage plus river related flooding +'avg_rivcfar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-maximum volumetric soil moisture +'max_vsw' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 2 ; + } +#Time-minimum volumetric soil moisture +'min_vsw' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 3 ; + } +#Time-standard-deviation volumetric soil moisture +'std_vsw' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 6 ; + } #Cross sectional area of flow in channel 'chcross' = { discipline = 1 ; @@ -5125,26 +5334,6 @@ parameterCategory = 0 ; parameterNumber = 15 ; } -#Mean discharge in the last 6 hours -'dis06' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 6 ; - } -#Mean discharge in the last 24 hours -'dis24' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 24 ; - } #Snow depth at elevation bands 'sd_elev' = { discipline = 2 ; @@ -5197,6 +5386,48 @@ parameterCategory = 0 ; parameterNumber = 19 ; } +#Floodplain depth +'flddep' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Floodplain flooded fraction +'fldffr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } +#Floodplain flooded area +'fldfar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + } +#River fraction +'rivfr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + } +#River area +'rivar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + } +#Fraction of river coverage plus river related flooding +'rivcffr' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + } +#Area of river coverage plus river related flooding +'rivcfar' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + } #Latitude 'lat' = { discipline = 0 ; @@ -7154,6 +7385,48 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Standardised Precipitation Index (SPI) +'spi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 0 ; + } +#Standardised Precipitation Evapotranspiration Index (SPEI) +'spei' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 1 ; + } +#Standardised Streamflow Index (SSFI) +'ssfi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 2 ; + } +#Standardised Reservoir Supply Index (SRSI) +'srsi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 3 ; + } +#Standardised Water-level Index (SWI) +'swi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 4 ; + } +#Standardised Snowmelt and Rain Index (SMRI) +'smri' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 5 ; + } +#Streamflow Drought Index (SDI) +'sdi' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 6 ; + } #Universal thermal climate index 'utci' = { discipline = 20 ; @@ -7291,12 +7564,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea ice area fraction 'siconc' = { @@ -7561,12 +7828,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea surface temperature 'tos' = { @@ -7657,36 +7918,18 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Northward surface stress 'tauvon' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface stress 'tauuoe' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Y-component of surface stress 'tauvo' = { @@ -7849,12 +8092,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Steric change in sea surface height 'stheig' = { @@ -8029,24 +8266,12 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface sea water velocity 'sve' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Heat Content surface to 26C isotherm 'hct26' = { @@ -8095,12 +8320,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Vertically integrated sea water practical salinity in the upper 300 m 'sc300v' = { @@ -8401,12 +8620,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea ice area fraction @@ -8694,12 +8907,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea surface temperature @@ -8798,12 +9005,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean northward surface stress @@ -8811,12 +9012,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface stress @@ -8824,12 +9019,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time mean Y-component of surface stress @@ -9006,12 +9195,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean steric change in sea surface height @@ -9201,12 +9384,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface sea water velocity @@ -9214,12 +9391,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean heat content surface to 26C isotherm @@ -9273,12 +9444,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean vertically integrated sea water practical salinity in the upper 300 m @@ -10018,6 +10183,44 @@ is_chemical_srcsink = 1 ; sourceSinkChemicalPhysicalProcess = 7 ; } +#Aerosol optical depth +'aod' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 102 ; + } +#Single scattering albedo +'ssa' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 103 ; + } +#Asymmetry Factor +'asymf' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 104 ; + } +#Aerosol backscatter from top of atmosphere +'aerbscattoa' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 107 ; + typeOfFirstFixedSurface = 8 ; + } +#Aerosol backscatter from ground +'aerbscatgnd' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 108 ; + typeOfFirstFixedSurface = 1 ; + } +#Aerosol extinction coefficient +'aerext' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 105 ; + } #Pressure tendency 'ptend' = { discipline = 0 ; @@ -10180,18 +10383,6 @@ parameterCategory = 2 ; parameterNumber = 16 ; } -#U-component of current -'ucurr' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - } -#V-component of current -'vcurr' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - } #Precipitable water 'pwat' = { discipline = 0 ; @@ -10558,19 +10749,11 @@ parameterCategory = 0 ; parameterNumber = 44 ; } -#Eastward sea water velocity -'ocu' = { +#Wave spectral peakedness +'wsp' = { discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - typeOfFirstFixedSurface = 160 ; - } -#Northward sea water velocity -'ocv' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; + parameterCategory = 0 ; + parameterNumber = 98 ; } #Skin reservoir content 'srcrea' = { diff --git a/definitions/grib2/tables/0/1.1.table b/definitions/grib2/tables/0/1.1.table index a3c2fdc79..a0502880b 100644 --- a/definitions/grib2/tables/0/1.1.table +++ b/definitions/grib2/tables/0/1.1.table @@ -1,2 +1,2 @@ -0 0 Local tables not used +0 0 Local tables not used 255 255 Missing diff --git a/definitions/grib2/tables/0/4.2.0.20.table b/definitions/grib2/tables/0/4.2.0.20.table index 2a66a0fe3..ffdfd8cbf 100644 --- a/definitions/grib2/tables/0/4.2.0.20.table +++ b/definitions/grib2/tables/0/4.2.0.20.table @@ -18,5 +18,5 @@ 58 58 Total yearly averaged atmospheric loss (see Note 1) mol s-1 100 100 Surface area density (aerosol) m-1 101 101 Atmosphere optical thickness m -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/0/4.5.table b/definitions/grib2/tables/0/4.5.table index 984d7a3a0..1c82cabbc 100644 --- a/definitions/grib2/tables/0/4.5.table +++ b/definitions/grib2/tables/0/4.5.table @@ -1,26 +1,26 @@ 0 0 Reserved -1 sfc Ground or water surface -2 2 Cloud base level -3 3 Level of cloud tops -4 4 Level of 0o C isotherm +1 sfc Ground or water surface +2 2 Cloud base level +3 3 Level of cloud tops +4 4 Level of 0o C isotherm 5 5 Level of adiabatic condensation lifted from the surface -6 6 Maximum wind level -7 sfc Tropopause -8 sfc Nominal top of the atmosphere -9 9 Sea bottom +6 6 Maximum wind level +7 sfc Tropopause +8 sfc Nominal top of the atmosphere +9 9 Sea bottom 20 20 Isothermal level (K) 100 pl Isobaric surface (Pa) 101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) -105 105 Hybrid level +105 105 Hybrid level 106 sfc Depth below land surface (m) 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) 110 110 Reserved -111 ml Eta level +111 ml Eta level 117 117 Mixed layer depth (m) 160 160 Depth below sea level (m) 255 255 Missing diff --git a/definitions/grib2/tables/1.0.table b/definitions/grib2/tables/1.0.table index 7b8026752..432c0f0e5 100644 --- a/definitions/grib2/tables/1.0.table +++ b/definitions/grib2/tables/1.0.table @@ -32,6 +32,7 @@ 30 30 Version implemented on 15 November 2022 31 31 Version implemented on 15 May 2023 32 32 Version implemented on 30 November 2023 -33 33 Pre-operational to be implemented by next amendment -# 34-254 Future versions +33 33 Version implemented on 15 May 2024 +34 34 Pre-operational to be implemented by next amendment +# 35-254 Future versions 255 255 Master tables not used. Local table entries and local templates may use the entire range of the table, not just those sections marked Reserved for local used. diff --git a/definitions/grib2/tables/1/1.1.table b/definitions/grib2/tables/1/1.1.table index a3c2fdc79..a0502880b 100644 --- a/definitions/grib2/tables/1/1.1.table +++ b/definitions/grib2/tables/1/1.1.table @@ -1,2 +1,2 @@ -0 0 Local tables not used +0 0 Local tables not used 255 255 Missing diff --git a/definitions/grib2/tables/1/4.5.table b/definitions/grib2/tables/1/4.5.table index 3b3039f7a..7c581e5ff 100644 --- a/definitions/grib2/tables/1/4.5.table +++ b/definitions/grib2/tables/1/4.5.table @@ -1,13 +1,13 @@ 0 0 Reserved -1 sfc Ground or water surface -2 2 Cloud base level -3 3 Level of cloud tops -4 4 Level of 0o C isotherm +1 sfc Ground or water surface +2 2 Cloud base level +3 3 Level of cloud tops +4 4 Level of 0o C isotherm 5 5 Level of adiabatic condensation lifted from the surface -6 6 Maximum wind level -7 sfc Tropopause -8 sfc Nominal top of the atmosphere -9 9 Sea bottom +6 6 Maximum wind level +7 sfc Tropopause +8 sfc Nominal top of the atmosphere +9 9 Sea bottom 20 20 Isothermal level (K) 100 pl Isobaric surface (Pa) 101 sfc Mean sea level diff --git a/definitions/grib2/tables/10/0.0.table b/definitions/grib2/tables/10/0.0.table index 1d3a90b49..88d8b2cb3 100644 --- a/definitions/grib2/tables/10/0.0.table +++ b/definitions/grib2/tables/10/0.0.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/1.1.table b/definitions/grib2/tables/10/1.1.table index 91ef66244..55fa1eb63 100644 --- a/definitions/grib2/tables/10/1.1.table +++ b/definitions/grib2/tables/10/1.1.table @@ -1,4 +1,4 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/10/1.2.table b/definitions/grib2/tables/10/1.2.table index d90ad0109..606bf8300 100644 --- a/definitions/grib2/tables/10/1.2.table +++ b/definitions/grib2/tables/10/1.2.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/1.3.table b/definitions/grib2/tables/10/1.3.table index 35cd6a636..712bb2ba8 100644 --- a/definitions/grib2/tables/10/1.3.table +++ b/definitions/grib2/tables/10/1.3.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products -4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) -5 5 THORPEX Interactive Grand Global Ensemble (TIGGE) test -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products +4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) +5 5 THORPEX Interactive Grand Global Ensemble (TIGGE) test +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/1.4.table b/definitions/grib2/tables/10/1.4.table index d11a335a7..7f47afd96 100644 --- a/definitions/grib2/tables/10/1.4.table +++ b/definitions/grib2/tables/10/1.4.table @@ -1,13 +1,13 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/10/3.0.table b/definitions/grib2/tables/10/3.0.table index 4baed0aab..4269b25ad 100644 --- a/definitions/grib2/tables/10/3.0.table +++ b/definitions/grib2/tables/10/3.0.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/10/3.10.table b/definitions/grib2/tables/10/3.10.table index 23c1cdd36..da36dc664 100644 --- a/definitions/grib2/tables/10/3.10.table +++ b/definitions/grib2/tables/10/3.10.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/10/3.11.table b/definitions/grib2/tables/10/3.11.table index 560318d1b..0a299af98 100644 --- a/definitions/grib2/tables/10/3.11.table +++ b/definitions/grib2/tables/10/3.11.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 There is no appended list +0 0 There is no appended list 1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows 2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row 3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) diff --git a/definitions/grib2/tables/10/3.15.table b/definitions/grib2/tables/10/3.15.table index 2394a293f..6087902a3 100644 --- a/definitions/grib2/tables/10/3.15.table +++ b/definitions/grib2/tables/10/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) 113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/3.2.table b/definitions/grib2/tables/10/3.2.table index 1a3d03bbc..58a2a548b 100644 --- a/definitions/grib2/tables/10/3.2.table +++ b/definitions/grib2/tables/10/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame 9 9 Earth represented by the OSGB 1936 Datum, using the Airy_1830 Spheroid, the Greenwich meridian as 0 longitude, the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/3.20.table b/definitions/grib2/tables/10/3.20.table index 3f7ab4cc4..63de6b1a9 100644 --- a/definitions/grib2/tables/10/3.20.table +++ b/definitions/grib2/tables/10/3.20.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/3.21.table b/definitions/grib2/tables/10/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/10/3.21.table +++ b/definitions/grib2/tables/10/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/3.3.table b/definitions/grib2/tables/10/3.3.table index 5167ed6b7..bd47e2509 100644 --- a/definitions/grib2/tables/10/3.3.table +++ b/definitions/grib2/tables/10/3.3.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/10/3.4.table b/definitions/grib2/tables/10/3.4.table index 63c8adaaa..ea9cbe829 100644 --- a/definitions/grib2/tables/10/3.4.table +++ b/definitions/grib2/tables/10/3.4.table @@ -1,10 +1,10 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -# 5-8 Reserved +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +# 5-8 Reserved diff --git a/definitions/grib2/tables/10/3.5.table b/definitions/grib2/tables/10/3.5.table index 8ccf0f13b..6d3ec036e 100644 --- a/definitions/grib2/tables/10/3.5.table +++ b/definitions/grib2/tables/10/3.5.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/10/3.7.table b/definitions/grib2/tables/10/3.7.table index e2dc660dd..2d01b8d52 100644 --- a/definitions/grib2/tables/10/3.7.table +++ b/definitions/grib2/tables/10/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 The complex numbers Fnm. See separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/10/3.8.table b/definitions/grib2/tables/10/3.8.table index 4e811917b..6df554ae9 100644 --- a/definitions/grib2/tables/10/3.8.table +++ b/definitions/grib2/tables/10/3.8.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/3.9.table b/definitions/grib2/tables/10/3.9.table index f35b7ca53..530d1dee0 100644 --- a/definitions/grib2/tables/10/3.9.table +++ b/definitions/grib2/tables/10/3.9.table @@ -1,4 +1,4 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/10/4.0.table b/definitions/grib2/tables/10/4.0.table index 5f405bed8..28733d42d 100644 --- a/definitions/grib2/tables/10/4.0.table +++ b/definitions/grib2/tables/10/4.0.table @@ -1,52 +1,52 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time 8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data # 33-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents 42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents 43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol 46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol 47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time -# 52-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +# 52-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved +# 1102-32767 Reserved # 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data diff --git a/definitions/grib2/tables/10/4.1.0.table b/definitions/grib2/tables/10/4.1.0.table index 361108860..3413dbad5 100644 --- a/definitions/grib2/tables/10/4.1.0.table +++ b/definitions/grib2/tables/10/4.1.0.table @@ -1,27 +1,27 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.1.1.table b/definitions/grib2/tables/10/4.1.1.table index 29f1dec79..dea5bc49e 100644 --- a/definitions/grib2/tables/10/4.1.1.table +++ b/definitions/grib2/tables/10/4.1.1.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.1.10.table b/definitions/grib2/tables/10/4.1.10.table index 9c8c92b12..e6ce6faf7 100644 --- a/definitions/grib2/tables/10/4.1.10.table +++ b/definitions/grib2/tables/10/4.1.10.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Sub-surface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Sub-surface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.1.2.table b/definitions/grib2/tables/10/4.1.2.table index b90201c63..805836998 100644 --- a/definitions/grib2/tables/10/4.1.2.table +++ b/definitions/grib2/tables/10/4.1.2.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.1.3.table b/definitions/grib2/tables/10/4.1.3.table index fe1d8ae5a..adcbfb051 100644 --- a/definitions/grib2/tables/10/4.1.3.table +++ b/definitions/grib2/tables/10/4.1.3.table @@ -1,8 +1,8 @@ # Code table 4.1 - Parameter category by product discipline. Product discipline 3 - Space products -0 0 Image format products -1 1 Quantitative products -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.10.table b/definitions/grib2/tables/10/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/10/4.10.table +++ b/definitions/grib2/tables/10/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/10/4.11.table b/definitions/grib2/tables/10/4.11.table index 1257d1b09..af9ff29ad 100644 --- a/definitions/grib2/tables/10/4.11.table +++ b/definitions/grib2/tables/10/4.11.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.12.table b/definitions/grib2/tables/10/4.12.table index e06a3be5b..6cab67bf5 100644 --- a/definitions/grib2/tables/10/4.12.table +++ b/definitions/grib2/tables/10/4.12.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.13.table b/definitions/grib2/tables/10/4.13.table index 107ace60c..f090fb9ae 100644 --- a/definitions/grib2/tables/10/4.13.table +++ b/definitions/grib2/tables/10/4.13.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.14.table b/definitions/grib2/tables/10/4.14.table index 24a228921..bcb04f328 100644 --- a/definitions/grib2/tables/10/4.14.table +++ b/definitions/grib2/tables/10/4.14.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.15.table b/definitions/grib2/tables/10/4.15.table index 97cdcd2ee..6e1ef5745 100644 --- a/definitions/grib2/tables/10/4.15.table +++ b/definitions/grib2/tables/10/4.15.table @@ -1,11 +1,11 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.0.table b/definitions/grib2/tables/10/4.2.0.0.table index debc0a6f4..8656f8974 100644 --- a/definitions/grib2/tables/10/4.2.0.0.table +++ b/definitions/grib2/tables/10/4.2.0.0.table @@ -20,6 +20,6 @@ 18 18 Snow temperature (top of snow) (K) 19 19 Turbulent transfer coefficient for heat (Numeric) 20 20 Turbulent diffusion coefficient for heat (m2/s) -# 21-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 21-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.1.table b/definitions/grib2/tables/10/4.2.0.1.table index b95e8699d..3d68fbe86 100644 --- a/definitions/grib2/tables/10/4.2.0.1.table +++ b/definitions/grib2/tables/10/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,10 +86,10 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) -# 93-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 93-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.13.table b/definitions/grib2/tables/10/4.2.0.13.table index b9979f0d3..90ab7d1b9 100644 --- a/definitions/grib2/tables/10/4.2.0.13.table +++ b/definitions/grib2/tables/10/4.2.0.13.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.14.table b/definitions/grib2/tables/10/4.2.0.14.table index 4a2a4e128..fca42ccc7 100644 --- a/definitions/grib2/tables/10/4.2.0.14.table +++ b/definitions/grib2/tables/10/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.15.table b/definitions/grib2/tables/10/4.2.0.15.table index 895892f86..66ccff19d 100644 --- a/definitions/grib2/tables/10/4.2.0.15.table +++ b/definitions/grib2/tables/10/4.2.0.15.table @@ -14,6 +14,6 @@ 12 12 Reflectivity of rain (dB) 13 13 Reflectivity of graupel (dB) 14 14 Reflectivity of hail (dB) -# 15-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 15-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.16.table b/definitions/grib2/tables/10/4.2.0.16.table index 39215ab20..18dedb7c0 100644 --- a/definitions/grib2/tables/10/4.2.0.16.table +++ b/definitions/grib2/tables/10/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.18.table b/definitions/grib2/tables/10/4.2.0.18.table index 30060fd2d..165aa6008 100644 --- a/definitions/grib2/tables/10/4.2.0.18.table +++ b/definitions/grib2/tables/10/4.2.0.18.table @@ -8,11 +8,11 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) 13 13 Total deposition (wet + dry) (Bq m-2) -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.19.table b/definitions/grib2/tables/10/4.2.0.19.table index 2aa34464a..90003262e 100644 --- a/definitions/grib2/tables/10/4.2.0.19.table +++ b/definitions/grib2/tables/10/4.2.0.19.table @@ -27,6 +27,6 @@ 25 25 Weather (Code table 4.225) 26 26 Convective outlook (Code table 4.224) 27 27 Icing scenario (Code table 4.227) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.190.table b/definitions/grib2/tables/10/4.2.0.190.table index 39fb55746..3d9d5ff85 100644 --- a/definitions/grib2/tables/10/4.2.0.190.table +++ b/definitions/grib2/tables/10/4.2.0.190.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.191.table b/definitions/grib2/tables/10/4.2.0.191.table index 81230c0e0..4ff12e532 100644 --- a/definitions/grib2/tables/10/4.2.0.191.table +++ b/definitions/grib2/tables/10/4.2.0.191.table @@ -2,6 +2,6 @@ 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/10/4.2.0.2.table b/definitions/grib2/tables/10/4.2.0.2.table index a3b08a8f0..6fcd262b0 100644 --- a/definitions/grib2/tables/10/4.2.0.2.table +++ b/definitions/grib2/tables/10/4.2.0.2.table @@ -35,6 +35,6 @@ 33 33 Wind fetch (m) 34 34 Normal wind component (m/s) 35 35 Tangential wind component (m/s) -# 36-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 36-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.20.table b/definitions/grib2/tables/10/4.2.0.20.table index cc2dbcc52..898a774eb 100644 --- a/definitions/grib2/tables/10/4.2.0.20.table +++ b/definitions/grib2/tables/10/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (Sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -25,7 +25,7 @@ 57 57 Total yearly average burden of the atmosphere (mol) 58 58 Total yearly averaged atmospheric loss (mol/s) 59 59 Aerosol number concentration (m-3) -# 60-99 Reserved +# 60-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -37,6 +37,6 @@ 108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) 109 109 Aerosol lidar extinction from satellite (m-1) 110 110 Aerosol lidar extinction from the ground (m-1) -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.3.table b/definitions/grib2/tables/10/4.2.0.3.table index f718c6ea9..08c1c7bc3 100644 --- a/definitions/grib2/tables/10/4.2.0.3.table +++ b/definitions/grib2/tables/10/4.2.0.3.table @@ -26,6 +26,6 @@ 24 24 Anisotropy of sub-gridscale orography (Numeric) 25 25 Natural logarithm of pressure in Pa (Numeric) 26 26 Exner pressure (Numeric) -# 27-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 27-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.4.table b/definitions/grib2/tables/10/4.2.0.4.table index fea4cafc3..336fdb421 100644 --- a/definitions/grib2/tables/10/4.2.0.4.table +++ b/definitions/grib2/tables/10/4.2.0.4.table @@ -12,9 +12,9 @@ 10 10 Photosynthetically active radiation (W m-2) 11 11 Net short-wave radiation flux, clear sky (W m-2) 12 12 Downward UV radiation (W m-2) -# 13-49 Reserved +# 13-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) -# 52-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.5.table b/definitions/grib2/tables/10/4.2.0.5.table index b0c93dd3a..86a199ace 100644 --- a/definitions/grib2/tables/10/4.2.0.5.table +++ b/definitions/grib2/tables/10/4.2.0.5.table @@ -6,6 +6,6 @@ 4 4 Upward long-wave radiation flux (W m-2) 5 5 Net long-wave radiation flux (W m-2) 6 6 Net long-wave radiation flux, clear sky (W m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.6.table b/definitions/grib2/tables/10/4.2.0.6.table index fd4b23014..fb935344e 100644 --- a/definitions/grib2/tables/10/4.2.0.6.table +++ b/definitions/grib2/tables/10/4.2.0.6.table @@ -35,6 +35,6 @@ 33 33 Sunshine duration (s) 34 34 Surface long wave effective total cloudiness (Numeric) 35 35 Surface short wave effective total cloudiness (Numeric) -# 36-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 36-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.0.7.table b/definitions/grib2/tables/10/4.2.0.7.table index 7a7d2008b..6c1794c73 100644 --- a/definitions/grib2/tables/10/4.2.0.7.table +++ b/definitions/grib2/tables/10/4.2.0.7.table @@ -13,8 +13,8 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraft helicity (m2 s-2) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.1.0.table b/definitions/grib2/tables/10/4.2.1.0.table index bf1e3e93f..9c4d129da 100644 --- a/definitions/grib2/tables/10/4.2.1.0.table +++ b/definitions/grib2/tables/10/4.2.1.0.table @@ -6,6 +6,6 @@ 4 4 Snow water equivalent per cent of normal (%) 5 5 Baseflow-groundwater runoff (kg m-2) 6 6 Storm surface runoff (kg m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.1.1.table b/definitions/grib2/tables/10/4.2.1.1.table index cb5117dc8..aa560e479 100644 --- a/definitions/grib2/tables/10/4.2.1.1.table +++ b/definitions/grib2/tables/10/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.10.0.table b/definitions/grib2/tables/10/4.2.10.0.table index a620c36ba..78d3bdef4 100644 --- a/definitions/grib2/tables/10/4.2.10.0.table +++ b/definitions/grib2/tables/10/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (s-1) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.10.1.table b/definitions/grib2/tables/10/4.2.10.1.table index ae52b0c26..de6b562b8 100644 --- a/definitions/grib2/tables/10/4.2.10.1.table +++ b/definitions/grib2/tables/10/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.10.191.table b/definitions/grib2/tables/10/4.2.10.191.table index 14085ac9a..6cafbd3d4 100644 --- a/definitions/grib2/tables/10/4.2.10.191.table +++ b/definitions/grib2/tables/10/4.2.10.191.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.10.2.table b/definitions/grib2/tables/10/4.2.10.2.table index a6d9dd0c8..258aeef18 100644 --- a/definitions/grib2/tables/10/4.2.10.2.table +++ b/definitions/grib2/tables/10/4.2.10.2.table @@ -9,6 +9,6 @@ 7 7 Ice divergence (/s) 8 8 Ice temperature (K) 9 9 Ice internal pressure (Pa m) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.10.3.table b/definitions/grib2/tables/10/4.2.10.3.table index 112af09d5..3b9a2df46 100644 --- a/definitions/grib2/tables/10/4.2.10.3.table +++ b/definitions/grib2/tables/10/4.2.10.3.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.10.4.table b/definitions/grib2/tables/10/4.2.10.4.table index d80a32780..91ffb2b29 100644 --- a/definitions/grib2/tables/10/4.2.10.4.table +++ b/definitions/grib2/tables/10/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2 s-1) 6 6 Ocean vertical momentum diffusivity (m2 s-1) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (m-1) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.2.0.table b/definitions/grib2/tables/10/4.2.2.0.table index 9a426a5c2..0632ff414 100644 --- a/definitions/grib2/tables/10/4.2.2.0.table +++ b/definitions/grib2/tables/10/4.2.2.0.table @@ -32,6 +32,6 @@ 30 30 Deciduous forest cover (Proportion) 31 31 Normalized differential vegetation index (NDVI) (Numeric) 32 32 Root depth of vegetation (m) -# 33-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 33-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.2.3.table b/definitions/grib2/tables/10/4.2.2.3.table index e985e41aa..d7db59d5e 100644 --- a/definitions/grib2/tables/10/4.2.2.3.table +++ b/definitions/grib2/tables/10/4.2.2.3.table @@ -22,6 +22,6 @@ 20 20 Column-integrated soil moisture (kg m-2) 21 21 Soil ice (kg m-3) 22 22 Column-integrated soil ice (kg m-2) -# 23-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 23-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.2.4.table b/definitions/grib2/tables/10/4.2.2.4.table index a5f0a3c5c..0992f59db 100644 --- a/definitions/grib2/tables/10/4.2.2.4.table +++ b/definitions/grib2/tables/10/4.2.2.4.table @@ -4,5 +4,5 @@ 2 2 Haines Index (Numeric) 3 3 Fire burned area (%) # 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.3.0.table b/definitions/grib2/tables/10/4.2.3.0.table index 254e56bc8..8c19d43b2 100644 --- a/definitions/grib2/tables/10/4.2.3.0.table +++ b/definitions/grib2/tables/10/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.2.3.1.table b/definitions/grib2/tables/10/4.2.3.1.table index 176ac35fb..af1896b14 100644 --- a/definitions/grib2/tables/10/4.2.3.1.table +++ b/definitions/grib2/tables/10/4.2.3.1.table @@ -17,12 +17,12 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +23 23 Angstrom coefficient +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.201.table b/definitions/grib2/tables/10/4.201.table index ebb698b38..e16d5d808 100644 --- a/definitions/grib2/tables/10/4.201.table +++ b/definitions/grib2/tables/10/4.201.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.202.table b/definitions/grib2/tables/10/4.202.table index 943c03f6f..aa93458f1 100644 --- a/definitions/grib2/tables/10/4.202.table +++ b/definitions/grib2/tables/10/4.202.table @@ -1,4 +1,4 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.203.table b/definitions/grib2/tables/10/4.203.table index 9736c1ab3..b8c37f87f 100644 --- a/definitions/grib2/tables/10/4.203.table +++ b/definitions/grib2/tables/10/4.203.table @@ -1,26 +1,26 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.204.table b/definitions/grib2/tables/10/4.204.table index 51d1cecce..8d8bca9b2 100644 --- a/definitions/grib2/tables/10/4.204.table +++ b/definitions/grib2/tables/10/4.204.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (16-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (16-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.205.table b/definitions/grib2/tables/10/4.205.table index 8d425ab9d..3fadf7d80 100644 --- a/definitions/grib2/tables/10/4.205.table +++ b/definitions/grib2/tables/10/4.205.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.206.table b/definitions/grib2/tables/10/4.206.table index 0be7fd4f8..43b0ba137 100644 --- a/definitions/grib2/tables/10/4.206.table +++ b/definitions/grib2/tables/10/4.206.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.207.table b/definitions/grib2/tables/10/4.207.table index fde9eb477..815a5777e 100644 --- a/definitions/grib2/tables/10/4.207.table +++ b/definitions/grib2/tables/10/4.207.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.208.table b/definitions/grib2/tables/10/4.208.table index 196becaaf..23ea97317 100644 --- a/definitions/grib2/tables/10/4.208.table +++ b/definitions/grib2/tables/10/4.208.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.209.table b/definitions/grib2/tables/10/4.209.table index 351c0f431..53c6c5eba 100644 --- a/definitions/grib2/tables/10/4.209.table +++ b/definitions/grib2/tables/10/4.209.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Stable -2 2 Mechanically-driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically-driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.210.table b/definitions/grib2/tables/10/4.210.table index 1c00b8c6f..149b2ba06 100644 --- a/definitions/grib2/tables/10/4.210.table +++ b/definitions/grib2/tables/10/4.210.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Contrail not present -1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.211.table b/definitions/grib2/tables/10/4.211.table index 66ef656f6..b5753f19f 100644 --- a/definitions/grib2/tables/10/4.211.table +++ b/definitions/grib2/tables/10/4.211.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.212.table b/definitions/grib2/tables/10/4.212.table index c59bd24e8..738c45d2c 100644 --- a/definitions/grib2/tables/10/4.212.table +++ b/definitions/grib2/tables/10/4.212.table @@ -1,18 +1,18 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.213.table b/definitions/grib2/tables/10/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/10/4.213.table +++ b/definitions/grib2/tables/10/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.215.table b/definitions/grib2/tables/10/4.215.table index 460888217..5ed37c034 100644 --- a/definitions/grib2/tables/10/4.215.table +++ b/definitions/grib2/tables/10/4.215.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.216.table b/definitions/grib2/tables/10/4.216.table index 4d9a70f86..b51b358f4 100644 --- a/definitions/grib2/tables/10/4.216.table +++ b/definitions/grib2/tables/10/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain # 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/10/4.217.table b/definitions/grib2/tables/10/4.217.table index 51a263a99..6a014c9c3 100644 --- a/definitions/grib2/tables/10/4.217.table +++ b/definitions/grib2/tables/10/4.217.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.218.table b/definitions/grib2/tables/10/4.218.table index d4b2ab843..b6087448f 100644 --- a/definitions/grib2/tables/10/4.218.table +++ b/definitions/grib2/tables/10/4.218.table @@ -1,38 +1,38 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation / crops -15 15 Permanent snow / ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -# 19-96 Reserved -97 97 Snow / ice on land -98 98 Snow / ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud / fog / Stratus -102 102 Low cloud / Stratocumulus -103 103 Low cloud / unknown type -104 104 Medium cloud / Nimbostratus -105 105 Medium cloud / Altostratus -106 106 Medium cloud / unknown type -107 107 High cloud / Cumulus -108 108 High cloud / Cirrus -109 109 High cloud / unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation / crops +15 15 Permanent snow / ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +# 19-96 Reserved +97 97 Snow / ice on land +98 98 Snow / ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud / fog / Stratus +102 102 Low cloud / Stratocumulus +103 103 Low cloud / unknown type +104 104 Medium cloud / Nimbostratus +105 105 Medium cloud / Altostratus +106 106 Medium cloud / unknown type +107 107 High cloud / Cumulus +108 108 High cloud / Cirrus +109 109 High cloud / unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.219.table b/definitions/grib2/tables/10/4.219.table index f10ce468e..a02452fc4 100644 --- a/definitions/grib2/tables/10/4.219.table +++ b/definitions/grib2/tables/10/4.219.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.220.table b/definitions/grib2/tables/10/4.220.table index 9c957eb01..7a18fa1fd 100644 --- a/definitions/grib2/tables/10/4.220.table +++ b/definitions/grib2/tables/10/4.220.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.221.table b/definitions/grib2/tables/10/4.221.table index 5466929c7..eb0b64502 100644 --- a/definitions/grib2/tables/10/4.221.table +++ b/definitions/grib2/tables/10/4.221.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.222.table b/definitions/grib2/tables/10/4.222.table index c54194e29..f554a7f3d 100644 --- a/definitions/grib2/tables/10/4.222.table +++ b/definitions/grib2/tables/10/4.222.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.223.table b/definitions/grib2/tables/10/4.223.table index b6a9be136..706abab78 100644 --- a/definitions/grib2/tables/10/4.223.table +++ b/definitions/grib2/tables/10/4.223.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing value +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing value diff --git a/definitions/grib2/tables/10/4.224.table b/definitions/grib2/tables/10/4.224.table index af846f841..cf67496b8 100644 --- a/definitions/grib2/tables/10/4.224.table +++ b/definitions/grib2/tables/10/4.224.table @@ -1,18 +1,18 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/10/4.227.table b/definitions/grib2/tables/10/4.227.table index 6a98d49d0..7676664e4 100644 --- a/definitions/grib2/tables/10/4.227.table +++ b/definitions/grib2/tables/10/4.227.table @@ -4,6 +4,6 @@ 2 2 Convective 3 3 Stratiform 4 4 Freezing -# 5-191 Reserved +# 5-191 Reserved # 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/10/4.3.table b/definitions/grib2/tables/10/4.3.table index 68e2cc83f..8a4e919c9 100644 --- a/definitions/grib2/tables/10/4.3.table +++ b/definitions/grib2/tables/10/4.3.table @@ -1,16 +1,16 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.4.table b/definitions/grib2/tables/10/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/10/4.4.table +++ b/definitions/grib2/tables/10/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.5.table b/definitions/grib2/tables/10/4.5.table index 1ada3eb23..c3b8aec5d 100644 --- a/definitions/grib2/tables/10/4.5.table +++ b/definitions/grib2/tables/10/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface 2 2 Cloud base level 3 3 Level of cloud tops @@ -12,11 +12,11 @@ 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) 12 12 Cumulonimbus (CB) top (m) -# 13-19 Reserved +# 13-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -25,7 +25,7 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level 112 112 Reserved 113 113 Logarithmic hybrid level @@ -36,7 +36,7 @@ 119 hpl Hybrid pressure level # 120-149 Reserved 150 150 Generalized vertical height coordinate -# 151-159 Reserved +# 151-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom @@ -44,6 +44,6 @@ 164 164 Bottom of thermally active sediment layer 165 165 Bottom of sediment layer penetrated by thermal wave 166 sfc Mixing layer -# 167-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 167-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.6.table b/definitions/grib2/tables/10/4.6.table index 54f2993c3..eaa5c4362 100644 --- a/definitions/grib2/tables/10/4.6.table +++ b/definitions/grib2/tables/10/4.6.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.7.table b/definitions/grib2/tables/10/4.7.table index 23e0d457e..e6d887bdb 100644 --- a/definitions/grib2/tables/10/4.7.table +++ b/definitions/grib2/tables/10/4.7.table @@ -1,14 +1,14 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.8.table b/definitions/grib2/tables/10/4.8.table index 37a6cf767..d06153079 100644 --- a/definitions/grib2/tables/10/4.8.table +++ b/definitions/grib2/tables/10/4.8.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.9.table b/definitions/grib2/tables/10/4.9.table index 19e64a3d2..5243e58dd 100644 --- a/definitions/grib2/tables/10/4.9.table +++ b/definitions/grib2/tables/10/4.9.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/4.91.table b/definitions/grib2/tables/10/4.91.table index 97b1c70ad..ae31ed61c 100644 --- a/definitions/grib2/tables/10/4.91.table +++ b/definitions/grib2/tables/10/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit 11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/10/5.1.table b/definitions/grib2/tables/10/5.1.table index 100d4106d..158a35850 100644 --- a/definitions/grib2/tables/10/5.1.table +++ b/definitions/grib2/tables/10/5.1.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/5.2.table b/definitions/grib2/tables/10/5.2.table index 7a4500ecd..d12b46fbd 100644 --- a/definitions/grib2/tables/10/5.2.table +++ b/definitions/grib2/tables/10/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use +# 12-191 Reserved +# 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/10/5.3.table b/definitions/grib2/tables/10/5.3.table index 705fa6524..6f228aeec 100644 --- a/definitions/grib2/tables/10/5.3.table +++ b/definitions/grib2/tables/10/5.3.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/5.4.table b/definitions/grib2/tables/10/5.4.table index 8133367a5..f844f557e 100644 --- a/definitions/grib2/tables/10/5.4.table +++ b/definitions/grib2/tables/10/5.4.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/5.40.table b/definitions/grib2/tables/10/5.40.table index 0d56ad0e0..2431eb547 100644 --- a/definitions/grib2/tables/10/5.40.table +++ b/definitions/grib2/tables/10/5.40.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/10/5.5.table b/definitions/grib2/tables/10/5.5.table index 5d625dbda..f2216e273 100644 --- a/definitions/grib2/tables/10/5.5.table +++ b/definitions/grib2/tables/10/5.5.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/5.6.table b/definitions/grib2/tables/10/5.6.table index 5838e994d..3b0892d37 100644 --- a/definitions/grib2/tables/10/5.6.table +++ b/definitions/grib2/tables/10/5.6.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/10/5.7.table b/definitions/grib2/tables/10/5.7.table index b93aa8130..f056d3059 100644 --- a/definitions/grib2/tables/10/5.7.table +++ b/definitions/grib2/tables/10/5.7.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/10/6.0.table b/definitions/grib2/tables/10/6.0.table index f539b26d7..a8f30f5a4 100644 --- a/definitions/grib2/tables/10/6.0.table +++ b/definitions/grib2/tables/10/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator 0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/11/0.0.table b/definitions/grib2/tables/11/0.0.table index b24c50564..2c5afceb4 100644 --- a/definitions/grib2/tables/11/0.0.table +++ b/definitions/grib2/tables/11/0.0.table @@ -1,10 +1,10 @@ # Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/1.1.table b/definitions/grib2/tables/11/1.1.table index d50f8fd72..f6d332005 100644 --- a/definitions/grib2/tables/11/1.1.table +++ b/definitions/grib2/tables/11/1.1.table @@ -1,4 +1,4 @@ # Code table 1.1 - GRIB local tables version number -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/11/1.2.table b/definitions/grib2/tables/11/1.2.table index 934b70455..638f1efbb 100644 --- a/definitions/grib2/tables/11/1.2.table +++ b/definitions/grib2/tables/11/1.2.table @@ -1,8 +1,8 @@ # Code table 1.2 - Significance of reference time -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/1.3.table b/definitions/grib2/tables/11/1.3.table index e8c38878d..34ace7fda 100644 --- a/definitions/grib2/tables/11/1.3.table +++ b/definitions/grib2/tables/11/1.3.table @@ -1,12 +1,12 @@ # Code table 1.3 - Production status of data -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products 4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) 5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) 6 6 Sub-seasonal to seasonal prediction project (S2S) 7 7 Sub-seasonal to seasonal prediction project test (S2S) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/1.4.table b/definitions/grib2/tables/11/1.4.table index 03203d874..877288c0e 100644 --- a/definitions/grib2/tables/11/1.4.table +++ b/definitions/grib2/tables/11/1.4.table @@ -1,13 +1,13 @@ # Code table 1.4 - Type of data -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/11/3.0.table b/definitions/grib2/tables/11/3.0.table index 45187b80d..a442a06a0 100644 --- a/definitions/grib2/tables/11/3.0.table +++ b/definitions/grib2/tables/11/3.0.table @@ -1,6 +1,6 @@ # Code table 3.0 - Source of grid definition -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/11/3.10.table b/definitions/grib2/tables/11/3.10.table index afa8843a7..1612d05e3 100644 --- a/definitions/grib2/tables/11/3.10.table +++ b/definitions/grib2/tables/11/3.10.table @@ -1,8 +1,8 @@ # Flag table 3.10 - Scanning mode for one diamond -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/11/3.11.table b/definitions/grib2/tables/11/3.11.table index e516a2ab9..06ae10810 100644 --- a/definitions/grib2/tables/11/3.11.table +++ b/definitions/grib2/tables/11/3.11.table @@ -1,7 +1,7 @@ # Code table 3.11 - Interpretation of list of numbers at end of section 3 -0 0 There is no appended list -1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows -2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row -3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) -# 4-254 Reserved -255 255 Missing +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/11/3.15.table b/definitions/grib2/tables/11/3.15.table index 331217ebe..6087902a3 100644 --- a/definitions/grib2/tables/11/3.15.table +++ b/definitions/grib2/tables/11/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/3.2.table b/definitions/grib2/tables/11/3.2.table index a2107f6e9..b9574a424 100644 --- a/definitions/grib2/tables/11/3.2.table +++ b/definitions/grib2/tables/11/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame 9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/3.20.table b/definitions/grib2/tables/11/3.20.table index efbf08d19..e2bb156ee 100644 --- a/definitions/grib2/tables/11/3.20.table +++ b/definitions/grib2/tables/11/3.20.table @@ -1,6 +1,6 @@ # Code table 3.20 - Type of horizontal line -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/3.21.table b/definitions/grib2/tables/11/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/11/3.21.table +++ b/definitions/grib2/tables/11/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/3.3.table b/definitions/grib2/tables/11/3.3.table index 5dd7c7001..25cb46a1d 100644 --- a/definitions/grib2/tables/11/3.3.table +++ b/definitions/grib2/tables/11/3.3.table @@ -1,9 +1,9 @@ # Flag table 3.3 - Resolution and component flags -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/11/3.4.table b/definitions/grib2/tables/11/3.4.table index 63c8adaaa..ea9cbe829 100644 --- a/definitions/grib2/tables/11/3.4.table +++ b/definitions/grib2/tables/11/3.4.table @@ -1,10 +1,10 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -# 5-8 Reserved +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +# 5-8 Reserved diff --git a/definitions/grib2/tables/11/3.5.table b/definitions/grib2/tables/11/3.5.table index eabdde896..2f8ec82e3 100644 --- a/definitions/grib2/tables/11/3.5.table +++ b/definitions/grib2/tables/11/3.5.table @@ -1,5 +1,5 @@ # Flag table 3.5 - Projection centre -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/11/3.7.table b/definitions/grib2/tables/11/3.7.table index e2dc660dd..2d01b8d52 100644 --- a/definitions/grib2/tables/11/3.7.table +++ b/definitions/grib2/tables/11/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 The complex numbers Fnm. See separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/11/3.8.table b/definitions/grib2/tables/11/3.8.table index 844e74235..578fab37f 100644 --- a/definitions/grib2/tables/11/3.8.table +++ b/definitions/grib2/tables/11/3.8.table @@ -1,7 +1,7 @@ # Code table 3.8 - Grid point position -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/3.9.table b/definitions/grib2/tables/11/3.9.table index fd730bc64..ecd65514a 100644 --- a/definitions/grib2/tables/11/3.9.table +++ b/definitions/grib2/tables/11/3.9.table @@ -1,4 +1,4 @@ # Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/11/4.0.table b/definitions/grib2/tables/11/4.0.table index 1c1fe09ab..51b3ccfa7 100644 --- a/definitions/grib2/tables/11/4.0.table +++ b/definitions/grib2/tables/11/4.0.table @@ -1,59 +1,59 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time 8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval 15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -# 35-39 Reserved +# 35-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents 42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol 46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time 53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time 54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters 60 60 Individual ensemble re-forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time 61 61 Individual ensemble re-forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 55-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +# 55-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved -# 32768-65534 Reserved for local use +# 1102-32767 Reserved +# 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/11/4.1.0.table b/definitions/grib2/tables/11/4.1.0.table index 361108860..3413dbad5 100644 --- a/definitions/grib2/tables/11/4.1.0.table +++ b/definitions/grib2/tables/11/4.1.0.table @@ -1,27 +1,27 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.1.1.table b/definitions/grib2/tables/11/4.1.1.table index 29f1dec79..dea5bc49e 100644 --- a/definitions/grib2/tables/11/4.1.1.table +++ b/definitions/grib2/tables/11/4.1.1.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.1.10.table b/definitions/grib2/tables/11/4.1.10.table index 9c8c92b12..e6ce6faf7 100644 --- a/definitions/grib2/tables/11/4.1.10.table +++ b/definitions/grib2/tables/11/4.1.10.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Sub-surface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Sub-surface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.1.2.table b/definitions/grib2/tables/11/4.1.2.table index b90201c63..805836998 100644 --- a/definitions/grib2/tables/11/4.1.2.table +++ b/definitions/grib2/tables/11/4.1.2.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.1.3.table b/definitions/grib2/tables/11/4.1.3.table index fe1d8ae5a..adcbfb051 100644 --- a/definitions/grib2/tables/11/4.1.3.table +++ b/definitions/grib2/tables/11/4.1.3.table @@ -1,8 +1,8 @@ # Code table 4.1 - Parameter category by product discipline. Product discipline 3 - Space products -0 0 Image format products -1 1 Quantitative products -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.10.table b/definitions/grib2/tables/11/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/11/4.10.table +++ b/definitions/grib2/tables/11/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/11/4.11.table b/definitions/grib2/tables/11/4.11.table index 7f404c849..01cc81303 100644 --- a/definitions/grib2/tables/11/4.11.table +++ b/definitions/grib2/tables/11/4.11.table @@ -1,10 +1,10 @@ # Code table 4.11 - Type of time intervals -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.12.table b/definitions/grib2/tables/11/4.12.table index 03fd89b36..d42b47e96 100644 --- a/definitions/grib2/tables/11/4.12.table +++ b/definitions/grib2/tables/11/4.12.table @@ -1,7 +1,7 @@ # Code table 4.12 - Operating mode -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.13.table b/definitions/grib2/tables/11/4.13.table index c92854eec..a0e28eac8 100644 --- a/definitions/grib2/tables/11/4.13.table +++ b/definitions/grib2/tables/11/4.13.table @@ -1,6 +1,6 @@ # Code table 4.13 - Quality control indicator -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.14.table b/definitions/grib2/tables/11/4.14.table index a88cb93fa..d525b23b3 100644 --- a/definitions/grib2/tables/11/4.14.table +++ b/definitions/grib2/tables/11/4.14.table @@ -1,6 +1,6 @@ # Code table 4.14 - Clutter filter indicator -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.15.table b/definitions/grib2/tables/11/4.15.table index 2e5f3dea3..7adddedb6 100644 --- a/definitions/grib2/tables/11/4.15.table +++ b/definitions/grib2/tables/11/4.15.table @@ -1,11 +1,11 @@ # Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.0.table b/definitions/grib2/tables/11/4.2.0.0.table index f7784cc33..e69e087c9 100644 --- a/definitions/grib2/tables/11/4.2.0.0.table +++ b/definitions/grib2/tables/11/4.2.0.0.table @@ -20,6 +20,6 @@ 18 18 Snow temperature (top of snow) (K) 19 19 Turbulent transfer coefficient for heat (Numeric) 20 20 Turbulent diffusion coefficient for heat (m2/s) -# 21-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 21-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.1.table b/definitions/grib2/tables/11/4.2.0.1.table index 827ba1dcf..256732de0 100644 --- a/definitions/grib2/tables/11/4.2.0.1.table +++ b/definitions/grib2/tables/11/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,10 +86,10 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) -# 93-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 93-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.13.table b/definitions/grib2/tables/11/4.2.0.13.table index b9979f0d3..90ab7d1b9 100644 --- a/definitions/grib2/tables/11/4.2.0.13.table +++ b/definitions/grib2/tables/11/4.2.0.13.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.14.table b/definitions/grib2/tables/11/4.2.0.14.table index 4a2a4e128..fca42ccc7 100644 --- a/definitions/grib2/tables/11/4.2.0.14.table +++ b/definitions/grib2/tables/11/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.15.table b/definitions/grib2/tables/11/4.2.0.15.table index 9a178ceb7..5a599a98e 100644 --- a/definitions/grib2/tables/11/4.2.0.15.table +++ b/definitions/grib2/tables/11/4.2.0.15.table @@ -14,6 +14,6 @@ 12 12 Reflectivity of rain (dB) 13 13 Reflectivity of graupel (dB) 14 14 Reflectivity of hail (dB) -# 15-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 15-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.16.table b/definitions/grib2/tables/11/4.2.0.16.table index 39215ab20..18dedb7c0 100644 --- a/definitions/grib2/tables/11/4.2.0.16.table +++ b/definitions/grib2/tables/11/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.18.table b/definitions/grib2/tables/11/4.2.0.18.table index 82fd13da1..fe06e9ea6 100644 --- a/definitions/grib2/tables/11/4.2.0.18.table +++ b/definitions/grib2/tables/11/4.2.0.18.table @@ -8,11 +8,11 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) 13 13 Total deposition (wet + dry) (Bq m-2) -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.19.table b/definitions/grib2/tables/11/4.2.0.19.table index 2aa34464a..90003262e 100644 --- a/definitions/grib2/tables/11/4.2.0.19.table +++ b/definitions/grib2/tables/11/4.2.0.19.table @@ -27,6 +27,6 @@ 25 25 Weather (Code table 4.225) 26 26 Convective outlook (Code table 4.224) 27 27 Icing scenario (Code table 4.227) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.190.table b/definitions/grib2/tables/11/4.2.0.190.table index 39fb55746..3d9d5ff85 100644 --- a/definitions/grib2/tables/11/4.2.0.190.table +++ b/definitions/grib2/tables/11/4.2.0.190.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.191.table b/definitions/grib2/tables/11/4.2.0.191.table index 81230c0e0..4ff12e532 100644 --- a/definitions/grib2/tables/11/4.2.0.191.table +++ b/definitions/grib2/tables/11/4.2.0.191.table @@ -2,6 +2,6 @@ 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/11/4.2.0.2.table b/definitions/grib2/tables/11/4.2.0.2.table index d587f84e9..f0570417b 100644 --- a/definitions/grib2/tables/11/4.2.0.2.table +++ b/definitions/grib2/tables/11/4.2.0.2.table @@ -35,6 +35,6 @@ 33 33 Wind fetch (m) 34 34 Normal wind component (m s-1) 35 35 Tangential wind component (m s-1) -# 36-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 36-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.20.table b/definitions/grib2/tables/11/4.2.0.20.table index 22cea6061..ca90179fe 100644 --- a/definitions/grib2/tables/11/4.2.0.20.table +++ b/definitions/grib2/tables/11/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -25,7 +25,7 @@ 57 57 Total yearly average burden of the atmosphere (mol) 58 58 Total yearly averaged atmospheric loss (mol/s) 59 59 Aerosol number concentration (m-3) -# 60-99 Reserved +# 60-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -37,6 +37,6 @@ 108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) 109 109 Aerosol lidar extinction from satellite (m-1) 110 110 Aerosol lidar extinction from the ground (m-1) -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.3.table b/definitions/grib2/tables/11/4.2.0.3.table index f718c6ea9..08c1c7bc3 100644 --- a/definitions/grib2/tables/11/4.2.0.3.table +++ b/definitions/grib2/tables/11/4.2.0.3.table @@ -26,6 +26,6 @@ 24 24 Anisotropy of sub-gridscale orography (Numeric) 25 25 Natural logarithm of pressure in Pa (Numeric) 26 26 Exner pressure (Numeric) -# 27-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 27-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.4.table b/definitions/grib2/tables/11/4.2.0.4.table index fea4cafc3..336fdb421 100644 --- a/definitions/grib2/tables/11/4.2.0.4.table +++ b/definitions/grib2/tables/11/4.2.0.4.table @@ -12,9 +12,9 @@ 10 10 Photosynthetically active radiation (W m-2) 11 11 Net short-wave radiation flux, clear sky (W m-2) 12 12 Downward UV radiation (W m-2) -# 13-49 Reserved +# 13-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) -# 52-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.5.table b/definitions/grib2/tables/11/4.2.0.5.table index b0c93dd3a..86a199ace 100644 --- a/definitions/grib2/tables/11/4.2.0.5.table +++ b/definitions/grib2/tables/11/4.2.0.5.table @@ -6,6 +6,6 @@ 4 4 Upward long-wave radiation flux (W m-2) 5 5 Net long-wave radiation flux (W m-2) 6 6 Net long-wave radiation flux, clear sky (W m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.6.table b/definitions/grib2/tables/11/4.2.0.6.table index a06f4292f..2d088e5fc 100644 --- a/definitions/grib2/tables/11/4.2.0.6.table +++ b/definitions/grib2/tables/11/4.2.0.6.table @@ -35,6 +35,6 @@ 33 33 Sunshine duration (s) 34 34 Surface long-wave effective total cloudiness (Numeric) 35 35 Surface short-wave effective total cloudiness (Numeric) -# 36-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 36-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.0.7.table b/definitions/grib2/tables/11/4.2.0.7.table index 7a7d2008b..6c1794c73 100644 --- a/definitions/grib2/tables/11/4.2.0.7.table +++ b/definitions/grib2/tables/11/4.2.0.7.table @@ -13,8 +13,8 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraft helicity (m2 s-2) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.1.0.table b/definitions/grib2/tables/11/4.2.1.0.table index bf1e3e93f..9c4d129da 100644 --- a/definitions/grib2/tables/11/4.2.1.0.table +++ b/definitions/grib2/tables/11/4.2.1.0.table @@ -6,6 +6,6 @@ 4 4 Snow water equivalent per cent of normal (%) 5 5 Baseflow-groundwater runoff (kg m-2) 6 6 Storm surface runoff (kg m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.1.1.table b/definitions/grib2/tables/11/4.2.1.1.table index cb5117dc8..aa560e479 100644 --- a/definitions/grib2/tables/11/4.2.1.1.table +++ b/definitions/grib2/tables/11/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.10.0.table b/definitions/grib2/tables/11/4.2.10.0.table index b820364fa..43643d405 100644 --- a/definitions/grib2/tables/11/4.2.10.0.table +++ b/definitions/grib2/tables/11/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea-surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (s-1) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.10.1.table b/definitions/grib2/tables/11/4.2.10.1.table index ae52b0c26..de6b562b8 100644 --- a/definitions/grib2/tables/11/4.2.10.1.table +++ b/definitions/grib2/tables/11/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.10.191.table b/definitions/grib2/tables/11/4.2.10.191.table index 14085ac9a..6cafbd3d4 100644 --- a/definitions/grib2/tables/11/4.2.10.191.table +++ b/definitions/grib2/tables/11/4.2.10.191.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.10.2.table b/definitions/grib2/tables/11/4.2.10.2.table index a6d9dd0c8..258aeef18 100644 --- a/definitions/grib2/tables/11/4.2.10.2.table +++ b/definitions/grib2/tables/11/4.2.10.2.table @@ -9,6 +9,6 @@ 7 7 Ice divergence (/s) 8 8 Ice temperature (K) 9 9 Ice internal pressure (Pa m) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.10.3.table b/definitions/grib2/tables/11/4.2.10.3.table index 112af09d5..3b9a2df46 100644 --- a/definitions/grib2/tables/11/4.2.10.3.table +++ b/definitions/grib2/tables/11/4.2.10.3.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.10.4.table b/definitions/grib2/tables/11/4.2.10.4.table index d80a32780..91ffb2b29 100644 --- a/definitions/grib2/tables/11/4.2.10.4.table +++ b/definitions/grib2/tables/11/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2 s-1) 6 6 Ocean vertical momentum diffusivity (m2 s-1) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (m-1) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.2.0.table b/definitions/grib2/tables/11/4.2.2.0.table index 9a426a5c2..0632ff414 100644 --- a/definitions/grib2/tables/11/4.2.2.0.table +++ b/definitions/grib2/tables/11/4.2.2.0.table @@ -32,6 +32,6 @@ 30 30 Deciduous forest cover (Proportion) 31 31 Normalized differential vegetation index (NDVI) (Numeric) 32 32 Root depth of vegetation (m) -# 33-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 33-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.2.3.table b/definitions/grib2/tables/11/4.2.2.3.table index e985e41aa..d7db59d5e 100644 --- a/definitions/grib2/tables/11/4.2.2.3.table +++ b/definitions/grib2/tables/11/4.2.2.3.table @@ -22,6 +22,6 @@ 20 20 Column-integrated soil moisture (kg m-2) 21 21 Soil ice (kg m-3) 22 22 Column-integrated soil ice (kg m-2) -# 23-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 23-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.2.4.table b/definitions/grib2/tables/11/4.2.2.4.table index a5f0a3c5c..0992f59db 100644 --- a/definitions/grib2/tables/11/4.2.2.4.table +++ b/definitions/grib2/tables/11/4.2.2.4.table @@ -4,5 +4,5 @@ 2 2 Haines Index (Numeric) 3 3 Fire burned area (%) # 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.3.0.table b/definitions/grib2/tables/11/4.2.3.0.table index 254e56bc8..8c19d43b2 100644 --- a/definitions/grib2/tables/11/4.2.3.0.table +++ b/definitions/grib2/tables/11/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.2.3.1.table b/definitions/grib2/tables/11/4.2.3.1.table index 176ac35fb..af1896b14 100644 --- a/definitions/grib2/tables/11/4.2.3.1.table +++ b/definitions/grib2/tables/11/4.2.3.1.table @@ -17,12 +17,12 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +23 23 Angstrom coefficient +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.201.table b/definitions/grib2/tables/11/4.201.table index dc3926b3f..b9711f69c 100644 --- a/definitions/grib2/tables/11/4.201.table +++ b/definitions/grib2/tables/11/4.201.table @@ -1,10 +1,10 @@ # Code table 4.201 - Precipitation type -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.202.table b/definitions/grib2/tables/11/4.202.table index 438502ff9..7f3c8f6cf 100644 --- a/definitions/grib2/tables/11/4.202.table +++ b/definitions/grib2/tables/11/4.202.table @@ -1,4 +1,4 @@ # Code table 4.202 - Precipitable water category -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.203.table b/definitions/grib2/tables/11/4.203.table index 8a9aedf7a..cf5eb6bdc 100644 --- a/definitions/grib2/tables/11/4.203.table +++ b/definitions/grib2/tables/11/4.203.table @@ -1,26 +1,26 @@ # Code table 4.203 - Cloud type -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.204.table b/definitions/grib2/tables/11/4.204.table index 91bcf1814..ffbd89502 100644 --- a/definitions/grib2/tables/11/4.204.table +++ b/definitions/grib2/tables/11/4.204.table @@ -1,9 +1,9 @@ # Code table 4.204 - Thunderstorm coverage -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (16-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (16-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.205.table b/definitions/grib2/tables/11/4.205.table index 5b4484dfd..c40c7f47b 100644 --- a/definitions/grib2/tables/11/4.205.table +++ b/definitions/grib2/tables/11/4.205.table @@ -1,6 +1,6 @@ # Code table 4.205 - Presence of aerosol -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.206.table b/definitions/grib2/tables/11/4.206.table index 02c3dfdf9..76472c261 100644 --- a/definitions/grib2/tables/11/4.206.table +++ b/definitions/grib2/tables/11/4.206.table @@ -1,6 +1,6 @@ # Code table 4.206 - Volcanic ash -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.207.table b/definitions/grib2/tables/11/4.207.table index 8ddb2e048..b6392fca0 100644 --- a/definitions/grib2/tables/11/4.207.table +++ b/definitions/grib2/tables/11/4.207.table @@ -1,10 +1,10 @@ # Code table 4.207 - Icing -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.208.table b/definitions/grib2/tables/11/4.208.table index b83685a1a..4361d38c0 100644 --- a/definitions/grib2/tables/11/4.208.table +++ b/definitions/grib2/tables/11/4.208.table @@ -1,9 +1,9 @@ # Code table 4.208 - Turbulence -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.209.table b/definitions/grib2/tables/11/4.209.table index cb7617071..39ea549ac 100644 --- a/definitions/grib2/tables/11/4.209.table +++ b/definitions/grib2/tables/11/4.209.table @@ -1,9 +1,9 @@ # Code table 4.209 - Planetary boundary-layer regime -0 0 Reserved -1 1 Stable -2 2 Mechanically driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.210.table b/definitions/grib2/tables/11/4.210.table index 524a6ca73..791878469 100644 --- a/definitions/grib2/tables/11/4.210.table +++ b/definitions/grib2/tables/11/4.210.table @@ -1,6 +1,6 @@ # Code table 4.210 - Contrail intensity -0 0 Contrail not present -1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.211.table b/definitions/grib2/tables/11/4.211.table index 098eb2d43..2a28a84d9 100644 --- a/definitions/grib2/tables/11/4.211.table +++ b/definitions/grib2/tables/11/4.211.table @@ -1,7 +1,7 @@ # Code table 4.211 - Contrail engine type -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.212.table b/definitions/grib2/tables/11/4.212.table index 1a085b88d..6a3dcf88c 100644 --- a/definitions/grib2/tables/11/4.212.table +++ b/definitions/grib2/tables/11/4.212.table @@ -1,18 +1,18 @@ # Code table 4.212 - Land use -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.213.table b/definitions/grib2/tables/11/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/11/4.213.table +++ b/definitions/grib2/tables/11/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.215.table b/definitions/grib2/tables/11/4.215.table index 88fda8b8c..c264c6722 100644 --- a/definitions/grib2/tables/11/4.215.table +++ b/definitions/grib2/tables/11/4.215.table @@ -1,9 +1,9 @@ # Code table 4.215 - Remotely-sensed snow coverage -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.216.table b/definitions/grib2/tables/11/4.216.table index 4d9a70f86..b51b358f4 100644 --- a/definitions/grib2/tables/11/4.216.table +++ b/definitions/grib2/tables/11/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain # 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/11/4.217.table b/definitions/grib2/tables/11/4.217.table index a4452182c..a700410d5 100644 --- a/definitions/grib2/tables/11/4.217.table +++ b/definitions/grib2/tables/11/4.217.table @@ -1,8 +1,8 @@ # Code table 4.217 - Cloud mask type -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.218.table b/definitions/grib2/tables/11/4.218.table index 6940a0e41..acf069c32 100644 --- a/definitions/grib2/tables/11/4.218.table +++ b/definitions/grib2/tables/11/4.218.table @@ -1,38 +1,38 @@ # Code table 4.218 - Pixel scene type -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation / crops -15 15 Permanent snow / ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -# 19-96 Reserved -97 97 Snow / ice on land -98 98 Snow / ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud / fog / Stratus -102 102 Low cloud / Stratocumulus -103 103 Low cloud / unknown type -104 104 Medium cloud / Nimbostratus -105 105 Medium cloud / Altostratus -106 106 Medium cloud / unknown type -107 107 High cloud / Cumulus -108 108 High cloud / Cirrus -109 109 High cloud / unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation / crops +15 15 Permanent snow / ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +# 19-96 Reserved +97 97 Snow / ice on land +98 98 Snow / ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud / fog / Stratus +102 102 Low cloud / Stratocumulus +103 103 Low cloud / unknown type +104 104 Medium cloud / Nimbostratus +105 105 Medium cloud / Altostratus +106 106 Medium cloud / unknown type +107 107 High cloud / Cumulus +108 108 High cloud / Cirrus +109 109 High cloud / unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.219.table b/definitions/grib2/tables/11/4.219.table index 86df0522e..9979f50ad 100644 --- a/definitions/grib2/tables/11/4.219.table +++ b/definitions/grib2/tables/11/4.219.table @@ -1,8 +1,8 @@ # Code table 4.219 - Cloud top height quality indicator -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.220.table b/definitions/grib2/tables/11/4.220.table index 93e841f8b..88e869e42 100644 --- a/definitions/grib2/tables/11/4.220.table +++ b/definitions/grib2/tables/11/4.220.table @@ -1,6 +1,6 @@ # Code table 4.220 - Horizontal dimension processed -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.221.table b/definitions/grib2/tables/11/4.221.table index 8448533d7..011cc3518 100644 --- a/definitions/grib2/tables/11/4.221.table +++ b/definitions/grib2/tables/11/4.221.table @@ -1,6 +1,6 @@ # Code table 4.221 - Treatment of missing data -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.222.table b/definitions/grib2/tables/11/4.222.table index 57f113014..558d947ac 100644 --- a/definitions/grib2/tables/11/4.222.table +++ b/definitions/grib2/tables/11/4.222.table @@ -1,6 +1,6 @@ # Code table 4.222 - Categorical result -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.223.table b/definitions/grib2/tables/11/4.223.table index e54719f86..11f629ef5 100644 --- a/definitions/grib2/tables/11/4.223.table +++ b/definitions/grib2/tables/11/4.223.table @@ -1,5 +1,5 @@ # Code table 4.223 - Fire detection indicator -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing value +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing value diff --git a/definitions/grib2/tables/11/4.224.table b/definitions/grib2/tables/11/4.224.table index e87cde4bb..014f56e23 100644 --- a/definitions/grib2/tables/11/4.224.table +++ b/definitions/grib2/tables/11/4.224.table @@ -1,18 +1,18 @@ # Code table 4.224 - Categorical outlook -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/11/4.227.table b/definitions/grib2/tables/11/4.227.table index 6a98d49d0..7676664e4 100644 --- a/definitions/grib2/tables/11/4.227.table +++ b/definitions/grib2/tables/11/4.227.table @@ -4,6 +4,6 @@ 2 2 Convective 3 3 Stratiform 4 4 Freezing -# 5-191 Reserved +# 5-191 Reserved # 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/11/4.234.table b/definitions/grib2/tables/11/4.234.table index 78d8fff12..9628e618e 100644 --- a/definitions/grib2/tables/11/4.234.table +++ b/definitions/grib2/tables/11/4.234.table @@ -6,14 +6,14 @@ 5 5 Deciduous broadleaf trees 6 6 Evergreen broadleaf trees 7 7 Tall grass -8 8 Desert -9 9 Tundra +8 8 Desert +9 9 Tundra 10 10 Irrigated crops -11 11 Semidesert +11 11 Semidesert 12 12 Ice caps and glaciers 13 13 Bogs and marshes 14 14 Inland water -15 15 Ocean +15 15 Ocean 16 16 Evergreen shrubs 17 17 Deciduous shrubs 18 18 Mixed forest diff --git a/definitions/grib2/tables/11/4.3.table b/definitions/grib2/tables/11/4.3.table index 8f7d20be3..1681cfc93 100644 --- a/definitions/grib2/tables/11/4.3.table +++ b/definitions/grib2/tables/11/4.3.table @@ -1,16 +1,16 @@ # Code table 4.3 - Type of generating process -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.4.table b/definitions/grib2/tables/11/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/11/4.4.table +++ b/definitions/grib2/tables/11/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.5.table b/definitions/grib2/tables/11/4.5.table index 1ada3eb23..c3b8aec5d 100644 --- a/definitions/grib2/tables/11/4.5.table +++ b/definitions/grib2/tables/11/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface 2 2 Cloud base level 3 3 Level of cloud tops @@ -12,11 +12,11 @@ 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) 12 12 Cumulonimbus (CB) top (m) -# 13-19 Reserved +# 13-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -25,7 +25,7 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level 112 112 Reserved 113 113 Logarithmic hybrid level @@ -36,7 +36,7 @@ 119 hpl Hybrid pressure level # 120-149 Reserved 150 150 Generalized vertical height coordinate -# 151-159 Reserved +# 151-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom @@ -44,6 +44,6 @@ 164 164 Bottom of thermally active sediment layer 165 165 Bottom of sediment layer penetrated by thermal wave 166 sfc Mixing layer -# 167-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 167-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.6.table b/definitions/grib2/tables/11/4.6.table index b2dfeb498..ce799721d 100644 --- a/definitions/grib2/tables/11/4.6.table +++ b/definitions/grib2/tables/11/4.6.table @@ -1,9 +1,9 @@ # Code table 4.6 - Type of ensemble forecast -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.7.table b/definitions/grib2/tables/11/4.7.table index e0de0e1b2..69b2b4d77 100644 --- a/definitions/grib2/tables/11/4.7.table +++ b/definitions/grib2/tables/11/4.7.table @@ -1,14 +1,14 @@ # Code table 4.7 - Derived forecast -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.8.table b/definitions/grib2/tables/11/4.8.table index ad883039c..78467454a 100644 --- a/definitions/grib2/tables/11/4.8.table +++ b/definitions/grib2/tables/11/4.8.table @@ -1,6 +1,6 @@ # Code table 4.8 - Clustering method -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.9.table b/definitions/grib2/tables/11/4.9.table index 5878b5ad3..0ce312dd1 100644 --- a/definitions/grib2/tables/11/4.9.table +++ b/definitions/grib2/tables/11/4.9.table @@ -1,9 +1,9 @@ # Code table 4.9 - Probability type -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/4.91.table b/definitions/grib2/tables/11/4.91.table index 97b1c70ad..ae31ed61c 100644 --- a/definitions/grib2/tables/11/4.91.table +++ b/definitions/grib2/tables/11/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit 11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/11/5.1.table b/definitions/grib2/tables/11/5.1.table index 854330c74..1189b5e46 100644 --- a/definitions/grib2/tables/11/5.1.table +++ b/definitions/grib2/tables/11/5.1.table @@ -1,6 +1,6 @@ # Code table 5.1 - Type of original field values -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/5.2.table b/definitions/grib2/tables/11/5.2.table index 7a4500ecd..d12b46fbd 100644 --- a/definitions/grib2/tables/11/5.2.table +++ b/definitions/grib2/tables/11/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use +# 12-191 Reserved +# 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/11/5.3.table b/definitions/grib2/tables/11/5.3.table index c3b7b30fe..481331791 100644 --- a/definitions/grib2/tables/11/5.3.table +++ b/definitions/grib2/tables/11/5.3.table @@ -1,7 +1,7 @@ # Code table 5.3 - Matrix coordinate parameter -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/5.4.table b/definitions/grib2/tables/11/5.4.table index 8121c1819..e84ab1901 100644 --- a/definitions/grib2/tables/11/5.4.table +++ b/definitions/grib2/tables/11/5.4.table @@ -1,6 +1,6 @@ # Code table 5.4 - Group splitting method -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/5.40.table b/definitions/grib2/tables/11/5.40.table index b9bad2c39..97e8880ab 100644 --- a/definitions/grib2/tables/11/5.40.table +++ b/definitions/grib2/tables/11/5.40.table @@ -1,5 +1,5 @@ # Code table 5.40 - Type of compression -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/11/5.5.table b/definitions/grib2/tables/11/5.5.table index 3ef3eb070..f2316975a 100644 --- a/definitions/grib2/tables/11/5.5.table +++ b/definitions/grib2/tables/11/5.5.table @@ -1,7 +1,7 @@ # Code table 5.5 - Missing value management for complex packing -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/5.6.table b/definitions/grib2/tables/11/5.6.table index 6d5177877..db68ead9c 100644 --- a/definitions/grib2/tables/11/5.6.table +++ b/definitions/grib2/tables/11/5.6.table @@ -1,7 +1,7 @@ # Code table 5.6 - Order of spatial differencing -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/11/5.7.table b/definitions/grib2/tables/11/5.7.table index 5ab780056..e54862c19 100644 --- a/definitions/grib2/tables/11/5.7.table +++ b/definitions/grib2/tables/11/5.7.table @@ -1,7 +1,7 @@ # Code table 5.7 - Precision of floating-point numbers -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/11/6.0.table b/definitions/grib2/tables/11/6.0.table index f539b26d7..a8f30f5a4 100644 --- a/definitions/grib2/tables/11/6.0.table +++ b/definitions/grib2/tables/11/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator 0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/12/0.0.table b/definitions/grib2/tables/12/0.0.table index b24c50564..2c5afceb4 100644 --- a/definitions/grib2/tables/12/0.0.table +++ b/definitions/grib2/tables/12/0.0.table @@ -1,10 +1,10 @@ # Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/1.0.table b/definitions/grib2/tables/12/1.0.table index 84ec19886..b21d01815 100644 --- a/definitions/grib2/tables/12/1.0.table +++ b/definitions/grib2/tables/12/1.0.table @@ -1,17 +1,17 @@ # Code table 1.0 - GRIB master tables version number -0 0 Experimental -1 1 Version implemented on 7 November 2001 -2 2 Version implemented on 4 November 2003 -3 3 Version implemented on 2 November 2005 -4 4 Version implemented on 7 November 2007 -5 5 Version implemented on 4 November 2009 -6 6 Version implemented on 15 September 2010 -7 7 Version implemented on 4 May 2011 -8 8 Version implemented on 2 November 2011 -9 9 Version implemented on 2 May 2012 +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 +6 6 Version implemented on 15 September 2010 +7 7 Version implemented on 4 May 2011 +8 8 Version implemented on 2 November 2011 +9 9 Version implemented on 2 May 2012 10 10 Version implemented on 7 November 2012 11 11 Version implemented on 8 May 2013 12 12 Version implemented on 14 November 2013 13 13 Pre-operational to be implemented by next amendment -# 14-254 Future versions -255 255 Missing +# 14-254 Future versions +255 255 Missing diff --git a/definitions/grib2/tables/12/1.1.table b/definitions/grib2/tables/12/1.1.table index d50f8fd72..f6d332005 100644 --- a/definitions/grib2/tables/12/1.1.table +++ b/definitions/grib2/tables/12/1.1.table @@ -1,4 +1,4 @@ # Code table 1.1 - GRIB local tables version number -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/12/1.2.table b/definitions/grib2/tables/12/1.2.table index 934b70455..638f1efbb 100644 --- a/definitions/grib2/tables/12/1.2.table +++ b/definitions/grib2/tables/12/1.2.table @@ -1,8 +1,8 @@ # Code table 1.2 - Significance of reference time -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/1.3.table b/definitions/grib2/tables/12/1.3.table index e8c38878d..34ace7fda 100644 --- a/definitions/grib2/tables/12/1.3.table +++ b/definitions/grib2/tables/12/1.3.table @@ -1,12 +1,12 @@ # Code table 1.3 - Production status of data -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products 4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) 5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) 6 6 Sub-seasonal to seasonal prediction project (S2S) 7 7 Sub-seasonal to seasonal prediction project test (S2S) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/1.4.table b/definitions/grib2/tables/12/1.4.table index 03203d874..877288c0e 100644 --- a/definitions/grib2/tables/12/1.4.table +++ b/definitions/grib2/tables/12/1.4.table @@ -1,13 +1,13 @@ # Code table 1.4 - Type of data -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/12/1.5.table b/definitions/grib2/tables/12/1.5.table index b2cf9f087..533111959 100644 --- a/definitions/grib2/tables/12/1.5.table +++ b/definitions/grib2/tables/12/1.5.table @@ -1,7 +1,7 @@ # Code table 1.5 - Identification template number -0 0 Calendar definition -1 1 Paleontological offset -2 2 Calendar definition and paleontological offset -# 3-32767 Reserved -# 32768-65534 Reserved for local use -65535 65535 Missing +0 0 Calendar definition +1 1 Paleontological offset +2 2 Calendar definition and paleontological offset +# 3-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/12/1.6.table b/definitions/grib2/tables/12/1.6.table index 5db921990..bd46899a7 100644 --- a/definitions/grib2/tables/12/1.6.table +++ b/definitions/grib2/tables/12/1.6.table @@ -1,8 +1,8 @@ # Code table 1.6 - Type of calendar -0 0 Gregorian -1 1 360-day -2 2 365-day -3 3 Proleptic Gregorian -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Gregorian +1 1 360-day +2 2 365-day +3 3 Proleptic Gregorian +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/3.0.table b/definitions/grib2/tables/12/3.0.table index 45187b80d..a442a06a0 100644 --- a/definitions/grib2/tables/12/3.0.table +++ b/definitions/grib2/tables/12/3.0.table @@ -1,6 +1,6 @@ # Code table 3.0 - Source of grid definition -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/12/3.10.table b/definitions/grib2/tables/12/3.10.table index afa8843a7..1612d05e3 100644 --- a/definitions/grib2/tables/12/3.10.table +++ b/definitions/grib2/tables/12/3.10.table @@ -1,8 +1,8 @@ # Flag table 3.10 - Scanning mode for one diamond -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/12/3.11.table b/definitions/grib2/tables/12/3.11.table index e516a2ab9..06ae10810 100644 --- a/definitions/grib2/tables/12/3.11.table +++ b/definitions/grib2/tables/12/3.11.table @@ -1,7 +1,7 @@ # Code table 3.11 - Interpretation of list of numbers at end of section 3 -0 0 There is no appended list -1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows -2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row -3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) -# 4-254 Reserved -255 255 Missing +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/12/3.15.table b/definitions/grib2/tables/12/3.15.table index 331217ebe..6087902a3 100644 --- a/definitions/grib2/tables/12/3.15.table +++ b/definitions/grib2/tables/12/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/3.2.table b/definitions/grib2/tables/12/3.2.table index 9238dc2a7..b9574a424 100644 --- a/definitions/grib2/tables/12/3.2.table +++ b/definitions/grib2/tables/12/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame -9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/3.20.table b/definitions/grib2/tables/12/3.20.table index efbf08d19..e2bb156ee 100644 --- a/definitions/grib2/tables/12/3.20.table +++ b/definitions/grib2/tables/12/3.20.table @@ -1,6 +1,6 @@ # Code table 3.20 - Type of horizontal line -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/3.21.table b/definitions/grib2/tables/12/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/12/3.21.table +++ b/definitions/grib2/tables/12/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/3.3.table b/definitions/grib2/tables/12/3.3.table index 5dd7c7001..25cb46a1d 100644 --- a/definitions/grib2/tables/12/3.3.table +++ b/definitions/grib2/tables/12/3.3.table @@ -1,9 +1,9 @@ # Flag table 3.3 - Resolution and component flags -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/12/3.4.table b/definitions/grib2/tables/12/3.4.table index 63c8adaaa..ea9cbe829 100644 --- a/definitions/grib2/tables/12/3.4.table +++ b/definitions/grib2/tables/12/3.4.table @@ -1,10 +1,10 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -# 5-8 Reserved +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +# 5-8 Reserved diff --git a/definitions/grib2/tables/12/3.5.table b/definitions/grib2/tables/12/3.5.table index eabdde896..2f8ec82e3 100644 --- a/definitions/grib2/tables/12/3.5.table +++ b/definitions/grib2/tables/12/3.5.table @@ -1,5 +1,5 @@ # Flag table 3.5 - Projection centre -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/12/3.7.table b/definitions/grib2/tables/12/3.7.table index 0a7d6efde..34c0de085 100644 --- a/definitions/grib2/tables/12/3.7.table +++ b/definitions/grib2/tables/12/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 see separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/12/3.8.table b/definitions/grib2/tables/12/3.8.table index 844e74235..578fab37f 100644 --- a/definitions/grib2/tables/12/3.8.table +++ b/definitions/grib2/tables/12/3.8.table @@ -1,7 +1,7 @@ # Code table 3.8 - Grid point position -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/3.9.table b/definitions/grib2/tables/12/3.9.table index fd730bc64..ecd65514a 100644 --- a/definitions/grib2/tables/12/3.9.table +++ b/definitions/grib2/tables/12/3.9.table @@ -1,4 +1,4 @@ # Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/12/4.0.table b/definitions/grib2/tables/12/4.0.table index b77e3f323..8608d20f9 100644 --- a/definitions/grib2/tables/12/4.0.table +++ b/definitions/grib2/tables/12/4.0.table @@ -1,61 +1,61 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time -8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -# 35-39 Reserved +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data +# 35-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol -46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -# 49-50 Reserved -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time -52 52 Reserved -53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time -54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +# 49-50 Reserved +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +52 52 Reserved +53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time +54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters 60 60 Individual ensemble re-forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time 61 61 Individual ensemble re-forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 55-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +# 55-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved -# 32768-65534 Reserved for local use +# 1102-32767 Reserved +# 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/12/4.1.0.table b/definitions/grib2/tables/12/4.1.0.table index 04cfd7802..df58636d6 100644 --- a/definitions/grib2/tables/12/4.1.0.table +++ b/definitions/grib2/tables/12/4.1.0.table @@ -1,27 +1,27 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.1.1.table b/definitions/grib2/tables/12/4.1.1.table index 7b22b6fed..05a854da0 100644 --- a/definitions/grib2/tables/12/4.1.1.table +++ b/definitions/grib2/tables/12/4.1.1.table @@ -1,7 +1,7 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.1.10.table b/definitions/grib2/tables/12/4.1.10.table index b97dcd355..e9663f391 100644 --- a/definitions/grib2/tables/12/4.1.10.table +++ b/definitions/grib2/tables/12/4.1.10.table @@ -1,10 +1,10 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Sub-surface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Sub-surface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.1.2.table b/definitions/grib2/tables/12/4.1.2.table index 5b488fe9e..e74126645 100644 --- a/definitions/grib2/tables/12/4.1.2.table +++ b/definitions/grib2/tables/12/4.1.2.table @@ -1,9 +1,9 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.1.3.table b/definitions/grib2/tables/12/4.1.3.table index 5096a166e..c1a1e267a 100644 --- a/definitions/grib2/tables/12/4.1.3.table +++ b/definitions/grib2/tables/12/4.1.3.table @@ -1,6 +1,6 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Image format products -1 1 Quantitative products -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.10.table b/definitions/grib2/tables/12/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/12/4.10.table +++ b/definitions/grib2/tables/12/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/12/4.11.table b/definitions/grib2/tables/12/4.11.table index 7f404c849..01cc81303 100644 --- a/definitions/grib2/tables/12/4.11.table +++ b/definitions/grib2/tables/12/4.11.table @@ -1,10 +1,10 @@ # Code table 4.11 - Type of time intervals -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.12.table b/definitions/grib2/tables/12/4.12.table index 03fd89b36..d42b47e96 100644 --- a/definitions/grib2/tables/12/4.12.table +++ b/definitions/grib2/tables/12/4.12.table @@ -1,7 +1,7 @@ # Code table 4.12 - Operating mode -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.13.table b/definitions/grib2/tables/12/4.13.table index c92854eec..a0e28eac8 100644 --- a/definitions/grib2/tables/12/4.13.table +++ b/definitions/grib2/tables/12/4.13.table @@ -1,6 +1,6 @@ # Code table 4.13 - Quality control indicator -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.14.table b/definitions/grib2/tables/12/4.14.table index a88cb93fa..d525b23b3 100644 --- a/definitions/grib2/tables/12/4.14.table +++ b/definitions/grib2/tables/12/4.14.table @@ -1,6 +1,6 @@ # Code table 4.14 - Clutter filter indicator -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.15.table b/definitions/grib2/tables/12/4.15.table index 2e5f3dea3..7adddedb6 100644 --- a/definitions/grib2/tables/12/4.15.table +++ b/definitions/grib2/tables/12/4.15.table @@ -1,11 +1,11 @@ # Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.0.table b/definitions/grib2/tables/12/4.2.0.0.table index ce91fe429..f5841e889 100644 --- a/definitions/grib2/tables/12/4.2.0.0.table +++ b/definitions/grib2/tables/12/4.2.0.0.table @@ -20,6 +20,6 @@ 18 18 Snow temperature (top of snow) (K) 19 19 Turbulent transfer coefficient for heat (Numeric) 20 20 Turbulent diffusion coefficient for heat (m2/s) -# 21-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 21-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.1.table b/definitions/grib2/tables/12/4.2.0.1.table index d1d1704df..fb7c3d776 100644 --- a/definitions/grib2/tables/12/4.2.0.1.table +++ b/definitions/grib2/tables/12/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,10 +86,10 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) -# 93-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 93-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.13.table b/definitions/grib2/tables/12/4.2.0.13.table index 5086101ad..3f5c30675 100644 --- a/definitions/grib2/tables/12/4.2.0.13.table +++ b/definitions/grib2/tables/12/4.2.0.13.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.14.table b/definitions/grib2/tables/12/4.2.0.14.table index 215884737..97fb38c8b 100644 --- a/definitions/grib2/tables/12/4.2.0.14.table +++ b/definitions/grib2/tables/12/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.15.table b/definitions/grib2/tables/12/4.2.0.15.table index d74fa7234..bb0b9ab46 100644 --- a/definitions/grib2/tables/12/4.2.0.15.table +++ b/definitions/grib2/tables/12/4.2.0.15.table @@ -14,6 +14,6 @@ 12 12 Reflectivity of rain (dB) 13 13 Reflectivity of graupel (dB) 14 14 Reflectivity of hail (dB) -# 15-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 15-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.16.table b/definitions/grib2/tables/12/4.2.0.16.table index 0c240a853..9499d9333 100644 --- a/definitions/grib2/tables/12/4.2.0.16.table +++ b/definitions/grib2/tables/12/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.18.table b/definitions/grib2/tables/12/4.2.0.18.table index 18c41aa48..7e0a736eb 100644 --- a/definitions/grib2/tables/12/4.2.0.18.table +++ b/definitions/grib2/tables/12/4.2.0.18.table @@ -8,11 +8,11 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) 13 13 Total deposition (wet + dry) (Bq m-2) -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.19.table b/definitions/grib2/tables/12/4.2.0.19.table index 75101bd37..d2beef083 100644 --- a/definitions/grib2/tables/12/4.2.0.19.table +++ b/definitions/grib2/tables/12/4.2.0.19.table @@ -27,6 +27,6 @@ 25 25 Weather (Code table 4.225) 26 26 Convective outlook (Code table 4.224) 27 27 Icing scenario (Code table 4.227) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.190.table b/definitions/grib2/tables/12/4.2.0.190.table index de621a924..a0d6ba0ac 100644 --- a/definitions/grib2/tables/12/4.2.0.190.table +++ b/definitions/grib2/tables/12/4.2.0.190.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.191.table b/definitions/grib2/tables/12/4.2.0.191.table index 1f949f149..2e82e01da 100644 --- a/definitions/grib2/tables/12/4.2.0.191.table +++ b/definitions/grib2/tables/12/4.2.0.191.table @@ -2,6 +2,6 @@ 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.2.table b/definitions/grib2/tables/12/4.2.0.2.table index 84882e8b8..ad1d84f52 100644 --- a/definitions/grib2/tables/12/4.2.0.2.table +++ b/definitions/grib2/tables/12/4.2.0.2.table @@ -35,6 +35,6 @@ 33 33 Wind fetch (m) 34 34 Normal wind component (m s-1) 35 35 Tangential wind component (m s-1) -# 36-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 36-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.20.table b/definitions/grib2/tables/12/4.2.0.20.table index ac97b0b39..a0eb7724a 100644 --- a/definitions/grib2/tables/12/4.2.0.20.table +++ b/definitions/grib2/tables/12/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -25,7 +25,7 @@ 57 57 Total yearly average burden of the atmosphere (mol) 58 58 Total yearly averaged atmospheric loss (mol/s) 59 59 Aerosol number concentration (m-3) -# 60-99 Reserved +# 60-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -37,6 +37,6 @@ 108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) 109 109 Aerosol lidar extinction from satellite (m-1) 110 110 Aerosol lidar extinction from the ground (m-1) -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.3.table b/definitions/grib2/tables/12/4.2.0.3.table index 9a88e0027..e1a68bfc5 100644 --- a/definitions/grib2/tables/12/4.2.0.3.table +++ b/definitions/grib2/tables/12/4.2.0.3.table @@ -26,6 +26,6 @@ 24 24 Anisotropy of sub-gridscale orography (Numeric) 25 25 Natural logarithm of pressure in Pa (Numeric) 26 26 Exner pressure (Numeric) -# 27-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 27-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.4.table b/definitions/grib2/tables/12/4.2.0.4.table index dbfcbddb7..03b5cea38 100644 --- a/definitions/grib2/tables/12/4.2.0.4.table +++ b/definitions/grib2/tables/12/4.2.0.4.table @@ -12,9 +12,9 @@ 10 10 Photosynthetically active radiation (W m-2) 11 11 Net short-wave radiation flux, clear sky (W m-2) 12 12 Downward UV radiation (W m-2) -# 13-49 Reserved +# 13-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) -# 52-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.5.table b/definitions/grib2/tables/12/4.2.0.5.table index f1c04650d..1bdd6ebee 100644 --- a/definitions/grib2/tables/12/4.2.0.5.table +++ b/definitions/grib2/tables/12/4.2.0.5.table @@ -6,6 +6,6 @@ 4 4 Upward long-wave radiation flux (W m-2) 5 5 Net long-wave radiation flux (W m-2) 6 6 Net long-wave radiation flux, clear sky (W m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.6.table b/definitions/grib2/tables/12/4.2.0.6.table index 9ee97b73f..89da06eec 100644 --- a/definitions/grib2/tables/12/4.2.0.6.table +++ b/definitions/grib2/tables/12/4.2.0.6.table @@ -35,6 +35,6 @@ 33 33 Sunshine duration (s) 34 34 Surface long-wave effective total cloudiness (Numeric) 35 35 Surface short-wave effective total cloudiness (Numeric) -# 36-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 36-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.0.7.table b/definitions/grib2/tables/12/4.2.0.7.table index db47d0113..8a2b85fb9 100644 --- a/definitions/grib2/tables/12/4.2.0.7.table +++ b/definitions/grib2/tables/12/4.2.0.7.table @@ -13,8 +13,8 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraft helicity (m2 s-2) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.1.0.table b/definitions/grib2/tables/12/4.2.1.0.table index e93f0a332..b6c648f00 100644 --- a/definitions/grib2/tables/12/4.2.1.0.table +++ b/definitions/grib2/tables/12/4.2.1.0.table @@ -6,6 +6,6 @@ 4 4 Snow water equivalent per cent of normal (%) 5 5 Baseflow-groundwater runoff (kg m-2) 6 6 Storm surface runoff (kg m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.1.1.table b/definitions/grib2/tables/12/4.2.1.1.table index b488eb0bd..171da3958 100644 --- a/definitions/grib2/tables/12/4.2.1.1.table +++ b/definitions/grib2/tables/12/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.10.0.table b/definitions/grib2/tables/12/4.2.10.0.table index 761b6395c..76b3da22c 100644 --- a/definitions/grib2/tables/12/4.2.10.0.table +++ b/definitions/grib2/tables/12/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea-surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (s-1) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.10.1.table b/definitions/grib2/tables/12/4.2.10.1.table index 5959bfa28..f0a073c00 100644 --- a/definitions/grib2/tables/12/4.2.10.1.table +++ b/definitions/grib2/tables/12/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.10.191.table b/definitions/grib2/tables/12/4.2.10.191.table index 18e56f930..6b9eee36e 100644 --- a/definitions/grib2/tables/12/4.2.10.191.table +++ b/definitions/grib2/tables/12/4.2.10.191.table @@ -1,6 +1,6 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.10.2.table b/definitions/grib2/tables/12/4.2.10.2.table index 6f0664420..24458b91f 100644 --- a/definitions/grib2/tables/12/4.2.10.2.table +++ b/definitions/grib2/tables/12/4.2.10.2.table @@ -9,6 +9,6 @@ 7 7 Ice divergence (/s) 8 8 Ice temperature (K) 9 9 Ice internal pressure (Pa m) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.10.3.table b/definitions/grib2/tables/12/4.2.10.3.table index f951bbe78..937720c93 100644 --- a/definitions/grib2/tables/12/4.2.10.3.table +++ b/definitions/grib2/tables/12/4.2.10.3.table @@ -1,6 +1,6 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.10.4.table b/definitions/grib2/tables/12/4.2.10.4.table index 450320ca1..e20a49470 100644 --- a/definitions/grib2/tables/12/4.2.10.4.table +++ b/definitions/grib2/tables/12/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2 s-1) 6 6 Ocean vertical momentum diffusivity (m2 s-1) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (m-1) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.2.0.table b/definitions/grib2/tables/12/4.2.2.0.table index 95b696a37..98eae911a 100644 --- a/definitions/grib2/tables/12/4.2.2.0.table +++ b/definitions/grib2/tables/12/4.2.2.0.table @@ -32,6 +32,6 @@ 30 30 Deciduous forest cover (Proportion) 31 31 Normalized differential vegetation index (NDVI) (Numeric) 32 32 Root depth of vegetation (m) -# 33-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 33-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.2.3.table b/definitions/grib2/tables/12/4.2.2.3.table index 2f6291077..3d3298c8a 100644 --- a/definitions/grib2/tables/12/4.2.2.3.table +++ b/definitions/grib2/tables/12/4.2.2.3.table @@ -22,6 +22,6 @@ 20 20 Column-integrated soil moisture (kg m-2) 21 21 Soil ice (kg m-3) 22 22 Column-integrated soil ice (kg m-2) -# 23-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 23-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.2.4.table b/definitions/grib2/tables/12/4.2.2.4.table index cf91e8b7a..30865c1b8 100644 --- a/definitions/grib2/tables/12/4.2.2.4.table +++ b/definitions/grib2/tables/12/4.2.2.4.table @@ -3,6 +3,6 @@ 1 1 Fire outlook due to dry thunderstorm (Code table 4.224) 2 2 Haines Index (Numeric) 3 3 Fire burned area (%) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.3.0.table b/definitions/grib2/tables/12/4.2.3.0.table index c0ffa29f5..80a829673 100644 --- a/definitions/grib2/tables/12/4.2.3.0.table +++ b/definitions/grib2/tables/12/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.2.3.1.table b/definitions/grib2/tables/12/4.2.3.1.table index 0c0fc8d37..bc16d8855 100644 --- a/definitions/grib2/tables/12/4.2.3.1.table +++ b/definitions/grib2/tables/12/4.2.3.1.table @@ -17,12 +17,12 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +23 23 Angstrom coefficient +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.201.table b/definitions/grib2/tables/12/4.201.table index 2510f2ef7..fa173c4e0 100644 --- a/definitions/grib2/tables/12/4.201.table +++ b/definitions/grib2/tables/12/4.201.table @@ -10,6 +10,6 @@ 8 8 Ice pellets 9 9 Graupel 10 10 Hail -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.202.table b/definitions/grib2/tables/12/4.202.table index 438502ff9..7f3c8f6cf 100644 --- a/definitions/grib2/tables/12/4.202.table +++ b/definitions/grib2/tables/12/4.202.table @@ -1,4 +1,4 @@ # Code table 4.202 - Precipitable water category -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.203.table b/definitions/grib2/tables/12/4.203.table index 8a9aedf7a..cf5eb6bdc 100644 --- a/definitions/grib2/tables/12/4.203.table +++ b/definitions/grib2/tables/12/4.203.table @@ -1,26 +1,26 @@ # Code table 4.203 - Cloud type -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.204.table b/definitions/grib2/tables/12/4.204.table index 91bcf1814..ffbd89502 100644 --- a/definitions/grib2/tables/12/4.204.table +++ b/definitions/grib2/tables/12/4.204.table @@ -1,9 +1,9 @@ # Code table 4.204 - Thunderstorm coverage -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (16-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (16-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.205.table b/definitions/grib2/tables/12/4.205.table index 5b4484dfd..c40c7f47b 100644 --- a/definitions/grib2/tables/12/4.205.table +++ b/definitions/grib2/tables/12/4.205.table @@ -1,6 +1,6 @@ # Code table 4.205 - Presence of aerosol -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.206.table b/definitions/grib2/tables/12/4.206.table index 02c3dfdf9..76472c261 100644 --- a/definitions/grib2/tables/12/4.206.table +++ b/definitions/grib2/tables/12/4.206.table @@ -1,6 +1,6 @@ # Code table 4.206 - Volcanic ash -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.207.table b/definitions/grib2/tables/12/4.207.table index 8ddb2e048..b6392fca0 100644 --- a/definitions/grib2/tables/12/4.207.table +++ b/definitions/grib2/tables/12/4.207.table @@ -1,10 +1,10 @@ # Code table 4.207 - Icing -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.208.table b/definitions/grib2/tables/12/4.208.table index b83685a1a..4361d38c0 100644 --- a/definitions/grib2/tables/12/4.208.table +++ b/definitions/grib2/tables/12/4.208.table @@ -1,9 +1,9 @@ # Code table 4.208 - Turbulence -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.209.table b/definitions/grib2/tables/12/4.209.table index cb7617071..39ea549ac 100644 --- a/definitions/grib2/tables/12/4.209.table +++ b/definitions/grib2/tables/12/4.209.table @@ -1,9 +1,9 @@ # Code table 4.209 - Planetary boundary-layer regime -0 0 Reserved -1 1 Stable -2 2 Mechanically driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.210.table b/definitions/grib2/tables/12/4.210.table index 524a6ca73..791878469 100644 --- a/definitions/grib2/tables/12/4.210.table +++ b/definitions/grib2/tables/12/4.210.table @@ -1,6 +1,6 @@ # Code table 4.210 - Contrail intensity -0 0 Contrail not present -1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.211.table b/definitions/grib2/tables/12/4.211.table index 098eb2d43..2a28a84d9 100644 --- a/definitions/grib2/tables/12/4.211.table +++ b/definitions/grib2/tables/12/4.211.table @@ -1,7 +1,7 @@ # Code table 4.211 - Contrail engine type -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.212.table b/definitions/grib2/tables/12/4.212.table index 1a085b88d..6a3dcf88c 100644 --- a/definitions/grib2/tables/12/4.212.table +++ b/definitions/grib2/tables/12/4.212.table @@ -1,18 +1,18 @@ # Code table 4.212 - Land use -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.213.table b/definitions/grib2/tables/12/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/12/4.213.table +++ b/definitions/grib2/tables/12/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.215.table b/definitions/grib2/tables/12/4.215.table index 88fda8b8c..c264c6722 100644 --- a/definitions/grib2/tables/12/4.215.table +++ b/definitions/grib2/tables/12/4.215.table @@ -1,9 +1,9 @@ # Code table 4.215 - Remotely-sensed snow coverage -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.216.table b/definitions/grib2/tables/12/4.216.table index 4d9a70f86..b51b358f4 100644 --- a/definitions/grib2/tables/12/4.216.table +++ b/definitions/grib2/tables/12/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain # 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/12/4.217.table b/definitions/grib2/tables/12/4.217.table index a4452182c..a700410d5 100644 --- a/definitions/grib2/tables/12/4.217.table +++ b/definitions/grib2/tables/12/4.217.table @@ -1,8 +1,8 @@ # Code table 4.217 - Cloud mask type -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.218.table b/definitions/grib2/tables/12/4.218.table index 6940a0e41..acf069c32 100644 --- a/definitions/grib2/tables/12/4.218.table +++ b/definitions/grib2/tables/12/4.218.table @@ -1,38 +1,38 @@ # Code table 4.218 - Pixel scene type -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation / crops -15 15 Permanent snow / ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -# 19-96 Reserved -97 97 Snow / ice on land -98 98 Snow / ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud / fog / Stratus -102 102 Low cloud / Stratocumulus -103 103 Low cloud / unknown type -104 104 Medium cloud / Nimbostratus -105 105 Medium cloud / Altostratus -106 106 Medium cloud / unknown type -107 107 High cloud / Cumulus -108 108 High cloud / Cirrus -109 109 High cloud / unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation / crops +15 15 Permanent snow / ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +# 19-96 Reserved +97 97 Snow / ice on land +98 98 Snow / ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud / fog / Stratus +102 102 Low cloud / Stratocumulus +103 103 Low cloud / unknown type +104 104 Medium cloud / Nimbostratus +105 105 Medium cloud / Altostratus +106 106 Medium cloud / unknown type +107 107 High cloud / Cumulus +108 108 High cloud / Cirrus +109 109 High cloud / unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.219.table b/definitions/grib2/tables/12/4.219.table index 86df0522e..9979f50ad 100644 --- a/definitions/grib2/tables/12/4.219.table +++ b/definitions/grib2/tables/12/4.219.table @@ -1,8 +1,8 @@ # Code table 4.219 - Cloud top height quality indicator -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.220.table b/definitions/grib2/tables/12/4.220.table index 93e841f8b..88e869e42 100644 --- a/definitions/grib2/tables/12/4.220.table +++ b/definitions/grib2/tables/12/4.220.table @@ -1,6 +1,6 @@ # Code table 4.220 - Horizontal dimension processed -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.221.table b/definitions/grib2/tables/12/4.221.table index 8448533d7..011cc3518 100644 --- a/definitions/grib2/tables/12/4.221.table +++ b/definitions/grib2/tables/12/4.221.table @@ -1,6 +1,6 @@ # Code table 4.221 - Treatment of missing data -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.222.table b/definitions/grib2/tables/12/4.222.table index 57f113014..558d947ac 100644 --- a/definitions/grib2/tables/12/4.222.table +++ b/definitions/grib2/tables/12/4.222.table @@ -1,6 +1,6 @@ # Code table 4.222 - Categorical result -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.223.table b/definitions/grib2/tables/12/4.223.table index f0deb076a..572c4e7a8 100644 --- a/definitions/grib2/tables/12/4.223.table +++ b/definitions/grib2/tables/12/4.223.table @@ -1,5 +1,5 @@ # Code table 4.223 - Fire detection indicator -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing diff --git a/definitions/grib2/tables/12/4.224.table b/definitions/grib2/tables/12/4.224.table index e87cde4bb..014f56e23 100644 --- a/definitions/grib2/tables/12/4.224.table +++ b/definitions/grib2/tables/12/4.224.table @@ -1,18 +1,18 @@ # Code table 4.224 - Categorical outlook -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/12/4.227.table b/definitions/grib2/tables/12/4.227.table index 27c76553d..48c3b7633 100644 --- a/definitions/grib2/tables/12/4.227.table +++ b/definitions/grib2/tables/12/4.227.table @@ -1,9 +1,9 @@ # Code table 4.227 - Icing scenario (weather/cloud classification) -0 0 None -1 1 General -2 2 Convective -3 3 Stratiform -4 4 Freezing -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 None +1 1 General +2 2 Convective +3 3 Stratiform +4 4 Freezing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/12/4.234.table b/definitions/grib2/tables/12/4.234.table index 9844a91d2..d8b3715b3 100644 --- a/definitions/grib2/tables/12/4.234.table +++ b/definitions/grib2/tables/12/4.234.table @@ -1,21 +1,21 @@ # Code table 4.234 - Canopy cover fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Crops, mixed farming -2 2 Short grass -3 3 Evergreen needleleaf trees -4 4 Deciduous needleleaf trees -5 5 Deciduous broadleaf trees -6 6 Evergreen broadleaf trees -7 7 Tall grass -8 8 Desert -9 9 Tundra -10 10 Irrigated crops -11 11 Semidesert -12 12 Ice caps and glaciers -13 13 Bogs and marshes -14 14 Inland water -15 15 Ocean -16 16 Evergreen shrubs -17 17 Deciduous shrubs -18 18 Mixed forest -19 19 Interrupted forest -20 20 Water and land mixtures +1 1 Crops, mixed farming +2 2 Short grass +3 3 Evergreen needleleaf trees +4 4 Deciduous needleleaf trees +5 5 Deciduous broadleaf trees +6 6 Evergreen broadleaf trees +7 7 Tall grass +8 8 Desert +9 9 Tundra +10 10 Irrigated crops +11 11 Semidesert +12 12 Ice caps and glaciers +13 13 Bogs and marshes +14 14 Inland water +15 15 Ocean +16 16 Evergreen shrubs +17 17 Deciduous shrubs +18 18 Mixed forest +19 19 Interrupted forest +20 20 Water and land mixtures diff --git a/definitions/grib2/tables/12/4.236.table b/definitions/grib2/tables/12/4.236.table index 08c7f8d56..b667b65fc 100644 --- a/definitions/grib2/tables/12/4.236.table +++ b/definitions/grib2/tables/12/4.236.table @@ -1,8 +1,8 @@ # Code table 4.236 - Soil texture fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Coarse -2 2 Medium -3 3 Medium-fine -4 4 Fine -5 5 Very-fine -6 6 Organic -7 7 Tropical-organic +1 1 Coarse +2 2 Medium +3 3 Medium-fine +4 4 Fine +5 5 Very-fine +6 6 Organic +7 7 Tropical-organic diff --git a/definitions/grib2/tables/12/4.3.table b/definitions/grib2/tables/12/4.3.table index 8f7d20be3..1681cfc93 100644 --- a/definitions/grib2/tables/12/4.3.table +++ b/definitions/grib2/tables/12/4.3.table @@ -1,16 +1,16 @@ # Code table 4.3 - Type of generating process -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.4.table b/definitions/grib2/tables/12/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/12/4.4.table +++ b/definitions/grib2/tables/12/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.5.table b/definitions/grib2/tables/12/4.5.table index 1ada3eb23..c3b8aec5d 100644 --- a/definitions/grib2/tables/12/4.5.table +++ b/definitions/grib2/tables/12/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface 2 2 Cloud base level 3 3 Level of cloud tops @@ -12,11 +12,11 @@ 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) 12 12 Cumulonimbus (CB) top (m) -# 13-19 Reserved +# 13-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -25,7 +25,7 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level 112 112 Reserved 113 113 Logarithmic hybrid level @@ -36,7 +36,7 @@ 119 hpl Hybrid pressure level # 120-149 Reserved 150 150 Generalized vertical height coordinate -# 151-159 Reserved +# 151-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom @@ -44,6 +44,6 @@ 164 164 Bottom of thermally active sediment layer 165 165 Bottom of sediment layer penetrated by thermal wave 166 sfc Mixing layer -# 167-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 167-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.6.table b/definitions/grib2/tables/12/4.6.table index b2dfeb498..ce799721d 100644 --- a/definitions/grib2/tables/12/4.6.table +++ b/definitions/grib2/tables/12/4.6.table @@ -1,9 +1,9 @@ # Code table 4.6 - Type of ensemble forecast -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.7.table b/definitions/grib2/tables/12/4.7.table index e0de0e1b2..69b2b4d77 100644 --- a/definitions/grib2/tables/12/4.7.table +++ b/definitions/grib2/tables/12/4.7.table @@ -1,14 +1,14 @@ # Code table 4.7 - Derived forecast -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.8.table b/definitions/grib2/tables/12/4.8.table index ad883039c..78467454a 100644 --- a/definitions/grib2/tables/12/4.8.table +++ b/definitions/grib2/tables/12/4.8.table @@ -1,6 +1,6 @@ # Code table 4.8 - Clustering method -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.9.table b/definitions/grib2/tables/12/4.9.table index 5878b5ad3..0ce312dd1 100644 --- a/definitions/grib2/tables/12/4.9.table +++ b/definitions/grib2/tables/12/4.9.table @@ -1,9 +1,9 @@ # Code table 4.9 - Probability type -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/4.91.table b/definitions/grib2/tables/12/4.91.table index 97b1c70ad..ae31ed61c 100644 --- a/definitions/grib2/tables/12/4.91.table +++ b/definitions/grib2/tables/12/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit 11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/12/5.1.table b/definitions/grib2/tables/12/5.1.table index 854330c74..1189b5e46 100644 --- a/definitions/grib2/tables/12/5.1.table +++ b/definitions/grib2/tables/12/5.1.table @@ -1,6 +1,6 @@ # Code table 5.1 - Type of original field values -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/5.2.table b/definitions/grib2/tables/12/5.2.table index 7a4500ecd..d12b46fbd 100644 --- a/definitions/grib2/tables/12/5.2.table +++ b/definitions/grib2/tables/12/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use +# 12-191 Reserved +# 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/12/5.3.table b/definitions/grib2/tables/12/5.3.table index c3b7b30fe..481331791 100644 --- a/definitions/grib2/tables/12/5.3.table +++ b/definitions/grib2/tables/12/5.3.table @@ -1,7 +1,7 @@ # Code table 5.3 - Matrix coordinate parameter -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/5.4.table b/definitions/grib2/tables/12/5.4.table index 8121c1819..e84ab1901 100644 --- a/definitions/grib2/tables/12/5.4.table +++ b/definitions/grib2/tables/12/5.4.table @@ -1,6 +1,6 @@ # Code table 5.4 - Group splitting method -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/5.40.table b/definitions/grib2/tables/12/5.40.table index b9bad2c39..97e8880ab 100644 --- a/definitions/grib2/tables/12/5.40.table +++ b/definitions/grib2/tables/12/5.40.table @@ -1,5 +1,5 @@ # Code table 5.40 - Type of compression -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/12/5.5.table b/definitions/grib2/tables/12/5.5.table index 3ef3eb070..f2316975a 100644 --- a/definitions/grib2/tables/12/5.5.table +++ b/definitions/grib2/tables/12/5.5.table @@ -1,7 +1,7 @@ # Code table 5.5 - Missing value management for complex packing -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/5.6.table b/definitions/grib2/tables/12/5.6.table index 6d5177877..db68ead9c 100644 --- a/definitions/grib2/tables/12/5.6.table +++ b/definitions/grib2/tables/12/5.6.table @@ -1,7 +1,7 @@ # Code table 5.6 - Order of spatial differencing -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/12/5.7.table b/definitions/grib2/tables/12/5.7.table index 5ab780056..e54862c19 100644 --- a/definitions/grib2/tables/12/5.7.table +++ b/definitions/grib2/tables/12/5.7.table @@ -1,7 +1,7 @@ # Code table 5.7 - Precision of floating-point numbers -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/12/6.0.table b/definitions/grib2/tables/12/6.0.table index f539b26d7..a8f30f5a4 100644 --- a/definitions/grib2/tables/12/6.0.table +++ b/definitions/grib2/tables/12/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator 0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/13/0.0.table b/definitions/grib2/tables/13/0.0.table index b24c50564..2c5afceb4 100644 --- a/definitions/grib2/tables/13/0.0.table +++ b/definitions/grib2/tables/13/0.0.table @@ -1,10 +1,10 @@ # Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/1.0.table b/definitions/grib2/tables/13/1.0.table index dfca4d4c1..b90cc628e 100644 --- a/definitions/grib2/tables/13/1.0.table +++ b/definitions/grib2/tables/13/1.0.table @@ -1,18 +1,18 @@ # Code table 1.0 - GRIB master tables version number -0 0 Experimental -1 1 Version implemented on 7 November 2001 -2 2 Version implemented on 4 November 2003 -3 3 Version implemented on 2 November 2005 -4 4 Version implemented on 7 November 2007 -5 5 Version implemented on 4 November 2009 -6 6 Version implemented on 15 September 2010 -7 7 Version implemented on 4 May 2011 -8 8 Version implemented on 2 November 2011 -9 9 Version implemented on 2 May 2012 +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 +6 6 Version implemented on 15 September 2010 +7 7 Version implemented on 4 May 2011 +8 8 Version implemented on 2 November 2011 +9 9 Version implemented on 2 May 2012 10 10 Version implemented on 7 November 2012 11 11 Version implemented on 8 May 2013 12 12 Version implemented on 14 November 2013 13 13 Version implemented on 7 May 2014 14 14 Pre-operational to be implemented by next amendment # 15-254 Future versions -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/13/1.1.table b/definitions/grib2/tables/13/1.1.table index d50f8fd72..f6d332005 100644 --- a/definitions/grib2/tables/13/1.1.table +++ b/definitions/grib2/tables/13/1.1.table @@ -1,4 +1,4 @@ # Code table 1.1 - GRIB local tables version number -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/13/1.2.table b/definitions/grib2/tables/13/1.2.table index 934b70455..638f1efbb 100644 --- a/definitions/grib2/tables/13/1.2.table +++ b/definitions/grib2/tables/13/1.2.table @@ -1,8 +1,8 @@ # Code table 1.2 - Significance of reference time -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/1.3.table b/definitions/grib2/tables/13/1.3.table index 9b37611b0..c3b924d9d 100644 --- a/definitions/grib2/tables/13/1.3.table +++ b/definitions/grib2/tables/13/1.3.table @@ -1,12 +1,12 @@ # Code table 1.3 - Production status of data -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products 4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) 5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) 6 6 S2S operational products 7 7 S2S test products -# 8-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/1.4.table b/definitions/grib2/tables/13/1.4.table index 03203d874..877288c0e 100644 --- a/definitions/grib2/tables/13/1.4.table +++ b/definitions/grib2/tables/13/1.4.table @@ -1,13 +1,13 @@ # Code table 1.4 - Type of data -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/13/1.5.table b/definitions/grib2/tables/13/1.5.table index b2cf9f087..533111959 100644 --- a/definitions/grib2/tables/13/1.5.table +++ b/definitions/grib2/tables/13/1.5.table @@ -1,7 +1,7 @@ # Code table 1.5 - Identification template number -0 0 Calendar definition -1 1 Paleontological offset -2 2 Calendar definition and paleontological offset -# 3-32767 Reserved -# 32768-65534 Reserved for local use -65535 65535 Missing +0 0 Calendar definition +1 1 Paleontological offset +2 2 Calendar definition and paleontological offset +# 3-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/13/1.6.table b/definitions/grib2/tables/13/1.6.table index 5db921990..bd46899a7 100644 --- a/definitions/grib2/tables/13/1.6.table +++ b/definitions/grib2/tables/13/1.6.table @@ -1,8 +1,8 @@ # Code table 1.6 - Type of calendar -0 0 Gregorian -1 1 360-day -2 2 365-day -3 3 Proleptic Gregorian -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Gregorian +1 1 360-day +2 2 365-day +3 3 Proleptic Gregorian +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/3.0.table b/definitions/grib2/tables/13/3.0.table index 45187b80d..a442a06a0 100644 --- a/definitions/grib2/tables/13/3.0.table +++ b/definitions/grib2/tables/13/3.0.table @@ -1,6 +1,6 @@ # Code table 3.0 - Source of grid definition -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/13/3.10.table b/definitions/grib2/tables/13/3.10.table index afa8843a7..1612d05e3 100644 --- a/definitions/grib2/tables/13/3.10.table +++ b/definitions/grib2/tables/13/3.10.table @@ -1,8 +1,8 @@ # Flag table 3.10 - Scanning mode for one diamond -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/13/3.11.table b/definitions/grib2/tables/13/3.11.table index e516a2ab9..06ae10810 100644 --- a/definitions/grib2/tables/13/3.11.table +++ b/definitions/grib2/tables/13/3.11.table @@ -1,7 +1,7 @@ # Code table 3.11 - Interpretation of list of numbers at end of section 3 -0 0 There is no appended list -1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows -2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row -3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) -# 4-254 Reserved -255 255 Missing +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/13/3.15.table b/definitions/grib2/tables/13/3.15.table index 331217ebe..6087902a3 100644 --- a/definitions/grib2/tables/13/3.15.table +++ b/definitions/grib2/tables/13/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/3.2.table b/definitions/grib2/tables/13/3.2.table index 9238dc2a7..b9574a424 100644 --- a/definitions/grib2/tables/13/3.2.table +++ b/definitions/grib2/tables/13/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame -9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/3.20.table b/definitions/grib2/tables/13/3.20.table index efbf08d19..e2bb156ee 100644 --- a/definitions/grib2/tables/13/3.20.table +++ b/definitions/grib2/tables/13/3.20.table @@ -1,6 +1,6 @@ # Code table 3.20 - Type of horizontal line -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/3.21.table b/definitions/grib2/tables/13/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/13/3.21.table +++ b/definitions/grib2/tables/13/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/3.3.table b/definitions/grib2/tables/13/3.3.table index 5dd7c7001..25cb46a1d 100644 --- a/definitions/grib2/tables/13/3.3.table +++ b/definitions/grib2/tables/13/3.3.table @@ -1,9 +1,9 @@ # Flag table 3.3 - Resolution and component flags -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/13/3.4.table b/definitions/grib2/tables/13/3.4.table index 63c8adaaa..ea9cbe829 100644 --- a/definitions/grib2/tables/13/3.4.table +++ b/definitions/grib2/tables/13/3.4.table @@ -1,10 +1,10 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -# 5-8 Reserved +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +# 5-8 Reserved diff --git a/definitions/grib2/tables/13/3.5.table b/definitions/grib2/tables/13/3.5.table index eabdde896..2f8ec82e3 100644 --- a/definitions/grib2/tables/13/3.5.table +++ b/definitions/grib2/tables/13/3.5.table @@ -1,5 +1,5 @@ # Flag table 3.5 - Projection centre -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/13/3.7.table b/definitions/grib2/tables/13/3.7.table index 0a7d6efde..34c0de085 100644 --- a/definitions/grib2/tables/13/3.7.table +++ b/definitions/grib2/tables/13/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 see separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/13/3.8.table b/definitions/grib2/tables/13/3.8.table index 844e74235..578fab37f 100644 --- a/definitions/grib2/tables/13/3.8.table +++ b/definitions/grib2/tables/13/3.8.table @@ -1,7 +1,7 @@ # Code table 3.8 - Grid point position -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/3.9.table b/definitions/grib2/tables/13/3.9.table index fd730bc64..ecd65514a 100644 --- a/definitions/grib2/tables/13/3.9.table +++ b/definitions/grib2/tables/13/3.9.table @@ -1,4 +1,4 @@ # Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/13/4.0.table b/definitions/grib2/tables/13/4.0.table index 89cf92c44..7627a2a3d 100644 --- a/definitions/grib2/tables/13/4.0.table +++ b/definitions/grib2/tables/13/4.0.table @@ -1,62 +1,62 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time -8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -# 35-39 Reserved +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data +# 35-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol -46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -# 49-50 Reserved -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time -52 52 Reserved -53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time -54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters -# 55-59 Reserved +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +# 49-50 Reserved +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +52 52 Reserved +53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time +54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters +# 55-59 Reserved 60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time 61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 62-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +# 62-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved -# 32768-65534 Reserved for local use +# 1102-32767 Reserved +# 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/13/4.1.0.table b/definitions/grib2/tables/13/4.1.0.table index 04cfd7802..df58636d6 100644 --- a/definitions/grib2/tables/13/4.1.0.table +++ b/definitions/grib2/tables/13/4.1.0.table @@ -1,27 +1,27 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.1.1.table b/definitions/grib2/tables/13/4.1.1.table index 7b22b6fed..05a854da0 100644 --- a/definitions/grib2/tables/13/4.1.1.table +++ b/definitions/grib2/tables/13/4.1.1.table @@ -1,7 +1,7 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.1.10.table b/definitions/grib2/tables/13/4.1.10.table index b97dcd355..e9663f391 100644 --- a/definitions/grib2/tables/13/4.1.10.table +++ b/definitions/grib2/tables/13/4.1.10.table @@ -1,10 +1,10 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Sub-surface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Sub-surface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.1.2.table b/definitions/grib2/tables/13/4.1.2.table index 5b488fe9e..e74126645 100644 --- a/definitions/grib2/tables/13/4.1.2.table +++ b/definitions/grib2/tables/13/4.1.2.table @@ -1,9 +1,9 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.1.3.table b/definitions/grib2/tables/13/4.1.3.table index 5096a166e..c1a1e267a 100644 --- a/definitions/grib2/tables/13/4.1.3.table +++ b/definitions/grib2/tables/13/4.1.3.table @@ -1,6 +1,6 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Image format products -1 1 Quantitative products -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.10.table b/definitions/grib2/tables/13/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/13/4.10.table +++ b/definitions/grib2/tables/13/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/13/4.11.table b/definitions/grib2/tables/13/4.11.table index 7f404c849..01cc81303 100644 --- a/definitions/grib2/tables/13/4.11.table +++ b/definitions/grib2/tables/13/4.11.table @@ -1,10 +1,10 @@ # Code table 4.11 - Type of time intervals -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.12.table b/definitions/grib2/tables/13/4.12.table index 03fd89b36..d42b47e96 100644 --- a/definitions/grib2/tables/13/4.12.table +++ b/definitions/grib2/tables/13/4.12.table @@ -1,7 +1,7 @@ # Code table 4.12 - Operating mode -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.13.table b/definitions/grib2/tables/13/4.13.table index c92854eec..a0e28eac8 100644 --- a/definitions/grib2/tables/13/4.13.table +++ b/definitions/grib2/tables/13/4.13.table @@ -1,6 +1,6 @@ # Code table 4.13 - Quality control indicator -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.14.table b/definitions/grib2/tables/13/4.14.table index a88cb93fa..d525b23b3 100644 --- a/definitions/grib2/tables/13/4.14.table +++ b/definitions/grib2/tables/13/4.14.table @@ -1,6 +1,6 @@ # Code table 4.14 - Clutter filter indicator -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.15.table b/definitions/grib2/tables/13/4.15.table index 2e5f3dea3..7adddedb6 100644 --- a/definitions/grib2/tables/13/4.15.table +++ b/definitions/grib2/tables/13/4.15.table @@ -1,11 +1,11 @@ # Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.0.table b/definitions/grib2/tables/13/4.2.0.0.table index 6de8a23c8..24d21959d 100644 --- a/definitions/grib2/tables/13/4.2.0.0.table +++ b/definitions/grib2/tables/13/4.2.0.0.table @@ -21,6 +21,6 @@ 19 19 Turbulent transfer coefficient for heat (Numeric) 20 20 Turbulent diffusion coefficient for heat (m2/s) 21 21 Apparent temperature (K) -# 22-191 Reserved +# 22-191 Reserved # 192-254 Reserved for local use -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.1.table b/definitions/grib2/tables/13/4.2.0.1.table index d1d1704df..fb7c3d776 100644 --- a/definitions/grib2/tables/13/4.2.0.1.table +++ b/definitions/grib2/tables/13/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,10 +86,10 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) -# 93-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 93-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.13.table b/definitions/grib2/tables/13/4.2.0.13.table index 5086101ad..3f5c30675 100644 --- a/definitions/grib2/tables/13/4.2.0.13.table +++ b/definitions/grib2/tables/13/4.2.0.13.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.14.table b/definitions/grib2/tables/13/4.2.0.14.table index 215884737..97fb38c8b 100644 --- a/definitions/grib2/tables/13/4.2.0.14.table +++ b/definitions/grib2/tables/13/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.15.table b/definitions/grib2/tables/13/4.2.0.15.table index d74fa7234..bb0b9ab46 100644 --- a/definitions/grib2/tables/13/4.2.0.15.table +++ b/definitions/grib2/tables/13/4.2.0.15.table @@ -14,6 +14,6 @@ 12 12 Reflectivity of rain (dB) 13 13 Reflectivity of graupel (dB) 14 14 Reflectivity of hail (dB) -# 15-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 15-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.16.table b/definitions/grib2/tables/13/4.2.0.16.table index 0c240a853..9499d9333 100644 --- a/definitions/grib2/tables/13/4.2.0.16.table +++ b/definitions/grib2/tables/13/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.18.table b/definitions/grib2/tables/13/4.2.0.18.table index 18c41aa48..7e0a736eb 100644 --- a/definitions/grib2/tables/13/4.2.0.18.table +++ b/definitions/grib2/tables/13/4.2.0.18.table @@ -8,11 +8,11 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) 13 13 Total deposition (wet + dry) (Bq m-2) -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.19.table b/definitions/grib2/tables/13/4.2.0.19.table index 75101bd37..d2beef083 100644 --- a/definitions/grib2/tables/13/4.2.0.19.table +++ b/definitions/grib2/tables/13/4.2.0.19.table @@ -27,6 +27,6 @@ 25 25 Weather (Code table 4.225) 26 26 Convective outlook (Code table 4.224) 27 27 Icing scenario (Code table 4.227) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.190.table b/definitions/grib2/tables/13/4.2.0.190.table index de621a924..a0d6ba0ac 100644 --- a/definitions/grib2/tables/13/4.2.0.190.table +++ b/definitions/grib2/tables/13/4.2.0.190.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.191.table b/definitions/grib2/tables/13/4.2.0.191.table index e3bba0ebe..b3a7092ea 100644 --- a/definitions/grib2/tables/13/4.2.0.191.table +++ b/definitions/grib2/tables/13/4.2.0.191.table @@ -3,6 +3,6 @@ 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.2.table b/definitions/grib2/tables/13/4.2.0.2.table index c83b07300..7bd1509f5 100644 --- a/definitions/grib2/tables/13/4.2.0.2.table +++ b/definitions/grib2/tables/13/4.2.0.2.table @@ -38,6 +38,6 @@ 36 36 Amplitude function for Rossby wave envelope for meridional wind (m/s) 37 37 Northward turbulent surface stress (N m-2 s) 38 38 Eastward turbulent surface stress (N m-2 s) -# 39-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 39-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.20.table b/definitions/grib2/tables/13/4.2.0.20.table index 9584f7c7f..df9ccc184 100644 --- a/definitions/grib2/tables/13/4.2.0.20.table +++ b/definitions/grib2/tables/13/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -25,7 +25,7 @@ 57 57 Total yearly average burden of the atmosphere (mol) 58 58 Total yearly averaged atmospheric loss (mol/s) 59 59 Aerosol number concentration (m-3) -# 60-99 Reserved +# 60-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -37,6 +37,6 @@ 108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) 109 109 Aerosol lidar extinction from satellite (/m) 110 110 Aerosol lidar extinction from the ground (/m) -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.3.table b/definitions/grib2/tables/13/4.2.0.3.table index 9a88e0027..e1a68bfc5 100644 --- a/definitions/grib2/tables/13/4.2.0.3.table +++ b/definitions/grib2/tables/13/4.2.0.3.table @@ -26,6 +26,6 @@ 24 24 Anisotropy of sub-gridscale orography (Numeric) 25 25 Natural logarithm of pressure in Pa (Numeric) 26 26 Exner pressure (Numeric) -# 27-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 27-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.4.table b/definitions/grib2/tables/13/4.2.0.4.table index dbfcbddb7..03b5cea38 100644 --- a/definitions/grib2/tables/13/4.2.0.4.table +++ b/definitions/grib2/tables/13/4.2.0.4.table @@ -12,9 +12,9 @@ 10 10 Photosynthetically active radiation (W m-2) 11 11 Net short-wave radiation flux, clear sky (W m-2) 12 12 Downward UV radiation (W m-2) -# 13-49 Reserved +# 13-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) -# 52-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.5.table b/definitions/grib2/tables/13/4.2.0.5.table index f1c04650d..1bdd6ebee 100644 --- a/definitions/grib2/tables/13/4.2.0.5.table +++ b/definitions/grib2/tables/13/4.2.0.5.table @@ -6,6 +6,6 @@ 4 4 Upward long-wave radiation flux (W m-2) 5 5 Net long-wave radiation flux (W m-2) 6 6 Net long-wave radiation flux, clear sky (W m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.6.table b/definitions/grib2/tables/13/4.2.0.6.table index 9ee97b73f..89da06eec 100644 --- a/definitions/grib2/tables/13/4.2.0.6.table +++ b/definitions/grib2/tables/13/4.2.0.6.table @@ -35,6 +35,6 @@ 33 33 Sunshine duration (s) 34 34 Surface long-wave effective total cloudiness (Numeric) 35 35 Surface short-wave effective total cloudiness (Numeric) -# 36-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 36-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.0.7.table b/definitions/grib2/tables/13/4.2.0.7.table index db47d0113..8a2b85fb9 100644 --- a/definitions/grib2/tables/13/4.2.0.7.table +++ b/definitions/grib2/tables/13/4.2.0.7.table @@ -13,8 +13,8 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraft helicity (m2 s-2) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.1.0.table b/definitions/grib2/tables/13/4.2.1.0.table index cf56b08ee..f455c3365 100644 --- a/definitions/grib2/tables/13/4.2.1.0.table +++ b/definitions/grib2/tables/13/4.2.1.0.table @@ -7,6 +7,6 @@ 5 5 Baseflow-groundwater runoff (kg m-2) 6 6 Storm surface runoff (kg m-2) 7 7 Discharge from rivers or streams (m3/s) -# 8-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.1.1.table b/definitions/grib2/tables/13/4.2.1.1.table index b488eb0bd..171da3958 100644 --- a/definitions/grib2/tables/13/4.2.1.1.table +++ b/definitions/grib2/tables/13/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.10.0.table b/definitions/grib2/tables/13/4.2.10.0.table index 095f51bdf..3611abd9a 100644 --- a/definitions/grib2/tables/13/4.2.10.0.table +++ b/definitions/grib2/tables/13/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea-surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (/s) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.10.1.table b/definitions/grib2/tables/13/4.2.10.1.table index 5959bfa28..f0a073c00 100644 --- a/definitions/grib2/tables/13/4.2.10.1.table +++ b/definitions/grib2/tables/13/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.10.191.table b/definitions/grib2/tables/13/4.2.10.191.table index dc0e23d7b..1ebf85006 100644 --- a/definitions/grib2/tables/13/4.2.10.191.table +++ b/definitions/grib2/tables/13/4.2.10.191.table @@ -3,6 +3,6 @@ 1 1 Meridional overturning stream function (m3/s) 2 2 Reserved 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.10.2.table b/definitions/grib2/tables/13/4.2.10.2.table index 157a9af65..0caeacba7 100644 --- a/definitions/grib2/tables/13/4.2.10.2.table +++ b/definitions/grib2/tables/13/4.2.10.2.table @@ -12,6 +12,6 @@ 10 10 Zonal vector component of vertically integrated ice internal pressure (Pa m) 11 11 Meridional vector component of vertically integrated ice internal pressure (Pa m) 12 12 Compressive ice strength (N/m) -# 13-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 13-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.10.3.table b/definitions/grib2/tables/13/4.2.10.3.table index f951bbe78..937720c93 100644 --- a/definitions/grib2/tables/13/4.2.10.3.table +++ b/definitions/grib2/tables/13/4.2.10.3.table @@ -1,6 +1,6 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.10.4.table b/definitions/grib2/tables/13/4.2.10.4.table index 54774f1b7..d5615ae26 100644 --- a/definitions/grib2/tables/13/4.2.10.4.table +++ b/definitions/grib2/tables/13/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2/s) 6 6 Ocean vertical momentum diffusivity (m2/s) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (/m) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.2.0.table b/definitions/grib2/tables/13/4.2.2.0.table index 93135b854..00342a32b 100644 --- a/definitions/grib2/tables/13/4.2.2.0.table +++ b/definitions/grib2/tables/13/4.2.2.0.table @@ -34,6 +34,6 @@ 32 32 Root depth of vegetation (m) 33 33 Water runoff and drainage (kg m-2) 34 34 Surface water runoff (kg m-2) -# 35-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 35-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.2.3.table b/definitions/grib2/tables/13/4.2.2.3.table index 2f6291077..3d3298c8a 100644 --- a/definitions/grib2/tables/13/4.2.2.3.table +++ b/definitions/grib2/tables/13/4.2.2.3.table @@ -22,6 +22,6 @@ 20 20 Column-integrated soil moisture (kg m-2) 21 21 Soil ice (kg m-3) 22 22 Column-integrated soil ice (kg m-2) -# 23-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 23-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.2.4.table b/definitions/grib2/tables/13/4.2.2.4.table index d4ede2f70..c8b877df6 100644 --- a/definitions/grib2/tables/13/4.2.2.4.table +++ b/definitions/grib2/tables/13/4.2.2.4.table @@ -4,6 +4,6 @@ 2 2 Haines Index (Numeric) 3 3 Fire burned area (%) 4 4 Fosberg index (Numeric) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.3.0.table b/definitions/grib2/tables/13/4.2.3.0.table index c0ffa29f5..80a829673 100644 --- a/definitions/grib2/tables/13/4.2.3.0.table +++ b/definitions/grib2/tables/13/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.2.3.1.table b/definitions/grib2/tables/13/4.2.3.1.table index 0c0fc8d37..bc16d8855 100644 --- a/definitions/grib2/tables/13/4.2.3.1.table +++ b/definitions/grib2/tables/13/4.2.3.1.table @@ -17,12 +17,12 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +23 23 Angstrom coefficient +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.201.table b/definitions/grib2/tables/13/4.201.table index 2510f2ef7..fa173c4e0 100644 --- a/definitions/grib2/tables/13/4.201.table +++ b/definitions/grib2/tables/13/4.201.table @@ -10,6 +10,6 @@ 8 8 Ice pellets 9 9 Graupel 10 10 Hail -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.202.table b/definitions/grib2/tables/13/4.202.table index 438502ff9..7f3c8f6cf 100644 --- a/definitions/grib2/tables/13/4.202.table +++ b/definitions/grib2/tables/13/4.202.table @@ -1,4 +1,4 @@ # Code table 4.202 - Precipitable water category -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.203.table b/definitions/grib2/tables/13/4.203.table index 8a9aedf7a..cf5eb6bdc 100644 --- a/definitions/grib2/tables/13/4.203.table +++ b/definitions/grib2/tables/13/4.203.table @@ -1,26 +1,26 @@ # Code table 4.203 - Cloud type -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.204.table b/definitions/grib2/tables/13/4.204.table index 91bcf1814..ffbd89502 100644 --- a/definitions/grib2/tables/13/4.204.table +++ b/definitions/grib2/tables/13/4.204.table @@ -1,9 +1,9 @@ # Code table 4.204 - Thunderstorm coverage -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (16-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (16-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.205.table b/definitions/grib2/tables/13/4.205.table index 5b4484dfd..c40c7f47b 100644 --- a/definitions/grib2/tables/13/4.205.table +++ b/definitions/grib2/tables/13/4.205.table @@ -1,6 +1,6 @@ # Code table 4.205 - Presence of aerosol -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.206.table b/definitions/grib2/tables/13/4.206.table index 02c3dfdf9..76472c261 100644 --- a/definitions/grib2/tables/13/4.206.table +++ b/definitions/grib2/tables/13/4.206.table @@ -1,6 +1,6 @@ # Code table 4.206 - Volcanic ash -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.207.table b/definitions/grib2/tables/13/4.207.table index 8ddb2e048..b6392fca0 100644 --- a/definitions/grib2/tables/13/4.207.table +++ b/definitions/grib2/tables/13/4.207.table @@ -1,10 +1,10 @@ # Code table 4.207 - Icing -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.208.table b/definitions/grib2/tables/13/4.208.table index b83685a1a..4361d38c0 100644 --- a/definitions/grib2/tables/13/4.208.table +++ b/definitions/grib2/tables/13/4.208.table @@ -1,9 +1,9 @@ # Code table 4.208 - Turbulence -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.209.table b/definitions/grib2/tables/13/4.209.table index cb7617071..39ea549ac 100644 --- a/definitions/grib2/tables/13/4.209.table +++ b/definitions/grib2/tables/13/4.209.table @@ -1,9 +1,9 @@ # Code table 4.209 - Planetary boundary-layer regime -0 0 Reserved -1 1 Stable -2 2 Mechanically driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.210.table b/definitions/grib2/tables/13/4.210.table index 524a6ca73..791878469 100644 --- a/definitions/grib2/tables/13/4.210.table +++ b/definitions/grib2/tables/13/4.210.table @@ -1,6 +1,6 @@ # Code table 4.210 - Contrail intensity -0 0 Contrail not present -1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.211.table b/definitions/grib2/tables/13/4.211.table index 098eb2d43..2a28a84d9 100644 --- a/definitions/grib2/tables/13/4.211.table +++ b/definitions/grib2/tables/13/4.211.table @@ -1,7 +1,7 @@ # Code table 4.211 - Contrail engine type -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.212.table b/definitions/grib2/tables/13/4.212.table index 1a085b88d..6a3dcf88c 100644 --- a/definitions/grib2/tables/13/4.212.table +++ b/definitions/grib2/tables/13/4.212.table @@ -1,18 +1,18 @@ # Code table 4.212 - Land use -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.213.table b/definitions/grib2/tables/13/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/13/4.213.table +++ b/definitions/grib2/tables/13/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.215.table b/definitions/grib2/tables/13/4.215.table index 88fda8b8c..c264c6722 100644 --- a/definitions/grib2/tables/13/4.215.table +++ b/definitions/grib2/tables/13/4.215.table @@ -1,9 +1,9 @@ # Code table 4.215 - Remotely-sensed snow coverage -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.216.table b/definitions/grib2/tables/13/4.216.table index 4d9a70f86..b51b358f4 100644 --- a/definitions/grib2/tables/13/4.216.table +++ b/definitions/grib2/tables/13/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain # 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/13/4.217.table b/definitions/grib2/tables/13/4.217.table index a4452182c..a700410d5 100644 --- a/definitions/grib2/tables/13/4.217.table +++ b/definitions/grib2/tables/13/4.217.table @@ -1,8 +1,8 @@ # Code table 4.217 - Cloud mask type -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.218.table b/definitions/grib2/tables/13/4.218.table index 6940a0e41..acf069c32 100644 --- a/definitions/grib2/tables/13/4.218.table +++ b/definitions/grib2/tables/13/4.218.table @@ -1,38 +1,38 @@ # Code table 4.218 - Pixel scene type -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation / crops -15 15 Permanent snow / ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -# 19-96 Reserved -97 97 Snow / ice on land -98 98 Snow / ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud / fog / Stratus -102 102 Low cloud / Stratocumulus -103 103 Low cloud / unknown type -104 104 Medium cloud / Nimbostratus -105 105 Medium cloud / Altostratus -106 106 Medium cloud / unknown type -107 107 High cloud / Cumulus -108 108 High cloud / Cirrus -109 109 High cloud / unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation / crops +15 15 Permanent snow / ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +# 19-96 Reserved +97 97 Snow / ice on land +98 98 Snow / ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud / fog / Stratus +102 102 Low cloud / Stratocumulus +103 103 Low cloud / unknown type +104 104 Medium cloud / Nimbostratus +105 105 Medium cloud / Altostratus +106 106 Medium cloud / unknown type +107 107 High cloud / Cumulus +108 108 High cloud / Cirrus +109 109 High cloud / unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.219.table b/definitions/grib2/tables/13/4.219.table index 86df0522e..9979f50ad 100644 --- a/definitions/grib2/tables/13/4.219.table +++ b/definitions/grib2/tables/13/4.219.table @@ -1,8 +1,8 @@ # Code table 4.219 - Cloud top height quality indicator -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.220.table b/definitions/grib2/tables/13/4.220.table index 93e841f8b..88e869e42 100644 --- a/definitions/grib2/tables/13/4.220.table +++ b/definitions/grib2/tables/13/4.220.table @@ -1,6 +1,6 @@ # Code table 4.220 - Horizontal dimension processed -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.221.table b/definitions/grib2/tables/13/4.221.table index 8448533d7..011cc3518 100644 --- a/definitions/grib2/tables/13/4.221.table +++ b/definitions/grib2/tables/13/4.221.table @@ -1,6 +1,6 @@ # Code table 4.221 - Treatment of missing data -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.222.table b/definitions/grib2/tables/13/4.222.table index 57f113014..558d947ac 100644 --- a/definitions/grib2/tables/13/4.222.table +++ b/definitions/grib2/tables/13/4.222.table @@ -1,6 +1,6 @@ # Code table 4.222 - Categorical result -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.223.table b/definitions/grib2/tables/13/4.223.table index f0deb076a..572c4e7a8 100644 --- a/definitions/grib2/tables/13/4.223.table +++ b/definitions/grib2/tables/13/4.223.table @@ -1,5 +1,5 @@ # Code table 4.223 - Fire detection indicator -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing diff --git a/definitions/grib2/tables/13/4.224.table b/definitions/grib2/tables/13/4.224.table index e87cde4bb..014f56e23 100644 --- a/definitions/grib2/tables/13/4.224.table +++ b/definitions/grib2/tables/13/4.224.table @@ -1,18 +1,18 @@ # Code table 4.224 - Categorical outlook -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/13/4.227.table b/definitions/grib2/tables/13/4.227.table index 27c76553d..48c3b7633 100644 --- a/definitions/grib2/tables/13/4.227.table +++ b/definitions/grib2/tables/13/4.227.table @@ -1,9 +1,9 @@ # Code table 4.227 - Icing scenario (weather/cloud classification) -0 0 None -1 1 General -2 2 Convective -3 3 Stratiform -4 4 Freezing -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 None +1 1 General +2 2 Convective +3 3 Stratiform +4 4 Freezing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/13/4.234.table b/definitions/grib2/tables/13/4.234.table index 9844a91d2..d8b3715b3 100644 --- a/definitions/grib2/tables/13/4.234.table +++ b/definitions/grib2/tables/13/4.234.table @@ -1,21 +1,21 @@ # Code table 4.234 - Canopy cover fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Crops, mixed farming -2 2 Short grass -3 3 Evergreen needleleaf trees -4 4 Deciduous needleleaf trees -5 5 Deciduous broadleaf trees -6 6 Evergreen broadleaf trees -7 7 Tall grass -8 8 Desert -9 9 Tundra -10 10 Irrigated crops -11 11 Semidesert -12 12 Ice caps and glaciers -13 13 Bogs and marshes -14 14 Inland water -15 15 Ocean -16 16 Evergreen shrubs -17 17 Deciduous shrubs -18 18 Mixed forest -19 19 Interrupted forest -20 20 Water and land mixtures +1 1 Crops, mixed farming +2 2 Short grass +3 3 Evergreen needleleaf trees +4 4 Deciduous needleleaf trees +5 5 Deciduous broadleaf trees +6 6 Evergreen broadleaf trees +7 7 Tall grass +8 8 Desert +9 9 Tundra +10 10 Irrigated crops +11 11 Semidesert +12 12 Ice caps and glaciers +13 13 Bogs and marshes +14 14 Inland water +15 15 Ocean +16 16 Evergreen shrubs +17 17 Deciduous shrubs +18 18 Mixed forest +19 19 Interrupted forest +20 20 Water and land mixtures diff --git a/definitions/grib2/tables/13/4.236.table b/definitions/grib2/tables/13/4.236.table index 08c7f8d56..b667b65fc 100644 --- a/definitions/grib2/tables/13/4.236.table +++ b/definitions/grib2/tables/13/4.236.table @@ -1,8 +1,8 @@ # Code table 4.236 - Soil texture fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Coarse -2 2 Medium -3 3 Medium-fine -4 4 Fine -5 5 Very-fine -6 6 Organic -7 7 Tropical-organic +1 1 Coarse +2 2 Medium +3 3 Medium-fine +4 4 Fine +5 5 Very-fine +6 6 Organic +7 7 Tropical-organic diff --git a/definitions/grib2/tables/13/4.3.table b/definitions/grib2/tables/13/4.3.table index 1a9d59dd1..2b775c807 100644 --- a/definitions/grib2/tables/13/4.3.table +++ b/definitions/grib2/tables/13/4.3.table @@ -1,18 +1,18 @@ # Code table 4.3 - Type of generating process -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast 12 12 Post-processed analysis 13 13 Post-processed forecast -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.4.table b/definitions/grib2/tables/13/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/13/4.4.table +++ b/definitions/grib2/tables/13/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.5.table b/definitions/grib2/tables/13/4.5.table index ddab1d723..d61b61c9f 100644 --- a/definitions/grib2/tables/13/4.5.table +++ b/definitions/grib2/tables/13/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface 2 2 Cloud base level 3 3 Level of cloud tops @@ -12,11 +12,11 @@ 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) 12 12 Cumulonimbus (CB) top (m) -# 13-19 Reserved +# 13-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -25,7 +25,7 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level 112 112 Reserved 113 113 Logarithmic hybrid level @@ -36,7 +36,7 @@ 119 hpl Hybrid pressure level # 120-149 Reserved 150 150 Generalized vertical height coordinate -# 151-159 Reserved +# 151-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom @@ -45,6 +45,6 @@ 165 165 Bottom of sediment layer penetrated by thermal wave 166 sfc Mixing layer 167 167 Bottom of root zone -# 168-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 168-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.6.table b/definitions/grib2/tables/13/4.6.table index b2dfeb498..ce799721d 100644 --- a/definitions/grib2/tables/13/4.6.table +++ b/definitions/grib2/tables/13/4.6.table @@ -1,9 +1,9 @@ # Code table 4.6 - Type of ensemble forecast -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.7.table b/definitions/grib2/tables/13/4.7.table index e0de0e1b2..69b2b4d77 100644 --- a/definitions/grib2/tables/13/4.7.table +++ b/definitions/grib2/tables/13/4.7.table @@ -1,14 +1,14 @@ # Code table 4.7 - Derived forecast -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.8.table b/definitions/grib2/tables/13/4.8.table index ad883039c..78467454a 100644 --- a/definitions/grib2/tables/13/4.8.table +++ b/definitions/grib2/tables/13/4.8.table @@ -1,6 +1,6 @@ # Code table 4.8 - Clustering method -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.9.table b/definitions/grib2/tables/13/4.9.table index 5878b5ad3..0ce312dd1 100644 --- a/definitions/grib2/tables/13/4.9.table +++ b/definitions/grib2/tables/13/4.9.table @@ -1,9 +1,9 @@ # Code table 4.9 - Probability type -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/4.91.table b/definitions/grib2/tables/13/4.91.table index 97b1c70ad..ae31ed61c 100644 --- a/definitions/grib2/tables/13/4.91.table +++ b/definitions/grib2/tables/13/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit 11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/13/5.1.table b/definitions/grib2/tables/13/5.1.table index 854330c74..1189b5e46 100644 --- a/definitions/grib2/tables/13/5.1.table +++ b/definitions/grib2/tables/13/5.1.table @@ -1,6 +1,6 @@ # Code table 5.1 - Type of original field values -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/5.2.table b/definitions/grib2/tables/13/5.2.table index 7a4500ecd..d12b46fbd 100644 --- a/definitions/grib2/tables/13/5.2.table +++ b/definitions/grib2/tables/13/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use +# 12-191 Reserved +# 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/13/5.3.table b/definitions/grib2/tables/13/5.3.table index c3b7b30fe..481331791 100644 --- a/definitions/grib2/tables/13/5.3.table +++ b/definitions/grib2/tables/13/5.3.table @@ -1,7 +1,7 @@ # Code table 5.3 - Matrix coordinate parameter -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/5.4.table b/definitions/grib2/tables/13/5.4.table index 8121c1819..e84ab1901 100644 --- a/definitions/grib2/tables/13/5.4.table +++ b/definitions/grib2/tables/13/5.4.table @@ -1,6 +1,6 @@ # Code table 5.4 - Group splitting method -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/5.40.table b/definitions/grib2/tables/13/5.40.table index b9bad2c39..97e8880ab 100644 --- a/definitions/grib2/tables/13/5.40.table +++ b/definitions/grib2/tables/13/5.40.table @@ -1,5 +1,5 @@ # Code table 5.40 - Type of compression -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/13/5.5.table b/definitions/grib2/tables/13/5.5.table index 3ef3eb070..f2316975a 100644 --- a/definitions/grib2/tables/13/5.5.table +++ b/definitions/grib2/tables/13/5.5.table @@ -1,7 +1,7 @@ # Code table 5.5 - Missing value management for complex packing -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/5.6.table b/definitions/grib2/tables/13/5.6.table index 6d5177877..db68ead9c 100644 --- a/definitions/grib2/tables/13/5.6.table +++ b/definitions/grib2/tables/13/5.6.table @@ -1,7 +1,7 @@ # Code table 5.6 - Order of spatial differencing -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/13/5.7.table b/definitions/grib2/tables/13/5.7.table index 5ab780056..e54862c19 100644 --- a/definitions/grib2/tables/13/5.7.table +++ b/definitions/grib2/tables/13/5.7.table @@ -1,7 +1,7 @@ # Code table 5.7 - Precision of floating-point numbers -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/13/6.0.table b/definitions/grib2/tables/13/6.0.table index f539b26d7..a8f30f5a4 100644 --- a/definitions/grib2/tables/13/6.0.table +++ b/definitions/grib2/tables/13/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator 0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/14/0.0.table b/definitions/grib2/tables/14/0.0.table index b24c50564..2c5afceb4 100644 --- a/definitions/grib2/tables/14/0.0.table +++ b/definitions/grib2/tables/14/0.0.table @@ -1,10 +1,10 @@ # Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/1.0.table b/definitions/grib2/tables/14/1.0.table index 4dafc79fb..a004eadb3 100644 --- a/definitions/grib2/tables/14/1.0.table +++ b/definitions/grib2/tables/14/1.0.table @@ -1,19 +1,19 @@ # Code table 1.0 - GRIB master tables version number -0 0 Experimental -1 1 Version implemented on 7 November 2001 -2 2 Version implemented on 4 November 2003 -3 3 Version implemented on 2 November 2005 -4 4 Version implemented on 7 November 2007 -5 5 Version implemented on 4 November 2009 -6 6 Version implemented on 15 September 2010 -7 7 Version implemented on 4 May 2011 -8 8 Version implemented on 2 November 2011 -9 9 Version implemented on 2 May 2012 -10 10 Version implemented on 7 November 2012 -11 11 Version implemented on 8 May 2013 -12 12 Version implemented on 14 November 2013 -13 13 Version implemented on 7 May 2014 -14 14 Version implemented on 5 November 2014 -15 15 Pre-operational to be implemented by next amendment -# 16-254 Future versions -255 255 Missing +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 +6 6 Version implemented on 15 September 2010 +7 7 Version implemented on 4 May 2011 +8 8 Version implemented on 2 November 2011 +9 9 Version implemented on 2 May 2012 +10 10 Version implemented on 7 November 2012 +11 11 Version implemented on 8 May 2013 +12 12 Version implemented on 14 November 2013 +13 13 Version implemented on 7 May 2014 +14 14 Version implemented on 5 November 2014 +15 15 Pre-operational to be implemented by next amendment +# 16-254 Future versions +255 255 Missing diff --git a/definitions/grib2/tables/14/1.1.table b/definitions/grib2/tables/14/1.1.table index d50f8fd72..f6d332005 100644 --- a/definitions/grib2/tables/14/1.1.table +++ b/definitions/grib2/tables/14/1.1.table @@ -1,4 +1,4 @@ # Code table 1.1 - GRIB local tables version number -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/14/1.2.table b/definitions/grib2/tables/14/1.2.table index 934b70455..638f1efbb 100644 --- a/definitions/grib2/tables/14/1.2.table +++ b/definitions/grib2/tables/14/1.2.table @@ -1,8 +1,8 @@ # Code table 1.2 - Significance of reference time -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/1.3.table b/definitions/grib2/tables/14/1.3.table index ea01c001c..eb3a79f9b 100644 --- a/definitions/grib2/tables/14/1.3.table +++ b/definitions/grib2/tables/14/1.3.table @@ -1,14 +1,14 @@ # Code table 1.3 - Production status of data -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products 4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) 5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) 6 6 S2S operational products 7 7 S2S test products 8 8 Uncertainties in ensembles of regional re-analysis project (UERRA) 9 9 Uncertainties in ensembles of regional re-analysis project test (UERRA) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/1.4.table b/definitions/grib2/tables/14/1.4.table index 03203d874..877288c0e 100644 --- a/definitions/grib2/tables/14/1.4.table +++ b/definitions/grib2/tables/14/1.4.table @@ -1,13 +1,13 @@ # Code table 1.4 - Type of data -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/14/1.5.table b/definitions/grib2/tables/14/1.5.table index b2cf9f087..533111959 100644 --- a/definitions/grib2/tables/14/1.5.table +++ b/definitions/grib2/tables/14/1.5.table @@ -1,7 +1,7 @@ # Code table 1.5 - Identification template number -0 0 Calendar definition -1 1 Paleontological offset -2 2 Calendar definition and paleontological offset -# 3-32767 Reserved -# 32768-65534 Reserved for local use -65535 65535 Missing +0 0 Calendar definition +1 1 Paleontological offset +2 2 Calendar definition and paleontological offset +# 3-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/14/1.6.table b/definitions/grib2/tables/14/1.6.table index 5db921990..bd46899a7 100644 --- a/definitions/grib2/tables/14/1.6.table +++ b/definitions/grib2/tables/14/1.6.table @@ -1,8 +1,8 @@ # Code table 1.6 - Type of calendar -0 0 Gregorian -1 1 360-day -2 2 365-day -3 3 Proleptic Gregorian -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Gregorian +1 1 360-day +2 2 365-day +3 3 Proleptic Gregorian +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/3.0.table b/definitions/grib2/tables/14/3.0.table index 45187b80d..a442a06a0 100644 --- a/definitions/grib2/tables/14/3.0.table +++ b/definitions/grib2/tables/14/3.0.table @@ -1,6 +1,6 @@ # Code table 3.0 - Source of grid definition -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/14/3.10.table b/definitions/grib2/tables/14/3.10.table index afa8843a7..1612d05e3 100644 --- a/definitions/grib2/tables/14/3.10.table +++ b/definitions/grib2/tables/14/3.10.table @@ -1,8 +1,8 @@ # Flag table 3.10 - Scanning mode for one diamond -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/14/3.11.table b/definitions/grib2/tables/14/3.11.table index e516a2ab9..06ae10810 100644 --- a/definitions/grib2/tables/14/3.11.table +++ b/definitions/grib2/tables/14/3.11.table @@ -1,7 +1,7 @@ # Code table 3.11 - Interpretation of list of numbers at end of section 3 -0 0 There is no appended list -1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows -2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row -3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) -# 4-254 Reserved -255 255 Missing +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/14/3.15.table b/definitions/grib2/tables/14/3.15.table index 331217ebe..6087902a3 100644 --- a/definitions/grib2/tables/14/3.15.table +++ b/definitions/grib2/tables/14/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/3.2.table b/definitions/grib2/tables/14/3.2.table index 9238dc2a7..b9574a424 100644 --- a/definitions/grib2/tables/14/3.2.table +++ b/definitions/grib2/tables/14/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame -9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/3.20.table b/definitions/grib2/tables/14/3.20.table index efbf08d19..e2bb156ee 100644 --- a/definitions/grib2/tables/14/3.20.table +++ b/definitions/grib2/tables/14/3.20.table @@ -1,6 +1,6 @@ # Code table 3.20 - Type of horizontal line -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/3.21.table b/definitions/grib2/tables/14/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/14/3.21.table +++ b/definitions/grib2/tables/14/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/3.3.table b/definitions/grib2/tables/14/3.3.table index 5dd7c7001..25cb46a1d 100644 --- a/definitions/grib2/tables/14/3.3.table +++ b/definitions/grib2/tables/14/3.3.table @@ -1,9 +1,9 @@ # Flag table 3.3 - Resolution and component flags -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/14/3.4.table b/definitions/grib2/tables/14/3.4.table index 897b813d7..43835c014 100644 --- a/definitions/grib2/tables/14/3.4.table +++ b/definitions/grib2/tables/14/3.4.table @@ -1,17 +1,17 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -5 0 Points within odd rows are not offset in i (x) direction -5 1 Points within odd rows are offset by Di/2 in i (x) direction -6 0 Points within even rows are not offset in i (x) direction -6 1 Points within even rows are offset by Di/2 in i (x) direction -7 0 Points are not offset in j (y) direction -7 1 Points are offset by Dj/2 in j (y) direction -8 0 Rows have Ni grid points and columns have Nj grid points -8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +5 0 Points within odd rows are not offset in i (x) direction +5 1 Points within odd rows are offset by Di/2 in i (x) direction +6 0 Points within even rows are not offset in i (x) direction +6 1 Points within even rows are offset by Di/2 in i (x) direction +7 0 Points are not offset in j (y) direction +7 1 Points are offset by Dj/2 in j (y) direction +8 0 Rows have Ni grid points and columns have Nj grid points +8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction diff --git a/definitions/grib2/tables/14/3.5.table b/definitions/grib2/tables/14/3.5.table index eabdde896..2f8ec82e3 100644 --- a/definitions/grib2/tables/14/3.5.table +++ b/definitions/grib2/tables/14/3.5.table @@ -1,5 +1,5 @@ # Flag table 3.5 - Projection centre -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/14/3.7.table b/definitions/grib2/tables/14/3.7.table index 0a7d6efde..34c0de085 100644 --- a/definitions/grib2/tables/14/3.7.table +++ b/definitions/grib2/tables/14/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 see separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/14/3.8.table b/definitions/grib2/tables/14/3.8.table index 844e74235..578fab37f 100644 --- a/definitions/grib2/tables/14/3.8.table +++ b/definitions/grib2/tables/14/3.8.table @@ -1,7 +1,7 @@ # Code table 3.8 - Grid point position -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/3.9.table b/definitions/grib2/tables/14/3.9.table index fd730bc64..ecd65514a 100644 --- a/definitions/grib2/tables/14/3.9.table +++ b/definitions/grib2/tables/14/3.9.table @@ -1,4 +1,4 @@ # Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/14/4.0.table b/definitions/grib2/tables/14/4.0.table index b24b6fb11..7627a2a3d 100644 --- a/definitions/grib2/tables/14/4.0.table +++ b/definitions/grib2/tables/14/4.0.table @@ -1,62 +1,62 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time -8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -# 35-39 Reserved +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data +# 35-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol -46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -# 49-50 Reserved -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time -52 52 Reserved -53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time -54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters -# 55-59 Reserved -60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +# 49-50 Reserved +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +52 52 Reserved +53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time +54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters +# 55-59 Reserved +60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time 61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 62-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +# 62-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved -# 32768-65534 Reserved for local use +# 1102-32767 Reserved +# 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/14/4.1.0.table b/definitions/grib2/tables/14/4.1.0.table index 04cfd7802..df58636d6 100644 --- a/definitions/grib2/tables/14/4.1.0.table +++ b/definitions/grib2/tables/14/4.1.0.table @@ -1,27 +1,27 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.1.1.table b/definitions/grib2/tables/14/4.1.1.table index 7b22b6fed..05a854da0 100644 --- a/definitions/grib2/tables/14/4.1.1.table +++ b/definitions/grib2/tables/14/4.1.1.table @@ -1,7 +1,7 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.1.10.table b/definitions/grib2/tables/14/4.1.10.table index b97dcd355..e9663f391 100644 --- a/definitions/grib2/tables/14/4.1.10.table +++ b/definitions/grib2/tables/14/4.1.10.table @@ -1,10 +1,10 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Sub-surface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Sub-surface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.1.2.table b/definitions/grib2/tables/14/4.1.2.table index 5b488fe9e..e74126645 100644 --- a/definitions/grib2/tables/14/4.1.2.table +++ b/definitions/grib2/tables/14/4.1.2.table @@ -1,9 +1,9 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.1.3.table b/definitions/grib2/tables/14/4.1.3.table index 5096a166e..c1a1e267a 100644 --- a/definitions/grib2/tables/14/4.1.3.table +++ b/definitions/grib2/tables/14/4.1.3.table @@ -1,6 +1,6 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Image format products -1 1 Quantitative products -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.10.table b/definitions/grib2/tables/14/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/14/4.10.table +++ b/definitions/grib2/tables/14/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/14/4.11.table b/definitions/grib2/tables/14/4.11.table index 7f404c849..01cc81303 100644 --- a/definitions/grib2/tables/14/4.11.table +++ b/definitions/grib2/tables/14/4.11.table @@ -1,10 +1,10 @@ # Code table 4.11 - Type of time intervals -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.12.table b/definitions/grib2/tables/14/4.12.table index 03fd89b36..d42b47e96 100644 --- a/definitions/grib2/tables/14/4.12.table +++ b/definitions/grib2/tables/14/4.12.table @@ -1,7 +1,7 @@ # Code table 4.12 - Operating mode -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.13.table b/definitions/grib2/tables/14/4.13.table index c92854eec..a0e28eac8 100644 --- a/definitions/grib2/tables/14/4.13.table +++ b/definitions/grib2/tables/14/4.13.table @@ -1,6 +1,6 @@ # Code table 4.13 - Quality control indicator -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.14.table b/definitions/grib2/tables/14/4.14.table index a88cb93fa..d525b23b3 100644 --- a/definitions/grib2/tables/14/4.14.table +++ b/definitions/grib2/tables/14/4.14.table @@ -1,6 +1,6 @@ # Code table 4.14 - Clutter filter indicator -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.15.table b/definitions/grib2/tables/14/4.15.table index 2e5f3dea3..7adddedb6 100644 --- a/definitions/grib2/tables/14/4.15.table +++ b/definitions/grib2/tables/14/4.15.table @@ -1,11 +1,11 @@ # Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.0.table b/definitions/grib2/tables/14/4.2.0.0.table index 41e5291a9..24d21959d 100644 --- a/definitions/grib2/tables/14/4.2.0.0.table +++ b/definitions/grib2/tables/14/4.2.0.0.table @@ -21,6 +21,6 @@ 19 19 Turbulent transfer coefficient for heat (Numeric) 20 20 Turbulent diffusion coefficient for heat (m2/s) 21 21 Apparent temperature (K) -# 22-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 22-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.1.table b/definitions/grib2/tables/14/4.2.0.1.table index 4c624e74a..bd0214c77 100644 --- a/definitions/grib2/tables/14/4.2.0.1.table +++ b/definitions/grib2/tables/14/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,12 +86,12 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) 93 93 Relative humidity with respect to water (%) 94 94 Relative humidity with respect to ice (%) -# 95-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 95-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.13.table b/definitions/grib2/tables/14/4.2.0.13.table index 5086101ad..3f5c30675 100644 --- a/definitions/grib2/tables/14/4.2.0.13.table +++ b/definitions/grib2/tables/14/4.2.0.13.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.14.table b/definitions/grib2/tables/14/4.2.0.14.table index 215884737..97fb38c8b 100644 --- a/definitions/grib2/tables/14/4.2.0.14.table +++ b/definitions/grib2/tables/14/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.15.table b/definitions/grib2/tables/14/4.2.0.15.table index d74fa7234..bb0b9ab46 100644 --- a/definitions/grib2/tables/14/4.2.0.15.table +++ b/definitions/grib2/tables/14/4.2.0.15.table @@ -14,6 +14,6 @@ 12 12 Reflectivity of rain (dB) 13 13 Reflectivity of graupel (dB) 14 14 Reflectivity of hail (dB) -# 15-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 15-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.16.table b/definitions/grib2/tables/14/4.2.0.16.table index 0c240a853..9499d9333 100644 --- a/definitions/grib2/tables/14/4.2.0.16.table +++ b/definitions/grib2/tables/14/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.18.table b/definitions/grib2/tables/14/4.2.0.18.table index 18c41aa48..7e0a736eb 100644 --- a/definitions/grib2/tables/14/4.2.0.18.table +++ b/definitions/grib2/tables/14/4.2.0.18.table @@ -8,11 +8,11 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) 13 13 Total deposition (wet + dry) (Bq m-2) -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.19.table b/definitions/grib2/tables/14/4.2.0.19.table index 75101bd37..d2beef083 100644 --- a/definitions/grib2/tables/14/4.2.0.19.table +++ b/definitions/grib2/tables/14/4.2.0.19.table @@ -27,6 +27,6 @@ 25 25 Weather (Code table 4.225) 26 26 Convective outlook (Code table 4.224) 27 27 Icing scenario (Code table 4.227) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.190.table b/definitions/grib2/tables/14/4.2.0.190.table index de621a924..a0d6ba0ac 100644 --- a/definitions/grib2/tables/14/4.2.0.190.table +++ b/definitions/grib2/tables/14/4.2.0.190.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.191.table b/definitions/grib2/tables/14/4.2.0.191.table index e3bba0ebe..b3a7092ea 100644 --- a/definitions/grib2/tables/14/4.2.0.191.table +++ b/definitions/grib2/tables/14/4.2.0.191.table @@ -3,6 +3,6 @@ 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.2.table b/definitions/grib2/tables/14/4.2.0.2.table index c83b07300..7bd1509f5 100644 --- a/definitions/grib2/tables/14/4.2.0.2.table +++ b/definitions/grib2/tables/14/4.2.0.2.table @@ -38,6 +38,6 @@ 36 36 Amplitude function for Rossby wave envelope for meridional wind (m/s) 37 37 Northward turbulent surface stress (N m-2 s) 38 38 Eastward turbulent surface stress (N m-2 s) -# 39-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 39-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.20.table b/definitions/grib2/tables/14/4.2.0.20.table index 9584f7c7f..df9ccc184 100644 --- a/definitions/grib2/tables/14/4.2.0.20.table +++ b/definitions/grib2/tables/14/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -25,7 +25,7 @@ 57 57 Total yearly average burden of the atmosphere (mol) 58 58 Total yearly averaged atmospheric loss (mol/s) 59 59 Aerosol number concentration (m-3) -# 60-99 Reserved +# 60-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -37,6 +37,6 @@ 108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) 109 109 Aerosol lidar extinction from satellite (/m) 110 110 Aerosol lidar extinction from the ground (/m) -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.3.table b/definitions/grib2/tables/14/4.2.0.3.table index 9a88e0027..e1a68bfc5 100644 --- a/definitions/grib2/tables/14/4.2.0.3.table +++ b/definitions/grib2/tables/14/4.2.0.3.table @@ -26,6 +26,6 @@ 24 24 Anisotropy of sub-gridscale orography (Numeric) 25 25 Natural logarithm of pressure in Pa (Numeric) 26 26 Exner pressure (Numeric) -# 27-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 27-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.4.table b/definitions/grib2/tables/14/4.2.0.4.table index dbfcbddb7..03b5cea38 100644 --- a/definitions/grib2/tables/14/4.2.0.4.table +++ b/definitions/grib2/tables/14/4.2.0.4.table @@ -12,9 +12,9 @@ 10 10 Photosynthetically active radiation (W m-2) 11 11 Net short-wave radiation flux, clear sky (W m-2) 12 12 Downward UV radiation (W m-2) -# 13-49 Reserved +# 13-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) -# 52-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.5.table b/definitions/grib2/tables/14/4.2.0.5.table index f1c04650d..1bdd6ebee 100644 --- a/definitions/grib2/tables/14/4.2.0.5.table +++ b/definitions/grib2/tables/14/4.2.0.5.table @@ -6,6 +6,6 @@ 4 4 Upward long-wave radiation flux (W m-2) 5 5 Net long-wave radiation flux (W m-2) 6 6 Net long-wave radiation flux, clear sky (W m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.6.table b/definitions/grib2/tables/14/4.2.0.6.table index 702152741..427240b70 100644 --- a/definitions/grib2/tables/14/4.2.0.6.table +++ b/definitions/grib2/tables/14/4.2.0.6.table @@ -37,6 +37,6 @@ 35 35 Surface short-wave effective total cloudiness (Numeric) 36 36 Fraction of stratiform precipitation cover (Proportion) 37 37 Fraction of convective precipitation cover (Proportion) -# 38-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 38-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.0.7.table b/definitions/grib2/tables/14/4.2.0.7.table index db47d0113..8a2b85fb9 100644 --- a/definitions/grib2/tables/14/4.2.0.7.table +++ b/definitions/grib2/tables/14/4.2.0.7.table @@ -13,8 +13,8 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraft helicity (m2 s-2) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.1.0.table b/definitions/grib2/tables/14/4.2.1.0.table index cf56b08ee..f455c3365 100644 --- a/definitions/grib2/tables/14/4.2.1.0.table +++ b/definitions/grib2/tables/14/4.2.1.0.table @@ -7,6 +7,6 @@ 5 5 Baseflow-groundwater runoff (kg m-2) 6 6 Storm surface runoff (kg m-2) 7 7 Discharge from rivers or streams (m3/s) -# 8-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.1.1.table b/definitions/grib2/tables/14/4.2.1.1.table index b488eb0bd..171da3958 100644 --- a/definitions/grib2/tables/14/4.2.1.1.table +++ b/definitions/grib2/tables/14/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.10.0.table b/definitions/grib2/tables/14/4.2.10.0.table index 095f51bdf..3611abd9a 100644 --- a/definitions/grib2/tables/14/4.2.10.0.table +++ b/definitions/grib2/tables/14/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea-surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (/s) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.10.1.table b/definitions/grib2/tables/14/4.2.10.1.table index 5959bfa28..f0a073c00 100644 --- a/definitions/grib2/tables/14/4.2.10.1.table +++ b/definitions/grib2/tables/14/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.10.191.table b/definitions/grib2/tables/14/4.2.10.191.table index 524929e78..1ebf85006 100644 --- a/definitions/grib2/tables/14/4.2.10.191.table +++ b/definitions/grib2/tables/14/4.2.10.191.table @@ -1,8 +1,8 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -2 2 Reserved +2 2 Reserved 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.10.2.table b/definitions/grib2/tables/14/4.2.10.2.table index 6797062ac..4633bad4f 100644 --- a/definitions/grib2/tables/14/4.2.10.2.table +++ b/definitions/grib2/tables/14/4.2.10.2.table @@ -12,6 +12,6 @@ 10 10 Zonal vector component of vertically integrated ice internal pressure (Pa m) 11 11 Meridional vector component of vertically integrated ice internal pressure (Pa m) 12 12 Compressive ice strength (N/m) -# 13-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 13-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.10.3.table b/definitions/grib2/tables/14/4.2.10.3.table index f951bbe78..937720c93 100644 --- a/definitions/grib2/tables/14/4.2.10.3.table +++ b/definitions/grib2/tables/14/4.2.10.3.table @@ -1,6 +1,6 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.10.4.table b/definitions/grib2/tables/14/4.2.10.4.table index 54774f1b7..d5615ae26 100644 --- a/definitions/grib2/tables/14/4.2.10.4.table +++ b/definitions/grib2/tables/14/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2/s) 6 6 Ocean vertical momentum diffusivity (m2/s) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (/m) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.2.0.table b/definitions/grib2/tables/14/4.2.2.0.table index 1853aa0fc..d61dd05fc 100644 --- a/definitions/grib2/tables/14/4.2.2.0.table +++ b/definitions/grib2/tables/14/4.2.2.0.table @@ -37,6 +37,6 @@ 35 35 Tile class (Code table 4.243) 36 36 Tile fraction (Proportion) 37 37 Tile percentage (%) -# 38-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 38-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.2.3.table b/definitions/grib2/tables/14/4.2.2.3.table index 2f6291077..3d3298c8a 100644 --- a/definitions/grib2/tables/14/4.2.2.3.table +++ b/definitions/grib2/tables/14/4.2.2.3.table @@ -22,6 +22,6 @@ 20 20 Column-integrated soil moisture (kg m-2) 21 21 Soil ice (kg m-3) 22 22 Column-integrated soil ice (kg m-2) -# 23-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 23-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.2.4.table b/definitions/grib2/tables/14/4.2.2.4.table index d4ede2f70..c8b877df6 100644 --- a/definitions/grib2/tables/14/4.2.2.4.table +++ b/definitions/grib2/tables/14/4.2.2.4.table @@ -4,6 +4,6 @@ 2 2 Haines Index (Numeric) 3 3 Fire burned area (%) 4 4 Fosberg index (Numeric) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.3.0.table b/definitions/grib2/tables/14/4.2.3.0.table index c0ffa29f5..80a829673 100644 --- a/definitions/grib2/tables/14/4.2.3.0.table +++ b/definitions/grib2/tables/14/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.2.3.1.table b/definitions/grib2/tables/14/4.2.3.1.table index 0c0fc8d37..bc16d8855 100644 --- a/definitions/grib2/tables/14/4.2.3.1.table +++ b/definitions/grib2/tables/14/4.2.3.1.table @@ -17,12 +17,12 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +23 23 Angstrom coefficient +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.201.table b/definitions/grib2/tables/14/4.201.table index 47f1b486f..fa173c4e0 100644 --- a/definitions/grib2/tables/14/4.201.table +++ b/definitions/grib2/tables/14/4.201.table @@ -1,15 +1,15 @@ # Code table 4.201 - Precipitation type -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow -6 6 Wet snow -7 7 Mixture of rain and snow -8 8 Ice pellets -9 9 Graupel -10 10 Hail -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +6 6 Wet snow +7 7 Mixture of rain and snow +8 8 Ice pellets +9 9 Graupel +10 10 Hail +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.202.table b/definitions/grib2/tables/14/4.202.table index 438502ff9..7f3c8f6cf 100644 --- a/definitions/grib2/tables/14/4.202.table +++ b/definitions/grib2/tables/14/4.202.table @@ -1,4 +1,4 @@ # Code table 4.202 - Precipitable water category -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.203.table b/definitions/grib2/tables/14/4.203.table index 8a9aedf7a..cf5eb6bdc 100644 --- a/definitions/grib2/tables/14/4.203.table +++ b/definitions/grib2/tables/14/4.203.table @@ -1,26 +1,26 @@ # Code table 4.203 - Cloud type -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.204.table b/definitions/grib2/tables/14/4.204.table index 91bcf1814..ffbd89502 100644 --- a/definitions/grib2/tables/14/4.204.table +++ b/definitions/grib2/tables/14/4.204.table @@ -1,9 +1,9 @@ # Code table 4.204 - Thunderstorm coverage -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (16-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (16-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.205.table b/definitions/grib2/tables/14/4.205.table index 5b4484dfd..c40c7f47b 100644 --- a/definitions/grib2/tables/14/4.205.table +++ b/definitions/grib2/tables/14/4.205.table @@ -1,6 +1,6 @@ # Code table 4.205 - Presence of aerosol -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.206.table b/definitions/grib2/tables/14/4.206.table index 02c3dfdf9..76472c261 100644 --- a/definitions/grib2/tables/14/4.206.table +++ b/definitions/grib2/tables/14/4.206.table @@ -1,6 +1,6 @@ # Code table 4.206 - Volcanic ash -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.207.table b/definitions/grib2/tables/14/4.207.table index 8ddb2e048..b6392fca0 100644 --- a/definitions/grib2/tables/14/4.207.table +++ b/definitions/grib2/tables/14/4.207.table @@ -1,10 +1,10 @@ # Code table 4.207 - Icing -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.208.table b/definitions/grib2/tables/14/4.208.table index b83685a1a..4361d38c0 100644 --- a/definitions/grib2/tables/14/4.208.table +++ b/definitions/grib2/tables/14/4.208.table @@ -1,9 +1,9 @@ # Code table 4.208 - Turbulence -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.209.table b/definitions/grib2/tables/14/4.209.table index cb7617071..39ea549ac 100644 --- a/definitions/grib2/tables/14/4.209.table +++ b/definitions/grib2/tables/14/4.209.table @@ -1,9 +1,9 @@ # Code table 4.209 - Planetary boundary-layer regime -0 0 Reserved -1 1 Stable -2 2 Mechanically driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.210.table b/definitions/grib2/tables/14/4.210.table index 524a6ca73..791878469 100644 --- a/definitions/grib2/tables/14/4.210.table +++ b/definitions/grib2/tables/14/4.210.table @@ -1,6 +1,6 @@ # Code table 4.210 - Contrail intensity -0 0 Contrail not present -1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.211.table b/definitions/grib2/tables/14/4.211.table index 098eb2d43..2a28a84d9 100644 --- a/definitions/grib2/tables/14/4.211.table +++ b/definitions/grib2/tables/14/4.211.table @@ -1,7 +1,7 @@ # Code table 4.211 - Contrail engine type -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.212.table b/definitions/grib2/tables/14/4.212.table index 1a085b88d..6a3dcf88c 100644 --- a/definitions/grib2/tables/14/4.212.table +++ b/definitions/grib2/tables/14/4.212.table @@ -1,18 +1,18 @@ # Code table 4.212 - Land use -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.213.table b/definitions/grib2/tables/14/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/14/4.213.table +++ b/definitions/grib2/tables/14/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.215.table b/definitions/grib2/tables/14/4.215.table index 88fda8b8c..c264c6722 100644 --- a/definitions/grib2/tables/14/4.215.table +++ b/definitions/grib2/tables/14/4.215.table @@ -1,9 +1,9 @@ # Code table 4.215 - Remotely-sensed snow coverage -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.216.table b/definitions/grib2/tables/14/4.216.table index 5d1460cef..b51b358f4 100644 --- a/definitions/grib2/tables/14/4.216.table +++ b/definitions/grib2/tables/14/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain -# 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 0-90 Elevation in increments of 100 m +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/14/4.217.table b/definitions/grib2/tables/14/4.217.table index a4452182c..a700410d5 100644 --- a/definitions/grib2/tables/14/4.217.table +++ b/definitions/grib2/tables/14/4.217.table @@ -1,8 +1,8 @@ # Code table 4.217 - Cloud mask type -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.218.table b/definitions/grib2/tables/14/4.218.table index 6940a0e41..acf069c32 100644 --- a/definitions/grib2/tables/14/4.218.table +++ b/definitions/grib2/tables/14/4.218.table @@ -1,38 +1,38 @@ # Code table 4.218 - Pixel scene type -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation / crops -15 15 Permanent snow / ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -# 19-96 Reserved -97 97 Snow / ice on land -98 98 Snow / ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud / fog / Stratus -102 102 Low cloud / Stratocumulus -103 103 Low cloud / unknown type -104 104 Medium cloud / Nimbostratus -105 105 Medium cloud / Altostratus -106 106 Medium cloud / unknown type -107 107 High cloud / Cumulus -108 108 High cloud / Cirrus -109 109 High cloud / unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation / crops +15 15 Permanent snow / ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +# 19-96 Reserved +97 97 Snow / ice on land +98 98 Snow / ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud / fog / Stratus +102 102 Low cloud / Stratocumulus +103 103 Low cloud / unknown type +104 104 Medium cloud / Nimbostratus +105 105 Medium cloud / Altostratus +106 106 Medium cloud / unknown type +107 107 High cloud / Cumulus +108 108 High cloud / Cirrus +109 109 High cloud / unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.219.table b/definitions/grib2/tables/14/4.219.table index 86df0522e..9979f50ad 100644 --- a/definitions/grib2/tables/14/4.219.table +++ b/definitions/grib2/tables/14/4.219.table @@ -1,8 +1,8 @@ # Code table 4.219 - Cloud top height quality indicator -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.220.table b/definitions/grib2/tables/14/4.220.table index 93e841f8b..88e869e42 100644 --- a/definitions/grib2/tables/14/4.220.table +++ b/definitions/grib2/tables/14/4.220.table @@ -1,6 +1,6 @@ # Code table 4.220 - Horizontal dimension processed -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.221.table b/definitions/grib2/tables/14/4.221.table index 8448533d7..011cc3518 100644 --- a/definitions/grib2/tables/14/4.221.table +++ b/definitions/grib2/tables/14/4.221.table @@ -1,6 +1,6 @@ # Code table 4.221 - Treatment of missing data -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.222.table b/definitions/grib2/tables/14/4.222.table index 57f113014..558d947ac 100644 --- a/definitions/grib2/tables/14/4.222.table +++ b/definitions/grib2/tables/14/4.222.table @@ -1,6 +1,6 @@ # Code table 4.222 - Categorical result -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.223.table b/definitions/grib2/tables/14/4.223.table index f0deb076a..572c4e7a8 100644 --- a/definitions/grib2/tables/14/4.223.table +++ b/definitions/grib2/tables/14/4.223.table @@ -1,5 +1,5 @@ # Code table 4.223 - Fire detection indicator -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing diff --git a/definitions/grib2/tables/14/4.224.table b/definitions/grib2/tables/14/4.224.table index e87cde4bb..014f56e23 100644 --- a/definitions/grib2/tables/14/4.224.table +++ b/definitions/grib2/tables/14/4.224.table @@ -1,18 +1,18 @@ # Code table 4.224 - Categorical outlook -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/14/4.227.table b/definitions/grib2/tables/14/4.227.table index 27c76553d..48c3b7633 100644 --- a/definitions/grib2/tables/14/4.227.table +++ b/definitions/grib2/tables/14/4.227.table @@ -1,9 +1,9 @@ # Code table 4.227 - Icing scenario (weather/cloud classification) -0 0 None -1 1 General -2 2 Convective -3 3 Stratiform -4 4 Freezing -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 None +1 1 General +2 2 Convective +3 3 Stratiform +4 4 Freezing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/14/4.234.table b/definitions/grib2/tables/14/4.234.table index 9844a91d2..d8b3715b3 100644 --- a/definitions/grib2/tables/14/4.234.table +++ b/definitions/grib2/tables/14/4.234.table @@ -1,21 +1,21 @@ # Code table 4.234 - Canopy cover fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Crops, mixed farming -2 2 Short grass -3 3 Evergreen needleleaf trees -4 4 Deciduous needleleaf trees -5 5 Deciduous broadleaf trees -6 6 Evergreen broadleaf trees -7 7 Tall grass -8 8 Desert -9 9 Tundra -10 10 Irrigated crops -11 11 Semidesert -12 12 Ice caps and glaciers -13 13 Bogs and marshes -14 14 Inland water -15 15 Ocean -16 16 Evergreen shrubs -17 17 Deciduous shrubs -18 18 Mixed forest -19 19 Interrupted forest -20 20 Water and land mixtures +1 1 Crops, mixed farming +2 2 Short grass +3 3 Evergreen needleleaf trees +4 4 Deciduous needleleaf trees +5 5 Deciduous broadleaf trees +6 6 Evergreen broadleaf trees +7 7 Tall grass +8 8 Desert +9 9 Tundra +10 10 Irrigated crops +11 11 Semidesert +12 12 Ice caps and glaciers +13 13 Bogs and marshes +14 14 Inland water +15 15 Ocean +16 16 Evergreen shrubs +17 17 Deciduous shrubs +18 18 Mixed forest +19 19 Interrupted forest +20 20 Water and land mixtures diff --git a/definitions/grib2/tables/14/4.236.table b/definitions/grib2/tables/14/4.236.table index 08c7f8d56..b667b65fc 100644 --- a/definitions/grib2/tables/14/4.236.table +++ b/definitions/grib2/tables/14/4.236.table @@ -1,8 +1,8 @@ # Code table 4.236 - Soil texture fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Coarse -2 2 Medium -3 3 Medium-fine -4 4 Fine -5 5 Very-fine -6 6 Organic -7 7 Tropical-organic +1 1 Coarse +2 2 Medium +3 3 Medium-fine +4 4 Fine +5 5 Very-fine +6 6 Organic +7 7 Tropical-organic diff --git a/definitions/grib2/tables/14/4.241.table b/definitions/grib2/tables/14/4.241.table index 21b8b207b..ce6a15f3c 100644 --- a/definitions/grib2/tables/14/4.241.table +++ b/definitions/grib2/tables/14/4.241.table @@ -1,9 +1,9 @@ # Code table 4.241 - Coverage attributes -0 0 Undefined -1 1 Unmodified -2 2 Snow-covered -3 3 Flooded -4 4 Ice covered -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Undefined +1 1 Unmodified +2 2 Snow-covered +3 3 Flooded +4 4 Ice covered +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.242.table b/definitions/grib2/tables/14/4.242.table index 012655df6..ca852339d 100644 --- a/definitions/grib2/tables/14/4.242.table +++ b/definitions/grib2/tables/14/4.242.table @@ -1,7 +1,7 @@ # Code table 4.242 - Tile classification -0 0 Reserved -1 1 Land use classes according to ESA-GLOBCOVER GCV2009 -2 2 Land use classes according to European Commission - Global Land Cover Project GLC2000 -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Land use classes according to ESA-GLOBCOVER GCV2009 +2 2 Land use classes according to European Commission - Global Land Cover Project GLC2000 +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.243.table b/definitions/grib2/tables/14/4.243.table index 9f047be33..8677e6819 100644 --- a/definitions/grib2/tables/14/4.243.table +++ b/definitions/grib2/tables/14/4.243.table @@ -1,43 +1,43 @@ # Code table 4.243 - Tile class -0 0 Reserved -1 1 Evergreen broadleaved forest -2 2 Deciduous broadleaved closed forest -3 3 Deciduous broadleaved open forest -4 4 Evergreen needle-leaf forest -5 5 Deciduous needle-leaf forest -6 6 Mixed leaf trees -7 7 Fresh water flooded trees -8 8 Saline water flooded trees -9 9 Mosaic tree/natural vegetation -10 10 Burnt tree cover -11 11 Evergreen shrubs closed-open -12 12 Deciduous shrubs closed-open -13 13 Herbaceous vegetation closed-open -14 14 Sparse herbaceous or grass -15 15 Flooded shrubs or herbaceous -16 16 Cultivated and managed areas -17 17 Mosaic crop/tree/natural vegetation -18 18 Mosaic crop/shrub/grass -19 19 Bare areas -20 20 Water -21 21 Snow and ice -22 22 Artificial surface -23 23 Ocean -24 24 Irrigated croplands -25 25 Rain fed croplands -26 26 Mosaic cropland (50-70%) - vegetation (20-50%) -27 27 Mosaic vegetation (50-70%) - cropland (20-50%) -28 28 Closed broadleaved evergreen forest -29 29 Closed needle-leaved evergreen forest -30 30 Open needle-leaved deciduous forest -31 31 Mixed broadleaved and needle-leaved forest -32 32 Mosaic shrubland (50-70%) - grassland (20-50%) -33 33 Mosaic grassland (50-70%) - shrubland (20-50%) -34 34 Closed to open shrubland -35 35 Sparse vegetation -36 36 Closed to open forest regularly flooded -37 37 Closed forest or shrubland permanently flooded -38 38 Closed to open grassland regularly flooded -39 39 Undefined -# 40-32767 Reserved -# 32768- Reserved for local use +0 0 Reserved +1 1 Evergreen broadleaved forest +2 2 Deciduous broadleaved closed forest +3 3 Deciduous broadleaved open forest +4 4 Evergreen needle-leaf forest +5 5 Deciduous needle-leaf forest +6 6 Mixed leaf trees +7 7 Fresh water flooded trees +8 8 Saline water flooded trees +9 9 Mosaic tree/natural vegetation +10 10 Burnt tree cover +11 11 Evergreen shrubs closed-open +12 12 Deciduous shrubs closed-open +13 13 Herbaceous vegetation closed-open +14 14 Sparse herbaceous or grass +15 15 Flooded shrubs or herbaceous +16 16 Cultivated and managed areas +17 17 Mosaic crop/tree/natural vegetation +18 18 Mosaic crop/shrub/grass +19 19 Bare areas +20 20 Water +21 21 Snow and ice +22 22 Artificial surface +23 23 Ocean +24 24 Irrigated croplands +25 25 Rain fed croplands +26 26 Mosaic cropland (50-70%) - vegetation (20-50%) +27 27 Mosaic vegetation (50-70%) - cropland (20-50%) +28 28 Closed broadleaved evergreen forest +29 29 Closed needle-leaved evergreen forest +30 30 Open needle-leaved deciduous forest +31 31 Mixed broadleaved and needle-leaved forest +32 32 Mosaic shrubland (50-70%) - grassland (20-50%) +33 33 Mosaic grassland (50-70%) - shrubland (20-50%) +34 34 Closed to open shrubland +35 35 Sparse vegetation +36 36 Closed to open forest regularly flooded +37 37 Closed forest or shrubland permanently flooded +38 38 Closed to open grassland regularly flooded +39 39 Undefined +# 40-32767 Reserved +# 32768- Reserved for local use diff --git a/definitions/grib2/tables/14/4.3.table b/definitions/grib2/tables/14/4.3.table index f423af2bf..46e498c5f 100644 --- a/definitions/grib2/tables/14/4.3.table +++ b/definitions/grib2/tables/14/4.3.table @@ -1,20 +1,20 @@ # Code table 4.3 - Type of generating process -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -12 12 Post-processed analysis -13 13 Post-processed forecast -14 14 Nowcast -15 15 Hindcast -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +12 12 Post-processed analysis +13 13 Post-processed forecast +14 14 Nowcast +15 15 Hindcast +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.4.table b/definitions/grib2/tables/14/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/14/4.4.table +++ b/definitions/grib2/tables/14/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.5.table b/definitions/grib2/tables/14/4.5.table index e6d6d424c..d61b61c9f 100644 --- a/definitions/grib2/tables/14/4.5.table +++ b/definitions/grib2/tables/14/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface 2 2 Cloud base level 3 3 Level of cloud tops @@ -12,11 +12,11 @@ 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) 12 12 Cumulonimbus (CB) top (m) -# 13-19 Reserved +# 13-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -25,18 +25,18 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level -112 112 Reserved +112 112 Reserved 113 113 Logarithmic hybrid level 114 114 Snow level (Numeric) -# 115-116 Reserved +# 115-116 Reserved 117 117 Mixed layer depth (m) 118 hhl Hybrid height level 119 hpl Hybrid pressure level -# 120-149 Reserved -150 150 Generalized vertical height coordinate -# 151-159 Reserved +# 120-149 Reserved +150 150 Generalized vertical height coordinate +# 151-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom @@ -45,6 +45,6 @@ 165 165 Bottom of sediment layer penetrated by thermal wave 166 sfc Mixing layer 167 167 Bottom of root zone -# 168-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 168-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.6.table b/definitions/grib2/tables/14/4.6.table index b2dfeb498..ce799721d 100644 --- a/definitions/grib2/tables/14/4.6.table +++ b/definitions/grib2/tables/14/4.6.table @@ -1,9 +1,9 @@ # Code table 4.6 - Type of ensemble forecast -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.7.table b/definitions/grib2/tables/14/4.7.table index e0de0e1b2..69b2b4d77 100644 --- a/definitions/grib2/tables/14/4.7.table +++ b/definitions/grib2/tables/14/4.7.table @@ -1,14 +1,14 @@ # Code table 4.7 - Derived forecast -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.8.table b/definitions/grib2/tables/14/4.8.table index ad883039c..78467454a 100644 --- a/definitions/grib2/tables/14/4.8.table +++ b/definitions/grib2/tables/14/4.8.table @@ -1,6 +1,6 @@ # Code table 4.8 - Clustering method -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.9.table b/definitions/grib2/tables/14/4.9.table index 5878b5ad3..0ce312dd1 100644 --- a/definitions/grib2/tables/14/4.9.table +++ b/definitions/grib2/tables/14/4.9.table @@ -1,9 +1,9 @@ # Code table 4.9 - Probability type -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/4.91.table b/definitions/grib2/tables/14/4.91.table index 44cf25f44..ae31ed61c 100644 --- a/definitions/grib2/tables/14/4.91.table +++ b/definitions/grib2/tables/14/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit -11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit +11 11 Equal to first limit +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/14/5.0.table b/definitions/grib2/tables/14/5.0.table index 5ec77ed0f..2795336df 100644 --- a/definitions/grib2/tables/14/5.0.table +++ b/definitions/grib2/tables/14/5.0.table @@ -1,23 +1,23 @@ # Code table 5.0 - Data representation template number -0 0 Grid point data - simple packing -1 1 Matrix value at grid point - simple packing -2 2 Grid point data - complex packing -3 3 Grid point data - complex packing and spatial differencing -4 4 Grid point data - IEEE floating point data -40 40 Grid point data - JPEG 2000 code stream format -41 41 Grid point data - Portable Network Graphics (PNG) -# 42-49 Reserved -50 50 Spectral data - simple packing -51 51 Spherical harmonics data - complex packing -# 52-60 Reserved -61 61 Grid point data - simple packing with logarithm pre-processing -# 62-199 Reserved -200 200 Run length packing with level values -# 201-49151 Reserved -# 49152-65534 Reserved for local use +0 0 Grid point data - simple packing +1 1 Matrix value at grid point - simple packing +2 2 Grid point data - complex packing +3 3 Grid point data - complex packing and spatial differencing +4 4 Grid point data - IEEE floating point data +40 40 Grid point data - JPEG 2000 code stream format +41 41 Grid point data - Portable Network Graphics (PNG) +# 42-49 Reserved +50 50 Spectral data - simple packing +51 51 Spherical harmonics data - complex packing +# 52-60 Reserved +61 61 Grid point data - simple packing with logarithm pre-processing +# 62-199 Reserved +200 200 Run length packing with level values +# 201-49151 Reserved +# 49152-65534 Reserved for local use 40000 40000 JPEG2000 Packing 40010 40010 PNG pacling 50000 50000 Sperical harmonics ieee packing 50001 50001 Second order packing 50002 50002 Second order packing -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/14/5.1.table b/definitions/grib2/tables/14/5.1.table index 854330c74..1189b5e46 100644 --- a/definitions/grib2/tables/14/5.1.table +++ b/definitions/grib2/tables/14/5.1.table @@ -1,6 +1,6 @@ # Code table 5.1 - Type of original field values -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/5.2.table b/definitions/grib2/tables/14/5.2.table index 7a4500ecd..d12b46fbd 100644 --- a/definitions/grib2/tables/14/5.2.table +++ b/definitions/grib2/tables/14/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use +# 12-191 Reserved +# 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/14/5.3.table b/definitions/grib2/tables/14/5.3.table index c3b7b30fe..481331791 100644 --- a/definitions/grib2/tables/14/5.3.table +++ b/definitions/grib2/tables/14/5.3.table @@ -1,7 +1,7 @@ # Code table 5.3 - Matrix coordinate parameter -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/5.4.table b/definitions/grib2/tables/14/5.4.table index 8121c1819..e84ab1901 100644 --- a/definitions/grib2/tables/14/5.4.table +++ b/definitions/grib2/tables/14/5.4.table @@ -1,6 +1,6 @@ # Code table 5.4 - Group splitting method -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/5.40.table b/definitions/grib2/tables/14/5.40.table index b9bad2c39..97e8880ab 100644 --- a/definitions/grib2/tables/14/5.40.table +++ b/definitions/grib2/tables/14/5.40.table @@ -1,5 +1,5 @@ # Code table 5.40 - Type of compression -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/14/5.5.table b/definitions/grib2/tables/14/5.5.table index 3ef3eb070..f2316975a 100644 --- a/definitions/grib2/tables/14/5.5.table +++ b/definitions/grib2/tables/14/5.5.table @@ -1,7 +1,7 @@ # Code table 5.5 - Missing value management for complex packing -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/5.6.table b/definitions/grib2/tables/14/5.6.table index 6d5177877..db68ead9c 100644 --- a/definitions/grib2/tables/14/5.6.table +++ b/definitions/grib2/tables/14/5.6.table @@ -1,7 +1,7 @@ # Code table 5.6 - Order of spatial differencing -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/14/5.7.table b/definitions/grib2/tables/14/5.7.table index 5ab780056..e54862c19 100644 --- a/definitions/grib2/tables/14/5.7.table +++ b/definitions/grib2/tables/14/5.7.table @@ -1,7 +1,7 @@ # Code table 5.7 - Precision of floating-point numbers -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/14/6.0.table b/definitions/grib2/tables/14/6.0.table index f539b26d7..a8f30f5a4 100644 --- a/definitions/grib2/tables/14/6.0.table +++ b/definitions/grib2/tables/14/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator 0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/15/0.0.table b/definitions/grib2/tables/15/0.0.table index b24c50564..2c5afceb4 100644 --- a/definitions/grib2/tables/15/0.0.table +++ b/definitions/grib2/tables/15/0.0.table @@ -1,10 +1,10 @@ # Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/1.0.table b/definitions/grib2/tables/15/1.0.table index 1d1bde1dc..9c3abfc0a 100644 --- a/definitions/grib2/tables/15/1.0.table +++ b/definitions/grib2/tables/15/1.0.table @@ -1,20 +1,20 @@ # Code table 1.0 - GRIB master tables version number -0 0 Experimental -1 1 Version implemented on 7 November 2001 -2 2 Version implemented on 4 November 2003 -3 3 Version implemented on 2 November 2005 -4 4 Version implemented on 7 November 2007 -5 5 Version implemented on 4 November 2009 -6 6 Version implemented on 15 September 2010 -7 7 Version implemented on 4 May 2011 -8 8 Version implemented on 2 November 2011 -9 9 Version implemented on 2 May 2012 -10 10 Version implemented on 7 November 2012 -11 11 Version implemented on 8 May 2013 -12 12 Version implemented on 14 November 2013 -13 13 Version implemented on 7 May 2014 -14 14 Version implemented on 5 November 2014 +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 +6 6 Version implemented on 15 September 2010 +7 7 Version implemented on 4 May 2011 +8 8 Version implemented on 2 November 2011 +9 9 Version implemented on 2 May 2012 +10 10 Version implemented on 7 November 2012 +11 11 Version implemented on 8 May 2013 +12 12 Version implemented on 14 November 2013 +13 13 Version implemented on 7 May 2014 +14 14 Version implemented on 5 November 2014 15 15 Version implemented on 6 May 2015 -16 16 Pre-operational to be implemented by next amendment -# 17-254 Future versions -255 255 Missing +16 16 Pre-operational to be implemented by next amendment +# 17-254 Future versions +255 255 Missing diff --git a/definitions/grib2/tables/15/1.1.table b/definitions/grib2/tables/15/1.1.table index d50f8fd72..f6d332005 100644 --- a/definitions/grib2/tables/15/1.1.table +++ b/definitions/grib2/tables/15/1.1.table @@ -1,4 +1,4 @@ # Code table 1.1 - GRIB local tables version number -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/15/1.2.table b/definitions/grib2/tables/15/1.2.table index 934b70455..638f1efbb 100644 --- a/definitions/grib2/tables/15/1.2.table +++ b/definitions/grib2/tables/15/1.2.table @@ -1,8 +1,8 @@ # Code table 1.2 - Significance of reference time -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/1.3.table b/definitions/grib2/tables/15/1.3.table index 6f061bf42..e7197fcb2 100644 --- a/definitions/grib2/tables/15/1.3.table +++ b/definitions/grib2/tables/15/1.3.table @@ -1,14 +1,14 @@ # Code table 1.3 - Production status of data -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products 4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) 5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) 6 6 S2S operational products 7 7 S2S test products 8 8 Uncertainties in ensembles of regional reanalysis project (UERRA) 9 9 Uncertainties in ensembles of regional reanalysis project test (UERRA) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/1.4.table b/definitions/grib2/tables/15/1.4.table index 03203d874..877288c0e 100644 --- a/definitions/grib2/tables/15/1.4.table +++ b/definitions/grib2/tables/15/1.4.table @@ -1,13 +1,13 @@ # Code table 1.4 - Type of data -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/15/1.5.table b/definitions/grib2/tables/15/1.5.table index b2cf9f087..533111959 100644 --- a/definitions/grib2/tables/15/1.5.table +++ b/definitions/grib2/tables/15/1.5.table @@ -1,7 +1,7 @@ # Code table 1.5 - Identification template number -0 0 Calendar definition -1 1 Paleontological offset -2 2 Calendar definition and paleontological offset -# 3-32767 Reserved -# 32768-65534 Reserved for local use -65535 65535 Missing +0 0 Calendar definition +1 1 Paleontological offset +2 2 Calendar definition and paleontological offset +# 3-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/15/1.6.table b/definitions/grib2/tables/15/1.6.table index 5db921990..bd46899a7 100644 --- a/definitions/grib2/tables/15/1.6.table +++ b/definitions/grib2/tables/15/1.6.table @@ -1,8 +1,8 @@ # Code table 1.6 - Type of calendar -0 0 Gregorian -1 1 360-day -2 2 365-day -3 3 Proleptic Gregorian -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Gregorian +1 1 360-day +2 2 365-day +3 3 Proleptic Gregorian +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/3.0.table b/definitions/grib2/tables/15/3.0.table index 45187b80d..a442a06a0 100644 --- a/definitions/grib2/tables/15/3.0.table +++ b/definitions/grib2/tables/15/3.0.table @@ -1,6 +1,6 @@ # Code table 3.0 - Source of grid definition -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/15/3.10.table b/definitions/grib2/tables/15/3.10.table index afa8843a7..1612d05e3 100644 --- a/definitions/grib2/tables/15/3.10.table +++ b/definitions/grib2/tables/15/3.10.table @@ -1,8 +1,8 @@ # Flag table 3.10 - Scanning mode for one diamond -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/15/3.11.table b/definitions/grib2/tables/15/3.11.table index e516a2ab9..06ae10810 100644 --- a/definitions/grib2/tables/15/3.11.table +++ b/definitions/grib2/tables/15/3.11.table @@ -1,7 +1,7 @@ # Code table 3.11 - Interpretation of list of numbers at end of section 3 -0 0 There is no appended list -1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows -2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row -3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) -# 4-254 Reserved -255 255 Missing +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/15/3.15.table b/definitions/grib2/tables/15/3.15.table index 331217ebe..6087902a3 100644 --- a/definitions/grib2/tables/15/3.15.table +++ b/definitions/grib2/tables/15/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/3.2.table b/definitions/grib2/tables/15/3.2.table index 9238dc2a7..b9574a424 100644 --- a/definitions/grib2/tables/15/3.2.table +++ b/definitions/grib2/tables/15/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame -9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/3.20.table b/definitions/grib2/tables/15/3.20.table index efbf08d19..e2bb156ee 100644 --- a/definitions/grib2/tables/15/3.20.table +++ b/definitions/grib2/tables/15/3.20.table @@ -1,6 +1,6 @@ # Code table 3.20 - Type of horizontal line -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/3.21.table b/definitions/grib2/tables/15/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/15/3.21.table +++ b/definitions/grib2/tables/15/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/3.3.table b/definitions/grib2/tables/15/3.3.table index 5dd7c7001..25cb46a1d 100644 --- a/definitions/grib2/tables/15/3.3.table +++ b/definitions/grib2/tables/15/3.3.table @@ -1,9 +1,9 @@ # Flag table 3.3 - Resolution and component flags -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/15/3.4.table b/definitions/grib2/tables/15/3.4.table index 897b813d7..43835c014 100644 --- a/definitions/grib2/tables/15/3.4.table +++ b/definitions/grib2/tables/15/3.4.table @@ -1,17 +1,17 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -5 0 Points within odd rows are not offset in i (x) direction -5 1 Points within odd rows are offset by Di/2 in i (x) direction -6 0 Points within even rows are not offset in i (x) direction -6 1 Points within even rows are offset by Di/2 in i (x) direction -7 0 Points are not offset in j (y) direction -7 1 Points are offset by Dj/2 in j (y) direction -8 0 Rows have Ni grid points and columns have Nj grid points -8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +5 0 Points within odd rows are not offset in i (x) direction +5 1 Points within odd rows are offset by Di/2 in i (x) direction +6 0 Points within even rows are not offset in i (x) direction +6 1 Points within even rows are offset by Di/2 in i (x) direction +7 0 Points are not offset in j (y) direction +7 1 Points are offset by Dj/2 in j (y) direction +8 0 Rows have Ni grid points and columns have Nj grid points +8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction diff --git a/definitions/grib2/tables/15/3.5.table b/definitions/grib2/tables/15/3.5.table index eabdde896..2f8ec82e3 100644 --- a/definitions/grib2/tables/15/3.5.table +++ b/definitions/grib2/tables/15/3.5.table @@ -1,5 +1,5 @@ # Flag table 3.5 - Projection centre -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/15/3.7.table b/definitions/grib2/tables/15/3.7.table index 0a7d6efde..34c0de085 100644 --- a/definitions/grib2/tables/15/3.7.table +++ b/definitions/grib2/tables/15/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 see separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/15/3.8.table b/definitions/grib2/tables/15/3.8.table index 844e74235..578fab37f 100644 --- a/definitions/grib2/tables/15/3.8.table +++ b/definitions/grib2/tables/15/3.8.table @@ -1,7 +1,7 @@ # Code table 3.8 - Grid point position -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/3.9.table b/definitions/grib2/tables/15/3.9.table index fd730bc64..ecd65514a 100644 --- a/definitions/grib2/tables/15/3.9.table +++ b/definitions/grib2/tables/15/3.9.table @@ -1,4 +1,4 @@ # Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/15/4.0.table b/definitions/grib2/tables/15/4.0.table index b4eff0769..b05d7ef13 100644 --- a/definitions/grib2/tables/15/4.0.table +++ b/definitions/grib2/tables/15/4.0.table @@ -1,64 +1,64 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time -8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -# 35-39 Reserved +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data +# 35-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol -46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -# 49-50 Reserved -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time -52 52 Reserved -53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time -54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters -# 55-56 Reserved -57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function -# 58-59 Reserved -60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +# 49-50 Reserved +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +52 52 Reserved +53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time +54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters +# 55-56 Reserved +57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function +# 58-59 Reserved +60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time 61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 62-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +# 62-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved -# 32768-65534 Reserved for local use +# 1102-32767 Reserved +# 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/15/4.1.0.table b/definitions/grib2/tables/15/4.1.0.table index 04cfd7802..df58636d6 100644 --- a/definitions/grib2/tables/15/4.1.0.table +++ b/definitions/grib2/tables/15/4.1.0.table @@ -1,27 +1,27 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.1.1.table b/definitions/grib2/tables/15/4.1.1.table index 7b22b6fed..05a854da0 100644 --- a/definitions/grib2/tables/15/4.1.1.table +++ b/definitions/grib2/tables/15/4.1.1.table @@ -1,7 +1,7 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.1.10.table b/definitions/grib2/tables/15/4.1.10.table index a9b20eb9c..88d3c8743 100644 --- a/definitions/grib2/tables/15/4.1.10.table +++ b/definitions/grib2/tables/15/4.1.10.table @@ -1,10 +1,10 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Subsurface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Subsurface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.1.2.table b/definitions/grib2/tables/15/4.1.2.table index 5b488fe9e..e74126645 100644 --- a/definitions/grib2/tables/15/4.1.2.table +++ b/definitions/grib2/tables/15/4.1.2.table @@ -1,9 +1,9 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.1.3.table b/definitions/grib2/tables/15/4.1.3.table index 5096a166e..c1a1e267a 100644 --- a/definitions/grib2/tables/15/4.1.3.table +++ b/definitions/grib2/tables/15/4.1.3.table @@ -1,6 +1,6 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Image format products -1 1 Quantitative products -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.10.table b/definitions/grib2/tables/15/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/15/4.10.table +++ b/definitions/grib2/tables/15/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/15/4.11.table b/definitions/grib2/tables/15/4.11.table index 7f404c849..01cc81303 100644 --- a/definitions/grib2/tables/15/4.11.table +++ b/definitions/grib2/tables/15/4.11.table @@ -1,10 +1,10 @@ # Code table 4.11 - Type of time intervals -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.12.table b/definitions/grib2/tables/15/4.12.table index 03fd89b36..d42b47e96 100644 --- a/definitions/grib2/tables/15/4.12.table +++ b/definitions/grib2/tables/15/4.12.table @@ -1,7 +1,7 @@ # Code table 4.12 - Operating mode -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.13.table b/definitions/grib2/tables/15/4.13.table index c92854eec..a0e28eac8 100644 --- a/definitions/grib2/tables/15/4.13.table +++ b/definitions/grib2/tables/15/4.13.table @@ -1,6 +1,6 @@ # Code table 4.13 - Quality control indicator -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.14.table b/definitions/grib2/tables/15/4.14.table index a88cb93fa..d525b23b3 100644 --- a/definitions/grib2/tables/15/4.14.table +++ b/definitions/grib2/tables/15/4.14.table @@ -1,6 +1,6 @@ # Code table 4.14 - Clutter filter indicator -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.15.table b/definitions/grib2/tables/15/4.15.table index 2e5f3dea3..7adddedb6 100644 --- a/definitions/grib2/tables/15/4.15.table +++ b/definitions/grib2/tables/15/4.15.table @@ -1,11 +1,11 @@ # Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.0.table b/definitions/grib2/tables/15/4.2.0.0.table index 41e5291a9..24d21959d 100644 --- a/definitions/grib2/tables/15/4.2.0.0.table +++ b/definitions/grib2/tables/15/4.2.0.0.table @@ -21,6 +21,6 @@ 19 19 Turbulent transfer coefficient for heat (Numeric) 20 20 Turbulent diffusion coefficient for heat (m2/s) 21 21 Apparent temperature (K) -# 22-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 22-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.1.table b/definitions/grib2/tables/15/4.2.0.1.table index f2fdd3026..69386bbe2 100644 --- a/definitions/grib2/tables/15/4.2.0.1.table +++ b/definitions/grib2/tables/15/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,7 +86,7 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) @@ -105,6 +105,6 @@ 105 105 Number density of snow (m-3) 106 106 Number density of graupel (m-3) 107 107 Number density of hail (m-3) -# 108-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 108-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.13.table b/definitions/grib2/tables/15/4.2.0.13.table index 5086101ad..3f5c30675 100644 --- a/definitions/grib2/tables/15/4.2.0.13.table +++ b/definitions/grib2/tables/15/4.2.0.13.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.14.table b/definitions/grib2/tables/15/4.2.0.14.table index 215884737..97fb38c8b 100644 --- a/definitions/grib2/tables/15/4.2.0.14.table +++ b/definitions/grib2/tables/15/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.15.table b/definitions/grib2/tables/15/4.2.0.15.table index dfbc4d12f..8df082466 100644 --- a/definitions/grib2/tables/15/4.2.0.15.table +++ b/definitions/grib2/tables/15/4.2.0.15.table @@ -16,6 +16,6 @@ 14 14 Reflectivity of hail (dB) 15 15 Hybrid scan reflectivity (dB) 16 16 Hybrid scan reflectivity height (m) -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.16.table b/definitions/grib2/tables/15/4.2.0.16.table index 0c240a853..9499d9333 100644 --- a/definitions/grib2/tables/15/4.2.0.16.table +++ b/definitions/grib2/tables/15/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.18.table b/definitions/grib2/tables/15/4.2.0.18.table index 18c41aa48..7e0a736eb 100644 --- a/definitions/grib2/tables/15/4.2.0.18.table +++ b/definitions/grib2/tables/15/4.2.0.18.table @@ -8,11 +8,11 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) 13 13 Total deposition (wet + dry) (Bq m-2) -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.19.table b/definitions/grib2/tables/15/4.2.0.19.table index 75101bd37..d2beef083 100644 --- a/definitions/grib2/tables/15/4.2.0.19.table +++ b/definitions/grib2/tables/15/4.2.0.19.table @@ -27,6 +27,6 @@ 25 25 Weather (Code table 4.225) 26 26 Convective outlook (Code table 4.224) 27 27 Icing scenario (Code table 4.227) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.190.table b/definitions/grib2/tables/15/4.2.0.190.table index de621a924..a0d6ba0ac 100644 --- a/definitions/grib2/tables/15/4.2.0.190.table +++ b/definitions/grib2/tables/15/4.2.0.190.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.191.table b/definitions/grib2/tables/15/4.2.0.191.table index e3bba0ebe..b3a7092ea 100644 --- a/definitions/grib2/tables/15/4.2.0.191.table +++ b/definitions/grib2/tables/15/4.2.0.191.table @@ -3,6 +3,6 @@ 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.2.table b/definitions/grib2/tables/15/4.2.0.2.table index c83b07300..7bd1509f5 100644 --- a/definitions/grib2/tables/15/4.2.0.2.table +++ b/definitions/grib2/tables/15/4.2.0.2.table @@ -38,6 +38,6 @@ 36 36 Amplitude function for Rossby wave envelope for meridional wind (m/s) 37 37 Northward turbulent surface stress (N m-2 s) 38 38 Eastward turbulent surface stress (N m-2 s) -# 39-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 39-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.20.table b/definitions/grib2/tables/15/4.2.0.20.table index 9584f7c7f..df9ccc184 100644 --- a/definitions/grib2/tables/15/4.2.0.20.table +++ b/definitions/grib2/tables/15/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -25,7 +25,7 @@ 57 57 Total yearly average burden of the atmosphere (mol) 58 58 Total yearly averaged atmospheric loss (mol/s) 59 59 Aerosol number concentration (m-3) -# 60-99 Reserved +# 60-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -37,6 +37,6 @@ 108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) 109 109 Aerosol lidar extinction from satellite (/m) 110 110 Aerosol lidar extinction from the ground (/m) -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.3.table b/definitions/grib2/tables/15/4.2.0.3.table index 9a88e0027..e1a68bfc5 100644 --- a/definitions/grib2/tables/15/4.2.0.3.table +++ b/definitions/grib2/tables/15/4.2.0.3.table @@ -26,6 +26,6 @@ 24 24 Anisotropy of sub-gridscale orography (Numeric) 25 25 Natural logarithm of pressure in Pa (Numeric) 26 26 Exner pressure (Numeric) -# 27-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 27-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.4.table b/definitions/grib2/tables/15/4.2.0.4.table index dbfcbddb7..03b5cea38 100644 --- a/definitions/grib2/tables/15/4.2.0.4.table +++ b/definitions/grib2/tables/15/4.2.0.4.table @@ -12,9 +12,9 @@ 10 10 Photosynthetically active radiation (W m-2) 11 11 Net short-wave radiation flux, clear sky (W m-2) 12 12 Downward UV radiation (W m-2) -# 13-49 Reserved +# 13-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) -# 52-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.5.table b/definitions/grib2/tables/15/4.2.0.5.table index 932a12fbd..b9084509a 100644 --- a/definitions/grib2/tables/15/4.2.0.5.table +++ b/definitions/grib2/tables/15/4.2.0.5.table @@ -7,6 +7,6 @@ 5 5 Net long-wave radiation flux (W m-2) 6 6 Net long-wave radiation flux, clear sky (W m-2) 7 7 Brightness temperature (K) -# 8-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.6.table b/definitions/grib2/tables/15/4.2.0.6.table index e28d8e4db..8f1574d46 100644 --- a/definitions/grib2/tables/15/4.2.0.6.table +++ b/definitions/grib2/tables/15/4.2.0.6.table @@ -39,6 +39,6 @@ 37 37 Fraction of convective precipitation cover (Proportion) 38 38 Mass density of cloud droplets (kg m-3) 39 39 Mass density of cloud ice (kg m-3) -# 40-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 40-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.0.7.table b/definitions/grib2/tables/15/4.2.0.7.table index db47d0113..8a2b85fb9 100644 --- a/definitions/grib2/tables/15/4.2.0.7.table +++ b/definitions/grib2/tables/15/4.2.0.7.table @@ -13,8 +13,8 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraft helicity (m2 s-2) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.1.0.table b/definitions/grib2/tables/15/4.2.1.0.table index cf56b08ee..f455c3365 100644 --- a/definitions/grib2/tables/15/4.2.1.0.table +++ b/definitions/grib2/tables/15/4.2.1.0.table @@ -7,6 +7,6 @@ 5 5 Baseflow-groundwater runoff (kg m-2) 6 6 Storm surface runoff (kg m-2) 7 7 Discharge from rivers or streams (m3/s) -# 8-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.1.1.table b/definitions/grib2/tables/15/4.2.1.1.table index b488eb0bd..171da3958 100644 --- a/definitions/grib2/tables/15/4.2.1.1.table +++ b/definitions/grib2/tables/15/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.10.0.table b/definitions/grib2/tables/15/4.2.10.0.table index 095f51bdf..3611abd9a 100644 --- a/definitions/grib2/tables/15/4.2.10.0.table +++ b/definitions/grib2/tables/15/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea-surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (/s) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.10.1.table b/definitions/grib2/tables/15/4.2.10.1.table index 5959bfa28..f0a073c00 100644 --- a/definitions/grib2/tables/15/4.2.10.1.table +++ b/definitions/grib2/tables/15/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.10.191.table b/definitions/grib2/tables/15/4.2.10.191.table index 524929e78..1ebf85006 100644 --- a/definitions/grib2/tables/15/4.2.10.191.table +++ b/definitions/grib2/tables/15/4.2.10.191.table @@ -1,8 +1,8 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -2 2 Reserved +2 2 Reserved 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.10.2.table b/definitions/grib2/tables/15/4.2.10.2.table index 6797062ac..4633bad4f 100644 --- a/definitions/grib2/tables/15/4.2.10.2.table +++ b/definitions/grib2/tables/15/4.2.10.2.table @@ -12,6 +12,6 @@ 10 10 Zonal vector component of vertically integrated ice internal pressure (Pa m) 11 11 Meridional vector component of vertically integrated ice internal pressure (Pa m) 12 12 Compressive ice strength (N/m) -# 13-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 13-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.10.3.table b/definitions/grib2/tables/15/4.2.10.3.table index f951bbe78..937720c93 100644 --- a/definitions/grib2/tables/15/4.2.10.3.table +++ b/definitions/grib2/tables/15/4.2.10.3.table @@ -1,6 +1,6 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.10.4.table b/definitions/grib2/tables/15/4.2.10.4.table index 54774f1b7..d5615ae26 100644 --- a/definitions/grib2/tables/15/4.2.10.4.table +++ b/definitions/grib2/tables/15/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2/s) 6 6 Ocean vertical momentum diffusivity (m2/s) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (/m) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.2.0.table b/definitions/grib2/tables/15/4.2.2.0.table index 81548840c..b253cac22 100644 --- a/definitions/grib2/tables/15/4.2.2.0.table +++ b/definitions/grib2/tables/15/4.2.2.0.table @@ -38,6 +38,6 @@ 36 36 Tile fraction (Proportion) 37 37 Tile percentage (%) 38 38 Soil volumetric ice content (water equivalent) (m3 m-3) -# 39-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 39-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.2.3.table b/definitions/grib2/tables/15/4.2.2.3.table index 08ac880fe..2b1d0ac38 100644 --- a/definitions/grib2/tables/15/4.2.2.3.table +++ b/definitions/grib2/tables/15/4.2.2.3.table @@ -23,6 +23,6 @@ 21 21 Soil ice (kg m-3) 22 22 Column-integrated soil ice (kg m-2) 23 23 Liquid water in snow pack (kg m-2) -# 24-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.2.4.table b/definitions/grib2/tables/15/4.2.2.4.table index d4ede2f70..c8b877df6 100644 --- a/definitions/grib2/tables/15/4.2.2.4.table +++ b/definitions/grib2/tables/15/4.2.2.4.table @@ -4,6 +4,6 @@ 2 2 Haines Index (Numeric) 3 3 Fire burned area (%) 4 4 Fosberg index (Numeric) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.3.0.table b/definitions/grib2/tables/15/4.2.3.0.table index c0ffa29f5..80a829673 100644 --- a/definitions/grib2/tables/15/4.2.3.0.table +++ b/definitions/grib2/tables/15/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.2.3.1.table b/definitions/grib2/tables/15/4.2.3.1.table index 0bda53063..bc9eaab0d 100644 --- a/definitions/grib2/tables/15/4.2.3.1.table +++ b/definitions/grib2/tables/15/4.2.3.1.table @@ -17,12 +17,12 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +23 23 Angstrom coefficient +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.201.table b/definitions/grib2/tables/15/4.201.table index 47f1b486f..fa173c4e0 100644 --- a/definitions/grib2/tables/15/4.201.table +++ b/definitions/grib2/tables/15/4.201.table @@ -1,15 +1,15 @@ # Code table 4.201 - Precipitation type -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow -6 6 Wet snow -7 7 Mixture of rain and snow -8 8 Ice pellets -9 9 Graupel -10 10 Hail -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +6 6 Wet snow +7 7 Mixture of rain and snow +8 8 Ice pellets +9 9 Graupel +10 10 Hail +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.202.table b/definitions/grib2/tables/15/4.202.table index 438502ff9..7f3c8f6cf 100644 --- a/definitions/grib2/tables/15/4.202.table +++ b/definitions/grib2/tables/15/4.202.table @@ -1,4 +1,4 @@ # Code table 4.202 - Precipitable water category -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.203.table b/definitions/grib2/tables/15/4.203.table index 8a9aedf7a..cf5eb6bdc 100644 --- a/definitions/grib2/tables/15/4.203.table +++ b/definitions/grib2/tables/15/4.203.table @@ -1,26 +1,26 @@ # Code table 4.203 - Cloud type -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.204.table b/definitions/grib2/tables/15/4.204.table index 91bcf1814..ffbd89502 100644 --- a/definitions/grib2/tables/15/4.204.table +++ b/definitions/grib2/tables/15/4.204.table @@ -1,9 +1,9 @@ # Code table 4.204 - Thunderstorm coverage -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (16-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (16-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.205.table b/definitions/grib2/tables/15/4.205.table index 5b4484dfd..c40c7f47b 100644 --- a/definitions/grib2/tables/15/4.205.table +++ b/definitions/grib2/tables/15/4.205.table @@ -1,6 +1,6 @@ # Code table 4.205 - Presence of aerosol -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.206.table b/definitions/grib2/tables/15/4.206.table index 02c3dfdf9..76472c261 100644 --- a/definitions/grib2/tables/15/4.206.table +++ b/definitions/grib2/tables/15/4.206.table @@ -1,6 +1,6 @@ # Code table 4.206 - Volcanic ash -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.207.table b/definitions/grib2/tables/15/4.207.table index 8ddb2e048..b6392fca0 100644 --- a/definitions/grib2/tables/15/4.207.table +++ b/definitions/grib2/tables/15/4.207.table @@ -1,10 +1,10 @@ # Code table 4.207 - Icing -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.208.table b/definitions/grib2/tables/15/4.208.table index b83685a1a..4361d38c0 100644 --- a/definitions/grib2/tables/15/4.208.table +++ b/definitions/grib2/tables/15/4.208.table @@ -1,9 +1,9 @@ # Code table 4.208 - Turbulence -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.209.table b/definitions/grib2/tables/15/4.209.table index cb7617071..39ea549ac 100644 --- a/definitions/grib2/tables/15/4.209.table +++ b/definitions/grib2/tables/15/4.209.table @@ -1,9 +1,9 @@ # Code table 4.209 - Planetary boundary-layer regime -0 0 Reserved -1 1 Stable -2 2 Mechanically driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.210.table b/definitions/grib2/tables/15/4.210.table index 524a6ca73..791878469 100644 --- a/definitions/grib2/tables/15/4.210.table +++ b/definitions/grib2/tables/15/4.210.table @@ -1,6 +1,6 @@ # Code table 4.210 - Contrail intensity -0 0 Contrail not present -1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.211.table b/definitions/grib2/tables/15/4.211.table index 098eb2d43..2a28a84d9 100644 --- a/definitions/grib2/tables/15/4.211.table +++ b/definitions/grib2/tables/15/4.211.table @@ -1,7 +1,7 @@ # Code table 4.211 - Contrail engine type -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.212.table b/definitions/grib2/tables/15/4.212.table index 1a085b88d..6a3dcf88c 100644 --- a/definitions/grib2/tables/15/4.212.table +++ b/definitions/grib2/tables/15/4.212.table @@ -1,18 +1,18 @@ # Code table 4.212 - Land use -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.213.table b/definitions/grib2/tables/15/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/15/4.213.table +++ b/definitions/grib2/tables/15/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.215.table b/definitions/grib2/tables/15/4.215.table index 034db72be..7888772d5 100644 --- a/definitions/grib2/tables/15/4.215.table +++ b/definitions/grib2/tables/15/4.215.table @@ -1,9 +1,9 @@ # Code table 4.215 - Remotely sensed snow coverage -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.216.table b/definitions/grib2/tables/15/4.216.table index 5d1460cef..b51b358f4 100644 --- a/definitions/grib2/tables/15/4.216.table +++ b/definitions/grib2/tables/15/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain -# 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 0-90 Elevation in increments of 100 m +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/15/4.217.table b/definitions/grib2/tables/15/4.217.table index a4452182c..a700410d5 100644 --- a/definitions/grib2/tables/15/4.217.table +++ b/definitions/grib2/tables/15/4.217.table @@ -1,8 +1,8 @@ # Code table 4.217 - Cloud mask type -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.218.table b/definitions/grib2/tables/15/4.218.table index bfca92f95..fdaa3ea31 100644 --- a/definitions/grib2/tables/15/4.218.table +++ b/definitions/grib2/tables/15/4.218.table @@ -1,38 +1,38 @@ # Code table 4.218 - Pixel scene type -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation/crops -15 15 Permanent snow/ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -# 19-96 Reserved -97 97 Snow/ice on land -98 98 Snow/ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud/fog/Stratus -102 102 Low cloud/Stratocumulus -103 103 Low cloud/unknown type -104 104 Medium cloud/Nimbostratus -105 105 Medium cloud/Altostratus -106 106 Medium cloud/unknown type -107 107 High cloud/Cumulus -108 108 High cloud/Cirrus -109 109 High cloud/unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation/crops +15 15 Permanent snow/ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +# 19-96 Reserved +97 97 Snow/ice on land +98 98 Snow/ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud/fog/Stratus +102 102 Low cloud/Stratocumulus +103 103 Low cloud/unknown type +104 104 Medium cloud/Nimbostratus +105 105 Medium cloud/Altostratus +106 106 Medium cloud/unknown type +107 107 High cloud/Cumulus +108 108 High cloud/Cirrus +109 109 High cloud/unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.219.table b/definitions/grib2/tables/15/4.219.table index 86df0522e..9979f50ad 100644 --- a/definitions/grib2/tables/15/4.219.table +++ b/definitions/grib2/tables/15/4.219.table @@ -1,8 +1,8 @@ # Code table 4.219 - Cloud top height quality indicator -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.220.table b/definitions/grib2/tables/15/4.220.table index 93e841f8b..88e869e42 100644 --- a/definitions/grib2/tables/15/4.220.table +++ b/definitions/grib2/tables/15/4.220.table @@ -1,6 +1,6 @@ # Code table 4.220 - Horizontal dimension processed -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.221.table b/definitions/grib2/tables/15/4.221.table index 8448533d7..011cc3518 100644 --- a/definitions/grib2/tables/15/4.221.table +++ b/definitions/grib2/tables/15/4.221.table @@ -1,6 +1,6 @@ # Code table 4.221 - Treatment of missing data -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.222.table b/definitions/grib2/tables/15/4.222.table index 57f113014..558d947ac 100644 --- a/definitions/grib2/tables/15/4.222.table +++ b/definitions/grib2/tables/15/4.222.table @@ -1,6 +1,6 @@ # Code table 4.222 - Categorical result -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.223.table b/definitions/grib2/tables/15/4.223.table index f0deb076a..572c4e7a8 100644 --- a/definitions/grib2/tables/15/4.223.table +++ b/definitions/grib2/tables/15/4.223.table @@ -1,5 +1,5 @@ # Code table 4.223 - Fire detection indicator -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing diff --git a/definitions/grib2/tables/15/4.224.table b/definitions/grib2/tables/15/4.224.table index e87cde4bb..014f56e23 100644 --- a/definitions/grib2/tables/15/4.224.table +++ b/definitions/grib2/tables/15/4.224.table @@ -1,18 +1,18 @@ # Code table 4.224 - Categorical outlook -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/15/4.227.table b/definitions/grib2/tables/15/4.227.table index 27c76553d..48c3b7633 100644 --- a/definitions/grib2/tables/15/4.227.table +++ b/definitions/grib2/tables/15/4.227.table @@ -1,9 +1,9 @@ # Code table 4.227 - Icing scenario (weather/cloud classification) -0 0 None -1 1 General -2 2 Convective -3 3 Stratiform -4 4 Freezing -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 None +1 1 General +2 2 Convective +3 3 Stratiform +4 4 Freezing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/15/4.234.table b/definitions/grib2/tables/15/4.234.table index 9844a91d2..d8b3715b3 100644 --- a/definitions/grib2/tables/15/4.234.table +++ b/definitions/grib2/tables/15/4.234.table @@ -1,21 +1,21 @@ # Code table 4.234 - Canopy cover fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Crops, mixed farming -2 2 Short grass -3 3 Evergreen needleleaf trees -4 4 Deciduous needleleaf trees -5 5 Deciduous broadleaf trees -6 6 Evergreen broadleaf trees -7 7 Tall grass -8 8 Desert -9 9 Tundra -10 10 Irrigated crops -11 11 Semidesert -12 12 Ice caps and glaciers -13 13 Bogs and marshes -14 14 Inland water -15 15 Ocean -16 16 Evergreen shrubs -17 17 Deciduous shrubs -18 18 Mixed forest -19 19 Interrupted forest -20 20 Water and land mixtures +1 1 Crops, mixed farming +2 2 Short grass +3 3 Evergreen needleleaf trees +4 4 Deciduous needleleaf trees +5 5 Deciduous broadleaf trees +6 6 Evergreen broadleaf trees +7 7 Tall grass +8 8 Desert +9 9 Tundra +10 10 Irrigated crops +11 11 Semidesert +12 12 Ice caps and glaciers +13 13 Bogs and marshes +14 14 Inland water +15 15 Ocean +16 16 Evergreen shrubs +17 17 Deciduous shrubs +18 18 Mixed forest +19 19 Interrupted forest +20 20 Water and land mixtures diff --git a/definitions/grib2/tables/15/4.236.table b/definitions/grib2/tables/15/4.236.table index 08c7f8d56..b667b65fc 100644 --- a/definitions/grib2/tables/15/4.236.table +++ b/definitions/grib2/tables/15/4.236.table @@ -1,8 +1,8 @@ # Code table 4.236 - Soil texture fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Coarse -2 2 Medium -3 3 Medium-fine -4 4 Fine -5 5 Very-fine -6 6 Organic -7 7 Tropical-organic +1 1 Coarse +2 2 Medium +3 3 Medium-fine +4 4 Fine +5 5 Very-fine +6 6 Organic +7 7 Tropical-organic diff --git a/definitions/grib2/tables/15/4.241.table b/definitions/grib2/tables/15/4.241.table index c0bd3e99e..6ce0a5ea7 100644 --- a/definitions/grib2/tables/15/4.241.table +++ b/definitions/grib2/tables/15/4.241.table @@ -1,9 +1,9 @@ # Code table 4.241 - Coverage attributes -0 0 Undefined -1 1 Unmodified -2 2 Snow covered -3 3 Flooded -4 4 Ice covered -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Undefined +1 1 Unmodified +2 2 Snow covered +3 3 Flooded +4 4 Ice covered +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.242.table b/definitions/grib2/tables/15/4.242.table index 083f88c29..f6865957c 100644 --- a/definitions/grib2/tables/15/4.242.table +++ b/definitions/grib2/tables/15/4.242.table @@ -1,7 +1,7 @@ # Code table 4.242 - Tile classification -0 0 Reserved -1 1 Land use classes according to ESA-GlobCover GCV2009 -2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 Reserved +1 1 Land use classes according to ESA-GlobCover GCV2009 +2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/15/4.243.table b/definitions/grib2/tables/15/4.243.table index b39053311..24d21b719 100644 --- a/definitions/grib2/tables/15/4.243.table +++ b/definitions/grib2/tables/15/4.243.table @@ -1,43 +1,43 @@ # Code table 4.243 - Tile class -0 0 Reserved -1 1 Evergreen broadleaved forest -2 2 Deciduous broadleaved closed forest -3 3 Deciduous broadleaved open forest -4 4 Evergreen needle-leaf forest -5 5 Deciduous needle-leaf forest -6 6 Mixed leaf trees -7 7 Freshwater flooded trees -8 8 Saline water flooded trees -9 9 Mosaic tree/natural vegetation -10 10 Burnt tree cover -11 11 Evergreen shrubs closed-open -12 12 Deciduous shrubs closed-open -13 13 Herbaceous vegetation closed-open -14 14 Sparse herbaceous or grass -15 15 Flooded shrubs or herbaceous -16 16 Cultivated and managed areas -17 17 Mosaic crop/tree/natural vegetation -18 18 Mosaic crop/shrub/grass -19 19 Bare areas -20 20 Water -21 21 Snow and ice -22 22 Artificial surface -23 23 Ocean -24 24 Irrigated croplands -25 25 Rainfed croplands -26 26 Mosaic cropland (50-70%) - vegetation (20-50%) -27 27 Mosaic vegetation (50-70%) - cropland (20-50%) -28 28 Closed broadleaved evergreen forest -29 29 Closed needle-leaved evergreen forest -30 30 Open needle-leaved deciduous forest -31 31 Mixed broadleaved and needle-leaved forest -32 32 Mosaic shrubland (50-70%) - grassland (20-50%) -33 33 Mosaic grassland (50-70%) - shrubland (20-50%) -34 34 Closed to open shrubland -35 35 Sparse vegetation -36 36 Closed to open forest regularly flooded -37 37 Closed forest or shrubland permanently flooded -38 38 Closed to open grassland regularly flooded -39 39 Undefined -# 40-32767 Reserved -# 32768- Reserved for local use +0 0 Reserved +1 1 Evergreen broadleaved forest +2 2 Deciduous broadleaved closed forest +3 3 Deciduous broadleaved open forest +4 4 Evergreen needle-leaf forest +5 5 Deciduous needle-leaf forest +6 6 Mixed leaf trees +7 7 Freshwater flooded trees +8 8 Saline water flooded trees +9 9 Mosaic tree/natural vegetation +10 10 Burnt tree cover +11 11 Evergreen shrubs closed-open +12 12 Deciduous shrubs closed-open +13 13 Herbaceous vegetation closed-open +14 14 Sparse herbaceous or grass +15 15 Flooded shrubs or herbaceous +16 16 Cultivated and managed areas +17 17 Mosaic crop/tree/natural vegetation +18 18 Mosaic crop/shrub/grass +19 19 Bare areas +20 20 Water +21 21 Snow and ice +22 22 Artificial surface +23 23 Ocean +24 24 Irrigated croplands +25 25 Rainfed croplands +26 26 Mosaic cropland (50-70%) - vegetation (20-50%) +27 27 Mosaic vegetation (50-70%) - cropland (20-50%) +28 28 Closed broadleaved evergreen forest +29 29 Closed needle-leaved evergreen forest +30 30 Open needle-leaved deciduous forest +31 31 Mixed broadleaved and needle-leaved forest +32 32 Mosaic shrubland (50-70%) - grassland (20-50%) +33 33 Mosaic grassland (50-70%) - shrubland (20-50%) +34 34 Closed to open shrubland +35 35 Sparse vegetation +36 36 Closed to open forest regularly flooded +37 37 Closed forest or shrubland permanently flooded +38 38 Closed to open grassland regularly flooded +39 39 Undefined +# 40-32767 Reserved +# 32768- Reserved for local use diff --git a/definitions/grib2/tables/15/4.3.table b/definitions/grib2/tables/15/4.3.table index f423af2bf..46e498c5f 100644 --- a/definitions/grib2/tables/15/4.3.table +++ b/definitions/grib2/tables/15/4.3.table @@ -1,20 +1,20 @@ # Code table 4.3 - Type of generating process -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -12 12 Post-processed analysis -13 13 Post-processed forecast -14 14 Nowcast -15 15 Hindcast -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +12 12 Post-processed analysis +13 13 Post-processed forecast +14 14 Nowcast +15 15 Hindcast +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.4.table b/definitions/grib2/tables/15/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/15/4.4.table +++ b/definitions/grib2/tables/15/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.5.table b/definitions/grib2/tables/15/4.5.table index f73733e88..d1a76825a 100644 --- a/definitions/grib2/tables/15/4.5.table +++ b/definitions/grib2/tables/15/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface 2 2 Cloud base level 3 3 Level of cloud tops @@ -12,11 +12,11 @@ 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) 12 12 Cumulonimbus (CB) top (m) -# 13-19 Reserved +# 13-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -25,18 +25,18 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level -112 112 Reserved -113 113 Logarithmic hybrid level +112 112 Reserved +113 113 Logarithmic hybrid level 114 114 Snow level (Numeric) -# 115-116 Reserved +# 115-116 Reserved 117 117 Mixed layer depth (m) 118 hhl Hybrid height level 119 hpl Hybrid pressure level -# 120-149 Reserved -150 150 Generalized vertical height coordinate -# 151-159 Reserved +# 120-149 Reserved +150 150 Generalized vertical height coordinate +# 151-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom @@ -47,17 +47,17 @@ 167 167 Bottom of root zone # 168-173 Reserved # 168-169 Reserved -174 sfc Top surface of ice on sea, lake or river -175 175 Top surface of ice, under snow cover, on sea, lake or river -176 176 Bottom surface (underside) ice on sea, lake or river -177 sfc Deep soil (of indefinite depth) -178 178 Reserved -179 179 Top surface of glacier ice and inland ice -180 180 Deep inland or glacier ice (of indefinite depth) -181 181 Grid tile land fraction as a model surface -182 182 Grid tile water fraction as a model surface -183 183 Grid tile ice fraction on sea, lake or river as a model surface -184 184 Grid tile glacier ice and inland ice fraction as a model surface -# 185-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +174 sfc Top surface of ice on sea, lake or river +175 175 Top surface of ice, under snow cover, on sea, lake or river +176 176 Bottom surface (underside) ice on sea, lake or river +177 sfc Deep soil (of indefinite depth) +178 178 Reserved +179 179 Top surface of glacier ice and inland ice +180 180 Deep inland or glacier ice (of indefinite depth) +181 181 Grid tile land fraction as a model surface +182 182 Grid tile water fraction as a model surface +183 183 Grid tile ice fraction on sea, lake or river as a model surface +184 184 Grid tile glacier ice and inland ice fraction as a model surface +# 185-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.6.table b/definitions/grib2/tables/15/4.6.table index b2dfeb498..ce799721d 100644 --- a/definitions/grib2/tables/15/4.6.table +++ b/definitions/grib2/tables/15/4.6.table @@ -1,9 +1,9 @@ # Code table 4.6 - Type of ensemble forecast -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.7.table b/definitions/grib2/tables/15/4.7.table index e0de0e1b2..69b2b4d77 100644 --- a/definitions/grib2/tables/15/4.7.table +++ b/definitions/grib2/tables/15/4.7.table @@ -1,14 +1,14 @@ # Code table 4.7 - Derived forecast -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.8.table b/definitions/grib2/tables/15/4.8.table index ad883039c..78467454a 100644 --- a/definitions/grib2/tables/15/4.8.table +++ b/definitions/grib2/tables/15/4.8.table @@ -1,6 +1,6 @@ # Code table 4.8 - Clustering method -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.9.table b/definitions/grib2/tables/15/4.9.table index 5878b5ad3..0ce312dd1 100644 --- a/definitions/grib2/tables/15/4.9.table +++ b/definitions/grib2/tables/15/4.9.table @@ -1,9 +1,9 @@ # Code table 4.9 - Probability type -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/4.91.table b/definitions/grib2/tables/15/4.91.table index 44cf25f44..ae31ed61c 100644 --- a/definitions/grib2/tables/15/4.91.table +++ b/definitions/grib2/tables/15/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit -11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit +11 11 Equal to first limit +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/15/5.0.table b/definitions/grib2/tables/15/5.0.table index 5ec77ed0f..2795336df 100644 --- a/definitions/grib2/tables/15/5.0.table +++ b/definitions/grib2/tables/15/5.0.table @@ -1,23 +1,23 @@ # Code table 5.0 - Data representation template number -0 0 Grid point data - simple packing -1 1 Matrix value at grid point - simple packing -2 2 Grid point data - complex packing -3 3 Grid point data - complex packing and spatial differencing -4 4 Grid point data - IEEE floating point data -40 40 Grid point data - JPEG 2000 code stream format -41 41 Grid point data - Portable Network Graphics (PNG) -# 42-49 Reserved -50 50 Spectral data - simple packing -51 51 Spherical harmonics data - complex packing -# 52-60 Reserved -61 61 Grid point data - simple packing with logarithm pre-processing -# 62-199 Reserved -200 200 Run length packing with level values -# 201-49151 Reserved -# 49152-65534 Reserved for local use +0 0 Grid point data - simple packing +1 1 Matrix value at grid point - simple packing +2 2 Grid point data - complex packing +3 3 Grid point data - complex packing and spatial differencing +4 4 Grid point data - IEEE floating point data +40 40 Grid point data - JPEG 2000 code stream format +41 41 Grid point data - Portable Network Graphics (PNG) +# 42-49 Reserved +50 50 Spectral data - simple packing +51 51 Spherical harmonics data - complex packing +# 52-60 Reserved +61 61 Grid point data - simple packing with logarithm pre-processing +# 62-199 Reserved +200 200 Run length packing with level values +# 201-49151 Reserved +# 49152-65534 Reserved for local use 40000 40000 JPEG2000 Packing 40010 40010 PNG pacling 50000 50000 Sperical harmonics ieee packing 50001 50001 Second order packing 50002 50002 Second order packing -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/15/5.1.table b/definitions/grib2/tables/15/5.1.table index 854330c74..1189b5e46 100644 --- a/definitions/grib2/tables/15/5.1.table +++ b/definitions/grib2/tables/15/5.1.table @@ -1,6 +1,6 @@ # Code table 5.1 - Type of original field values -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/5.2.table b/definitions/grib2/tables/15/5.2.table index 7a4500ecd..d12b46fbd 100644 --- a/definitions/grib2/tables/15/5.2.table +++ b/definitions/grib2/tables/15/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use +# 12-191 Reserved +# 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/15/5.3.table b/definitions/grib2/tables/15/5.3.table index c3b7b30fe..481331791 100644 --- a/definitions/grib2/tables/15/5.3.table +++ b/definitions/grib2/tables/15/5.3.table @@ -1,7 +1,7 @@ # Code table 5.3 - Matrix coordinate parameter -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/5.4.table b/definitions/grib2/tables/15/5.4.table index 8121c1819..e84ab1901 100644 --- a/definitions/grib2/tables/15/5.4.table +++ b/definitions/grib2/tables/15/5.4.table @@ -1,6 +1,6 @@ # Code table 5.4 - Group splitting method -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/5.40.table b/definitions/grib2/tables/15/5.40.table index b9bad2c39..97e8880ab 100644 --- a/definitions/grib2/tables/15/5.40.table +++ b/definitions/grib2/tables/15/5.40.table @@ -1,5 +1,5 @@ # Code table 5.40 - Type of compression -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/15/5.5.table b/definitions/grib2/tables/15/5.5.table index 3ef3eb070..f2316975a 100644 --- a/definitions/grib2/tables/15/5.5.table +++ b/definitions/grib2/tables/15/5.5.table @@ -1,7 +1,7 @@ # Code table 5.5 - Missing value management for complex packing -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/5.6.table b/definitions/grib2/tables/15/5.6.table index 6d5177877..db68ead9c 100644 --- a/definitions/grib2/tables/15/5.6.table +++ b/definitions/grib2/tables/15/5.6.table @@ -1,7 +1,7 @@ # Code table 5.6 - Order of spatial differencing -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/15/5.7.table b/definitions/grib2/tables/15/5.7.table index 5ab780056..e54862c19 100644 --- a/definitions/grib2/tables/15/5.7.table +++ b/definitions/grib2/tables/15/5.7.table @@ -1,7 +1,7 @@ # Code table 5.7 - Precision of floating-point numbers -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/15/6.0.table b/definitions/grib2/tables/15/6.0.table index f539b26d7..a8f30f5a4 100644 --- a/definitions/grib2/tables/15/6.0.table +++ b/definitions/grib2/tables/15/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator 0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/16/0.0.table b/definitions/grib2/tables/16/0.0.table index b24c50564..2c5afceb4 100644 --- a/definitions/grib2/tables/16/0.0.table +++ b/definitions/grib2/tables/16/0.0.table @@ -1,10 +1,10 @@ # Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/1.1.table b/definitions/grib2/tables/16/1.1.table index d50f8fd72..f6d332005 100644 --- a/definitions/grib2/tables/16/1.1.table +++ b/definitions/grib2/tables/16/1.1.table @@ -1,4 +1,4 @@ # Code table 1.1 - GRIB local tables version number -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/16/1.2.table b/definitions/grib2/tables/16/1.2.table index 934b70455..638f1efbb 100644 --- a/definitions/grib2/tables/16/1.2.table +++ b/definitions/grib2/tables/16/1.2.table @@ -1,8 +1,8 @@ # Code table 1.2 - Significance of reference time -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/1.3.table b/definitions/grib2/tables/16/1.3.table index 6f061bf42..e7197fcb2 100644 --- a/definitions/grib2/tables/16/1.3.table +++ b/definitions/grib2/tables/16/1.3.table @@ -1,14 +1,14 @@ # Code table 1.3 - Production status of data -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products 4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) 5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) 6 6 S2S operational products 7 7 S2S test products 8 8 Uncertainties in ensembles of regional reanalysis project (UERRA) 9 9 Uncertainties in ensembles of regional reanalysis project test (UERRA) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/1.4.table b/definitions/grib2/tables/16/1.4.table index 03203d874..877288c0e 100644 --- a/definitions/grib2/tables/16/1.4.table +++ b/definitions/grib2/tables/16/1.4.table @@ -1,13 +1,13 @@ # Code table 1.4 - Type of data -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/16/1.5.table b/definitions/grib2/tables/16/1.5.table index b2cf9f087..533111959 100644 --- a/definitions/grib2/tables/16/1.5.table +++ b/definitions/grib2/tables/16/1.5.table @@ -1,7 +1,7 @@ # Code table 1.5 - Identification template number -0 0 Calendar definition -1 1 Paleontological offset -2 2 Calendar definition and paleontological offset -# 3-32767 Reserved -# 32768-65534 Reserved for local use -65535 65535 Missing +0 0 Calendar definition +1 1 Paleontological offset +2 2 Calendar definition and paleontological offset +# 3-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/16/1.6.table b/definitions/grib2/tables/16/1.6.table index 5db921990..bd46899a7 100644 --- a/definitions/grib2/tables/16/1.6.table +++ b/definitions/grib2/tables/16/1.6.table @@ -1,8 +1,8 @@ # Code table 1.6 - Type of calendar -0 0 Gregorian -1 1 360-day -2 2 365-day -3 3 Proleptic Gregorian -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Gregorian +1 1 360-day +2 2 365-day +3 3 Proleptic Gregorian +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/3.0.table b/definitions/grib2/tables/16/3.0.table index 45187b80d..a442a06a0 100644 --- a/definitions/grib2/tables/16/3.0.table +++ b/definitions/grib2/tables/16/3.0.table @@ -1,6 +1,6 @@ # Code table 3.0 - Source of grid definition -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/16/3.10.table b/definitions/grib2/tables/16/3.10.table index afa8843a7..1612d05e3 100644 --- a/definitions/grib2/tables/16/3.10.table +++ b/definitions/grib2/tables/16/3.10.table @@ -1,8 +1,8 @@ # Flag table 3.10 - Scanning mode for one diamond -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/16/3.11.table b/definitions/grib2/tables/16/3.11.table index e516a2ab9..06ae10810 100644 --- a/definitions/grib2/tables/16/3.11.table +++ b/definitions/grib2/tables/16/3.11.table @@ -1,7 +1,7 @@ # Code table 3.11 - Interpretation of list of numbers at end of section 3 -0 0 There is no appended list -1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows -2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row -3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) -# 4-254 Reserved -255 255 Missing +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/16/3.15.table b/definitions/grib2/tables/16/3.15.table index 331217ebe..6087902a3 100644 --- a/definitions/grib2/tables/16/3.15.table +++ b/definitions/grib2/tables/16/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/3.2.table b/definitions/grib2/tables/16/3.2.table index 9238dc2a7..b9574a424 100644 --- a/definitions/grib2/tables/16/3.2.table +++ b/definitions/grib2/tables/16/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame -9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/3.20.table b/definitions/grib2/tables/16/3.20.table index efbf08d19..e2bb156ee 100644 --- a/definitions/grib2/tables/16/3.20.table +++ b/definitions/grib2/tables/16/3.20.table @@ -1,6 +1,6 @@ # Code table 3.20 - Type of horizontal line -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/3.21.table b/definitions/grib2/tables/16/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/16/3.21.table +++ b/definitions/grib2/tables/16/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/3.3.table b/definitions/grib2/tables/16/3.3.table index 5dd7c7001..25cb46a1d 100644 --- a/definitions/grib2/tables/16/3.3.table +++ b/definitions/grib2/tables/16/3.3.table @@ -1,9 +1,9 @@ # Flag table 3.3 - Resolution and component flags -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/16/3.4.table b/definitions/grib2/tables/16/3.4.table index 897b813d7..43835c014 100644 --- a/definitions/grib2/tables/16/3.4.table +++ b/definitions/grib2/tables/16/3.4.table @@ -1,17 +1,17 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -5 0 Points within odd rows are not offset in i (x) direction -5 1 Points within odd rows are offset by Di/2 in i (x) direction -6 0 Points within even rows are not offset in i (x) direction -6 1 Points within even rows are offset by Di/2 in i (x) direction -7 0 Points are not offset in j (y) direction -7 1 Points are offset by Dj/2 in j (y) direction -8 0 Rows have Ni grid points and columns have Nj grid points -8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +5 0 Points within odd rows are not offset in i (x) direction +5 1 Points within odd rows are offset by Di/2 in i (x) direction +6 0 Points within even rows are not offset in i (x) direction +6 1 Points within even rows are offset by Di/2 in i (x) direction +7 0 Points are not offset in j (y) direction +7 1 Points are offset by Dj/2 in j (y) direction +8 0 Rows have Ni grid points and columns have Nj grid points +8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction diff --git a/definitions/grib2/tables/16/3.5.table b/definitions/grib2/tables/16/3.5.table index eabdde896..2f8ec82e3 100644 --- a/definitions/grib2/tables/16/3.5.table +++ b/definitions/grib2/tables/16/3.5.table @@ -1,5 +1,5 @@ # Flag table 3.5 - Projection centre -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/16/3.7.table b/definitions/grib2/tables/16/3.7.table index 0a7d6efde..34c0de085 100644 --- a/definitions/grib2/tables/16/3.7.table +++ b/definitions/grib2/tables/16/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 see separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/16/3.8.table b/definitions/grib2/tables/16/3.8.table index 844e74235..578fab37f 100644 --- a/definitions/grib2/tables/16/3.8.table +++ b/definitions/grib2/tables/16/3.8.table @@ -1,7 +1,7 @@ # Code table 3.8 - Grid point position -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/3.9.table b/definitions/grib2/tables/16/3.9.table index fd730bc64..ecd65514a 100644 --- a/definitions/grib2/tables/16/3.9.table +++ b/definitions/grib2/tables/16/3.9.table @@ -1,4 +1,4 @@ # Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/16/4.0.table b/definitions/grib2/tables/16/4.0.table index 05bf24330..eef83c7c3 100644 --- a/definitions/grib2/tables/16/4.0.table +++ b/definitions/grib2/tables/16/4.0.table @@ -1,65 +1,65 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time -8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -# 35-39 Reserved +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data +# 35-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol -46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -# 49-50 Reserved -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time -52 52 Reserved -53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time -54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters -55 55 Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time -56 56 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters -57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function -# 58-59 Reserved -60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval -# 62-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non continuous time interval for aerosol +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +# 49-50 Reserved +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +52 52 Reserved +53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time +54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters +55 55 Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time +56 56 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters +57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function +# 58-59 Reserved +60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval +# 62-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved -# 32768-65534 Reserved for local use +# 1102-32767 Reserved +# 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/16/4.1.0.table b/definitions/grib2/tables/16/4.1.0.table index 04cfd7802..df58636d6 100644 --- a/definitions/grib2/tables/16/4.1.0.table +++ b/definitions/grib2/tables/16/4.1.0.table @@ -1,27 +1,27 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.1.1.table b/definitions/grib2/tables/16/4.1.1.table index 7b22b6fed..05a854da0 100644 --- a/definitions/grib2/tables/16/4.1.1.table +++ b/definitions/grib2/tables/16/4.1.1.table @@ -1,7 +1,7 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.1.10.table b/definitions/grib2/tables/16/4.1.10.table index a9b20eb9c..88d3c8743 100644 --- a/definitions/grib2/tables/16/4.1.10.table +++ b/definitions/grib2/tables/16/4.1.10.table @@ -1,10 +1,10 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Subsurface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Subsurface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.1.2.table b/definitions/grib2/tables/16/4.1.2.table index 5b488fe9e..e74126645 100644 --- a/definitions/grib2/tables/16/4.1.2.table +++ b/definitions/grib2/tables/16/4.1.2.table @@ -1,9 +1,9 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.1.3.table b/definitions/grib2/tables/16/4.1.3.table index d2baa1362..210b39fd5 100644 --- a/definitions/grib2/tables/16/4.1.3.table +++ b/definitions/grib2/tables/16/4.1.3.table @@ -1,11 +1,11 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Image format products -1 1 Quantitative products -2 2 Cloud properties -3 3 Flight rules conditions -4 4 Volcanic ash -5 5 Sea surface temperature -6 6 Solar radiation -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +2 2 Cloud properties +3 3 Flight rules conditions +4 4 Volcanic ash +5 5 Sea surface temperature +6 6 Solar radiation +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.10.table b/definitions/grib2/tables/16/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/16/4.10.table +++ b/definitions/grib2/tables/16/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/16/4.11.table b/definitions/grib2/tables/16/4.11.table index 7f404c849..01cc81303 100644 --- a/definitions/grib2/tables/16/4.11.table +++ b/definitions/grib2/tables/16/4.11.table @@ -1,10 +1,10 @@ # Code table 4.11 - Type of time intervals -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.12.table b/definitions/grib2/tables/16/4.12.table index 03fd89b36..d42b47e96 100644 --- a/definitions/grib2/tables/16/4.12.table +++ b/definitions/grib2/tables/16/4.12.table @@ -1,7 +1,7 @@ # Code table 4.12 - Operating mode -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.13.table b/definitions/grib2/tables/16/4.13.table index c92854eec..a0e28eac8 100644 --- a/definitions/grib2/tables/16/4.13.table +++ b/definitions/grib2/tables/16/4.13.table @@ -1,6 +1,6 @@ # Code table 4.13 - Quality control indicator -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.14.table b/definitions/grib2/tables/16/4.14.table index a88cb93fa..d525b23b3 100644 --- a/definitions/grib2/tables/16/4.14.table +++ b/definitions/grib2/tables/16/4.14.table @@ -1,6 +1,6 @@ # Code table 4.14 - Clutter filter indicator -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.15.table b/definitions/grib2/tables/16/4.15.table index 2e5f3dea3..7adddedb6 100644 --- a/definitions/grib2/tables/16/4.15.table +++ b/definitions/grib2/tables/16/4.15.table @@ -1,11 +1,11 @@ # Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.0.table b/definitions/grib2/tables/16/4.2.0.0.table index cfadd2d07..3a285255f 100644 --- a/definitions/grib2/tables/16/4.2.0.0.table +++ b/definitions/grib2/tables/16/4.2.0.0.table @@ -27,6 +27,6 @@ 25 25 Temperature tendency due to long-wave radiation, clear sky (K s-1) 26 26 Temperature tendency due to parameterizations (K s-1) 27 27 Wet bulb temperature (K) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.1.table b/definitions/grib2/tables/16/4.2.0.1.table index 775cfe54f..1ecbf240a 100644 --- a/definitions/grib2/tables/16/4.2.0.1.table +++ b/definitions/grib2/tables/16/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,7 +86,7 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) @@ -106,6 +106,6 @@ 106 106 Number density of graupel (m-3) 107 107 Number density of hail (m-3) 108 108 Specific humidity tendency due to parameterizations (kg kg-1 s-1) -# 109-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 109-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.13.table b/definitions/grib2/tables/16/4.2.0.13.table index 5086101ad..3f5c30675 100644 --- a/definitions/grib2/tables/16/4.2.0.13.table +++ b/definitions/grib2/tables/16/4.2.0.13.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.14.table b/definitions/grib2/tables/16/4.2.0.14.table index 215884737..97fb38c8b 100644 --- a/definitions/grib2/tables/16/4.2.0.14.table +++ b/definitions/grib2/tables/16/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.15.table b/definitions/grib2/tables/16/4.2.0.15.table index dfbc4d12f..8df082466 100644 --- a/definitions/grib2/tables/16/4.2.0.15.table +++ b/definitions/grib2/tables/16/4.2.0.15.table @@ -16,6 +16,6 @@ 14 14 Reflectivity of hail (dB) 15 15 Hybrid scan reflectivity (dB) 16 16 Hybrid scan reflectivity height (m) -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.16.table b/definitions/grib2/tables/16/4.2.0.16.table index 0c240a853..9499d9333 100644 --- a/definitions/grib2/tables/16/4.2.0.16.table +++ b/definitions/grib2/tables/16/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.18.table b/definitions/grib2/tables/16/4.2.0.18.table index 18c41aa48..7e0a736eb 100644 --- a/definitions/grib2/tables/16/4.2.0.18.table +++ b/definitions/grib2/tables/16/4.2.0.18.table @@ -8,11 +8,11 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) 13 13 Total deposition (wet + dry) (Bq m-2) -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.19.table b/definitions/grib2/tables/16/4.2.0.19.table index ec2b9823d..e51b670a0 100644 --- a/definitions/grib2/tables/16/4.2.0.19.table +++ b/definitions/grib2/tables/16/4.2.0.19.table @@ -28,6 +28,6 @@ 26 26 Convective outlook (Code table 4.224) 27 27 Icing scenario (Code table 4.227) 28 28 Mountain wave turbulence (eddy dissipation rate) (m2/3 s-1) -# 29-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 29-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.190.table b/definitions/grib2/tables/16/4.2.0.190.table index de621a924..a0d6ba0ac 100644 --- a/definitions/grib2/tables/16/4.2.0.190.table +++ b/definitions/grib2/tables/16/4.2.0.190.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.191.table b/definitions/grib2/tables/16/4.2.0.191.table index e3bba0ebe..b3a7092ea 100644 --- a/definitions/grib2/tables/16/4.2.0.191.table +++ b/definitions/grib2/tables/16/4.2.0.191.table @@ -3,6 +3,6 @@ 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.2.table b/definitions/grib2/tables/16/4.2.0.2.table index 46b0774aa..906cf6205 100644 --- a/definitions/grib2/tables/16/4.2.0.2.table +++ b/definitions/grib2/tables/16/4.2.0.2.table @@ -44,6 +44,6 @@ 42 42 v-component of geostrophic wind (m s-1) 43 43 Geostrophic wind direction (degree true) 44 44 Geostrophic wind speed (m s-1) -# 45-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 45-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.20.table b/definitions/grib2/tables/16/4.2.0.20.table index 9584f7c7f..df9ccc184 100644 --- a/definitions/grib2/tables/16/4.2.0.20.table +++ b/definitions/grib2/tables/16/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -25,7 +25,7 @@ 57 57 Total yearly average burden of the atmosphere (mol) 58 58 Total yearly averaged atmospheric loss (mol/s) 59 59 Aerosol number concentration (m-3) -# 60-99 Reserved +# 60-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -37,6 +37,6 @@ 108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) 109 109 Aerosol lidar extinction from satellite (/m) 110 110 Aerosol lidar extinction from the ground (/m) -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.3.table b/definitions/grib2/tables/16/4.2.0.3.table index c7c6359d4..17e7f204f 100644 --- a/definitions/grib2/tables/16/4.2.0.3.table +++ b/definitions/grib2/tables/16/4.2.0.3.table @@ -30,6 +30,6 @@ 28 28 Downdraught mass flux (kg m-2 s-1) 29 29 Updraught detrainment rate (kg m-3 s-1) 30 30 Downdraught detrainment rate (kg m-3 s-1) -# 31-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 31-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.4.table b/definitions/grib2/tables/16/4.2.0.4.table index bd37ea3f5..da327a450 100644 --- a/definitions/grib2/tables/16/4.2.0.4.table +++ b/definitions/grib2/tables/16/4.2.0.4.table @@ -14,9 +14,9 @@ 12 12 Downward UV radiation (W m-2) 13 13 Direct short wave radiation flux (W m-2) 14 14 Diffuse short wave radiation flux (W m-2) -# 15-49 Reserved +# 15-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) -# 52-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.5.table b/definitions/grib2/tables/16/4.2.0.5.table index 932a12fbd..b9084509a 100644 --- a/definitions/grib2/tables/16/4.2.0.5.table +++ b/definitions/grib2/tables/16/4.2.0.5.table @@ -7,6 +7,6 @@ 5 5 Net long-wave radiation flux (W m-2) 6 6 Net long-wave radiation flux, clear sky (W m-2) 7 7 Brightness temperature (K) -# 8-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.6.table b/definitions/grib2/tables/16/4.2.0.6.table index 4cec0c8aa..0450ec194 100644 --- a/definitions/grib2/tables/16/4.2.0.6.table +++ b/definitions/grib2/tables/16/4.2.0.6.table @@ -40,10 +40,10 @@ 38 38 Mass density of cloud droplets (kg m-3) 39 39 Mass density of cloud ice (kg m-3) 40 40 Mass density of convective cloud water droplets (kg m-3) -# 41-46 Reserved +# 41-46 Reserved 47 47 Volume fraction of cloud water droplets (Numeric) 48 48 Volume fraction of cloud ice particles (Numeric) 49 49 Volume fraction of cloud (ice and/or water) (Numeric) -# 50-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 50-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.0.7.table b/definitions/grib2/tables/16/4.2.0.7.table index 23a1a82da..2bf21255d 100644 --- a/definitions/grib2/tables/16/4.2.0.7.table +++ b/definitions/grib2/tables/16/4.2.0.7.table @@ -13,11 +13,11 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraft helicity (m2 s-2) 16 16 Bulk Richardson number (Numeric) 17 17 Gradient Richardson number (Numeric) 18 18 Flux Richardson number (Numeric) -# 19-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 19-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.1.0.table b/definitions/grib2/tables/16/4.2.1.0.table index 74c95f57b..e6f23655a 100644 --- a/definitions/grib2/tables/16/4.2.1.0.table +++ b/definitions/grib2/tables/16/4.2.1.0.table @@ -15,6 +15,6 @@ 13 13 Depth of water on soil surface (kg m-2) 14 14 Upstream accumulated precipitation (kg m-2) 15 15 Upstream accumulated snow melt (kg m-2) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.1.1.table b/definitions/grib2/tables/16/4.2.1.1.table index b488eb0bd..171da3958 100644 --- a/definitions/grib2/tables/16/4.2.1.1.table +++ b/definitions/grib2/tables/16/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.10.0.table b/definitions/grib2/tables/16/4.2.10.0.table index 095f51bdf..3611abd9a 100644 --- a/definitions/grib2/tables/16/4.2.10.0.table +++ b/definitions/grib2/tables/16/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea-surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (/s) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.10.1.table b/definitions/grib2/tables/16/4.2.10.1.table index 5959bfa28..f0a073c00 100644 --- a/definitions/grib2/tables/16/4.2.10.1.table +++ b/definitions/grib2/tables/16/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.10.191.table b/definitions/grib2/tables/16/4.2.10.191.table index 524929e78..1ebf85006 100644 --- a/definitions/grib2/tables/16/4.2.10.191.table +++ b/definitions/grib2/tables/16/4.2.10.191.table @@ -1,8 +1,8 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -2 2 Reserved +2 2 Reserved 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.10.2.table b/definitions/grib2/tables/16/4.2.10.2.table index 6797062ac..4633bad4f 100644 --- a/definitions/grib2/tables/16/4.2.10.2.table +++ b/definitions/grib2/tables/16/4.2.10.2.table @@ -12,6 +12,6 @@ 10 10 Zonal vector component of vertically integrated ice internal pressure (Pa m) 11 11 Meridional vector component of vertically integrated ice internal pressure (Pa m) 12 12 Compressive ice strength (N/m) -# 13-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 13-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.10.3.table b/definitions/grib2/tables/16/4.2.10.3.table index f951bbe78..937720c93 100644 --- a/definitions/grib2/tables/16/4.2.10.3.table +++ b/definitions/grib2/tables/16/4.2.10.3.table @@ -1,6 +1,6 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.10.4.table b/definitions/grib2/tables/16/4.2.10.4.table index 54774f1b7..d5615ae26 100644 --- a/definitions/grib2/tables/16/4.2.10.4.table +++ b/definitions/grib2/tables/16/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2/s) 6 6 Ocean vertical momentum diffusivity (m2/s) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (/m) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.2.0.table b/definitions/grib2/tables/16/4.2.2.0.table index 81548840c..b253cac22 100644 --- a/definitions/grib2/tables/16/4.2.2.0.table +++ b/definitions/grib2/tables/16/4.2.2.0.table @@ -38,6 +38,6 @@ 36 36 Tile fraction (Proportion) 37 37 Tile percentage (%) 38 38 Soil volumetric ice content (water equivalent) (m3 m-3) -# 39-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 39-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.2.3.table b/definitions/grib2/tables/16/4.2.2.3.table index dff2f7953..6cb8eb7af 100644 --- a/definitions/grib2/tables/16/4.2.2.3.table +++ b/definitions/grib2/tables/16/4.2.2.3.table @@ -25,6 +25,6 @@ 23 23 Liquid water in snow pack (kg m-2) 24 24 Frost index (K day-1) 25 25 Snow depth at elevation bands (kg m-2) -# 26-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 26-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.2.4.table b/definitions/grib2/tables/16/4.2.2.4.table index b9383fe10..cb3db6f78 100644 --- a/definitions/grib2/tables/16/4.2.2.4.table +++ b/definitions/grib2/tables/16/4.2.2.4.table @@ -11,6 +11,6 @@ 9 9 Initial fire spread index (Canadian forest service) (Numeric) 10 10 Fire build up index (Canadian forest service) (Numeric) 11 11 Fire daily severity rating (Canadian forest service) (Numeric) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.3.0.table b/definitions/grib2/tables/16/4.2.3.0.table index c0ffa29f5..80a829673 100644 --- a/definitions/grib2/tables/16/4.2.3.0.table +++ b/definitions/grib2/tables/16/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.2.3.1.table b/definitions/grib2/tables/16/4.2.3.1.table index 75911ee32..04cdde1f1 100644 --- a/definitions/grib2/tables/16/4.2.3.1.table +++ b/definitions/grib2/tables/16/4.2.3.1.table @@ -17,16 +17,16 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) -20 20 Aerosol optical thickness at 0.635 um -21 21 Aerosol optical thickness at 0.810 um -22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-26 Reserved +20 20 Aerosol optical thickness at 0.635 um +21 21 Aerosol optical thickness at 0.810 um +22 22 Aerosol optical thickness at 1.640 um +23 23 Angstrom coefficient +# 24-26 Reserved 27 27 Bidirectional reflectance factor (Numeric) 28 28 Brightness temperature (K) 29 29 Scaled radiance (Numeric) -# 30-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 30-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.201.table b/definitions/grib2/tables/16/4.201.table index 47f1b486f..fa173c4e0 100644 --- a/definitions/grib2/tables/16/4.201.table +++ b/definitions/grib2/tables/16/4.201.table @@ -1,15 +1,15 @@ # Code table 4.201 - Precipitation type -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow -6 6 Wet snow -7 7 Mixture of rain and snow -8 8 Ice pellets -9 9 Graupel -10 10 Hail -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +6 6 Wet snow +7 7 Mixture of rain and snow +8 8 Ice pellets +9 9 Graupel +10 10 Hail +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.202.table b/definitions/grib2/tables/16/4.202.table index 438502ff9..7f3c8f6cf 100644 --- a/definitions/grib2/tables/16/4.202.table +++ b/definitions/grib2/tables/16/4.202.table @@ -1,4 +1,4 @@ # Code table 4.202 - Precipitable water category -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.203.table b/definitions/grib2/tables/16/4.203.table index 8a9aedf7a..cf5eb6bdc 100644 --- a/definitions/grib2/tables/16/4.203.table +++ b/definitions/grib2/tables/16/4.203.table @@ -1,26 +1,26 @@ # Code table 4.203 - Cloud type -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.204.table b/definitions/grib2/tables/16/4.204.table index 91bcf1814..ffbd89502 100644 --- a/definitions/grib2/tables/16/4.204.table +++ b/definitions/grib2/tables/16/4.204.table @@ -1,9 +1,9 @@ # Code table 4.204 - Thunderstorm coverage -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (16-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (16-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.205.table b/definitions/grib2/tables/16/4.205.table index 5b4484dfd..c40c7f47b 100644 --- a/definitions/grib2/tables/16/4.205.table +++ b/definitions/grib2/tables/16/4.205.table @@ -1,6 +1,6 @@ # Code table 4.205 - Presence of aerosol -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.206.table b/definitions/grib2/tables/16/4.206.table index 02c3dfdf9..76472c261 100644 --- a/definitions/grib2/tables/16/4.206.table +++ b/definitions/grib2/tables/16/4.206.table @@ -1,6 +1,6 @@ # Code table 4.206 - Volcanic ash -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.207.table b/definitions/grib2/tables/16/4.207.table index 8ddb2e048..b6392fca0 100644 --- a/definitions/grib2/tables/16/4.207.table +++ b/definitions/grib2/tables/16/4.207.table @@ -1,10 +1,10 @@ # Code table 4.207 - Icing -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.208.table b/definitions/grib2/tables/16/4.208.table index b83685a1a..4361d38c0 100644 --- a/definitions/grib2/tables/16/4.208.table +++ b/definitions/grib2/tables/16/4.208.table @@ -1,9 +1,9 @@ # Code table 4.208 - Turbulence -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.209.table b/definitions/grib2/tables/16/4.209.table index cb7617071..39ea549ac 100644 --- a/definitions/grib2/tables/16/4.209.table +++ b/definitions/grib2/tables/16/4.209.table @@ -1,9 +1,9 @@ # Code table 4.209 - Planetary boundary-layer regime -0 0 Reserved -1 1 Stable -2 2 Mechanically driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.210.table b/definitions/grib2/tables/16/4.210.table index 524a6ca73..791878469 100644 --- a/definitions/grib2/tables/16/4.210.table +++ b/definitions/grib2/tables/16/4.210.table @@ -1,6 +1,6 @@ # Code table 4.210 - Contrail intensity -0 0 Contrail not present -1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.211.table b/definitions/grib2/tables/16/4.211.table index 098eb2d43..2a28a84d9 100644 --- a/definitions/grib2/tables/16/4.211.table +++ b/definitions/grib2/tables/16/4.211.table @@ -1,7 +1,7 @@ # Code table 4.211 - Contrail engine type -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.212.table b/definitions/grib2/tables/16/4.212.table index 1a085b88d..6a3dcf88c 100644 --- a/definitions/grib2/tables/16/4.212.table +++ b/definitions/grib2/tables/16/4.212.table @@ -1,18 +1,18 @@ # Code table 4.212 - Land use -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.213.table b/definitions/grib2/tables/16/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/16/4.213.table +++ b/definitions/grib2/tables/16/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.215.table b/definitions/grib2/tables/16/4.215.table index 034db72be..7888772d5 100644 --- a/definitions/grib2/tables/16/4.215.table +++ b/definitions/grib2/tables/16/4.215.table @@ -1,9 +1,9 @@ # Code table 4.215 - Remotely sensed snow coverage -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.216.table b/definitions/grib2/tables/16/4.216.table index 5d1460cef..b51b358f4 100644 --- a/definitions/grib2/tables/16/4.216.table +++ b/definitions/grib2/tables/16/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain -# 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 0-90 Elevation in increments of 100 m +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/16/4.217.table b/definitions/grib2/tables/16/4.217.table index a4452182c..a700410d5 100644 --- a/definitions/grib2/tables/16/4.217.table +++ b/definitions/grib2/tables/16/4.217.table @@ -1,8 +1,8 @@ # Code table 4.217 - Cloud mask type -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.218.table b/definitions/grib2/tables/16/4.218.table index c585bed96..0ad5f49ee 100644 --- a/definitions/grib2/tables/16/4.218.table +++ b/definitions/grib2/tables/16/4.218.table @@ -1,44 +1,44 @@ # Code table 4.218 - Pixel scene type -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation/crops -15 15 Permanent snow/ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -19 19 Warm liquid water cloud -20 20 Supercooled liquid water cloud -21 21 Mixed phase cloud -22 22 Optically thin ice cloud -23 23 Optically thick ice cloud -24 24 Multi-layered cloud -# 25-96 Reserved -97 97 Snow/ice on land -98 98 Snow/ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud/fog/Stratus -102 102 Low cloud/Stratocumulus -103 103 Low cloud/unknown type -104 104 Medium cloud/Nimbostratus -105 105 Medium cloud/Altostratus -106 106 Medium cloud/unknown type -107 107 High cloud/Cumulus -108 108 High cloud/Cirrus -109 109 High cloud/unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation/crops +15 15 Permanent snow/ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +19 19 Warm liquid water cloud +20 20 Supercooled liquid water cloud +21 21 Mixed phase cloud +22 22 Optically thin ice cloud +23 23 Optically thick ice cloud +24 24 Multi-layered cloud +# 25-96 Reserved +97 97 Snow/ice on land +98 98 Snow/ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud/fog/Stratus +102 102 Low cloud/Stratocumulus +103 103 Low cloud/unknown type +104 104 Medium cloud/Nimbostratus +105 105 Medium cloud/Altostratus +106 106 Medium cloud/unknown type +107 107 High cloud/Cumulus +108 108 High cloud/Cirrus +109 109 High cloud/unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.219.table b/definitions/grib2/tables/16/4.219.table index 86df0522e..9979f50ad 100644 --- a/definitions/grib2/tables/16/4.219.table +++ b/definitions/grib2/tables/16/4.219.table @@ -1,8 +1,8 @@ # Code table 4.219 - Cloud top height quality indicator -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.220.table b/definitions/grib2/tables/16/4.220.table index 93e841f8b..88e869e42 100644 --- a/definitions/grib2/tables/16/4.220.table +++ b/definitions/grib2/tables/16/4.220.table @@ -1,6 +1,6 @@ # Code table 4.220 - Horizontal dimension processed -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.221.table b/definitions/grib2/tables/16/4.221.table index 8448533d7..011cc3518 100644 --- a/definitions/grib2/tables/16/4.221.table +++ b/definitions/grib2/tables/16/4.221.table @@ -1,6 +1,6 @@ # Code table 4.221 - Treatment of missing data -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.222.table b/definitions/grib2/tables/16/4.222.table index 57f113014..558d947ac 100644 --- a/definitions/grib2/tables/16/4.222.table +++ b/definitions/grib2/tables/16/4.222.table @@ -1,6 +1,6 @@ # Code table 4.222 - Categorical result -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.223.table b/definitions/grib2/tables/16/4.223.table index f0deb076a..572c4e7a8 100644 --- a/definitions/grib2/tables/16/4.223.table +++ b/definitions/grib2/tables/16/4.223.table @@ -1,5 +1,5 @@ # Code table 4.223 - Fire detection indicator -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing diff --git a/definitions/grib2/tables/16/4.224.table b/definitions/grib2/tables/16/4.224.table index e87cde4bb..014f56e23 100644 --- a/definitions/grib2/tables/16/4.224.table +++ b/definitions/grib2/tables/16/4.224.table @@ -1,18 +1,18 @@ # Code table 4.224 - Categorical outlook -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/16/4.227.table b/definitions/grib2/tables/16/4.227.table index 27c76553d..48c3b7633 100644 --- a/definitions/grib2/tables/16/4.227.table +++ b/definitions/grib2/tables/16/4.227.table @@ -1,9 +1,9 @@ # Code table 4.227 - Icing scenario (weather/cloud classification) -0 0 None -1 1 General -2 2 Convective -3 3 Stratiform -4 4 Freezing -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 None +1 1 General +2 2 Convective +3 3 Stratiform +4 4 Freezing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/16/4.234.table b/definitions/grib2/tables/16/4.234.table index 9844a91d2..d8b3715b3 100644 --- a/definitions/grib2/tables/16/4.234.table +++ b/definitions/grib2/tables/16/4.234.table @@ -1,21 +1,21 @@ # Code table 4.234 - Canopy cover fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Crops, mixed farming -2 2 Short grass -3 3 Evergreen needleleaf trees -4 4 Deciduous needleleaf trees -5 5 Deciduous broadleaf trees -6 6 Evergreen broadleaf trees -7 7 Tall grass -8 8 Desert -9 9 Tundra -10 10 Irrigated crops -11 11 Semidesert -12 12 Ice caps and glaciers -13 13 Bogs and marshes -14 14 Inland water -15 15 Ocean -16 16 Evergreen shrubs -17 17 Deciduous shrubs -18 18 Mixed forest -19 19 Interrupted forest -20 20 Water and land mixtures +1 1 Crops, mixed farming +2 2 Short grass +3 3 Evergreen needleleaf trees +4 4 Deciduous needleleaf trees +5 5 Deciduous broadleaf trees +6 6 Evergreen broadleaf trees +7 7 Tall grass +8 8 Desert +9 9 Tundra +10 10 Irrigated crops +11 11 Semidesert +12 12 Ice caps and glaciers +13 13 Bogs and marshes +14 14 Inland water +15 15 Ocean +16 16 Evergreen shrubs +17 17 Deciduous shrubs +18 18 Mixed forest +19 19 Interrupted forest +20 20 Water and land mixtures diff --git a/definitions/grib2/tables/16/4.236.table b/definitions/grib2/tables/16/4.236.table index 08c7f8d56..b667b65fc 100644 --- a/definitions/grib2/tables/16/4.236.table +++ b/definitions/grib2/tables/16/4.236.table @@ -1,8 +1,8 @@ # Code table 4.236 - Soil texture fraction (to be used as partitioned parameter in PDT 4.53 or 4.54) -1 1 Coarse -2 2 Medium -3 3 Medium-fine -4 4 Fine -5 5 Very-fine -6 6 Organic -7 7 Tropical-organic +1 1 Coarse +2 2 Medium +3 3 Medium-fine +4 4 Fine +5 5 Very-fine +6 6 Organic +7 7 Tropical-organic diff --git a/definitions/grib2/tables/16/4.240.table b/definitions/grib2/tables/16/4.240.table index c12ebbb77..1838acfc0 100644 --- a/definitions/grib2/tables/16/4.240.table +++ b/definitions/grib2/tables/16/4.240.table @@ -1,12 +1,12 @@ # Code table 4.240 - Type of distribution function -0 0 No specific distribution function given -1 1 Delta functions with spatially variable concentration and fixed diameters Dl (p1) in meter -2 2 Delta functions with spatially variable concentration and fixed masses Ml (p1) in kg -3 3 Gaussian (Normal) distribution with spatially variable concentration and fixed mean diameter Dl(p1) and variance(p2) -4 4 Gaussian (Normal) distribution with spatially variable concentration, mean diameter and variance -5 5 Log-normal distribution with spatially variable number density, mean diameter and variance +0 0 No specific distribution function given +1 1 Delta functions with spatially variable concentration and fixed diameters Dl (p1) in meter +2 2 Delta functions with spatially variable concentration and fixed masses Ml (p1) in kg +3 3 Gaussian (Normal) distribution with spatially variable concentration and fixed mean diameter Dl(p1) and variance(p2) +4 4 Gaussian (Normal) distribution with spatially variable concentration, mean diameter and variance +5 5 Log-normal distribution with spatially variable number density, mean diameter and variance 6 6 Log-normal distribution with spatially variable number density, mean diameter and fixed variance(p1) 7 7 Log-normal distribution with spatially variable number density and mass density and fixed variance(p1) and fixed particle density(p2) -# 8-49151 Reserved -# 49152-65534 Reserved for local use -65535 65535 Missing value +# 8-49151 Reserved +# 49152-65534 Reserved for local use +65535 65535 Missing value diff --git a/definitions/grib2/tables/16/4.241.table b/definitions/grib2/tables/16/4.241.table index a037b4ba5..5ea7f775a 100644 --- a/definitions/grib2/tables/16/4.241.table +++ b/definitions/grib2/tables/16/4.241.table @@ -1,9 +1,9 @@ # Code table 4.241 - Coverage attributes -0 0 Undefined -1 1 Unmodified -2 2 Snow covered -3 3 Flooded -4 4 Ice covered -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 Undefined +1 1 Unmodified +2 2 Snow covered +3 3 Flooded +4 4 Ice covered +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/16/4.242.table b/definitions/grib2/tables/16/4.242.table index 083f88c29..f6865957c 100644 --- a/definitions/grib2/tables/16/4.242.table +++ b/definitions/grib2/tables/16/4.242.table @@ -1,7 +1,7 @@ # Code table 4.242 - Tile classification -0 0 Reserved -1 1 Land use classes according to ESA-GlobCover GCV2009 -2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 Reserved +1 1 Land use classes according to ESA-GlobCover GCV2009 +2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/16/4.243.table b/definitions/grib2/tables/16/4.243.table index b39053311..24d21b719 100644 --- a/definitions/grib2/tables/16/4.243.table +++ b/definitions/grib2/tables/16/4.243.table @@ -1,43 +1,43 @@ # Code table 4.243 - Tile class -0 0 Reserved -1 1 Evergreen broadleaved forest -2 2 Deciduous broadleaved closed forest -3 3 Deciduous broadleaved open forest -4 4 Evergreen needle-leaf forest -5 5 Deciduous needle-leaf forest -6 6 Mixed leaf trees -7 7 Freshwater flooded trees -8 8 Saline water flooded trees -9 9 Mosaic tree/natural vegetation -10 10 Burnt tree cover -11 11 Evergreen shrubs closed-open -12 12 Deciduous shrubs closed-open -13 13 Herbaceous vegetation closed-open -14 14 Sparse herbaceous or grass -15 15 Flooded shrubs or herbaceous -16 16 Cultivated and managed areas -17 17 Mosaic crop/tree/natural vegetation -18 18 Mosaic crop/shrub/grass -19 19 Bare areas -20 20 Water -21 21 Snow and ice -22 22 Artificial surface -23 23 Ocean -24 24 Irrigated croplands -25 25 Rainfed croplands -26 26 Mosaic cropland (50-70%) - vegetation (20-50%) -27 27 Mosaic vegetation (50-70%) - cropland (20-50%) -28 28 Closed broadleaved evergreen forest -29 29 Closed needle-leaved evergreen forest -30 30 Open needle-leaved deciduous forest -31 31 Mixed broadleaved and needle-leaved forest -32 32 Mosaic shrubland (50-70%) - grassland (20-50%) -33 33 Mosaic grassland (50-70%) - shrubland (20-50%) -34 34 Closed to open shrubland -35 35 Sparse vegetation -36 36 Closed to open forest regularly flooded -37 37 Closed forest or shrubland permanently flooded -38 38 Closed to open grassland regularly flooded -39 39 Undefined -# 40-32767 Reserved -# 32768- Reserved for local use +0 0 Reserved +1 1 Evergreen broadleaved forest +2 2 Deciduous broadleaved closed forest +3 3 Deciduous broadleaved open forest +4 4 Evergreen needle-leaf forest +5 5 Deciduous needle-leaf forest +6 6 Mixed leaf trees +7 7 Freshwater flooded trees +8 8 Saline water flooded trees +9 9 Mosaic tree/natural vegetation +10 10 Burnt tree cover +11 11 Evergreen shrubs closed-open +12 12 Deciduous shrubs closed-open +13 13 Herbaceous vegetation closed-open +14 14 Sparse herbaceous or grass +15 15 Flooded shrubs or herbaceous +16 16 Cultivated and managed areas +17 17 Mosaic crop/tree/natural vegetation +18 18 Mosaic crop/shrub/grass +19 19 Bare areas +20 20 Water +21 21 Snow and ice +22 22 Artificial surface +23 23 Ocean +24 24 Irrigated croplands +25 25 Rainfed croplands +26 26 Mosaic cropland (50-70%) - vegetation (20-50%) +27 27 Mosaic vegetation (50-70%) - cropland (20-50%) +28 28 Closed broadleaved evergreen forest +29 29 Closed needle-leaved evergreen forest +30 30 Open needle-leaved deciduous forest +31 31 Mixed broadleaved and needle-leaved forest +32 32 Mosaic shrubland (50-70%) - grassland (20-50%) +33 33 Mosaic grassland (50-70%) - shrubland (20-50%) +34 34 Closed to open shrubland +35 35 Sparse vegetation +36 36 Closed to open forest regularly flooded +37 37 Closed forest or shrubland permanently flooded +38 38 Closed to open grassland regularly flooded +39 39 Undefined +# 40-32767 Reserved +# 32768- Reserved for local use diff --git a/definitions/grib2/tables/16/4.3.table b/definitions/grib2/tables/16/4.3.table index f205ea0c2..bcf8102a1 100644 --- a/definitions/grib2/tables/16/4.3.table +++ b/definitions/grib2/tables/16/4.3.table @@ -1,22 +1,22 @@ # Code table 4.3 - Type of generating process -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -12 12 Post-processed analysis -13 13 Post-processed forecast -14 14 Nowcast -15 15 Hindcast -16 16 Physical retrieval -17 17 Regression analysis -# 18-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +12 12 Post-processed analysis +13 13 Post-processed forecast +14 14 Nowcast +15 15 Hindcast +16 16 Physical retrieval +17 17 Regression analysis +# 18-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.4.table b/definitions/grib2/tables/16/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/16/4.4.table +++ b/definitions/grib2/tables/16/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.5.table b/definitions/grib2/tables/16/4.5.table index 73c6eb7bf..8d4ae8d1a 100644 --- a/definitions/grib2/tables/16/4.5.table +++ b/definitions/grib2/tables/16/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface (-) 2 2 Cloud base level (-) 3 3 Level of cloud tops (-) @@ -12,11 +12,11 @@ 10 10 Entire atmosphere (-) 11 11 Cumulonimbus (CB) base (m) 12 12 Cumulonimbus (CB) top (m) -# 13-19 Reserved +# 13-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -25,18 +25,18 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level (-) -112 112 Reserved -113 113 Logarithmic hybrid level +112 112 Reserved +113 113 Logarithmic hybrid level 114 114 Snow level (Numeric) -# 115-116 Reserved +# 115-116 Reserved 117 117 Mixed layer depth (m) 118 hhl Hybrid height level (-) 119 hpl Hybrid pressure level (-) -# 120-149 Reserved -150 150 Generalized vertical height coordinate -# 151-159 Reserved +# 120-149 Reserved +150 150 Generalized vertical height coordinate +# 151-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom (-) @@ -45,18 +45,18 @@ 165 165 Bottom of sediment layer penetrated by thermal wave (-) 166 sfc Mixing layer (-) 167 167 Bottom of root zone (-) -# 168-173 Reserved -174 sfc Top surface of ice on sea, lake or river -175 175 Top surface of ice, under snow cover, on sea, lake or river -176 176 Bottom surface (underside) ice on sea, lake or river -177 sfc Deep soil (of indefinite depth) -178 178 Reserved -179 179 Top surface of glacier ice and inland ice -180 180 Deep inland or glacier ice (of indefinite depth) -181 181 Grid tile land fraction as a model surface -182 182 Grid tile water fraction as a model surface -183 183 Grid tile ice fraction on sea, lake or river as a model surface -184 184 Grid tile glacier ice and inland ice fraction as a model surface -# 185-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 168-173 Reserved +174 sfc Top surface of ice on sea, lake or river +175 175 Top surface of ice, under snow cover, on sea, lake or river +176 176 Bottom surface (underside) ice on sea, lake or river +177 sfc Deep soil (of indefinite depth) +178 178 Reserved +179 179 Top surface of glacier ice and inland ice +180 180 Deep inland or glacier ice (of indefinite depth) +181 181 Grid tile land fraction as a model surface +182 182 Grid tile water fraction as a model surface +183 183 Grid tile ice fraction on sea, lake or river as a model surface +184 184 Grid tile glacier ice and inland ice fraction as a model surface +# 185-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.6.table b/definitions/grib2/tables/16/4.6.table index b2dfeb498..ce799721d 100644 --- a/definitions/grib2/tables/16/4.6.table +++ b/definitions/grib2/tables/16/4.6.table @@ -1,9 +1,9 @@ # Code table 4.6 - Type of ensemble forecast -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.7.table b/definitions/grib2/tables/16/4.7.table index e0de0e1b2..69b2b4d77 100644 --- a/definitions/grib2/tables/16/4.7.table +++ b/definitions/grib2/tables/16/4.7.table @@ -1,14 +1,14 @@ # Code table 4.7 - Derived forecast -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.8.table b/definitions/grib2/tables/16/4.8.table index ad883039c..78467454a 100644 --- a/definitions/grib2/tables/16/4.8.table +++ b/definitions/grib2/tables/16/4.8.table @@ -1,6 +1,6 @@ # Code table 4.8 - Clustering method -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.9.table b/definitions/grib2/tables/16/4.9.table index 5878b5ad3..0ce312dd1 100644 --- a/definitions/grib2/tables/16/4.9.table +++ b/definitions/grib2/tables/16/4.9.table @@ -1,9 +1,9 @@ # Code table 4.9 - Probability type -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/4.91.table b/definitions/grib2/tables/16/4.91.table index 44cf25f44..ae31ed61c 100644 --- a/definitions/grib2/tables/16/4.91.table +++ b/definitions/grib2/tables/16/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit -11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit +11 11 Equal to first limit +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/16/5.0.table b/definitions/grib2/tables/16/5.0.table index 5ec77ed0f..2795336df 100644 --- a/definitions/grib2/tables/16/5.0.table +++ b/definitions/grib2/tables/16/5.0.table @@ -1,23 +1,23 @@ # Code table 5.0 - Data representation template number -0 0 Grid point data - simple packing -1 1 Matrix value at grid point - simple packing -2 2 Grid point data - complex packing -3 3 Grid point data - complex packing and spatial differencing -4 4 Grid point data - IEEE floating point data -40 40 Grid point data - JPEG 2000 code stream format -41 41 Grid point data - Portable Network Graphics (PNG) -# 42-49 Reserved -50 50 Spectral data - simple packing -51 51 Spherical harmonics data - complex packing -# 52-60 Reserved -61 61 Grid point data - simple packing with logarithm pre-processing -# 62-199 Reserved -200 200 Run length packing with level values -# 201-49151 Reserved -# 49152-65534 Reserved for local use +0 0 Grid point data - simple packing +1 1 Matrix value at grid point - simple packing +2 2 Grid point data - complex packing +3 3 Grid point data - complex packing and spatial differencing +4 4 Grid point data - IEEE floating point data +40 40 Grid point data - JPEG 2000 code stream format +41 41 Grid point data - Portable Network Graphics (PNG) +# 42-49 Reserved +50 50 Spectral data - simple packing +51 51 Spherical harmonics data - complex packing +# 52-60 Reserved +61 61 Grid point data - simple packing with logarithm pre-processing +# 62-199 Reserved +200 200 Run length packing with level values +# 201-49151 Reserved +# 49152-65534 Reserved for local use 40000 40000 JPEG2000 Packing 40010 40010 PNG pacling 50000 50000 Sperical harmonics ieee packing 50001 50001 Second order packing 50002 50002 Second order packing -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/16/5.1.table b/definitions/grib2/tables/16/5.1.table index 854330c74..1189b5e46 100644 --- a/definitions/grib2/tables/16/5.1.table +++ b/definitions/grib2/tables/16/5.1.table @@ -1,6 +1,6 @@ # Code table 5.1 - Type of original field values -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/5.2.table b/definitions/grib2/tables/16/5.2.table index 40586a131..d77fdf4e7 100644 --- a/definitions/grib2/tables/16/5.2.table +++ b/definitions/grib2/tables/16/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/5.3.table b/definitions/grib2/tables/16/5.3.table index c3b7b30fe..481331791 100644 --- a/definitions/grib2/tables/16/5.3.table +++ b/definitions/grib2/tables/16/5.3.table @@ -1,7 +1,7 @@ # Code table 5.3 - Matrix coordinate parameter -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/5.4.table b/definitions/grib2/tables/16/5.4.table index 8121c1819..e84ab1901 100644 --- a/definitions/grib2/tables/16/5.4.table +++ b/definitions/grib2/tables/16/5.4.table @@ -1,6 +1,6 @@ # Code table 5.4 - Group splitting method -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/5.40.table b/definitions/grib2/tables/16/5.40.table index b9bad2c39..97e8880ab 100644 --- a/definitions/grib2/tables/16/5.40.table +++ b/definitions/grib2/tables/16/5.40.table @@ -1,5 +1,5 @@ # Code table 5.40 - Type of compression -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/16/5.5.table b/definitions/grib2/tables/16/5.5.table index 3ef3eb070..f2316975a 100644 --- a/definitions/grib2/tables/16/5.5.table +++ b/definitions/grib2/tables/16/5.5.table @@ -1,7 +1,7 @@ # Code table 5.5 - Missing value management for complex packing -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/5.6.table b/definitions/grib2/tables/16/5.6.table index 6d5177877..db68ead9c 100644 --- a/definitions/grib2/tables/16/5.6.table +++ b/definitions/grib2/tables/16/5.6.table @@ -1,7 +1,7 @@ # Code table 5.6 - Order of spatial differencing -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/16/5.7.table b/definitions/grib2/tables/16/5.7.table index 5ab780056..e54862c19 100644 --- a/definitions/grib2/tables/16/5.7.table +++ b/definitions/grib2/tables/16/5.7.table @@ -1,7 +1,7 @@ # Code table 5.7 - Precision of floating-point numbers -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/16/6.0.table b/definitions/grib2/tables/16/6.0.table index f539b26d7..a8f30f5a4 100644 --- a/definitions/grib2/tables/16/6.0.table +++ b/definitions/grib2/tables/16/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator 0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/17/0.0.table b/definitions/grib2/tables/17/0.0.table index b24c50564..2c5afceb4 100644 --- a/definitions/grib2/tables/17/0.0.table +++ b/definitions/grib2/tables/17/0.0.table @@ -1,10 +1,10 @@ # Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/1.0.table b/definitions/grib2/tables/17/1.0.table index d1134399b..893633977 100644 --- a/definitions/grib2/tables/17/1.0.table +++ b/definitions/grib2/tables/17/1.0.table @@ -1,22 +1,22 @@ # Code table 1.0 - GRIB master tables version number -0 0 Experimental -1 1 Version implemented on 7 November 2001 -2 2 Version implemented on 4 November 2003 -3 3 Version implemented on 2 November 2005 -4 4 Version implemented on 7 November 2007 -5 5 Version implemented on 4 November 2009 -6 6 Version implemented on 15 September 2010 -7 7 Version implemented on 4 May 2011 -8 8 Version implemented on 2 November 2011 -9 9 Version implemented on 2 May 2012 -10 10 Version implemented on 7 November 2012 -11 11 Version implemented on 8 May 2013 -12 12 Version implemented on 14 November 2013 -13 13 Version implemented on 7 May 2014 -14 14 Version implemented on 5 November 2014 -15 15 Version implemented on 6 May 2015 -16 16 Version implemented on 11 November 2015 +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 +6 6 Version implemented on 15 September 2010 +7 7 Version implemented on 4 May 2011 +8 8 Version implemented on 2 November 2011 +9 9 Version implemented on 2 May 2012 +10 10 Version implemented on 7 November 2012 +11 11 Version implemented on 8 May 2013 +12 12 Version implemented on 14 November 2013 +13 13 Version implemented on 7 May 2014 +14 14 Version implemented on 5 November 2014 +15 15 Version implemented on 6 May 2015 +16 16 Version implemented on 11 November 2015 17 17 Version implemented on 4 May 2016 18 18 Pre-operational to be implemented by next amendment -# 19-254 Future versions -255 255 Missing +# 19-254 Future versions +255 255 Missing diff --git a/definitions/grib2/tables/17/1.1.table b/definitions/grib2/tables/17/1.1.table index d50f8fd72..f6d332005 100644 --- a/definitions/grib2/tables/17/1.1.table +++ b/definitions/grib2/tables/17/1.1.table @@ -1,4 +1,4 @@ # Code table 1.1 - GRIB local tables version number -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/17/1.2.table b/definitions/grib2/tables/17/1.2.table index 934b70455..638f1efbb 100644 --- a/definitions/grib2/tables/17/1.2.table +++ b/definitions/grib2/tables/17/1.2.table @@ -1,8 +1,8 @@ # Code table 1.2 - Significance of reference time -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/1.3.table b/definitions/grib2/tables/17/1.3.table index 0c95269d5..c1a9a7b9d 100644 --- a/definitions/grib2/tables/17/1.3.table +++ b/definitions/grib2/tables/17/1.3.table @@ -1,14 +1,14 @@ # Code table 1.3 - Production status of data -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products -4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products +4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) 5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) -6 6 S2S operational products -7 7 S2S test products +6 6 S2S operational products +7 7 S2S test products 8 8 Uncertainties in Ensembles of Regional ReAnalyses project (UERRA) 9 9 Uncertainties in Ensembles of Regional ReAnalyses project test (UERRA) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/1.4.table b/definitions/grib2/tables/17/1.4.table index 03203d874..877288c0e 100644 --- a/definitions/grib2/tables/17/1.4.table +++ b/definitions/grib2/tables/17/1.4.table @@ -1,13 +1,13 @@ # Code table 1.4 - Type of data -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/17/1.5.table b/definitions/grib2/tables/17/1.5.table index b2cf9f087..533111959 100644 --- a/definitions/grib2/tables/17/1.5.table +++ b/definitions/grib2/tables/17/1.5.table @@ -1,7 +1,7 @@ # Code table 1.5 - Identification template number -0 0 Calendar definition -1 1 Paleontological offset -2 2 Calendar definition and paleontological offset -# 3-32767 Reserved -# 32768-65534 Reserved for local use -65535 65535 Missing +0 0 Calendar definition +1 1 Paleontological offset +2 2 Calendar definition and paleontological offset +# 3-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/17/1.6.table b/definitions/grib2/tables/17/1.6.table index 5db921990..bd46899a7 100644 --- a/definitions/grib2/tables/17/1.6.table +++ b/definitions/grib2/tables/17/1.6.table @@ -1,8 +1,8 @@ # Code table 1.6 - Type of calendar -0 0 Gregorian -1 1 360-day -2 2 365-day -3 3 Proleptic Gregorian -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Gregorian +1 1 360-day +2 2 365-day +3 3 Proleptic Gregorian +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/3.0.table b/definitions/grib2/tables/17/3.0.table index 45187b80d..a442a06a0 100644 --- a/definitions/grib2/tables/17/3.0.table +++ b/definitions/grib2/tables/17/3.0.table @@ -1,6 +1,6 @@ # Code table 3.0 - Source of grid definition -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/17/3.10.table b/definitions/grib2/tables/17/3.10.table index afa8843a7..1612d05e3 100644 --- a/definitions/grib2/tables/17/3.10.table +++ b/definitions/grib2/tables/17/3.10.table @@ -1,8 +1,8 @@ # Flag table 3.10 - Scanning mode for one diamond -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/17/3.11.table b/definitions/grib2/tables/17/3.11.table index e516a2ab9..06ae10810 100644 --- a/definitions/grib2/tables/17/3.11.table +++ b/definitions/grib2/tables/17/3.11.table @@ -1,7 +1,7 @@ # Code table 3.11 - Interpretation of list of numbers at end of section 3 -0 0 There is no appended list -1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows -2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row -3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) -# 4-254 Reserved -255 255 Missing +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/17/3.15.table b/definitions/grib2/tables/17/3.15.table index 331217ebe..6087902a3 100644 --- a/definitions/grib2/tables/17/3.15.table +++ b/definitions/grib2/tables/17/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/3.2.table b/definitions/grib2/tables/17/3.2.table index 9238dc2a7..b9574a424 100644 --- a/definitions/grib2/tables/17/3.2.table +++ b/definitions/grib2/tables/17/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame -9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/3.20.table b/definitions/grib2/tables/17/3.20.table index efbf08d19..e2bb156ee 100644 --- a/definitions/grib2/tables/17/3.20.table +++ b/definitions/grib2/tables/17/3.20.table @@ -1,6 +1,6 @@ # Code table 3.20 - Type of horizontal line -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/3.21.table b/definitions/grib2/tables/17/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/17/3.21.table +++ b/definitions/grib2/tables/17/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/3.3.table b/definitions/grib2/tables/17/3.3.table index 5dd7c7001..25cb46a1d 100644 --- a/definitions/grib2/tables/17/3.3.table +++ b/definitions/grib2/tables/17/3.3.table @@ -1,9 +1,9 @@ # Flag table 3.3 - Resolution and component flags -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/17/3.4.table b/definitions/grib2/tables/17/3.4.table index 897b813d7..43835c014 100644 --- a/definitions/grib2/tables/17/3.4.table +++ b/definitions/grib2/tables/17/3.4.table @@ -1,17 +1,17 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -5 0 Points within odd rows are not offset in i (x) direction -5 1 Points within odd rows are offset by Di/2 in i (x) direction -6 0 Points within even rows are not offset in i (x) direction -6 1 Points within even rows are offset by Di/2 in i (x) direction -7 0 Points are not offset in j (y) direction -7 1 Points are offset by Dj/2 in j (y) direction -8 0 Rows have Ni grid points and columns have Nj grid points -8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +5 0 Points within odd rows are not offset in i (x) direction +5 1 Points within odd rows are offset by Di/2 in i (x) direction +6 0 Points within even rows are not offset in i (x) direction +6 1 Points within even rows are offset by Di/2 in i (x) direction +7 0 Points are not offset in j (y) direction +7 1 Points are offset by Dj/2 in j (y) direction +8 0 Rows have Ni grid points and columns have Nj grid points +8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction diff --git a/definitions/grib2/tables/17/3.5.table b/definitions/grib2/tables/17/3.5.table index eabdde896..2f8ec82e3 100644 --- a/definitions/grib2/tables/17/3.5.table +++ b/definitions/grib2/tables/17/3.5.table @@ -1,5 +1,5 @@ # Flag table 3.5 - Projection centre -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/17/3.7.table b/definitions/grib2/tables/17/3.7.table index 0a7d6efde..34c0de085 100644 --- a/definitions/grib2/tables/17/3.7.table +++ b/definitions/grib2/tables/17/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 see separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/17/3.8.table b/definitions/grib2/tables/17/3.8.table index 844e74235..578fab37f 100644 --- a/definitions/grib2/tables/17/3.8.table +++ b/definitions/grib2/tables/17/3.8.table @@ -1,7 +1,7 @@ # Code table 3.8 - Grid point position -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/3.9.table b/definitions/grib2/tables/17/3.9.table index fd730bc64..ecd65514a 100644 --- a/definitions/grib2/tables/17/3.9.table +++ b/definitions/grib2/tables/17/3.9.table @@ -1,4 +1,4 @@ # Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/17/4.0.table b/definitions/grib2/tables/17/4.0.table index 802eca6bf..ff8a54b04 100644 --- a/definitions/grib2/tables/17/4.0.table +++ b/definitions/grib2/tables/17/4.0.table @@ -1,65 +1,65 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time -8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -# 35-39 Reserved +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data +# 35-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol -46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol 47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -# 49-50 Reserved -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time -52 52 Reserved -53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time -54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters -55 55 Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time -56 56 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters -57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function -# 58-59 Reserved -60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval -# 62-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +# 49-50 Reserved +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +52 52 Reserved +53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time +54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters +55 55 Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time +56 56 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters +57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function +# 58-59 Reserved +60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval +# 62-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved -# 32768-65534 Reserved for local use +# 1102-32767 Reserved +# 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/17/4.1.0.table b/definitions/grib2/tables/17/4.1.0.table index 04cfd7802..df58636d6 100644 --- a/definitions/grib2/tables/17/4.1.0.table +++ b/definitions/grib2/tables/17/4.1.0.table @@ -1,27 +1,27 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.1.1.table b/definitions/grib2/tables/17/4.1.1.table index 7b22b6fed..05a854da0 100644 --- a/definitions/grib2/tables/17/4.1.1.table +++ b/definitions/grib2/tables/17/4.1.1.table @@ -1,7 +1,7 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.1.10.table b/definitions/grib2/tables/17/4.1.10.table index a9b20eb9c..88d3c8743 100644 --- a/definitions/grib2/tables/17/4.1.10.table +++ b/definitions/grib2/tables/17/4.1.10.table @@ -1,10 +1,10 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Subsurface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Subsurface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.1.2.table b/definitions/grib2/tables/17/4.1.2.table index 5b488fe9e..e74126645 100644 --- a/definitions/grib2/tables/17/4.1.2.table +++ b/definitions/grib2/tables/17/4.1.2.table @@ -1,9 +1,9 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.1.3.table b/definitions/grib2/tables/17/4.1.3.table index 7bf60d4a7..ba38c9301 100644 --- a/definitions/grib2/tables/17/4.1.3.table +++ b/definitions/grib2/tables/17/4.1.3.table @@ -1,11 +1,11 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Image format products -1 1 Quantitative products -2 2 Cloud properties -3 3 Flight rule conditions -4 4 Volcanic ash -5 5 Sea-surface temperature -6 6 Solar radiation -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +2 2 Cloud properties +3 3 Flight rule conditions +4 4 Volcanic ash +5 5 Sea-surface temperature +6 6 Solar radiation +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.10.table b/definitions/grib2/tables/17/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/17/4.10.table +++ b/definitions/grib2/tables/17/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/17/4.11.table b/definitions/grib2/tables/17/4.11.table index 7f404c849..01cc81303 100644 --- a/definitions/grib2/tables/17/4.11.table +++ b/definitions/grib2/tables/17/4.11.table @@ -1,10 +1,10 @@ # Code table 4.11 - Type of time intervals -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.12.table b/definitions/grib2/tables/17/4.12.table index 03fd89b36..d42b47e96 100644 --- a/definitions/grib2/tables/17/4.12.table +++ b/definitions/grib2/tables/17/4.12.table @@ -1,7 +1,7 @@ # Code table 4.12 - Operating mode -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.13.table b/definitions/grib2/tables/17/4.13.table index c92854eec..a0e28eac8 100644 --- a/definitions/grib2/tables/17/4.13.table +++ b/definitions/grib2/tables/17/4.13.table @@ -1,6 +1,6 @@ # Code table 4.13 - Quality control indicator -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.14.table b/definitions/grib2/tables/17/4.14.table index a88cb93fa..d525b23b3 100644 --- a/definitions/grib2/tables/17/4.14.table +++ b/definitions/grib2/tables/17/4.14.table @@ -1,6 +1,6 @@ # Code table 4.14 - Clutter filter indicator -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.15.table b/definitions/grib2/tables/17/4.15.table index 2e5f3dea3..7adddedb6 100644 --- a/definitions/grib2/tables/17/4.15.table +++ b/definitions/grib2/tables/17/4.15.table @@ -1,11 +1,11 @@ # Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.0.table b/definitions/grib2/tables/17/4.2.0.0.table index f24b8832c..4e2cf578e 100644 --- a/definitions/grib2/tables/17/4.2.0.0.table +++ b/definitions/grib2/tables/17/4.2.0.0.table @@ -27,6 +27,6 @@ 25 25 Temperature tendency due to long-wave radiation, clear sky (K s-1) 26 26 Temperature tendency due to parameterization (K s-1) 27 27 Wet-bulb temperature (K) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.1.table b/definitions/grib2/tables/17/4.2.0.1.table index 70001f746..004d11d25 100644 --- a/definitions/grib2/tables/17/4.2.0.1.table +++ b/definitions/grib2/tables/17/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,7 +86,7 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) @@ -115,6 +115,6 @@ 115 115 Mass density of liquid water coating on snow expressed as mass of liquid water per unit volume of air (kg m-3) 116 116 Specific mass of liquid water coating on snow expressed as mass of liquid water per unit mass of moist air (kg kg-1) 117 117 Mass mixing ratio of liquid water coating on snow expressed as mass of liquid water per unit mass of dry air (kg kg-1) -# 118-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 118-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.13.table b/definitions/grib2/tables/17/4.2.0.13.table index 5086101ad..3f5c30675 100644 --- a/definitions/grib2/tables/17/4.2.0.13.table +++ b/definitions/grib2/tables/17/4.2.0.13.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.14.table b/definitions/grib2/tables/17/4.2.0.14.table index 215884737..97fb38c8b 100644 --- a/definitions/grib2/tables/17/4.2.0.14.table +++ b/definitions/grib2/tables/17/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.15.table b/definitions/grib2/tables/17/4.2.0.15.table index dfbc4d12f..8df082466 100644 --- a/definitions/grib2/tables/17/4.2.0.15.table +++ b/definitions/grib2/tables/17/4.2.0.15.table @@ -16,6 +16,6 @@ 14 14 Reflectivity of hail (dB) 15 15 Hybrid scan reflectivity (dB) 16 16 Hybrid scan reflectivity height (m) -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.16.table b/definitions/grib2/tables/17/4.2.0.16.table index 0c240a853..9499d9333 100644 --- a/definitions/grib2/tables/17/4.2.0.16.table +++ b/definitions/grib2/tables/17/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.18.table b/definitions/grib2/tables/17/4.2.0.18.table index 9ae3539ca..16cfa489d 100644 --- a/definitions/grib2/tables/17/4.2.0.18.table +++ b/definitions/grib2/tables/17/4.2.0.18.table @@ -8,7 +8,7 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) @@ -16,6 +16,6 @@ 14 14 Specific activity concentration (Bq kg-1) 15 15 Maximum of air concentration in layer (Bq m-3) 16 16 Height of maximum air concentration (m) -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.19.table b/definitions/grib2/tables/17/4.2.0.19.table index 8705082c5..e4db36249 100644 --- a/definitions/grib2/tables/17/4.2.0.19.table +++ b/definitions/grib2/tables/17/4.2.0.19.table @@ -31,6 +31,6 @@ 29 29 Clear air turbulence (CAT) (m2/3 s-1) 30 30 Eddy dissipation parameter (m2/3 s-1) 31 31 Maximum of Eddy dissipation parameter in layer (m2/3 s-1) -# 32-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 32-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.190.table b/definitions/grib2/tables/17/4.2.0.190.table index de621a924..a0d6ba0ac 100644 --- a/definitions/grib2/tables/17/4.2.0.190.table +++ b/definitions/grib2/tables/17/4.2.0.190.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.191.table b/definitions/grib2/tables/17/4.2.0.191.table index e3bba0ebe..b3a7092ea 100644 --- a/definitions/grib2/tables/17/4.2.0.191.table +++ b/definitions/grib2/tables/17/4.2.0.191.table @@ -3,6 +3,6 @@ 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.2.table b/definitions/grib2/tables/17/4.2.0.2.table index 8ebc75124..7967bf7bf 100644 --- a/definitions/grib2/tables/17/4.2.0.2.table +++ b/definitions/grib2/tables/17/4.2.0.2.table @@ -44,6 +44,6 @@ 42 42 v-component of geostrophic wind (m s-1) 43 43 Geostrophic wind direction (degree true) 44 44 Geostrophic wind speed (m s-1) -# 45-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 45-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.20.table b/definitions/grib2/tables/17/4.2.0.20.table index 983539bd2..38479b834 100644 --- a/definitions/grib2/tables/17/4.2.0.20.table +++ b/definitions/grib2/tables/17/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -28,7 +28,7 @@ 60 60 Aerosol specific number concentration (kg-1) 61 61 Maximum of mass density in layer (kg m-3) 62 62 Height of maximum mass density (m) -# 63-99 Reserved +# 63-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -41,6 +41,6 @@ 109 109 Aerosol lidar extinction from satellite (/m) 110 110 Aerosol lidar extinction from the ground (/m) 111 111 Angstrom exponent (Numeric) -# 112-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 112-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.3.table b/definitions/grib2/tables/17/4.2.0.3.table index c7c6359d4..17e7f204f 100644 --- a/definitions/grib2/tables/17/4.2.0.3.table +++ b/definitions/grib2/tables/17/4.2.0.3.table @@ -30,6 +30,6 @@ 28 28 Downdraught mass flux (kg m-2 s-1) 29 29 Updraught detrainment rate (kg m-3 s-1) 30 30 Downdraught detrainment rate (kg m-3 s-1) -# 31-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 31-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.4.table b/definitions/grib2/tables/17/4.2.0.4.table index 0a5ded2b5..f97270456 100644 --- a/definitions/grib2/tables/17/4.2.0.4.table +++ b/definitions/grib2/tables/17/4.2.0.4.table @@ -14,11 +14,11 @@ 12 12 Downward UV radiation (W m-2) 13 13 Direct short-wave radiation flux (W m-2) 14 14 Diffuse short-wave radiation flux (W m-2) -# 15-49 Reserved +# 15-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) 52 52 Downward short-wave radiation flux, clear sky (W m-2) 53 53 Upward short-wave radiation flux, clear sky (W m-2) -# 54-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 54-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.5.table b/definitions/grib2/tables/17/4.2.0.5.table index 4550220b6..ddfa634ce 100644 --- a/definitions/grib2/tables/17/4.2.0.5.table +++ b/definitions/grib2/tables/17/4.2.0.5.table @@ -8,6 +8,6 @@ 6 6 Net long-wave radiation flux, clear sky (W m-2) 7 7 Brightness temperature (K) 8 8 Downward long-wave radiation flux, clear sky (W m-2) -# 9-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 9-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.6.table b/definitions/grib2/tables/17/4.2.0.6.table index 4cec0c8aa..0450ec194 100644 --- a/definitions/grib2/tables/17/4.2.0.6.table +++ b/definitions/grib2/tables/17/4.2.0.6.table @@ -40,10 +40,10 @@ 38 38 Mass density of cloud droplets (kg m-3) 39 39 Mass density of cloud ice (kg m-3) 40 40 Mass density of convective cloud water droplets (kg m-3) -# 41-46 Reserved +# 41-46 Reserved 47 47 Volume fraction of cloud water droplets (Numeric) 48 48 Volume fraction of cloud ice particles (Numeric) 49 49 Volume fraction of cloud (ice and/or water) (Numeric) -# 50-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 50-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.0.7.table b/definitions/grib2/tables/17/4.2.0.7.table index 6d0d87a46..3e653431f 100644 --- a/definitions/grib2/tables/17/4.2.0.7.table +++ b/definitions/grib2/tables/17/4.2.0.7.table @@ -13,11 +13,11 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraught helicity (m2 s-2) 16 16 Bulk Richardson number (Numeric) 17 17 Gradient Richardson number (Numeric) 18 18 Flux Richardson number (Numeric) -# 19-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 19-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.1.0.table b/definitions/grib2/tables/17/4.2.1.0.table index bcd849c2e..a2660f4f3 100644 --- a/definitions/grib2/tables/17/4.2.1.0.table +++ b/definitions/grib2/tables/17/4.2.1.0.table @@ -16,6 +16,6 @@ 14 14 Upstream accumulated precipitation (kg m-2) 15 15 Upstream accumulated snow melt (kg m-2) 16 16 Percolation rate (kg m-2 s-1) -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.1.1.table b/definitions/grib2/tables/17/4.2.1.1.table index b488eb0bd..171da3958 100644 --- a/definitions/grib2/tables/17/4.2.1.1.table +++ b/definitions/grib2/tables/17/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.10.0.table b/definitions/grib2/tables/17/4.2.10.0.table index 095f51bdf..3611abd9a 100644 --- a/definitions/grib2/tables/17/4.2.10.0.table +++ b/definitions/grib2/tables/17/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea-surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (/s) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.10.1.table b/definitions/grib2/tables/17/4.2.10.1.table index 5959bfa28..f0a073c00 100644 --- a/definitions/grib2/tables/17/4.2.10.1.table +++ b/definitions/grib2/tables/17/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.10.191.table b/definitions/grib2/tables/17/4.2.10.191.table index 524929e78..1ebf85006 100644 --- a/definitions/grib2/tables/17/4.2.10.191.table +++ b/definitions/grib2/tables/17/4.2.10.191.table @@ -1,8 +1,8 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -2 2 Reserved +2 2 Reserved 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.10.2.table b/definitions/grib2/tables/17/4.2.10.2.table index 6797062ac..4633bad4f 100644 --- a/definitions/grib2/tables/17/4.2.10.2.table +++ b/definitions/grib2/tables/17/4.2.10.2.table @@ -12,6 +12,6 @@ 10 10 Zonal vector component of vertically integrated ice internal pressure (Pa m) 11 11 Meridional vector component of vertically integrated ice internal pressure (Pa m) 12 12 Compressive ice strength (N/m) -# 13-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 13-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.10.3.table b/definitions/grib2/tables/17/4.2.10.3.table index f951bbe78..937720c93 100644 --- a/definitions/grib2/tables/17/4.2.10.3.table +++ b/definitions/grib2/tables/17/4.2.10.3.table @@ -1,6 +1,6 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.10.4.table b/definitions/grib2/tables/17/4.2.10.4.table index 54774f1b7..d5615ae26 100644 --- a/definitions/grib2/tables/17/4.2.10.4.table +++ b/definitions/grib2/tables/17/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2/s) 6 6 Ocean vertical momentum diffusivity (m2/s) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (/m) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.2.0.table b/definitions/grib2/tables/17/4.2.2.0.table index 81548840c..b253cac22 100644 --- a/definitions/grib2/tables/17/4.2.2.0.table +++ b/definitions/grib2/tables/17/4.2.2.0.table @@ -38,6 +38,6 @@ 36 36 Tile fraction (Proportion) 37 37 Tile percentage (%) 38 38 Soil volumetric ice content (water equivalent) (m3 m-3) -# 39-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 39-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.2.3.table b/definitions/grib2/tables/17/4.2.2.3.table index 690fab42b..2674e9f42 100644 --- a/definitions/grib2/tables/17/4.2.2.3.table +++ b/definitions/grib2/tables/17/4.2.2.3.table @@ -27,6 +27,6 @@ 25 25 Snow depth at elevation bands (kg m-2) 26 26 Soil heat flux (W m-2) 27 27 Soil depth (m) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.2.4.table b/definitions/grib2/tables/17/4.2.2.4.table index bb54fac22..ceb761557 100644 --- a/definitions/grib2/tables/17/4.2.2.4.table +++ b/definitions/grib2/tables/17/4.2.2.4.table @@ -11,6 +11,6 @@ 9 9 Initial Fire Spread Index (Canadian Forest Service) (Numeric) 10 10 Fire Buildup Index (Canadian Forest Service) (Numeric) 11 11 Fire Daily Severity Rating (Canadian Forest Service) (Numeric) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.3.0.table b/definitions/grib2/tables/17/4.2.3.0.table index c0ffa29f5..80a829673 100644 --- a/definitions/grib2/tables/17/4.2.3.0.table +++ b/definitions/grib2/tables/17/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.2.3.1.table b/definitions/grib2/tables/17/4.2.3.1.table index 8e0793fe0..04cdde1f1 100644 --- a/definitions/grib2/tables/17/4.2.3.1.table +++ b/definitions/grib2/tables/17/4.2.3.1.table @@ -17,16 +17,16 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-26 Reserved +23 23 Angstrom coefficient +# 24-26 Reserved 27 27 Bidirectional reflectance factor (Numeric) 28 28 Brightness temperature (K) 29 29 Scaled radiance (Numeric) -# 30-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 30-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.201.table b/definitions/grib2/tables/17/4.201.table index 47f1b486f..fa173c4e0 100644 --- a/definitions/grib2/tables/17/4.201.table +++ b/definitions/grib2/tables/17/4.201.table @@ -1,15 +1,15 @@ # Code table 4.201 - Precipitation type -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow -6 6 Wet snow -7 7 Mixture of rain and snow -8 8 Ice pellets -9 9 Graupel -10 10 Hail -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +6 6 Wet snow +7 7 Mixture of rain and snow +8 8 Ice pellets +9 9 Graupel +10 10 Hail +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.202.table b/definitions/grib2/tables/17/4.202.table index 438502ff9..7f3c8f6cf 100644 --- a/definitions/grib2/tables/17/4.202.table +++ b/definitions/grib2/tables/17/4.202.table @@ -1,4 +1,4 @@ # Code table 4.202 - Precipitable water category -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.203.table b/definitions/grib2/tables/17/4.203.table index 8a9aedf7a..cf5eb6bdc 100644 --- a/definitions/grib2/tables/17/4.203.table +++ b/definitions/grib2/tables/17/4.203.table @@ -1,26 +1,26 @@ # Code table 4.203 - Cloud type -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.204.table b/definitions/grib2/tables/17/4.204.table index 481372936..8e0be1f8c 100644 --- a/definitions/grib2/tables/17/4.204.table +++ b/definitions/grib2/tables/17/4.204.table @@ -1,9 +1,9 @@ # Code table 4.204 - Thunderstorm coverage -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (6-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (6-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.205.table b/definitions/grib2/tables/17/4.205.table index 5b4484dfd..c40c7f47b 100644 --- a/definitions/grib2/tables/17/4.205.table +++ b/definitions/grib2/tables/17/4.205.table @@ -1,6 +1,6 @@ # Code table 4.205 - Presence of aerosol -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.206.table b/definitions/grib2/tables/17/4.206.table index 02c3dfdf9..76472c261 100644 --- a/definitions/grib2/tables/17/4.206.table +++ b/definitions/grib2/tables/17/4.206.table @@ -1,6 +1,6 @@ # Code table 4.206 - Volcanic ash -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.207.table b/definitions/grib2/tables/17/4.207.table index 8ddb2e048..b6392fca0 100644 --- a/definitions/grib2/tables/17/4.207.table +++ b/definitions/grib2/tables/17/4.207.table @@ -1,10 +1,10 @@ # Code table 4.207 - Icing -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.208.table b/definitions/grib2/tables/17/4.208.table index b83685a1a..4361d38c0 100644 --- a/definitions/grib2/tables/17/4.208.table +++ b/definitions/grib2/tables/17/4.208.table @@ -1,9 +1,9 @@ # Code table 4.208 - Turbulence -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.209.table b/definitions/grib2/tables/17/4.209.table index cb7617071..39ea549ac 100644 --- a/definitions/grib2/tables/17/4.209.table +++ b/definitions/grib2/tables/17/4.209.table @@ -1,9 +1,9 @@ # Code table 4.209 - Planetary boundary-layer regime -0 0 Reserved -1 1 Stable -2 2 Mechanically driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.210.table b/definitions/grib2/tables/17/4.210.table index c01f4bcca..791878469 100644 --- a/definitions/grib2/tables/17/4.210.table +++ b/definitions/grib2/tables/17/4.210.table @@ -1,6 +1,6 @@ # Code table 4.210 - Contrail intensity 0 0 Contrail not present 1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.211.table b/definitions/grib2/tables/17/4.211.table index 098eb2d43..2a28a84d9 100644 --- a/definitions/grib2/tables/17/4.211.table +++ b/definitions/grib2/tables/17/4.211.table @@ -1,7 +1,7 @@ # Code table 4.211 - Contrail engine type -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.212.table b/definitions/grib2/tables/17/4.212.table index 1a085b88d..6a3dcf88c 100644 --- a/definitions/grib2/tables/17/4.212.table +++ b/definitions/grib2/tables/17/4.212.table @@ -1,18 +1,18 @@ # Code table 4.212 - Land use -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.213.table b/definitions/grib2/tables/17/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/17/4.213.table +++ b/definitions/grib2/tables/17/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.215.table b/definitions/grib2/tables/17/4.215.table index 034db72be..7888772d5 100644 --- a/definitions/grib2/tables/17/4.215.table +++ b/definitions/grib2/tables/17/4.215.table @@ -1,9 +1,9 @@ # Code table 4.215 - Remotely sensed snow coverage -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.216.table b/definitions/grib2/tables/17/4.216.table index 5d1460cef..b51b358f4 100644 --- a/definitions/grib2/tables/17/4.216.table +++ b/definitions/grib2/tables/17/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain -# 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 0-90 Elevation in increments of 100 m +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/17/4.217.table b/definitions/grib2/tables/17/4.217.table index a4452182c..a700410d5 100644 --- a/definitions/grib2/tables/17/4.217.table +++ b/definitions/grib2/tables/17/4.217.table @@ -1,8 +1,8 @@ # Code table 4.217 - Cloud mask type -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.218.table b/definitions/grib2/tables/17/4.218.table index 7e3a69578..b5b15150b 100644 --- a/definitions/grib2/tables/17/4.218.table +++ b/definitions/grib2/tables/17/4.218.table @@ -1,44 +1,44 @@ # Code table 4.218 - Pixel scene type -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation/crops -15 15 Permanent snow/ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -19 19 Warm liquid water cloud -20 20 Supercooled liquid water cloud -21 21 Mixed-phase cloud -22 22 Optically thin ice cloud -23 23 Optically thick ice cloud -24 24 Multilayered cloud -# 25-96 Reserved -97 97 Snow/ice on land -98 98 Snow/ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud/fog/Stratus -102 102 Low cloud/Stratocumulus -103 103 Low cloud/unknown type -104 104 Medium cloud/Nimbostratus -105 105 Medium cloud/Altostratus -106 106 Medium cloud/unknown type -107 107 High cloud/Cumulus -108 108 High cloud/Cirrus -109 109 High cloud/unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation/crops +15 15 Permanent snow/ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +19 19 Warm liquid water cloud +20 20 Supercooled liquid water cloud +21 21 Mixed-phase cloud +22 22 Optically thin ice cloud +23 23 Optically thick ice cloud +24 24 Multilayered cloud +# 25-96 Reserved +97 97 Snow/ice on land +98 98 Snow/ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud/fog/Stratus +102 102 Low cloud/Stratocumulus +103 103 Low cloud/unknown type +104 104 Medium cloud/Nimbostratus +105 105 Medium cloud/Altostratus +106 106 Medium cloud/unknown type +107 107 High cloud/Cumulus +108 108 High cloud/Cirrus +109 109 High cloud/unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.219.table b/definitions/grib2/tables/17/4.219.table index 86df0522e..9979f50ad 100644 --- a/definitions/grib2/tables/17/4.219.table +++ b/definitions/grib2/tables/17/4.219.table @@ -1,8 +1,8 @@ # Code table 4.219 - Cloud top height quality indicator -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.220.table b/definitions/grib2/tables/17/4.220.table index 93e841f8b..88e869e42 100644 --- a/definitions/grib2/tables/17/4.220.table +++ b/definitions/grib2/tables/17/4.220.table @@ -1,6 +1,6 @@ # Code table 4.220 - Horizontal dimension processed -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.221.table b/definitions/grib2/tables/17/4.221.table index 8448533d7..011cc3518 100644 --- a/definitions/grib2/tables/17/4.221.table +++ b/definitions/grib2/tables/17/4.221.table @@ -1,6 +1,6 @@ # Code table 4.221 - Treatment of missing data -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.222.table b/definitions/grib2/tables/17/4.222.table index 57f113014..558d947ac 100644 --- a/definitions/grib2/tables/17/4.222.table +++ b/definitions/grib2/tables/17/4.222.table @@ -1,6 +1,6 @@ # Code table 4.222 - Categorical result -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.223.table b/definitions/grib2/tables/17/4.223.table index f0deb076a..572c4e7a8 100644 --- a/definitions/grib2/tables/17/4.223.table +++ b/definitions/grib2/tables/17/4.223.table @@ -1,5 +1,5 @@ # Code table 4.223 - Fire detection indicator -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing diff --git a/definitions/grib2/tables/17/4.224.table b/definitions/grib2/tables/17/4.224.table index e87cde4bb..014f56e23 100644 --- a/definitions/grib2/tables/17/4.224.table +++ b/definitions/grib2/tables/17/4.224.table @@ -1,18 +1,18 @@ # Code table 4.224 - Categorical outlook -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/17/4.227.table b/definitions/grib2/tables/17/4.227.table index 27c76553d..48c3b7633 100644 --- a/definitions/grib2/tables/17/4.227.table +++ b/definitions/grib2/tables/17/4.227.table @@ -1,9 +1,9 @@ # Code table 4.227 - Icing scenario (weather/cloud classification) -0 0 None -1 1 General -2 2 Convective -3 3 Stratiform -4 4 Freezing -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 None +1 1 General +2 2 Convective +3 3 Stratiform +4 4 Freezing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/17/4.234.table b/definitions/grib2/tables/17/4.234.table index 816541ce9..3b05b4515 100644 --- a/definitions/grib2/tables/17/4.234.table +++ b/definitions/grib2/tables/17/4.234.table @@ -1,21 +1,21 @@ # Code table 4.234 - Canopy cover fraction (to be used as partitioned parameter in product definition template 4.53 or 4.54) -1 1 Crops, mixed farming -2 2 Short grass -3 3 Evergreen needleleaf trees -4 4 Deciduous needleleaf trees -5 5 Deciduous broadleaf trees -6 6 Evergreen broadleaf trees -7 7 Tall grass -8 8 Desert -9 9 Tundra -10 10 Irrigated crops -11 11 Semidesert -12 12 Ice caps and glaciers -13 13 Bogs and marshes -14 14 Inland water -15 15 Ocean -16 16 Evergreen shrubs -17 17 Deciduous shrubs -18 18 Mixed forest -19 19 Interrupted forest -20 20 Water and land mixtures +1 1 Crops, mixed farming +2 2 Short grass +3 3 Evergreen needleleaf trees +4 4 Deciduous needleleaf trees +5 5 Deciduous broadleaf trees +6 6 Evergreen broadleaf trees +7 7 Tall grass +8 8 Desert +9 9 Tundra +10 10 Irrigated crops +11 11 Semidesert +12 12 Ice caps and glaciers +13 13 Bogs and marshes +14 14 Inland water +15 15 Ocean +16 16 Evergreen shrubs +17 17 Deciduous shrubs +18 18 Mixed forest +19 19 Interrupted forest +20 20 Water and land mixtures diff --git a/definitions/grib2/tables/17/4.236.table b/definitions/grib2/tables/17/4.236.table index fbe093ce9..9c58b488c 100644 --- a/definitions/grib2/tables/17/4.236.table +++ b/definitions/grib2/tables/17/4.236.table @@ -1,8 +1,8 @@ # Code table 4.236 - Soil texture fraction (to be used as partitioned parameter in product definition template 4.53 or 4.54) -1 1 Coarse -2 2 Medium -3 3 Medium-fine -4 4 Fine -5 5 Very-fine -6 6 Organic -7 7 Tropical-organic +1 1 Coarse +2 2 Medium +3 3 Medium-fine +4 4 Fine +5 5 Very-fine +6 6 Organic +7 7 Tropical-organic diff --git a/definitions/grib2/tables/17/4.240.table b/definitions/grib2/tables/17/4.240.table index ca335fea8..986557483 100644 --- a/definitions/grib2/tables/17/4.240.table +++ b/definitions/grib2/tables/17/4.240.table @@ -1,12 +1,12 @@ # Code table 4.240 - Type of distribution function -0 0 No specific distribution function given +0 0 No specific distribution function given 1 1 Delta functions with spatially variable concentration and fixed diameters Dl (p1) in metre -2 2 Delta functions with spatially variable concentration and fixed masses Ml (p1) in kg -3 3 Gaussian (normal) distribution with spatially variable concentration and fixed mean diameter Dl(p1) and variance(p2) -4 4 Gaussian (normal) distribution with spatially variable concentration, mean diameter and variance -5 5 Log-normal distribution with spatially variable number density, mean diameter and variance -6 6 Log-normal distribution with spatially variable number density, mean diameter and fixed variance(p1) +2 2 Delta functions with spatially variable concentration and fixed masses Ml (p1) in kg +3 3 Gaussian (normal) distribution with spatially variable concentration and fixed mean diameter Dl(p1) and variance(p2) +4 4 Gaussian (normal) distribution with spatially variable concentration, mean diameter and variance +5 5 Log-normal distribution with spatially variable number density, mean diameter and variance +6 6 Log-normal distribution with spatially variable number density, mean diameter and fixed variance(p1) 7 7 Log-normal distribution with spatially variable number density and mass density and fixed variance(p1) and fixed particle density(p2) -# 8-49151 Reserved -# 49152-65534 Reserved for local use -65535 65535 Missing value +# 8-49151 Reserved +# 49152-65534 Reserved for local use +65535 65535 Missing value diff --git a/definitions/grib2/tables/17/4.241.table b/definitions/grib2/tables/17/4.241.table index a037b4ba5..5ea7f775a 100644 --- a/definitions/grib2/tables/17/4.241.table +++ b/definitions/grib2/tables/17/4.241.table @@ -1,9 +1,9 @@ # Code table 4.241 - Coverage attributes -0 0 Undefined -1 1 Unmodified -2 2 Snow covered -3 3 Flooded -4 4 Ice covered -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 Undefined +1 1 Unmodified +2 2 Snow covered +3 3 Flooded +4 4 Ice covered +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/17/4.242.table b/definitions/grib2/tables/17/4.242.table index 083f88c29..f6865957c 100644 --- a/definitions/grib2/tables/17/4.242.table +++ b/definitions/grib2/tables/17/4.242.table @@ -1,7 +1,7 @@ # Code table 4.242 - Tile classification -0 0 Reserved -1 1 Land use classes according to ESA-GlobCover GCV2009 -2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 Reserved +1 1 Land use classes according to ESA-GlobCover GCV2009 +2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/17/4.243.table b/definitions/grib2/tables/17/4.243.table index b39053311..24d21b719 100644 --- a/definitions/grib2/tables/17/4.243.table +++ b/definitions/grib2/tables/17/4.243.table @@ -1,43 +1,43 @@ # Code table 4.243 - Tile class -0 0 Reserved -1 1 Evergreen broadleaved forest -2 2 Deciduous broadleaved closed forest -3 3 Deciduous broadleaved open forest -4 4 Evergreen needle-leaf forest -5 5 Deciduous needle-leaf forest -6 6 Mixed leaf trees -7 7 Freshwater flooded trees -8 8 Saline water flooded trees -9 9 Mosaic tree/natural vegetation -10 10 Burnt tree cover -11 11 Evergreen shrubs closed-open -12 12 Deciduous shrubs closed-open -13 13 Herbaceous vegetation closed-open -14 14 Sparse herbaceous or grass -15 15 Flooded shrubs or herbaceous -16 16 Cultivated and managed areas -17 17 Mosaic crop/tree/natural vegetation -18 18 Mosaic crop/shrub/grass -19 19 Bare areas -20 20 Water -21 21 Snow and ice -22 22 Artificial surface -23 23 Ocean -24 24 Irrigated croplands -25 25 Rainfed croplands -26 26 Mosaic cropland (50-70%) - vegetation (20-50%) -27 27 Mosaic vegetation (50-70%) - cropland (20-50%) -28 28 Closed broadleaved evergreen forest -29 29 Closed needle-leaved evergreen forest -30 30 Open needle-leaved deciduous forest -31 31 Mixed broadleaved and needle-leaved forest -32 32 Mosaic shrubland (50-70%) - grassland (20-50%) -33 33 Mosaic grassland (50-70%) - shrubland (20-50%) -34 34 Closed to open shrubland -35 35 Sparse vegetation -36 36 Closed to open forest regularly flooded -37 37 Closed forest or shrubland permanently flooded -38 38 Closed to open grassland regularly flooded -39 39 Undefined -# 40-32767 Reserved -# 32768- Reserved for local use +0 0 Reserved +1 1 Evergreen broadleaved forest +2 2 Deciduous broadleaved closed forest +3 3 Deciduous broadleaved open forest +4 4 Evergreen needle-leaf forest +5 5 Deciduous needle-leaf forest +6 6 Mixed leaf trees +7 7 Freshwater flooded trees +8 8 Saline water flooded trees +9 9 Mosaic tree/natural vegetation +10 10 Burnt tree cover +11 11 Evergreen shrubs closed-open +12 12 Deciduous shrubs closed-open +13 13 Herbaceous vegetation closed-open +14 14 Sparse herbaceous or grass +15 15 Flooded shrubs or herbaceous +16 16 Cultivated and managed areas +17 17 Mosaic crop/tree/natural vegetation +18 18 Mosaic crop/shrub/grass +19 19 Bare areas +20 20 Water +21 21 Snow and ice +22 22 Artificial surface +23 23 Ocean +24 24 Irrigated croplands +25 25 Rainfed croplands +26 26 Mosaic cropland (50-70%) - vegetation (20-50%) +27 27 Mosaic vegetation (50-70%) - cropland (20-50%) +28 28 Closed broadleaved evergreen forest +29 29 Closed needle-leaved evergreen forest +30 30 Open needle-leaved deciduous forest +31 31 Mixed broadleaved and needle-leaved forest +32 32 Mosaic shrubland (50-70%) - grassland (20-50%) +33 33 Mosaic grassland (50-70%) - shrubland (20-50%) +34 34 Closed to open shrubland +35 35 Sparse vegetation +36 36 Closed to open forest regularly flooded +37 37 Closed forest or shrubland permanently flooded +38 38 Closed to open grassland regularly flooded +39 39 Undefined +# 40-32767 Reserved +# 32768- Reserved for local use diff --git a/definitions/grib2/tables/17/4.3.table b/definitions/grib2/tables/17/4.3.table index f205ea0c2..bcf8102a1 100644 --- a/definitions/grib2/tables/17/4.3.table +++ b/definitions/grib2/tables/17/4.3.table @@ -1,22 +1,22 @@ # Code table 4.3 - Type of generating process -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -12 12 Post-processed analysis -13 13 Post-processed forecast -14 14 Nowcast -15 15 Hindcast -16 16 Physical retrieval -17 17 Regression analysis -# 18-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +12 12 Post-processed analysis +13 13 Post-processed forecast +14 14 Nowcast +15 15 Hindcast +16 16 Physical retrieval +17 17 Regression analysis +# 18-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.4.table b/definitions/grib2/tables/17/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/17/4.4.table +++ b/definitions/grib2/tables/17/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.5.table b/definitions/grib2/tables/17/4.5.table index e70520c3b..c2771c9c6 100644 --- a/definitions/grib2/tables/17/4.5.table +++ b/definitions/grib2/tables/17/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface (-) 2 2 Cloud base level (-) 3 3 Level of cloud tops (-) @@ -16,11 +16,11 @@ 14 14 Level of free convection (LFC) 15 15 Convective condensation level (CCL) 16 16 Level of neutral buoyancy or equilibrium level (LNB) -# 17-19 Reserved +# 17-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -29,19 +29,19 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level (-) -112 112 Reserved -113 113 Logarithmic hybrid level +112 112 Reserved +113 113 Logarithmic hybrid level 114 114 Snow level (Numeric) -# 115-116 Reserved +# 115-116 Reserved 117 117 Mixed layer depth (m) 118 hhl Hybrid height level (-) 119 hpl Hybrid pressure level (-) -# 120-149 Reserved -150 150 Generalized vertical height coordinate +# 120-149 Reserved +150 150 Generalized vertical height coordinate 151 sol Soil level (Numeric) -# 152-159 Reserved +# 152-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom (-) @@ -50,7 +50,7 @@ 165 165 Bottom of sediment layer penetrated by thermal wave (-) 166 sfc Mixing layer (-) 167 167 Bottom of root zone (-) -# 168-173 Reserved +# 168-173 Reserved 174 sfc Top surface of ice on sea, lake or river 175 175 Top surface of ice, under snow cover, on sea, lake or river 176 176 Bottom surface (underside) ice on sea, lake or river @@ -62,6 +62,6 @@ 182 182 Grid tile water fraction as a model surface 183 183 Grid tile ice fraction on sea, lake or river as a model surface 184 184 Grid tile glacier ice and inland ice fraction as a model surface -# 185-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 185-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.6.table b/definitions/grib2/tables/17/4.6.table index b2dfeb498..ce799721d 100644 --- a/definitions/grib2/tables/17/4.6.table +++ b/definitions/grib2/tables/17/4.6.table @@ -1,9 +1,9 @@ # Code table 4.6 - Type of ensemble forecast -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.7.table b/definitions/grib2/tables/17/4.7.table index e0de0e1b2..69b2b4d77 100644 --- a/definitions/grib2/tables/17/4.7.table +++ b/definitions/grib2/tables/17/4.7.table @@ -1,14 +1,14 @@ # Code table 4.7 - Derived forecast -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.8.table b/definitions/grib2/tables/17/4.8.table index ad883039c..78467454a 100644 --- a/definitions/grib2/tables/17/4.8.table +++ b/definitions/grib2/tables/17/4.8.table @@ -1,6 +1,6 @@ # Code table 4.8 - Clustering method -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.9.table b/definitions/grib2/tables/17/4.9.table index 5878b5ad3..0ce312dd1 100644 --- a/definitions/grib2/tables/17/4.9.table +++ b/definitions/grib2/tables/17/4.9.table @@ -1,9 +1,9 @@ # Code table 4.9 - Probability type -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/4.91.table b/definitions/grib2/tables/17/4.91.table index 44cf25f44..ae31ed61c 100644 --- a/definitions/grib2/tables/17/4.91.table +++ b/definitions/grib2/tables/17/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit -11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit +11 11 Equal to first limit +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/17/5.0.table b/definitions/grib2/tables/17/5.0.table index 5ec77ed0f..2795336df 100644 --- a/definitions/grib2/tables/17/5.0.table +++ b/definitions/grib2/tables/17/5.0.table @@ -1,23 +1,23 @@ # Code table 5.0 - Data representation template number -0 0 Grid point data - simple packing -1 1 Matrix value at grid point - simple packing -2 2 Grid point data - complex packing -3 3 Grid point data - complex packing and spatial differencing -4 4 Grid point data - IEEE floating point data -40 40 Grid point data - JPEG 2000 code stream format -41 41 Grid point data - Portable Network Graphics (PNG) -# 42-49 Reserved -50 50 Spectral data - simple packing -51 51 Spherical harmonics data - complex packing -# 52-60 Reserved -61 61 Grid point data - simple packing with logarithm pre-processing -# 62-199 Reserved -200 200 Run length packing with level values -# 201-49151 Reserved -# 49152-65534 Reserved for local use +0 0 Grid point data - simple packing +1 1 Matrix value at grid point - simple packing +2 2 Grid point data - complex packing +3 3 Grid point data - complex packing and spatial differencing +4 4 Grid point data - IEEE floating point data +40 40 Grid point data - JPEG 2000 code stream format +41 41 Grid point data - Portable Network Graphics (PNG) +# 42-49 Reserved +50 50 Spectral data - simple packing +51 51 Spherical harmonics data - complex packing +# 52-60 Reserved +61 61 Grid point data - simple packing with logarithm pre-processing +# 62-199 Reserved +200 200 Run length packing with level values +# 201-49151 Reserved +# 49152-65534 Reserved for local use 40000 40000 JPEG2000 Packing 40010 40010 PNG pacling 50000 50000 Sperical harmonics ieee packing 50001 50001 Second order packing 50002 50002 Second order packing -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/17/5.1.table b/definitions/grib2/tables/17/5.1.table index 854330c74..1189b5e46 100644 --- a/definitions/grib2/tables/17/5.1.table +++ b/definitions/grib2/tables/17/5.1.table @@ -1,6 +1,6 @@ # Code table 5.1 - Type of original field values -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/5.2.table b/definitions/grib2/tables/17/5.2.table index 40586a131..d77fdf4e7 100644 --- a/definitions/grib2/tables/17/5.2.table +++ b/definitions/grib2/tables/17/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/5.3.table b/definitions/grib2/tables/17/5.3.table index c3b7b30fe..481331791 100644 --- a/definitions/grib2/tables/17/5.3.table +++ b/definitions/grib2/tables/17/5.3.table @@ -1,7 +1,7 @@ # Code table 5.3 - Matrix coordinate parameter -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/5.4.table b/definitions/grib2/tables/17/5.4.table index 8121c1819..e84ab1901 100644 --- a/definitions/grib2/tables/17/5.4.table +++ b/definitions/grib2/tables/17/5.4.table @@ -1,6 +1,6 @@ # Code table 5.4 - Group splitting method -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/5.40.table b/definitions/grib2/tables/17/5.40.table index b9bad2c39..97e8880ab 100644 --- a/definitions/grib2/tables/17/5.40.table +++ b/definitions/grib2/tables/17/5.40.table @@ -1,5 +1,5 @@ # Code table 5.40 - Type of compression -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/17/5.5.table b/definitions/grib2/tables/17/5.5.table index 3ef3eb070..f2316975a 100644 --- a/definitions/grib2/tables/17/5.5.table +++ b/definitions/grib2/tables/17/5.5.table @@ -1,7 +1,7 @@ # Code table 5.5 - Missing value management for complex packing -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/5.6.table b/definitions/grib2/tables/17/5.6.table index 6d5177877..db68ead9c 100644 --- a/definitions/grib2/tables/17/5.6.table +++ b/definitions/grib2/tables/17/5.6.table @@ -1,7 +1,7 @@ # Code table 5.6 - Order of spatial differencing -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/17/5.7.table b/definitions/grib2/tables/17/5.7.table index 5ab780056..e54862c19 100644 --- a/definitions/grib2/tables/17/5.7.table +++ b/definitions/grib2/tables/17/5.7.table @@ -1,7 +1,7 @@ # Code table 5.7 - Precision of floating-point numbers -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/17/6.0.table b/definitions/grib2/tables/17/6.0.table index 2a29aa285..a8f30f5a4 100644 --- a/definitions/grib2/tables/17/6.0.table +++ b/definitions/grib2/tables/17/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator -0 0 A bit map applies to this product and is specified in this Section +0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/18/0.0.table b/definitions/grib2/tables/18/0.0.table index b24c50564..2c5afceb4 100644 --- a/definitions/grib2/tables/18/0.0.table +++ b/definitions/grib2/tables/18/0.0.table @@ -1,10 +1,10 @@ # Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/1.0.table b/definitions/grib2/tables/18/1.0.table index 8829485d9..0e6f26f8e 100644 --- a/definitions/grib2/tables/18/1.0.table +++ b/definitions/grib2/tables/18/1.0.table @@ -1,22 +1,22 @@ # Code table 1.0 - GRIB master tables version number -0 0 Experimental -1 1 Version implemented on 7 November 2001 -2 2 Version implemented on 4 November 2003 -3 3 Version implemented on 2 November 2005 -4 4 Version implemented on 7 November 2007 -5 5 Version implemented on 4 November 2009 -6 6 Version implemented on 15 September 2010 -7 7 Version implemented on 4 May 2011 -8 8 Version implemented on 2 November 2011 -9 9 Version implemented on 2 May 2012 -10 10 Version implemented on 7 November 2012 -11 11 Version implemented on 8 May 2013 -12 12 Version implemented on 14 November 2013 -13 13 Version implemented on 7 May 2014 -14 14 Version implemented on 5 November 2014 -15 15 Version implemented on 6 May 2015 -16 16 Version implemented on 11 November 2015 -17 17 Version implemented on 4 May 2016 +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 +6 6 Version implemented on 15 September 2010 +7 7 Version implemented on 4 May 2011 +8 8 Version implemented on 2 November 2011 +9 9 Version implemented on 2 May 2012 +10 10 Version implemented on 7 November 2012 +11 11 Version implemented on 8 May 2013 +12 12 Version implemented on 14 November 2013 +13 13 Version implemented on 7 May 2014 +14 14 Version implemented on 5 November 2014 +15 15 Version implemented on 6 May 2015 +16 16 Version implemented on 11 November 2015 +17 17 Version implemented on 4 May 2016 18 18 Version implemented on 2 November 2016 19 19 Pre-operational to be implemented by next amendment # 20-254 Future versions diff --git a/definitions/grib2/tables/18/1.1.table b/definitions/grib2/tables/18/1.1.table index d50f8fd72..f6d332005 100644 --- a/definitions/grib2/tables/18/1.1.table +++ b/definitions/grib2/tables/18/1.1.table @@ -1,4 +1,4 @@ # Code table 1.1 - GRIB local tables version number -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/18/1.2.table b/definitions/grib2/tables/18/1.2.table index 934b70455..638f1efbb 100644 --- a/definitions/grib2/tables/18/1.2.table +++ b/definitions/grib2/tables/18/1.2.table @@ -1,8 +1,8 @@ # Code table 1.2 - Significance of reference time -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/1.3.table b/definitions/grib2/tables/18/1.3.table index 0c95269d5..c1a9a7b9d 100644 --- a/definitions/grib2/tables/18/1.3.table +++ b/definitions/grib2/tables/18/1.3.table @@ -1,14 +1,14 @@ # Code table 1.3 - Production status of data -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products -4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products +4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) 5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) -6 6 S2S operational products -7 7 S2S test products +6 6 S2S operational products +7 7 S2S test products 8 8 Uncertainties in Ensembles of Regional ReAnalyses project (UERRA) 9 9 Uncertainties in Ensembles of Regional ReAnalyses project test (UERRA) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/1.4.table b/definitions/grib2/tables/18/1.4.table index 03203d874..877288c0e 100644 --- a/definitions/grib2/tables/18/1.4.table +++ b/definitions/grib2/tables/18/1.4.table @@ -1,13 +1,13 @@ # Code table 1.4 - Type of data -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/18/1.5.table b/definitions/grib2/tables/18/1.5.table index b2cf9f087..533111959 100644 --- a/definitions/grib2/tables/18/1.5.table +++ b/definitions/grib2/tables/18/1.5.table @@ -1,7 +1,7 @@ # Code table 1.5 - Identification template number -0 0 Calendar definition -1 1 Paleontological offset -2 2 Calendar definition and paleontological offset -# 3-32767 Reserved -# 32768-65534 Reserved for local use -65535 65535 Missing +0 0 Calendar definition +1 1 Paleontological offset +2 2 Calendar definition and paleontological offset +# 3-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/18/1.6.table b/definitions/grib2/tables/18/1.6.table index 5db921990..bd46899a7 100644 --- a/definitions/grib2/tables/18/1.6.table +++ b/definitions/grib2/tables/18/1.6.table @@ -1,8 +1,8 @@ # Code table 1.6 - Type of calendar -0 0 Gregorian -1 1 360-day -2 2 365-day -3 3 Proleptic Gregorian -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Gregorian +1 1 360-day +2 2 365-day +3 3 Proleptic Gregorian +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/3.0.table b/definitions/grib2/tables/18/3.0.table index 45187b80d..a442a06a0 100644 --- a/definitions/grib2/tables/18/3.0.table +++ b/definitions/grib2/tables/18/3.0.table @@ -1,6 +1,6 @@ # Code table 3.0 - Source of grid definition -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/18/3.10.table b/definitions/grib2/tables/18/3.10.table index afa8843a7..1612d05e3 100644 --- a/definitions/grib2/tables/18/3.10.table +++ b/definitions/grib2/tables/18/3.10.table @@ -1,8 +1,8 @@ # Flag table 3.10 - Scanning mode for one diamond -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/18/3.11.table b/definitions/grib2/tables/18/3.11.table index e516a2ab9..06ae10810 100644 --- a/definitions/grib2/tables/18/3.11.table +++ b/definitions/grib2/tables/18/3.11.table @@ -1,7 +1,7 @@ # Code table 3.11 - Interpretation of list of numbers at end of section 3 -0 0 There is no appended list -1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows -2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row -3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) -# 4-254 Reserved -255 255 Missing +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/18/3.15.table b/definitions/grib2/tables/18/3.15.table index 331217ebe..6087902a3 100644 --- a/definitions/grib2/tables/18/3.15.table +++ b/definitions/grib2/tables/18/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/3.2.table b/definitions/grib2/tables/18/3.2.table index 9238dc2a7..b9574a424 100644 --- a/definitions/grib2/tables/18/3.2.table +++ b/definitions/grib2/tables/18/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame -9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/3.20.table b/definitions/grib2/tables/18/3.20.table index efbf08d19..e2bb156ee 100644 --- a/definitions/grib2/tables/18/3.20.table +++ b/definitions/grib2/tables/18/3.20.table @@ -1,6 +1,6 @@ # Code table 3.20 - Type of horizontal line -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/3.21.table b/definitions/grib2/tables/18/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/18/3.21.table +++ b/definitions/grib2/tables/18/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/3.3.table b/definitions/grib2/tables/18/3.3.table index 5dd7c7001..25cb46a1d 100644 --- a/definitions/grib2/tables/18/3.3.table +++ b/definitions/grib2/tables/18/3.3.table @@ -1,9 +1,9 @@ # Flag table 3.3 - Resolution and component flags -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/18/3.4.table b/definitions/grib2/tables/18/3.4.table index 897b813d7..43835c014 100644 --- a/definitions/grib2/tables/18/3.4.table +++ b/definitions/grib2/tables/18/3.4.table @@ -1,17 +1,17 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -5 0 Points within odd rows are not offset in i (x) direction -5 1 Points within odd rows are offset by Di/2 in i (x) direction -6 0 Points within even rows are not offset in i (x) direction -6 1 Points within even rows are offset by Di/2 in i (x) direction -7 0 Points are not offset in j (y) direction -7 1 Points are offset by Dj/2 in j (y) direction -8 0 Rows have Ni grid points and columns have Nj grid points -8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +5 0 Points within odd rows are not offset in i (x) direction +5 1 Points within odd rows are offset by Di/2 in i (x) direction +6 0 Points within even rows are not offset in i (x) direction +6 1 Points within even rows are offset by Di/2 in i (x) direction +7 0 Points are not offset in j (y) direction +7 1 Points are offset by Dj/2 in j (y) direction +8 0 Rows have Ni grid points and columns have Nj grid points +8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction diff --git a/definitions/grib2/tables/18/3.5.table b/definitions/grib2/tables/18/3.5.table index eabdde896..2f8ec82e3 100644 --- a/definitions/grib2/tables/18/3.5.table +++ b/definitions/grib2/tables/18/3.5.table @@ -1,5 +1,5 @@ # Flag table 3.5 - Projection centre -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/18/3.7.table b/definitions/grib2/tables/18/3.7.table index 0a7d6efde..34c0de085 100644 --- a/definitions/grib2/tables/18/3.7.table +++ b/definitions/grib2/tables/18/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 see separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/18/3.8.table b/definitions/grib2/tables/18/3.8.table index 844e74235..578fab37f 100644 --- a/definitions/grib2/tables/18/3.8.table +++ b/definitions/grib2/tables/18/3.8.table @@ -1,7 +1,7 @@ # Code table 3.8 - Grid point position -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/3.9.table b/definitions/grib2/tables/18/3.9.table index fd730bc64..ecd65514a 100644 --- a/definitions/grib2/tables/18/3.9.table +++ b/definitions/grib2/tables/18/3.9.table @@ -1,4 +1,4 @@ # Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/18/4.0.table b/definitions/grib2/tables/18/4.0.table index 5ad2ed89a..aceff01af 100644 --- a/definitions/grib2/tables/18/4.0.table +++ b/definitions/grib2/tables/18/4.0.table @@ -1,72 +1,72 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time -8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time # 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data # 35-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol -46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol 49 49 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -# 50 Reserved -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +# 50 Reserved +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time # 52 Reserved -53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time -54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters -55 55 Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time +53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time +54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters +55 55 Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time 56 56 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters (deprecated) -57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function +57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function 58 58 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function 59 59 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters (corrected version of template 4.56) -60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval +60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval # 62-69 Reserved 70 70 Post-processing analysis or forecast at a horizontal level or in a horizontal layer at a point in time 71 71 Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time 72 72 Post-processing average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval 73 73 Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval # 74-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval # 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved -# 32768-65534 Reserved for local use +# 1102-32767 Reserved +# 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/18/4.1.0.table b/definitions/grib2/tables/18/4.1.0.table index 04cfd7802..df58636d6 100644 --- a/definitions/grib2/tables/18/4.1.0.table +++ b/definitions/grib2/tables/18/4.1.0.table @@ -1,27 +1,27 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.1.1.table b/definitions/grib2/tables/18/4.1.1.table index 7b22b6fed..05a854da0 100644 --- a/definitions/grib2/tables/18/4.1.1.table +++ b/definitions/grib2/tables/18/4.1.1.table @@ -1,7 +1,7 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.1.10.table b/definitions/grib2/tables/18/4.1.10.table index a9b20eb9c..88d3c8743 100644 --- a/definitions/grib2/tables/18/4.1.10.table +++ b/definitions/grib2/tables/18/4.1.10.table @@ -1,10 +1,10 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Subsurface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Subsurface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.1.2.table b/definitions/grib2/tables/18/4.1.2.table index 5b488fe9e..e74126645 100644 --- a/definitions/grib2/tables/18/4.1.2.table +++ b/definitions/grib2/tables/18/4.1.2.table @@ -1,9 +1,9 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.1.3.table b/definitions/grib2/tables/18/4.1.3.table index 7bf60d4a7..ba38c9301 100644 --- a/definitions/grib2/tables/18/4.1.3.table +++ b/definitions/grib2/tables/18/4.1.3.table @@ -1,11 +1,11 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Image format products -1 1 Quantitative products -2 2 Cloud properties -3 3 Flight rule conditions -4 4 Volcanic ash -5 5 Sea-surface temperature -6 6 Solar radiation -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +2 2 Cloud properties +3 3 Flight rule conditions +4 4 Volcanic ash +5 5 Sea-surface temperature +6 6 Solar radiation +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.10.table b/definitions/grib2/tables/18/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/18/4.10.table +++ b/definitions/grib2/tables/18/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/18/4.11.table b/definitions/grib2/tables/18/4.11.table index 7f404c849..01cc81303 100644 --- a/definitions/grib2/tables/18/4.11.table +++ b/definitions/grib2/tables/18/4.11.table @@ -1,10 +1,10 @@ # Code table 4.11 - Type of time intervals -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.12.table b/definitions/grib2/tables/18/4.12.table index 03fd89b36..d42b47e96 100644 --- a/definitions/grib2/tables/18/4.12.table +++ b/definitions/grib2/tables/18/4.12.table @@ -1,7 +1,7 @@ # Code table 4.12 - Operating mode -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.13.table b/definitions/grib2/tables/18/4.13.table index c92854eec..a0e28eac8 100644 --- a/definitions/grib2/tables/18/4.13.table +++ b/definitions/grib2/tables/18/4.13.table @@ -1,6 +1,6 @@ # Code table 4.13 - Quality control indicator -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.14.table b/definitions/grib2/tables/18/4.14.table index a88cb93fa..d525b23b3 100644 --- a/definitions/grib2/tables/18/4.14.table +++ b/definitions/grib2/tables/18/4.14.table @@ -1,6 +1,6 @@ # Code table 4.14 - Clutter filter indicator -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.15.table b/definitions/grib2/tables/18/4.15.table index 2e5f3dea3..7adddedb6 100644 --- a/definitions/grib2/tables/18/4.15.table +++ b/definitions/grib2/tables/18/4.15.table @@ -1,11 +1,11 @@ # Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.0.table b/definitions/grib2/tables/18/4.2.0.0.table index 7201a8667..83b3e8ef1 100644 --- a/definitions/grib2/tables/18/4.2.0.0.table +++ b/definitions/grib2/tables/18/4.2.0.0.table @@ -29,6 +29,6 @@ 27 27 Wet-bulb temperature (K) 28 28 Unbalanced component of temperature (K) 29 29 Temperature advection (K s-1) -# 30-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 30-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.1.table b/definitions/grib2/tables/18/4.2.0.1.table index c38d6a053..7d43684d3 100644 --- a/definitions/grib2/tables/18/4.2.0.1.table +++ b/definitions/grib2/tables/18/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,7 +86,7 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) @@ -118,6 +118,6 @@ 118 118 Unbalanced component of specific humidity (kg kg-1) 119 119 Unbalanced component of specific cloud liquid water content (kg kg-1) 120 120 Unbalanced component of specific cloud ice water content (kg kg-1) -# 121-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 121-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.13.table b/definitions/grib2/tables/18/4.2.0.13.table index 5086101ad..3f5c30675 100644 --- a/definitions/grib2/tables/18/4.2.0.13.table +++ b/definitions/grib2/tables/18/4.2.0.13.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.14.table b/definitions/grib2/tables/18/4.2.0.14.table index 215884737..97fb38c8b 100644 --- a/definitions/grib2/tables/18/4.2.0.14.table +++ b/definitions/grib2/tables/18/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.15.table b/definitions/grib2/tables/18/4.2.0.15.table index dfbc4d12f..8df082466 100644 --- a/definitions/grib2/tables/18/4.2.0.15.table +++ b/definitions/grib2/tables/18/4.2.0.15.table @@ -16,6 +16,6 @@ 14 14 Reflectivity of hail (dB) 15 15 Hybrid scan reflectivity (dB) 16 16 Hybrid scan reflectivity height (m) -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.16.table b/definitions/grib2/tables/18/4.2.0.16.table index 0c240a853..9499d9333 100644 --- a/definitions/grib2/tables/18/4.2.0.16.table +++ b/definitions/grib2/tables/18/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.18.table b/definitions/grib2/tables/18/4.2.0.18.table index 9d106f419..9ca6db61e 100644 --- a/definitions/grib2/tables/18/4.2.0.18.table +++ b/definitions/grib2/tables/18/4.2.0.18.table @@ -8,7 +8,7 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) @@ -18,6 +18,6 @@ 16 16 Height of maximum air concentration (m) 17 17 Column-integrated air concentration (Bq m-2) 18 18 Column-averaged air concentration in layer (Bq m-3) -# 19-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 19-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.19.table b/definitions/grib2/tables/18/4.2.0.19.table index 8705082c5..e4db36249 100644 --- a/definitions/grib2/tables/18/4.2.0.19.table +++ b/definitions/grib2/tables/18/4.2.0.19.table @@ -31,6 +31,6 @@ 29 29 Clear air turbulence (CAT) (m2/3 s-1) 30 30 Eddy dissipation parameter (m2/3 s-1) 31 31 Maximum of Eddy dissipation parameter in layer (m2/3 s-1) -# 32-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 32-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.190.table b/definitions/grib2/tables/18/4.2.0.190.table index de621a924..a0d6ba0ac 100644 --- a/definitions/grib2/tables/18/4.2.0.190.table +++ b/definitions/grib2/tables/18/4.2.0.190.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.191.table b/definitions/grib2/tables/18/4.2.0.191.table index e3bba0ebe..b3a7092ea 100644 --- a/definitions/grib2/tables/18/4.2.0.191.table +++ b/definitions/grib2/tables/18/4.2.0.191.table @@ -3,6 +3,6 @@ 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.2.table b/definitions/grib2/tables/18/4.2.0.2.table index 5446262e6..8a70b2591 100644 --- a/definitions/grib2/tables/18/4.2.0.2.table +++ b/definitions/grib2/tables/18/4.2.0.2.table @@ -46,6 +46,6 @@ 44 44 Geostrophic wind speed (m s-1) 45 45 Unbalanced component of divergence (s-1) 46 46 Vorticity advection (s-2) -# 47-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 47-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.20.table b/definitions/grib2/tables/18/4.2.0.20.table index efc427a19..bbdeef5b1 100644 --- a/definitions/grib2/tables/18/4.2.0.20.table +++ b/definitions/grib2/tables/18/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -29,7 +29,7 @@ 61 61 Maximum of mass density in layer (kg m-3) 62 62 Height of maximum mass density (m) 63 63 Column-averaged mass density in layer (kg m-3) -# 64-99 Reserved +# 64-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -42,6 +42,6 @@ 109 109 Aerosol lidar extinction from satellite (/m) 110 110 Aerosol lidar extinction from the ground (/m) 111 111 Angstrom exponent (Numeric) -# 112-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 112-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.3.table b/definitions/grib2/tables/18/4.2.0.3.table index 34941dcab..52c421b97 100644 --- a/definitions/grib2/tables/18/4.2.0.3.table +++ b/definitions/grib2/tables/18/4.2.0.3.table @@ -31,6 +31,6 @@ 29 29 Updraught detrainment rate (kg m-3 s-1) 30 30 Downdraught detrainment rate (kg m-3 s-1) 31 31 Unbalanced component of logarithm of surface pressure (-) -# 32-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 32-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.4.table b/definitions/grib2/tables/18/4.2.0.4.table index 0a5ded2b5..f97270456 100644 --- a/definitions/grib2/tables/18/4.2.0.4.table +++ b/definitions/grib2/tables/18/4.2.0.4.table @@ -14,11 +14,11 @@ 12 12 Downward UV radiation (W m-2) 13 13 Direct short-wave radiation flux (W m-2) 14 14 Diffuse short-wave radiation flux (W m-2) -# 15-49 Reserved +# 15-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) 52 52 Downward short-wave radiation flux, clear sky (W m-2) 53 53 Upward short-wave radiation flux, clear sky (W m-2) -# 54-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 54-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.5.table b/definitions/grib2/tables/18/4.2.0.5.table index 4550220b6..ddfa634ce 100644 --- a/definitions/grib2/tables/18/4.2.0.5.table +++ b/definitions/grib2/tables/18/4.2.0.5.table @@ -8,6 +8,6 @@ 6 6 Net long-wave radiation flux, clear sky (W m-2) 7 7 Brightness temperature (K) 8 8 Downward long-wave radiation flux, clear sky (W m-2) -# 9-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 9-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.6.table b/definitions/grib2/tables/18/4.2.0.6.table index 4cec0c8aa..0450ec194 100644 --- a/definitions/grib2/tables/18/4.2.0.6.table +++ b/definitions/grib2/tables/18/4.2.0.6.table @@ -40,10 +40,10 @@ 38 38 Mass density of cloud droplets (kg m-3) 39 39 Mass density of cloud ice (kg m-3) 40 40 Mass density of convective cloud water droplets (kg m-3) -# 41-46 Reserved +# 41-46 Reserved 47 47 Volume fraction of cloud water droplets (Numeric) 48 48 Volume fraction of cloud ice particles (Numeric) 49 49 Volume fraction of cloud (ice and/or water) (Numeric) -# 50-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 50-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.0.7.table b/definitions/grib2/tables/18/4.2.0.7.table index 6d0d87a46..3e653431f 100644 --- a/definitions/grib2/tables/18/4.2.0.7.table +++ b/definitions/grib2/tables/18/4.2.0.7.table @@ -13,11 +13,11 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraught helicity (m2 s-2) 16 16 Bulk Richardson number (Numeric) 17 17 Gradient Richardson number (Numeric) 18 18 Flux Richardson number (Numeric) -# 19-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 19-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.1.0.table b/definitions/grib2/tables/18/4.2.1.0.table index bcd849c2e..a2660f4f3 100644 --- a/definitions/grib2/tables/18/4.2.1.0.table +++ b/definitions/grib2/tables/18/4.2.1.0.table @@ -16,6 +16,6 @@ 14 14 Upstream accumulated precipitation (kg m-2) 15 15 Upstream accumulated snow melt (kg m-2) 16 16 Percolation rate (kg m-2 s-1) -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.1.1.table b/definitions/grib2/tables/18/4.2.1.1.table index b488eb0bd..171da3958 100644 --- a/definitions/grib2/tables/18/4.2.1.1.table +++ b/definitions/grib2/tables/18/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.10.0.table b/definitions/grib2/tables/18/4.2.10.0.table index 095f51bdf..3611abd9a 100644 --- a/definitions/grib2/tables/18/4.2.10.0.table +++ b/definitions/grib2/tables/18/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea-surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (/s) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.10.1.table b/definitions/grib2/tables/18/4.2.10.1.table index 5959bfa28..f0a073c00 100644 --- a/definitions/grib2/tables/18/4.2.10.1.table +++ b/definitions/grib2/tables/18/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.10.191.table b/definitions/grib2/tables/18/4.2.10.191.table index 524929e78..1ebf85006 100644 --- a/definitions/grib2/tables/18/4.2.10.191.table +++ b/definitions/grib2/tables/18/4.2.10.191.table @@ -1,8 +1,8 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -2 2 Reserved +2 2 Reserved 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.10.2.table b/definitions/grib2/tables/18/4.2.10.2.table index 6797062ac..4633bad4f 100644 --- a/definitions/grib2/tables/18/4.2.10.2.table +++ b/definitions/grib2/tables/18/4.2.10.2.table @@ -12,6 +12,6 @@ 10 10 Zonal vector component of vertically integrated ice internal pressure (Pa m) 11 11 Meridional vector component of vertically integrated ice internal pressure (Pa m) 12 12 Compressive ice strength (N/m) -# 13-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 13-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.10.3.table b/definitions/grib2/tables/18/4.2.10.3.table index de7afd61c..b01d7ae46 100644 --- a/definitions/grib2/tables/18/4.2.10.3.table +++ b/definitions/grib2/tables/18/4.2.10.3.table @@ -2,6 +2,6 @@ 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) 2 2 Heat exchange coefficient (-) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.10.4.table b/definitions/grib2/tables/18/4.2.10.4.table index 54774f1b7..d5615ae26 100644 --- a/definitions/grib2/tables/18/4.2.10.4.table +++ b/definitions/grib2/tables/18/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2/s) 6 6 Ocean vertical momentum diffusivity (m2/s) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (/m) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.2.0.table b/definitions/grib2/tables/18/4.2.2.0.table index 81548840c..b253cac22 100644 --- a/definitions/grib2/tables/18/4.2.2.0.table +++ b/definitions/grib2/tables/18/4.2.2.0.table @@ -38,6 +38,6 @@ 36 36 Tile fraction (Proportion) 37 37 Tile percentage (%) 38 38 Soil volumetric ice content (water equivalent) (m3 m-3) -# 39-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 39-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.2.3.table b/definitions/grib2/tables/18/4.2.2.3.table index 690fab42b..2674e9f42 100644 --- a/definitions/grib2/tables/18/4.2.2.3.table +++ b/definitions/grib2/tables/18/4.2.2.3.table @@ -27,6 +27,6 @@ 25 25 Snow depth at elevation bands (kg m-2) 26 26 Soil heat flux (W m-2) 27 27 Soil depth (m) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.2.4.table b/definitions/grib2/tables/18/4.2.2.4.table index bb54fac22..ceb761557 100644 --- a/definitions/grib2/tables/18/4.2.2.4.table +++ b/definitions/grib2/tables/18/4.2.2.4.table @@ -11,6 +11,6 @@ 9 9 Initial Fire Spread Index (Canadian Forest Service) (Numeric) 10 10 Fire Buildup Index (Canadian Forest Service) (Numeric) 11 11 Fire Daily Severity Rating (Canadian Forest Service) (Numeric) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.3.0.table b/definitions/grib2/tables/18/4.2.3.0.table index c0ffa29f5..80a829673 100644 --- a/definitions/grib2/tables/18/4.2.3.0.table +++ b/definitions/grib2/tables/18/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.2.3.1.table b/definitions/grib2/tables/18/4.2.3.1.table index 8e0793fe0..04cdde1f1 100644 --- a/definitions/grib2/tables/18/4.2.3.1.table +++ b/definitions/grib2/tables/18/4.2.3.1.table @@ -17,16 +17,16 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-26 Reserved +23 23 Angstrom coefficient +# 24-26 Reserved 27 27 Bidirectional reflectance factor (Numeric) 28 28 Brightness temperature (K) 29 29 Scaled radiance (Numeric) -# 30-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 30-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.201.table b/definitions/grib2/tables/18/4.201.table index 47f1b486f..fa173c4e0 100644 --- a/definitions/grib2/tables/18/4.201.table +++ b/definitions/grib2/tables/18/4.201.table @@ -1,15 +1,15 @@ # Code table 4.201 - Precipitation type -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow -6 6 Wet snow -7 7 Mixture of rain and snow -8 8 Ice pellets -9 9 Graupel -10 10 Hail -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +6 6 Wet snow +7 7 Mixture of rain and snow +8 8 Ice pellets +9 9 Graupel +10 10 Hail +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.202.table b/definitions/grib2/tables/18/4.202.table index 438502ff9..7f3c8f6cf 100644 --- a/definitions/grib2/tables/18/4.202.table +++ b/definitions/grib2/tables/18/4.202.table @@ -1,4 +1,4 @@ # Code table 4.202 - Precipitable water category -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.203.table b/definitions/grib2/tables/18/4.203.table index 8a9aedf7a..cf5eb6bdc 100644 --- a/definitions/grib2/tables/18/4.203.table +++ b/definitions/grib2/tables/18/4.203.table @@ -1,26 +1,26 @@ # Code table 4.203 - Cloud type -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.204.table b/definitions/grib2/tables/18/4.204.table index 481372936..8e0be1f8c 100644 --- a/definitions/grib2/tables/18/4.204.table +++ b/definitions/grib2/tables/18/4.204.table @@ -1,9 +1,9 @@ # Code table 4.204 - Thunderstorm coverage -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (6-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (6-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.205.table b/definitions/grib2/tables/18/4.205.table index 5b4484dfd..c40c7f47b 100644 --- a/definitions/grib2/tables/18/4.205.table +++ b/definitions/grib2/tables/18/4.205.table @@ -1,6 +1,6 @@ # Code table 4.205 - Presence of aerosol -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.206.table b/definitions/grib2/tables/18/4.206.table index 02c3dfdf9..76472c261 100644 --- a/definitions/grib2/tables/18/4.206.table +++ b/definitions/grib2/tables/18/4.206.table @@ -1,6 +1,6 @@ # Code table 4.206 - Volcanic ash -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.207.table b/definitions/grib2/tables/18/4.207.table index 8ddb2e048..b6392fca0 100644 --- a/definitions/grib2/tables/18/4.207.table +++ b/definitions/grib2/tables/18/4.207.table @@ -1,10 +1,10 @@ # Code table 4.207 - Icing -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.208.table b/definitions/grib2/tables/18/4.208.table index b83685a1a..4361d38c0 100644 --- a/definitions/grib2/tables/18/4.208.table +++ b/definitions/grib2/tables/18/4.208.table @@ -1,9 +1,9 @@ # Code table 4.208 - Turbulence -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.209.table b/definitions/grib2/tables/18/4.209.table index cb7617071..39ea549ac 100644 --- a/definitions/grib2/tables/18/4.209.table +++ b/definitions/grib2/tables/18/4.209.table @@ -1,9 +1,9 @@ # Code table 4.209 - Planetary boundary-layer regime -0 0 Reserved -1 1 Stable -2 2 Mechanically driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.210.table b/definitions/grib2/tables/18/4.210.table index c01f4bcca..791878469 100644 --- a/definitions/grib2/tables/18/4.210.table +++ b/definitions/grib2/tables/18/4.210.table @@ -1,6 +1,6 @@ # Code table 4.210 - Contrail intensity 0 0 Contrail not present 1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.211.table b/definitions/grib2/tables/18/4.211.table index 098eb2d43..2a28a84d9 100644 --- a/definitions/grib2/tables/18/4.211.table +++ b/definitions/grib2/tables/18/4.211.table @@ -1,7 +1,7 @@ # Code table 4.211 - Contrail engine type -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.212.table b/definitions/grib2/tables/18/4.212.table index 1a085b88d..6a3dcf88c 100644 --- a/definitions/grib2/tables/18/4.212.table +++ b/definitions/grib2/tables/18/4.212.table @@ -1,18 +1,18 @@ # Code table 4.212 - Land use -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.213.table b/definitions/grib2/tables/18/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/18/4.213.table +++ b/definitions/grib2/tables/18/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.215.table b/definitions/grib2/tables/18/4.215.table index 034db72be..7888772d5 100644 --- a/definitions/grib2/tables/18/4.215.table +++ b/definitions/grib2/tables/18/4.215.table @@ -1,9 +1,9 @@ # Code table 4.215 - Remotely sensed snow coverage -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.216.table b/definitions/grib2/tables/18/4.216.table index 5d1460cef..b51b358f4 100644 --- a/definitions/grib2/tables/18/4.216.table +++ b/definitions/grib2/tables/18/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain -# 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 0-90 Elevation in increments of 100 m +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/18/4.217.table b/definitions/grib2/tables/18/4.217.table index a4452182c..a700410d5 100644 --- a/definitions/grib2/tables/18/4.217.table +++ b/definitions/grib2/tables/18/4.217.table @@ -1,8 +1,8 @@ # Code table 4.217 - Cloud mask type -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.218.table b/definitions/grib2/tables/18/4.218.table index 7e3a69578..b5b15150b 100644 --- a/definitions/grib2/tables/18/4.218.table +++ b/definitions/grib2/tables/18/4.218.table @@ -1,44 +1,44 @@ # Code table 4.218 - Pixel scene type -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation/crops -15 15 Permanent snow/ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -19 19 Warm liquid water cloud -20 20 Supercooled liquid water cloud -21 21 Mixed-phase cloud -22 22 Optically thin ice cloud -23 23 Optically thick ice cloud -24 24 Multilayered cloud -# 25-96 Reserved -97 97 Snow/ice on land -98 98 Snow/ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud/fog/Stratus -102 102 Low cloud/Stratocumulus -103 103 Low cloud/unknown type -104 104 Medium cloud/Nimbostratus -105 105 Medium cloud/Altostratus -106 106 Medium cloud/unknown type -107 107 High cloud/Cumulus -108 108 High cloud/Cirrus -109 109 High cloud/unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation/crops +15 15 Permanent snow/ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +19 19 Warm liquid water cloud +20 20 Supercooled liquid water cloud +21 21 Mixed-phase cloud +22 22 Optically thin ice cloud +23 23 Optically thick ice cloud +24 24 Multilayered cloud +# 25-96 Reserved +97 97 Snow/ice on land +98 98 Snow/ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud/fog/Stratus +102 102 Low cloud/Stratocumulus +103 103 Low cloud/unknown type +104 104 Medium cloud/Nimbostratus +105 105 Medium cloud/Altostratus +106 106 Medium cloud/unknown type +107 107 High cloud/Cumulus +108 108 High cloud/Cirrus +109 109 High cloud/unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.219.table b/definitions/grib2/tables/18/4.219.table index 86df0522e..9979f50ad 100644 --- a/definitions/grib2/tables/18/4.219.table +++ b/definitions/grib2/tables/18/4.219.table @@ -1,8 +1,8 @@ # Code table 4.219 - Cloud top height quality indicator -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.220.table b/definitions/grib2/tables/18/4.220.table index 93e841f8b..88e869e42 100644 --- a/definitions/grib2/tables/18/4.220.table +++ b/definitions/grib2/tables/18/4.220.table @@ -1,6 +1,6 @@ # Code table 4.220 - Horizontal dimension processed -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.221.table b/definitions/grib2/tables/18/4.221.table index 8448533d7..011cc3518 100644 --- a/definitions/grib2/tables/18/4.221.table +++ b/definitions/grib2/tables/18/4.221.table @@ -1,6 +1,6 @@ # Code table 4.221 - Treatment of missing data -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.222.table b/definitions/grib2/tables/18/4.222.table index 57f113014..558d947ac 100644 --- a/definitions/grib2/tables/18/4.222.table +++ b/definitions/grib2/tables/18/4.222.table @@ -1,6 +1,6 @@ # Code table 4.222 - Categorical result -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.223.table b/definitions/grib2/tables/18/4.223.table index f0deb076a..572c4e7a8 100644 --- a/definitions/grib2/tables/18/4.223.table +++ b/definitions/grib2/tables/18/4.223.table @@ -1,5 +1,5 @@ # Code table 4.223 - Fire detection indicator -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing diff --git a/definitions/grib2/tables/18/4.224.table b/definitions/grib2/tables/18/4.224.table index e87cde4bb..014f56e23 100644 --- a/definitions/grib2/tables/18/4.224.table +++ b/definitions/grib2/tables/18/4.224.table @@ -1,18 +1,18 @@ # Code table 4.224 - Categorical outlook -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/18/4.227.table b/definitions/grib2/tables/18/4.227.table index 27c76553d..48c3b7633 100644 --- a/definitions/grib2/tables/18/4.227.table +++ b/definitions/grib2/tables/18/4.227.table @@ -1,9 +1,9 @@ # Code table 4.227 - Icing scenario (weather/cloud classification) -0 0 None -1 1 General -2 2 Convective -3 3 Stratiform -4 4 Freezing -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 None +1 1 General +2 2 Convective +3 3 Stratiform +4 4 Freezing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/18/4.234.table b/definitions/grib2/tables/18/4.234.table index 816541ce9..3b05b4515 100644 --- a/definitions/grib2/tables/18/4.234.table +++ b/definitions/grib2/tables/18/4.234.table @@ -1,21 +1,21 @@ # Code table 4.234 - Canopy cover fraction (to be used as partitioned parameter in product definition template 4.53 or 4.54) -1 1 Crops, mixed farming -2 2 Short grass -3 3 Evergreen needleleaf trees -4 4 Deciduous needleleaf trees -5 5 Deciduous broadleaf trees -6 6 Evergreen broadleaf trees -7 7 Tall grass -8 8 Desert -9 9 Tundra -10 10 Irrigated crops -11 11 Semidesert -12 12 Ice caps and glaciers -13 13 Bogs and marshes -14 14 Inland water -15 15 Ocean -16 16 Evergreen shrubs -17 17 Deciduous shrubs -18 18 Mixed forest -19 19 Interrupted forest -20 20 Water and land mixtures +1 1 Crops, mixed farming +2 2 Short grass +3 3 Evergreen needleleaf trees +4 4 Deciduous needleleaf trees +5 5 Deciduous broadleaf trees +6 6 Evergreen broadleaf trees +7 7 Tall grass +8 8 Desert +9 9 Tundra +10 10 Irrigated crops +11 11 Semidesert +12 12 Ice caps and glaciers +13 13 Bogs and marshes +14 14 Inland water +15 15 Ocean +16 16 Evergreen shrubs +17 17 Deciduous shrubs +18 18 Mixed forest +19 19 Interrupted forest +20 20 Water and land mixtures diff --git a/definitions/grib2/tables/18/4.236.table b/definitions/grib2/tables/18/4.236.table index fbe093ce9..9c58b488c 100644 --- a/definitions/grib2/tables/18/4.236.table +++ b/definitions/grib2/tables/18/4.236.table @@ -1,8 +1,8 @@ # Code table 4.236 - Soil texture fraction (to be used as partitioned parameter in product definition template 4.53 or 4.54) -1 1 Coarse -2 2 Medium -3 3 Medium-fine -4 4 Fine -5 5 Very-fine -6 6 Organic -7 7 Tropical-organic +1 1 Coarse +2 2 Medium +3 3 Medium-fine +4 4 Fine +5 5 Very-fine +6 6 Organic +7 7 Tropical-organic diff --git a/definitions/grib2/tables/18/4.240.table b/definitions/grib2/tables/18/4.240.table index 7313e6eec..986557483 100644 --- a/definitions/grib2/tables/18/4.240.table +++ b/definitions/grib2/tables/18/4.240.table @@ -1,12 +1,12 @@ # Code table 4.240 - Type of distribution function -0 0 No specific distribution function given -1 1 Delta functions with spatially variable concentration and fixed diameters Dl (p1) in metre -2 2 Delta functions with spatially variable concentration and fixed masses Ml (p1) in kg -3 3 Gaussian (normal) distribution with spatially variable concentration and fixed mean diameter Dl(p1) and variance(p2) -4 4 Gaussian (normal) distribution with spatially variable concentration, mean diameter and variance -5 5 Log-normal distribution with spatially variable number density, mean diameter and variance -6 6 Log-normal distribution with spatially variable number density, mean diameter and fixed variance(p1) +0 0 No specific distribution function given +1 1 Delta functions with spatially variable concentration and fixed diameters Dl (p1) in metre +2 2 Delta functions with spatially variable concentration and fixed masses Ml (p1) in kg +3 3 Gaussian (normal) distribution with spatially variable concentration and fixed mean diameter Dl(p1) and variance(p2) +4 4 Gaussian (normal) distribution with spatially variable concentration, mean diameter and variance +5 5 Log-normal distribution with spatially variable number density, mean diameter and variance +6 6 Log-normal distribution with spatially variable number density, mean diameter and fixed variance(p1) 7 7 Log-normal distribution with spatially variable number density and mass density and fixed variance(p1) and fixed particle density(p2) -# 8-49151 Reserved -# 49152-65534 Reserved for local use -65535 65535 Missing value +# 8-49151 Reserved +# 49152-65534 Reserved for local use +65535 65535 Missing value diff --git a/definitions/grib2/tables/18/4.241.table b/definitions/grib2/tables/18/4.241.table index a037b4ba5..5ea7f775a 100644 --- a/definitions/grib2/tables/18/4.241.table +++ b/definitions/grib2/tables/18/4.241.table @@ -1,9 +1,9 @@ # Code table 4.241 - Coverage attributes -0 0 Undefined -1 1 Unmodified -2 2 Snow covered -3 3 Flooded -4 4 Ice covered -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 Undefined +1 1 Unmodified +2 2 Snow covered +3 3 Flooded +4 4 Ice covered +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/18/4.242.table b/definitions/grib2/tables/18/4.242.table index 083f88c29..f6865957c 100644 --- a/definitions/grib2/tables/18/4.242.table +++ b/definitions/grib2/tables/18/4.242.table @@ -1,7 +1,7 @@ # Code table 4.242 - Tile classification -0 0 Reserved -1 1 Land use classes according to ESA-GlobCover GCV2009 -2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 Reserved +1 1 Land use classes according to ESA-GlobCover GCV2009 +2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/18/4.243.table b/definitions/grib2/tables/18/4.243.table index b39053311..24d21b719 100644 --- a/definitions/grib2/tables/18/4.243.table +++ b/definitions/grib2/tables/18/4.243.table @@ -1,43 +1,43 @@ # Code table 4.243 - Tile class -0 0 Reserved -1 1 Evergreen broadleaved forest -2 2 Deciduous broadleaved closed forest -3 3 Deciduous broadleaved open forest -4 4 Evergreen needle-leaf forest -5 5 Deciduous needle-leaf forest -6 6 Mixed leaf trees -7 7 Freshwater flooded trees -8 8 Saline water flooded trees -9 9 Mosaic tree/natural vegetation -10 10 Burnt tree cover -11 11 Evergreen shrubs closed-open -12 12 Deciduous shrubs closed-open -13 13 Herbaceous vegetation closed-open -14 14 Sparse herbaceous or grass -15 15 Flooded shrubs or herbaceous -16 16 Cultivated and managed areas -17 17 Mosaic crop/tree/natural vegetation -18 18 Mosaic crop/shrub/grass -19 19 Bare areas -20 20 Water -21 21 Snow and ice -22 22 Artificial surface -23 23 Ocean -24 24 Irrigated croplands -25 25 Rainfed croplands -26 26 Mosaic cropland (50-70%) - vegetation (20-50%) -27 27 Mosaic vegetation (50-70%) - cropland (20-50%) -28 28 Closed broadleaved evergreen forest -29 29 Closed needle-leaved evergreen forest -30 30 Open needle-leaved deciduous forest -31 31 Mixed broadleaved and needle-leaved forest -32 32 Mosaic shrubland (50-70%) - grassland (20-50%) -33 33 Mosaic grassland (50-70%) - shrubland (20-50%) -34 34 Closed to open shrubland -35 35 Sparse vegetation -36 36 Closed to open forest regularly flooded -37 37 Closed forest or shrubland permanently flooded -38 38 Closed to open grassland regularly flooded -39 39 Undefined -# 40-32767 Reserved -# 32768- Reserved for local use +0 0 Reserved +1 1 Evergreen broadleaved forest +2 2 Deciduous broadleaved closed forest +3 3 Deciduous broadleaved open forest +4 4 Evergreen needle-leaf forest +5 5 Deciduous needle-leaf forest +6 6 Mixed leaf trees +7 7 Freshwater flooded trees +8 8 Saline water flooded trees +9 9 Mosaic tree/natural vegetation +10 10 Burnt tree cover +11 11 Evergreen shrubs closed-open +12 12 Deciduous shrubs closed-open +13 13 Herbaceous vegetation closed-open +14 14 Sparse herbaceous or grass +15 15 Flooded shrubs or herbaceous +16 16 Cultivated and managed areas +17 17 Mosaic crop/tree/natural vegetation +18 18 Mosaic crop/shrub/grass +19 19 Bare areas +20 20 Water +21 21 Snow and ice +22 22 Artificial surface +23 23 Ocean +24 24 Irrigated croplands +25 25 Rainfed croplands +26 26 Mosaic cropland (50-70%) - vegetation (20-50%) +27 27 Mosaic vegetation (50-70%) - cropland (20-50%) +28 28 Closed broadleaved evergreen forest +29 29 Closed needle-leaved evergreen forest +30 30 Open needle-leaved deciduous forest +31 31 Mixed broadleaved and needle-leaved forest +32 32 Mosaic shrubland (50-70%) - grassland (20-50%) +33 33 Mosaic grassland (50-70%) - shrubland (20-50%) +34 34 Closed to open shrubland +35 35 Sparse vegetation +36 36 Closed to open forest regularly flooded +37 37 Closed forest or shrubland permanently flooded +38 38 Closed to open grassland regularly flooded +39 39 Undefined +# 40-32767 Reserved +# 32768- Reserved for local use diff --git a/definitions/grib2/tables/18/4.3.table b/definitions/grib2/tables/18/4.3.table index 8ba9e08ab..cea1bef4f 100644 --- a/definitions/grib2/tables/18/4.3.table +++ b/definitions/grib2/tables/18/4.3.table @@ -1,23 +1,23 @@ # Code table 4.3 - Type of generating process -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -12 12 Post-processed analysis -13 13 Post-processed forecast -14 14 Nowcast -15 15 Hindcast -16 16 Physical retrieval -17 17 Regression analysis -18 18 Difference between two forecasts -# 19-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +12 12 Post-processed analysis +13 13 Post-processed forecast +14 14 Nowcast +15 15 Hindcast +16 16 Physical retrieval +17 17 Regression analysis +18 18 Difference between two forecasts +# 19-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.4.table b/definitions/grib2/tables/18/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/18/4.4.table +++ b/definitions/grib2/tables/18/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.5.table b/definitions/grib2/tables/18/4.5.table index 2f1a8a8b7..33abd6293 100644 --- a/definitions/grib2/tables/18/4.5.table +++ b/definitions/grib2/tables/18/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface (-) 2 2 Cloud base level (-) 3 3 Level of cloud tops (-) @@ -16,15 +16,15 @@ 14 14 Level of free convection (LFC) 15 15 Convective condensation level (CCL) 16 16 Level of neutral buoyancy or equilibrium level (LNB) -# 17-19 Reserved +# 17-19 Reserved 20 20 Isothermal level (K) 21 21 Lowest level where mass density exceeds the specified value (base for a given threshold of mass density) (kg m-3) 22 22 Highest level where mass density exceeds the specified value (top for a given threshold of mass density) (kg m-3) 23 23 Lowest level where air concentration exceeds the specified value (base for a given threshold of air concentration) (Bq m-3) 24 24 Highest level where air concentration exceeds the specified value (top for a given threshold of air concentration) (Bq m-3) -# 25-99 Reserved +# 25-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -33,20 +33,20 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level (-) -112 112 Reserved -113 113 Logarithmic hybrid level +112 112 Reserved +113 113 Logarithmic hybrid level 114 114 Snow level (Numeric) 115 115 Sigma height level # 116 Reserved 117 117 Mixed layer depth (m) 118 hhl Hybrid height level (-) 119 hpl Hybrid pressure level (-) -# 120-149 Reserved -150 150 Generalized vertical height coordinate +# 120-149 Reserved +150 150 Generalized vertical height coordinate 151 sol Soil level (Numeric) -# 152-159 Reserved +# 152-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom (-) @@ -55,7 +55,7 @@ 165 165 Bottom of sediment layer penetrated by thermal wave (-) 166 sfc Mixing layer (-) 167 167 Bottom of root zone (-) -# 168-173 Reserved +# 168-173 Reserved 174 sfc Top surface of ice on sea, lake or river 175 175 Top surface of ice, under snow cover, on sea, lake or river 176 176 Bottom surface (underside) ice on sea, lake or river @@ -67,6 +67,6 @@ 182 182 Grid tile water fraction as a model surface 183 183 Grid tile ice fraction on sea, lake or river as a model surface 184 184 Grid tile glacier ice and inland ice fraction as a model surface -# 185-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 185-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.6.table b/definitions/grib2/tables/18/4.6.table index b2dfeb498..ce799721d 100644 --- a/definitions/grib2/tables/18/4.6.table +++ b/definitions/grib2/tables/18/4.6.table @@ -1,9 +1,9 @@ # Code table 4.6 - Type of ensemble forecast -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.7.table b/definitions/grib2/tables/18/4.7.table index e0de0e1b2..69b2b4d77 100644 --- a/definitions/grib2/tables/18/4.7.table +++ b/definitions/grib2/tables/18/4.7.table @@ -1,14 +1,14 @@ # Code table 4.7 - Derived forecast -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.8.table b/definitions/grib2/tables/18/4.8.table index ad883039c..78467454a 100644 --- a/definitions/grib2/tables/18/4.8.table +++ b/definitions/grib2/tables/18/4.8.table @@ -1,6 +1,6 @@ # Code table 4.8 - Clustering method -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.9.table b/definitions/grib2/tables/18/4.9.table index 5878b5ad3..0ce312dd1 100644 --- a/definitions/grib2/tables/18/4.9.table +++ b/definitions/grib2/tables/18/4.9.table @@ -1,9 +1,9 @@ # Code table 4.9 - Probability type -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/4.91.table b/definitions/grib2/tables/18/4.91.table index 44cf25f44..ae31ed61c 100644 --- a/definitions/grib2/tables/18/4.91.table +++ b/definitions/grib2/tables/18/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit -11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit +11 11 Equal to first limit +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/18/5.0.table b/definitions/grib2/tables/18/5.0.table index 33597681b..4d6cc68c8 100644 --- a/definitions/grib2/tables/18/5.0.table +++ b/definitions/grib2/tables/18/5.0.table @@ -1,24 +1,24 @@ # Code table 5.0 - Data representation template number -0 0 Grid point data - simple packing -1 1 Matrix value at grid point - simple packing -2 2 Grid point data - complex packing -3 3 Grid point data - complex packing and spatial differencing -4 4 Grid point data - IEEE floating point data -40 40 Grid point data - JPEG 2000 code stream format -41 41 Grid point data - Portable Network Graphics (PNG) +0 0 Grid point data - simple packing +1 1 Matrix value at grid point - simple packing +2 2 Grid point data - complex packing +3 3 Grid point data - complex packing and spatial differencing +4 4 Grid point data - IEEE floating point data +40 40 Grid point data - JPEG 2000 code stream format +41 41 Grid point data - Portable Network Graphics (PNG) 42 42 Grid point data - CCSDS recommended lossless compression -# 43-49 Reserved -50 50 Spectral data - simple packing -51 51 Spherical harmonics data - complex packing -# 52-60 Reserved -61 61 Grid point data - simple packing with logarithm pre-processing -# 62-199 Reserved -200 200 Run length packing with level values -# 201-49151 Reserved -# 49152-65534 Reserved for local use +# 43-49 Reserved +50 50 Spectral data - simple packing +51 51 Spherical harmonics data - complex packing +# 52-60 Reserved +61 61 Grid point data - simple packing with logarithm pre-processing +# 62-199 Reserved +200 200 Run length packing with level values +# 201-49151 Reserved +# 49152-65534 Reserved for local use 40000 40000 JPEG2000 Packing 40010 40010 PNG pacling 50000 50000 Sperical harmonics ieee packing 50001 50001 Second order packing 50002 50002 Second order packing -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/18/5.1.table b/definitions/grib2/tables/18/5.1.table index 854330c74..1189b5e46 100644 --- a/definitions/grib2/tables/18/5.1.table +++ b/definitions/grib2/tables/18/5.1.table @@ -1,6 +1,6 @@ # Code table 5.1 - Type of original field values -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/5.2.table b/definitions/grib2/tables/18/5.2.table index 40586a131..d77fdf4e7 100644 --- a/definitions/grib2/tables/18/5.2.table +++ b/definitions/grib2/tables/18/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/5.3.table b/definitions/grib2/tables/18/5.3.table index c3b7b30fe..481331791 100644 --- a/definitions/grib2/tables/18/5.3.table +++ b/definitions/grib2/tables/18/5.3.table @@ -1,7 +1,7 @@ # Code table 5.3 - Matrix coordinate parameter -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/5.4.table b/definitions/grib2/tables/18/5.4.table index 8121c1819..e84ab1901 100644 --- a/definitions/grib2/tables/18/5.4.table +++ b/definitions/grib2/tables/18/5.4.table @@ -1,6 +1,6 @@ # Code table 5.4 - Group splitting method -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/5.40.table b/definitions/grib2/tables/18/5.40.table index b9bad2c39..97e8880ab 100644 --- a/definitions/grib2/tables/18/5.40.table +++ b/definitions/grib2/tables/18/5.40.table @@ -1,5 +1,5 @@ # Code table 5.40 - Type of compression -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/18/5.5.table b/definitions/grib2/tables/18/5.5.table index 3ef3eb070..f2316975a 100644 --- a/definitions/grib2/tables/18/5.5.table +++ b/definitions/grib2/tables/18/5.5.table @@ -1,7 +1,7 @@ # Code table 5.5 - Missing value management for complex packing -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/5.6.table b/definitions/grib2/tables/18/5.6.table index 6d5177877..db68ead9c 100644 --- a/definitions/grib2/tables/18/5.6.table +++ b/definitions/grib2/tables/18/5.6.table @@ -1,7 +1,7 @@ # Code table 5.6 - Order of spatial differencing -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/18/5.7.table b/definitions/grib2/tables/18/5.7.table index 5ab780056..e54862c19 100644 --- a/definitions/grib2/tables/18/5.7.table +++ b/definitions/grib2/tables/18/5.7.table @@ -1,7 +1,7 @@ # Code table 5.7 - Precision of floating-point numbers -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/18/6.0.table b/definitions/grib2/tables/18/6.0.table index 2a29aa285..a8f30f5a4 100644 --- a/definitions/grib2/tables/18/6.0.table +++ b/definitions/grib2/tables/18/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator -0 0 A bit map applies to this product and is specified in this Section +0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/19/0.0.table b/definitions/grib2/tables/19/0.0.table index b24c50564..2c5afceb4 100644 --- a/definitions/grib2/tables/19/0.0.table +++ b/definitions/grib2/tables/19/0.0.table @@ -1,10 +1,10 @@ # Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/1.0.table b/definitions/grib2/tables/19/1.0.table index bd54828ee..06710c183 100644 --- a/definitions/grib2/tables/19/1.0.table +++ b/definitions/grib2/tables/19/1.0.table @@ -1,22 +1,22 @@ # Code table 1.0 - GRIB master tables version number -0 0 Experimental -1 1 Version implemented on 7 November 2001 -2 2 Version implemented on 4 November 2003 -3 3 Version implemented on 2 November 2005 -4 4 Version implemented on 7 November 2007 -5 5 Version implemented on 4 November 2009 -6 6 Version implemented on 15 September 2010 -7 7 Version implemented on 4 May 2011 -8 8 Version implemented on 2 November 2011 -9 9 Version implemented on 2 May 2012 -10 10 Version implemented on 7 November 2012 -11 11 Version implemented on 8 May 2013 -12 12 Version implemented on 14 November 2013 -13 13 Version implemented on 7 May 2014 -14 14 Version implemented on 5 November 2014 -15 15 Version implemented on 6 May 2015 -16 16 Version implemented on 11 November 2015 -17 17 Version implemented on 4 May 2016 +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 +6 6 Version implemented on 15 September 2010 +7 7 Version implemented on 4 May 2011 +8 8 Version implemented on 2 November 2011 +9 9 Version implemented on 2 May 2012 +10 10 Version implemented on 7 November 2012 +11 11 Version implemented on 8 May 2013 +12 12 Version implemented on 14 November 2013 +13 13 Version implemented on 7 May 2014 +14 14 Version implemented on 5 November 2014 +15 15 Version implemented on 6 May 2015 +16 16 Version implemented on 11 November 2015 +17 17 Version implemented on 4 May 2016 18 18 Version implemented on 2 November 2016 19 19 Version implemented on 3 May 2017 20 20 Pre-operational to be implemented by next amendment diff --git a/definitions/grib2/tables/19/1.1.table b/definitions/grib2/tables/19/1.1.table index d50f8fd72..f6d332005 100644 --- a/definitions/grib2/tables/19/1.1.table +++ b/definitions/grib2/tables/19/1.1.table @@ -1,4 +1,4 @@ # Code table 1.1 - GRIB local tables version number -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/19/1.2.table b/definitions/grib2/tables/19/1.2.table index 934b70455..638f1efbb 100644 --- a/definitions/grib2/tables/19/1.2.table +++ b/definitions/grib2/tables/19/1.2.table @@ -1,8 +1,8 @@ # Code table 1.2 - Significance of reference time -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/1.3.table b/definitions/grib2/tables/19/1.3.table index 0c95269d5..c1a9a7b9d 100644 --- a/definitions/grib2/tables/19/1.3.table +++ b/definitions/grib2/tables/19/1.3.table @@ -1,14 +1,14 @@ # Code table 1.3 - Production status of data -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products -4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products +4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) 5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) -6 6 S2S operational products -7 7 S2S test products +6 6 S2S operational products +7 7 S2S test products 8 8 Uncertainties in Ensembles of Regional ReAnalyses project (UERRA) 9 9 Uncertainties in Ensembles of Regional ReAnalyses project test (UERRA) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/1.4.table b/definitions/grib2/tables/19/1.4.table index 03203d874..877288c0e 100644 --- a/definitions/grib2/tables/19/1.4.table +++ b/definitions/grib2/tables/19/1.4.table @@ -1,13 +1,13 @@ # Code table 1.4 - Type of data -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/19/1.5.table b/definitions/grib2/tables/19/1.5.table index b2cf9f087..533111959 100644 --- a/definitions/grib2/tables/19/1.5.table +++ b/definitions/grib2/tables/19/1.5.table @@ -1,7 +1,7 @@ # Code table 1.5 - Identification template number -0 0 Calendar definition -1 1 Paleontological offset -2 2 Calendar definition and paleontological offset -# 3-32767 Reserved -# 32768-65534 Reserved for local use -65535 65535 Missing +0 0 Calendar definition +1 1 Paleontological offset +2 2 Calendar definition and paleontological offset +# 3-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/19/1.6.table b/definitions/grib2/tables/19/1.6.table index 5db921990..bd46899a7 100644 --- a/definitions/grib2/tables/19/1.6.table +++ b/definitions/grib2/tables/19/1.6.table @@ -1,8 +1,8 @@ # Code table 1.6 - Type of calendar -0 0 Gregorian -1 1 360-day -2 2 365-day -3 3 Proleptic Gregorian -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Gregorian +1 1 360-day +2 2 365-day +3 3 Proleptic Gregorian +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/3.0.table b/definitions/grib2/tables/19/3.0.table index 45187b80d..a442a06a0 100644 --- a/definitions/grib2/tables/19/3.0.table +++ b/definitions/grib2/tables/19/3.0.table @@ -1,6 +1,6 @@ # Code table 3.0 - Source of grid definition -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/19/3.10.table b/definitions/grib2/tables/19/3.10.table index afa8843a7..1612d05e3 100644 --- a/definitions/grib2/tables/19/3.10.table +++ b/definitions/grib2/tables/19/3.10.table @@ -1,8 +1,8 @@ # Flag table 3.10 - Scanning mode for one diamond -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/19/3.11.table b/definitions/grib2/tables/19/3.11.table index e516a2ab9..06ae10810 100644 --- a/definitions/grib2/tables/19/3.11.table +++ b/definitions/grib2/tables/19/3.11.table @@ -1,7 +1,7 @@ # Code table 3.11 - Interpretation of list of numbers at end of section 3 -0 0 There is no appended list -1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows -2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row -3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) -# 4-254 Reserved -255 255 Missing +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/19/3.15.table b/definitions/grib2/tables/19/3.15.table index 331217ebe..6087902a3 100644 --- a/definitions/grib2/tables/19/3.15.table +++ b/definitions/grib2/tables/19/3.15.table @@ -1,23 +1,23 @@ # Code table 3.15 - Physical meaning of vertical coordinate -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/3.2.table b/definitions/grib2/tables/19/3.2.table index 1b5c8241d..56ffdc08e 100644 --- a/definitions/grib2/tables/19/3.2.table +++ b/definitions/grib2/tables/19/3.2.table @@ -1,14 +1,14 @@ # Code table 3.2 - Shape of the Earth -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS-84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS-84 reference frame -9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS-84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS-84 reference frame +9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/3.20.table b/definitions/grib2/tables/19/3.20.table index efbf08d19..e2bb156ee 100644 --- a/definitions/grib2/tables/19/3.20.table +++ b/definitions/grib2/tables/19/3.20.table @@ -1,6 +1,6 @@ # Code table 3.20 - Type of horizontal line -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/3.21.table b/definitions/grib2/tables/19/3.21.table index 88dbb9019..e001e1c8f 100644 --- a/definitions/grib2/tables/19/3.21.table +++ b/definitions/grib2/tables/19/3.21.table @@ -1,8 +1,8 @@ # Code table 3.21 - Vertical dimension coordinate values definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/3.3.table b/definitions/grib2/tables/19/3.3.table index 5dd7c7001..25cb46a1d 100644 --- a/definitions/grib2/tables/19/3.3.table +++ b/definitions/grib2/tables/19/3.3.table @@ -1,9 +1,9 @@ # Flag table 3.3 - Resolution and component flags -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/19/3.4.table b/definitions/grib2/tables/19/3.4.table index 897b813d7..43835c014 100644 --- a/definitions/grib2/tables/19/3.4.table +++ b/definitions/grib2/tables/19/3.4.table @@ -1,17 +1,17 @@ # Flag table 3.4 - Scanning mode -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -5 0 Points within odd rows are not offset in i (x) direction -5 1 Points within odd rows are offset by Di/2 in i (x) direction -6 0 Points within even rows are not offset in i (x) direction -6 1 Points within even rows are offset by Di/2 in i (x) direction -7 0 Points are not offset in j (y) direction -7 1 Points are offset by Dj/2 in j (y) direction -8 0 Rows have Ni grid points and columns have Nj grid points -8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +5 0 Points within odd rows are not offset in i (x) direction +5 1 Points within odd rows are offset by Di/2 in i (x) direction +6 0 Points within even rows are not offset in i (x) direction +6 1 Points within even rows are offset by Di/2 in i (x) direction +7 0 Points are not offset in j (y) direction +7 1 Points are offset by Dj/2 in j (y) direction +8 0 Rows have Ni grid points and columns have Nj grid points +8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction diff --git a/definitions/grib2/tables/19/3.5.table b/definitions/grib2/tables/19/3.5.table index eabdde896..2f8ec82e3 100644 --- a/definitions/grib2/tables/19/3.5.table +++ b/definitions/grib2/tables/19/3.5.table @@ -1,5 +1,5 @@ # Flag table 3.5 - Projection centre -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/19/3.7.table b/definitions/grib2/tables/19/3.7.table index 0a7d6efde..34c0de085 100644 --- a/definitions/grib2/tables/19/3.7.table +++ b/definitions/grib2/tables/19/3.7.table @@ -1,5 +1,5 @@ # Code table 3.7 - Spectral data representation mode -0 0 Reserved +0 0 Reserved 1 1 see separate doc or pdf file -# 2-254 Reserved -255 255 Missing +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/19/3.8.table b/definitions/grib2/tables/19/3.8.table index 844e74235..578fab37f 100644 --- a/definitions/grib2/tables/19/3.8.table +++ b/definitions/grib2/tables/19/3.8.table @@ -1,7 +1,7 @@ # Code table 3.8 - Grid point position -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/3.9.table b/definitions/grib2/tables/19/3.9.table index fd730bc64..ecd65514a 100644 --- a/definitions/grib2/tables/19/3.9.table +++ b/definitions/grib2/tables/19/3.9.table @@ -1,4 +1,4 @@ # Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/19/4.0.table b/definitions/grib2/tables/19/4.0.table index 906bf12d3..a37b59d09 100644 --- a/definitions/grib2/tables/19/4.0.table +++ b/definitions/grib2/tables/19/4.0.table @@ -1,75 +1,75 @@ # Code table 4.0 - Product definition template number -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time -8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data -34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -# 35-39 Reserved +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data +# 35-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol -46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol -48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -49 49 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol -# 50 Reserved -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +49 49 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +# 50 Reserved +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time # 52 Reserved -53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time -54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters -55 55 Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time -56 56 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters (deprecated) -57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function -58 58 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function -59 59 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters (corrected version of template 4.56) -60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval -# 62-66 Reserved -67 67 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents based on a distribution function -68 68 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents based on a distribution function +53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time +54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters +55 55 Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time +56 56 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters (deprecated) +57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function +58 58 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function +59 59 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters (corrected version of template 4.56) +60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval +# 62-66 Reserved +67 67 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents based on a distribution function +68 68 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents based on a distribution function # 69 Reserved 70 70 Post-processing analysis or forecast at a horizontal level or in a horizontal layer at a point in time -71 71 Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -72 72 Post-processing average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -73 73 Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval -# 74-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +71 71 Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +72 72 Post-processing average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +73 73 Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval +# 74-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved -# 32768-65534 Reserved for local use +# 1102-32767 Reserved +# 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/19/4.1.0.table b/definitions/grib2/tables/19/4.1.0.table index 04cfd7802..df58636d6 100644 --- a/definitions/grib2/tables/19/4.1.0.table +++ b/definitions/grib2/tables/19/4.1.0.table @@ -1,27 +1,27 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.1.1.table b/definitions/grib2/tables/19/4.1.1.table index 7b22b6fed..05a854da0 100644 --- a/definitions/grib2/tables/19/4.1.1.table +++ b/definitions/grib2/tables/19/4.1.1.table @@ -1,7 +1,7 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.1.10.table b/definitions/grib2/tables/19/4.1.10.table index a9b20eb9c..88d3c8743 100644 --- a/definitions/grib2/tables/19/4.1.10.table +++ b/definitions/grib2/tables/19/4.1.10.table @@ -1,10 +1,10 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Subsurface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Subsurface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.1.2.table b/definitions/grib2/tables/19/4.1.2.table index 5b488fe9e..e74126645 100644 --- a/definitions/grib2/tables/19/4.1.2.table +++ b/definitions/grib2/tables/19/4.1.2.table @@ -1,9 +1,9 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.1.3.table b/definitions/grib2/tables/19/4.1.3.table index 7bf60d4a7..ba38c9301 100644 --- a/definitions/grib2/tables/19/4.1.3.table +++ b/definitions/grib2/tables/19/4.1.3.table @@ -1,11 +1,11 @@ # Code table 4.1 - Parameter category by product discipline -0 0 Image format products -1 1 Quantitative products -2 2 Cloud properties -3 3 Flight rule conditions -4 4 Volcanic ash -5 5 Sea-surface temperature -6 6 Solar radiation -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +2 2 Cloud properties +3 3 Flight rule conditions +4 4 Volcanic ash +5 5 Sea-surface temperature +6 6 Solar radiation +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.10.table b/definitions/grib2/tables/19/4.10.table index 1a92baaf6..8a390e4be 100644 --- a/definitions/grib2/tables/19/4.10.table +++ b/definitions/grib2/tables/19/4.10.table @@ -1,16 +1,16 @@ # Code table 4.10 - Type of statistical processing -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -11 11 Summation -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/19/4.11.table b/definitions/grib2/tables/19/4.11.table index 7f404c849..01cc81303 100644 --- a/definitions/grib2/tables/19/4.11.table +++ b/definitions/grib2/tables/19/4.11.table @@ -1,10 +1,10 @@ # Code table 4.11 - Type of time intervals -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.12.table b/definitions/grib2/tables/19/4.12.table index 03fd89b36..d42b47e96 100644 --- a/definitions/grib2/tables/19/4.12.table +++ b/definitions/grib2/tables/19/4.12.table @@ -1,7 +1,7 @@ # Code table 4.12 - Operating mode -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.13.table b/definitions/grib2/tables/19/4.13.table index c92854eec..a0e28eac8 100644 --- a/definitions/grib2/tables/19/4.13.table +++ b/definitions/grib2/tables/19/4.13.table @@ -1,6 +1,6 @@ # Code table 4.13 - Quality control indicator -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.14.table b/definitions/grib2/tables/19/4.14.table index a88cb93fa..d525b23b3 100644 --- a/definitions/grib2/tables/19/4.14.table +++ b/definitions/grib2/tables/19/4.14.table @@ -1,6 +1,6 @@ # Code table 4.14 - Clutter filter indicator -0 0 No clutter filter used -1 1 Clutter filter used -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.15.table b/definitions/grib2/tables/19/4.15.table index 2e5f3dea3..7adddedb6 100644 --- a/definitions/grib2/tables/19/4.15.table +++ b/definitions/grib2/tables/19/4.15.table @@ -1,11 +1,11 @@ # Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.0.table b/definitions/grib2/tables/19/4.2.0.0.table index 7201a8667..83b3e8ef1 100644 --- a/definitions/grib2/tables/19/4.2.0.0.table +++ b/definitions/grib2/tables/19/4.2.0.0.table @@ -29,6 +29,6 @@ 27 27 Wet-bulb temperature (K) 28 28 Unbalanced component of temperature (K) 29 29 Temperature advection (K s-1) -# 30-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 30-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.1.table b/definitions/grib2/tables/19/4.2.0.1.table index c38d6a053..7d43684d3 100644 --- a/definitions/grib2/tables/19/4.2.0.1.table +++ b/definitions/grib2/tables/19/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,7 +86,7 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rainwater content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) @@ -118,6 +118,6 @@ 118 118 Unbalanced component of specific humidity (kg kg-1) 119 119 Unbalanced component of specific cloud liquid water content (kg kg-1) 120 120 Unbalanced component of specific cloud ice water content (kg kg-1) -# 121-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 121-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.13.table b/definitions/grib2/tables/19/4.2.0.13.table index 5086101ad..3f5c30675 100644 --- a/definitions/grib2/tables/19/4.2.0.13.table +++ b/definitions/grib2/tables/19/4.2.0.13.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.14.table b/definitions/grib2/tables/19/4.2.0.14.table index 215884737..97fb38c8b 100644 --- a/definitions/grib2/tables/19/4.2.0.14.table +++ b/definitions/grib2/tables/19/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.15.table b/definitions/grib2/tables/19/4.2.0.15.table index dfbc4d12f..8df082466 100644 --- a/definitions/grib2/tables/19/4.2.0.15.table +++ b/definitions/grib2/tables/19/4.2.0.15.table @@ -16,6 +16,6 @@ 14 14 Reflectivity of hail (dB) 15 15 Hybrid scan reflectivity (dB) 16 16 Hybrid scan reflectivity height (m) -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.16.table b/definitions/grib2/tables/19/4.2.0.16.table index 0c240a853..9499d9333 100644 --- a/definitions/grib2/tables/19/4.2.0.16.table +++ b/definitions/grib2/tables/19/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.18.table b/definitions/grib2/tables/19/4.2.0.18.table index 9d106f419..9ca6db61e 100644 --- a/definitions/grib2/tables/19/4.2.0.18.table +++ b/definitions/grib2/tables/19/4.2.0.18.table @@ -8,7 +8,7 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) @@ -18,6 +18,6 @@ 16 16 Height of maximum air concentration (m) 17 17 Column-integrated air concentration (Bq m-2) 18 18 Column-averaged air concentration in layer (Bq m-3) -# 19-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 19-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.19.table b/definitions/grib2/tables/19/4.2.0.19.table index 1d7b4da91..b27eb2dbe 100644 --- a/definitions/grib2/tables/19/4.2.0.19.table +++ b/definitions/grib2/tables/19/4.2.0.19.table @@ -31,6 +31,6 @@ 29 29 Clear air turbulence (CAT) (m2/3 s-1) 30 30 Eddy dissipation parameter (m2/3 s-1) 31 31 Maximum of eddy dissipation parameter in layer (m2/3 s-1) -# 32-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 32-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.190.table b/definitions/grib2/tables/19/4.2.0.190.table index de621a924..a0d6ba0ac 100644 --- a/definitions/grib2/tables/19/4.2.0.190.table +++ b/definitions/grib2/tables/19/4.2.0.190.table @@ -1,5 +1,5 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.191.table b/definitions/grib2/tables/19/4.2.0.191.table index e3bba0ebe..b3a7092ea 100644 --- a/definitions/grib2/tables/19/4.2.0.191.table +++ b/definitions/grib2/tables/19/4.2.0.191.table @@ -3,6 +3,6 @@ 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.2.table b/definitions/grib2/tables/19/4.2.0.2.table index 5446262e6..8a70b2591 100644 --- a/definitions/grib2/tables/19/4.2.0.2.table +++ b/definitions/grib2/tables/19/4.2.0.2.table @@ -46,6 +46,6 @@ 44 44 Geostrophic wind speed (m s-1) 45 45 Unbalanced component of divergence (s-1) 46 46 Vorticity advection (s-2) -# 47-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 47-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.20.table b/definitions/grib2/tables/19/4.2.0.20.table index 3278506dd..0f95689f8 100644 --- a/definitions/grib2/tables/19/4.2.0.20.table +++ b/definitions/grib2/tables/19/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -29,7 +29,7 @@ 61 61 Maximum of mass density in layer (kg m-3) 62 62 Height of maximum mass density (m) 63 63 Column-averaged mass density in layer (kg m-3) -# 64-99 Reserved +# 64-99 Reserved 100 100 Surface area density (aerosol) (m-1) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -42,6 +42,6 @@ 109 109 Aerosol lidar extinction from satellite (m-1) 110 110 Aerosol lidar extinction from the ground (m-1) 111 111 Angstrom exponent (Numeric) -# 112-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 112-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.3.table b/definitions/grib2/tables/19/4.2.0.3.table index 34941dcab..52c421b97 100644 --- a/definitions/grib2/tables/19/4.2.0.3.table +++ b/definitions/grib2/tables/19/4.2.0.3.table @@ -31,6 +31,6 @@ 29 29 Updraught detrainment rate (kg m-3 s-1) 30 30 Downdraught detrainment rate (kg m-3 s-1) 31 31 Unbalanced component of logarithm of surface pressure (-) -# 32-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 32-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.4.table b/definitions/grib2/tables/19/4.2.0.4.table index 0a5ded2b5..f97270456 100644 --- a/definitions/grib2/tables/19/4.2.0.4.table +++ b/definitions/grib2/tables/19/4.2.0.4.table @@ -14,11 +14,11 @@ 12 12 Downward UV radiation (W m-2) 13 13 Direct short-wave radiation flux (W m-2) 14 14 Diffuse short-wave radiation flux (W m-2) -# 15-49 Reserved +# 15-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) 52 52 Downward short-wave radiation flux, clear sky (W m-2) 53 53 Upward short-wave radiation flux, clear sky (W m-2) -# 54-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 54-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.5.table b/definitions/grib2/tables/19/4.2.0.5.table index 4550220b6..ddfa634ce 100644 --- a/definitions/grib2/tables/19/4.2.0.5.table +++ b/definitions/grib2/tables/19/4.2.0.5.table @@ -8,6 +8,6 @@ 6 6 Net long-wave radiation flux, clear sky (W m-2) 7 7 Brightness temperature (K) 8 8 Downward long-wave radiation flux, clear sky (W m-2) -# 9-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 9-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.6.table b/definitions/grib2/tables/19/4.2.0.6.table index 4cec0c8aa..0450ec194 100644 --- a/definitions/grib2/tables/19/4.2.0.6.table +++ b/definitions/grib2/tables/19/4.2.0.6.table @@ -40,10 +40,10 @@ 38 38 Mass density of cloud droplets (kg m-3) 39 39 Mass density of cloud ice (kg m-3) 40 40 Mass density of convective cloud water droplets (kg m-3) -# 41-46 Reserved +# 41-46 Reserved 47 47 Volume fraction of cloud water droplets (Numeric) 48 48 Volume fraction of cloud ice particles (Numeric) 49 49 Volume fraction of cloud (ice and/or water) (Numeric) -# 50-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 50-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.0.7.table b/definitions/grib2/tables/19/4.2.0.7.table index aff6a6516..6289d8b20 100644 --- a/definitions/grib2/tables/19/4.2.0.7.table +++ b/definitions/grib2/tables/19/4.2.0.7.table @@ -13,12 +13,12 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraught helicity (m2 s-2) 16 16 Bulk Richardson number (Numeric) 17 17 Gradient Richardson number (Numeric) 18 18 Flux Richardson number (Numeric) 19 19 Convective available potential energy - shear (m2 s-2) -# 20-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 20-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.1.0.table b/definitions/grib2/tables/19/4.2.1.0.table index bcd849c2e..a2660f4f3 100644 --- a/definitions/grib2/tables/19/4.2.1.0.table +++ b/definitions/grib2/tables/19/4.2.1.0.table @@ -16,6 +16,6 @@ 14 14 Upstream accumulated precipitation (kg m-2) 15 15 Upstream accumulated snow melt (kg m-2) 16 16 Percolation rate (kg m-2 s-1) -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.1.1.table b/definitions/grib2/tables/19/4.2.1.1.table index b488eb0bd..171da3958 100644 --- a/definitions/grib2/tables/19/4.2.1.1.table +++ b/definitions/grib2/tables/19/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.10.0.table b/definitions/grib2/tables/19/4.2.10.0.table index 095f51bdf..3611abd9a 100644 --- a/definitions/grib2/tables/19/4.2.10.0.table +++ b/definitions/grib2/tables/19/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea-surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (/s) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.10.1.table b/definitions/grib2/tables/19/4.2.10.1.table index 5959bfa28..f0a073c00 100644 --- a/definitions/grib2/tables/19/4.2.10.1.table +++ b/definitions/grib2/tables/19/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.10.191.table b/definitions/grib2/tables/19/4.2.10.191.table index 524929e78..1ebf85006 100644 --- a/definitions/grib2/tables/19/4.2.10.191.table +++ b/definitions/grib2/tables/19/4.2.10.191.table @@ -1,8 +1,8 @@ # Code table 4.2 - Parameter number by product discipline and parameter category 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -2 2 Reserved +2 2 Reserved 3 3 Days since last observation (d) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.10.2.table b/definitions/grib2/tables/19/4.2.10.2.table index 6797062ac..4633bad4f 100644 --- a/definitions/grib2/tables/19/4.2.10.2.table +++ b/definitions/grib2/tables/19/4.2.10.2.table @@ -12,6 +12,6 @@ 10 10 Zonal vector component of vertically integrated ice internal pressure (Pa m) 11 11 Meridional vector component of vertically integrated ice internal pressure (Pa m) 12 12 Compressive ice strength (N/m) -# 13-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 13-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.10.3.table b/definitions/grib2/tables/19/4.2.10.3.table index de7afd61c..b01d7ae46 100644 --- a/definitions/grib2/tables/19/4.2.10.3.table +++ b/definitions/grib2/tables/19/4.2.10.3.table @@ -2,6 +2,6 @@ 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) 2 2 Heat exchange coefficient (-) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.10.4.table b/definitions/grib2/tables/19/4.2.10.4.table index 54774f1b7..d5615ae26 100644 --- a/definitions/grib2/tables/19/4.2.10.4.table +++ b/definitions/grib2/tables/19/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2/s) 6 6 Ocean vertical momentum diffusivity (m2/s) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (/m) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.2.0.table b/definitions/grib2/tables/19/4.2.2.0.table index 81548840c..b253cac22 100644 --- a/definitions/grib2/tables/19/4.2.2.0.table +++ b/definitions/grib2/tables/19/4.2.2.0.table @@ -38,6 +38,6 @@ 36 36 Tile fraction (Proportion) 37 37 Tile percentage (%) 38 38 Soil volumetric ice content (water equivalent) (m3 m-3) -# 39-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 39-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.2.3.table b/definitions/grib2/tables/19/4.2.2.3.table index 690fab42b..2674e9f42 100644 --- a/definitions/grib2/tables/19/4.2.2.3.table +++ b/definitions/grib2/tables/19/4.2.2.3.table @@ -27,6 +27,6 @@ 25 25 Snow depth at elevation bands (kg m-2) 26 26 Soil heat flux (W m-2) 27 27 Soil depth (m) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.2.4.table b/definitions/grib2/tables/19/4.2.2.4.table index bb54fac22..ceb761557 100644 --- a/definitions/grib2/tables/19/4.2.2.4.table +++ b/definitions/grib2/tables/19/4.2.2.4.table @@ -11,6 +11,6 @@ 9 9 Initial Fire Spread Index (Canadian Forest Service) (Numeric) 10 10 Fire Buildup Index (Canadian Forest Service) (Numeric) 11 11 Fire Daily Severity Rating (Canadian Forest Service) (Numeric) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.3.0.table b/definitions/grib2/tables/19/4.2.3.0.table index c0ffa29f5..80a829673 100644 --- a/definitions/grib2/tables/19/4.2.3.0.table +++ b/definitions/grib2/tables/19/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.2.3.1.table b/definitions/grib2/tables/19/4.2.3.1.table index 8e0793fe0..04cdde1f1 100644 --- a/definitions/grib2/tables/19/4.2.3.1.table +++ b/definitions/grib2/tables/19/4.2.3.1.table @@ -17,16 +17,16 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-26 Reserved +23 23 Angstrom coefficient +# 24-26 Reserved 27 27 Bidirectional reflectance factor (Numeric) 28 28 Brightness temperature (K) 29 29 Scaled radiance (Numeric) -# 30-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 30-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.201.table b/definitions/grib2/tables/19/4.201.table index 47f1b486f..fa173c4e0 100644 --- a/definitions/grib2/tables/19/4.201.table +++ b/definitions/grib2/tables/19/4.201.table @@ -1,15 +1,15 @@ # Code table 4.201 - Precipitation type -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow -6 6 Wet snow -7 7 Mixture of rain and snow -8 8 Ice pellets -9 9 Graupel -10 10 Hail -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +6 6 Wet snow +7 7 Mixture of rain and snow +8 8 Ice pellets +9 9 Graupel +10 10 Hail +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.202.table b/definitions/grib2/tables/19/4.202.table index 438502ff9..7f3c8f6cf 100644 --- a/definitions/grib2/tables/19/4.202.table +++ b/definitions/grib2/tables/19/4.202.table @@ -1,4 +1,4 @@ # Code table 4.202 - Precipitable water category -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.203.table b/definitions/grib2/tables/19/4.203.table index 8a9aedf7a..cf5eb6bdc 100644 --- a/definitions/grib2/tables/19/4.203.table +++ b/definitions/grib2/tables/19/4.203.table @@ -1,26 +1,26 @@ # Code table 4.203 - Cloud type -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.204.table b/definitions/grib2/tables/19/4.204.table index 481372936..8e0be1f8c 100644 --- a/definitions/grib2/tables/19/4.204.table +++ b/definitions/grib2/tables/19/4.204.table @@ -1,9 +1,9 @@ # Code table 4.204 - Thunderstorm coverage -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (6-45%) -4 4 Numerous (> 45%) -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (6-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.205.table b/definitions/grib2/tables/19/4.205.table index 5b4484dfd..c40c7f47b 100644 --- a/definitions/grib2/tables/19/4.205.table +++ b/definitions/grib2/tables/19/4.205.table @@ -1,6 +1,6 @@ # Code table 4.205 - Presence of aerosol -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.206.table b/definitions/grib2/tables/19/4.206.table index 02c3dfdf9..76472c261 100644 --- a/definitions/grib2/tables/19/4.206.table +++ b/definitions/grib2/tables/19/4.206.table @@ -1,6 +1,6 @@ # Code table 4.206 - Volcanic ash -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.207.table b/definitions/grib2/tables/19/4.207.table index 8ddb2e048..b6392fca0 100644 --- a/definitions/grib2/tables/19/4.207.table +++ b/definitions/grib2/tables/19/4.207.table @@ -1,10 +1,10 @@ # Code table 4.207 - Icing -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.208.table b/definitions/grib2/tables/19/4.208.table index b83685a1a..4361d38c0 100644 --- a/definitions/grib2/tables/19/4.208.table +++ b/definitions/grib2/tables/19/4.208.table @@ -1,9 +1,9 @@ # Code table 4.208 - Turbulence -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.209.table b/definitions/grib2/tables/19/4.209.table index cb7617071..39ea549ac 100644 --- a/definitions/grib2/tables/19/4.209.table +++ b/definitions/grib2/tables/19/4.209.table @@ -1,9 +1,9 @@ # Code table 4.209 - Planetary boundary-layer regime -0 0 Reserved -1 1 Stable -2 2 Mechanically driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.210.table b/definitions/grib2/tables/19/4.210.table index ae569a8ba..791878469 100644 --- a/definitions/grib2/tables/19/4.210.table +++ b/definitions/grib2/tables/19/4.210.table @@ -3,4 +3,4 @@ 1 1 Contrail present # 2-191 Reserved # 192-254 Reserved for local use -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/19/4.211.table b/definitions/grib2/tables/19/4.211.table index 098eb2d43..2a28a84d9 100644 --- a/definitions/grib2/tables/19/4.211.table +++ b/definitions/grib2/tables/19/4.211.table @@ -1,7 +1,7 @@ # Code table 4.211 - Contrail engine type -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.212.table b/definitions/grib2/tables/19/4.212.table index 1a085b88d..6a3dcf88c 100644 --- a/definitions/grib2/tables/19/4.212.table +++ b/definitions/grib2/tables/19/4.212.table @@ -1,18 +1,18 @@ # Code table 4.212 - Land use -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.213.table b/definitions/grib2/tables/19/4.213.table index c65784a00..68d627af6 100644 --- a/definitions/grib2/tables/19/4.213.table +++ b/definitions/grib2/tables/19/4.213.table @@ -1,16 +1,16 @@ # Code table 4.213 - Soil type -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.215.table b/definitions/grib2/tables/19/4.215.table index 034db72be..7888772d5 100644 --- a/definitions/grib2/tables/19/4.215.table +++ b/definitions/grib2/tables/19/4.215.table @@ -1,9 +1,9 @@ # Code table 4.215 - Remotely sensed snow coverage -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.216.table b/definitions/grib2/tables/19/4.216.table index 5d1460cef..b51b358f4 100644 --- a/definitions/grib2/tables/19/4.216.table +++ b/definitions/grib2/tables/19/4.216.table @@ -1,5 +1,5 @@ # Code table 4.216 - Elevation of snow-covered terrain -# 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 0-90 Elevation in increments of 100 m +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/19/4.217.table b/definitions/grib2/tables/19/4.217.table index a4452182c..a700410d5 100644 --- a/definitions/grib2/tables/19/4.217.table +++ b/definitions/grib2/tables/19/4.217.table @@ -1,8 +1,8 @@ # Code table 4.217 - Cloud mask type -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.218.table b/definitions/grib2/tables/19/4.218.table index 7e3a69578..b5b15150b 100644 --- a/definitions/grib2/tables/19/4.218.table +++ b/definitions/grib2/tables/19/4.218.table @@ -1,44 +1,44 @@ # Code table 4.218 - Pixel scene type -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation/crops -15 15 Permanent snow/ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -19 19 Warm liquid water cloud -20 20 Supercooled liquid water cloud -21 21 Mixed-phase cloud -22 22 Optically thin ice cloud -23 23 Optically thick ice cloud -24 24 Multilayered cloud -# 25-96 Reserved -97 97 Snow/ice on land -98 98 Snow/ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud/fog/Stratus -102 102 Low cloud/Stratocumulus -103 103 Low cloud/unknown type -104 104 Medium cloud/Nimbostratus -105 105 Medium cloud/Altostratus -106 106 Medium cloud/unknown type -107 107 High cloud/Cumulus -108 108 High cloud/Cirrus -109 109 High cloud/unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation/crops +15 15 Permanent snow/ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +19 19 Warm liquid water cloud +20 20 Supercooled liquid water cloud +21 21 Mixed-phase cloud +22 22 Optically thin ice cloud +23 23 Optically thick ice cloud +24 24 Multilayered cloud +# 25-96 Reserved +97 97 Snow/ice on land +98 98 Snow/ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud/fog/Stratus +102 102 Low cloud/Stratocumulus +103 103 Low cloud/unknown type +104 104 Medium cloud/Nimbostratus +105 105 Medium cloud/Altostratus +106 106 Medium cloud/unknown type +107 107 High cloud/Cumulus +108 108 High cloud/Cirrus +109 109 High cloud/unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.219.table b/definitions/grib2/tables/19/4.219.table index 86df0522e..9979f50ad 100644 --- a/definitions/grib2/tables/19/4.219.table +++ b/definitions/grib2/tables/19/4.219.table @@ -1,8 +1,8 @@ # Code table 4.219 - Cloud top height quality indicator -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.220.table b/definitions/grib2/tables/19/4.220.table index 93e841f8b..88e869e42 100644 --- a/definitions/grib2/tables/19/4.220.table +++ b/definitions/grib2/tables/19/4.220.table @@ -1,6 +1,6 @@ # Code table 4.220 - Horizontal dimension processed -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.221.table b/definitions/grib2/tables/19/4.221.table index 8448533d7..011cc3518 100644 --- a/definitions/grib2/tables/19/4.221.table +++ b/definitions/grib2/tables/19/4.221.table @@ -1,6 +1,6 @@ # Code table 4.221 - Treatment of missing data -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.222.table b/definitions/grib2/tables/19/4.222.table index 57f113014..558d947ac 100644 --- a/definitions/grib2/tables/19/4.222.table +++ b/definitions/grib2/tables/19/4.222.table @@ -1,6 +1,6 @@ # Code table 4.222 - Categorical result -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.223.table b/definitions/grib2/tables/19/4.223.table index f0deb076a..572c4e7a8 100644 --- a/definitions/grib2/tables/19/4.223.table +++ b/definitions/grib2/tables/19/4.223.table @@ -1,5 +1,5 @@ # Code table 4.223 - Fire detection indicator -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing diff --git a/definitions/grib2/tables/19/4.224.table b/definitions/grib2/tables/19/4.224.table index e87cde4bb..014f56e23 100644 --- a/definitions/grib2/tables/19/4.224.table +++ b/definitions/grib2/tables/19/4.224.table @@ -1,18 +1,18 @@ # Code table 4.224 - Categorical outlook -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/19/4.227.table b/definitions/grib2/tables/19/4.227.table index 27c76553d..48c3b7633 100644 --- a/definitions/grib2/tables/19/4.227.table +++ b/definitions/grib2/tables/19/4.227.table @@ -1,9 +1,9 @@ # Code table 4.227 - Icing scenario (weather/cloud classification) -0 0 None -1 1 General -2 2 Convective -3 3 Stratiform -4 4 Freezing -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 None +1 1 General +2 2 Convective +3 3 Stratiform +4 4 Freezing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/19/4.234.table b/definitions/grib2/tables/19/4.234.table index 816541ce9..3b05b4515 100644 --- a/definitions/grib2/tables/19/4.234.table +++ b/definitions/grib2/tables/19/4.234.table @@ -1,21 +1,21 @@ # Code table 4.234 - Canopy cover fraction (to be used as partitioned parameter in product definition template 4.53 or 4.54) -1 1 Crops, mixed farming -2 2 Short grass -3 3 Evergreen needleleaf trees -4 4 Deciduous needleleaf trees -5 5 Deciduous broadleaf trees -6 6 Evergreen broadleaf trees -7 7 Tall grass -8 8 Desert -9 9 Tundra -10 10 Irrigated crops -11 11 Semidesert -12 12 Ice caps and glaciers -13 13 Bogs and marshes -14 14 Inland water -15 15 Ocean -16 16 Evergreen shrubs -17 17 Deciduous shrubs -18 18 Mixed forest -19 19 Interrupted forest -20 20 Water and land mixtures +1 1 Crops, mixed farming +2 2 Short grass +3 3 Evergreen needleleaf trees +4 4 Deciduous needleleaf trees +5 5 Deciduous broadleaf trees +6 6 Evergreen broadleaf trees +7 7 Tall grass +8 8 Desert +9 9 Tundra +10 10 Irrigated crops +11 11 Semidesert +12 12 Ice caps and glaciers +13 13 Bogs and marshes +14 14 Inland water +15 15 Ocean +16 16 Evergreen shrubs +17 17 Deciduous shrubs +18 18 Mixed forest +19 19 Interrupted forest +20 20 Water and land mixtures diff --git a/definitions/grib2/tables/19/4.236.table b/definitions/grib2/tables/19/4.236.table index fbe093ce9..9c58b488c 100644 --- a/definitions/grib2/tables/19/4.236.table +++ b/definitions/grib2/tables/19/4.236.table @@ -1,8 +1,8 @@ # Code table 4.236 - Soil texture fraction (to be used as partitioned parameter in product definition template 4.53 or 4.54) -1 1 Coarse -2 2 Medium -3 3 Medium-fine -4 4 Fine -5 5 Very-fine -6 6 Organic -7 7 Tropical-organic +1 1 Coarse +2 2 Medium +3 3 Medium-fine +4 4 Fine +5 5 Very-fine +6 6 Organic +7 7 Tropical-organic diff --git a/definitions/grib2/tables/19/4.240.table b/definitions/grib2/tables/19/4.240.table index 35e363211..400a13e26 100644 --- a/definitions/grib2/tables/19/4.240.table +++ b/definitions/grib2/tables/19/4.240.table @@ -1,13 +1,13 @@ # Code table 4.240 - Type of distribution function -0 0 No specific distribution function given -1 1 Delta functions with spatially variable concentration and fixed diameters Dl (p1) in metre -2 2 Delta functions with spatially variable concentration and fixed masses Ml (p1) in kg -3 3 Gaussian (normal) distribution with spatially variable concentration and fixed mean diameter Dl(p1) and variance(p2) -4 4 Gaussian (normal) distribution with spatially variable concentration, mean diameter and variance -5 5 Log-normal distribution with spatially variable number density, mean diameter and variance -6 6 Log-normal distribution with spatially variable number density, mean diameter and fixed variance(p1) +0 0 No specific distribution function given +1 1 Delta functions with spatially variable concentration and fixed diameters Dl (p1) in metre +2 2 Delta functions with spatially variable concentration and fixed masses Ml (p1) in kg +3 3 Gaussian (normal) distribution with spatially variable concentration and fixed mean diameter Dl(p1) and variance(p2) +4 4 Gaussian (normal) distribution with spatially variable concentration, mean diameter and variance +5 5 Log-normal distribution with spatially variable number density, mean diameter and variance +6 6 Log-normal distribution with spatially variable number density, mean diameter and fixed variance(p1) 7 7 Log-normal distribution with spatially variable number density and mass density and fixed variance(p1) and fixed particle density(p2) 8 8 No distribution function. The encoded variable is derived from variables characterized by type of distribution function of type no. 7 (see above) with fixed variance(p1) and fixed particle density(p2) -# 9-49151 Reserved -# 49152-65534 Reserved for local use -65535 65535 Missing value +# 9-49151 Reserved +# 49152-65534 Reserved for local use +65535 65535 Missing value diff --git a/definitions/grib2/tables/19/4.241.table b/definitions/grib2/tables/19/4.241.table index a037b4ba5..5ea7f775a 100644 --- a/definitions/grib2/tables/19/4.241.table +++ b/definitions/grib2/tables/19/4.241.table @@ -1,9 +1,9 @@ # Code table 4.241 - Coverage attributes -0 0 Undefined -1 1 Unmodified -2 2 Snow covered -3 3 Flooded -4 4 Ice covered -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 Undefined +1 1 Unmodified +2 2 Snow covered +3 3 Flooded +4 4 Ice covered +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/19/4.242.table b/definitions/grib2/tables/19/4.242.table index 083f88c29..f6865957c 100644 --- a/definitions/grib2/tables/19/4.242.table +++ b/definitions/grib2/tables/19/4.242.table @@ -1,7 +1,7 @@ # Code table 4.242 - Tile classification -0 0 Reserved -1 1 Land use classes according to ESA-GlobCover GCV2009 -2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +0 0 Reserved +1 1 Land use classes according to ESA-GlobCover GCV2009 +2 2 Land use classes according to European Commission-Global Land Cover Project GLC2000 +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/19/4.243.table b/definitions/grib2/tables/19/4.243.table index b39053311..24d21b719 100644 --- a/definitions/grib2/tables/19/4.243.table +++ b/definitions/grib2/tables/19/4.243.table @@ -1,43 +1,43 @@ # Code table 4.243 - Tile class -0 0 Reserved -1 1 Evergreen broadleaved forest -2 2 Deciduous broadleaved closed forest -3 3 Deciduous broadleaved open forest -4 4 Evergreen needle-leaf forest -5 5 Deciduous needle-leaf forest -6 6 Mixed leaf trees -7 7 Freshwater flooded trees -8 8 Saline water flooded trees -9 9 Mosaic tree/natural vegetation -10 10 Burnt tree cover -11 11 Evergreen shrubs closed-open -12 12 Deciduous shrubs closed-open -13 13 Herbaceous vegetation closed-open -14 14 Sparse herbaceous or grass -15 15 Flooded shrubs or herbaceous -16 16 Cultivated and managed areas -17 17 Mosaic crop/tree/natural vegetation -18 18 Mosaic crop/shrub/grass -19 19 Bare areas -20 20 Water -21 21 Snow and ice -22 22 Artificial surface -23 23 Ocean -24 24 Irrigated croplands -25 25 Rainfed croplands -26 26 Mosaic cropland (50-70%) - vegetation (20-50%) -27 27 Mosaic vegetation (50-70%) - cropland (20-50%) -28 28 Closed broadleaved evergreen forest -29 29 Closed needle-leaved evergreen forest -30 30 Open needle-leaved deciduous forest -31 31 Mixed broadleaved and needle-leaved forest -32 32 Mosaic shrubland (50-70%) - grassland (20-50%) -33 33 Mosaic grassland (50-70%) - shrubland (20-50%) -34 34 Closed to open shrubland -35 35 Sparse vegetation -36 36 Closed to open forest regularly flooded -37 37 Closed forest or shrubland permanently flooded -38 38 Closed to open grassland regularly flooded -39 39 Undefined -# 40-32767 Reserved -# 32768- Reserved for local use +0 0 Reserved +1 1 Evergreen broadleaved forest +2 2 Deciduous broadleaved closed forest +3 3 Deciduous broadleaved open forest +4 4 Evergreen needle-leaf forest +5 5 Deciduous needle-leaf forest +6 6 Mixed leaf trees +7 7 Freshwater flooded trees +8 8 Saline water flooded trees +9 9 Mosaic tree/natural vegetation +10 10 Burnt tree cover +11 11 Evergreen shrubs closed-open +12 12 Deciduous shrubs closed-open +13 13 Herbaceous vegetation closed-open +14 14 Sparse herbaceous or grass +15 15 Flooded shrubs or herbaceous +16 16 Cultivated and managed areas +17 17 Mosaic crop/tree/natural vegetation +18 18 Mosaic crop/shrub/grass +19 19 Bare areas +20 20 Water +21 21 Snow and ice +22 22 Artificial surface +23 23 Ocean +24 24 Irrigated croplands +25 25 Rainfed croplands +26 26 Mosaic cropland (50-70%) - vegetation (20-50%) +27 27 Mosaic vegetation (50-70%) - cropland (20-50%) +28 28 Closed broadleaved evergreen forest +29 29 Closed needle-leaved evergreen forest +30 30 Open needle-leaved deciduous forest +31 31 Mixed broadleaved and needle-leaved forest +32 32 Mosaic shrubland (50-70%) - grassland (20-50%) +33 33 Mosaic grassland (50-70%) - shrubland (20-50%) +34 34 Closed to open shrubland +35 35 Sparse vegetation +36 36 Closed to open forest regularly flooded +37 37 Closed forest or shrubland permanently flooded +38 38 Closed to open grassland regularly flooded +39 39 Undefined +# 40-32767 Reserved +# 32768- Reserved for local use diff --git a/definitions/grib2/tables/19/4.3.table b/definitions/grib2/tables/19/4.3.table index 8ba9e08ab..cea1bef4f 100644 --- a/definitions/grib2/tables/19/4.3.table +++ b/definitions/grib2/tables/19/4.3.table @@ -1,23 +1,23 @@ # Code table 4.3 - Type of generating process -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -12 12 Post-processed analysis -13 13 Post-processed forecast -14 14 Nowcast -15 15 Hindcast -16 16 Physical retrieval -17 17 Regression analysis -18 18 Difference between two forecasts -# 19-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +12 12 Post-processed analysis +13 13 Post-processed forecast +14 14 Nowcast +15 15 Hindcast +16 16 Physical retrieval +17 17 Regression analysis +18 18 Difference between two forecasts +# 19-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.4.table b/definitions/grib2/tables/19/4.4.table index 7087ebddb..6e63e069c 100644 --- a/definitions/grib2/tables/19/4.4.table +++ b/definitions/grib2/tables/19/4.4.table @@ -1,17 +1,17 @@ # Code table 4.4 - Indicator of unit of time range -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.5.table b/definitions/grib2/tables/19/4.5.table index 2f1a8a8b7..33abd6293 100644 --- a/definitions/grib2/tables/19/4.5.table +++ b/definitions/grib2/tables/19/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface (-) 2 2 Cloud base level (-) 3 3 Level of cloud tops (-) @@ -16,15 +16,15 @@ 14 14 Level of free convection (LFC) 15 15 Convective condensation level (CCL) 16 16 Level of neutral buoyancy or equilibrium level (LNB) -# 17-19 Reserved +# 17-19 Reserved 20 20 Isothermal level (K) 21 21 Lowest level where mass density exceeds the specified value (base for a given threshold of mass density) (kg m-3) 22 22 Highest level where mass density exceeds the specified value (top for a given threshold of mass density) (kg m-3) 23 23 Lowest level where air concentration exceeds the specified value (base for a given threshold of air concentration) (Bq m-3) 24 24 Highest level where air concentration exceeds the specified value (top for a given threshold of air concentration) (Bq m-3) -# 25-99 Reserved +# 25-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -33,20 +33,20 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level (-) -112 112 Reserved -113 113 Logarithmic hybrid level +112 112 Reserved +113 113 Logarithmic hybrid level 114 114 Snow level (Numeric) 115 115 Sigma height level # 116 Reserved 117 117 Mixed layer depth (m) 118 hhl Hybrid height level (-) 119 hpl Hybrid pressure level (-) -# 120-149 Reserved -150 150 Generalized vertical height coordinate +# 120-149 Reserved +150 150 Generalized vertical height coordinate 151 sol Soil level (Numeric) -# 152-159 Reserved +# 152-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 sfc Lake or river bottom (-) @@ -55,7 +55,7 @@ 165 165 Bottom of sediment layer penetrated by thermal wave (-) 166 sfc Mixing layer (-) 167 167 Bottom of root zone (-) -# 168-173 Reserved +# 168-173 Reserved 174 sfc Top surface of ice on sea, lake or river 175 175 Top surface of ice, under snow cover, on sea, lake or river 176 176 Bottom surface (underside) ice on sea, lake or river @@ -67,6 +67,6 @@ 182 182 Grid tile water fraction as a model surface 183 183 Grid tile ice fraction on sea, lake or river as a model surface 184 184 Grid tile glacier ice and inland ice fraction as a model surface -# 185-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 185-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.6.table b/definitions/grib2/tables/19/4.6.table index b2dfeb498..ce799721d 100644 --- a/definitions/grib2/tables/19/4.6.table +++ b/definitions/grib2/tables/19/4.6.table @@ -1,9 +1,9 @@ # Code table 4.6 - Type of ensemble forecast -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.7.table b/definitions/grib2/tables/19/4.7.table index e0de0e1b2..69b2b4d77 100644 --- a/definitions/grib2/tables/19/4.7.table +++ b/definitions/grib2/tables/19/4.7.table @@ -1,14 +1,14 @@ # Code table 4.7 - Derived forecast -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.8.table b/definitions/grib2/tables/19/4.8.table index ad883039c..78467454a 100644 --- a/definitions/grib2/tables/19/4.8.table +++ b/definitions/grib2/tables/19/4.8.table @@ -1,6 +1,6 @@ # Code table 4.8 - Clustering method -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.9.table b/definitions/grib2/tables/19/4.9.table index 5878b5ad3..0ce312dd1 100644 --- a/definitions/grib2/tables/19/4.9.table +++ b/definitions/grib2/tables/19/4.9.table @@ -1,9 +1,9 @@ # Code table 4.9 - Probability type -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/4.91.table b/definitions/grib2/tables/19/4.91.table index 44cf25f44..ae31ed61c 100644 --- a/definitions/grib2/tables/19/4.91.table +++ b/definitions/grib2/tables/19/4.91.table @@ -1,16 +1,16 @@ # Code table 4.91 - Type of Interval -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit -11 11 Equal to first limit -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit +11 11 Equal to first limit +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/19/5.0.table b/definitions/grib2/tables/19/5.0.table index 33597681b..4d6cc68c8 100644 --- a/definitions/grib2/tables/19/5.0.table +++ b/definitions/grib2/tables/19/5.0.table @@ -1,24 +1,24 @@ # Code table 5.0 - Data representation template number -0 0 Grid point data - simple packing -1 1 Matrix value at grid point - simple packing -2 2 Grid point data - complex packing -3 3 Grid point data - complex packing and spatial differencing -4 4 Grid point data - IEEE floating point data -40 40 Grid point data - JPEG 2000 code stream format -41 41 Grid point data - Portable Network Graphics (PNG) +0 0 Grid point data - simple packing +1 1 Matrix value at grid point - simple packing +2 2 Grid point data - complex packing +3 3 Grid point data - complex packing and spatial differencing +4 4 Grid point data - IEEE floating point data +40 40 Grid point data - JPEG 2000 code stream format +41 41 Grid point data - Portable Network Graphics (PNG) 42 42 Grid point data - CCSDS recommended lossless compression -# 43-49 Reserved -50 50 Spectral data - simple packing -51 51 Spherical harmonics data - complex packing -# 52-60 Reserved -61 61 Grid point data - simple packing with logarithm pre-processing -# 62-199 Reserved -200 200 Run length packing with level values -# 201-49151 Reserved -# 49152-65534 Reserved for local use +# 43-49 Reserved +50 50 Spectral data - simple packing +51 51 Spherical harmonics data - complex packing +# 52-60 Reserved +61 61 Grid point data - simple packing with logarithm pre-processing +# 62-199 Reserved +200 200 Run length packing with level values +# 201-49151 Reserved +# 49152-65534 Reserved for local use 40000 40000 JPEG2000 Packing 40010 40010 PNG pacling 50000 50000 Sperical harmonics ieee packing 50001 50001 Second order packing 50002 50002 Second order packing -65535 65535 Missing +65535 65535 Missing diff --git a/definitions/grib2/tables/19/5.1.table b/definitions/grib2/tables/19/5.1.table index 854330c74..1189b5e46 100644 --- a/definitions/grib2/tables/19/5.1.table +++ b/definitions/grib2/tables/19/5.1.table @@ -1,6 +1,6 @@ # Code table 5.1 - Type of original field values -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/5.2.table b/definitions/grib2/tables/19/5.2.table index 40586a131..d77fdf4e7 100644 --- a/definitions/grib2/tables/19/5.2.table +++ b/definitions/grib2/tables/19/5.2.table @@ -1,8 +1,8 @@ # Code table 5.2 - Matrix coordinate value function definition -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/5.3.table b/definitions/grib2/tables/19/5.3.table index c3b7b30fe..481331791 100644 --- a/definitions/grib2/tables/19/5.3.table +++ b/definitions/grib2/tables/19/5.3.table @@ -1,7 +1,7 @@ # Code table 5.3 - Matrix coordinate parameter -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/5.4.table b/definitions/grib2/tables/19/5.4.table index 8121c1819..e84ab1901 100644 --- a/definitions/grib2/tables/19/5.4.table +++ b/definitions/grib2/tables/19/5.4.table @@ -1,6 +1,6 @@ # Code table 5.4 - Group splitting method -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/5.40.table b/definitions/grib2/tables/19/5.40.table index b9bad2c39..97e8880ab 100644 --- a/definitions/grib2/tables/19/5.40.table +++ b/definitions/grib2/tables/19/5.40.table @@ -1,5 +1,5 @@ # Code table 5.40 - Type of compression -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/19/5.5.table b/definitions/grib2/tables/19/5.5.table index 3ef3eb070..f2316975a 100644 --- a/definitions/grib2/tables/19/5.5.table +++ b/definitions/grib2/tables/19/5.5.table @@ -1,7 +1,7 @@ # Code table 5.5 - Missing value management for complex packing -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/5.6.table b/definitions/grib2/tables/19/5.6.table index 6d5177877..db68ead9c 100644 --- a/definitions/grib2/tables/19/5.6.table +++ b/definitions/grib2/tables/19/5.6.table @@ -1,7 +1,7 @@ # Code table 5.6 - Order of spatial differencing -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/19/5.7.table b/definitions/grib2/tables/19/5.7.table index 5ab780056..e54862c19 100644 --- a/definitions/grib2/tables/19/5.7.table +++ b/definitions/grib2/tables/19/5.7.table @@ -1,7 +1,7 @@ # Code table 5.7 - Precision of floating-point numbers -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/19/6.0.table b/definitions/grib2/tables/19/6.0.table index 2a29aa285..a8f30f5a4 100644 --- a/definitions/grib2/tables/19/6.0.table +++ b/definitions/grib2/tables/19/6.0.table @@ -1,6 +1,6 @@ # Code table 6.0 - Bit map indicator -0 0 A bit map applies to this product and is specified in this Section +0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/32/4.252.table b/definitions/grib2/tables/32/4.252.table index f13d72689..961928cd4 100644 --- a/definitions/grib2/tables/32/4.252.table +++ b/definitions/grib2/tables/32/4.252.table @@ -161,5 +161,5 @@ # 4023-4500 Reserved for tile class entries for tile models using the European Commission-Global Land Cover Project GLC2000 survey # 4501-5000 Reserved for tile grouping entries for tile models using the European Commission-Global Land Cover Project GLC2000 survey # 5001-32767 Reserved for additional land cover surveys -# 32768-65534 Reserved for local use -65535 65535 Missing \ No newline at end of file +# 32768-65534 Reserved for local use +65535 65535 Missing \ No newline at end of file diff --git a/definitions/grib2/tables/33/0.0.table b/definitions/grib2/tables/33/0.0.table new file mode 100644 index 000000000..a8542e94f --- /dev/null +++ b/definitions/grib2/tables/33/0.0.table @@ -0,0 +1,13 @@ +# Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Satellite remote sensing products (formerly Space products) +4 4 Space weather products +# 5-9 Reserved +10 10 Oceanographic products +# 11-19 Reserved +20 20 Health and socioeconomic impacts +# 21-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/1.0.table b/definitions/grib2/tables/33/1.0.table new file mode 100644 index 000000000..841af8c85 --- /dev/null +++ b/definitions/grib2/tables/33/1.0.table @@ -0,0 +1,38 @@ +# Code table 1.0 - GRIB master tables version number +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 +6 6 Version implemented on 15 September 2010 +7 7 Version implemented on 4 May 2011 +8 8 Version implemented on 2 November 2011 +9 9 Version implemented on 2 May 2012 +10 10 Version implemented on 7 November 2012 +11 11 Version implemented on 8 May 2013 +12 12 Version implemented on 14 November 2013 +13 13 Version implemented on 7 May 2014 +14 14 Version implemented on 5 November 2014 +15 15 Version implemented on 6 May 2015 +16 16 Version implemented on 11 November 2015 +17 17 Version implemented on 4 May 2016 +18 18 Version implemented on 2 November 2016 +19 19 Version implemented on 3 May 2017 +20 20 Version implemented on 8 November 2017 +21 21 Version implemented on 2 May 2018 +22 22 Version implemented on 7 November 2018 +23 23 Version implemented on 15 May 2019 +24 24 Version implemented on 6 November 2019 +25 25 Version implemented on 6 May 2020 +26 26 Version implemented on 16 November 2020 +27 27 Version implemented on 15 June 2021 +28 28 Version implemented on 15 November 2021 +29 29 Version implemented on 15 May 2022 +30 30 Version implemented on 15 November 2022 +31 31 Version implemented on 15 May 2023 +32 32 Version implemented on 30 November 2023 +33 33 Version implemented on 15 May 2024 +34 34 Pre-operational to be implemented by next amendment +# 35-254 Future versions +255 255 Missing diff --git a/definitions/grib2/tables/33/1.1.table b/definitions/grib2/tables/33/1.1.table new file mode 100644 index 000000000..f6d332005 --- /dev/null +++ b/definitions/grib2/tables/33/1.1.table @@ -0,0 +1,4 @@ +# Code table 1.1 - GRIB local tables version number +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/33/1.2.table b/definitions/grib2/tables/33/1.2.table new file mode 100644 index 000000000..05ec48c5d --- /dev/null +++ b/definitions/grib2/tables/33/1.2.table @@ -0,0 +1,10 @@ +# Code table 1.2 - Significance of reference time +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +4 4 Local time +5 5 Simulation start +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/1.3.table b/definitions/grib2/tables/33/1.3.table new file mode 100644 index 000000000..88c033e42 --- /dev/null +++ b/definitions/grib2/tables/33/1.3.table @@ -0,0 +1,18 @@ +# Code table 1.3 - Production status of data +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products +4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) +5 5 THORPEX Interactive Grand Global Ensemble test (TIGGE) +6 6 S2S operational products +7 7 S2S test products +8 8 Uncertainties in Ensembles of Regional ReAnalyses project (UERRA) +9 9 Uncertainties in Ensembles of Regional ReAnalyses project test (UERRA) +10 10 Copernicus regional reanalysis (CARRA/CERRA) +11 11 Copernicus regional reanalysis test (CARRA/CERRA) +12 12 Destination Earth +13 13 Destination Earth test +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/1.4.table b/definitions/grib2/tables/33/1.4.table new file mode 100644 index 000000000..877288c0e --- /dev/null +++ b/definitions/grib2/tables/33/1.4.table @@ -0,0 +1,13 @@ +# Code table 1.4 - Type of data +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/33/1.5.table b/definitions/grib2/tables/33/1.5.table new file mode 100644 index 000000000..533111959 --- /dev/null +++ b/definitions/grib2/tables/33/1.5.table @@ -0,0 +1,7 @@ +# Code table 1.5 - Identification template number +0 0 Calendar definition +1 1 Paleontological offset +2 2 Calendar definition and paleontological offset +# 3-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/33/1.6.table b/definitions/grib2/tables/33/1.6.table new file mode 100644 index 000000000..bd46899a7 --- /dev/null +++ b/definitions/grib2/tables/33/1.6.table @@ -0,0 +1,8 @@ +# Code table 1.6 - Type of calendar +0 0 Gregorian +1 1 360-day +2 2 365-day +3 3 Proleptic Gregorian +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/3.0.table b/definitions/grib2/tables/33/3.0.table new file mode 100644 index 000000000..a442a06a0 --- /dev/null +++ b/definitions/grib2/tables/33/3.0.table @@ -0,0 +1,6 @@ +# Code table 3.0 - Source of grid definition +0 0 Specified in Code table 3.1 +1 1 Predetermined grid definition (Defined by originating centre) +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/33/3.1.table b/definitions/grib2/tables/33/3.1.table new file mode 100644 index 000000000..26dc8da3f --- /dev/null +++ b/definitions/grib2/tables/33/3.1.table @@ -0,0 +1,57 @@ +# Code table 3.1 - Grid definition template number +0 0 Latitude/longitude (Also called equidistant cylindrical, or Plate Carree) +1 1 Rotated latitude/longitude +2 2 Stretched latitude/longitude +3 3 Stretched and rotated latitude/longitude +4 4 Variable resolution latitude/longitude +5 5 Variable resolution rotated latitude/longitude +# 6-9 Reserved +10 10 Mercator +# 11 Reserved +12 12 Transverse Mercator +13 13 Mercator with modelling subdomains definition +# 14-19 Reserved +20 20 Polar stereographic projection (Can be south or north) +# 21-22 Reserved +23 23 Polar stereographic with modelling subdomains definition +# 24-29 Reserved +30 30 Lambert conformal (Can be secant or tangent, conical or bipolar) +31 31 Albers equal area +# 32 Reserved +33 33 Lambert conformal with modelling subdomains definition +# 34-39 Reserved +40 40 Gaussian latitude/longitude +41 41 Rotated Gaussian latitude/longitude +42 42 Stretched Gaussian latitude/longitude +43 43 Stretched and rotated Gaussian latitude/longitude +# 44-49 Reserved +50 50 Spherical harmonic coefficients +51 51 Rotated spherical harmonic coefficients +52 52 Stretched spherical harmonic coefficients +53 53 Stretched and rotated spherical harmonic coefficients +# 54-60 Reserved +61 61 Spectral Mercator with modelling subdomains definition +62 62 Spectral polar stereographic with modelling subdomains definition +63 63 Spectral Lambert conformal with modelling subdomains definition +# 64-89 Reserved +90 90 Space view perspective or orthographic +# 91-99 Reserved +100 100 Triangular grid based on an icosahedron +101 101 General unstructured grid +# 102-109 Reserved +110 110 Equatorial azimuthal equidistant projection +# 111-119 Reserved +120 120 Azimuth-range projection +# 121-139 Reserved +140 140 Lambert azimuthal equal area projection +# 141-149 Reserved +150 150 Hierarchical Equal Area isoLatitude Pixelization grid (HEALPix) +# 151-999 Reserved +1000 1000 Cross-section grid with points equally spaced on the horizontal +# 1001-1099 Reserved +1100 1100 Hovmoller diagram grid with points equally spaced on the horizontal +# 1101-1199 Reserved +1200 1200 Time section grid +# 1201-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/33/3.10.table b/definitions/grib2/tables/33/3.10.table new file mode 100644 index 000000000..1612d05e3 --- /dev/null +++ b/definitions/grib2/tables/33/3.10.table @@ -0,0 +1,8 @@ +# Flag table 3.10 - Scanning mode for one diamond +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/33/3.11.table b/definitions/grib2/tables/33/3.11.table new file mode 100644 index 000000000..06ae10810 --- /dev/null +++ b/definitions/grib2/tables/33/3.11.table @@ -0,0 +1,7 @@ +# Code table 3.11 - Interpretation of list of numbers at end of section 3 +0 0 There is no appended list +1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows +2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row +3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/3.12.table b/definitions/grib2/tables/33/3.12.table new file mode 100644 index 000000000..7d4757100 --- /dev/null +++ b/definitions/grib2/tables/33/3.12.table @@ -0,0 +1,6 @@ +# Code table 3.12 - HEALPix rhomboids or points ordering +0 0 Ring ordering +1 1 Nested ordering +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/3.13.table b/definitions/grib2/tables/33/3.13.table new file mode 100644 index 000000000..aabe4fc03 --- /dev/null +++ b/definitions/grib2/tables/33/3.13.table @@ -0,0 +1,8 @@ +# Flag table 3.13 - HEALPix scanning mode +1 0 Points scan in +i (+x) direction +1 1 Points scan in -i (-x) direction +2 0 Points scan in -j (-y) direction +2 1 Points scan in +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/33/3.15.table b/definitions/grib2/tables/33/3.15.table new file mode 100644 index 000000000..43539dbfc --- /dev/null +++ b/definitions/grib2/tables/33/3.15.table @@ -0,0 +1,23 @@ +# Code table 3.15 - Physical meaning of vertical coordinate +# 0-19 Reserved +20 20 Temperature (K) +# 21-99 Reserved +100 100 Pressure (Pa) +101 101 Pressure deviation from mean sea level (Pa) +102 102 Altitude above mean sea level (m) +103 103 Height above ground (m) +104 104 Sigma coordinate +105 105 Hybrid coordinate +106 106 Depth below land surface (m) +107 pt Potential temperature (theta) (K) +108 108 Pressure deviation from ground to level (Pa) +109 pv Potential vorticity (K m2 kg-1 s-1) +110 110 Geometrical height (m) +111 111 Eta coordinate +112 112 Geopotential height (gpm) +113 113 Logarithmic hybrid coordinate +# 114-159 Reserved +160 160 Depth below sea level (m) +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/3.2.table b/definitions/grib2/tables/33/3.2.table new file mode 100644 index 000000000..13b9bf469 --- /dev/null +++ b/definitions/grib2/tables/33/3.2.table @@ -0,0 +1,16 @@ +# Code table 3.2 - Shape of the reference system +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS-84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS-84 reference frame +9 9 Earth represented by the Ordnance Survey Great Britain 1936 Datum, using the Airy 1830 Spheroid, the Greenwich meridian as 0 longitude, and the Newlyn datum as mean sea level, 0 height +10 10 Earth model assumed WGS84 with corrected geomagnetic coordinates (latitude and longitude) defined by Gustafsson et al., 1992 +11 11 Sun assumed spherical with radius = 695 990 000 m (Allen, C.W., Astrophysical Quantities, 3rd ed.; Athlone: London, 1976) and Stonyhurst latitude and longitude system with origin at the intersection of the solar central meridian (as seen from Earth) and the solar equator (Thompson, W., Coordinate systems for solar image data, Astron. Astrophys. 2006, 449, 791-803) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/3.20.table b/definitions/grib2/tables/33/3.20.table new file mode 100644 index 000000000..e2bb156ee --- /dev/null +++ b/definitions/grib2/tables/33/3.20.table @@ -0,0 +1,6 @@ +# Code table 3.20 - Type of horizontal line +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/3.21.table b/definitions/grib2/tables/33/3.21.table new file mode 100644 index 000000000..e001e1c8f --- /dev/null +++ b/definitions/grib2/tables/33/3.21.table @@ -0,0 +1,8 @@ +# Code table 3.21 - Vertical dimension coordinate values definition +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/3.25.table b/definitions/grib2/tables/33/3.25.table new file mode 100644 index 000000000..e5a754994 --- /dev/null +++ b/definitions/grib2/tables/33/3.25.table @@ -0,0 +1,10 @@ +# Code table 3.25 - Type of bi-Fourier truncation +# 0-76 Reserved +77 77 Rectangular +# 78-87 Reserved +88 88 Elliptic +# 89-98 Reserved +99 99 Diamond +# 100-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/3.3.table b/definitions/grib2/tables/33/3.3.table new file mode 100644 index 000000000..25cb46a1d --- /dev/null +++ b/definitions/grib2/tables/33/3.3.table @@ -0,0 +1,9 @@ +# Flag table 3.3 - Resolution and component flags +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/33/3.4.table b/definitions/grib2/tables/33/3.4.table new file mode 100644 index 000000000..0f9d84464 --- /dev/null +++ b/definitions/grib2/tables/33/3.4.table @@ -0,0 +1,17 @@ +# Flag table 3.4 - Scanning mode +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction are consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scan in the opposite direction +5 0 Points within odd rows are not offset in i (x) direction +5 1 Points within odd rows are offset by Di/2 in i (x) direction +6 0 Points within even rows are not offset in i (x) direction +6 1 Points within even rows are offset by Di/2 in i (x) direction +7 0 Points are not offset in j (y) direction +7 1 Points are offset by Dj/2 in j (y) direction +8 0 Rows have Ni grid points and columns have Nj grid points +8 1 Rows have Ni grid points if points are not offset in i direction Rows have Ni-1 grid points if points are offset by Di/2 in i direction Columns have Nj grid points if points are not offset in j direction Columns have Nj-1 grid points if points are offset by Dj/2 in j direction diff --git a/definitions/grib2/tables/33/3.5.table b/definitions/grib2/tables/33/3.5.table new file mode 100644 index 000000000..2f8ec82e3 --- /dev/null +++ b/definitions/grib2/tables/33/3.5.table @@ -0,0 +1,5 @@ +# Flag table 3.5 - Projection centre +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/33/3.6.table b/definitions/grib2/tables/33/3.6.table new file mode 100644 index 000000000..5ab13aaa5 --- /dev/null +++ b/definitions/grib2/tables/33/3.6.table @@ -0,0 +1,3 @@ +# Code table 3.6 - Spectral data representation type +1 1 see separate doc or pdf file +2 2 Bi-Fourier representation diff --git a/definitions/grib2/tables/33/3.7.table b/definitions/grib2/tables/33/3.7.table new file mode 100644 index 000000000..34c0de085 --- /dev/null +++ b/definitions/grib2/tables/33/3.7.table @@ -0,0 +1,5 @@ +# Code table 3.7 - Spectral data representation mode +0 0 Reserved +1 1 see separate doc or pdf file +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/3.8.table b/definitions/grib2/tables/33/3.8.table new file mode 100644 index 000000000..fcd17dca8 --- /dev/null +++ b/definitions/grib2/tables/33/3.8.table @@ -0,0 +1,10 @@ +# Code table 3.8 - Grid point position +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +3 3 Grid points at shape vertices +4 4 Grid points at centre of shapes +5 5 Grid points at midpoints of shape sides +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/3.9.table b/definitions/grib2/tables/33/3.9.table new file mode 100644 index 000000000..ecd65514a --- /dev/null +++ b/definitions/grib2/tables/33/3.9.table @@ -0,0 +1,4 @@ +# Flag table 3.9 - Numbering order of diamonds as seen from the corresponding pole +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/33/4.0.table b/definitions/grib2/tables/33/4.0.table new file mode 100644 index 000000000..86399bd79 --- /dev/null +++ b/definitions/grib2/tables/33/4.0.table @@ -0,0 +1,124 @@ +# Code table 4.0 - Product definition template number +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values or other statistically processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +33 33 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +34 34 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data +35 35 Satellite product with or without associated quality values +# 36-39 Reserved +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +42 42 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +49 49 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol +# 50 Reserved +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +# 52 Reserved +53 53 Partitioned parameters at a horizontal level or in a horizontal layer at a point in time +54 54 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for partitioned parameters +55 55 Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time +56 56 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters (deprecated) +57 57 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function +58 58 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents based on a distribution function +59 59 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters (corrected version of template 4.56) +60 60 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +61 61 Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval +62 62 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time +63 63 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for spatio-temporal changing tiles +# 64-66 Reserved +67 67 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents based on a distribution function +68 68 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents based on a distribution function +# 69 Reserved +70 70 Post-processing analysis or forecast at a horizontal level or in a horizontal layer at a point in time +71 71 Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +72 72 Post-processing average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +73 73 Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval +# 74-75 Reserved +76 76 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents with source or sink +77 77 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents with source or sink +78 78 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents with source or sink +79 79 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents with source or sink +80 80 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol with source or sink +81 81 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol with source or sink +82 82 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol with source or sink +83 83 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol with source or sink +84 84 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol with source or sink +85 85 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol +86 86 Quantile forecasts at a horizontal level or in a horizontal layer at a point in time +87 87 Quantile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +88 88 Analysis or forecast at a horizontal level or in a horizontal layer at a specified local time +89 89 Post-processed quantile forecasts at a horizontal level or in a horizontal layer at a point in time +90 90 Post-processed quantile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +92 92 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a specified local time +93 93 Post-processing analysis or forecast at a horizontal level or in a horizontal layer at a specified local time +94 94 Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a specified local time +95 95 Average, accumulation, extreme values or other statistically processed value at a horizontal level or in a horizontal layer at a specified local time +96 96 Average, accumulation, extreme values or other statistically processed values of an individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a specified local time +97 97 Average, accumulation, extreme values or other statistically processed values of post-processing analysis or forecast at a horizontal level or in a horizontal layer at a specified local time +98 98 Average, accumulation, extreme values or other statistically processed values of a post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a specified local time +99 99 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for wave 2D spectra with explicit list of frequencies and directions +100 100 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for wave 2D spectra with explicit list of frequencies and directions +101 101 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for wave 2D spectra with frequencies and directions defined by formulae +102 102 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for wave 2D spectra with frequencies and directions defined by formulae +103 103 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for waves selected by period range +104 104 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for waves selected by period range +105 105 Anomalies, significance and other derived products from an analysis or forecast in relation to a reference period at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +106 106 Anomalies, significance and other derived products from an individual ensemble forecast, control and perturbed in relation to a reference period at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +107 107 Anomalies, significance and other derived products from derived forecasts based on all ensemble members in relation to a reference period at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +108 108 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for generic optical products +109 109 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for generic optical products +110 110 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for generic optical products +111 111 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for generic optical products +112 112 Anomalies, significance and other derived products as probability forecasts in relation to a reference period at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +113 113 Generalised tiles at a horizontal level or horizontal layer at a point in time +114 114 Average, accumulation, and/or extreme values or other statistically processed values on generalised tiles at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +115 115 Individual ensemble forecast, control and perturbed on generalised tiles at a horizontal level or in a horizontal layer at a point in time +116 116 Individual ensemble forecast, control and perturbed on generalised tiles at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +117 117 Individual large ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +118 118 Individual large ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +119 119 Probability forecasts from large ensembles at a horizontal level or in a horizontal layer at a point in time +120 120 Probability forecasts from large ensembles at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +121 121 Probability forecasts from large ensembles with spatiotemporal processing based on focal (moving window) statistics at a horizontal level or in a horizontal layer at a point in time +122 122 Probability forecasts from large ensembles with spatiotemporal processing based on focal (moving window) statistics at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +123 123 Probability forecasts from large ensembles with spatiotemporal processing based on focal (moving window) statistics in relation to a reference period at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +124 124 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for radionuclides +125 125 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for radionuclides +126 126 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for radionuclides +127 127 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for radionuclides +# 128-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing +# 1102-32767 Reserved +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/33/4.1.0.table b/definitions/grib2/tables/33/4.1.0.table new file mode 100644 index 000000000..deb34a4e3 --- /dev/null +++ b/definitions/grib2/tables/33/4.1.0.table @@ -0,0 +1,29 @@ +# Product discipline 0 - Meteorological products +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +21 21 Thermodynamic properties +22 22 Drought indices +# 23-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.1.1.table b/definitions/grib2/tables/33/4.1.1.table new file mode 100644 index 000000000..df2c13fa8 --- /dev/null +++ b/definitions/grib2/tables/33/4.1.1.table @@ -0,0 +1,7 @@ +# Product discipline 1 - Hydrological products +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.1.10.table b/definitions/grib2/tables/33/4.1.10.table new file mode 100644 index 000000000..5a64f9652 --- /dev/null +++ b/definitions/grib2/tables/33/4.1.10.table @@ -0,0 +1,10 @@ +# Product discipline 10 - Oceanographic products +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Subsurface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.1.2.table b/definitions/grib2/tables/33/4.1.2.table new file mode 100644 index 000000000..9d6f690ac --- /dev/null +++ b/definitions/grib2/tables/33/4.1.2.table @@ -0,0 +1,11 @@ +# Product discipline 2 - Land surface products +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +5 5 Glaciers and inland ice +6 6 Urban areas +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.1.20.table b/definitions/grib2/tables/33/4.1.20.table new file mode 100644 index 000000000..e651e326f --- /dev/null +++ b/definitions/grib2/tables/33/4.1.20.table @@ -0,0 +1,8 @@ +# Product discipline 20 - Health and socioeconomic impacts +0 0 Health indicators +1 1 Epidemiology +2 2 Socioeconomic indicators +3 3 Renewable energy sector +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.1.3.table b/definitions/grib2/tables/33/4.1.3.table new file mode 100644 index 000000000..35d82f440 --- /dev/null +++ b/definitions/grib2/tables/33/4.1.3.table @@ -0,0 +1,11 @@ +# Product discipline 3 - Satellite remote sensing products (formerly Space products) +0 0 Image format products +1 1 Quantitative products +2 2 Cloud properties +3 3 Flight rule conditions +4 4 Volcanic ash +5 5 Sea-surface temperature +6 6 Solar radiation +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.1.4.table b/definitions/grib2/tables/33/4.1.4.table new file mode 100644 index 000000000..7d1378729 --- /dev/null +++ b/definitions/grib2/tables/33/4.1.4.table @@ -0,0 +1,15 @@ +# Product discipline 4 - Space weather products +0 0 Temperature +1 1 Momentum +2 2 Charged particle mass and number +3 3 Electric and magnetic fields +4 4 Energetic particles +5 5 Waves +6 6 Solar electromagnetic emissions +7 7 Terrestrial electromagnetic emissions +8 8 Imagery +9 9 Ion-neutral coupling +10 10 Space weather indices +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.10.table b/definitions/grib2/tables/33/4.10.table new file mode 100644 index 000000000..0acd9127c --- /dev/null +++ b/definitions/grib2/tables/33/4.10.table @@ -0,0 +1,22 @@ +# Code table 4.10 - Type of statistical processing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +11 11 Summation +12 12 Return period +13 13 Median +# 14-99 Reserved +100 100 Severity +101 101 Mode +102 102 Index processing +# 103-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/33/4.100.table b/definitions/grib2/tables/33/4.100.table new file mode 100644 index 000000000..a24770d68 --- /dev/null +++ b/definitions/grib2/tables/33/4.100.table @@ -0,0 +1,10 @@ +# Code table 4.100 - Type of reference dataset +0 0 Analysis +1 1 Forecast +2 2 Reforecast (Hindcast) +3 3 Reanalysis +4 4 Climate projection +5 5 Gridded observations +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.101.table b/definitions/grib2/tables/33/4.101.table new file mode 100644 index 000000000..0fcdb13d9 --- /dev/null +++ b/definitions/grib2/tables/33/4.101.table @@ -0,0 +1,13 @@ +# Code table 4.101 - Type of relationship to reference dataset +0 0 Anomaly +1 1 Standardized anomaly +2 2 Significance (Wilcoxon-Mann-Whitney) +3 3 Climatology +# 4-19 Reserved +20 20 Extreme Forecast Index (EFI) +21 21 Shift of Tails (SOT) +22 22 Anomaly of probabilities +23 23 Standardized Drought Index +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.102.table b/definitions/grib2/tables/33/4.102.table new file mode 100644 index 000000000..214844fb3 --- /dev/null +++ b/definitions/grib2/tables/33/4.102.table @@ -0,0 +1,22 @@ +# Code table 4.102 - Statistical processing of reference period +0 0 Average +1 1 Accumulation +2 2 Maximum +3 3 Minimum +4 4 Median +# 5-19 Reserved +20 20 Model Climate +21 21 Index based on normal distribution +22 22 Index based on log-normal distribution +23 23 Index based on generalised log-normal distribution +24 24 Index based on gamma distribution +25 25 Index based on logistic distribution +26 26 Index based on log-logistic distribution +27 27 Index based on generalised logistic distribution +28 28 Index based on Weibull distribution +29 29 Index based on generalised extreme value distribution +30 30 Index based on Pearson III distribution +31 31 Index based on empirical distribution +# 32-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.103.table b/definitions/grib2/tables/33/4.103.table new file mode 100644 index 000000000..5d70488ca --- /dev/null +++ b/definitions/grib2/tables/33/4.103.table @@ -0,0 +1,9 @@ +# Code table 4.103 - Spatial vicinity type +0 0 Circle [m] +1 1 Rectangle [m,m] +2 2 Square [m] +3 3 Wedge [m, degree, degree] +4 4 Span of grid boxes centered around grid box i,j [x,y] +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.104.table b/definitions/grib2/tables/33/4.104.table new file mode 100644 index 000000000..d1e417780 --- /dev/null +++ b/definitions/grib2/tables/33/4.104.table @@ -0,0 +1,15 @@ +# Code table 4.104 - Spatial and temporal vicinity processing +0 0 Average +1 1 Reserved +2 2 Maximum +3 3 Minimum +4 4 Range +5 5 Reserved +6 6 Standard deviation +# 7-10 Reserved +11 11 Sum +# 12-189 Reserved +190 190 Quantile +191 191 Categorical (boolean) +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.105.table b/definitions/grib2/tables/33/4.105.table new file mode 100644 index 000000000..f3be24ecb --- /dev/null +++ b/definitions/grib2/tables/33/4.105.table @@ -0,0 +1,6 @@ +# Code table 4.105 - Spatial and temporal vicinity missing data +0 0 Ignore missing data +1 1 No data +# 2-189 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.11.table b/definitions/grib2/tables/33/4.11.table new file mode 100644 index 000000000..01cc81303 --- /dev/null +++ b/definitions/grib2/tables/33/4.11.table @@ -0,0 +1,10 @@ +# Code table 4.11 - Type of time intervals +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.12.table b/definitions/grib2/tables/33/4.12.table new file mode 100644 index 000000000..d42b47e96 --- /dev/null +++ b/definitions/grib2/tables/33/4.12.table @@ -0,0 +1,7 @@ +# Code table 4.12 - Operating mode +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.13.table b/definitions/grib2/tables/33/4.13.table new file mode 100644 index 000000000..a0e28eac8 --- /dev/null +++ b/definitions/grib2/tables/33/4.13.table @@ -0,0 +1,6 @@ +# Code table 4.13 - Quality control indicator +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.14.table b/definitions/grib2/tables/33/4.14.table new file mode 100644 index 000000000..d525b23b3 --- /dev/null +++ b/definitions/grib2/tables/33/4.14.table @@ -0,0 +1,6 @@ +# Code table 4.14 - Clutter filter indicator +0 0 No clutter filter used +1 1 Clutter filter used +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.15.table b/definitions/grib2/tables/33/4.15.table new file mode 100644 index 000000000..7adddedb6 --- /dev/null +++ b/definitions/grib2/tables/33/4.15.table @@ -0,0 +1,11 @@ +# Code table 4.15 - Type of spatial processing used to arrive at given data value from the source data +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.16.table b/definitions/grib2/tables/33/4.16.table new file mode 100644 index 000000000..5b9f6fd73 --- /dev/null +++ b/definitions/grib2/tables/33/4.16.table @@ -0,0 +1,10 @@ +# Code table 4.16 - Quality value associated with parameter +0 0 Confidence index +1 1 Quality indicator +2 2 Correlation of product with used calibration product +3 3 Standard deviation +4 4 Random error +5 5 Probability +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.192.table b/definitions/grib2/tables/33/4.192.table new file mode 100644 index 000000000..e1fd91594 --- /dev/null +++ b/definitions/grib2/tables/33/4.192.table @@ -0,0 +1,4 @@ +1 1 first +2 2 second +3 3 third +4 4 fourth diff --git a/definitions/grib2/tables/33/4.2.0.0.table b/definitions/grib2/tables/33/4.2.0.0.table new file mode 100644 index 000000000..e4912c9d6 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.0.table @@ -0,0 +1,37 @@ +# Product discipline 0 - Meteorological products, parameter category 0: temperature +0 0 Temperature (K) +1 1 Virtual temperature (K) +2 2 Potential temperature (K) +3 3 Pseudo-adiabatic potential temperature or equivalent potential temperature (K) +4 4 Maximum temperature (K) +5 5 Minimum temperature (K) +6 6 Dewpoint temperature (K) +7 7 Dewpoint depression (or deficit) (K) +8 8 Lapse rate (K/m) +9 9 Temperature anomaly (K) +10 10 Latent heat net flux (W m-2) +11 11 Sensible heat net flux (W m-2) +12 12 Heat index (K) +13 13 Wind chill factor (K) +14 14 Minimum dewpoint depression (K) +15 15 Virtual potential temperature (K) +16 16 Snow phase change heat flux (W m-2) +17 17 Skin temperature (K) +18 18 Snow temperature (top of snow) (K) +19 19 Turbulent transfer coefficient for heat (Numeric) +20 20 Turbulent diffusion coefficient for heat (m2/s) +21 21 Apparent temperature (K) +22 22 Temperature tendency due to short-wave radiation (K s-1) +23 23 Temperature tendency due to long-wave radiation (K s-1) +24 24 Temperature tendency due to short-wave radiation, clear sky (K s-1) +25 25 Temperature tendency due to long-wave radiation, clear sky (K s-1) +26 26 Temperature tendency due to parameterization (K s-1) +27 27 Wet-bulb temperature (K) +28 28 Unbalanced component of temperature (K) +29 29 Temperature advection (K s-1) +30 30 Latent heat net flux due to evaporation (W m-2) +31 31 Latent heat net flux due to sublimation (W m-2) +32 32 Wet-bulb potential temperature (K) +# 33-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.1.table b/definitions/grib2/tables/33/4.2.0.1.table new file mode 100644 index 000000000..2405606cb --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.1.table @@ -0,0 +1,174 @@ +# Product discipline 0 - Meteorological products, parameter category 1: moisture +0 0 Specific humidity (kg/kg) +1 1 Relative humidity (%) +2 2 Humidity mixing ratio (kg/kg) +3 3 Precipitable water (kg m-2) +4 4 Vapour pressure (Pa) +5 5 Saturation deficit (Pa) +6 6 Evaporation (kg m-2) +7 7 Precipitation rate (kg m-2 s-1) +8 8 Total precipitation (kg m-2) +9 9 Large-scale precipitation (non-convective) (kg m-2) +10 10 Convective precipitation (kg m-2) +11 11 Snow depth (m) +12 12 Snowfall rate water equivalent (kg m-2 s-1) +13 13 Water equivalent of accumulated snow depth (kg m-2) +14 14 Convective snow (kg m-2) +15 15 Large-scale snow (kg m-2) +16 16 Snow melt (kg m-2) +17 17 Snow age (d) +18 18 Absolute humidity (kg m-3) +19 19 Precipitation type (Code table 4.201) +20 20 Integrated liquid water (kg m-2) +21 21 Condensate (kg/kg) +22 22 Cloud mixing ratio (kg/kg) +23 23 Ice water mixing ratio (kg/kg) +24 24 Rain mixing ratio (kg/kg) +25 25 Snow mixing ratio (kg/kg) +26 26 Horizontal moisture convergence (kg kg-1 s-1) +27 27 Maximum relative humidity (%) +28 28 Maximum absolute humidity (kg m-3) +29 29 Total snowfall (m) +30 30 Precipitable water category (Code table 4.202) +31 31 Hail (m) +32 32 Graupel (snow pellets) (kg/kg) +33 33 Categorical rain (Code table 4.222) +34 34 Categorical freezing rain (Code table 4.222) +35 35 Categorical ice pellets (Code table 4.222) +36 36 Categorical snow (Code table 4.222) +37 37 Convective precipitation rate (kg m-2 s-1) +38 38 Horizontal moisture divergence (kg kg-1 s-1) +39 39 Per cent frozen precipitation (%) +40 40 Potential evaporation (kg m-2) +41 41 Potential evaporation rate (W m-2) +42 42 Snow cover (%) +43 43 Rain fraction of total cloud water (Proportion) +44 44 Rime factor (Numeric) +45 45 Total column integrated rain (kg m-2) +46 46 Total column integrated snow (kg m-2) +47 47 Large scale water precipitation (non-convective) (kg m-2) +48 48 Convective water precipitation (kg m-2) +49 49 Total water precipitation (kg m-2) +50 50 Total snow precipitation (kg m-2) +51 51 Total column water [Vertically integrated total water=vapour + cloud water/ice] (kg m-2) +52 52 Total precipitation rate (kg m-2 s-1) +53 53 Total snowfall rate water equivalent (kg m-2 s-1) +54 54 Large scale precipitation rate (kg m-2 s-1) +55 55 Convective snowfall rate water equivalent (kg m-2 s-1) +56 56 Large scale snowfall rate water equivalent (kg m-2 s-1) +57 57 Total snowfall rate (m/s) +58 58 Convective snowfall rate (m/s) +59 59 Large scale snowfall rate (m/s) +60 60 Snow depth water equivalent (kg m-2) +61 61 Snow density (kg m-3) +62 62 Snow evaporation (kg m-2) +63 63 Reserved +64 64 Total column integrated water vapour (kg m-2) +65 65 Rain precipitation rate (kg m-2 s-1) +66 66 Snow precipitation rate (kg m-2 s-1) +67 67 Freezing rain precipitation rate (kg m-2 s-1) +68 68 Ice pellets precipitation rate (kg m-2 s-1) +69 69 Total column integrated cloud water (kg m-2) +70 70 Total column integrated cloud ice (kg m-2) +71 71 Hail mixing ratio (kg/kg) +72 72 Total column integrated hail (kg m-2) +73 73 Hail precipitation rate (kg m-2 s-1) +74 74 Total column integrated graupel (kg m-2) +75 75 Graupel (snow pellets) precipitation rate (kg m-2 s-1) +76 76 Convective rain rate (kg m-2 s-1) +77 77 Large scale rain rate (kg m-2 s-1) +78 78 Total column integrated water (all components including precipitation) (kg m-2) +79 79 Evaporation rate (kg m-2 s-1) +80 80 Total condensate (kg/kg) +81 81 Total column-integrated condensate (kg m-2) +82 82 Cloud ice mixing-ratio (kg/kg) +83 83 Specific cloud liquid water content (kg/kg) +84 84 Specific cloud ice water content (kg/kg) +85 85 Specific rainwater content (kg/kg) +86 86 Specific snow water content (kg/kg) +87 87 Stratiform precipitation rate (kg m-2 s-1) +88 88 Categorical convective precipitation (Code table 4.222) +# 89 Reserved +90 90 Total kinematic moisture flux (kg kg-1 m s-1) +91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) +92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) +93 93 Relative humidity with respect to water (%) +94 94 Relative humidity with respect to ice (%) +95 95 Freezing or frozen precipitation rate (kg m-2 s-1) +96 96 Mass density of rain (kg m-3) +97 97 Mass density of snow (kg m-3) +98 98 Mass density of graupel (kg m-3) +99 99 Mass density of hail (kg m-3) +100 100 Specific number concentration of rain (kg-1) +101 101 Specific number concentration of snow (kg-1) +102 102 Specific number concentration of graupel (kg-1) +103 103 Specific number concentration of hail (kg-1) +104 104 Number density of rain (m-3) +105 105 Number density of snow (m-3) +106 106 Number density of graupel (m-3) +107 107 Number density of hail (m-3) +108 108 Specific humidity tendency due to parameterization (kg kg-1 s-1) +109 109 Mass density of liquid water coating on hail expressed as mass of liquid water per unit volume of air (kg m-3) +110 110 Specific mass of liquid water coating on hail expressed as mass of liquid water per unit mass of moist air (kg kg-1) +111 111 Mass mixing ratio of liquid water coating on hail expressed as mass of liquid water per unit mass of dry air (kg kg-1) +112 112 Mass density of liquid water coating on graupel expressed as mass of liquid water per unit volume of air (kg m-3) +113 113 Specific mass of liquid water coating on graupel expressed as mass of liquid water per unit mass of moist air (kg kg-1) +114 114 Mass mixing ratio of liquid water coating on graupel expressed as mass of liquid water per unit mass of dry air (kg kg-1) +115 115 Mass density of liquid water coating on snow expressed as mass of liquid water per unit volume of air (kg m-3) +116 116 Specific mass of liquid water coating on snow expressed as mass of liquid water per unit mass of moist air (kg kg-1) +117 117 Mass mixing ratio of liquid water coating on snow expressed as mass of liquid water per unit mass of dry air (kg kg-1) +118 118 Unbalanced component of specific humidity (kg kg-1) +119 119 Unbalanced component of specific cloud liquid water content (kg kg-1) +120 120 Unbalanced component of specific cloud ice water content (kg kg-1) +121 121 Fraction of snow cover (Proportion) +122 122 Precipitation intensity index (Code table 4.247) +123 123 Dominant precipitation type (Code table 4.201) +124 124 Presence of showers (Code table 4.222) +125 125 Presence of blowing snow (Code table 4.222) +126 126 Presence of blizzard (Code table 4.222) +127 127 Ice pellets (non-water equivalent) precipitation rate (m/s) +128 128 Total solid precipitation rate (kg m-2 s-1) +129 129 Effective radius of cloud water (m) +130 130 Effective radius of rain (m) +131 131 Effective radius of cloud ice (m) +132 132 Effective radius of snow (m) +133 133 Effective radius of graupel (m) +134 134 Effective radius of hail (m) +135 135 Effective radius of subgrid liquid clouds (m) +136 136 Effective radius of subgrid ice clouds (m) +137 137 Effective aspect ratio of rain (-) +138 138 Effective aspect ratio of cloud ice (-) +139 139 Effective aspect ratio of snow (-) +140 140 Effective aspect ratio of graupel (-) +141 141 Effective aspect ratio of hail (-) +142 142 Effective aspect ratio of subgrid ice clouds (-) +143 143 Potential evaporation rate (kg m-2 s-1) +144 144 Specific rain water content (convective) (kg kg-1) +145 145 Specific snow water content (convective) (kg kg-1) +146 146 Cloud ice precipitation rate (kg m-2 s-1) +147 147 Character of precipitation (Code table 4.249) +148 148 Snow evaporation rate (kg m-2 s-1) +149 149 Cloud water mixing ratio (kg kg-1) +150 150 Column integrated eastward water vapour mass flux (kg m-1 s-1) +151 151 Column integrated northward water vapour mass flux (kg m-1 s-1) +152 152 Column integrated eastward cloud liquid water mass flux (kg m-1 s-1) +153 153 Column integrated northward cloud liquid water mass flux (kg m-1 s-1) +154 154 Column integrated eastward cloud ice mass flux (kg m-1 s-1) +155 155 Column integrated northward cloud ice mass flux (kg m-1 s-1) +156 156 Column integrated eastward rain mass flux (kg m-1 s-1) +157 157 Column integrated northward rain mass flux (kg m-1 s-1) +158 158 Column integrated eastward snow mass flux (kg m-1 s-1) +159 159 Column integrated northward snow mass flux (kg m-1 s-1) +160 160 Column integrated divergence of water vapour mass flux (kg m-2 s-1) +161 161 Column integrated divergence of cloud liquid water mass flux (kg m-2 s-1) +162 162 Column integrated divergence of cloud ice mass flux (kg m-2 s-1) +163 163 Column integrated divergence of rain mass flux (kg m-2 s-1) +164 164 Column integrated divergence of snow mass flux (kg m-2 s-1) +165 165 Column integrated divergence of total water mass flux (kg m-2 s-1) +166 166 Column integrated water vapour flux (kg m-2 s-1) +167 167 Total column supercooled liquid water (kg m-2) +168 168 Saturation specific humidity with respect to water (kg m-3) +169 169 Total column integrated saturation specific humidity with respect to water (kg m-2) +# 170-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.13.table b/definitions/grib2/tables/33/4.2.0.13.table new file mode 100644 index 000000000..4c1253b96 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.13.table @@ -0,0 +1,5 @@ +# Product discipline 0 - Meteorological products, parameter category 13: aerosols +0 0 Aerosol type (Code table 4.205) +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.14.table b/definitions/grib2/tables/33/4.2.0.14.table new file mode 100644 index 000000000..df0f721ea --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.14.table @@ -0,0 +1,7 @@ +# Product discipline 0 - Meteorological products, parameter category 14: trace gases +0 0 Total ozone (DU) +1 1 Ozone mixing ratio (kg/kg) +2 2 Total column integrated ozone (DU) +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.15.table b/definitions/grib2/tables/33/4.2.0.15.table new file mode 100644 index 000000000..ac49ad402 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.15.table @@ -0,0 +1,21 @@ +# Product discipline 0 - Meteorological products, parameter category 15: radar +0 0 Base spectrum width (m/s) +1 1 Base reflectivity (dB) +2 2 Base radial velocity (m/s) +3 3 Vertically integrated liquid water (VIL) (kg m-2) +4 4 Layer-maximum base reflectivity (dB) +5 5 Precipitation (kg m-2) +6 6 Radar spectra (1) (-) +7 7 Radar spectra (2) (-) +8 8 Radar spectra (3) (-) +9 9 Reflectivity of cloud droplets (dB) +10 10 Reflectivity of cloud ice (dB) +11 11 Reflectivity of snow (dB) +12 12 Reflectivity of rain (dB) +13 13 Reflectivity of graupel (dB) +14 14 Reflectivity of hail (dB) +15 15 Hybrid scan reflectivity (dB) +16 16 Hybrid scan reflectivity height (m) +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.16.table b/definitions/grib2/tables/33/4.2.0.16.table new file mode 100644 index 000000000..111e6d986 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.16.table @@ -0,0 +1,10 @@ +# Product discipline 0 - Meteorological products, parameter category 16: forecast radar imagery +0 0 Equivalent radar reflectivity factor for rain (mm6 m-3) +1 1 Equivalent radar reflectivity factor for snow (mm6 m-3) +2 2 Equivalent radar reflectivity factor for parameterized convection (mm6 m-3) +3 3 Echo top (m) +4 4 Reflectivity (dB) +5 5 Composite reflectivity (dB) +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.17.table b/definitions/grib2/tables/33/4.2.0.17.table new file mode 100644 index 000000000..90ef72d87 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.17.table @@ -0,0 +1,7 @@ +# Product discipline 0 - Meteorological products, parameter category 17: electrodynamics +0 0 Lightning strike density (m-2 s-1) +1 1 Lightning potential index (LPI) (J kg-1) +2 2 Cloud-to-ground lightning flash density (km-2 day-1) +3 3 Cloud-to-cloud lightning flash density (km-2 day-1) +4 4 Total lightning flash density (km-2 day-1) +5 5 Subgrid-scale lightning potential index (J kg-1) diff --git a/definitions/grib2/tables/33/4.2.0.18.table b/definitions/grib2/tables/33/4.2.0.18.table new file mode 100644 index 000000000..6efa6e5e0 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.18.table @@ -0,0 +1,31 @@ +# Product discipline 0 - Meteorological products, parameter category 18: nuclear/radiology +0 0 Air activity concentration of caesium 137 (Bq m-3) +1 1 Air activity concentration of iodine 131 (Bq m-3) +2 2 Air activity concentration of radioactive pollutant (Bq m-3) +3 3 Ground deposition activity of caesium 137 (Bq m-2) +4 4 Ground deposition activity of iodine 131 (Bq m-2) +5 5 Ground deposition activity of radioactive pollutant (Bq m-2) +6 6 Time-integrated air activity concentration of caesium pollutant (Bq s m-3) +7 7 Time-integrated air activity concentration of iodine pollutant (Bq s m-3) +8 8 Time-integrated air activity concentration of radioactive pollutant (Bq s m-3) +9 9 Reserved +10 10 Air activity concentration (Bq m-3) +11 11 Wet deposition activity (Bq m-2) +12 12 Dry deposition activity (Bq m-2) +13 13 Total deposition activity (wet + dry) (Bq m-2) +14 14 Specific activity concentration (Bq kg-1) +15 15 Maximum of air activity concentration in layer (Bq m-3) +16 16 Height of maximum air activity concentration (m) +17 17 Column-integrated air activity concentration (Bq m-2) +18 18 Column-averaged air activity concentration in layer (Bq m-3) +19 19 Deposition activity arrival (s) +20 20 Deposition activity ended (s) +21 21 Cloud activity arrival (s) +22 22 Cloud activity ended (s) +23 23 Effective dose rate (nSv h-1) +24 24 Thyroid dose rate (adult) (nSv h-1) +25 25 Gamma dose rate (adult) (nSv h-1) +26 26 Activity emission (Bq s-1) +# 27-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.19.table b/definitions/grib2/tables/33/4.2.0.19.table new file mode 100644 index 000000000..be45d7a0d --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.19.table @@ -0,0 +1,55 @@ +# Product discipline 0 - Meteorological products, parameter category 19: physical atmospheric properties +0 0 Visibility (m) +1 1 Albedo (%) +2 2 Thunderstorm probability (%) +3 3 Mixed layer depth (m) +4 4 Volcanic ash (Code table 4.206) +5 5 Icing top (m) +6 6 Icing base (m) +7 7 Icing (Code table 4.207) +8 8 Turbulence top (m) +9 9 Turbulence base (m) +10 10 Turbulence (Code table 4.208) +11 11 Turbulent kinetic energy (J/kg) +12 12 Planetary boundary-layer regime (Code table 4.209) +13 13 Contrail intensity (Code table 4.210) +14 14 Contrail engine type (Code table 4.211) +15 15 Contrail top (m) +16 16 Contrail base (m) +17 17 Maximum snow albedo (%) +18 18 Snow free albedo (%) +19 19 Snow albedo (%) +20 20 Icing (%) +21 21 In-cloud turbulence (%) +22 22 Clear air turbulence (CAT) (%) +23 23 Supercooled large droplet probability (%) +24 24 Convective turbulent kinetic energy (J/kg) +25 25 Weather (Code table 4.225) +26 26 Convective outlook (Code table 4.224) +27 27 Icing scenario (Code table 4.227) +28 28 Mountain wave turbulence (eddy dissipation rate) (m2/3 s-1) +29 29 Clear air turbulence (CAT) (m2/3 s-1) +30 30 Eddy dissipation parameter (m2/3 s-1) +31 31 Maximum of eddy dissipation parameter in layer (m2/3 s-1) +32 32 Highest freezing level (m) +33 33 Visibility through liquid fog (m) +34 34 Visibility through ice fog (m) +35 35 Visibility through blowing snow (m) +36 36 Presence of snow squalls (Code table 4.222) +37 37 Icing severity (Code table 4.228) +38 38 Sky transparency index (Code table 4.214) +39 39 Seeing index (Code table 4.214) +40 40 Snow level (m) +41 41 Duct base height (m) +42 42 Trapping layer base height (m) +43 43 Trapping layer top height (m) +44 44 Mean vertical gradient of refractivity inside trapping layer (m-1) +45 45 Minimum vertical gradient of refractivity inside trapping layer (m-1) +46 46 Net radiation flux (W m-2) +47 47 Global irradiance on tilted surfaces (W m-2) +48 48 Top of persistent contrails (m) +49 49 Base of persistent contrails (m) +50 50 Convectively-induced turbulence (CIT) (eddy dissipation rate) (m2/3 s-1) +# 51-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.190.table b/definitions/grib2/tables/33/4.2.0.190.table new file mode 100644 index 000000000..dfe39840d --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.190.table @@ -0,0 +1,5 @@ +# Product discipline 0 - Meteorological products, parameter category 190: CCITT IA5 string +0 0 Arbitrary text string (CCITT IA5) +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.191.table b/definitions/grib2/tables/33/4.2.0.191.table new file mode 100644 index 000000000..5fce8eab0 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.191.table @@ -0,0 +1,12 @@ +# Product discipline 0 - Meteorological products, parameter category 191: miscellaneous +0 0 Seconds prior to initial reference time (defined in Section 1) (s) +1 1 Geographical latitude (deg N) +2 2 Geographical longitude (deg E) +3 3 Days since last observation (d) +4 4 Tropical cyclone density track (Numeric) +5 5 Hurricane track in spatiotemporal vicinity (boolean) +6 6 Tropical storm track in spatiotemporal vicinity (boolean) +7 7 Tropical depression track in spatiotemporal vicinity (boolean) +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.2.table b/definitions/grib2/tables/33/4.2.0.2.table new file mode 100644 index 000000000..bd6e32851 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.2.table @@ -0,0 +1,72 @@ +# Product discipline 0 - Meteorological products, parameter category 2: momentum +0 0 Wind direction (from which blowing) (degree true) +1 1 Wind speed (m/s) +2 2 u-component of wind (m/s) +3 3 v-component of wind (m/s) +4 4 Stream function (m2/s) +5 5 Velocity potential (m2/s) +6 6 Montgomery stream function (m2 s-2) +7 7 Sigma coordinate vertical velocity (/s) +8 8 Vertical velocity (pressure) (Pa/s) +9 9 Vertical velocity (geometric) (m/s) +10 10 Absolute vorticity (/s) +11 11 Absolute divergence (/s) +12 12 Relative vorticity (/s) +13 13 Relative divergence (/s) +14 14 Potential vorticity (K m2 kg-1 s-1) +15 15 Vertical u-component shear (/s) +16 16 Vertical v-component shear (/s) +17 17 Momentum flux, u-component (N m-2) +18 18 Momentum flux, v-component (N m-2) +19 19 Wind mixing energy (J) +20 20 Boundary layer dissipation (W m-2) +21 21 Maximum wind speed (m/s) +22 22 Wind speed (gust) (m/s) +23 23 u-component of wind (gust) (m/s) +24 24 v-component of wind (gust) (m/s) +25 25 Vertical speed shear (/s) +26 26 Horizontal momentum flux (N m-2) +27 27 u-component storm motion (m/s) +28 28 v-component storm motion (m/s) +29 29 Drag coefficient (Numeric) +30 30 Frictional velocity (m/s) +31 31 Turbulent diffusion coefficient for momentum (m2/s) +32 32 Eta coordinate vertical velocity (/s) +33 33 Wind fetch (m) +34 34 Normal wind component (m/s) +35 35 Tangential wind component (m/s) +36 36 Amplitude function for Rossby wave envelope for meridional wind (m/s) +37 37 Northward turbulent surface stress (N m-2 s) +38 38 Eastward turbulent surface stress (N m-2 s) +39 39 Eastward wind tendency due to parameterization (m s-2) +40 40 Northward wind tendency due to parameterization (m s-2) +41 41 u-component of geostrophic wind (m s-1) +42 42 v-component of geostrophic wind (m s-1) +43 43 Geostrophic wind direction (degree true) +44 44 Geostrophic wind speed (m s-1) +45 45 Unbalanced component of divergence (s-1) +46 46 Vorticity advection (s-2) +47 47 Surface roughness for heat (m) +48 48 Surface roughness for moisture (m) +49 49 Wind stress (N m-2) +50 50 Eastward wind stress (N m-2) +51 51 Northward wind stress (N m-2) +52 52 u-component of wind stress (N m-2) +53 53 v-component of wind stress (N m-2) +54 54 Natural logarithm of surface roughness length for heat (Numeric) +55 55 Natural logarithm of surface roughness length for moisture (Numeric) +56 56 u-component of neutral wind (m s-1) +57 57 v-component of neutral wind (m s-1) +58 58 Magnitude of turbulent surface stress (N m-2) +59 59 Vertical divergence (s-1) +60 60 Drag thermal coefficient (Numeric) +61 61 Drag evaporation coefficient (Numeric) +62 62 Eastward turbulent surface stress (N m-2) +63 63 Northward turbulent surface stress (N m-2) +64 64 Eastward turbulent surface stress due to orographic form drag (N m-2) +65 65 Northward turbulent surface stress due to orographic form drag (N m-2) +66 66 Eastward turbulent surface stress due to surface roughness (N m-2) +67 67 Northward turbulent surface stress due to surface roughness (N m-2) +# 68-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.20.table b/definitions/grib2/tables/33/4.2.0.20.table new file mode 100644 index 000000000..7855a8618 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.20.table @@ -0,0 +1,69 @@ +# Product discipline 0 - Meteorological products, parameter category 20: atmospheric chemical constituents +0 0 Mass density (concentration) (kg m-3) +1 1 Column-integrated mass density (kg m-2) +2 2 Mass mixing ratio (mass fraction in air) (kg/kg) +3 3 Atmosphere emission mass flux (kg m-2 s-1) +4 4 Atmosphere net production mass flux (kg m-2 s-1) +5 5 Atmosphere net production and emission mass flux (kg m-2 s-1) +6 6 Surface dry deposition mass flux (kg m-2 s-1) +7 7 Surface wet deposition mass flux (kg m-2 s-1) +8 8 Atmosphere re-emission mass flux (kg m-2 s-1) +9 9 Wet deposition by large-scale precipitation mass flux (kg m-2 s-1) +10 10 Wet deposition by convective precipitation mass flux (kg m-2 s-1) +11 11 Sedimentation mass flux (kg m-2 s-1) +12 12 Dry deposition mass flux (kg m-2 s-1) +13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) +14 14 Transfer from SO2 (sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) +15 15 Dry deposition velocity (m/s) +16 16 Mass mixing ratio with respect to dry air (kg/kg) +17 17 Mass mixing ratio with respect to wet air (kg/kg) +18 18 Potential of hydrogen (pH) (pH) +# 19-49 Reserved +50 50 Amount in atmosphere (mol) +51 51 Concentration in air (mol m-3) +52 52 Volume mixing ratio (fraction in air) (mol/mol) +53 53 Chemical gross production rate of concentration (mol m-3 s-1) +54 54 Chemical gross destruction rate of concentration (mol m-3 s-1) +55 55 Surface flux (mol m-2 s-1) +56 56 Changes of amount in atmosphere (mol/s) +57 57 Total yearly average burden of the atmosphere (mol) +58 58 Total yearly averaged atmospheric loss (mol/s) +59 59 Aerosol number concentration (m-3) +60 60 Aerosol specific number concentration (kg-1) +61 61 Maximum of mass density in layer (kg m-3) +62 62 Height of maximum mass density (m) +63 63 Column-averaged mass density in layer (kg m-3) +64 64 Mole fraction with respect to dry air (mol/mol) +65 65 Mole fraction with respect to wet air (mol/mol) +66 66 Column-integrated in-cloud scavenging rate by precipitation (kg m-2 s-1) +67 67 Column-integrated below-cloud scavenging rate by precipitation (kg m-2 s-1) +68 68 Column-integrated release rate from evaporating precipitation (kg m-2 s-1) +69 69 Column-integrated in-cloud scavenging rate by large-scale precipitation (kg m-2 s-1) +70 70 Column-integrated below-cloud scavenging rate by large-scale precipitation (kg m-2 s-1) +71 71 Column-integrated release rate from evaporating large-scale precipitation (kg m-2 s-1) +72 72 Column-integrated in-cloud scavenging rate by convective precipitation (kg m-2 s-1) +73 73 Column-integrated below-cloud scavenging rate by convective precipitation (kg m-2 s-1) +74 74 Column-integrated release rate from evaporating convective precipitation (kg m-2 s-1) +75 75 Wildfire flux (kg m-2 s-1) +76 76 Emission rate (kg kg-1 s-1) +77 77 Surface emission flux (kg m-2 s-1) +78 78 Column integrated eastward mass flux (kg m-1 s-1) +79 79 Column integrated northward mass flux (kg m-1 s-1) +80 80 Column integrated divergence of mass flux (kg m-2 s-1) +81 81 Column integrated net source (kg m-2 s-1) +# 82-99 Reserved +100 100 Surface area density (aerosol) (/m) +101 101 Vertical visual range (m) +102 102 Aerosol optical thickness (Numeric) +103 103 Single scattering albedo (Numeric) +104 104 Asymmetry factor (Numeric) +105 105 Aerosol extinction coefficient (/m) +106 106 Aerosol absorption coefficient (/m) +107 107 Aerosol lidar backscatter from satellite (m-1 sr-1) +108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) +109 109 Aerosol lidar extinction from satellite (/m) +110 110 Aerosol lidar extinction from the ground (/m) +111 111 Angstrom exponent (Numeric) +# 112-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.21.table b/definitions/grib2/tables/33/4.2.0.21.table new file mode 100644 index 000000000..05646e1a6 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.21.table @@ -0,0 +1,27 @@ +# Product discipline 0 - Meteorological products, parameter category 21: thermodynamic properties +0 0 Column integrated potential + internal energy (J m-2) +1 1 Column integrated kinetic energy (J m-2) +2 2 Column integrated total energy (J m-2) +3 3 Column integrated enthalpy (J m-2) +4 4 Column integrated water enthalpy (J m-2) +5 5 Column integrated eastward enthalpy flux (W m-1) +6 6 Column integrated northward enthalpy flux (W m-1) +7 7 Column integrated eastward potential energy flux (W m-1) +8 8 Column integrated northward potential energy flux (W m-1) +9 9 Column integrated eastward kinetic energy flux (W m-1) +10 10 Column integrated northward kinetic energy flux (W m-1) +11 11 Column integrated eastward total energy flux (W m-1) +12 12 Column integrated northward total energy flux (W m-1) +13 13 Divergence of column integrated enthalpy flux (W m-2) +14 14 Divergence of column integrated potential energy flux (W m-2) +15 15 Divergence of column integrated water potential energy flux (W m-2) +16 16 Divergence of column integrated kinetic energy flux (W m-2) +17 17 Divergence of column integrated total energy flux (W m-2) +18 18 Divergence of column integrated water enthalpy flux (W m-2) +19 19 Column integrated eastward heat flux (W m-1) +20 20 Column integrated northward heat flux (W m-1) +21 21 Column integrated potential+internal+latent energy (J m-2) +22 22 Eady growth rate (day-1) +# 23-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.22.table b/definitions/grib2/tables/33/4.2.0.22.table new file mode 100644 index 000000000..726bda9c0 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.22.table @@ -0,0 +1,11 @@ +# Product discipline 0 - Meteorological products, parameter category 22: drought indices +0 0 Standard Precipitation Index (SPI) (dimensionless) +1 1 Standardized Precipitation Evapotranspiration Index (SPEI) (dimensionless) +2 2 Standardized Streamflow index (SSFI) (dimensionless) +3 3 Standardized Reservoir Supply Index (SRSI) (dimensionless) +4 4 Standardized Water-level Index (SWI) (dimensionless) +5 5 Standardized Snowmelt and Rain Index (SMRI) (dimensionless) +6 6 Streamflow Drought Index (SDI) (dimensionless) +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.3.table b/definitions/grib2/tables/33/4.2.0.3.table new file mode 100644 index 000000000..d685de2ef --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.3.table @@ -0,0 +1,51 @@ +# Product discipline 0 - Meteorological products, parameter category 3: mass +0 0 Pressure (Pa) +1 1 Pressure reduced to MSL (Pa) +2 2 Pressure tendency (Pa/s) +3 3 ICAO Standard Atmosphere Reference Height (m) +4 4 Geopotential (m2 s-2) +5 5 Geopotential height (gpm) +6 6 Geometric height (m) +7 7 Standard deviation of height (m) +8 8 Pressure anomaly (Pa) +9 9 Geopotential height anomaly (gpm) +10 10 Density (kg m-3) +11 11 Altimeter setting (Pa) +12 12 Thickness (m) +13 13 Pressure altitude (m) +14 14 Density altitude (m) +15 15 5-wave geopotential height (gpm) +16 16 Zonal flux of gravity wave stress (N m-2) +17 17 Meridional flux of gravity wave stress (N m-2) +18 18 Planetary boundary layer height (m) +19 19 5-wave geopotential height anomaly (gpm) +20 20 Standard deviation of sub-grid scale orography (m) +21 21 Angle of sub-gridscale orography (rad) +22 22 Slope of sub-gridscale orography (Numeric) +23 23 Gravity wave dissipation (W m-2) +24 24 Anisotropy of sub-gridscale orography (Numeric) +25 25 Natural logarithm of pressure in Pa (Numeric) +26 26 Exner pressure (Numeric) +27 27 Updraught mass flux (kg m-2 s-1) +28 28 Downdraught mass flux (kg m-2 s-1) +29 29 Updraught detrainment rate (kg m-3 s-1) +30 30 Downdraught detrainment rate (kg m-3 s-1) +31 31 Unbalanced component of logarithm of surface pressure (-) +32 32 Saturation water vapour pressure (Pa) +33 33 Geometric altitude above mean sea level (m) +34 34 Geometric height above ground level (m) +35 35 Column integrated divergence of total mass flux (kg m-2 s-1) +36 36 Column integrated eastward total mass flux (kg m-1 s-1) +37 37 Column integrated northward total mass flux (kg m-1 s-1) +38 38 Standard deviation of filtered subgrid orography (m) +39 39 Column integrated mass of atmosphere (kg m-2) +40 40 Column integrated eastward geopotential flux (W m-1) +41 41 Column integrated northward geopotential flux (W m-1) +42 42 Column integrated divergence of water geopotential flux (W m-2) +43 43 Column integrated divergence of geopotential flux (W m-2) +44 44 Height of zero-degree wet-bulb temperature (m) +45 45 Height of one-degree wet-bulb temperature (m) +46 46 Pressure departure from hydrostatic state (Pa) +# 47-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.4.table b/definitions/grib2/tables/33/4.2.0.4.table new file mode 100644 index 000000000..88c24ae52 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.4.table @@ -0,0 +1,33 @@ +# Product discipline 0 - Meteorological products, parameter category 4: short-wave radiation +0 0 Net short-wave radiation flux (surface) (W m-2) +1 1 Net short-wave radiation flux (top of atmosphere) (W m-2) +2 2 Short-wave radiation flux (W m-2) +3 3 Global radiation flux (W m-2) +4 4 Brightness temperature (K) +5 5 Radiance (with respect to wave number) (W m-1 sr-1) +6 6 Radiance (with respect to wavelength) (W m-3 sr-1) +7 7 Downward short-wave radiation flux (W m-2) +8 8 Upward short-wave radiation flux (W m-2) +9 9 Net short wave radiation flux (W m-2) +10 10 Photosynthetically active radiation (W m-2) +11 11 Net short-wave radiation flux, clear sky (W m-2) +12 12 Downward UV radiation (W m-2) +13 13 Direct short-wave radiation flux (W m-2) +14 14 Diffuse short-wave radiation flux (W m-2) +15 15 Upward UV radiation emitted/reflected from the Earth's surface (W m-2) +# 16-49 Reserved +50 50 UV index (under clear sky) (Numeric) +51 51 UV index (Numeric) +52 52 Downward short-wave radiation flux, clear sky (W m-2) +53 53 Upward short-wave radiation flux, clear sky (W m-2) +54 54 Direct normal short-wave radiation flux (W m-2) +55 55 UV visible albedo for diffuse radiation (%) +56 56 UV visible albedo for direct radiation (%) +57 57 UV visible albedo for direct radiation, geometric component (%) +58 58 UV visible albedo for direct radiation, isotropic component (%) +59 59 UV visible albedo for direct radiation, volumetric component (%) +60 60 Photosynthetically active radiation flux, clear sky (W m-2) +61 61 Direct short-wave radiation flux, clear sky (W m-2) +# 62-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.5.table b/definitions/grib2/tables/33/4.2.0.5.table new file mode 100644 index 000000000..7065106a2 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.5.table @@ -0,0 +1,18 @@ +# Product discipline 0 - Meteorological products, parameter category 5: long-wave radiation +0 0 Net long-wave radiation flux (surface) (W m-2) +1 1 Net long-wave radiation flux (top of atmosphere) (W m-2) +2 2 Long-wave radiation flux (W m-2) +3 3 Downward long-wave radiation flux (W m-2) +4 4 Upward long-wave radiation flux (W m-2) +5 5 Net long-wave radiation flux (W m-2) +6 6 Net long-wave radiation flux, clear sky (W m-2) +7 7 Brightness temperature (K) +8 8 Downward long-wave radiation flux, clear sky (W m-2) +9 9 Near IR albedo for diffuse radiation (%) +10 10 Near IR albedo for direct radiation (%) +11 11 Near IR albedo for direct radiation, geometric component (%) +12 12 Near IR albedo for direct radiation, isotropic component (%) +13 13 Near IR albedo for direct radiation, volumetric component (%) +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.6.table b/definitions/grib2/tables/33/4.2.0.6.table new file mode 100644 index 000000000..d831f3474 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.6.table @@ -0,0 +1,51 @@ +# Product discipline 0 - Meteorological products, parameter category 6: cloud +0 0 Cloud ice (kg m-2) +1 1 Total cloud cover (%) +2 2 Convective cloud cover (%) +3 3 Low cloud cover (%) +4 4 Medium cloud cover (%) +5 5 High cloud cover (%) +6 6 Cloud water (kg m-2) +7 7 Cloud amount (%) +8 8 Cloud type (Code table 4.203) +9 9 Thunderstorm maximum tops (m) +10 10 Thunderstorm coverage (Code table 4.204) +11 11 Cloud base (m) +12 12 Cloud top (m) +13 13 Ceiling (m) +14 14 Non-convective cloud cover (%) +15 15 Cloud work function (J/kg) +16 16 Convective cloud efficiency (Proportion) +17 17 Total condensate (kg/kg) +18 18 Total column-integrated cloud water (kg m-2) +19 19 Total column-integrated cloud ice (kg m-2) +20 20 Total column-integrated condensate (kg m-2) +21 21 Ice fraction of total condensate (Proportion) +22 22 Cloud cover (%) +23 23 Cloud ice mixing ratio (kg/kg) +24 24 Sunshine (Numeric) +25 25 Horizontal extent of cumulonimbus (CB) (%) +26 26 Height of convective cloud base (m) +27 27 Height of convective cloud top (m) +28 28 Number of cloud droplets per unit mass of air (/kg) +29 29 Number of cloud ice particles per unit mass of air (/kg) +30 30 Number density of cloud droplets (m-3) +31 31 Number density of cloud ice particles (m-3) +32 32 Fraction of cloud cover (Numeric) +33 33 Sunshine duration (s) +34 34 Surface long-wave effective total cloudiness (Numeric) +35 35 Surface short-wave effective total cloudiness (Numeric) +36 36 Fraction of stratiform precipitation cover (Proportion) +37 37 Fraction of convective precipitation cover (Proportion) +38 38 Mass density of cloud droplets (kg m-3) +39 39 Mass density of cloud ice (kg m-3) +40 40 Mass density of convective cloud water droplets (kg m-3) +# 41-46 Reserved +47 47 Volume fraction of cloud water droplets (Numeric) +48 48 Volume fraction of cloud ice particles (Numeric) +49 49 Volume fraction of cloud (ice and/or water) (Numeric) +50 50 Fog (%) +51 51 Sunshine duration fraction (Proportion) +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.0.7.table b/definitions/grib2/tables/33/4.2.0.7.table new file mode 100644 index 000000000..15acb1857 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.0.7.table @@ -0,0 +1,25 @@ +# Product discipline 0 - Meteorological products, parameter category 7: thermodynamic stability indices +0 0 Parcel lifted index (to 500 hPa) (K) +1 1 Best lifted index (to 500 hPa) (K) +2 2 K index (K) +3 3 KO index (K) +4 4 Total totals index (K) +5 5 Sweat index (Numeric) +6 6 Convective available potential energy (J/kg) +7 7 Convective inhibition (J/kg) +8 8 Storm relative helicity (J/kg) +9 9 Energy helicity index (Numeric) +10 10 Surface lifted index (K) +11 11 Best (4-layer) lifted index (K) +12 12 Richardson number (Numeric) +13 13 Showalter index (K) +14 14 Reserved +15 15 Updraught helicity (m2 s-2) +16 16 Bulk Richardson number (Numeric) +17 17 Gradient Richardson number (Numeric) +18 18 Flux Richardson number (Numeric) +19 19 Convective available potential energy - shear (m2 s-2) +20 20 Thunderstorm intensity index (Code table 4.246) +# 21-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.1.0.table b/definitions/grib2/tables/33/4.2.1.0.table new file mode 100644 index 000000000..7072b3d44 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.1.0.table @@ -0,0 +1,25 @@ +# Product discipline 1 - Hydrological products, parameter category 0: hydrology basic products +0 0 Flash flood guidance (Encoded as an accumulation over a floating subinterval of time between the reference time and valid time) (kg m-2) +1 1 Flash flood runoff (Encoded as an accumulation over a floating subinterval of time) (kg m-2) +2 2 Remotely-sensed snow cover (Code table 4.215) +3 3 Elevation of snow-covered terrain (Code table 4.216) +4 4 Snow water equivalent per cent of normal (%) +5 5 Baseflow-groundwater runoff (kg m-2) +6 6 Storm surface runoff (kg m-2) +7 7 Discharge from rivers or streams (m3/s) +8 8 Groundwater upper storage (kg m-2) +9 9 Groundwater lower storage (kg m-2) +10 10 Side flow into river channel (m3 s-1 m-1) +11 11 River storage of water (m3) +12 12 Floodplain storage of water (m3) +13 13 Water on soil surface (kg m-2) +14 14 Upstream accumulated precipitation (kg m-2) +15 15 Upstream accumulated snow melt (kg m-2) +16 16 Percolation rate (kg m-2 s-1) +17 17 River outflow of water (m3 s-1) +18 18 Floodplain outflow of water (m3 s-1) +19 19 Floodpath outflow of water (m3 s-1) +20 20 Water on surface (kg m-2) +# 21-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.1.1.table b/definitions/grib2/tables/33/4.2.1.1.table new file mode 100644 index 000000000..e3931d5e6 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.1.1.table @@ -0,0 +1,7 @@ +# Product discipline 1 - Hydrological products, parameter category 1: hydrology probabilities +0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) +1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) +2 2 Probability of 0.01 inch of precipitation (POP) (%) +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.1.2.table b/definitions/grib2/tables/33/4.2.1.2.table new file mode 100644 index 000000000..2c4e0f50d --- /dev/null +++ b/definitions/grib2/tables/33/4.2.1.2.table @@ -0,0 +1,28 @@ +# Product discipline 1 - Hydrological products, parameter category 2: inland water and sediment properties +0 0 Water depth (m) +1 1 Water temperature (K) +2 2 Water fraction (Proportion) +3 3 Sediment thickness (m) +4 4 Sediment temperature (K) +5 5 Ice thickness (m) +6 6 Ice temperature (K) +7 7 Ice cover (Proportion) +8 8 Land cover (0 = water, 1 = land) (Proportion) +9 9 Shape factor with respect to salinity profile (-) +10 10 Shape factor with respect to temperature profile in thermocline (-) +11 11 Attenuation coefficient of water with respect to solar radiation (m) +12 12 Salinity (kg/kg) +13 13 Cross-sectional area of flow in channel (m2) +14 14 Snow temperature (K) +15 15 Lake depth (m) +16 16 River depth (m) +17 17 Floodplain depth (m) +18 18 Floodplain flooded fraction (proportion) +19 19 FLoodplain flooded area (m2) +20 20 River fraction (proportion) +21 21 River area (m2) +22 22 Fraction of river coverage plus river related flooding (proportion) +23 23 Area of river coverage plus river related flooding (m2) +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.10.0.table b/definitions/grib2/tables/33/4.2.10.0.table new file mode 100644 index 000000000..92b18661a --- /dev/null +++ b/definitions/grib2/tables/33/4.2.10.0.table @@ -0,0 +1,103 @@ +# Product discipline 10 - Oceanographic products, parameter category 0: waves +0 0 Wave spectra (1) (-) +1 1 Wave spectra (2) (-) +2 2 Wave spectra (3) (-) +3 3 Significant height of combined wind waves and swell (m) +4 4 Direction of wind waves (degree true) +5 5 Significant height of wind waves (m) +6 6 Mean period of wind waves (s) +7 7 Direction of swell waves (degree true) +8 8 Significant height of swell waves (m) +9 9 Mean period of swell waves (s) +10 10 Primary wave direction (degree true) +11 11 Primary wave mean period (s) +12 12 Secondary wave direction (degree true) +13 13 Secondary wave mean period (s) +14 14 Mean direction of combined wind waves and swell (degree true) +15 15 Mean period of combined wind waves and swell (s) +16 16 Coefficient of drag with waves (-) +17 17 Friction velocity (m/s) +18 18 Wave stress (N m-2) +19 19 Normalized wave stress (-) +20 20 Mean square slope of waves (-) +21 21 u-component surface Stokes drift (m/s) +22 22 v-component surface Stokes drift (m/s) +23 23 Period of maximum individual wave height (s) +24 24 Maximum individual wave height (m) +25 25 Inverse mean wave frequency (s) +26 26 Inverse mean frequency of wind waves (s) +27 27 Inverse mean frequency of total swell (s) +28 28 Mean zero-crossing wave period (s) +29 29 Mean zero-crossing period of wind waves (s) +30 30 Mean zero-crossing period of total swell (s) +31 31 Wave directional width (-) +32 32 Directional width of wind waves (-) +33 33 Directional width of total swell (-) +34 34 Peak wave period (s) +35 35 Peak period of wind waves (s) +36 36 Peak period of total swell (s) +37 37 Altimeter wave height (m) +38 38 Altimeter corrected wave height (m) +39 39 Altimeter range relative correction (-) +40 40 10-metre neutral wind speed over waves (m/s) +41 41 10-metre wind direction over waves (deg) +42 42 Wave energy spectrum (m2 s rad-1) +43 43 Kurtosis of the sea-surface elevation due to waves (-) +44 44 Benjamin-Feir index (-) +45 45 Spectral peakedness factor (/s) +46 46 Peak wave direction (deg) +47 47 Significant wave height of first swell partition (m) +48 48 Significant wave height of second swell partition (m) +49 49 Significant wave height of third swell partition (m) +50 50 Mean wave period of first swell partition (s) +51 51 Mean wave period of second swell partition (s) +52 52 Mean wave period of third swell partition (s) +53 53 Mean wave direction of first swell partition (deg) +54 54 Mean wave direction of second swell partition (deg) +55 55 Mean wave direction of third swell partition (deg) +56 56 Wave directional width of first swell partition (-) +57 57 Wave directional width of second swell partition (-) +58 58 Wave directional width of third swell partition (-) +59 59 Wave frequency width of first swell partition (-) +60 60 Wave frequency width of second swell partition (-) +61 61 Wave frequency width of third swell partition (-) +62 62 Wave frequency width (-) +63 63 Frequency width of wind waves (-) +64 64 Frequency width of total swell (-) +65 65 Peak wave period of first swell partition (s) +66 66 Peak wave period of second swell partition (s) +67 67 Peak wave period of third swell partition (s) +68 68 Peak wave direction of first swell partition (degree true) +69 69 Peak wave direction of second swell partition (degree true) +70 70 Peak wave direction of third swell partition (degree true) +71 71 Peak direction of wind waves (degree true) +72 72 Peak direction of total swell (degree true) +73 73 Whitecap fraction (fraction) +74 74 Mean direction of total swell (degree) +75 75 Mean direction of wind waves (degree) +76 76 Charnock (Numeric) +77 77 Wave Spectral Skewness (Numeric) +78 78 Wave energy flux magnitude (W m-1) +79 79 Wave energy flux mean direction (degree true) +80 80 Ratio of wave angular and frequency width (Numeric) +81 81 Free convective velocity over the oceans (m s-1) +82 82 Air density over the oceans (kg m-3) +83 83 Normalized energy flux into waves (Numeric) +84 84 Normalized stress into ocean (Numeric) +85 85 Normalized energy flux into ocean (Numeric) +86 86 Surface elevation variance due to waves (over all frequencies and directions) (m2 s rad-1) +87 87 Wave induced mean sea level correction (m) +88 88 Spectral width index (Numeric) +89 89 Number of events in freak waves statistics (Numeric) +90 90 u-component of surface momentum flux into ocean (N m-2) +91 91 v-component of surface momentum flux into ocean (N m-2) +92 92 Wave turbulent energy flux into ocean (W m-2) +93 93 Envelop maximum individual wave height (m) +94 94 Time domain maximum individual crest height (m) +95 95 Time domain maximum individual wave height (m) +96 96 Space time maximum individual crest height (m) +97 97 Space time maximum individual wave height (m) +98 98 Goda peakedness factor (Numeric) +# 99-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.10.1.table b/definitions/grib2/tables/33/4.2.10.1.table new file mode 100644 index 000000000..aeec67455 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.10.1.table @@ -0,0 +1,11 @@ +# Product discipline 10 - Oceanographic products, parameter category 1: currents +0 0 Current direction (degree true) +1 1 Current speed (m/s) +2 2 u-component of current (m/s) +3 3 v-component of current (m/s) +4 4 Rip current occurrence probability (%) +5 5 Eastward current (m s-1) +6 6 Northward current (m s-1) +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.10.191.table b/definitions/grib2/tables/33/4.2.10.191.table new file mode 100644 index 000000000..cd4d4cde7 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.10.191.table @@ -0,0 +1,9 @@ +# Product discipline 10 - Oceanographic products, parameter category 191: miscellaneous +0 0 Seconds prior to initial reference time (defined in Section 1) (s) +1 1 Meridional overturning stream function (m3/s) +2 2 Reserved +3 3 Days since last observation (d) +4 4 Barotropic stream function (m3 s-1) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.10.2.table b/definitions/grib2/tables/33/4.2.10.2.table new file mode 100644 index 000000000..0f27bd249 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.10.2.table @@ -0,0 +1,34 @@ +# Product discipline 10 - Oceanographic products, parameter category 2: ice +0 0 Ice cover (Proportion) +1 1 Ice thickness (m) +2 2 Direction of ice drift (degree true) +3 3 Speed of ice drift (m/s) +4 4 u-component of ice drift (m/s) +5 5 v-component of ice drift (m/s) +6 6 Ice growth rate (m/s) +7 7 Ice divergence (/s) +8 8 Ice temperature (K) +9 9 Module of ice internal pressure (Pa m) +10 10 Zonal vector component of vertically integrated ice internal pressure (Pa m) +11 11 Meridional vector component of vertically integrated ice internal pressure (Pa m) +12 12 Compressive ice strength (N/m) +13 13 Snow temperature (over sea ice) (K) +14 14 Albedo (Numeric) +15 15 Sea ice volume per unit area (m3 m-2) +16 16 Snow volume over sea ice per unit area (m3 m-2) +17 17 Sea ice heat content (J m-2) +18 18 Snow over sea ice heat content (J m-2) +19 19 Ice freeboard thickness (m) +20 20 Ice melt pond fraction (fraction) +21 21 Ice melt pond depth (m) +22 22 Ice melt pond volume per unit area (m3 m-2) +23 23 Sea ice fraction tendency due to parameterization (s-1) +24 24 x-component of ice drift (m s-1) +25 25 y-component of ice drift (m s-1) +26 26 Sea ice salinity (g kg-1) +27 27 Freezing/melting potential (W m-2) +28 28 Melt onset date (Numeric) +29 29 Freeze onset date (Numeric) +# 30-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.10.3.table b/definitions/grib2/tables/33/4.2.10.3.table new file mode 100644 index 000000000..6c4277c8e --- /dev/null +++ b/definitions/grib2/tables/33/4.2.10.3.table @@ -0,0 +1,26 @@ +# Product discipline 10 - Oceanographic products, parameter category 3: surface properties +0 0 Water temperature (K) +1 1 Deviation of sea level from mean (m) +2 2 Heat exchange coefficient (-) +3 3 Practical salinity (Numeric) +4 4 Downward heat flux (W m-2) +5 5 Eastward surface stress (N m-2) +6 6 Northward surface stress (N m-2) +7 7 x-component surface stress (N m-2) +8 8 y-component surface stress (N m-2) +9 9 Thermosteric change in sea surface height (m) +10 10 Halosteric change in sea surface height (m) +11 11 Steric change in sea surface height (m) +12 12 Sea salt flux (kg m-2 s-1) +13 13 Net upward water flux (kg m-2 s-1) +14 14 Eastward surface water velocity (m s-1) +15 15 Northward surface water velocity (m s-1) +16 16 x-component of surface water velocity (m s-1) +17 17 y-component of surface water velocity (m s-1) +18 18 Heat flux correction (W m-2) +19 19 Sea surface height tendency due to parameterization (m s-1) +20 20 Deviation of sea level from mean with inverse barometer correction (m) +21 21 Salinity (kg kg-1) +# 22-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.10.4.table b/definitions/grib2/tables/33/4.2.10.4.table new file mode 100644 index 000000000..0b9ef0956 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.10.4.table @@ -0,0 +1,54 @@ +# Product discipline 10 - Oceanographic products, parameter category 4: subsurface properties +0 0 Main thermocline depth (m) +1 1 Main thermocline anomaly (m) +2 2 Transient thermocline depth (m) +3 3 Salinity (kg/kg) +4 4 Ocean vertical heat diffusivity (m2/s) +5 5 Ocean vertical salt diffusivity (m2/s) +6 6 Ocean vertical momentum diffusivity (m2/s) +7 7 Bathymetry (m) +# 8-10 Reserved +11 11 Shape factor with respect to salinity profile (-) +12 12 Shape factor with respect to temperature profile in thermocline (-) +13 13 Attenuation coefficient of water with respect to solar radiation (/m) +14 14 Water depth (m) +15 15 Water temperature (K) +16 16 Water density (rho) (kg m-3) +17 17 Water density anomaly (sigma) (kg m-3) +18 18 Water potential temperature (theta) (K) +19 19 Water potential density (rho theta) (kg m-3) +20 20 Water potential density anomaly (sigma theta) (kg m-3) +21 21 Practical salinity (Numeric) +22 22 Water column-integrated heat content (J m-2) +23 23 Eastward water velocity (m s-1) +24 24 Northward water velocity (m s-1) +25 25 x-component water velocity (m s-1) +26 26 y-component water velocity (m s-1) +27 27 Upward water velocity (m s-1) +28 28 Vertical eddy diffusivity (m2 s-1) +29 29 Bottom pressure equivalent height (m) +30 30 Fresh water flux into sea water from rivers (kg m-2 s-1) +31 31 Fresh water flux correction (kg m-2 s-1) +32 32 Virtual salt flux into sea water (g kg-1 m-2 s-1) +33 33 Virtual salt flux correction (g kg-1 m-2 s-1) +34 34 Sea water temperature tendency due to Newtonian relaxation (K s-1) +35 35 Sea water salinity tendency due to Newtonian relaxation (g kg-1 s-1) +36 36 Sea water temperature tendency due to parameterization (K s-1) +37 37 Sea water salinity tendency due to parameterization (g kg-1 s-1) +38 38 Eastward sea water velocity tendency due to parameterization (m s-2) +39 39 Northward sea water velocity tendency due to parameterization (m s-2) +40 40 Sea water temperature tendency due to direct bias correction (K s-1) +41 41 Sea water salinity tendency due to direct bias correction (g kg-1 s-1) +42 42 Sea water meridional volume transport (m3 m-2 s-1) +43 43 Sea water zonal volume transport (m3 m-2 s-1) +44 44 Sea water column integrated meridional volume transport (m3 m-1 s-1) +45 45 Sea water column integrated zonal volume transport (m3 m-1 s-1) +46 46 Sea water meridional mass transport (kg m-2 s-1) +47 47 Sea water zonal mass transport (kg m-2 s-1) +48 48 Sea water column integrated meridional mass transport (kg m-1 s-1) +49 49 Sea water column integrated zonal mass transport (kg m-1 s-1) +50 50 Sea water column integrated practical salinity (g kg-1 m) +51 51 Sea water column integrated salinity (kg kg-1 m) +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.2.0.table b/definitions/grib2/tables/33/4.2.2.0.table new file mode 100644 index 000000000..8daeafd85 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.2.0.table @@ -0,0 +1,68 @@ +# Product discipline 2 - Land surface products, parameter category 0: vegetation/biomass +0 0 Land cover (0 = sea, 1 = land) (Proportion) +1 1 Surface roughness (m) +2 2 Soil temperature (K) +3 3 Soil moisture content (kg m-2) +4 4 Vegetation (%) +5 5 Water runoff (kg m-2) +6 6 Evapotranspiration (kg-2 s-1) +7 7 Model terrain height (m) +8 8 Land use (Code table 4.212) +9 9 Volumetric soil moisture content (Proportion) +10 10 Ground heat flux (W m-2) +11 11 Moisture availability (%) +12 12 Exchange coefficient (kg m-2 s-1) +13 13 Plant canopy surface water (kg m-2) +14 14 Blackadar's mixing length scale (m) +15 15 Canopy conductance (m/s) +16 16 Minimal stomatal resistance (s/m) +17 17 Wilting point (Proportion) +18 18 Solar parameter in canopy conductance (Proportion) +19 19 Temperature parameter in canopy (Proportion) +20 20 Humidity parameter in canopy conductance (Proportion) +21 21 Soil moisture parameter in canopy conductance (Proportion) +22 22 Soil moisture (kg m-3) +23 23 Column-integrated soil water (kg m-2) +24 24 Heat flux (W m-2) +25 25 Volumetric soil moisture (m3 m-3) +26 26 Wilting point (kg m-3) +27 27 Volumetric wilting point (m3 m-3) +28 28 Leaf area index (Numeric) +29 29 Evergreen forest cover (Proportion) +30 30 Deciduous forest cover (Proportion) +31 31 Normalized differential vegetation index (NDVI) (Numeric) +32 32 Root depth of vegetation (m) +33 33 Water runoff and drainage (kg m-2) +34 34 Surface water runoff (kg m-2) +35 35 Tile class (Code table 4.243) +36 36 Tile fraction (Proportion) +37 37 Tile percentage (%) +38 38 Soil volumetric ice content (water equivalent) (m3 m-3) +39 39 Evapotranspiration rate (kg m-2 s-1) +40 40 Potential evapotranspiration rate (kg m-2 s-1) +41 41 Snow melt rate (kg m-2 s-1) +42 42 Water runoff and drainage rate (kg m-2 s-1) +43 43 Drainage direction (Code table 4.250) +44 44 Upstream area (m2) +45 45 Wetland cover (Proportion) +46 46 Wetland type (Code table 4.239) +47 47 Irrigation cover (Proportion) +48 48 C4 crop cover (Proportion) +49 49 C4 grass cover (Proportion) +50 50 Skin reservoir content (kg m-2) +51 51 Surface runoff rate (kg m-2 s-1) +52 52 Subsurface runoff rate (kg m-2 s-1) +53 53 Low-vegetation cover (Proportion) +54 54 High-vegetation cover (Proportion) +55 55 Leaf area index, low-vegetation (m2 m-2) +56 56 Leaf area index, high-vegetation (m2 m-2) +57 57 Type of low-vegetation (Code table 4.234) +58 58 Type of high-vegetation (Code table 4.234) +59 59 Net ecosystem exchange flux (kg m-2 s-1) +60 60 Gross primary production flux (kg m-2 s-1) +61 61 Ecosystem respiration flux (kg m-2 s-1) +62 62 Emissivity (Proportion) +63 63 Canopy air temperature (K) +# 64-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.2.3.table b/definitions/grib2/tables/33/4.2.2.3.table new file mode 100644 index 000000000..ad6b618f2 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.2.3.table @@ -0,0 +1,35 @@ +# Product discipline 2 - Land surface products, parameter category 3: soil products +0 0 Soil type (Code table 4.213) +1 1 Upper layer soil temperature (K) +2 2 Upper layer soil moisture (kg m-3) +3 3 Lower layer soil moisture (kg m-3) +4 4 Bottom layer soil temperature (K) +5 5 Liquid volumetric soil moisture (non-frozen) (Proportion) +6 6 Number of soil layers in root zone (Numeric) +7 7 Transpiration stress-onset (soil moisture) (Proportion) +8 8 Direct evaporation cease (soil moisture) (Proportion) +9 9 Soil porosity (Proportion) +10 10 Liquid volumetric soil moisture (non-frozen) (m3 m-3) +11 11 Volumetric transpiration stress-onset (soil moisture) (m3 m-3) +12 12 Transpiration stress-onset (soil moisture) (kg m-3) +13 13 Volumetric direct evaporation cease (soil moisture) (m3 m-3) +14 14 Direct evaporation cease (soil moisture) (kg m-3) +15 15 Soil porosity (m3 m-3) +16 16 Volumetric saturation of soil moisture (m3 m-3) +17 17 Saturation of soil moisture (kg m-3) +18 18 Soil temperature (K) +19 19 Soil moisture (kg m-3) +20 20 Column-integrated soil moisture (kg m-2) +21 21 Soil ice (kg m-3) +22 22 Column-integrated soil ice (kg m-2) +23 23 Liquid water in snow pack (kg m-2) +24 24 Frost index (K day-1) +25 25 Snow depth at elevation bands (kg m-2) +26 26 Soil heat flux (W m-2) +27 27 Soil depth (m) +28 28 Snow temperature (K) +29 29 Ice temperature (K) +30 30 Soil wetness index (Numeric) +# 31-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.2.4.table b/definitions/grib2/tables/33/4.2.2.4.table new file mode 100644 index 000000000..0ea44a18c --- /dev/null +++ b/definitions/grib2/tables/33/4.2.2.4.table @@ -0,0 +1,41 @@ +# Product discipline 2 - Land surface products, parameter category 4: fire weather products +0 0 Fire outlook (Code table 4.224) +1 1 Fire outlook due to dry thunderstorm (Code table 4.224) +2 2 Haines index (Numeric) +3 3 Fire burned area (%) +4 4 Fosberg index (Numeric) +5 5 Forest Fire Weather Index (as defined by the Canadian Forest Service) (Numeric) +6 6 Fine Fuel Moisture Code (as defined by the Canadian Forest Service) (Numeric) +7 7 Duff Moisture Code (as defined by the Canadian Forest Service) (Numeric) +8 8 Drought Code (as defined by the Canadian Forest Service) (Numeric) +9 9 Initial Fire Spread Index (as defined by the Canadian Forest Service) (Numeric) +10 10 Fire Buildup Index (as defined by the Canadian Forest Service) (Numeric) +11 11 Fire Daily Severity Rating (as defined by the Canadian Forest Service) (Numeric) +12 12 Keetch-Byram drought index (Numeric) +13 13 Drought factor (as defined by the Australian forest service ) (Numeric) +14 14 Rate of spread (as defined by the Australian forest service ) (m/s) +15 15 Fire danger index (as defined by the Australian forest service ) (Numeric) +16 16 Spread component (as defined by the US Forest Service National Fire Danger Rating System) (Numeric) +17 17 Burning index (as defined by the US Forest Service National Fire Danger Rating System) (Numeric) +18 18 Ignition component (as defined by the US Forest Service National Fire Danger Rating System) (%) +19 19 Energy release component (as defined by the US Forest Service National Fire Danger Rating System) (Joule/m2) +20 20 Burning area (%) +21 21 Burnable area (%) +22 22 Unburnable area (%) +23 23 Fuel load (kg m-2) +24 24 Combustion completeness (%) +25 25 Fuel moisture content (kg kg-1) +26 26 Wildfire potential (as defined by the US NOAA Global Systems Laboratory) (Numeric) +27 27 Live leaf fuel load (kg m-2) +28 28 Live wood fuel load (kg m-2) +29 29 Dead leaf fuel load (kg m-2) +30 30 Dead wood fuel load (kg m-2) +31 31 Live fuel moisture content (kg kg-1) +32 32 Fine dead leaf moisture content (kg kg-1) +33 33 Dense dead leaf moisture content (kg kg-1) +34 34 Fine dead wood moisture content (kg kg-1) +35 35 Dense dead wood moisture content (kg kg-1) +36 36 Fire radiative power (W) +# 37-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.2.5.table b/definitions/grib2/tables/33/4.2.2.5.table new file mode 100644 index 000000000..1d08dd573 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.2.5.table @@ -0,0 +1,6 @@ +# Product discipline 2 - Land surface products, parameter category 5: glaciers and inland ice +0 0 Glacier cover (Proportion) +1 1 Glacier temperature (K) +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.2.6.table b/definitions/grib2/tables/33/4.2.2.6.table new file mode 100644 index 000000000..7a7712af0 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.2.6.table @@ -0,0 +1,13 @@ +# Product discipline 2 - Land surface products, parameter category 6: urban areas +0 0 Urban cover (Proportion) +1 1 Road cover (Proportion) +2 2 Building cover (Proportion) +3 3 Building height (m) +4 4 Vertical-to-horizontal area fraction (m2 m-2) +5 5 Standard deviation of building height (m) +6 6 Distance downward from roof surface (m) +7 7 Distance inward from outer wall surface (m) +8 8 Distance downward from road surface (m) +# 9-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.20.0.table b/definitions/grib2/tables/33/4.2.20.0.table new file mode 100644 index 000000000..a997371d9 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.20.0.table @@ -0,0 +1,13 @@ +# Product discipline 20 - Health and socioeconomic impacts, parameter category 0: health indicators +0 0 Universal thermal climate index (K) +1 1 Mean radiant temperature (K) +2 2 Wet-bulb globe temperature (K) +3 3 Globe temperature (K) +4 4 Humidex (K) +5 5 Effective temperature (K) +6 6 Normal effective temperature (K) +7 7 Standard effective temperature (K) +8 8 Physiological equivalent temperature (K) +# 9-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.20.1.table b/definitions/grib2/tables/33/4.2.20.1.table new file mode 100644 index 000000000..0712cd8d1 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.20.1.table @@ -0,0 +1,14 @@ +# Product discipline 20 - Health and socioeconomic impacts, parameter category 1: epidemiology +0 0 Malaria cases (Fraction) +1 1 Malaria circumsporozoite protein rate (Fraction) +2 2 Plasmodium falciparum entomological inoculation rate (Bites per day per person) +3 3 Human bite rate by anopheles vectors (Bites per day per person) +4 4 Malaria immunity (Fraction) +5 5 Falciparum parasite rates (Fraction) +6 6 Detectable falciparum parasite ratio (after day 10) (Fraction) +7 7 Anopheles vector to host ratio (Fraction) +8 8 Anopheles vector number (Number m-2) +9 9 Fraction of malarial vector reproductive habitat (Fraction) +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.20.2.table b/definitions/grib2/tables/33/4.2.20.2.table new file mode 100644 index 000000000..d6b9083d1 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.20.2.table @@ -0,0 +1,5 @@ +# Product discipline 20 - Health and socioeconomic impacts, parameter category 2: socioeconomic indicators +0 0 Population density (Person m-2) +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.20.3.table b/definitions/grib2/tables/33/4.2.20.3.table new file mode 100644 index 000000000..9c2f80cfa --- /dev/null +++ b/definitions/grib2/tables/33/4.2.20.3.table @@ -0,0 +1,14 @@ +# Product discipline 20 - Health and socioeconomic impacts, parameter category 3: renewable energy sector +0 0 Renewable power capacity (W) +1 1 Renewable power production rate (W) +2 2 Wind power capacity (W) +3 3 Wind power production rate (W) +4 4 Solar photovoltaic (PV) power capacity (W) +5 5 Solar photovoltaic (PV) power production rate (W) +6 6 Solar non-photovoltaic (PV) power capacity (W) +7 7 Solar non-photovoltaic (PV) power production rate (W) +8 8 Concentrated solar power (CSP) power capacity (W) +9 9 Concentrated solar power (CSP) power production rate (W) +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.3.0.table b/definitions/grib2/tables/33/4.2.3.0.table new file mode 100644 index 000000000..0bec15119 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.3.0.table @@ -0,0 +1,14 @@ +# Product discipline 3 - Space products, parameter category 0: image format products +0 0 Scaled radiance (Numeric) +1 1 Scaled albedo (Numeric) +2 2 Scaled brightness temperature (Numeric) +3 3 Scaled precipitable water (Numeric) +4 4 Scaled lifted index (Numeric) +5 5 Scaled cloud top pressure (Numeric) +6 6 Scaled skin temperature (Numeric) +7 7 Cloud mask (Code table 4.217) +8 8 Pixel scene type (Code table 4.218) +9 9 Fire detection indicator (Code table 4.223) +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.3.1.table b/definitions/grib2/tables/33/4.2.3.1.table new file mode 100644 index 000000000..2aec33b42 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.3.1.table @@ -0,0 +1,38 @@ +# Product discipline 3 - Space products, parameter category 1: quantitative products +0 0 Estimated precipitation (kg m-2) +1 1 Instantaneous rain rate (kg m-2 s-1) +2 2 Cloud top height (m) +3 3 Cloud top height quality indicator (Code table 4.219) +4 4 Estimated u-component of wind (m/s) +5 5 Estimated v-component of wind (m/s) +6 6 Number of pixel used (Numeric) +7 7 Solar zenith angle (deg) +8 8 Relative azimuth angle (deg) +9 9 Reflectance in 0.6 micron channel (%) +10 10 Reflectance in 0.8 micron channel (%) +11 11 Reflectance in 1.6 micron channel (%) +12 12 Reflectance in 3.9 micron channel (%) +13 13 Atmospheric divergence (/s) +14 14 Cloudy brightness temperature (K) +15 15 Clear-sky brightness temperature (K) +16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) +17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) +18 18 Reserved +19 19 Wind speed (m/s) +20 20 Aerosol optical thickness at 0.635 um +21 21 Aerosol optical thickness at 0.810 um +22 22 Aerosol optical thickness at 1.640 um +23 23 Angstrom coefficient +# 24-26 Reserved +27 27 Bidirectional reflectance factor (Numeric) +28 28 Brightness temperature (K) +29 29 Scaled radiance (Numeric) +30 30 Reflectance in 0.4 micron channel (%) +31 31 Cloudy reflectance (%) +32 32 Clear reflectance (%) +# 33-97 Reserved +98 98 Correlation coefficient between MPE rain-rates for the co-located IR data and the microwave data rain-rates (Numeric) +99 99 Standard deviation between MPE rain-rates for the co-located IR data and the microwave data rain-rates (kg m-2 s-1) +# 100-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.3.2.table b/definitions/grib2/tables/33/4.2.3.2.table new file mode 100644 index 000000000..a97ce4942 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.3.2.table @@ -0,0 +1,24 @@ +# Product discipline 3 - Space products, parameter category 2: cloud properties +0 0 Clear sky probability (%) +1 1 Cloud top temperature (K) +2 2 Cloud top pressure (Pa) +3 3 Cloud type (Code table 4.218) +4 4 Cloud phase (Code table 4.218) +5 5 Cloud optical depth (Numeric) +6 6 Cloud particle effective radius (m) +7 7 Cloud liquid water path (kg m-2) +8 8 Cloud ice water path (kg m-2) +9 9 Cloud albedo (Numeric) +10 10 Cloud emissivity (Numeric) +11 11 Effective absorption optical depth ratio (Numeric) +30 30 Measurement cost (Numeric) +31 31 Upper layer cloud optical depth (Numeric) +32 32 Upper layer cloud top pressure (Pa) +33 33 Upper layer cloud effective radius (m) +34 34 Error in upper layer cloud optical depth (Numeric) +35 35 Error in upper layer cloud top pressure (Pa) +36 36 Error in upper layer cloud effective radius (m) +37 37 Lower layer cloud optical depth (Numeric) +38 38 Lower layer cloud top pressure (Pa) +39 39 Error in lower layer cloud optical depth (Numeric) +40 40 Error in lower layer cloud top pressure (Pa) diff --git a/definitions/grib2/tables/33/4.2.3.3.table b/definitions/grib2/tables/33/4.2.3.3.table new file mode 100644 index 000000000..c487a578e --- /dev/null +++ b/definitions/grib2/tables/33/4.2.3.3.table @@ -0,0 +1,4 @@ +# Product discipline 3 - Space products, parameter category 3: flight rule conditions +0 0 Probability of encountering marginal visual flight rule conditions (%) +1 1 Probability of encountering low instrument flight rule conditions (%) +2 2 Probability of encountering instrument flight rule conditions (%) diff --git a/definitions/grib2/tables/33/4.2.3.4.table b/definitions/grib2/tables/33/4.2.3.4.table new file mode 100644 index 000000000..7f832ff3c --- /dev/null +++ b/definitions/grib2/tables/33/4.2.3.4.table @@ -0,0 +1,10 @@ +# Product discipline 3 - Space products, parameter category 4: volcanic ash +0 0 Volcanic ash probability (%) +1 1 Volcanic ash cloud top temperature (K) +2 2 Volcanic ash cloud top pressure (Pa) +3 3 Volcanic ash cloud top height (m) +4 4 Volcanic ash cloud emissivity (Numeric) +5 5 Volcanic ash effective absorption optical depth ratio (Numeric) +6 6 Volcanic ash cloud optical depth (Numeric) +7 7 Volcanic ash column density (kg m-2) +8 8 Volcanic ash particle effective radius (m) diff --git a/definitions/grib2/tables/33/4.2.3.5.table b/definitions/grib2/tables/33/4.2.3.5.table new file mode 100644 index 000000000..58a3f12cb --- /dev/null +++ b/definitions/grib2/tables/33/4.2.3.5.table @@ -0,0 +1,7 @@ +# Product discipline 3 - Space products, parameter category 5: sea-surface temperature +0 0 Interface sea-surface temperature (K) +1 1 Skin sea-surface temperature (K) +2 2 Sub-skin sea-surface temperature (K) +3 3 Foundation sea-surface temperature (K) +4 4 Estimated bias between sea-surface temperature and standard (K) +5 5 Estimated standard deviation between sea surface temperature and standard (K) diff --git a/definitions/grib2/tables/33/4.2.3.6.table b/definitions/grib2/tables/33/4.2.3.6.table new file mode 100644 index 000000000..62a5ba656 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.3.6.table @@ -0,0 +1,7 @@ +# Product discipline 3 - Space products, parameter category 6: solar radiation +0 0 Global solar irradiance (W m-2) +1 1 Global solar exposure (J m-2) +2 2 Direct solar irradiance (W m-2) +3 3 Direct solar exposure (J m-2) +4 4 Diffuse solar irradiance (W m-2) +5 5 Diffuse solar exposure (J m-2) diff --git a/definitions/grib2/tables/33/4.2.4.0.table b/definitions/grib2/tables/33/4.2.4.0.table new file mode 100644 index 000000000..337308305 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.0.table @@ -0,0 +1,10 @@ +# Product discipline 4 - Space weather products, parameter category 0: temperature +0 0 Temperature (K) +1 1 Electron temperature (K) +2 2 Proton temperature (K) +3 3 Ion temperature (K) +4 4 Parallel temperature (K) +5 5 Perpendicular temperature (K) +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.1.table b/definitions/grib2/tables/33/4.2.4.1.table new file mode 100644 index 000000000..9ec11160f --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.1.table @@ -0,0 +1,8 @@ +# Product discipline 4 - Space weather products, parameter category 1: momentum +0 0 Velocity magnitude (speed) (m s-1) +1 1 1st vector component of velocity (coordinate system dependent) (m s-1) +2 2 2nd vector component of velocity (coordinate system dependent) (m s-1) +3 3 3rd vector component of velocity (coordinate system dependent) (m s-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.10.table b/definitions/grib2/tables/33/4.2.4.10.table new file mode 100644 index 000000000..8f5b19e06 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.10.table @@ -0,0 +1,12 @@ +# Product discipline 4 - Space weather products, parameter category 10: space weather indices +0 0 Scintillation index (sigma phi) (rad) +1 1 Scintillation index S4 (Numeric) +2 2 Rate of change of TEC index (ROTI) (TECU/min) +3 3 Disturbance ionosphere index spatial gradient (DIXSG) (Numeric) +4 4 Along arc TEC rate (AATR) (TECU/min) +5 5 Kp (Numeric) +6 6 Equatorial disturbance storm time index (Dst) (nT) +7 7 Auroral electrojet (AE) (nT) +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.2.table b/definitions/grib2/tables/33/4.2.4.2.table new file mode 100644 index 000000000..b479b3361 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.2.table @@ -0,0 +1,18 @@ +# Product discipline 4 - Space weather products, parameter category 2: charged particle mass and number +0 0 Particle number density (m-3) +1 1 Electron density (m-3) +2 2 Proton density (m-3) +3 3 Ion density (m-3) +4 4 Vertical total electron content (TECU) +5 5 HF absorption frequency (Hz) +6 6 HF absorption (dB) +7 7 Spread F (m) +8 8 h'F (m) +9 9 Critical frequency (Hz) +10 10 Maximal usable frequency (MUF) (Hz) +11 11 Peak height (hm) (m) +12 12 Peak density (Nm) (m-3) +13 13 Equivalent slab thickness (tau) (km) +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.3.table b/definitions/grib2/tables/33/4.2.4.3.table new file mode 100644 index 000000000..3b752bbbc --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.3.table @@ -0,0 +1,12 @@ +# Product discipline 4 - Space weather products, parameter category 3: electric and magnetic fields +0 0 Magnetic field magnitude (T) +1 1 1st vector component of magnetic field (T) +2 2 2nd vector component of magnetic field (T) +3 3 3rd vector component of magnetic field (T) +4 4 Electric field magnitude (V m-1) +5 5 1st vector component of electric field (V m-1) +6 6 2nd vector component of electric field (V m-1) +7 7 3rd vector component of electric field (V m-1) +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.4.table b/definitions/grib2/tables/33/4.2.4.4.table new file mode 100644 index 000000000..694c8cacc --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.4.table @@ -0,0 +1,11 @@ +# Product discipline 4 - Space weather products, parameter category 4: energetic particles +0 0 Proton flux (differential) ((m2 s sr eV)-1) +1 1 Proton flux (integral) ((m2 s sr )-1) +2 2 Electron flux (differential) ((m2 s sr eV)-1) +3 3 Electron flux (integral) ((m2 s sr)-1) +4 4 Heavy ion flux (differential) ((m2 s sr eV/nuc)-1) +5 5 Heavy ion flux (integral) ((m2 s sr)-1) +6 6 Cosmic ray neutron flux (h-1) +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.5.table b/definitions/grib2/tables/33/4.2.4.5.table new file mode 100644 index 000000000..913efec6f --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.5.table @@ -0,0 +1,8 @@ +# Product discipline 4 - Space weather products, parameter category 5: waves +0 0 Amplitude (dB) +1 1 Phase (rad) +2 2 Frequency (Hz) +3 3 Wavelength (m) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.6.table b/definitions/grib2/tables/33/4.2.4.6.table new file mode 100644 index 000000000..6d13019a6 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.6.table @@ -0,0 +1,11 @@ +# Product discipline 4 - Space weather products, parameter category 6: solar electromagnetic emissions +0 0 Integrated solar irradiance (W m-2) +1 1 Solar X-ray flux (XRS long) (W m-2) +2 2 Solar X-ray flux (XRS short) (W m-2) +3 3 Solar EUV irradiance (W m-2) +4 4 Solar spectral irradiance (W m-2 nm-1) +5 5 F10.7 (W m-2 Hz-1) +6 6 Solar radio emissions (W m-2 Hz-1) +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.7.table b/definitions/grib2/tables/33/4.2.4.7.table new file mode 100644 index 000000000..38c2b17a8 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.7.table @@ -0,0 +1,8 @@ +# Product discipline 4 - Space weather products, parameter category 7: terrestrial electromagnetic emissions +0 0 Limb intensity (J m-2 s-1) +1 1 Disk intensity (J m-2 s-1) +2 2 Disk intensity day (J m-2 s-1) +3 3 Disk intensity night (J m-2 s-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.8.table b/definitions/grib2/tables/33/4.2.4.8.table new file mode 100644 index 000000000..f350f4807 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.8.table @@ -0,0 +1,13 @@ +# Product discipline 4 - Space weather products, parameter category 8: imagery +0 0 X-ray radiance (W sr-1 m-2) +1 1 EUV radiance (W sr-1 m-2) +2 2 H-alpha radiance (W sr-1 m-2) +3 3 White light radiance (W sr-1 m-2) +4 4 CaII-K radiance (W sr-1 m-2) +5 5 White light coronagraph radiance (W sr-1 m-2) +6 6 Heliospheric radiance (W sr-1 m-2) +7 7 Thematic mask (Numeric) +8 8 Solar induced chlorophyll fluorescence (W m-2 sr-1 m-1) +# 9-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.2.4.9.table b/definitions/grib2/tables/33/4.2.4.9.table new file mode 100644 index 000000000..0e83436e2 --- /dev/null +++ b/definitions/grib2/tables/33/4.2.4.9.table @@ -0,0 +1,7 @@ +# Product discipline 4 - Space weather products, parameter category 9: ion-neutral coupling +0 0 Pedersen conductivity (S m-1) +1 1 Hall conductivity (S m-1) +2 2 Parallel conductivity (S m-1) +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.201.table b/definitions/grib2/tables/33/4.201.table new file mode 100644 index 000000000..a725e4e65 --- /dev/null +++ b/definitions/grib2/tables/33/4.201.table @@ -0,0 +1,17 @@ +# Code table 4.201 - Precipitation type +0 0 No precipitation +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +6 6 Wet snow +7 7 Mixture of rain and snow +8 8 Ice pellets +9 9 Graupel +10 10 Hail +11 11 Drizzle +12 12 Freezing drizzle +# 13-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.202.table b/definitions/grib2/tables/33/4.202.table new file mode 100644 index 000000000..7f3c8f6cf --- /dev/null +++ b/definitions/grib2/tables/33/4.202.table @@ -0,0 +1,4 @@ +# Code table 4.202 - Precipitable water category +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.203.table b/definitions/grib2/tables/33/4.203.table new file mode 100644 index 000000000..cf5eb6bdc --- /dev/null +++ b/definitions/grib2/tables/33/4.203.table @@ -0,0 +1,26 @@ +# Code table 4.203 - Cloud type +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.204.table b/definitions/grib2/tables/33/4.204.table new file mode 100644 index 000000000..8e0be1f8c --- /dev/null +++ b/definitions/grib2/tables/33/4.204.table @@ -0,0 +1,9 @@ +# Code table 4.204 - Thunderstorm coverage +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (6-45%) +4 4 Numerous (> 45%) +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.205.table b/definitions/grib2/tables/33/4.205.table new file mode 100644 index 000000000..c40c7f47b --- /dev/null +++ b/definitions/grib2/tables/33/4.205.table @@ -0,0 +1,6 @@ +# Code table 4.205 - Presence of aerosol +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.206.table b/definitions/grib2/tables/33/4.206.table new file mode 100644 index 000000000..76472c261 --- /dev/null +++ b/definitions/grib2/tables/33/4.206.table @@ -0,0 +1,6 @@ +# Code table 4.206 - Volcanic ash +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.207.table b/definitions/grib2/tables/33/4.207.table new file mode 100644 index 000000000..b6392fca0 --- /dev/null +++ b/definitions/grib2/tables/33/4.207.table @@ -0,0 +1,10 @@ +# Code table 4.207 - Icing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.208.table b/definitions/grib2/tables/33/4.208.table new file mode 100644 index 000000000..4361d38c0 --- /dev/null +++ b/definitions/grib2/tables/33/4.208.table @@ -0,0 +1,9 @@ +# Code table 4.208 - Turbulence +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.209.table b/definitions/grib2/tables/33/4.209.table new file mode 100644 index 000000000..39ea549ac --- /dev/null +++ b/definitions/grib2/tables/33/4.209.table @@ -0,0 +1,9 @@ +# Code table 4.209 - Planetary boundary-layer regime +0 0 Reserved +1 1 Stable +2 2 Mechanically driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.210.table b/definitions/grib2/tables/33/4.210.table new file mode 100644 index 000000000..791878469 --- /dev/null +++ b/definitions/grib2/tables/33/4.210.table @@ -0,0 +1,6 @@ +# Code table 4.210 - Contrail intensity +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.211.table b/definitions/grib2/tables/33/4.211.table new file mode 100644 index 000000000..2a28a84d9 --- /dev/null +++ b/definitions/grib2/tables/33/4.211.table @@ -0,0 +1,7 @@ +# Code table 4.211 - Contrail engine type +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.212.table b/definitions/grib2/tables/33/4.212.table new file mode 100644 index 000000000..6a3dcf88c --- /dev/null +++ b/definitions/grib2/tables/33/4.212.table @@ -0,0 +1,18 @@ +# Code table 4.212 - Land use +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.213.table b/definitions/grib2/tables/33/4.213.table new file mode 100644 index 000000000..68d627af6 --- /dev/null +++ b/definitions/grib2/tables/33/4.213.table @@ -0,0 +1,16 @@ +# Code table 4.213 - Soil type +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.214.table b/definitions/grib2/tables/33/4.214.table new file mode 100644 index 000000000..b08860ce0 --- /dev/null +++ b/definitions/grib2/tables/33/4.214.table @@ -0,0 +1,11 @@ +# Code table 4.214 - Environmental Factor Qualifier +0 0 Worst +1 1 Very poor +2 2 Poor +3 3 Average +4 4 Good +5 5 Excellent +# 6-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.215.table b/definitions/grib2/tables/33/4.215.table new file mode 100644 index 000000000..7888772d5 --- /dev/null +++ b/definitions/grib2/tables/33/4.215.table @@ -0,0 +1,9 @@ +# Code table 4.215 - Remotely sensed snow coverage +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.216.table b/definitions/grib2/tables/33/4.216.table new file mode 100644 index 000000000..b51b358f4 --- /dev/null +++ b/definitions/grib2/tables/33/4.216.table @@ -0,0 +1,5 @@ +# Code table 4.216 - Elevation of snow-covered terrain +# 0-90 Elevation in increments of 100 m +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/33/4.217.table b/definitions/grib2/tables/33/4.217.table new file mode 100644 index 000000000..a700410d5 --- /dev/null +++ b/definitions/grib2/tables/33/4.217.table @@ -0,0 +1,8 @@ +# Code table 4.217 - Cloud mask type +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.218.table b/definitions/grib2/tables/33/4.218.table new file mode 100644 index 000000000..a13debf16 --- /dev/null +++ b/definitions/grib2/tables/33/4.218.table @@ -0,0 +1,46 @@ +# Code table 4.218 - Pixel scene type +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation/crops +15 15 Permanent snow/ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +19 19 Warm liquid water cloud +20 20 Supercooled liquid water cloud +21 21 Mixed-phase cloud +22 22 Optically thin ice cloud +23 23 Optically thick ice cloud +24 24 Multilayered cloud +# 25-96 Reserved +97 97 Snow/ice on land +98 98 Snow/ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud/fog/stratus +102 102 Low cloud/stratocumulus +103 103 Low cloud/unknown type +104 104 Medium cloud/nimbostratus +105 105 Medium cloud/altostratus +106 106 Medium cloud/unknown type +107 107 High cloud/cumulus +108 108 High cloud/cirrus +109 109 High cloud/unknown +110 110 Unknown cloud type +111 111 Single layer water cloud +112 112 Single layer ice cloud +# 113-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.219.table b/definitions/grib2/tables/33/4.219.table new file mode 100644 index 000000000..9979f50ad --- /dev/null +++ b/definitions/grib2/tables/33/4.219.table @@ -0,0 +1,8 @@ +# Code table 4.219 - Cloud top height quality indicator +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.220.table b/definitions/grib2/tables/33/4.220.table new file mode 100644 index 000000000..88e869e42 --- /dev/null +++ b/definitions/grib2/tables/33/4.220.table @@ -0,0 +1,6 @@ +# Code table 4.220 - Horizontal dimension processed +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.221.table b/definitions/grib2/tables/33/4.221.table new file mode 100644 index 000000000..011cc3518 --- /dev/null +++ b/definitions/grib2/tables/33/4.221.table @@ -0,0 +1,6 @@ +# Code table 4.221 - Treatment of missing data +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.222.table b/definitions/grib2/tables/33/4.222.table new file mode 100644 index 000000000..558d947ac --- /dev/null +++ b/definitions/grib2/tables/33/4.222.table @@ -0,0 +1,6 @@ +# Code table 4.222 - Categorical result +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.223.table b/definitions/grib2/tables/33/4.223.table new file mode 100644 index 000000000..572c4e7a8 --- /dev/null +++ b/definitions/grib2/tables/33/4.223.table @@ -0,0 +1,5 @@ +# Code table 4.223 - Fire detection indicator +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing diff --git a/definitions/grib2/tables/33/4.224.table b/definitions/grib2/tables/33/4.224.table new file mode 100644 index 000000000..014f56e23 --- /dev/null +++ b/definitions/grib2/tables/33/4.224.table @@ -0,0 +1,18 @@ +# Code table 4.224 - Categorical outlook +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/4.225.table b/definitions/grib2/tables/33/4.225.table new file mode 100644 index 000000000..9dc374087 --- /dev/null +++ b/definitions/grib2/tables/33/4.225.table @@ -0,0 +1,2 @@ +# Code table 4.225 - Weather (see FM 94 BUFR/FM 95 CREX Code table 0 20 003 - Present weather) +511 511 Missing value diff --git a/definitions/grib2/tables/33/4.227.table b/definitions/grib2/tables/33/4.227.table new file mode 100644 index 000000000..48c3b7633 --- /dev/null +++ b/definitions/grib2/tables/33/4.227.table @@ -0,0 +1,9 @@ +# Code table 4.227 - Icing scenario (weather/cloud classification) +0 0 None +1 1 General +2 2 Convective +3 3 Stratiform +4 4 Freezing +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/33/4.228.table b/definitions/grib2/tables/33/4.228.table new file mode 100644 index 000000000..048a69f0b --- /dev/null +++ b/definitions/grib2/tables/33/4.228.table @@ -0,0 +1,8 @@ +# Code table 4.228 - Icing severity +0 0 None +1 1 Trace +2 2 Light +3 3 Moderate +4 4 Severe +# 5-254 Reserved +255 255 Missing value diff --git a/definitions/grib2/tables/33/4.230.table b/definitions/grib2/tables/33/4.230.table new file mode 100644 index 000000000..1871fb176 --- /dev/null +++ b/definitions/grib2/tables/33/4.230.table @@ -0,0 +1,601 @@ +# Code table 4.230 - Atmospheric chemical constituent type +0 0 Ozone O3 +1 1 Water vapour H2O +2 2 Methane CH4 +3 3 Carbon dioxide CO2 +4 4 Carbon monoxide CO +5 5 Nitrogen dioxide NO2 +6 6 Nitrous oxide N2O +7 7 Formaldehyde HCHO +8 8 Sulphur dioxide SO2 +9 9 Ammonia NH3 +10 10 Ammonium cation NH4+ +11 11 Nitrogen monoxide NO +12 12 Atomic oxygen O +13 13 Nitrate radical NO3* +14 14 Hydroperoxyl radical HOO* +15 15 Dinitrogen pentoxide N2O5 +16 16 Nitrous acid HONO +17 17 Nitric acid HNO3 +18 18 Peroxynitric acid HO2NO2 +19 19 Hydrogen peroxide H2O2 +20 20 Dihydrogen H2 +21 21 Atomic nitrogen N +22 22 Sulphate anion SO42- +23 23 Atomic Radon Rn +24 24 Mercury vapour Hg(0) +25 25 Mercury(II) cation Hg2+ +26 26 Atomic chlorine Cl +27 27 Chlorine monoxide ClO +28 28 Dichlorine peroxide Cl2O2 +29 29 Hypochlorous acid HClO +30 30 Chlorine nitrate ClONO2 +31 31 Chlorine dioxide ClO2 +32 32 Atomic bromine Br +33 33 Bromine monoxide BrO +34 34 Bromine chloride BrCl +35 35 Hydrogen bromide HBr +36 36 Hypobromous acid HBrO +37 37 Bromine nitrate BrONO2 +38 38 Dioxygen O2 +39 39 Nitryl chloride NO2Cl +40 40 Sulphuric acid H2SO4 +41 41 Hydrogen sulphide H2S +42 42 Sulphur trioxide SO3 +43 43 Bromine Br2 +44 44 Hydrofluoric acid HF +45 45 Sulphur hexafluoride SF6 +46 46 Chlorine Cl2 +# 47-9999 Reserved +10000 10000 Hydroxyl radical HO* +10001 10001 Methyl peroxy radical CH3OO* +10002 10002 Methyl hydroperoxide CH3OOH +10004 10004 Methanol CH3OH +10005 10005 Formic acid HCOOH +10006 10006 Hydrogen cyanide HCN +10007 10007 Aceto nitrile CH3CN +10008 10008 Ethane C2H6 +10009 10009 Ethene (= Ethylene) C2H4 +10010 10010 Ethyne (= Acetylene) C2H2 +10011 10011 Ethanol C2H5OH +10012 10012 Acetic acid C2H5OOH +10013 10013 Peroxyacetyl nitrate CH3C(O)OONO2 +10014 10014 Propane C3H8 +10015 10015 Propene C3H6 +10016 10016 Butane (all isomers) C4H10 +10017 10017 Isoprene C5H10 +10018 10018 Alpha pinene C10H16 +10019 10019 Beta pinene C10H16 +10020 10020 Limonene C10H16 +10021 10021 Benzene C6H6 +10022 10022 Toluene C7H8 +10023 10023 Xylene C8H10 +10024 10024 Methanesulphonic acid CH3SO3H +10025 10025 Methylglyoxal (2-oxopropanal) CH3C(O)CHO +10026 10026 Peroxyacetyl radical CH3C(O)OO* +10027 10027 Methacrylic acid (2-methylprop-2-enoic acid) CH2C(CH3)COOH +10028 10028 Methacrolein (2-methylprop-2-enal) CH2C(CH3)CHO +10029 10029 Acetone (propan-2-one) CH3C(O)CH3 +10030 10030 Ethyl dioxidanyl radical CH3CH2OO* +10031 10031 Butadiene (buta-1,3-diene) (CH2CH)2 +10032 10032 Acetaldehyde (ethanal) CH3CHO +10033 10033 Glycolaldehyde (hydroxyethanal) HOCH2CHO +10034 10034 Cresol (methylphenol), all isomers CH3C6H4OH +10035 10035 Peracetic acid (ethaneperoxoic acid) CH3C(O)OOH +10036 10036 2-hydroxyethyl oxidanyl radical HOCH2CH2O* +10037 10037 2-hydroxyethyl dioxidanyl radical HOCH2CH2OO* +10038 10038 Glyoxal (oxaldehyde) OCHCHO +10039 10039 Isopropyl dioxidanyl radical (CH3)2CHOO* +10040 10040 Isopropyl hydroperoxide (2-hydroperoxypropane) (CH3)2CHOOH +10041 10041 Hydroxyacetone (1-hydroxypropan-2-one) CH3C(O)CH2OH +10042 10042 Peroxyacetic acid (ethaneperoxoic acid) CH3C(O)OOH +10043 10043 Methyl vinyl ketone (but-3-en-2-one) CH3C(O)CHCH2 +10044 10044 Phenoxy radical C6H5O* +10045 10045 Methyl radical CH3* +10046 10046 Carbonyl sulphide (carbon oxide sulphide) OCS +10047 10047 Dibromomethane CH2Br2 +10048 10048 Methoxy radical CH3O* +10049 10049 Tribromomethane CHBr3 +10050 10050 Formyl radical (oxomethyl radical) HOC* +10051 10051 Hydroxymethyl dioxidanyl radical HOCH2OO* +10052 10052 Ethyl hydroperoxide CH3CH2OOH +10053 10053 3-hydroxypropyl dioxidanyl radical HOCH2CH2CH2OO* +10054 10054 3-hydroxypropyl hydroperoxide HOCH2CH2CH2OOH +10055 10055 Methyl-peroxy-nitrate (nitroperoxy-methane) CH3OONO2 +10056 10056 2-lambda^1-oxidanyloxy-2-methylbut-3-en-1-ol (4-hydroxy-3-methyl-1-butene-3-ylperoxy radical) HOCH2C(CH3)(OO*)CHCH2 +10057 10057 2-lambda^1-oxidanyloxy-3-methylbut-3-en-1-ol (2-hydroxy-1-isopropenylethylperoxy radical) HOCH2CH(OO*)C(CH3)CH2 +10058 10058 (Z)-4-hydroperoxy-2-methyl-2-butenal CH2(OOH)CHC(CH3)CHO +10059 10059 (Z)-4-hydroperoxy-3-methyl-2-butenal CH2(OOH)C(CH3)CHCHO +# 10060-10499 Reserved for other simple organic molecules (e.g. higher aldehydes, alcohols, peroxides, etc.) +10500 10500 Dimethyl sulphide CH3SCH3 (DMS) +10501 10501 DMSO (dimethyl sulfoxide) (CH3)2SO +# 10502-20000 Reserved +20001 20001 Hydrogen chloride HCl +20002 20002 CFC-11 (trichlorofluoromethane) CCl3F +20003 20003 CFC-12 (dichlorodifluoromethane) CCl2F2 +20004 20004 CFC-113 (1,1,2-trichloro-1,2,2-trifluoroethane) Cl2FC-CClF2 +20005 20005 CFC-113a (1,1,1-trichloro-2,2,2-trifluoroethane) Cl3C-CF3 +20006 20006 CFC-114 (1,2-dichloro-1,1,2,2-tetrafluoroethane) ClF2C-CClF2 +20007 20007 CFC-115 (1-chloro-1,1,2,2,2-pentafluoroethane) ClF2C-CF3 +20008 20008 HCFC-22 (chlorodifluoromethane) CHClF2 +20009 20009 HCFC-141b (1,1-dichloro-1-fluoroethane) Cl2FC-CH3 +20010 20010 HCFC-142b (1-chloro-1,1-difluoroethane) ClF2C-CH3 +20011 20011 Halon-1202 (dibromodifluoromethane) CBr2F2 +20012 20012 Halon-1211 (bromochlorodifluoromethane) CBrClF2 +20013 20013 Halon-1301 (bromotrifluoromethane) CBrF3 +20014 20014 Halon-2402 (1,2-dibromo-1,1,2,2-tetrafluoroethane) BrF2C-CBrF2 +20015 20015 HCC-40 (methyl chloride) CH3Cl +20016 20016 HCC-10 (carbon tetrachloride) CCl4 +20017 20017 HCC-140a (1,1,1-trichloroethane) Cl3C-CH3 +20018 20018 HBC-40B1 (methyl bromide) CH3Br +20019 20019 HCH (hexachlorocyclohexane) all isomers C6H6Cl6 +20020 20020 alpha-HCH (alpha-hexachlorocyclohexane) both enantiomers alpha-C6H6Cl6 +20021 20021 PCB-153 (2,2',4,4',5,5'-hexachlorobiphenyl) (C6H2Cl3)2 +20022 20022 HCFC-141a (1,1-dichloro-2-fluoroethane) Cl2HC-CH2F +# 20023-29999 Reserved +30000 30000 Radioactive pollutant (tracer, defined by originating centre) +# 30001-30009 Reserved +30010 30010 Tritium (Hydrogen 3) H-3 +30011 30011 Tritium organic bounded H-3o +30012 30012 Tritium inorganic H-3a +30013 30013 Beryllium 7 Be-7 +30014 30014 Beryllium 10 Be-10 +30015 30015 Carbon 14 C-14 +30016 30016 Carbon 14 CO2 C-14CO2 +30017 30017 Carbon 14 other gases C-14og +30018 30018 Nitrogen 13 N-13 +30019 30019 Nitrogen 16 N-16 +30020 30020 Fluorine 18 F-18 +30021 30021 Sodium 22 Na-22 +30022 30022 Phosphate 32 P-32 +30023 30023 Phosphate 33 P-33 +30024 30024 Sulphur 35 S-35 +30025 30025 Chlorine 36 Cl-36 +30026 30026 Potassium 40 K-40 +30027 30027 Argon 41 Ar-41 +30028 30028 Calcium 41 Ca-41 +30029 30029 Calcium 45 Ca-45 +30030 30030 Titanium 44 Ti-44 +30031 30031 Scandium 46 Sc-46 +30032 30032 Vanadium 48 V-48 +30033 30033 Vanadium 49 V-49 +30034 30034 Chrome 51 Cr-51 +30035 30035 Manganese 52 Mn-52 +30036 30036 Manganese 54 Mn-54 +30037 30037 Iron 55 Fe-55 +30038 30038 Iron 59 Fe-59 +30039 30039 Cobalt 56 Co-56 +30040 30040 Cobalt 57 Co-57 +30041 30041 Cobalt 58 Co-58 +30042 30042 Cobalt 60 Co-60 +30043 30043 Nickel 59 Ni-59 +30044 30044 Nickel 63 Ni-63 +30045 30045 Zinc 65 Zn-65 +30046 30046 Gallium 67 Ga-67 +30047 30047 Gallium 68 Ga-68 +30048 30048 Germanium 68 Ge-68 +30049 30049 Germanium 69 Ge-69 +30050 30050 Arsenic 73 As-73 +30051 30051 Selenium 75 Se-75 +30052 30052 Selenium 79 Se-79 +30053 30053 Rubidium 81 Rb-81 +30054 30054 Rubidium 83 Rb-83 +30055 30055 Rubidium 84 Rb-84 +30056 30056 Rubidium 86 Rb-86 +30057 30057 Rubidium 87 Rb-87 +30058 30058 Rubidium 88 Rb-88 +30059 30059 Krypton 85 Kr-85 +30060 30060 Krypton 85 metastable Kr-85m +30061 30061 Krypton 87 Kr-87 +30062 30062 Krypton 88 Kr-88 +30063 30063 Krypton 89 Kr-89 +30064 30064 Strontium 85 Sr-85 +30065 30065 Strontium 89 Sr-89 +30066 30066 Strontium 89/90 Sr-8990 +30067 30067 Strontium 90 Sr-90 +30068 30068 Strontium 91 Sr-91 +30069 30069 Strontium 92 Sr-92 +30070 30070 Yttrium 87 Y-87 +30071 30071 Yttrium 88 Y-88 +30072 30072 Yttrium 90 Y-90 +30073 30073 Yttrium 91 Y-91 +30074 30074 Yttrium 91 metastable Y-91m +30075 30075 Yttrium 92 Y-92 +30076 30076 Yttrium 93 Y-93 +30077 30077 Zirconium 89 Zr-89 +30078 30078 Zirconium 93 Zr-93 +30079 30079 Zirconium 95 Zr-95 +30080 30080 Zirconium 97 Zr-97 +30081 30081 Niobium 93 metastable Nb-93m +30082 30082 Niobium 94 Nb-94 +30083 30083 Niobium 95 Nb-95 +30084 30084 Niobium 95 metastable Nb-95m +30085 30085 Niobium 97 Nb-97 +30086 30086 Niobium 97 metastable Nb-97m +30087 30087 Molybdenum 93 Mo-93 +30088 30088 Molybdenum 99 Mo-99 +30089 30089 Technetium 95 metastable Tc-95m +30090 30090 Technetium 96 Tc-96 +30091 30091 Technetium 99 Tc-99 +30092 30092 Technetium 99 metastable Tc-99m +30093 30093 Rhodium 99 Rh-99 +30094 30094 Rhodium 101 Rh-101 +30095 30095 Rhodium 102 metastable Rh-102m +30096 30096 Rhodium 103 metastable Rh-103m +30097 30097 Rhodium 105 Rh-105 +30098 30098 Rhodium 106 Rh-106 +30099 30099 Palladium 100 Pd-100 +30100 30100 Palladium 103 Pd-103 +30101 30101 Palladium 107 Pd-107 +30102 30102 Ruthenium 103 Ru-103 +30103 30103 Ruthenium 105 Ru-105 +30104 30104 Ruthenium 106 Ru-106 +30105 30105 Silver 108 metastable Ag-108m +30106 30106 Silver 110 metastable Ag-110m +30107 30107 Cadmium 109 Cd-109 +30108 30108 Cadmium 113 metastable Cd-113m +30109 30109 Cadmium 115 metastable Cd-115m +30110 30110 Indium 114 metastable In-114m +30111 30111 Tin 113 Sn-113 +30112 30112 Tin 119 metastable Sn-119m +30113 30113 Tin 121 metastable Sn-121m +30114 30114 Tin 122 Sn-122 +30115 30115 Tin 123 Sn-123 +30116 30116 Tin 126 Sn-126 +30117 30117 Antimony 124 Sb-124 +30118 30118 Antimony 125 Sb-125 +30119 30119 Antimony 126 Sb-126 +30120 30120 Antimony 127 Sb-127 +30121 30121 Antimony 129 Sb-129 +30122 30122 Tellurium 123 metastable Te-123m +30123 30123 Tellurium 125 metastable Te-125m +30124 30124 Tellurium 127 Te-127 +30125 30125 Tellurium 127 metastable Te-127m +30126 30126 Tellurium 129 Te-129 +30127 30127 Tellurium 129 metastable Te-129m +30128 30128 Tellurium 131 metastable Te-131m +30129 30129 Tellurium 132 Te-132 +30130 30130 Iodine 123 I-123 +30131 30131 Iodine 124 I-124 +30132 30132 Iodine 125 I-125 +30133 30133 Iodine 126 I-126 +30134 30134 Iodine 129 I-129 +30135 30135 Iodine 129 elementary gaseous I-129g +30136 30136 Iodine 129 organic bounded I-129o +30137 30137 Iodine 131 I-131 +30138 30138 Iodine 131 elementary gaseous I-131g +30139 30139 Iodine 131 organic bounded I-131o +30140 30140 Iodine 131 gaseous elementary and organic bounded I-131go +30141 30141 Iodine 131 aerosol I-131a +30142 30142 Iodine 132 I-132 +30143 30143 Iodine 132 elementary gaseous I-132g +30144 30144 Iodine 132 organic bounded I-132o +30145 30145 Iodine 132 gaseous elementary and organic bounded I-132go +30146 30146 Iodine 132 aerosol I-132a +30147 30147 Iodine 133 I-133 +30148 30148 Iodine 133 elementary gaseous I-133g +30149 30149 Iodine 133 organic bounded I-133o +30150 30150 Iodine 133 gaseous elementary and organic bounded I-133go +30151 30151 Iodine 133 aerosol I-133a +30152 30152 Iodine 134 I-134 +30153 30153 Iodine 134 elementary gaseous I-134g +30154 30154 Iodine 134 organic bounded I-134o +30155 30155 Iodine 135 I-135 +30156 30156 Iodine 135 elementary gaseous I-135g +30157 30157 Iodine 135 organic bounded I-135o +30158 30158 Iodine 135 gaseous elementary and organic bounded I-135go +30159 30159 Iodine 135 aerosol I-135a +30160 30160 Xenon 131 metastable Xe-131m +30161 30161 Xenon 133 Xe-133 +30162 30162 Xenon 133 metastable Xe-133m +30163 30163 Xenon 135 Xe-135 +30164 30164 Xenon 135 metastable Xe-135m +30165 30165 Xenon 137 Xe-137 +30166 30166 Xenon 138 Xe-138 +30167 30167 Xenon sum of all Xenon isotopes Xe-sum +30168 30168 Caesium 131 Cs-131 +30169 30169 Caesium 134 Cs-134 +30170 30170 Caesium 135 Cs-135 +30171 30171 Caesium 136 Cs-136 +30172 30172 Caesium 137 Cs-137 +30173 30173 Barium 133 Ba-133 +30174 30174 Barium 137 metastable Ba-137m +30175 30175 Barium 140 Ba-140 +30176 30176 Cerium 139 Ce-139 +30177 30177 Cerium 141 Ce-141 +30178 30178 Cerium 143 Ce-143 +30179 30179 Cerium 144 Ce-144 +30180 30180 Lanthanum 140 La-140 +30181 30181 Lanthanum 141 La-141 +30182 30182 Praseodymium 143 Pr-143 +30183 30183 Praseodymium 144 Pr-144 +30184 30184 Praseodymium 144 metastable Pr-144m +30185 30185 Samarium 145 Sm-145 +30186 30186 Samarium 147 Sm-147 +30187 30187 Samarium 151 Sm-151 +30188 30188 Neodymium 147 Nd-147 +30189 30189 Promethium 146 Pm-146 +30190 30190 Promethium 147 Pm-147 +30191 30191 Promethium 151 Pm-151 +30192 30192 Europium 152 Eu-152 +30193 30193 Europium 154 Eu-154 +30194 30194 Europium 155 Eu-155 +30195 30195 Gadolinium 153 Gd-153 +30196 30196 Terbium 160 Tb-160 +30197 30197 Holmium 166 metastable Ho-166m +30198 30198 Thulium 170 Tm-170 +30199 30199 Ytterbium 169 Yb-169 +30200 30200 Hafnium 175 Hf-175 +30201 30201 Hafnium 181 Hf-181 +30202 30202 Tantalum 179 Ta-179 +30203 30203 Tantalum 182 Ta-182 +30204 30204 Rhenium 184 Re-184 +30205 30205 Iridium 192 Ir-192 +30206 30206 Mercury 203 Hg-203 +30207 30207 Thallium 204 Tl-204 +30208 30208 Thallium 207 Tl-207 +30209 30209 Thallium 208 Tl-208 +30210 30210 Thallium 209 Tl-209 +30211 30211 Bismuth 205 Bi-205 +30212 30212 Bismuth 207 Bi-207 +30213 30213 Bismuth 210 Bi-210 +30214 30214 Bismuth 211 Bi-211 +30215 30215 Bismuth 212 Bi-212 +30216 30216 Bismuth 213 Bi-213 +30217 30217 Bismuth 214 Bi-214 +30218 30218 Polonium 208 Po-208 +30219 30219 Polonium 210 Po-210 +30220 30220 Polonium 212 Po-212 +30221 30221 Polonium 213 Po-213 +30222 30222 Polonium 214 Po-214 +30223 30223 Polonium 215 Po-215 +30224 30224 Polonium 216 Po-216 +30225 30225 Polonium 218 Po-218 +30226 30226 Lead 209 Pb-209 +30227 30227 Lead 210 Pb-210 +30228 30228 Lead 211 Pb-211 +30229 30229 Lead 212 Pb-212 +30230 30230 Lead 214 Pb-214 +30231 30231 Astatine 217 At-217 +30232 30232 Radon 219 Rn-219 +30233 30233 Radon 220 Rn-220 +30234 30234 Radon 222 Rn-222 +30235 30235 Francium 221 Fr-221 +30236 30236 Francium 223 Fr-223 +30237 30237 Radium 223 Ra-223 +30238 30238 Radium 224 Ra-224 +30239 30239 Radium 225 Ra-225 +30240 30240 Radium 226 Ra-226 +30241 30241 Radium 228 Ra-228 +30242 30242 Actinium 225 Ac-225 +30243 30243 Actinium 227 Ac-227 +30244 30244 Actinium 228 Ac-228 +30245 30245 Thorium 227 Th-227 +30246 30246 Thorium 228 Th-228 +30247 30247 Thorium 229 Th-229 +30248 30248 Thorium 230 Th-230 +30249 30249 Thorium 231 Th-231 +30250 30250 Thorium 232 Th-232 +30251 30251 Thorium 234 Th-234 +30252 30252 Protactinium 231 Pa-231 +30253 30253 Protactinium 233 Pa-233 +30254 30254 Protactinium 234 metastable Pa-234m +30255 30255 Uranium 232 U-232 +30256 30256 Uranium 233 U-233 +30257 30257 Uranium 234 U-234 +30258 30258 Uranium 235 U-235 +30259 30259 Uranium 236 U-236 +30260 30260 Uranium 237 U-237 +30261 30261 Uranium 238 U-238 +30262 30262 Plutonium 236 Pu-236 +30263 30263 Plutonium 238 Pu-238 +30264 30264 Plutonium 239 Pu-239 +30265 30265 Plutonium 240 Pu-240 +30266 30266 Plutonium 241 Pu-241 +30267 30267 Plutonium 242 Pu-242 +30268 30268 Plutonium 244 Pu-244 +30269 30269 Neptunium 237 Np-237 +30270 30270 Neptunium 238 Np-238 +30271 30271 Neptunium 239 Np-239 +30272 30272 Americium 241 Am-241 +30273 30273 Americium 242 Am-242 +30274 30274 Americium 242 metastable Am-242m +30275 30275 Americium 243 Am-243 +30276 30276 Curium 242 Cm-242 +30277 30277 Curium 243 Cm-243 +30278 30278 Curium 244 Cm-244 +30279 30279 Curium 245 Cm-245 +30280 30280 Curium 246 Cm-246 +30281 30281 Curium 247 Cm-247 +30282 30282 Curium 248 Cm-248 +30283 30283 Curium 243/244 Cm-243244 +30284 30284 Plutonium 238/Americium 241 Pu-238Am-241 +30285 30285 Plutonium 239/240 Pu-239240 +30286 30286 Berkelium 249 Bk-249 +30287 30287 Californium 249 Cf-249 +30288 30288 Californium 250 Cf-250 +30289 30289 Californium 252 Cf-252 +30290 30290 Sum aerosol particulates SumAer +30291 30291 Sum Iodine SumIod +30292 30292 Sum noble gas SumNG +30293 30293 Activation gas ActGas +30294 30294 Cs-137 Equivalent EquCs137 +30295 30295 Carbon-13 C-13 +30296 30296 Lead Pb +30297 30297 Tellurium 131 Te-131 +30298 30298 Neodymium 137 Nd-137 +30299 30299 Pseudo radionuclide +30300 30300 Silver 112 Ag-112 +30301 30301 Silver 115 Ag-115 +30302 30302 Barium 139 Ba-139 +30303 30303 Barium 141 Ba-141 +30304 30304 Barium 142 Ba-142 +30305 30305 Bromine 84 Br-84 +30306 30306 Cadminum 115 Cd-115 +30307 30307 Cadminum 117 Cd-117 +30308 30308 Cadminum 117 metastable Cd-117m +30309 30309 Cerium 145 Ce-145 +30310 30310 Cerium 146 Ce-146 +30311 30311 Cobalt 58 metastable Co-58m +30312 30312 Ceasium 138 Cs-138 +30313 30313 Ceasium 139 Cs-139 +30314 30314 Iodine 130 aerosol I-130a +30315 30315 Iodine 130 elementary gaseous I-130e +30316 30316 Iodine 130 organic bounded I-130o +30317 30317 Iodine 132 metastable I-132m +30318 30318 Iodine 134 metastable I-134m +30319 30319 Indium 115 metastable In-115m +30320 30320 Indium 117 metastable In-117m +30321 30321 Krypton 83 metastable Kr-83m +30322 30322 Lanthanum 142 La-142 +30323 30323 Lanthanum 143 La-143 +30324 30324 Manganese 56 Mn-56 +30325 30325 Molybdenum 101 Mo-101 +30326 30326 Molybdenum 102 Mo-102 +30327 30327 Neodymium 149 Nd-149 +30328 30328 Neodymium 151 Nd-151 +30329 30329 Palladium 109 Pd-109 +30330 30330 Palladium 112 Pd-112 +30331 30331 Praseodymium 145 Pr-145 +30332 30332 Praseodymium 146 Pr-146 +30333 30333 Praseodymium 147 Pr-147 +30334 30334 Rubidium 89 Rb-89 +30335 30335 Rubidium 90 Rb-90 +30336 30336 Rubidium 90 metastable Rb-90m +30337 30337 Rhodium 105 metastable Rh-105m +30338 30338 Rhodium 107 Rh-107 +30339 30339 Antimony 128 Sb-128 +30340 30340 Antimony 128 metastable Sb-128m +30341 30341 Antimony 129 metastable Sb-129m +30342 30342 Antimony 130 Sb-130 +30343 30343 Antimony 130 metastable Sb-130m +30344 30344 Antimony 131 Sb-131 +30345 30345 Antimony 132 Sb-132 +30346 30346 Antimony 132 metastable Sb-132m +30347 30347 Antimony 133 Sb-133 +30348 30348 Selenium 83 Se-83 +30349 30349 Tin 127 Sn-127 +30350 30350 Tin 127 metastable Sn-127m +30351 30351 Tin 128 Sn-128 +30352 30352 Tin 129 metastable Sn-129m +30353 30353 Tin 130 Sn-130 +30354 30354 Strontium 93 Sr-93 +30355 30355 Technetium 101 Tc-101 +30356 30356 Technetium 102 Tc-102 +30357 30357 Technetium 104 Tc-104 +30358 30358 Technetium 105 Tc-105 +30359 30359 Tellurium 133 Te-133 +30360 30360 Tellurium 133 metastable Te-133m +30361 30361 Tellurium 134 Te-134 +30362 30362 Yttrium 93 metastable Y-93m +30363 30363 Yttrium 94 Y-94 +30364 30364 Yttrium 95 Y-95 +30365 30365 Zirconium 96 Zr-96 +# 30366-39999 Reserved +40000 40000 Singlet sigma oxygen (dioxygen (sigma singlet)) O2 +40001 40001 Singlet delta oxygen (dioxygen (delta singlet)) O2 +40002 40002 Singlet excited oxygen atom O(1D) +40003 40003 Triplet ground state oxygen atom O(3P) +# 40004-59999 Reserved +60000 60000 HOx radical (OH+HO2) HOx* +60001 60001 Total inorganic and organic peroxy radicals (HOO* + ROO*) ROO* +60002 60002 Passive Ozone +60003 60003 NOx expressed as nitrogen NOx +60004 60004 All nitrogen oxides (NOy) expressed as nitrogen NOy +60005 60005 Total inorganic chlorine Clx +60006 60006 Total inorganic bromine Brx +60007 60007 Total inorganic chlorine except HCl, ClONO2: ClOx +60008 60008 Total inorganic bromine except HBr, BrONO2: BrOx +60009 60009 Lumped alkanes +60010 60010 Lumped alkenes +60011 60011 Lumped aromatic compounds +60012 60012 Lumped terpenes +60013 60013 Non-methane volatile organic compounds expressed as carbon NMVOC +60014 60014 Anthropogenic non-methane volatile organic compounds expressed as carbon aNMVOC +60015 60015 Biogenic non-methane volatile organic compounds expressed as carbon bNMVOC +60016 60016 Lumped oxygenated hydrocarbons OVOC +60017 60017 NOx expressed as nitrogen dioxide (NO2) NOx +60018 60018 Organic aldehydes RCHO +60019 60019 Organic peroxides ROOH +60020 60020 Organic nitrates RNO3 +60021 60021 Ethers ROR' +60022 60022 Amines NRR'R'' +60023 60023 Ketones RC(O)R' +60024 60024 Dicarbonyls unsaturated RC(O)CH2C(O)R' +60025 60025 Hydroxy dicarbonyls unsaturated RC(O)CHOHC(O)R' +60026 60026 Hydroxy ketones RC(OH)C(O)R' +60027 60027 Oxides Ox +60028 60028 Peroxyacyl nitrates RC(O)OONO2 +60029 60029 Aromatic peroxide radical (Aryl dioxydanyl radicals) ArOO* +60030 60030 Biogenic secondary organic compound +60031 60031 Anthropogenic secondary organic compound +60032 60032 All hydroxy-peroxides products of the reaction of hydroxy-isoprene adducts with O2 ISOPOOH +60033 60033 Anthropogenic volatile organic compounds aVOC +60034 60034 Biomass burning volatile organic compounds bbVOC +# 60035-61999 Reserved +62000 62000 Total aerosol +62001 62001 Dust dry +62002 62002 Water in ambient +62003 62003 Ammonium dry +62004 62004 Nitrate dry +62005 62005 Nitric acid trihydrate +62006 62006 Sulphate dry +62007 62007 Mercury dry +62008 62008 Sea salt dry +62009 62009 Black carbon dry +62010 62010 Particulate organic matter dry +62011 62011 Primary particulate organic matter dry +62012 62012 Secondary particulate organic matter dry +62013 62013 Black carbon hydrophilic dry +62014 62014 Black carbon hydrophobic dry +62015 62015 Particulate organic matter hydrophilic dry +62016 62016 Particulate organic matter hydrophobic dry +62017 62017 Nitrate hydrophilic dry +62018 62018 Nitrate hydrophobic dry +# 62019 Reserved +62020 62020 Smoke - high absorption +62021 62021 Smoke - low absorption +62022 62022 Aerosol - high absorption +62023 62023 Aerosol - low absorption +# 62024 Reserved +62025 62025 Volcanic ash +62026 62026 Particulate matter (PM) +# 62027 Reserved +62028 62028 Total aerosol hydrophilic +62029 62029 Total aerosol hydrophobic +62030 62030 Primary particulate inorganic matter dry +62031 62031 Secondary particulate inorganic matter dry +62032 62032 Biogenic secondary organic aerosol +62033 62033 Anthropogenic secondary organic aerosol +62034 62034 Rain water H2Orain +62035 62035 Cloud water H2Ocloud +62036 62036 Brown carbon dry +# 62037-62099 Reserved +62100 62100 Alnus (alder) pollen +62101 62101 Betula (birch) pollen +62102 62102 Castanea (chestnut) pollen +62103 62103 Carpinus (hornbeam) pollen +62104 62104 Corylus (hazel) pollen +62105 62105 Fagus (beech) pollen +62106 62106 Fraxinus (ash) pollen +62107 62107 Pinus (pine) pollen +62108 62108 Platanus (plane) pollen +62109 62109 Populus (cottonwood, poplar) pollen +62110 62110 Quercus (oak) pollen +62111 62111 Salix (willow) pollen +62112 62112 Taxus (yew) pollen +62113 62113 Tilia (lime, linden) pollen +62114 62114 Ulmus (elm) pollen +62115 62115 Olea (olive) pollen +# 62116-62199 Reserved +62200 62200 Ambrosia (ragweed, burr-ragweed) pollen +62201 62201 Artemisia (sagebrush, wormwood, mugwort) pollen +62202 62202 Brassica (rape, broccoli, Brussels sprouts, cabbage, cauliflower, collards, kale, kohlrabi, mustard, rutabaga) pollen +62203 62203 Plantago (plantain) pollen +62204 62204 Rumex (dock, sorrel) pollen +62205 62205 Urtica (nettle) pollen +# 62206-62299 Reserved +62300 62300 Poaceae (grass family) pollen +# 62301-62999 Reserved +# 63000-65534 For experimental use at local level +65535 65535 Missing diff --git a/definitions/grib2/tables/33/4.233.table b/definitions/grib2/tables/33/4.233.table new file mode 100644 index 000000000..00b837c93 --- /dev/null +++ b/definitions/grib2/tables/33/4.233.table @@ -0,0 +1,601 @@ +# Code table 4.233 - Aerosol type +0 0 Ozone O3 +1 1 Water vapour H2O +2 2 Methane CH4 +3 3 Carbon dioxide CO2 +4 4 Carbon monoxide CO +5 5 Nitrogen dioxide NO2 +6 6 Nitrous oxide N2O +7 7 Formaldehyde HCHO +8 8 Sulphur dioxide SO2 +9 9 Ammonia NH3 +10 10 Ammonium cation NH4+ +11 11 Nitrogen monoxide NO +12 12 Atomic oxygen O +13 13 Nitrate radical NO3* +14 14 Hydroperoxyl radical HOO* +15 15 Dinitrogen pentoxide N2O5 +16 16 Nitrous acid HONO +17 17 Nitric acid HNO3 +18 18 Peroxynitric acid HO2NO2 +19 19 Hydrogen peroxide H2O2 +20 20 Dihydrogen H2 +21 21 Atomic nitrogen N +22 22 Sulphate anion SO42- +23 23 Atomic Radon Rn +24 24 Mercury vapour Hg(0) +25 25 Mercury(II) cation Hg2+ +26 26 Atomic chlorine Cl +27 27 Chlorine monoxide ClO +28 28 Dichlorine peroxide Cl2O2 +29 29 Hypochlorous acid HClO +30 30 Chlorine nitrate ClONO2 +31 31 Chlorine dioxide ClO2 +32 32 Atomic bromine Br +33 33 Bromine monoxide BrO +34 34 Bromine chloride BrCl +35 35 Hydrogen bromide HBr +36 36 Hypobromous acid HBrO +37 37 Bromine nitrate BrONO2 +38 38 Dioxygen O2 +39 39 Nitryl chloride NO2Cl +40 40 Sulphuric acid H2SO4 +41 41 Hydrogen sulphide H2S +42 42 Sulphur trioxide SO3 +43 43 Bromine Br2 +44 44 Hydrofluoric acid HF +45 45 Sulphur hexafluoride SF6 +46 46 Chlorine Cl2 +# 47-9999 Reserved +10000 10000 Hydroxyl radical HO* +10001 10001 Methyl peroxy radical CH3OO* +10002 10002 Methyl hydroperoxide CH3OOH +10004 10004 Methanol CH3OH +10005 10005 Formic acid HCOOH +10006 10006 Hydrogen cyanide HCN +10007 10007 Aceto nitrile CH3CN +10008 10008 Ethane C2H6 +10009 10009 Ethene (= Ethylene) C2H4 +10010 10010 Ethyne (= Acetylene) C2H2 +10011 10011 Ethanol C2H5OH +10012 10012 Acetic acid C2H5OOH +10013 10013 Peroxyacetyl nitrate CH3C(O)OONO2 +10014 10014 Propane C3H8 +10015 10015 Propene C3H6 +10016 10016 Butane (all isomers) C4H10 +10017 10017 Isoprene C5H10 +10018 10018 Alpha pinene C10H16 +10019 10019 Beta pinene C10H16 +10020 10020 Limonene C10H16 +10021 10021 Benzene C6H6 +10022 10022 Toluene C7H8 +10023 10023 Xylene C8H10 +10024 10024 Methanesulphonic acid CH3SO3H +10025 10025 Methylglyoxal (2-oxopropanal) CH3C(O)CHO +10026 10026 Peroxyacetyl radical CH3C(O)OO* +10027 10027 Methacrylic acid (2-methylprop-2-enoic acid) CH2C(CH3)COOH +10028 10028 Methacrolein (2-methylprop-2-enal) CH2C(CH3)CHO +10029 10029 Acetone (propan-2-one) CH3C(O)CH3 +10030 10030 Ethyl dioxidanyl radical CH3CH2OO* +10031 10031 Butadiene (buta-1,3-diene) (CH2CH)2 +10032 10032 Acetaldehyde (ethanal) CH3CHO +10033 10033 Glycolaldehyde (hydroxyethanal) HOCH2CHO +10034 10034 Cresol (methylphenol), all isomers CH3C6H4OH +10035 10035 Peracetic acid (ethaneperoxoic acid) CH3C(O)OOH +10036 10036 2-hydroxyethyl oxidanyl radical HOCH2CH2O* +10037 10037 2-hydroxyethyl dioxidanyl radical HOCH2CH2OO* +10038 10038 Glyoxal (oxaldehyde) OCHCHO +10039 10039 Isopropyl dioxidanyl radical (CH3)2CHOO* +10040 10040 Isopropyl hydroperoxide (2-hydroperoxypropane) (CH3)2CHOOH +10041 10041 Hydroxyacetone (1-hydroxypropan-2-one) CH3C(O)CH2OH +10042 10042 Peroxyacetic acid (ethaneperoxoic acid) CH3C(O)OOH +10043 10043 Methyl vinyl ketone (but-3-en-2-one) CH3C(O)CHCH2 +10044 10044 Phenoxy radical C6H5O* +10045 10045 Methyl radical CH3* +10046 10046 Carbonyl sulphide (carbon oxide sulphide) OCS +10047 10047 Dibromomethane CH2Br2 +10048 10048 Methoxy radical CH3O* +10049 10049 Tribromomethane CHBr3 +10050 10050 Formyl radical (oxomethyl radical) HOC* +10051 10051 Hydroxymethyl dioxidanyl radical HOCH2OO* +10052 10052 Ethyl hydroperoxide CH3CH2OOH +10053 10053 3-hydroxypropyl dioxidanyl radical HOCH2CH2CH2OO* +10054 10054 3-hydroxypropyl hydroperoxide HOCH2CH2CH2OOH +10055 10055 Methyl-peroxy-nitrate (nitroperoxy-methane) CH3OONO2 +10056 10056 2-lambda^1-oxidanyloxy-2-methylbut-3-en-1-ol (4-hydroxy-3-methyl-1-butene-3-ylperoxy radical) HOCH2C(CH3)(OO*)CHCH2 +10057 10057 2-lambda^1-oxidanyloxy-3-methylbut-3-en-1-ol (2-hydroxy-1-isopropenylethylperoxy radical) HOCH2CH(OO*)C(CH3)CH2 +10058 10058 (Z)-4-hydroperoxy-2-methyl-2-butenal CH2(OOH)CHC(CH3)CHO +10059 10059 (Z)-4-hydroperoxy-3-methyl-2-butenal CH2(OOH)C(CH3)CHCHO +# 10060-10499 Reserved for other simple organic molecules (e.g. higher aldehydes, alcohols, peroxides, etc.) +10500 10500 Dimethyl sulphide CH3SCH3 (DMS) +10501 10501 DMSO (dimethyl sulfoxide) (CH3)2SO +# 10502-20000 Reserved +20001 20001 Hydrogen chloride HCl +20002 20002 CFC-11 (trichlorofluoromethane) CCl3F +20003 20003 CFC-12 (dichlorodifluoromethane) CCl2F2 +20004 20004 CFC-113 (1,1,2-trichloro-1,2,2-trifluoroethane) Cl2FC-CClF2 +20005 20005 CFC-113a (1,1,1-trichloro-2,2,2-trifluoroethane) Cl3C-CF3 +20006 20006 CFC-114 (1,2-dichloro-1,1,2,2-tetrafluoroethane) ClF2C-CClF2 +20007 20007 CFC-115 (1-chloro-1,1,2,2,2-pentafluoroethane) ClF2C-CF3 +20008 20008 HCFC-22 (chlorodifluoromethane) CHClF2 +20009 20009 HCFC-141b (1,1-dichloro-1-fluoroethane) Cl2FC-CH3 +20010 20010 HCFC-142b (1-chloro-1,1-difluoroethane) ClF2C-CH3 +20011 20011 Halon-1202 (dibromodifluoromethane) CBr2F2 +20012 20012 Halon-1211 (bromochlorodifluoromethane) CBrClF2 +20013 20013 Halon-1301 (bromotrifluoromethane) CBrF3 +20014 20014 Halon-2402 (1,2-dibromo-1,1,2,2-tetrafluoroethane) BrF2C-CBrF2 +20015 20015 HCC-40 (methyl chloride) CH3Cl +20016 20016 HCC-10 (carbon tetrachloride) CCl4 +20017 20017 HCC-140a (1,1,1-trichloroethane) Cl3C-CH3 +20018 20018 HBC-40B1 (methyl bromide) CH3Br +20019 20019 HCH (hexachlorocyclohexane) all isomers C6H6Cl6 +20020 20020 alpha-HCH (alpha-hexachlorocyclohexane) both enantiomers alpha-C6H6Cl6 +20021 20021 PCB-153 (2,2',4,4',5,5'-hexachlorobiphenyl) (C6H2Cl3)2 +20022 20022 HCFC-141a (1,1-dichloro-2-fluoroethane) Cl2HC-CH2F +# 20023-29999 Reserved +30000 30000 Radioactive pollutant (tracer, defined by originating centre) +# 30001-30009 Reserved +30010 30010 Tritium (Hydrogen 3) H-3 +30011 30011 Tritium organic bounded H-3o +30012 30012 Tritium inorganic H-3a +30013 30013 Beryllium 7 Be-7 +30014 30014 Beryllium 10 Be-10 +30015 30015 Carbon 14 C-14 +30016 30016 Carbon 14 CO2 C-14CO2 +30017 30017 Carbon 14 other gases C-14og +30018 30018 Nitrogen 13 N-13 +30019 30019 Nitrogen 16 N-16 +30020 30020 Fluorine 18 F-18 +30021 30021 Sodium 22 Na-22 +30022 30022 Phosphate 32 P-32 +30023 30023 Phosphate 33 P-33 +30024 30024 Sulphur 35 S-35 +30025 30025 Chlorine 36 Cl-36 +30026 30026 Potassium 40 K-40 +30027 30027 Argon 41 Ar-41 +30028 30028 Calcium 41 Ca-41 +30029 30029 Calcium 45 Ca-45 +30030 30030 Titanium 44 Ti-44 +30031 30031 Scandium 46 Sc-46 +30032 30032 Vanadium 48 V-48 +30033 30033 Vanadium 49 V-49 +30034 30034 Chrome 51 Cr-51 +30035 30035 Manganese 52 Mn-52 +30036 30036 Manganese 54 Mn-54 +30037 30037 Iron 55 Fe-55 +30038 30038 Iron 59 Fe-59 +30039 30039 Cobalt 56 Co-56 +30040 30040 Cobalt 57 Co-57 +30041 30041 Cobalt 58 Co-58 +30042 30042 Cobalt 60 Co-60 +30043 30043 Nickel 59 Ni-59 +30044 30044 Nickel 63 Ni-63 +30045 30045 Zinc 65 Zn-65 +30046 30046 Gallium 67 Ga-67 +30047 30047 Gallium 68 Ga-68 +30048 30048 Germanium 68 Ge-68 +30049 30049 Germanium 69 Ge-69 +30050 30050 Arsenic 73 As-73 +30051 30051 Selenium 75 Se-75 +30052 30052 Selenium 79 Se-79 +30053 30053 Rubidium 81 Rb-81 +30054 30054 Rubidium 83 Rb-83 +30055 30055 Rubidium 84 Rb-84 +30056 30056 Rubidium 86 Rb-86 +30057 30057 Rubidium 87 Rb-87 +30058 30058 Rubidium 88 Rb-88 +30059 30059 Krypton 85 Kr-85 +30060 30060 Krypton 85 metastable Kr-85m +30061 30061 Krypton 87 Kr-87 +30062 30062 Krypton 88 Kr-88 +30063 30063 Krypton 89 Kr-89 +30064 30064 Strontium 85 Sr-85 +30065 30065 Strontium 89 Sr-89 +30066 30066 Strontium 89/90 Sr-8990 +30067 30067 Strontium 90 Sr-90 +30068 30068 Strontium 91 Sr-91 +30069 30069 Strontium 92 Sr-92 +30070 30070 Yttrium 87 Y-87 +30071 30071 Yttrium 88 Y-88 +30072 30072 Yttrium 90 Y-90 +30073 30073 Yttrium 91 Y-91 +30074 30074 Yttrium 91 metastable Y-91m +30075 30075 Yttrium 92 Y-92 +30076 30076 Yttrium 93 Y-93 +30077 30077 Zirconium 89 Zr-89 +30078 30078 Zirconium 93 Zr-93 +30079 30079 Zirconium 95 Zr-95 +30080 30080 Zirconium 97 Zr-97 +30081 30081 Niobium 93 metastable Nb-93m +30082 30082 Niobium 94 Nb-94 +30083 30083 Niobium 95 Nb-95 +30084 30084 Niobium 95 metastable Nb-95m +30085 30085 Niobium 97 Nb-97 +30086 30086 Niobium 97 metastable Nb-97m +30087 30087 Molybdenum 93 Mo-93 +30088 30088 Molybdenum 99 Mo-99 +30089 30089 Technetium 95 metastable Tc-95m +30090 30090 Technetium 96 Tc-96 +30091 30091 Technetium 99 Tc-99 +30092 30092 Technetium 99 metastable Tc-99m +30093 30093 Rhodium 99 Rh-99 +30094 30094 Rhodium 101 Rh-101 +30095 30095 Rhodium 102 metastable Rh-102m +30096 30096 Rhodium 103 metastable Rh-103m +30097 30097 Rhodium 105 Rh-105 +30098 30098 Rhodium 106 Rh-106 +30099 30099 Palladium 100 Pd-100 +30100 30100 Palladium 103 Pd-103 +30101 30101 Palladium 107 Pd-107 +30102 30102 Ruthenium 103 Ru-103 +30103 30103 Ruthenium 105 Ru-105 +30104 30104 Ruthenium 106 Ru-106 +30105 30105 Silver 108 metastable Ag-108m +30106 30106 Silver 110 metastable Ag-110m +30107 30107 Cadmium 109 Cd-109 +30108 30108 Cadmium 113 metastable Cd-113m +30109 30109 Cadmium 115 metastable Cd-115m +30110 30110 Indium 114 metastable In-114m +30111 30111 Tin 113 Sn-113 +30112 30112 Tin 119 metastable Sn-119m +30113 30113 Tin 121 metastable Sn-121m +30114 30114 Tin 122 Sn-122 +30115 30115 Tin 123 Sn-123 +30116 30116 Tin 126 Sn-126 +30117 30117 Antimony 124 Sb-124 +30118 30118 Antimony 125 Sb-125 +30119 30119 Antimony 126 Sb-126 +30120 30120 Antimony 127 Sb-127 +30121 30121 Antimony 129 Sb-129 +30122 30122 Tellurium 123 metastable Te-123m +30123 30123 Tellurium 125 metastable Te-125m +30124 30124 Tellurium 127 Te-127 +30125 30125 Tellurium 127 metastable Te-127m +30126 30126 Tellurium 129 Te-129 +30127 30127 Tellurium 129 metastable Te-129m +30128 30128 Tellurium 131 metastable Te-131m +30129 30129 Tellurium 132 Te-132 +30130 30130 Iodine 123 I-123 +30131 30131 Iodine 124 I-124 +30132 30132 Iodine 125 I-125 +30133 30133 Iodine 126 I-126 +30134 30134 Iodine 129 I-129 +30135 30135 Iodine 129 elementary gaseous I-129g +30136 30136 Iodine 129 organic bounded I-129o +30137 30137 Iodine 131 I-131 +30138 30138 Iodine 131 elementary gaseous I-131g +30139 30139 Iodine 131 organic bounded I-131o +30140 30140 Iodine 131 gaseous elementary and organic bounded I-131go +30141 30141 Iodine 131 aerosol I-131a +30142 30142 Iodine 132 I-132 +30143 30143 Iodine 132 elementary gaseous I-132g +30144 30144 Iodine 132 organic bounded I-132o +30145 30145 Iodine 132 gaseous elementary and organic bounded I-132go +30146 30146 Iodine 132 aerosol I-132a +30147 30147 Iodine 133 I-133 +30148 30148 Iodine 133 elementary gaseous I-133g +30149 30149 Iodine 133 organic bounded I-133o +30150 30150 Iodine 133 gaseous elementary and organic bounded I-133go +30151 30151 Iodine 133 aerosol I-133a +30152 30152 Iodine 134 I-134 +30153 30153 Iodine 134 elementary gaseous I-134g +30154 30154 Iodine 134 organic bounded I-134o +30155 30155 Iodine 135 I-135 +30156 30156 Iodine 135 elementary gaseous I-135g +30157 30157 Iodine 135 organic bounded I-135o +30158 30158 Iodine 135 gaseous elementary and organic bounded I-135go +30159 30159 Iodine 135 aerosol I-135a +30160 30160 Xenon 131 metastable Xe-131m +30161 30161 Xenon 133 Xe-133 +30162 30162 Xenon 133 metastable Xe-133m +30163 30163 Xenon 135 Xe-135 +30164 30164 Xenon 135 metastable Xe-135m +30165 30165 Xenon 137 Xe-137 +30166 30166 Xenon 138 Xe-138 +30167 30167 Xenon sum of all Xenon isotopes Xe-sum +30168 30168 Caesium 131 Cs-131 +30169 30169 Caesium 134 Cs-134 +30170 30170 Caesium 135 Cs-135 +30171 30171 Caesium 136 Cs-136 +30172 30172 Caesium 137 Cs-137 +30173 30173 Barium 133 Ba-133 +30174 30174 Barium 137 metastable Ba-137m +30175 30175 Barium 140 Ba-140 +30176 30176 Cerium 139 Ce-139 +30177 30177 Cerium 141 Ce-141 +30178 30178 Cerium 143 Ce-143 +30179 30179 Cerium 144 Ce-144 +30180 30180 Lanthanum 140 La-140 +30181 30181 Lanthanum 141 La-141 +30182 30182 Praseodymium 143 Pr-143 +30183 30183 Praseodymium 144 Pr-144 +30184 30184 Praseodymium 144 metastable Pr-144m +30185 30185 Samarium 145 Sm-145 +30186 30186 Samarium 147 Sm-147 +30187 30187 Samarium 151 Sm-151 +30188 30188 Neodymium 147 Nd-147 +30189 30189 Promethium 146 Pm-146 +30190 30190 Promethium 147 Pm-147 +30191 30191 Promethium 151 Pm-151 +30192 30192 Europium 152 Eu-152 +30193 30193 Europium 154 Eu-154 +30194 30194 Europium 155 Eu-155 +30195 30195 Gadolinium 153 Gd-153 +30196 30196 Terbium 160 Tb-160 +30197 30197 Holmium 166 metastable Ho-166m +30198 30198 Thulium 170 Tm-170 +30199 30199 Ytterbium 169 Yb-169 +30200 30200 Hafnium 175 Hf-175 +30201 30201 Hafnium 181 Hf-181 +30202 30202 Tantalum 179 Ta-179 +30203 30203 Tantalum 182 Ta-182 +30204 30204 Rhenium 184 Re-184 +30205 30205 Iridium 192 Ir-192 +30206 30206 Mercury 203 Hg-203 +30207 30207 Thallium 204 Tl-204 +30208 30208 Thallium 207 Tl-207 +30209 30209 Thallium 208 Tl-208 +30210 30210 Thallium 209 Tl-209 +30211 30211 Bismuth 205 Bi-205 +30212 30212 Bismuth 207 Bi-207 +30213 30213 Bismuth 210 Bi-210 +30214 30214 Bismuth 211 Bi-211 +30215 30215 Bismuth 212 Bi-212 +30216 30216 Bismuth 213 Bi-213 +30217 30217 Bismuth 214 Bi-214 +30218 30218 Polonium 208 Po-208 +30219 30219 Polonium 210 Po-210 +30220 30220 Polonium 212 Po-212 +30221 30221 Polonium 213 Po-213 +30222 30222 Polonium 214 Po-214 +30223 30223 Polonium 215 Po-215 +30224 30224 Polonium 216 Po-216 +30225 30225 Polonium 218 Po-218 +30226 30226 Lead 209 Pb-209 +30227 30227 Lead 210 Pb-210 +30228 30228 Lead 211 Pb-211 +30229 30229 Lead 212 Pb-212 +30230 30230 Lead 214 Pb-214 +30231 30231 Astatine 217 At-217 +30232 30232 Radon 219 Rn-219 +30233 30233 Radon 220 Rn-220 +30234 30234 Radon 222 Rn-222 +30235 30235 Francium 221 Fr-221 +30236 30236 Francium 223 Fr-223 +30237 30237 Radium 223 Ra-223 +30238 30238 Radium 224 Ra-224 +30239 30239 Radium 225 Ra-225 +30240 30240 Radium 226 Ra-226 +30241 30241 Radium 228 Ra-228 +30242 30242 Actinium 225 Ac-225 +30243 30243 Actinium 227 Ac-227 +30244 30244 Actinium 228 Ac-228 +30245 30245 Thorium 227 Th-227 +30246 30246 Thorium 228 Th-228 +30247 30247 Thorium 229 Th-229 +30248 30248 Thorium 230 Th-230 +30249 30249 Thorium 231 Th-231 +30250 30250 Thorium 232 Th-232 +30251 30251 Thorium 234 Th-234 +30252 30252 Protactinium 231 Pa-231 +30253 30253 Protactinium 233 Pa-233 +30254 30254 Protactinium 234 metastable Pa-234m +30255 30255 Uranium 232 U-232 +30256 30256 Uranium 233 U-233 +30257 30257 Uranium 234 U-234 +30258 30258 Uranium 235 U-235 +30259 30259 Uranium 236 U-236 +30260 30260 Uranium 237 U-237 +30261 30261 Uranium 238 U-238 +30262 30262 Plutonium 236 Pu-236 +30263 30263 Plutonium 238 Pu-238 +30264 30264 Plutonium 239 Pu-239 +30265 30265 Plutonium 240 Pu-240 +30266 30266 Plutonium 241 Pu-241 +30267 30267 Plutonium 242 Pu-242 +30268 30268 Plutonium 244 Pu-244 +30269 30269 Neptunium 237 Np-237 +30270 30270 Neptunium 238 Np-238 +30271 30271 Neptunium 239 Np-239 +30272 30272 Americium 241 Am-241 +30273 30273 Americium 242 Am-242 +30274 30274 Americium 242 metastable Am-242m +30275 30275 Americium 243 Am-243 +30276 30276 Curium 242 Cm-242 +30277 30277 Curium 243 Cm-243 +30278 30278 Curium 244 Cm-244 +30279 30279 Curium 245 Cm-245 +30280 30280 Curium 246 Cm-246 +30281 30281 Curium 247 Cm-247 +30282 30282 Curium 248 Cm-248 +30283 30283 Curium 243/244 Cm-243244 +30284 30284 Plutonium 238/Americium 241 Pu-238Am-241 +30285 30285 Plutonium 239/240 Pu-239240 +30286 30286 Berkelium 249 Bk-249 +30287 30287 Californium 249 Cf-249 +30288 30288 Californium 250 Cf-250 +30289 30289 Californium 252 Cf-252 +30290 30290 Sum aerosol particulates SumAer +30291 30291 Sum Iodine SumIod +30292 30292 Sum noble gas SumNG +30293 30293 Activation gas ActGas +30294 30294 Cs-137 Equivalent EquCs137 +30295 30295 Carbon-13 C-13 +30296 30296 Lead Pb +30297 30297 Tellurium 131 Te-131 +30298 30298 Neodymium 137 Nd-137 +30299 30299 Pseudo radionuclide +30300 30300 Silver 112 Ag-112 +30301 30301 Silver 115 Ag-115 +30302 30302 Barium 139 Ba-139 +30303 30303 Barium 141 Ba-141 +30304 30304 Barium 142 Ba-142 +30305 30305 Bromine 84 Br-84 +30306 30306 Cadminum 115 Cd-115 +30307 30307 Cadminum 117 Cd-117 +30308 30308 Cadminum 117 metastable Cd-117m +30309 30309 Cerium 145 Ce-145 +30310 30310 Cerium 146 Ce-146 +30311 30311 Cobalt 58 metastable Co-58m +30312 30312 Ceasium 138 Cs-138 +30313 30313 Ceasium 139 Cs-139 +30314 30314 Iodine 130 aerosol I-130a +30315 30315 Iodine 130 elementary gaseous I-130e +30316 30316 Iodine 130 organic bounded I-130o +30317 30317 Iodine 132 metastable I-132m +30318 30318 Iodine 134 metastable I-134m +30319 30319 Indium 115 metastable In-115m +30320 30320 Indium 117 metastable In-117m +30321 30321 Krypton 83 metastable Kr-83m +30322 30322 Lanthanum 142 La-142 +30323 30323 Lanthanum 143 La-143 +30324 30324 Manganese 56 Mn-56 +30325 30325 Molybdenum 101 Mo-101 +30326 30326 Molybdenum 102 Mo-102 +30327 30327 Neodymium 149 Nd-149 +30328 30328 Neodymium 151 Nd-151 +30329 30329 Palladium 109 Pd-109 +30330 30330 Palladium 112 Pd-112 +30331 30331 Praseodymium 145 Pr-145 +30332 30332 Praseodymium 146 Pr-146 +30333 30333 Praseodymium 147 Pr-147 +30334 30334 Rubidium 89 Rb-89 +30335 30335 Rubidium 90 Rb-90 +30336 30336 Rubidium 90 metastable Rb-90m +30337 30337 Rhodium 105 metastable Rh-105m +30338 30338 Rhodium 107 Rh-107 +30339 30339 Antimony 128 Sb-128 +30340 30340 Antimony 128 metastable Sb-128m +30341 30341 Antimony 129 metastable Sb-129m +30342 30342 Antimony 130 Sb-130 +30343 30343 Antimony 130 metastable Sb-130m +30344 30344 Antimony 131 Sb-131 +30345 30345 Antimony 132 Sb-132 +30346 30346 Antimony 132 metastable Sb-132m +30347 30347 Antimony 133 Sb-133 +30348 30348 Selenium 83 Se-83 +30349 30349 Tin 127 Sn-127 +30350 30350 Tin 127 metastable Sn-127m +30351 30351 Tin 128 Sn-128 +30352 30352 Tin 129 metastable Sn-129m +30353 30353 Tin 130 Sn-130 +30354 30354 Strontium 93 Sr-93 +30355 30355 Technetium 101 Tc-101 +30356 30356 Technetium 102 Tc-102 +30357 30357 Technetium 104 Tc-104 +30358 30358 Technetium 105 Tc-105 +30359 30359 Tellurium 133 Te-133 +30360 30360 Tellurium 133 metastable Te-133m +30361 30361 Tellurium 134 Te-134 +30362 30362 Yttrium 93 metastable Y-93m +30363 30363 Yttrium 94 Y-94 +30364 30364 Yttrium 95 Y-95 +30365 30365 Zirconium 96 Zr-96 +# 30366-39999 Reserved +40000 40000 Singlet sigma oxygen (dioxygen (sigma singlet)) O2 +40001 40001 Singlet delta oxygen (dioxygen (delta singlet)) O2 +40002 40002 Singlet excited oxygen atom O(1D) +40003 40003 Triplet ground state oxygen atom O(3P) +# 40004-59999 Reserved +60000 60000 HOx radical (OH+HO2) HOx* +60001 60001 Total inorganic and organic peroxy radicals (HOO* + ROO*) ROO* +60002 60002 Passive Ozone +60003 60003 NOx expressed as nitrogen NOx +60004 60004 All nitrogen oxides (NOy) expressed as nitrogen NOy +60005 60005 Total inorganic chlorine Clx +60006 60006 Total inorganic bromine Brx +60007 60007 Total inorganic chlorine except HCl, ClONO2: ClOx +60008 60008 Total inorganic bromine except HBr, BrONO2: BrOx +60009 60009 Lumped alkanes +60010 60010 Lumped alkenes +60011 60011 Lumped aromatic compounds +60012 60012 Lumped terpenes +60013 60013 Non-methane volatile organic compounds expressed as carbon NMVOC +60014 60014 Anthropogenic non-methane volatile organic compounds expressed as carbon aNMVOC +60015 60015 Biogenic non-methane volatile organic compounds expressed as carbon bNMVOC +60016 60016 Lumped oxygenated hydrocarbons OVOC +60017 60017 NOx expressed as nitrogen dioxide (NO2) NOx +60018 60018 Organic aldehydes RCHO +60019 60019 Organic peroxides ROOH +60020 60020 Organic nitrates RNO3 +60021 60021 Ethers ROR' +60022 60022 Amines NRR'R'' +60023 60023 Ketones RC(O)R' +60024 60024 Dicarbonyls unsaturated RC(O)CH2C(O)R' +60025 60025 Hydroxy dicarbonyls unsaturated RC(O)CHOHC(O)R' +60026 60026 Hydroxy ketones RC(OH)C(O)R' +60027 60027 Oxides Ox +60028 60028 Peroxyacyl nitrates RC(O)OONO2 +60029 60029 Aromatic peroxide radical (Aryl dioxydanyl radicals) ArOO* +60030 60030 Biogenic secondary organic compound +60031 60031 Anthropogenic secondary organic compound +60032 60032 All hydroxy-peroxides products of the reaction of hydroxy-isoprene adducts with O2 ISOPOOH +60033 60033 Anthropogenic volatile organic compounds aVOC +60034 60034 Biomass burning volatile organic compounds bbVOC +# 60035-61999 Reserved +62000 62000 Total aerosol +62001 62001 Dust dry +62002 62002 Water in ambient +62003 62003 Ammonium dry +62004 62004 Nitrate dry +62005 62005 Nitric acid trihydrate +62006 62006 Sulphate dry +62007 62007 Mercury dry +62008 62008 Sea salt dry +62009 62009 Black carbon dry +62010 62010 Particulate organic matter dry +62011 62011 Primary particulate organic matter dry +62012 62012 Secondary particulate organic matter dry +62013 62013 Black carbon hydrophilic dry +62014 62014 Black carbon hydrophobic dry +62015 62015 Particulate organic matter hydrophilic dry +62016 62016 Particulate organic matter hydrophobic dry +62017 62017 Nitrate hydrophilic dry +62018 62018 Nitrate hydrophobic dry +# 62019 Reserved +62020 62020 Smoke - high absorption +62021 62021 Smoke - low absorption +62022 62022 Aerosol - high absorption +62023 62023 Aerosol - low absorption +# 62024 Reserved +62025 62025 Volcanic ash +62026 62026 Particulate matter (PM) +# 62027 Reserved +62028 62028 Total aerosol hydrophilic +62029 62029 Total aerosol hydrophobic +62030 62030 Primary particulate inorganic matter dry +62031 62031 Secondary particulate inorganic matter dry +62032 62032 Biogenic secondary organic aerosol +62033 62033 Anthropogenic secondary organic aerosol +62034 62034 Rain water H2Orain +62035 62035 Cloud water H2Ocloud +62036 62036 Brown carbon dry +# 62037-62099 Reserved +62100 62100 Alnus (alder) pollen +62101 62101 Betula (birch) pollen +62102 62102 Castanea (chestnut) pollen +62103 62103 Carpinus (hornbeam) pollen +62104 62104 Corylus (hazel) pollen +62105 62105 Fagus (beech) pollen +62106 62106 Fraxinus (ash) pollen +62107 62107 Pinus (pine) pollen +62108 62108 Platanus (plane) pollen +62109 62109 Populus (cottonwood, poplar) pollen +62110 62110 Quercus (oak) pollen +62111 62111 Salix (willow) pollen +62112 62112 Taxus (yew) pollen +62113 62113 Tilia (lime, linden) pollen +62114 62114 Ulmus (elm) pollen +62115 62115 Olea (olive) pollen +# 62116-62199 Reserved +62200 62200 Ambrosia (ragweed, burr-ragweed) pollen +62201 62201 Artemisia (sagebrush, wormwood, mugwort) pollen +62202 62202 Brassica (rape, broccoli, Brussels sprouts, cabbage, cauliflower, collards, kale, kohlrabi, mustard, rutabaga) pollen +62203 62203 Plantago (plantain) pollen +62204 62204 Rumex (dock, sorrel) pollen +62205 62205 Urtica (nettle) pollen +# 62206-62299 Reserved +62300 62300 Poaceae (grass family) pollen +# 62301-62999 Reserved +# 63000-65534 For experimental use at local level +65535 65535 Missing diff --git a/definitions/grib2/tables/33/4.234.table b/definitions/grib2/tables/33/4.234.table new file mode 100644 index 000000000..3b05b4515 --- /dev/null +++ b/definitions/grib2/tables/33/4.234.table @@ -0,0 +1,21 @@ +# Code table 4.234 - Canopy cover fraction (to be used as partitioned parameter in product definition template 4.53 or 4.54) +1 1 Crops, mixed farming +2 2 Short grass +3 3 Evergreen needleleaf trees +4 4 Deciduous needleleaf trees +5 5 Deciduous broadleaf trees +6 6 Evergreen broadleaf trees +7 7 Tall grass +8 8 Desert +9 9 Tundra +10 10 Irrigated crops +11 11 Semidesert +12 12 Ice caps and glaciers +13 13 Bogs and marshes +14 14 Inland water +15 15 Ocean +16 16 Evergreen shrubs +17 17 Deciduous shrubs +18 18 Mixed forest +19 19 Interrupted forest +20 20 Water and land mixtures diff --git a/definitions/grib2/tables/33/4.236.table b/definitions/grib2/tables/33/4.236.table new file mode 100644 index 000000000..9c58b488c --- /dev/null +++ b/definitions/grib2/tables/33/4.236.table @@ -0,0 +1,8 @@ +# Code table 4.236 - Soil texture fraction (to be used as partitioned parameter in product definition template 4.53 or 4.54) +1 1 Coarse +2 2 Medium +3 3 Medium-fine +4 4 Fine +5 5 Very-fine +6 6 Organic +7 7 Tropical-organic diff --git a/definitions/grib2/tables/33/4.238.table b/definitions/grib2/tables/33/4.238.table new file mode 100644 index 000000000..cd8b5cba8 --- /dev/null +++ b/definitions/grib2/tables/33/4.238.table @@ -0,0 +1,34 @@ +# Code table 4.238 - Source or sink +0 0 Other +1 1 Aviation +2 2 Lightning +3 3 Biogenic sources +4 4 Anthropogenic sources +5 5 Wild fires +6 6 Natural sources +7 7 Volcanoes +8 8 Bio-fuel +9 9 Fossil-fuel +10 10 Wetlands +11 11 Oceans +12 12 Elevated anthropogenic sources +13 13 Surface anthropogenic sources +14 14 Agriculture livestock +15 15 Agriculture soils +16 16 Agriculture waste burning +17 17 Agriculture (all) +18 18 Residential, commercial and other combustion +19 19 Power generation +20 20 Super power stations +21 21 Fugitives +22 22 Industrial process +23 23 Solvents +24 24 Ships +25 25 Wastes (solid and water) +26 26 Road transportation +27 27 Off-road transportation +28 28 Nuclear power plant +29 29 Nuclear weapon +# 30-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.239.table b/definitions/grib2/tables/33/4.239.table new file mode 100644 index 000000000..f095b14a0 --- /dev/null +++ b/definitions/grib2/tables/33/4.239.table @@ -0,0 +1,17 @@ +# Code table 4.239 - Wetland Type +0 0 Reserved +1 1 Bog +2 2 Drained +3 3 Fen +4 4 Floodplain +5 5 Mangrove +6 6 Marsh +7 7 Rice +8 8 Riverine +9 9 Salt marsh +10 10 Swamp +11 11 Upland +12 12 Wet tundra +# 13-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.240.table b/definitions/grib2/tables/33/4.240.table new file mode 100644 index 000000000..2a31fb2ab --- /dev/null +++ b/definitions/grib2/tables/33/4.240.table @@ -0,0 +1,13 @@ +# Code table 4.240 - Type of distribution function +0 0 No specific distribution function given +1 1 Delta functions with spatially variable concentration and fixed diameters Dl (p1) in metre +2 2 Delta functions with spatially variable concentration and fixed masses Ml (p1) in kg +3 3 Gaussian (normal) distribution with spatially variable concentration and fixed mean diameter Dl(p1) and variance(p2) +4 4 Gaussian (normal) distribution with spatially variable concentration, mean diameter and variance +5 5 Log-normal distribution with spatially variable number density, mean diameter and variance +6 6 Log-normal distribution with spatially variable number density, mean diameter and fixed variance(p1) +7 7 Log-normal distribution with spatially variable number density and mass density and fixed variance(p1) and fixed particle density(p2) +8 8 No distribution function. The encoded variable is derived from variables characterized by type of distribution function of type No. 7 (see above) with fixed variance(p1) and fixed particle density(p2) +# 9-49151 Reserved +# 49152-65534 Reserved for local use +65535 65535 Missing value diff --git a/definitions/grib2/tables/33/4.241.table b/definitions/grib2/tables/33/4.241.table new file mode 100644 index 000000000..743e5f6e2 --- /dev/null +++ b/definitions/grib2/tables/33/4.241.table @@ -0,0 +1,12 @@ +# Code table 4.241 - Coverage attributes +0 UNDEF Undefined +1 UNMOD Unmodified +2 SNOW Snow covered +3 FLOOD Flooded +4 ICE Ice covered +5 ITCW With intercepted water +6 ITCS With intercepted snow +7 AGG Aggregated +# 8-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/33/4.242.table b/definitions/grib2/tables/33/4.242.table new file mode 100644 index 000000000..9574142da --- /dev/null +++ b/definitions/grib2/tables/33/4.242.table @@ -0,0 +1,10 @@ +# Code table 4.242 - Tile classification +0 0 Reserved +1 GCV2009 Land use classes according to ESA-GlobCover GCV2009 +2 GLC2000 Land use classes according to European Commission-Global Land Cover Project GLC2000 +3 ECOCLIMAP Land use classes according to ECOCLIMAP +4 ECOCLIMAP-SG Land use classes according to ECOCLIMAP-SG +5 GLCCv2BATS Land use classes according to USGS EROS Global Land Cover Characterization (GLCC) v2.0 BATS Classification +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/33/4.243.table b/definitions/grib2/tables/33/4.243.table new file mode 100644 index 000000000..24d21b719 --- /dev/null +++ b/definitions/grib2/tables/33/4.243.table @@ -0,0 +1,43 @@ +# Code table 4.243 - Tile class +0 0 Reserved +1 1 Evergreen broadleaved forest +2 2 Deciduous broadleaved closed forest +3 3 Deciduous broadleaved open forest +4 4 Evergreen needle-leaf forest +5 5 Deciduous needle-leaf forest +6 6 Mixed leaf trees +7 7 Freshwater flooded trees +8 8 Saline water flooded trees +9 9 Mosaic tree/natural vegetation +10 10 Burnt tree cover +11 11 Evergreen shrubs closed-open +12 12 Deciduous shrubs closed-open +13 13 Herbaceous vegetation closed-open +14 14 Sparse herbaceous or grass +15 15 Flooded shrubs or herbaceous +16 16 Cultivated and managed areas +17 17 Mosaic crop/tree/natural vegetation +18 18 Mosaic crop/shrub/grass +19 19 Bare areas +20 20 Water +21 21 Snow and ice +22 22 Artificial surface +23 23 Ocean +24 24 Irrigated croplands +25 25 Rainfed croplands +26 26 Mosaic cropland (50-70%) - vegetation (20-50%) +27 27 Mosaic vegetation (50-70%) - cropland (20-50%) +28 28 Closed broadleaved evergreen forest +29 29 Closed needle-leaved evergreen forest +30 30 Open needle-leaved deciduous forest +31 31 Mixed broadleaved and needle-leaved forest +32 32 Mosaic shrubland (50-70%) - grassland (20-50%) +33 33 Mosaic grassland (50-70%) - shrubland (20-50%) +34 34 Closed to open shrubland +35 35 Sparse vegetation +36 36 Closed to open forest regularly flooded +37 37 Closed forest or shrubland permanently flooded +38 38 Closed to open grassland regularly flooded +39 39 Undefined +# 40-32767 Reserved +# 32768- Reserved for local use diff --git a/definitions/grib2/tables/33/4.244.table b/definitions/grib2/tables/33/4.244.table new file mode 100644 index 000000000..a4470cd56 --- /dev/null +++ b/definitions/grib2/tables/33/4.244.table @@ -0,0 +1,7 @@ +# Code table 4.244 - Quality indicator +0 0 No quality information available +1 1 Failed +2 2 Passed +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.246.table b/definitions/grib2/tables/33/4.246.table new file mode 100644 index 000000000..0ca9c0c98 --- /dev/null +++ b/definitions/grib2/tables/33/4.246.table @@ -0,0 +1,7 @@ +# Code table 4.246 - Thunderstorm intensity +0 0 No thunderstorm occurrence +1 1 Weak thunderstorm +2 2 Moderate thunderstorm +3 3 Severe thunderstorm +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/4.247.table b/definitions/grib2/tables/33/4.247.table new file mode 100644 index 000000000..6da16e396 --- /dev/null +++ b/definitions/grib2/tables/33/4.247.table @@ -0,0 +1,7 @@ +# Code table 4.247 - Precipitation intensity +0 0 No precipitation occurrence +1 1 Light precipitation +2 2 Moderate precipitation +3 3 Heavy precipitation +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/4.248.table b/definitions/grib2/tables/33/4.248.table new file mode 100644 index 000000000..04e365c97 --- /dev/null +++ b/definitions/grib2/tables/33/4.248.table @@ -0,0 +1,6 @@ +# Code table 4.248 - Method used to derive data values for a given local time +0 0 Nearest forecast or analysis time to specified local time +1 1 Interpolated to be valid at the specified local time +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.249.table b/definitions/grib2/tables/33/4.249.table new file mode 100644 index 000000000..bd1c944c4 --- /dev/null +++ b/definitions/grib2/tables/33/4.249.table @@ -0,0 +1,7 @@ +# Code table 4.249 - Character of precipitation +0 0 None +1 1 Showers +2 2 Intermittent +3 3 Continuous +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/4.250.table b/definitions/grib2/tables/33/4.250.table new file mode 100644 index 000000000..a249158ca --- /dev/null +++ b/definitions/grib2/tables/33/4.250.table @@ -0,0 +1,14 @@ +# Code table 4.250 - Drainage direction +0 0 Reserved +1 1 South-west +2 2 South +3 3 South-east +4 4 West +5 5 No direction +6 6 East +7 7 North-west +8 8 North +9 9 North-east +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.251.table b/definitions/grib2/tables/33/4.251.table new file mode 100644 index 000000000..3a78e713e --- /dev/null +++ b/definitions/grib2/tables/33/4.251.table @@ -0,0 +1,7 @@ +# Code table 4.251 - Wave direction and frequency formulae +0 0 Undefined sequence +1 1 Geometric sequence +2 2 Arithmetic sequence +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.252.table b/definitions/grib2/tables/33/4.252.table new file mode 100644 index 000000000..3baf4064c --- /dev/null +++ b/definitions/grib2/tables/33/4.252.table @@ -0,0 +1,165 @@ +# Code table 4.252 - Tile classes and groupings +0 0 Reserved +1 SEOC Seas and oceans +2 INWB Inland water bodies +3 BARE Bare areas +4 HIV High vegetation +5 LOV Low vegetation +6 URBAN Urban +# 7-1000 Reserved for intercomparison tile classes/groupings +1001 SEAO Sea and oceans +1002 LAKE Lakes +1003 RIVE Rivers +1004 NO Bare land +1005 ROCK Bare rock +1006 SNOW Permanent snow +1007 BOBD Boreal broadleaf deciduous +1008 TEBD Temperate broadleaf deciduous +1009 TRBD Tropical broadleaf deciduous +1010 TEBE Temperate broadleaf evergreen +1011 TRBE Tropical broadleaf evergreen +1012 BONE Boreal needleleaf evergreen +1013 TENE Temperate needleleaf evergreen +1014 BOND Boreal needleleaf deciduous +1015 SHRB Shrubs +1016 BOGR Boreal grassland +1017 GRAS Temperate grassland +1018 TROG Tropical grassland +1019 C3W Winter C3 crops +1020 C3S Summer C3 crops +1021 C4 C4 crops +1022 FLTR Flooded trees +1023 FLGR Flooded grassland +1024 LCZ1 Local climate zone 1: compact high-rise (buildings) +1025 LCZ2 Local climate zone 2: compact midrise (buildings) +1026 LCZ3 Local climate zone 3: compact low-rise (buildings) +1027 LCZ4 Local climate zone 4: open high-rise (buildings) +1028 LCZ5 Local climate zone 5: open midrise (buildings) +1029 LCZ6 Local climate zone 6: open low-rise (buildings) +1030 LCZ7 Local climate zone 7: lightweight low-rise (buildings) +1031 LCZ8 Local climate zone 8: large low-rise (buildings) +1032 LCZ9 Local climate zone 9: sparsely built (buildings) +1033 LCZ10 Local climate zone 10: heavy industry (buildings) +1034 TEBDU Urban temperate broadleaf deciduous +1035 TRBDU Urban tropical broadleaf deciduous +1036 TEBEU Urban temperate broadleaf evergreen +1037 TRBEU Urban tropical broadleaf evergreen +1038 BONEU Urban boreal needleleaf evergreen +1039 TENEU Urban temperate needleleaf evergreen +1040 BONDU Urban boreal needleleaf deciduous +# 1041-1500 Reserved for tile class entries for tile models using the ECOCLIMAP-SG land cover survey +# v8.1 groupings +1501 GNATU Nature grouping (NO + ROCK + SNOW + BOBD + TEBD + TRBD + TEBE + TRBE + BONE + TENE + BOND + SHRB + BOGR + GRAS + TROG + C3W + C3S + C4 + FLTR + FLGR) +1502 GNOFO Non-forest grouping (NO + ROCK + SNOW + BOGR + GRAS + TROG + C3W + C3S + C4 + FLTR + FLGR) +1503 GFORE Forest grouping (BOBD + TEBD + TRBD + TEBE + TRBE + BONE + TENE + BOND + SHRB) +1504 GNOVE Non-vegetated grouping (NO + ROCK + SNOW) +1505 GTREE Trees grouping (BOBD + TEBD + TRBD + TEBE + TRBE + BONE + TENE + BOND + SHRB + FLTR) +1506 GLVEG Low vegetation grouping (BOGR + GRAS + TROG + C3W + C3S + C4 + FLGR) +1507 GNFLV Non-flooded low vegetation grouping (BOGR + GRAS + TROG + C3W + C3S + C4) +1508 GCROP Crops grouping (C3W + C3S + C4) +1509 GGRAS Grassland grouping (BOGR + GRAS + TROG) +1510 GBARO Bare and rock grouping (NO + ROCK) +1511 GC3CR C3 crops grouping (C3W + C3S) +1512 GBFOR Broadleaf forest grouping (BOBD + TEBD + TRBD + TEBE + TRBE + SHRB) +1513 GNFOR Needleleaf forest grouping (BONE + TENE + BOND) +1514 GDBFO Deciduous broadleaf forest grouping (BOBD + TEBD + TRBD + TEBE + SHRB) +1515 GTGRA Temperate grassland grouping (BOGR + GRAS) +# v9.0 groupings +1516 GNFNF Non-forest (no FLTR) grouping (NO + ROCK + SNOW + BOGR + GRAS + TROG + C3W + C3S + C4 + FLGR) +1517 GBFFT Broadleaf forest (with FLTR) grouping (BOBD + TEBD + TRBD + TEBE + TRBE + SHRB + FLTR) +1518 GBTRE Broadleaf trees grouping (BOBD + TEBD + TRBD + TEBE + TRBE + FLTR) +1519 GCGRA C3/C4 grasslands grouping (BOGR + GRAS + FLGR) +1520 GBDTR Broadleaf deciduous trees grouping (BOBD + TEBD + TRBD + FLTR) +1521 GBETR Broadleaf evergreen trees grouping (TEBE + TRBE) +1522 GNETR Needleleaf evergreen trees grouping (BONE + TENE) +# Other groupings +1523 GLCZU LCZ or urban grouping (LCZ1 + LCZ2 + LCZ3 + LCZ4 + LCZ5 + LCZ6 + LCZ7 + LCZ8 + LCZ9 + LCZ10) +1524 GIWAT Inland water grouping (LAKE + RIVE) +1525 GPTEBD Urban parks and gardens TEBD grouping (NO + GRAS + TEBDU) +1526 GPTRBD Urban parks and gardens TRBD grouping (NO + GRAS + TRBDU) +1527 GPTEBE Urban parks and gardens TEBE grouping (NO + GRAS + TEBEU) +1528 GPTRBE Urban parks and gardens TRBE grouping (NO + GRAS + TRBEU) +1529 GPBONE Urban parks and gardens BONE grouping (NO + GRAS + BONEU) +1530 GPTENE Urban parks and gardens TENE grouping (NO + GRAS + TENEU) +1531 GPBOND Urban parks and gardens BOND grouping (NO + GRAS + BONDU) +# 1532-2000 Reserved for tile grouping entries for tile models using the ECOCLIMAP-SG land cover survey +2001 CRMF Crops, mixed farming +2002 SHGR Short grass +2003 EVNE Evergreen needleleaf trees +2004 DENE Deciduous needleleaf trees +2005 DEBR Deciduous broadleaf trees +2006 EVBR Evergreen broadleaf trees +2007 TAGR Tall grass +2008 DESE Desert +2009 TUND Tundra +2010 IRCR Irrigated crops +2011 SEDE Semidesert +2012 ICGL Ice caps and glaciers +2013 BOMA Bogs and marshes +2014 INWA Inland water +2015 OCEA Ocean +2016 EVSH Evergreen shrubs +2017 DESH Deciduous shrubs +2018 MFWO Mixed forest/woodland +2019 INFO Interrupted forest +2020 WLMI Water and land mixtures +2021 BASO Bare soil +2022 URBA Urban +2023 LORI Low-rise building +2024 HIRI High-rise building +# 2025-2500 Reserved for tile class entries for tile models using the GLCC v2.0 BATS Classification survey +2501 GLVE Low vegetation grouping (CRMF + SHGR + TAGR + TUND + IRCR + SEDE + BOMA + EVSH + DESH + WLMI) +2502 GHVE High vegetation grouping (EVNE + DENE + DEBR + EVBR + MFWO + INFO) +# 2503-3000 Reserved for tile grouping entries for tile models using the GLCC v2.0 BATS Classification survey +3001 PFIC Post-flooding or irrigated croplands +3002 RACR Rainfed croplands +3003 MCVE Mosaic cropland (50-70%) / vegetation (grassland, shrubland, forest) (20-50%) +3004 MVCR Mosaic vegetation (grassland, shrubland, forest) (50-70%) / cropland (20-50%) +3005 COBS Closed to open (>15%) broadleaved evergreen and/or semi-deciduous forest (>5m) +3006 CLBD Closed (>40%) broadleaved deciduous forest (>5m) +3007 OPBD Open (15-40%) broadleaved deciduous forest (>5m) +3008 CLNE Closed (>40%) needleleaved evergreen forest (>5m) +3009 ONDE Open (15-40%) needleleaved deciduous or evergreen forest (>5m) +3010 COBN Closed to open (>15%) mixed broadleaved and needleleaved forest (>5m) +3011 MFSG Mosaic forest/shrubland (50-70%) / grassland (20-50%) +3012 MGFS Mosaic grassland (50-70%) / forest / shrubland (20-50%) +3013 COSH Closed to open (>15%) shrubland (<5m) +3014 COHV Closed to open (>15%) herbaceous vegetation +3015 SPVE Sparse (<15%) vegetation (woody vegetation, shrubs, grassland) +3016 COBFF Closed to open (>15%) broadleaved forest regularly flooded (semi-permanently or temporarily) - fresh or brackish water +3017 CLBFF Closed (>40%) broadleaved forest or shrubland permanently flooded - saline or brackish water +3018 COVEF Closed to open (>15%) vegetation (grassland, shrubland, woody vegetation) on regularly flooded or waterlogged soil - fresh, brackish or saline water +3019 ASAA Artificial surfaces and associated areas (urban areas >50%) +3020 BAAR Bare areas +3021 WABO Water bodies +3022 PESI Permanent snow and ice +# 3023-3500 Reserved for tile class entries for tile models using the ESA-GlobCover GCV2009 survey +3501 GRDT Grouping using the dominant tiles approach (dominant tile varies per gridbox) +# 3502-4000 Reserved for tile grouping entries for tile models using the ESA-GlobCover GCV2009 survey +4001 TBECO Tree cover, broadleaved evergreen, closed to open (>15%) +4002 TBDC Tree cover, broadleaved deciduous, closed (>40%) +4003 TBDO Tree cover, broadleaved deciduous, open (15-40%) +4004 TNECO Tree cover, needleleaved evergreen, closed to open (>15%) +4005 TNDCO Tree cover, needleleaved decidous, closed to open (>15%) +4006 TMLCO Tree cover, mixed leaftype, closed to open (>15%) +4007 TCOFF Tree cover, closed to open (>15%), regularly flooded, fresh or brackish water: swamp forests +4008 TCOFS Tree cover, closed to open (>15%), regularly flooded, saline water: mangrove forests +4009 MTVG Mosaic of tree cover and other natural vegetation (crop component possible) +4010 TBURN Tree Cover, burnt (mainly boreal forests) +4011 SCOE Shrubcover, closed to open (>15%), evergreen (broadleaved or needleleaved) +4012 SCOD Shrubcover, closed to open (>15%), deciduous (broadleaved) +4013 HCCO Herbaceous cover, closed to open (>15%) +4014 SHSC Sparse herbaceous or sparse shrub cover +4015 FSHCO Regularly flooded (>2 month) shrub or herbaceous cover, closed to open +4016 CROP Cropland (upland crops or inundated/ flooded crops) +4017 MCTNV Mosaic of cropland / tree cover/ other natural vegetation +4018 MCSH Mosaic of cropland / shrub or herbaceous cover +4019 BAARE Bare areas +4020 WBNA Water bodies (natural or artificial) +4021 SINA Snow or ice (natural or artificial) +4022 URAR Urban areas +# 4023-4500 Reserved for tile class entries for tile models using the European Commission-Global Land Cover Project GLC2000 survey +# 4501-5000 Reserved for tile grouping entries for tile models using the European Commission-Global Land Cover Project GLC2000 survey +# 5001-32767 Reserved for additional land cover surveys +# 32768-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/33/4.3.table b/definitions/grib2/tables/33/4.3.table new file mode 100644 index 000000000..8ae36efc3 --- /dev/null +++ b/definitions/grib2/tables/33/4.3.table @@ -0,0 +1,26 @@ +# Code table 4.3 - Type of generating process +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +12 12 Post-processed analysis +13 13 Post-processed forecast +14 14 Nowcast +15 15 Hindcast +16 16 Physical retrieval +17 17 Regression analysis +18 18 Difference between two forecasts +19 19 First guess +20 20 Analysis increment +21 21 Initialization increment for analysis +# 22-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.333.table b/definitions/grib2/tables/33/4.333.table new file mode 100644 index 000000000..1367d35c6 --- /dev/null +++ b/definitions/grib2/tables/33/4.333.table @@ -0,0 +1,12 @@ +# Code table 4.333 - Transport dispersion model +1 1 DERMA (Danish Emergency Response Model of the Atmosphere) +2 2 E-EMEP (Emergency EMEP model) +3 3 FLEXPART (Particle dispersion model) +4 4 MLDP (Modèle lagrangien de dispersion de particules) +5 5 MATCH (Multi-scale Atmospheric Transport Model) +6 6 SILAM (System for Integrated modeLling of Atmospheric composition) +7 7 SNAP (Severe Nuclear Accident Program) +8 8 WRF-Chem (Weather Research and Forecasting Chemical model) +9 9 Trajectoire (Trajectory model) +# 10-254 Reserved +255 255 Missing value diff --git a/definitions/grib2/tables/33/4.335.table b/definitions/grib2/tables/33/4.335.table new file mode 100644 index 000000000..f47807cf6 --- /dev/null +++ b/definitions/grib2/tables/33/4.335.table @@ -0,0 +1,7 @@ +# Code table 4.335 - Emission scenario origin +1 1 ARGOS (Accident Reporting and Guiding Operational System) +2 2 JRODOS (Java version of Real time Online Decision SuppOrt System) +3 3 Assimilated (Scenario retrieved from measurements) +4 4 Centre (scenario by originating centre) +# 5-254 Reserved +255 255 Missing value diff --git a/definitions/grib2/tables/33/4.336.table b/definitions/grib2/tables/33/4.336.table new file mode 100644 index 000000000..c7855abea --- /dev/null +++ b/definitions/grib2/tables/33/4.336.table @@ -0,0 +1,13 @@ +# Code table 4.336 - NWP model +1 1 AROME (Meso scale NWP, Meteo-France) +2 2 ARPEGE (Global scale NWP, Meteo-France) +3 3 GFS (Global forecast system, NCEP) +4 4 HARMONIE (HIRLAM-ALADIN Research on Mesoscale Operational NWP) +5 5 HIRLAM (HIgh resolution Limited Area Model) +6 6 IFS (Integrated Forecast System) +7 7 GEM GDPS (Canadian Global Deterministic Prediction System) +8 8 GEM RDPS (Canadian Regional Deterministic Prediction System) +9 9 GEM HRDPS (Canadian High Resolution Deterministic Prediction System) +10 10 WRF (Weather Research and Forecasting) +# 11-254 Reserved +255 255 Missing value diff --git a/definitions/grib2/tables/33/4.4.table b/definitions/grib2/tables/33/4.4.table new file mode 100644 index 000000000..6e63e069c --- /dev/null +++ b/definitions/grib2/tables/33/4.4.table @@ -0,0 +1,17 @@ +# Code table 4.4 - Indicator of unit of time range +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.5.table b/definitions/grib2/tables/33/4.5.table new file mode 100644 index 000000000..f139bc109 --- /dev/null +++ b/definitions/grib2/tables/33/4.5.table @@ -0,0 +1,95 @@ +# Code table 4.5 - Fixed surface types and units +0 0 Reserved +1 sfc Ground or water surface (-) +2 2 Cloud base level (-) +3 3 Level of cloud tops (-) +4 4 Level of 0 degree C isotherm (-) +5 5 Level of adiabatic condensation lifted from the surface (-) +6 6 Maximum wind level (-) +7 sfc Tropopause (-) +8 sfc Nominal top of the atmosphere (-) +9 9 Sea bottom (-) +10 10 Entire atmosphere (-) +11 11 Cumulonimbus (CB) base (m) +12 12 Cumulonimbus (CB) top (m) +13 13 Lowest level where vertically integrated cloud cover exceeds the specified percentage (cloud base for a given percentage cloud cover) (%) +14 14 Level of free convection (LFC) (-) +15 15 Convective condensation level (CCL) (-) +16 16 Level of neutral buoyancy or equilibrium level (LNB) (-) +17 sfc Departure level of the most unstable parcel of air (MUDL) +18 sfc Departure level of a mixed layer parcel of air with specified layer depth (Pa) +19 19 Lowest level where cloud cover exceeds the specified percentage (%) +20 20 Isothermal level (K) +21 21 Lowest level where mass density exceeds the specified value (base for a given threshold of mass density) (kg m-3) +22 22 Highest level where mass density exceeds the specified value (top for a given threshold of mass density) (kg m-3) +23 23 Lowest level where air concentration exceeds the specified value (base for a given threshold of air concentration) (Bq m-3) +24 24 Highest level where air concentration exceeds the specified value (top for a given threshold of air concentration) (Bq m-3) +25 25 Highest level where radar reflectivity exceeds the specified value (echo top for a given threshold of reflectivity) (dBZ) +26 26 Convective cloud layer base (m) +27 27 Convective cloud layer top (m) +# 28-29 Reserved +30 30 Specified radius from the centre of the Sun (m) +31 31 Solar photosphere +32 32 Ionospheric D-region level +33 33 Ionospheric E-region level +34 34 Ionospheric F1-region level +35 35 Ionospheric F2-region level +# 36-99 Reserved +100 pl Isobaric surface (Pa) +101 sfc Mean sea level +102 102 Specific altitude above mean sea level (m) +103 sfc Specified height level above ground (m) +104 104 Sigma level (sigma value) +105 ml Hybrid level (-) +106 sfc Depth below land surface (m) +107 pt Isentropic (theta) level (K) +108 108 Level at specified pressure difference from ground to level (Pa) +109 pv Potential vorticity surface (K m2 kg-1 s-1) +110 110 Reserved +111 111 Eta level (-) +112 112 Reserved +113 113 Logarithmic hybrid level +114 sol Snow level (Numeric) +115 115 Sigma height level +# 116 Reserved +117 117 Mixed layer depth (m) +118 hhl Hybrid height level (-) +119 hpl Hybrid pressure level (-) +# 120-149 Reserved +150 150 Generalized vertical height coordinate +151 sol Soil level (Numeric) +152 sol Sea-ice level (Numeric) +# 153-159 Reserved +160 160 Depth below sea level (m) +161 161 Depth below water surface (m) +162 sfc Lake or river bottom (-) +163 163 Bottom of sediment layer (-) +164 164 Bottom of thermally active sediment layer (-) +165 165 Bottom of sediment layer penetrated by thermal wave (-) +166 sfc Mixing layer (-) +167 167 Bottom of root zone (-) +168 168 Ocean model level (Numeric) +169 169 Ocean level defined by water density (sigma-theta) difference from near-surface to level (kg m-3) +170 170 Ocean level defined by water potential temperature difference from near-surface to level (K) +171 171 Ocean level defined by vertical eddy diffusivity difference from near-surface to level (m2 s-1) +172 172 Ocean level defined by water density (rho) difference from near-surface to level (m) +173 173 Top of snow over sea ice on sea, lake or river +174 sfc Top surface of ice on sea, lake or river +175 175 Top surface of ice, under snow cover, on sea, lake or river +176 176 Bottom surface (underside) ice on sea, lake or river +177 sfc Deep soil (of indefinite depth) +# 178 Reserved +179 179 Top surface of glacier ice and inland ice +180 180 Deep inland or glacier ice (of indefinite depth) +181 181 Grid tile land fraction as a model surface +182 182 Grid tile water fraction as a model surface +183 183 Grid tile ice fraction on sea, lake or river as a model surface +184 184 Grid tile glacier ice and inland ice fraction as a model surface +185 185 Roof level +186 186 Wall level +187 187 Road level +188 188 Melt pond top surface +189 189 Melt pond bottom surface +# 190-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.6.table b/definitions/grib2/tables/33/4.6.table new file mode 100644 index 000000000..ce799721d --- /dev/null +++ b/definitions/grib2/tables/33/4.6.table @@ -0,0 +1,9 @@ +# Code table 4.6 - Type of ensemble forecast +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.7.table b/definitions/grib2/tables/33/4.7.table new file mode 100644 index 000000000..128fa317f --- /dev/null +++ b/definitions/grib2/tables/33/4.7.table @@ -0,0 +1,15 @@ +# Code table 4.7 - Derived forecast +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +10 10 Variance of all ensemble members +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.8.table b/definitions/grib2/tables/33/4.8.table new file mode 100644 index 000000000..78467454a --- /dev/null +++ b/definitions/grib2/tables/33/4.8.table @@ -0,0 +1,6 @@ +# Code table 4.8 - Clustering method +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.9.table b/definitions/grib2/tables/33/4.9.table new file mode 100644 index 000000000..8e481465e --- /dev/null +++ b/definitions/grib2/tables/33/4.9.table @@ -0,0 +1,14 @@ +# Code table 4.9 - Probability type +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +5 5 Probability of event equal to lower limit +6 6 Probability of event in above normal category +7 7 Probability of event in near normal category +8 8 Probability of event in below normal category +9 9 Probability based on counts of categorical boolean +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/4.91.table b/definitions/grib2/tables/33/4.91.table new file mode 100644 index 000000000..1a0f215f0 --- /dev/null +++ b/definitions/grib2/tables/33/4.91.table @@ -0,0 +1,16 @@ +# Code table 4.91 - Type of Interval +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit +11 11 Equal to first limit +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/5.0.table b/definitions/grib2/tables/33/5.0.table new file mode 100644 index 000000000..5e00004b0 --- /dev/null +++ b/definitions/grib2/tables/33/5.0.table @@ -0,0 +1,22 @@ +# Code table 5.0 - Data representation template number +0 0 Grid point data - simple packing +1 1 Matrix value at grid point - simple packing +2 2 Grid point data - complex packing +3 3 Grid point data - complex packing and spatial differencing +4 4 Grid point data - IEEE floating point data +# 5-39 Reserved +40 40 Grid point data - JPEG 2000 code stream format +41 41 Grid point data - Portable Network Graphics (PNG) +42 42 Grid point data - CCSDS recommended lossless compression +# 43-49 Reserved +50 50 Spectral data - simple packing +51 51 Spherical harmonics data - complex packing +# 52 Reserved +53 53 Spectral data for limited area models - complex packing +# 54-60 Reserved +61 61 Grid point data - simple packing with logarithm pre-processing +# 62-199 Reserved +200 200 Run length packing with level values +# 201-49151 Reserved +# 49152-65534 Reserved for local use +65535 65535 Missing diff --git a/definitions/grib2/tables/33/5.1.table b/definitions/grib2/tables/33/5.1.table new file mode 100644 index 000000000..1189b5e46 --- /dev/null +++ b/definitions/grib2/tables/33/5.1.table @@ -0,0 +1,6 @@ +# Code table 5.1 - Type of original field values +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/5.2.table b/definitions/grib2/tables/33/5.2.table new file mode 100644 index 000000000..60d557a0d --- /dev/null +++ b/definitions/grib2/tables/33/5.2.table @@ -0,0 +1,8 @@ +# Code table 5.2 - Matrix coordinate value function definition +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/5.25.table b/definitions/grib2/tables/33/5.25.table new file mode 100644 index 000000000..79e9fd69a --- /dev/null +++ b/definitions/grib2/tables/33/5.25.table @@ -0,0 +1,9 @@ +# Code table 5.25 - type of bi-Fourier subtruncation +# 0-76 Reserved +77 77 Rectangular +# 78-87 Reserved +88 88 Elliptic +# 89-98 Reserved +99 99 Diamond +# 100-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/5.26.table b/definitions/grib2/tables/33/5.26.table new file mode 100644 index 000000000..298f3fcd0 --- /dev/null +++ b/definitions/grib2/tables/33/5.26.table @@ -0,0 +1,5 @@ +# Code table 5.26 - packing mode for axes +0 0 Spectral coefficients for axes are packed +1 1 Spectral coefficients for axes included in the unpacked subset +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/5.3.table b/definitions/grib2/tables/33/5.3.table new file mode 100644 index 000000000..481331791 --- /dev/null +++ b/definitions/grib2/tables/33/5.3.table @@ -0,0 +1,7 @@ +# Code table 5.3 - Matrix coordinate parameter +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/5.4.table b/definitions/grib2/tables/33/5.4.table new file mode 100644 index 000000000..e84ab1901 --- /dev/null +++ b/definitions/grib2/tables/33/5.4.table @@ -0,0 +1,6 @@ +# Code table 5.4 - Group splitting method +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/5.40.table b/definitions/grib2/tables/33/5.40.table new file mode 100644 index 000000000..97e8880ab --- /dev/null +++ b/definitions/grib2/tables/33/5.40.table @@ -0,0 +1,5 @@ +# Code table 5.40 - Type of compression +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/5.5.table b/definitions/grib2/tables/33/5.5.table new file mode 100644 index 000000000..f2316975a --- /dev/null +++ b/definitions/grib2/tables/33/5.5.table @@ -0,0 +1,7 @@ +# Code table 5.5 - Missing value management for complex packing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/5.6.table b/definitions/grib2/tables/33/5.6.table new file mode 100644 index 000000000..db68ead9c --- /dev/null +++ b/definitions/grib2/tables/33/5.6.table @@ -0,0 +1,7 @@ +# Code table 5.6 - Order of spatial differencing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/33/5.7.table b/definitions/grib2/tables/33/5.7.table new file mode 100644 index 000000000..e54862c19 --- /dev/null +++ b/definitions/grib2/tables/33/5.7.table @@ -0,0 +1,7 @@ +# Code table 5.7 - Precision of floating-point numbers +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/33/6.0.table b/definitions/grib2/tables/33/6.0.table new file mode 100644 index 000000000..a8f30f5a4 --- /dev/null +++ b/definitions/grib2/tables/33/6.0.table @@ -0,0 +1,6 @@ +# Code table 6.0 - Bit map indicator +0 0 A bit map applies to this product and is specified in this Section +1 1 A bit map pre-determined by the originating/generating centre applies to this product and is not specified in this Section +# 1-253 A bit map predetermined by the originating/generating centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/6/1.1.table b/definitions/grib2/tables/6/1.1.table index 6c5a60361..6ccac21de 100644 --- a/definitions/grib2/tables/6/1.1.table +++ b/definitions/grib2/tables/6/1.1.table @@ -1,5 +1,5 @@ # Code Table 1.1 GRIB Local Tables Version Number -0 0 Local tables not used +0 0 Local tables not used # . Only table entries and templates from the current Master table are valid. # 1-254 Number of local tables version used 255 255 Missing diff --git a/definitions/grib2/tables/6/4.5.table b/definitions/grib2/tables/6/4.5.table index 9be96e9da..5b80a90fc 100644 --- a/definitions/grib2/tables/6/4.5.table +++ b/definitions/grib2/tables/6/4.5.table @@ -1,13 +1,13 @@ #Code table 4.5: Fixed surface types and units 0 0 Reserved -1 sfc Ground or water surface -2 2 Cloud base level -3 3 Level of cloud tops -4 4 Level of 0 degree C isotherm +1 sfc Ground or water surface +2 2 Cloud base level +3 3 Level of cloud tops +4 4 Level of 0 degree C isotherm 5 5 Level of adiabatic condensation lifted from the surface -6 6 Maximum wind level -7 sfc Tropopause -8 sfc Nominal top of the atmosphere +6 6 Maximum wind level +7 sfc Tropopause +8 sfc Nominal top of the atmosphere 9 9 Sea bottom 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) diff --git a/definitions/grib2/tables/7/1.1.table b/definitions/grib2/tables/7/1.1.table index 6c5a60361..6ccac21de 100644 --- a/definitions/grib2/tables/7/1.1.table +++ b/definitions/grib2/tables/7/1.1.table @@ -1,5 +1,5 @@ # Code Table 1.1 GRIB Local Tables Version Number -0 0 Local tables not used +0 0 Local tables not used # . Only table entries and templates from the current Master table are valid. # 1-254 Number of local tables version used 255 255 Missing diff --git a/definitions/grib2/tables/7/3.10.table b/definitions/grib2/tables/7/3.10.table index e4a446b9a..04686d32e 100644 --- a/definitions/grib2/tables/7/3.10.table +++ b/definitions/grib2/tables/7/3.10.table @@ -5,4 +5,4 @@ 2 1 Points scan in -j direction, i.e. from east to west 3 0 Adjacent points in i direction are consecutive 3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +# 4-8 Reserved diff --git a/definitions/grib2/tables/7/3.4.table b/definitions/grib2/tables/7/3.4.table index 72e3343b7..d3cad225c 100644 --- a/definitions/grib2/tables/7/3.4.table +++ b/definitions/grib2/tables/7/3.4.table @@ -7,4 +7,4 @@ 3 1 Adjacent points in j (y) direction is consecutive 4 0 All rows scan in the same direction 4 1 Adjacent rows scans in the opposite direction -# 5-8 Reserved +# 5-8 Reserved diff --git a/definitions/grib2/tables/7/3.9.table b/definitions/grib2/tables/7/3.9.table index 5edac03a5..cc2e6104b 100644 --- a/definitions/grib2/tables/7/3.9.table +++ b/definitions/grib2/tables/7/3.9.table @@ -1,4 +1,4 @@ # FLAG TABLE 3.9, Numbering order of diamonds as seen from the corresponding pole 1 0 Clockwise orientation 1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +# 2-8 Reserved diff --git a/definitions/grib2/tables/7/4.5.table b/definitions/grib2/tables/7/4.5.table index 9be96e9da..5b80a90fc 100644 --- a/definitions/grib2/tables/7/4.5.table +++ b/definitions/grib2/tables/7/4.5.table @@ -1,13 +1,13 @@ #Code table 4.5: Fixed surface types and units 0 0 Reserved -1 sfc Ground or water surface -2 2 Cloud base level -3 3 Level of cloud tops -4 4 Level of 0 degree C isotherm +1 sfc Ground or water surface +2 2 Cloud base level +3 3 Level of cloud tops +4 4 Level of 0 degree C isotherm 5 5 Level of adiabatic condensation lifted from the surface -6 6 Maximum wind level -7 sfc Tropopause -8 sfc Nominal top of the atmosphere +6 6 Maximum wind level +7 sfc Tropopause +8 sfc Nominal top of the atmosphere 9 9 Sea bottom 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) diff --git a/definitions/grib2/tables/8/0.0.table b/definitions/grib2/tables/8/0.0.table index 1d3a90b49..88d8b2cb3 100644 --- a/definitions/grib2/tables/8/0.0.table +++ b/definitions/grib2/tables/8/0.0.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/1.0.table b/definitions/grib2/tables/8/1.0.table index dc3fcebf0..9f43a852b 100644 --- a/definitions/grib2/tables/8/1.0.table +++ b/definitions/grib2/tables/8/1.0.table @@ -1,13 +1,13 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Experimental -1 1 Version implemented on 7 November 2001 -2 2 Version implemented on 4 November 2003 -3 3 Version implemented on 2 November 2005 -4 4 Version implemented on 7 November 2007 -5 5 Version implemented on 4 November 2009 -6 6 Version implemented on 15 September 2010 -7 7 Version implemented on 4 May 2011 -8 8 Version implemented on 2 November 2011 -9 9 Pre-operational to be implemented by next amendment -# 10-254 Future versions +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 +6 6 Version implemented on 15 September 2010 +7 7 Version implemented on 4 May 2011 +8 8 Version implemented on 2 November 2011 +9 9 Pre-operational to be implemented by next amendment +# 10-254 Future versions 255 255 Master tables not used. Local table entries and local templates may use the entire range of the table, not just those sections marked Reserved for local used. diff --git a/definitions/grib2/tables/8/1.1.table b/definitions/grib2/tables/8/1.1.table index 91ef66244..55fa1eb63 100644 --- a/definitions/grib2/tables/8/1.1.table +++ b/definitions/grib2/tables/8/1.1.table @@ -1,4 +1,4 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/8/1.2.table b/definitions/grib2/tables/8/1.2.table index d90ad0109..606bf8300 100644 --- a/definitions/grib2/tables/8/1.2.table +++ b/definitions/grib2/tables/8/1.2.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/1.3.table b/definitions/grib2/tables/8/1.3.table index 35cd6a636..712bb2ba8 100644 --- a/definitions/grib2/tables/8/1.3.table +++ b/definitions/grib2/tables/8/1.3.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products -4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) -5 5 THORPEX Interactive Grand Global Ensemble (TIGGE) test -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products +4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) +5 5 THORPEX Interactive Grand Global Ensemble (TIGGE) test +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/1.4.table b/definitions/grib2/tables/8/1.4.table index d11a335a7..7f47afd96 100644 --- a/definitions/grib2/tables/8/1.4.table +++ b/definitions/grib2/tables/8/1.4.table @@ -1,13 +1,13 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/8/3.0.table b/definitions/grib2/tables/8/3.0.table index 4baed0aab..4269b25ad 100644 --- a/definitions/grib2/tables/8/3.0.table +++ b/definitions/grib2/tables/8/3.0.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/8/3.10.table b/definitions/grib2/tables/8/3.10.table index 23c1cdd36..da36dc664 100644 --- a/definitions/grib2/tables/8/3.10.table +++ b/definitions/grib2/tables/8/3.10.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/8/3.11.table b/definitions/grib2/tables/8/3.11.table index 560318d1b..0a299af98 100644 --- a/definitions/grib2/tables/8/3.11.table +++ b/definitions/grib2/tables/8/3.11.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 There is no appended list +0 0 There is no appended list 1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows 2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row 3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) diff --git a/definitions/grib2/tables/8/3.15.table b/definitions/grib2/tables/8/3.15.table index 55ca1688a..976862747 100644 --- a/definitions/grib2/tables/8/3.15.table +++ b/definitions/grib2/tables/8/3.15.table @@ -1,22 +1,22 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) -# 113-159 Reserved +# 113-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/3.2.table b/definitions/grib2/tables/8/3.2.table index 3d7a4f1fc..563efbdb5 100644 --- a/definitions/grib2/tables/8/3.2.table +++ b/definitions/grib2/tables/8/3.2.table @@ -1,13 +1,13 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame -# 9-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +# 9-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/3.20.table b/definitions/grib2/tables/8/3.20.table index 3f7ab4cc4..63de6b1a9 100644 --- a/definitions/grib2/tables/8/3.20.table +++ b/definitions/grib2/tables/8/3.20.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/3.21.table b/definitions/grib2/tables/8/3.21.table index b0c77d135..2bc46aae9 100644 --- a/definitions/grib2/tables/8/3.21.table +++ b/definitions/grib2/tables/8/3.21.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/3.3.table b/definitions/grib2/tables/8/3.3.table index 5167ed6b7..bd47e2509 100644 --- a/definitions/grib2/tables/8/3.3.table +++ b/definitions/grib2/tables/8/3.3.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/8/3.4.table b/definitions/grib2/tables/8/3.4.table index 6253896b1..752c70757 100644 --- a/definitions/grib2/tables/8/3.4.table +++ b/definitions/grib2/tables/8/3.4.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -# 5-8 Reserved +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +# 5-8 Reserved diff --git a/definitions/grib2/tables/8/3.5.table b/definitions/grib2/tables/8/3.5.table index 8ccf0f13b..6d3ec036e 100644 --- a/definitions/grib2/tables/8/3.5.table +++ b/definitions/grib2/tables/8/3.5.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/8/3.7.table b/definitions/grib2/tables/8/3.7.table index 41bba8329..4b2e684d3 100644 --- a/definitions/grib2/tables/8/3.7.table +++ b/definitions/grib2/tables/8/3.7.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Reserved 1 1 The complex numbers Fnm (see code figure 1 in Code Table 3.6 above) are stored for m>=0 as pairs of real numbers Re(Fnm), Im(Fnm) ordered with n increasing from m to N(m), first for m=0 and then for m=1, 2, ... M. (see Note 1) -# 2-254 Reserved +# 2-254 Reserved 255 255 Missing diff --git a/definitions/grib2/tables/8/3.8.table b/definitions/grib2/tables/8/3.8.table index 4e811917b..6df554ae9 100644 --- a/definitions/grib2/tables/8/3.8.table +++ b/definitions/grib2/tables/8/3.8.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/3.9.table b/definitions/grib2/tables/8/3.9.table index f35b7ca53..530d1dee0 100644 --- a/definitions/grib2/tables/8/3.9.table +++ b/definitions/grib2/tables/8/3.9.table @@ -1,4 +1,4 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/8/4.0.table b/definitions/grib2/tables/8/4.0.table index faa4f59df..0852d9f0d 100644 --- a/definitions/grib2/tables/8/4.0.table +++ b/definitions/grib2/tables/8/4.0.table @@ -1,52 +1,52 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time 8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically-processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically-processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data # 33-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents 42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents 43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol 46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol 47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non continuous time interval for aerosol 48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of atmospheric aerosol -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time -# 52-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +# 52-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved +# 1102-32767 Reserved # 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data diff --git a/definitions/grib2/tables/8/4.1.0.table b/definitions/grib2/tables/8/4.1.0.table index 361108860..3413dbad5 100644 --- a/definitions/grib2/tables/8/4.1.0.table +++ b/definitions/grib2/tables/8/4.1.0.table @@ -1,27 +1,27 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.1.1.table b/definitions/grib2/tables/8/4.1.1.table index 29f1dec79..dea5bc49e 100644 --- a/definitions/grib2/tables/8/4.1.1.table +++ b/definitions/grib2/tables/8/4.1.1.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.1.10.table b/definitions/grib2/tables/8/4.1.10.table index 9c8c92b12..e6ce6faf7 100644 --- a/definitions/grib2/tables/8/4.1.10.table +++ b/definitions/grib2/tables/8/4.1.10.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Sub-surface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Sub-surface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.1.2.table b/definitions/grib2/tables/8/4.1.2.table index b90201c63..805836998 100644 --- a/definitions/grib2/tables/8/4.1.2.table +++ b/definitions/grib2/tables/8/4.1.2.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.1.3.table b/definitions/grib2/tables/8/4.1.3.table index 3c947b136..c96617665 100644 --- a/definitions/grib2/tables/8/4.1.3.table +++ b/definitions/grib2/tables/8/4.1.3.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Image format products -1 1 Quantitative products -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.10.table b/definitions/grib2/tables/8/4.10.table index 0e5170876..a13fb00b4 100644 --- a/definitions/grib2/tables/8/4.10.table +++ b/definitions/grib2/tables/8/4.10.table @@ -1,15 +1,15 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -# 11-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +# 11-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/8/4.11.table b/definitions/grib2/tables/8/4.11.table index 1257d1b09..af9ff29ad 100644 --- a/definitions/grib2/tables/8/4.11.table +++ b/definitions/grib2/tables/8/4.11.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.12.table b/definitions/grib2/tables/8/4.12.table index e06a3be5b..6cab67bf5 100644 --- a/definitions/grib2/tables/8/4.12.table +++ b/definitions/grib2/tables/8/4.12.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.13.table b/definitions/grib2/tables/8/4.13.table index 107ace60c..f090fb9ae 100644 --- a/definitions/grib2/tables/8/4.13.table +++ b/definitions/grib2/tables/8/4.13.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No quality control applied -1 1 Quality control applied -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No quality control applied +1 1 Quality control applied +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.14.table b/definitions/grib2/tables/8/4.14.table index 9ed9078a8..bcb04f328 100644 --- a/definitions/grib2/tables/8/4.14.table +++ b/definitions/grib2/tables/8/4.14.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No clutter filter used -1 1 Clutter filter used +0 0 No clutter filter used +1 1 Clutter filter used # 2-191 Reserved # 192-254 Reserved for local use -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/8/4.15.table b/definitions/grib2/tables/8/4.15.table index 97cdcd2ee..6e1ef5745 100644 --- a/definitions/grib2/tables/8/4.15.table +++ b/definitions/grib2/tables/8/4.15.table @@ -1,11 +1,11 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.0.table b/definitions/grib2/tables/8/4.2.0.0.table index debc0a6f4..8656f8974 100644 --- a/definitions/grib2/tables/8/4.2.0.0.table +++ b/definitions/grib2/tables/8/4.2.0.0.table @@ -20,6 +20,6 @@ 18 18 Snow temperature (top of snow) (K) 19 19 Turbulent transfer coefficient for heat (Numeric) 20 20 Turbulent diffusion coefficient for heat (m2/s) -# 21-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 21-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.1.table b/definitions/grib2/tables/8/4.2.0.1.table index 1922792a6..8ee93e99b 100644 --- a/definitions/grib2/tables/8/4.2.0.1.table +++ b/definitions/grib2/tables/8/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,10 +86,10 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rain water content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) -# 93-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 93-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.13.table b/definitions/grib2/tables/8/4.2.0.13.table index b9979f0d3..90ab7d1b9 100644 --- a/definitions/grib2/tables/8/4.2.0.13.table +++ b/definitions/grib2/tables/8/4.2.0.13.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.14.table b/definitions/grib2/tables/8/4.2.0.14.table index 4a2a4e128..fca42ccc7 100644 --- a/definitions/grib2/tables/8/4.2.0.14.table +++ b/definitions/grib2/tables/8/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.15.table b/definitions/grib2/tables/8/4.2.0.15.table index a7fa034b0..c89ecd203 100644 --- a/definitions/grib2/tables/8/4.2.0.15.table +++ b/definitions/grib2/tables/8/4.2.0.15.table @@ -14,6 +14,6 @@ 12 12 Reflectivity of rain (dB) 13 13 Reflectivity of graupel (dB) 14 14 Reflectivity of hail (dB) -# 15-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 15-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.16.table b/definitions/grib2/tables/8/4.2.0.16.table index 39215ab20..18dedb7c0 100644 --- a/definitions/grib2/tables/8/4.2.0.16.table +++ b/definitions/grib2/tables/8/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.18.table b/definitions/grib2/tables/8/4.2.0.18.table index 30060fd2d..165aa6008 100644 --- a/definitions/grib2/tables/8/4.2.0.18.table +++ b/definitions/grib2/tables/8/4.2.0.18.table @@ -8,11 +8,11 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) 13 13 Total deposition (wet + dry) (Bq m-2) -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.19.table b/definitions/grib2/tables/8/4.2.0.19.table index 1bbbd4243..1a2f91974 100644 --- a/definitions/grib2/tables/8/4.2.0.19.table +++ b/definitions/grib2/tables/8/4.2.0.19.table @@ -26,6 +26,6 @@ 24 24 Convective turbulent kinetic energy (J/kg) 25 25 Weather Interpretation ww (WMO) (-) 26 26 Convective outlook (Code table 4.224) -# 27-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 27-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.190.table b/definitions/grib2/tables/8/4.2.0.190.table index 39fb55746..3d9d5ff85 100644 --- a/definitions/grib2/tables/8/4.2.0.190.table +++ b/definitions/grib2/tables/8/4.2.0.190.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.191.table b/definitions/grib2/tables/8/4.2.0.191.table index 81230c0e0..4ff12e532 100644 --- a/definitions/grib2/tables/8/4.2.0.191.table +++ b/definitions/grib2/tables/8/4.2.0.191.table @@ -2,6 +2,6 @@ 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/8/4.2.0.2.table b/definitions/grib2/tables/8/4.2.0.2.table index 58428f66a..f93074e5e 100644 --- a/definitions/grib2/tables/8/4.2.0.2.table +++ b/definitions/grib2/tables/8/4.2.0.2.table @@ -33,6 +33,6 @@ 31 31 Turbulent diffusion coefficient for momentum (m2/s) 32 32 Eta coordinate vertical velocity (/s) 33 33 Wind fetch (m) -# 34-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 34-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.20.table b/definitions/grib2/tables/8/4.2.0.20.table index d0ef4b3a0..2bee70352 100644 --- a/definitions/grib2/tables/8/4.2.0.20.table +++ b/definitions/grib2/tables/8/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (Sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -25,7 +25,7 @@ 57 57 Total yearly average burden of the atmosphere (mol) 58 58 Total yearly averaged atmospheric loss (mol/s) 59 59 Aerosol number concentration (m-3) -# 60-99 Reserved +# 60-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Atmosphere optical thickness (m) 102 102 Aerosol optical thickness (Numeric) @@ -37,6 +37,6 @@ 108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) 109 109 Aerosol lidar extinction from satellite (m-1) 110 110 Aerosol lidar extinction from the ground (m-1) -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.3.table b/definitions/grib2/tables/8/4.2.0.3.table index b337cbd06..18c33fdf8 100644 --- a/definitions/grib2/tables/8/4.2.0.3.table +++ b/definitions/grib2/tables/8/4.2.0.3.table @@ -25,6 +25,6 @@ 23 23 Gravity wave dissipation (W m-2) 24 24 Anisotropy of sub-gridscale orography (Numeric) 25 25 Natural logarithm of pressure in Pa (Numeric) -# 26-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 26-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.4.table b/definitions/grib2/tables/8/4.2.0.4.table index fea4cafc3..336fdb421 100644 --- a/definitions/grib2/tables/8/4.2.0.4.table +++ b/definitions/grib2/tables/8/4.2.0.4.table @@ -12,9 +12,9 @@ 10 10 Photosynthetically active radiation (W m-2) 11 11 Net short-wave radiation flux, clear sky (W m-2) 12 12 Downward UV radiation (W m-2) -# 13-49 Reserved +# 13-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) -# 52-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.5.table b/definitions/grib2/tables/8/4.2.0.5.table index aae853bf9..607235064 100644 --- a/definitions/grib2/tables/8/4.2.0.5.table +++ b/definitions/grib2/tables/8/4.2.0.5.table @@ -6,6 +6,6 @@ 4 4 Upward long-wave radiation flux (W m-2) 5 5 Net long wave radiation flux (W m-2) 6 6 Net long-wave radiation flux, clear sky (W m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.6.table b/definitions/grib2/tables/8/4.2.0.6.table index 462727d0b..747fd8088 100644 --- a/definitions/grib2/tables/8/4.2.0.6.table +++ b/definitions/grib2/tables/8/4.2.0.6.table @@ -33,6 +33,6 @@ 31 31 Number density of cloud ice (m-3) 32 32 Fraction of cloud cover (Numeric) 33 33 Sunshine duration (s) -# 34-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 34-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.0.7.table b/definitions/grib2/tables/8/4.2.0.7.table index 7a7d2008b..6c1794c73 100644 --- a/definitions/grib2/tables/8/4.2.0.7.table +++ b/definitions/grib2/tables/8/4.2.0.7.table @@ -13,8 +13,8 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraft helicity (m2 s-2) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.1.0.table b/definitions/grib2/tables/8/4.2.1.0.table index bf1e3e93f..9c4d129da 100644 --- a/definitions/grib2/tables/8/4.2.1.0.table +++ b/definitions/grib2/tables/8/4.2.1.0.table @@ -6,6 +6,6 @@ 4 4 Snow water equivalent per cent of normal (%) 5 5 Baseflow-groundwater runoff (kg m-2) 6 6 Storm surface runoff (kg m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.1.1.table b/definitions/grib2/tables/8/4.2.1.1.table index cb5117dc8..aa560e479 100644 --- a/definitions/grib2/tables/8/4.2.1.1.table +++ b/definitions/grib2/tables/8/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.10.0.table b/definitions/grib2/tables/8/4.2.10.0.table index eb9d1fa65..c00ce058f 100644 --- a/definitions/grib2/tables/8/4.2.10.0.table +++ b/definitions/grib2/tables/8/4.2.10.0.table @@ -48,6 +48,6 @@ 46 46 2-dim spectral energy density (m2 s) 47 47 Frequency spectral energy density (m2 s) 48 48 Directional spectral energy density -# 49-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 49-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.10.1.table b/definitions/grib2/tables/8/4.2.10.1.table index 5a33bac5d..a076fb07c 100644 --- a/definitions/grib2/tables/8/4.2.10.1.table +++ b/definitions/grib2/tables/8/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.10.191.table b/definitions/grib2/tables/8/4.2.10.191.table index 14085ac9a..6cafbd3d4 100644 --- a/definitions/grib2/tables/8/4.2.10.191.table +++ b/definitions/grib2/tables/8/4.2.10.191.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.10.2.table b/definitions/grib2/tables/8/4.2.10.2.table index a69b2622c..80fe973be 100644 --- a/definitions/grib2/tables/8/4.2.10.2.table +++ b/definitions/grib2/tables/8/4.2.10.2.table @@ -9,6 +9,6 @@ 7 7 Ice divergence (/s) 8 8 Ice temperature (K) 9 9 Ice internal pressure (Pa m) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.10.3.table b/definitions/grib2/tables/8/4.2.10.3.table index 112af09d5..3b9a2df46 100644 --- a/definitions/grib2/tables/8/4.2.10.3.table +++ b/definitions/grib2/tables/8/4.2.10.3.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.10.4.table b/definitions/grib2/tables/8/4.2.10.4.table index d80a32780..91ffb2b29 100644 --- a/definitions/grib2/tables/8/4.2.10.4.table +++ b/definitions/grib2/tables/8/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2 s-1) 6 6 Ocean vertical momentum diffusivity (m2 s-1) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (m-1) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.2.0.table b/definitions/grib2/tables/8/4.2.2.0.table index b440b9426..083fc5913 100644 --- a/definitions/grib2/tables/8/4.2.2.0.table +++ b/definitions/grib2/tables/8/4.2.2.0.table @@ -32,6 +32,6 @@ 30 30 Deciduous forest (Numeric) 31 31 Normalized differential vegetation index (NDVI) (Numeric) 32 32 Root depth of vegetation (m) -# 33-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 33-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.2.3.table b/definitions/grib2/tables/8/4.2.2.3.table index 80113a4bd..a9ec602e6 100644 --- a/definitions/grib2/tables/8/4.2.2.3.table +++ b/definitions/grib2/tables/8/4.2.2.3.table @@ -22,6 +22,6 @@ 20 20 Column-integrated soil moisture (kg m-2) 21 21 Soil ice (kg m-3) 22 22 Column-integrated soil ice (kg m-2) -# 23-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 23-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.3.0.table b/definitions/grib2/tables/8/4.2.3.0.table index 254e56bc8..8c19d43b2 100644 --- a/definitions/grib2/tables/8/4.2.3.0.table +++ b/definitions/grib2/tables/8/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.2.3.1.table b/definitions/grib2/tables/8/4.2.3.1.table index 16eee69c4..d199aff60 100644 --- a/definitions/grib2/tables/8/4.2.3.1.table +++ b/definitions/grib2/tables/8/4.2.3.1.table @@ -17,12 +17,12 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +23 23 Angstrom coefficient +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.201.table b/definitions/grib2/tables/8/4.201.table index ebb698b38..e16d5d808 100644 --- a/definitions/grib2/tables/8/4.201.table +++ b/definitions/grib2/tables/8/4.201.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.202.table b/definitions/grib2/tables/8/4.202.table index 943c03f6f..aa93458f1 100644 --- a/definitions/grib2/tables/8/4.202.table +++ b/definitions/grib2/tables/8/4.202.table @@ -1,4 +1,4 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 0-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 0-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.203.table b/definitions/grib2/tables/8/4.203.table index fce5a15b1..9a8d29e01 100644 --- a/definitions/grib2/tables/8/4.203.table +++ b/definitions/grib2/tables/8/4.203.table @@ -1,25 +1,25 @@ -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.205.table b/definitions/grib2/tables/8/4.205.table index 8d425ab9d..3fadf7d80 100644 --- a/definitions/grib2/tables/8/4.205.table +++ b/definitions/grib2/tables/8/4.205.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.206.table b/definitions/grib2/tables/8/4.206.table index 0be7fd4f8..43b0ba137 100644 --- a/definitions/grib2/tables/8/4.206.table +++ b/definitions/grib2/tables/8/4.206.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.207.table b/definitions/grib2/tables/8/4.207.table index fde9eb477..815a5777e 100644 --- a/definitions/grib2/tables/8/4.207.table +++ b/definitions/grib2/tables/8/4.207.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.208.table b/definitions/grib2/tables/8/4.208.table index 196becaaf..23ea97317 100644 --- a/definitions/grib2/tables/8/4.208.table +++ b/definitions/grib2/tables/8/4.208.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.209.table b/definitions/grib2/tables/8/4.209.table index 351c0f431..53c6c5eba 100644 --- a/definitions/grib2/tables/8/4.209.table +++ b/definitions/grib2/tables/8/4.209.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Stable -2 2 Mechanically-driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically-driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.210.table b/definitions/grib2/tables/8/4.210.table index 1c00b8c6f..149b2ba06 100644 --- a/definitions/grib2/tables/8/4.210.table +++ b/definitions/grib2/tables/8/4.210.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Contrail not present -1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.211.table b/definitions/grib2/tables/8/4.211.table index 66ef656f6..b5753f19f 100644 --- a/definitions/grib2/tables/8/4.211.table +++ b/definitions/grib2/tables/8/4.211.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.212.table b/definitions/grib2/tables/8/4.212.table index c59bd24e8..738c45d2c 100644 --- a/definitions/grib2/tables/8/4.212.table +++ b/definitions/grib2/tables/8/4.212.table @@ -1,18 +1,18 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.213.table b/definitions/grib2/tables/8/4.213.table index 0f5de0104..5cee0b798 100644 --- a/definitions/grib2/tables/8/4.213.table +++ b/definitions/grib2/tables/8/4.213.table @@ -1,21 +1,21 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -12 12 Loam -13 13 Peat -14 14 Rock -15 15 Ice -16 16 Water -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +12 12 Loam +13 13 Peat +14 14 Rock +15 15 Ice +16 16 Water +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.215.table b/definitions/grib2/tables/8/4.215.table index 460888217..5ed37c034 100644 --- a/definitions/grib2/tables/8/4.215.table +++ b/definitions/grib2/tables/8/4.215.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.216.table b/definitions/grib2/tables/8/4.216.table index cc62ca5e3..2fd143724 100644 --- a/definitions/grib2/tables/8/4.216.table +++ b/definitions/grib2/tables/8/4.216.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit # 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/8/4.217.table b/definitions/grib2/tables/8/4.217.table index 51a263a99..6a014c9c3 100644 --- a/definitions/grib2/tables/8/4.217.table +++ b/definitions/grib2/tables/8/4.217.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.218.table b/definitions/grib2/tables/8/4.218.table index d4b2ab843..b6087448f 100644 --- a/definitions/grib2/tables/8/4.218.table +++ b/definitions/grib2/tables/8/4.218.table @@ -1,38 +1,38 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation / crops -15 15 Permanent snow / ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -# 19-96 Reserved -97 97 Snow / ice on land -98 98 Snow / ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud / fog / Stratus -102 102 Low cloud / Stratocumulus -103 103 Low cloud / unknown type -104 104 Medium cloud / Nimbostratus -105 105 Medium cloud / Altostratus -106 106 Medium cloud / unknown type -107 107 High cloud / Cumulus -108 108 High cloud / Cirrus -109 109 High cloud / unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation / crops +15 15 Permanent snow / ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +# 19-96 Reserved +97 97 Snow / ice on land +98 98 Snow / ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud / fog / Stratus +102 102 Low cloud / Stratocumulus +103 103 Low cloud / unknown type +104 104 Medium cloud / Nimbostratus +105 105 Medium cloud / Altostratus +106 106 Medium cloud / unknown type +107 107 High cloud / Cumulus +108 108 High cloud / Cirrus +109 109 High cloud / unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.219.table b/definitions/grib2/tables/8/4.219.table index f10ce468e..a02452fc4 100644 --- a/definitions/grib2/tables/8/4.219.table +++ b/definitions/grib2/tables/8/4.219.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.220.table b/definitions/grib2/tables/8/4.220.table index 9c957eb01..7a18fa1fd 100644 --- a/definitions/grib2/tables/8/4.220.table +++ b/definitions/grib2/tables/8/4.220.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.221.table b/definitions/grib2/tables/8/4.221.table index 5466929c7..eb0b64502 100644 --- a/definitions/grib2/tables/8/4.221.table +++ b/definitions/grib2/tables/8/4.221.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.222.table b/definitions/grib2/tables/8/4.222.table index c54194e29..f554a7f3d 100644 --- a/definitions/grib2/tables/8/4.222.table +++ b/definitions/grib2/tables/8/4.222.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.223.table b/definitions/grib2/tables/8/4.223.table index b6a9be136..706abab78 100644 --- a/definitions/grib2/tables/8/4.223.table +++ b/definitions/grib2/tables/8/4.223.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing value +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing value diff --git a/definitions/grib2/tables/8/4.224.table b/definitions/grib2/tables/8/4.224.table index af846f841..cf67496b8 100644 --- a/definitions/grib2/tables/8/4.224.table +++ b/definitions/grib2/tables/8/4.224.table @@ -1,18 +1,18 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/8/4.3.table b/definitions/grib2/tables/8/4.3.table index 68e2cc83f..8a4e919c9 100644 --- a/definitions/grib2/tables/8/4.3.table +++ b/definitions/grib2/tables/8/4.3.table @@ -1,16 +1,16 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.4.table b/definitions/grib2/tables/8/4.4.table index df5272d2f..511c76aa9 100644 --- a/definitions/grib2/tables/8/4.4.table +++ b/definitions/grib2/tables/8/4.4.table @@ -1,17 +1,17 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.5.table b/definitions/grib2/tables/8/4.5.table index 4f36494e9..dfba82870 100644 --- a/definitions/grib2/tables/8/4.5.table +++ b/definitions/grib2/tables/8/4.5.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface 2 2 Cloud base level 3 3 Level of cloud tops @@ -12,11 +12,11 @@ 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) 12 12 Cumulonimbus (CB) top (m) -# 13-19 Reserved +# 13-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -25,7 +25,7 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level 112 112 Reserved 113 113 Logarithmic hybrid coordinate @@ -35,14 +35,14 @@ 119 hpl Hybrid pressure level # 120-149 Reserved 150 150 Generalized vertical height coordinate -# 151-159 Reserved -160 160 Depth below sea level m +# 151-159 Reserved +160 160 Depth below sea level m 161 161 Depth below water surface (m) 162 sfc Lake or river bottom 163 163 Bottom of sediment layer 164 164 Bottom of thermally active sediment layer 165 165 Bottom of sediment layer penetrated by thermal wave 166 sfc Mixing layer -# 167-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 167-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.6.table b/definitions/grib2/tables/8/4.6.table index 54f2993c3..eaa5c4362 100644 --- a/definitions/grib2/tables/8/4.6.table +++ b/definitions/grib2/tables/8/4.6.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.7.table b/definitions/grib2/tables/8/4.7.table index 23e0d457e..e6d887bdb 100644 --- a/definitions/grib2/tables/8/4.7.table +++ b/definitions/grib2/tables/8/4.7.table @@ -1,14 +1,14 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.8.table b/definitions/grib2/tables/8/4.8.table index 37a6cf767..d06153079 100644 --- a/definitions/grib2/tables/8/4.8.table +++ b/definitions/grib2/tables/8/4.8.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.9.table b/definitions/grib2/tables/8/4.9.table index 19e64a3d2..5243e58dd 100644 --- a/definitions/grib2/tables/8/4.9.table +++ b/definitions/grib2/tables/8/4.9.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/4.91.table b/definitions/grib2/tables/8/4.91.table index 05c4579bd..cea421695 100644 --- a/definitions/grib2/tables/8/4.91.table +++ b/definitions/grib2/tables/8/4.91.table @@ -1,16 +1,16 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit -11 11 Equal to first limit. -# 12-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit +11 11 Equal to first limit. +# 12-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/8/5.1.table b/definitions/grib2/tables/8/5.1.table index 100d4106d..158a35850 100644 --- a/definitions/grib2/tables/8/5.1.table +++ b/definitions/grib2/tables/8/5.1.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/5.2.table b/definitions/grib2/tables/8/5.2.table index 4d0808be6..d9896e11f 100644 --- a/definitions/grib2/tables/8/5.2.table +++ b/definitions/grib2/tables/8/5.2.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use +# 12-191 Reserved +# 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/8/5.3.table b/definitions/grib2/tables/8/5.3.table index 705fa6524..6f228aeec 100644 --- a/definitions/grib2/tables/8/5.3.table +++ b/definitions/grib2/tables/8/5.3.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/5.4.table b/definitions/grib2/tables/8/5.4.table index 8133367a5..f844f557e 100644 --- a/definitions/grib2/tables/8/5.4.table +++ b/definitions/grib2/tables/8/5.4.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/5.40.table b/definitions/grib2/tables/8/5.40.table index 0d56ad0e0..2431eb547 100644 --- a/definitions/grib2/tables/8/5.40.table +++ b/definitions/grib2/tables/8/5.40.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/8/5.5.table b/definitions/grib2/tables/8/5.5.table index 5d625dbda..f2216e273 100644 --- a/definitions/grib2/tables/8/5.5.table +++ b/definitions/grib2/tables/8/5.5.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/5.6.table b/definitions/grib2/tables/8/5.6.table index 5838e994d..3b0892d37 100644 --- a/definitions/grib2/tables/8/5.6.table +++ b/definitions/grib2/tables/8/5.6.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/8/5.7.table b/definitions/grib2/tables/8/5.7.table index b93aa8130..f056d3059 100644 --- a/definitions/grib2/tables/8/5.7.table +++ b/definitions/grib2/tables/8/5.7.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/8/6.0.table b/definitions/grib2/tables/8/6.0.table index aecdc6e5e..9c9dba372 100644 --- a/definitions/grib2/tables/8/6.0.table +++ b/definitions/grib2/tables/8/6.0.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating Centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating Centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating Centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/9/0.0.table b/definitions/grib2/tables/9/0.0.table index 1d3a90b49..88d8b2cb3 100644 --- a/definitions/grib2/tables/9/0.0.table +++ b/definitions/grib2/tables/9/0.0.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Meteorological products -1 1 Hydrological products -2 2 Land surface products -3 3 Space products -# 4-9 Reserved -10 10 Oceanographic products -# 11-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Meteorological products +1 1 Hydrological products +2 2 Land surface products +3 3 Space products +# 4-9 Reserved +10 10 Oceanographic products +# 11-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/1.0.table b/definitions/grib2/tables/9/1.0.table index 045af30c3..4b1406c7e 100644 --- a/definitions/grib2/tables/9/1.0.table +++ b/definitions/grib2/tables/9/1.0.table @@ -1,14 +1,14 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Experimental -1 1 Version implemented on 7 November 2001 -2 2 Version implemented on 4 November 2003 -3 3 Version implemented on 2 November 2005 -4 4 Version implemented on 7 November 2007 -5 5 Version implemented on 4 November 2009 +0 0 Experimental +1 1 Version implemented on 7 November 2001 +2 2 Version implemented on 4 November 2003 +3 3 Version implemented on 2 November 2005 +4 4 Version implemented on 7 November 2007 +5 5 Version implemented on 4 November 2009 6 6 Version implemented on 15 September 2010 7 7 Version implemented on 4 May 2011 8 8 Version implemented on 2 November 2011 9 9 Version implemented on 2 May 2012 10 10 Pre-operational to be implemented by next amendment -# 11-254 Future versions +# 11-254 Future versions 255 255 Master tables not used. Local table entries and local templates may use the entire range of the table, not just those sections marked Reserved for local used. diff --git a/definitions/grib2/tables/9/1.1.table b/definitions/grib2/tables/9/1.1.table index 91ef66244..55fa1eb63 100644 --- a/definitions/grib2/tables/9/1.1.table +++ b/definitions/grib2/tables/9/1.1.table @@ -1,4 +1,4 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Local tables not used. Only table entries and templates from the current master table are valid -# 1-254 Number of local tables version used -255 255 Missing +0 0 Local tables not used. Only table entries and templates from the current master table are valid +# 1-254 Number of local tables version used +255 255 Missing diff --git a/definitions/grib2/tables/9/1.2.table b/definitions/grib2/tables/9/1.2.table index d90ad0109..606bf8300 100644 --- a/definitions/grib2/tables/9/1.2.table +++ b/definitions/grib2/tables/9/1.2.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Analysis -1 1 Start of forecast -2 2 Verifying time of forecast -3 3 Observation time -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Start of forecast +2 2 Verifying time of forecast +3 3 Observation time +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/1.3.table b/definitions/grib2/tables/9/1.3.table index 35cd6a636..712bb2ba8 100644 --- a/definitions/grib2/tables/9/1.3.table +++ b/definitions/grib2/tables/9/1.3.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Operational products -1 1 Operational test products -2 2 Research products -3 3 Re-analysis products -4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) -5 5 THORPEX Interactive Grand Global Ensemble (TIGGE) test -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Operational products +1 1 Operational test products +2 2 Research products +3 3 Re-analysis products +4 4 THORPEX Interactive Grand Global Ensemble (TIGGE) +5 5 THORPEX Interactive Grand Global Ensemble (TIGGE) test +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/1.4.table b/definitions/grib2/tables/9/1.4.table index d11a335a7..7f47afd96 100644 --- a/definitions/grib2/tables/9/1.4.table +++ b/definitions/grib2/tables/9/1.4.table @@ -1,13 +1,13 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 an Analysis products -1 fc Forecast products -2 af Analysis and forecast products -3 cf Control forecast products -4 pf Perturbed forecast products -5 cp Control and perturbed forecast products -6 sa Processed satellite observations -7 ra Processed radar observations -8 ep Event probability -# 9-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 an Analysis products +1 fc Forecast products +2 af Analysis and forecast products +3 cf Control forecast products +4 pf Perturbed forecast products +5 cp Control and perturbed forecast products +6 sa Processed satellite observations +7 ra Processed radar observations +8 ep Event probability +# 9-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/9/3.0.table b/definitions/grib2/tables/9/3.0.table index 4baed0aab..4269b25ad 100644 --- a/definitions/grib2/tables/9/3.0.table +++ b/definitions/grib2/tables/9/3.0.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Specified in Code table 3.1 +0 0 Specified in Code table 3.1 1 1 Predetermined grid definition (Defined by originating centre) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 A grid definition does not apply to this product +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 A grid definition does not apply to this product diff --git a/definitions/grib2/tables/9/3.10.table b/definitions/grib2/tables/9/3.10.table index 23c1cdd36..da36dc664 100644 --- a/definitions/grib2/tables/9/3.10.table +++ b/definitions/grib2/tables/9/3.10.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 Points scan in +i direction, i.e. from pole to Equator -1 1 Points scan in -i direction, i.e. from Equator to pole -2 0 Points scan in +j direction, i.e. from west to east -2 1 Points scan in -j direction, i.e. from east to west -3 0 Adjacent points in i direction are consecutive -3 1 Adjacent points in j direction are consecutive -# 4-8 Reserved +1 0 Points scan in +i direction, i.e. from pole to Equator +1 1 Points scan in -i direction, i.e. from Equator to pole +2 0 Points scan in +j direction, i.e. from west to east +2 1 Points scan in -j direction, i.e. from east to west +3 0 Adjacent points in i direction are consecutive +3 1 Adjacent points in j direction are consecutive +# 4-8 Reserved diff --git a/definitions/grib2/tables/9/3.11.table b/definitions/grib2/tables/9/3.11.table index 560318d1b..0a299af98 100644 --- a/definitions/grib2/tables/9/3.11.table +++ b/definitions/grib2/tables/9/3.11.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 There is no appended list +0 0 There is no appended list 1 1 Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes) may not be reached in all rows 2 2 Numbers define number of points corresponding to coordinate lines delimited by extreme coordinate values given in grid definition (i.e. extreme longitudes) which are present in each row 3 3 Numbers define the actual latitudes for each row in the grid. The list of numbers are integer values of the valid latitudes in microdegrees (scaled by 10-6) or in unit equal to the ratio of the basic angle and the subdivisions number for each row, in the same order as specified in the scanning mode flag (bit no. 2) diff --git a/definitions/grib2/tables/9/3.15.table b/definitions/grib2/tables/9/3.15.table index 94f6c8e04..44e7a0983 100644 --- a/definitions/grib2/tables/9/3.15.table +++ b/definitions/grib2/tables/9/3.15.table @@ -1,23 +1,23 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 0-19 Reserved +# 0-19 Reserved 20 20 Temperature (K) -# 21-99 Reserved +# 21-99 Reserved 100 100 Pressure (Pa) 101 101 Pressure deviation from mean sea level (Pa) 102 102 Altitude above mean sea level (m) 103 103 Height above ground (m) -104 104 Sigma coordinate -105 105 Hybrid coordinate +104 104 Sigma coordinate +105 105 Hybrid coordinate 106 106 Depth below land surface (m) 107 pt Potential temperature (theta) (K) 108 108 Pressure deviation from ground to level (Pa) 109 pv Potential vorticity (K m-2 kg-1 s-1) 110 110 Geometrical height (m) -111 111 Eta coordinate +111 111 Eta coordinate 112 112 Geopotential height (gpm) 113 113 Logarithmic hybrid coordinate -# 114-159 Reserved +# 114-159 Reserved 160 160 Depth below sea level (m) -# 161-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 161-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/3.2.table b/definitions/grib2/tables/9/3.2.table index 3d7a4f1fc..563efbdb5 100644 --- a/definitions/grib2/tables/9/3.2.table +++ b/definitions/grib2/tables/9/3.2.table @@ -1,13 +1,13 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Earth assumed spherical with radius = 6 367 470.0 m -1 1 Earth assumed spherical with radius specified (in m) by data producer -2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) -3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer -4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) -5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) -6 6 Earth assumed spherical with radius of 6 371 229.0 m -7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer -8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame -# 9-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Earth assumed spherical with radius = 6 367 470.0 m +1 1 Earth assumed spherical with radius specified (in m) by data producer +2 2 Earth assumed oblate spheroid with size as determined by IAU in 1965 (major axis = 6 378 160.0 m, minor axis = 6 356 775.0 m, f = 1/297.0) +3 3 Earth assumed oblate spheroid with major and minor axes specified (in km) by data producer +4 4 Earth assumed oblate spheroid as defined in IAG-GRS80 model (major axis = 6 378 137.0 m, minor axis = 6 356 752.314 m, f = 1/298.257 222 101) +5 5 Earth assumed represented by WGS84 (as used by ICAO since 1998) +6 6 Earth assumed spherical with radius of 6 371 229.0 m +7 7 Earth assumed oblate spheroid with major or minor axes specified (in m) by data producer +8 8 Earth model assumed spherical with radius of 6 371 200 m, but the horizontal datum of the resulting latitude/longitude field is the WGS84 reference frame +# 9-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/3.20.table b/definitions/grib2/tables/9/3.20.table index 3f7ab4cc4..63de6b1a9 100644 --- a/definitions/grib2/tables/9/3.20.table +++ b/definitions/grib2/tables/9/3.20.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Rhumb -1 1 Great circle -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Rhumb +1 1 Great circle +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/3.21.table b/definitions/grib2/tables/9/3.21.table index b0c77d135..2bc46aae9 100644 --- a/definitions/grib2/tables/9/3.21.table +++ b/definitions/grib2/tables/9/3.21.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 -# 2-10 Reserved -11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1) = C1, f(n) = f(n-1) + C2 +# 2-10 Reserved +11 11 Geometric coordinates f(1) = C1, f(n) = C2 * f(n-1) +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/3.3.table b/definitions/grib2/tables/9/3.3.table index 5167ed6b7..bd47e2509 100644 --- a/definitions/grib2/tables/9/3.3.table +++ b/definitions/grib2/tables/9/3.3.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 1-2 Reserved -3 0 i direction increments not given -3 1 i direction increments given -4 0 j direction increments not given -4 1 j direction increments given -5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions -5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively -# 6-8 Reserved - set to zero +# 1-2 Reserved +3 0 i direction increments not given +3 1 i direction increments given +4 0 j direction increments not given +4 1 j direction increments given +5 0 Resolved u- and v- components of vector quantities relative to easterly and northerly directions +5 1 Resolved u- and v- components of vector quantities relative to the defined grid in the direction of increasing x and y (or i and j) coordinates, respectively +# 6-8 Reserved - set to zero diff --git a/definitions/grib2/tables/9/3.4.table b/definitions/grib2/tables/9/3.4.table index 6253896b1..752c70757 100644 --- a/definitions/grib2/tables/9/3.4.table +++ b/definitions/grib2/tables/9/3.4.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 Points of first row or column scan in the +i (+x) direction -1 1 Points of first row or column scan in the -i (-x) direction -2 0 Points of first row or column scan in the -j (-y) direction -2 1 Points of first row or column scan in the +j (+y) direction -3 0 Adjacent points in i (x) direction are consecutive -3 1 Adjacent points in j (y) direction is consecutive -4 0 All rows scan in the same direction -4 1 Adjacent rows scans in the opposite direction -# 5-8 Reserved +1 0 Points of first row or column scan in the +i (+x) direction +1 1 Points of first row or column scan in the -i (-x) direction +2 0 Points of first row or column scan in the -j (-y) direction +2 1 Points of first row or column scan in the +j (+y) direction +3 0 Adjacent points in i (x) direction are consecutive +3 1 Adjacent points in j (y) direction is consecutive +4 0 All rows scan in the same direction +4 1 Adjacent rows scans in the opposite direction +# 5-8 Reserved diff --git a/definitions/grib2/tables/9/3.5.table b/definitions/grib2/tables/9/3.5.table index 8ccf0f13b..6d3ec036e 100644 --- a/definitions/grib2/tables/9/3.5.table +++ b/definitions/grib2/tables/9/3.5.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 North Pole is on the projection plane -1 1 South Pole is on the projection plane -2 0 Only one projection centre is used -2 1 Projection is bipolar and symmetric +1 0 North Pole is on the projection plane +1 1 South Pole is on the projection plane +2 0 Only one projection centre is used +2 1 Projection is bipolar and symmetric diff --git a/definitions/grib2/tables/9/3.7.table b/definitions/grib2/tables/9/3.7.table index 65693989a..4b2e684d3 100644 --- a/definitions/grib2/tables/9/3.7.table +++ b/definitions/grib2/tables/9/3.7.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved +0 0 Reserved 1 1 The complex numbers Fnm (see code figure 1 in Code Table 3.6 above) are stored for m>=0 as pairs of real numbers Re(Fnm), Im(Fnm) ordered with n increasing from m to N(m), first for m=0 and then for m=1, 2, ... M. (see Note 1) -# 2-254 Reserved +# 2-254 Reserved 255 255 Missing diff --git a/definitions/grib2/tables/9/3.8.table b/definitions/grib2/tables/9/3.8.table index 4e811917b..6df554ae9 100644 --- a/definitions/grib2/tables/9/3.8.table +++ b/definitions/grib2/tables/9/3.8.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Grid points at triangle vertices -1 1 Grid points at centres of triangles -2 2 Grid points at midpoints of triangle sides -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Grid points at triangle vertices +1 1 Grid points at centres of triangles +2 2 Grid points at midpoints of triangle sides +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/3.9.table b/definitions/grib2/tables/9/3.9.table index f35b7ca53..530d1dee0 100644 --- a/definitions/grib2/tables/9/3.9.table +++ b/definitions/grib2/tables/9/3.9.table @@ -1,4 +1,4 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 0 Clockwise orientation -1 1 Anti-clockwise (i.e. counter-clockwise) orientation -# 2-8 Reserved +1 0 Clockwise orientation +1 1 Anti-clockwise (i.e. counter-clockwise) orientation +# 2-8 Reserved diff --git a/definitions/grib2/tables/9/4.0.table b/definitions/grib2/tables/9/4.0.table index faa4f59df..0852d9f0d 100644 --- a/definitions/grib2/tables/9/4.0.table +++ b/definitions/grib2/tables/9/4.0.table @@ -1,52 +1,52 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time -1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time -2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time -3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time -4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time -5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time -6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time -7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time +0 0 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time +1 1 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time +2 2 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer at a point in time +3 3 Derived forecasts based on a cluster of ensemble members over a rectangular area at a horizontal level or in a horizontal layer at a point in time +4 4 Derived forecasts based on a cluster of ensemble members over a circular area at a horizontal level or in a horizontal layer at a point in time +5 5 Probability forecasts at a horizontal level or in a horizontal layer at a point in time +6 6 Percentile forecasts at a horizontal level or in a horizontal layer at a point in time +7 7 Analysis or forecast error at a horizontal level or in a horizontal layer at a point in time 8 8 Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval -15 15 Average, accumulation, extreme values, or other statistically-processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time -# 16-19 Reserved -20 20 Radar product -# 21-29 Reserved -30 30 Satellite product (deprecated) -31 31 Satellite product -32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data +9 9 Probability forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +10 10 Percentile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +11 11 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +12 12 Derived forecasts based on all ensemble members at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +13 13 Derived forecasts based on a cluster of ensemble members over a rectangular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +14 14 Derived forecasts based on a cluster of ensemble members over a circular area, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval +15 15 Average, accumulation, extreme values, or other statistically-processed values over a spatial area at a horizontal level or in a horizontal layer at a point in time +# 16-19 Reserved +20 20 Radar product +# 21-29 Reserved +30 30 Satellite product (deprecated) +31 31 Satellite product +32 32 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data # 33-39 Reserved 311 311 Satellite product auxiliary information -40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents -41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +40 40 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents +41 41 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents 42 42 Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents 43 43 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous time interval for atmospheric chemical constituents -44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol -45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol +44 44 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for aerosol +45 45 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for aerosol 46 46 Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol 47 47 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non continuous time interval for aerosol 48 48 Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of atmospheric aerosol -51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time -# 52-90 Reserved -91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval -# 92-253 Reserved -254 254 CCITT IA5 character string -# 255-999 Reserved -1000 1000 Cross-section of analysis and forecast at a point in time -1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time -1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude -# 1003-1099 Reserved -1100 1100 Hovmoller-type grid with no averaging or other statistical processing -1101 1101 Hovmoller-type grid with averaging or other statistical processing +51 51 Categorical forecasts at a horizontal level or in a horizontal layer at a point in time +# 52-90 Reserved +91 91 Categorical forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval +# 92-253 Reserved +254 254 CCITT IA5 character string +# 255-999 Reserved +1000 1000 Cross-section of analysis and forecast at a point in time +1001 1001 Cross-section of averaged or otherwise statistically processed analysis or forecast over a range of time +1002 1002 Cross-section of analysis and forecast, averaged or otherwise statistically processed over latitude or longitude +# 1003-1099 Reserved +1100 1100 Hovmoller-type grid with no averaging or other statistical processing +1101 1101 Hovmoller-type grid with averaging or other statistical processing 50001 50001 Forecasting Systems with Variable Resolution in a point in time 50011 50011 Forecasting Systems with Variable Resolution in a continous or non countinous time interval -# 1102-32767 Reserved +# 1102-32767 Reserved # 32768-65534 Reserved for local use 40033 40033 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for simulated (synthetic) satellite data 40034 40034 Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for simulated (synthetic) satellite data diff --git a/definitions/grib2/tables/9/4.1.0.table b/definitions/grib2/tables/9/4.1.0.table index 361108860..3413dbad5 100644 --- a/definitions/grib2/tables/9/4.1.0.table +++ b/definitions/grib2/tables/9/4.1.0.table @@ -1,27 +1,27 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Temperature -1 1 Moisture -2 2 Momentum -3 3 Mass -4 4 Short-wave radiation -5 5 Long-wave radiation -6 6 Cloud -7 7 Thermodynamic stability indices -8 8 Kinematic stability indices -9 9 Temperature probabilities -10 10 Moisture probabilities -11 11 Momentum probabilities -12 12 Mass probabilities -13 13 Aerosols -14 14 Trace gases (e.g. ozone, CO2) -15 15 Radar -16 16 Forecast radar imagery -17 17 Electrodynamics -18 18 Nuclear/radiology -19 19 Physical atmospheric properties -20 20 Atmospheric chemical constituents -# 21-189 Reserved -190 190 CCITT IA5 string -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Temperature +1 1 Moisture +2 2 Momentum +3 3 Mass +4 4 Short-wave radiation +5 5 Long-wave radiation +6 6 Cloud +7 7 Thermodynamic stability indices +8 8 Kinematic stability indices +9 9 Temperature probabilities +10 10 Moisture probabilities +11 11 Momentum probabilities +12 12 Mass probabilities +13 13 Aerosols +14 14 Trace gases (e.g. ozone, CO2) +15 15 Radar +16 16 Forecast radar imagery +17 17 Electrodynamics +18 18 Nuclear/radiology +19 19 Physical atmospheric properties +20 20 Atmospheric chemical constituents +# 21-189 Reserved +190 190 CCITT IA5 string +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.1.1.table b/definitions/grib2/tables/9/4.1.1.table index 29f1dec79..dea5bc49e 100644 --- a/definitions/grib2/tables/9/4.1.1.table +++ b/definitions/grib2/tables/9/4.1.1.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Hydrology basic products -1 1 Hydrology probabilities -2 2 Inland water and sediment properties -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Hydrology basic products +1 1 Hydrology probabilities +2 2 Inland water and sediment properties +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.1.10.table b/definitions/grib2/tables/9/4.1.10.table index 9c8c92b12..e6ce6faf7 100644 --- a/definitions/grib2/tables/9/4.1.10.table +++ b/definitions/grib2/tables/9/4.1.10.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Waves -1 1 Currents -2 2 Ice -3 3 Surface properties -4 4 Sub-surface properties -# 5-190 Reserved -191 191 Miscellaneous -# 192-254 Reserved for local use -255 255 Missing +0 0 Waves +1 1 Currents +2 2 Ice +3 3 Surface properties +4 4 Sub-surface properties +# 5-190 Reserved +191 191 Miscellaneous +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.1.2.table b/definitions/grib2/tables/9/4.1.2.table index b90201c63..805836998 100644 --- a/definitions/grib2/tables/9/4.1.2.table +++ b/definitions/grib2/tables/9/4.1.2.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Vegetation/biomass -1 1 Agri-/aquacultural special products -2 2 Transportation-related products -3 3 Soil products -4 4 Fire weather products -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Vegetation/biomass +1 1 Agri-/aquacultural special products +2 2 Transportation-related products +3 3 Soil products +4 4 Fire weather products +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.1.3.table b/definitions/grib2/tables/9/4.1.3.table index 3c947b136..c96617665 100644 --- a/definitions/grib2/tables/9/4.1.3.table +++ b/definitions/grib2/tables/9/4.1.3.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Image format products -1 1 Quantitative products -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Image format products +1 1 Quantitative products +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.10.table b/definitions/grib2/tables/9/4.10.table index 0e5170876..a13fb00b4 100644 --- a/definitions/grib2/tables/9/4.10.table +++ b/definitions/grib2/tables/9/4.10.table @@ -1,15 +1,15 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 avg Average -1 accum Accumulation -2 max Maximum -3 min Minimum -4 diff Difference (value at the end of time range minus value at the beginning) -5 rms Root mean square -6 sd Standard deviation -7 cov Covariance (temporal variance) -8 8 Difference (value at the start of time range minus value at the end) -9 ratio Ratio -10 10 Standardized anomaly -# 11-191 Reserved -# 192-254 Reserved for local use -255 missing Missing +0 avg Average +1 accum Accumulation +2 max Maximum +3 min Minimum +4 diff Difference (value at the end of time range minus value at the beginning) +5 rms Root mean square +6 sd Standard deviation +7 cov Covariance (temporal variance) +8 8 Difference (value at the start of time range minus value at the end) +9 ratio Ratio +10 10 Standardized anomaly +# 11-191 Reserved +# 192-254 Reserved for local use +255 missing Missing diff --git a/definitions/grib2/tables/9/4.11.table b/definitions/grib2/tables/9/4.11.table index 1257d1b09..af9ff29ad 100644 --- a/definitions/grib2/tables/9/4.11.table +++ b/definitions/grib2/tables/9/4.11.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Successive times processed have same forecast time, start time of forecast is incremented -2 2 Successive times processed have same start time of forecast, forecast time is incremented -3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant -4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant -5 5 Floating subinterval of time between forecast time and end of overall time interval -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Successive times processed have same forecast time, start time of forecast is incremented +2 2 Successive times processed have same start time of forecast, forecast time is incremented +3 3 Successive times processed have start time of forecast incremented and forecast time decremented so that valid time remains constant +4 4 Successive times processed have start time of forecast decremented and forecast time incremented so that valid time remains constant +5 5 Floating subinterval of time between forecast time and end of overall time interval +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.12.table b/definitions/grib2/tables/9/4.12.table index 680b6456d..6cab67bf5 100644 --- a/definitions/grib2/tables/9/4.12.table +++ b/definitions/grib2/tables/9/4.12.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Maintenance mode -1 1 Clear air -2 2 Precipitation +0 0 Maintenance mode +1 1 Clear air +2 2 Precipitation # 3-191 Reserved # 192-254 Reserved for local use -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/9/4.13.table b/definitions/grib2/tables/9/4.13.table index 0d0474d69..f090fb9ae 100644 --- a/definitions/grib2/tables/9/4.13.table +++ b/definitions/grib2/tables/9/4.13.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No quality control applied -1 1 Quality control applied +0 0 No quality control applied +1 1 Quality control applied # 2-191 Reserved # 192-254 Reserved for local use -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/9/4.14.table b/definitions/grib2/tables/9/4.14.table index 9ed9078a8..bcb04f328 100644 --- a/definitions/grib2/tables/9/4.14.table +++ b/definitions/grib2/tables/9/4.14.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No clutter filter used -1 1 Clutter filter used +0 0 No clutter filter used +1 1 Clutter filter used # 2-191 Reserved # 192-254 Reserved for local use -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/9/4.15.table b/definitions/grib2/tables/9/4.15.table index 4c8a88401..6e1ef5745 100644 --- a/definitions/grib2/tables/9/4.15.table +++ b/definitions/grib2/tables/9/4.15.table @@ -1,11 +1,11 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Data is calculated directly from the source grid with no interpolation -1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point -4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point -6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +0 0 Data is calculated directly from the source grid with no interpolation +1 1 Bilinear interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +2 2 Bicubic interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +3 3 Using the value from the source grid grid-point which is nearest to the nominal grid-point +4 4 Budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +5 5 Spectral interpolation using the 4 source grid grid-point values surrounding the nominal grid-point +6 6 Neighbor-budget interpolation using the 4 source grid grid-point values surrounding the nominal grid-point # 7-191 Reserved # 192-254 Reserved for local use -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.0.table b/definitions/grib2/tables/9/4.2.0.0.table index debc0a6f4..8656f8974 100644 --- a/definitions/grib2/tables/9/4.2.0.0.table +++ b/definitions/grib2/tables/9/4.2.0.0.table @@ -20,6 +20,6 @@ 18 18 Snow temperature (top of snow) (K) 19 19 Turbulent transfer coefficient for heat (Numeric) 20 20 Turbulent diffusion coefficient for heat (m2/s) -# 21-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 21-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.1.table b/definitions/grib2/tables/9/4.2.0.1.table index 1922792a6..8ee93e99b 100644 --- a/definitions/grib2/tables/9/4.2.0.1.table +++ b/definitions/grib2/tables/9/4.2.0.1.table @@ -62,7 +62,7 @@ 60 60 Snow depth water equivalent (kg m-2) 61 61 Snow density (kg m-3) 62 62 Snow evaporation (kg m-2) -63 63 Reserved +63 63 Reserved 64 64 Total column integrated water vapour (kg m-2) 65 65 Rain precipitation rate (kg m-2 s-1) 66 66 Snow precipitation rate (kg m-2 s-1) @@ -86,10 +86,10 @@ 84 84 Specific cloud ice water content (kg/kg) 85 85 Specific rain water content (kg/kg) 86 86 Specific snow water content (kg/kg) -# 87-89 Reserved +# 87-89 Reserved 90 90 Total kinematic moisture flux (kg kg-1 m s-1) 91 91 u-component (zonal) kinematic moisture flux (kg kg-1 m s-1) 92 92 v-component (meridional) kinematic moisture flux (kg kg-1 m s-1) -# 93-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 93-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.13.table b/definitions/grib2/tables/9/4.2.0.13.table index b9979f0d3..90ab7d1b9 100644 --- a/definitions/grib2/tables/9/4.2.0.13.table +++ b/definitions/grib2/tables/9/4.2.0.13.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Aerosol type (Code table 4.205) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.14.table b/definitions/grib2/tables/9/4.2.0.14.table index 4a2a4e128..fca42ccc7 100644 --- a/definitions/grib2/tables/9/4.2.0.14.table +++ b/definitions/grib2/tables/9/4.2.0.14.table @@ -2,6 +2,6 @@ 0 0 Total ozone (DU) 1 1 Ozone mixing ratio (kg/kg) 2 2 Total column integrated ozone (DU) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.15.table b/definitions/grib2/tables/9/4.2.0.15.table index 895892f86..66ccff19d 100644 --- a/definitions/grib2/tables/9/4.2.0.15.table +++ b/definitions/grib2/tables/9/4.2.0.15.table @@ -14,6 +14,6 @@ 12 12 Reflectivity of rain (dB) 13 13 Reflectivity of graupel (dB) 14 14 Reflectivity of hail (dB) -# 15-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 15-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.16.table b/definitions/grib2/tables/9/4.2.0.16.table index 39215ab20..18dedb7c0 100644 --- a/definitions/grib2/tables/9/4.2.0.16.table +++ b/definitions/grib2/tables/9/4.2.0.16.table @@ -5,6 +5,6 @@ 3 3 Echo top (m) 4 4 Reflectivity (dB) 5 5 Composite reflectivity (dB) -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.18.table b/definitions/grib2/tables/9/4.2.0.18.table index 30060fd2d..165aa6008 100644 --- a/definitions/grib2/tables/9/4.2.0.18.table +++ b/definitions/grib2/tables/9/4.2.0.18.table @@ -8,11 +8,11 @@ 6 6 Time-integrated air concentration of caesium pollutant (Bq s m-3) 7 7 Time-integrated air concentration of iodine pollutant (Bq s m-3) 8 8 Time-integrated air concentration of radioactive pollutant (Bq s m-3) -9 9 Reserved +9 9 Reserved 10 10 Air concentration (Bq m-3) 11 11 Wet deposition (Bq m-2) 12 12 Dry deposition (Bq m-2) 13 13 Total deposition (wet + dry) (Bq m-2) -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.19.table b/definitions/grib2/tables/9/4.2.0.19.table index 5831b567c..cbce2f76c 100644 --- a/definitions/grib2/tables/9/4.2.0.19.table +++ b/definitions/grib2/tables/9/4.2.0.19.table @@ -27,6 +27,6 @@ 25 25 Weather (Code table 4.225) 26 26 Convective outlook (Code table 4.224) 27 27 Icing scenario (Code table 4.227) -# 28-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 28-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.190.table b/definitions/grib2/tables/9/4.2.0.190.table index 39fb55746..3d9d5ff85 100644 --- a/definitions/grib2/tables/9/4.2.0.190.table +++ b/definitions/grib2/tables/9/4.2.0.190.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Arbitrary text string (CCITT IA5) -# 1-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 1-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.191.table b/definitions/grib2/tables/9/4.2.0.191.table index 81230c0e0..4ff12e532 100644 --- a/definitions/grib2/tables/9/4.2.0.191.table +++ b/definitions/grib2/tables/9/4.2.0.191.table @@ -2,6 +2,6 @@ 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Geographical latitude (deg N) 2 2 Geographical longitude (deg E) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing value +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing value diff --git a/definitions/grib2/tables/9/4.2.0.2.table b/definitions/grib2/tables/9/4.2.0.2.table index e8b59a998..68aa47ba6 100644 --- a/definitions/grib2/tables/9/4.2.0.2.table +++ b/definitions/grib2/tables/9/4.2.0.2.table @@ -35,6 +35,6 @@ 33 33 Wind fetch (m) 34 34 Normal wind component (m/s) 35 35 Tangential wind component (m/s) -# 36-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 36-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.20.table b/definitions/grib2/tables/9/4.2.0.20.table index cc2dbcc52..898a774eb 100644 --- a/definitions/grib2/tables/9/4.2.0.20.table +++ b/definitions/grib2/tables/9/4.2.0.20.table @@ -14,7 +14,7 @@ 12 12 Dry deposition mass flux (kg m-2 s-1) 13 13 Transfer from hydrophobic to hydrophilic (kg kg-1 s-1) 14 14 Transfer from SO2 (Sulphur dioxide) to SO4 (sulphate) (kg kg-1 s-1) -# 15-49 Reserved +# 15-49 Reserved 50 50 Amount in atmosphere (mol) 51 51 Concentration in air (mol m-3) 52 52 Volume mixing ratio (fraction in air) (mol/mol) @@ -25,7 +25,7 @@ 57 57 Total yearly average burden of the atmosphere (mol) 58 58 Total yearly averaged atmospheric loss (mol/s) 59 59 Aerosol number concentration (m-3) -# 60-99 Reserved +# 60-99 Reserved 100 100 Surface area density (aerosol) (/m) 101 101 Vertical visual range (m) 102 102 Aerosol optical thickness (Numeric) @@ -37,6 +37,6 @@ 108 108 Aerosol lidar backscatter from the ground (m-1 sr-1) 109 109 Aerosol lidar extinction from satellite (m-1) 110 110 Aerosol lidar extinction from the ground (m-1) -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.3.table b/definitions/grib2/tables/9/4.2.0.3.table index f718c6ea9..08c1c7bc3 100644 --- a/definitions/grib2/tables/9/4.2.0.3.table +++ b/definitions/grib2/tables/9/4.2.0.3.table @@ -26,6 +26,6 @@ 24 24 Anisotropy of sub-gridscale orography (Numeric) 25 25 Natural logarithm of pressure in Pa (Numeric) 26 26 Exner pressure (Numeric) -# 27-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 27-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.4.table b/definitions/grib2/tables/9/4.2.0.4.table index fea4cafc3..336fdb421 100644 --- a/definitions/grib2/tables/9/4.2.0.4.table +++ b/definitions/grib2/tables/9/4.2.0.4.table @@ -12,9 +12,9 @@ 10 10 Photosynthetically active radiation (W m-2) 11 11 Net short-wave radiation flux, clear sky (W m-2) 12 12 Downward UV radiation (W m-2) -# 13-49 Reserved +# 13-49 Reserved 50 50 UV index (under clear sky) (Numeric) 51 51 UV index (Numeric) -# 52-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 52-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.5.table b/definitions/grib2/tables/9/4.2.0.5.table index aae853bf9..607235064 100644 --- a/definitions/grib2/tables/9/4.2.0.5.table +++ b/definitions/grib2/tables/9/4.2.0.5.table @@ -6,6 +6,6 @@ 4 4 Upward long-wave radiation flux (W m-2) 5 5 Net long wave radiation flux (W m-2) 6 6 Net long-wave radiation flux, clear sky (W m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.6.table b/definitions/grib2/tables/9/4.2.0.6.table index fd4b23014..fb935344e 100644 --- a/definitions/grib2/tables/9/4.2.0.6.table +++ b/definitions/grib2/tables/9/4.2.0.6.table @@ -35,6 +35,6 @@ 33 33 Sunshine duration (s) 34 34 Surface long wave effective total cloudiness (Numeric) 35 35 Surface short wave effective total cloudiness (Numeric) -# 36-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 36-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.0.7.table b/definitions/grib2/tables/9/4.2.0.7.table index 7a7d2008b..6c1794c73 100644 --- a/definitions/grib2/tables/9/4.2.0.7.table +++ b/definitions/grib2/tables/9/4.2.0.7.table @@ -13,8 +13,8 @@ 11 11 Best (4-layer) lifted index (K) 12 12 Richardson number (Numeric) 13 13 Showalter index (K) -14 14 Reserved +14 14 Reserved 15 15 Updraft helicity (m2 s-2) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.1.0.table b/definitions/grib2/tables/9/4.2.1.0.table index bf1e3e93f..9c4d129da 100644 --- a/definitions/grib2/tables/9/4.2.1.0.table +++ b/definitions/grib2/tables/9/4.2.1.0.table @@ -6,6 +6,6 @@ 4 4 Snow water equivalent per cent of normal (%) 5 5 Baseflow-groundwater runoff (kg m-2) 6 6 Storm surface runoff (kg m-2) -# 7-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 7-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.1.1.table b/definitions/grib2/tables/9/4.2.1.1.table index cb5117dc8..aa560e479 100644 --- a/definitions/grib2/tables/9/4.2.1.1.table +++ b/definitions/grib2/tables/9/4.2.1.1.table @@ -2,6 +2,6 @@ 0 0 Conditional per cent precipitation amount fractile for an overall period (Encoded as an accumulation) (kg m-2) 1 1 Per cent precipitation in a sub-period of an overall period (Encoded as per cent accumulation over the sub-period) (%) 2 2 Probability of 0.01 inch of precipitation (POP) (%) -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.10.0.table b/definitions/grib2/tables/9/4.2.10.0.table index d4321d955..8bba32cf5 100644 --- a/definitions/grib2/tables/9/4.2.10.0.table +++ b/definitions/grib2/tables/9/4.2.10.0.table @@ -45,6 +45,6 @@ 43 43 Kurtosis of the sea surface elevation due to waves (-) 44 44 Benjamin-Feir index (-) 45 45 Spectral peakedness factor (s-1) -# 46-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 46-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.10.1.table b/definitions/grib2/tables/9/4.2.10.1.table index 5a33bac5d..a076fb07c 100644 --- a/definitions/grib2/tables/9/4.2.10.1.table +++ b/definitions/grib2/tables/9/4.2.10.1.table @@ -3,6 +3,6 @@ 1 1 Current speed (m/s) 2 2 u-component of current (m/s) 3 3 v-component of current (m/s) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.10.191.table b/definitions/grib2/tables/9/4.2.10.191.table index 14085ac9a..6cafbd3d4 100644 --- a/definitions/grib2/tables/9/4.2.10.191.table +++ b/definitions/grib2/tables/9/4.2.10.191.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Seconds prior to initial reference time (defined in Section 1) (s) 1 1 Meridional overturning stream function (m3/s) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.10.2.table b/definitions/grib2/tables/9/4.2.10.2.table index a69b2622c..80fe973be 100644 --- a/definitions/grib2/tables/9/4.2.10.2.table +++ b/definitions/grib2/tables/9/4.2.10.2.table @@ -9,6 +9,6 @@ 7 7 Ice divergence (/s) 8 8 Ice temperature (K) 9 9 Ice internal pressure (Pa m) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.10.3.table b/definitions/grib2/tables/9/4.2.10.3.table index 112af09d5..3b9a2df46 100644 --- a/definitions/grib2/tables/9/4.2.10.3.table +++ b/definitions/grib2/tables/9/4.2.10.3.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 Water temperature (K) 1 1 Deviation of sea level from mean (m) -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.10.4.table b/definitions/grib2/tables/9/4.2.10.4.table index d80a32780..91ffb2b29 100644 --- a/definitions/grib2/tables/9/4.2.10.4.table +++ b/definitions/grib2/tables/9/4.2.10.4.table @@ -7,12 +7,12 @@ 5 5 Ocean vertical salt diffusivity (m2 s-1) 6 6 Ocean vertical momentum diffusivity (m2 s-1) 7 7 Bathymetry (m) -# 8-10 Reserved +# 8-10 Reserved 11 11 Shape factor with respect to salinity profile (-) 12 12 Shape factor with respect to temperature profile in thermocline (-) 13 13 Attenuation coefficient of water with respect to solar radiation (m-1) 14 14 Water depth (m) 15 15 Water temperature (K) -# 16-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 16-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.2.0.table b/definitions/grib2/tables/9/4.2.2.0.table index ed4a85093..bbd328f0a 100644 --- a/definitions/grib2/tables/9/4.2.2.0.table +++ b/definitions/grib2/tables/9/4.2.2.0.table @@ -32,6 +32,6 @@ 30 30 Deciduous forest cover (Proportion) 31 31 Normalized differential vegetation index (NDVI) (Numeric) 32 32 Root depth of vegetation (m) -# 33-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 33-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.2.3.table b/definitions/grib2/tables/9/4.2.2.3.table index 80113a4bd..a9ec602e6 100644 --- a/definitions/grib2/tables/9/4.2.2.3.table +++ b/definitions/grib2/tables/9/4.2.2.3.table @@ -22,6 +22,6 @@ 20 20 Column-integrated soil moisture (kg m-2) 21 21 Soil ice (kg m-3) 22 22 Column-integrated soil ice (kg m-2) -# 23-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 23-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.3.0.table b/definitions/grib2/tables/9/4.2.3.0.table index 254e56bc8..8c19d43b2 100644 --- a/definitions/grib2/tables/9/4.2.3.0.table +++ b/definitions/grib2/tables/9/4.2.3.0.table @@ -9,6 +9,6 @@ 7 7 Cloud mask (Code table 4.217) 8 8 Pixel scene type (Code table 4.218) 9 9 Fire detection indicator (Code table 4.223) -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.2.3.1.table b/definitions/grib2/tables/9/4.2.3.1.table index 16eee69c4..d199aff60 100644 --- a/definitions/grib2/tables/9/4.2.3.1.table +++ b/definitions/grib2/tables/9/4.2.3.1.table @@ -17,12 +17,12 @@ 15 15 Clear-sky brightness temperature (K) 16 16 Cloudy radiance (with respect to wave number) (W m-1 sr-1) 17 17 Clear-sky radiance (with respect to wave number) (W m-1 sr-1) -18 18 Reserved +18 18 Reserved 19 19 Wind speed (m/s) 20 20 Aerosol optical thickness at 0.635 um 21 21 Aerosol optical thickness at 0.810 um 22 22 Aerosol optical thickness at 1.640 um -23 23 Angstrom coefficient -# 24-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +23 23 Angstrom coefficient +# 24-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.201.table b/definitions/grib2/tables/9/4.201.table index d1aa3491d..e16d5d808 100644 --- a/definitions/grib2/tables/9/4.201.table +++ b/definitions/grib2/tables/9/4.201.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Rain -2 2 Thunderstorm -3 3 Freezing rain -4 4 Mixed/ice -5 5 Snow +0 0 Reserved +1 1 Rain +2 2 Thunderstorm +3 3 Freezing rain +4 4 Mixed/ice +5 5 Snow # 6-191 Reserved # 192-254 Reserved for local use -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/9/4.203.table b/definitions/grib2/tables/9/4.203.table index fce5a15b1..9a8d29e01 100644 --- a/definitions/grib2/tables/9/4.203.table +++ b/definitions/grib2/tables/9/4.203.table @@ -1,25 +1,25 @@ -0 0 Clear -1 1 Cumulonimbus -2 2 Stratus -3 3 Stratocumulus -4 4 Cumulus -5 5 Altostratus -6 6 Nimbostratus -7 7 Altocumulus -8 8 Cirrostratus -9 9 Cirrocumulus -10 10 Cirrus -11 11 Cumulonimbus - ground-based fog beneath the lowest layer -12 12 Stratus - ground-based fog beneath the lowest layer -13 13 Stratocumulus - ground-based fog beneath the lowest layer -14 14 Cumulus - ground-based fog beneath the lowest layer -15 15 Altostratus - ground-based fog beneath the lowest layer -16 16 Nimbostratus - ground-based fog beneath the lowest layer -17 17 Altocumulus - ground-based fog beneath the lowest layer -18 18 Cirrostratus - ground-based fog beneath the lowest layer -19 19 Cirrocumulus - ground-based fog beneath the lowest layer -20 20 Cirrus - ground-based fog beneath the lowest layer -# 21-190 Reserved -191 191 Unknown -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear +1 1 Cumulonimbus +2 2 Stratus +3 3 Stratocumulus +4 4 Cumulus +5 5 Altostratus +6 6 Nimbostratus +7 7 Altocumulus +8 8 Cirrostratus +9 9 Cirrocumulus +10 10 Cirrus +11 11 Cumulonimbus - ground-based fog beneath the lowest layer +12 12 Stratus - ground-based fog beneath the lowest layer +13 13 Stratocumulus - ground-based fog beneath the lowest layer +14 14 Cumulus - ground-based fog beneath the lowest layer +15 15 Altostratus - ground-based fog beneath the lowest layer +16 16 Nimbostratus - ground-based fog beneath the lowest layer +17 17 Altocumulus - ground-based fog beneath the lowest layer +18 18 Cirrostratus - ground-based fog beneath the lowest layer +19 19 Cirrocumulus - ground-based fog beneath the lowest layer +20 20 Cirrus - ground-based fog beneath the lowest layer +# 21-190 Reserved +191 191 Unknown +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.204.table b/definitions/grib2/tables/9/4.204.table index a1bdcdf05..8d8bca9b2 100644 --- a/definitions/grib2/tables/9/4.204.table +++ b/definitions/grib2/tables/9/4.204.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 None -1 1 Isolated (1-2%) -2 2 Few (3-5%) -3 3 Scattered (16-45%) -4 4 Numerous (> 45%) +0 0 None +1 1 Isolated (1-2%) +2 2 Few (3-5%) +3 3 Scattered (16-45%) +4 4 Numerous (> 45%) # 5-191 Reserved # 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/9/4.205.table b/definitions/grib2/tables/9/4.205.table index 8d425ab9d..3fadf7d80 100644 --- a/definitions/grib2/tables/9/4.205.table +++ b/definitions/grib2/tables/9/4.205.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Aerosol not present -1 1 Aerosol present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Aerosol not present +1 1 Aerosol present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.206.table b/definitions/grib2/tables/9/4.206.table index 0be7fd4f8..43b0ba137 100644 --- a/definitions/grib2/tables/9/4.206.table +++ b/definitions/grib2/tables/9/4.206.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Not present -1 1 Present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not present +1 1 Present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.207.table b/definitions/grib2/tables/9/4.207.table index fde9eb477..815a5777e 100644 --- a/definitions/grib2/tables/9/4.207.table +++ b/definitions/grib2/tables/9/4.207.table @@ -1,10 +1,10 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 None -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Trace -5 5 Heavy -# 6-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Trace +5 5 Heavy +# 6-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.208.table b/definitions/grib2/tables/9/4.208.table index 196becaaf..23ea97317 100644 --- a/definitions/grib2/tables/9/4.208.table +++ b/definitions/grib2/tables/9/4.208.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 None (smooth) -1 1 Light -2 2 Moderate -3 3 Severe -4 4 Extreme -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 None (smooth) +1 1 Light +2 2 Moderate +3 3 Severe +4 4 Extreme +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.209.table b/definitions/grib2/tables/9/4.209.table index 351c0f431..53c6c5eba 100644 --- a/definitions/grib2/tables/9/4.209.table +++ b/definitions/grib2/tables/9/4.209.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Stable -2 2 Mechanically-driven turbulence -3 3 Forced convection -4 4 Free convection -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Stable +2 2 Mechanically-driven turbulence +3 3 Forced convection +4 4 Free convection +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.210.table b/definitions/grib2/tables/9/4.210.table index 1c00b8c6f..149b2ba06 100644 --- a/definitions/grib2/tables/9/4.210.table +++ b/definitions/grib2/tables/9/4.210.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Contrail not present -1 1 Contrail present -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Contrail not present +1 1 Contrail present +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.211.table b/definitions/grib2/tables/9/4.211.table index 66ef656f6..b5753f19f 100644 --- a/definitions/grib2/tables/9/4.211.table +++ b/definitions/grib2/tables/9/4.211.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Low bypass -1 1 High bypass -2 2 Non-bypass -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Low bypass +1 1 High bypass +2 2 Non-bypass +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.212.table b/definitions/grib2/tables/9/4.212.table index c59bd24e8..738c45d2c 100644 --- a/definitions/grib2/tables/9/4.212.table +++ b/definitions/grib2/tables/9/4.212.table @@ -1,18 +1,18 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Urban land -2 2 Agriculture -3 3 Range land -4 4 Deciduous forest -5 5 Coniferous forest -6 6 Forest/wetland -7 7 Water -8 8 Wetlands -9 9 Desert -10 10 Tundra -11 11 Ice -12 12 Tropical forest -13 13 Savannah -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Urban land +2 2 Agriculture +3 3 Range land +4 4 Deciduous forest +5 5 Coniferous forest +6 6 Forest/wetland +7 7 Water +8 8 Wetlands +9 9 Desert +10 10 Tundra +11 11 Ice +12 12 Tropical forest +13 13 Savannah +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.213.table b/definitions/grib2/tables/9/4.213.table index 0f5de0104..5cee0b798 100644 --- a/definitions/grib2/tables/9/4.213.table +++ b/definitions/grib2/tables/9/4.213.table @@ -1,21 +1,21 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 Sand -2 2 Loamy sand -3 3 Sandy loam -4 4 Silt loam -5 5 Organic (redefined) -6 6 Sandy clay loam -7 7 Silt clay loam -8 8 Clay loam -9 9 Sandy clay -10 10 Silty clay -11 11 Clay -12 12 Loam -13 13 Peat -14 14 Rock -15 15 Ice -16 16 Water -# 17-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Reserved +1 1 Sand +2 2 Loamy sand +3 3 Sandy loam +4 4 Silt loam +5 5 Organic (redefined) +6 6 Sandy clay loam +7 7 Silt clay loam +8 8 Clay loam +9 9 Sandy clay +10 10 Silty clay +11 11 Clay +12 12 Loam +13 13 Peat +14 14 Rock +15 15 Ice +16 16 Water +# 17-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.215.table b/definitions/grib2/tables/9/4.215.table index 460888217..5ed37c034 100644 --- a/definitions/grib2/tables/9/4.215.table +++ b/definitions/grib2/tables/9/4.215.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -# 0-49 Reserved -50 50 No-snow/no-cloud -# 51-99 Reserved -100 100 Clouds -# 101-249 Reserved -250 250 Snow -# 251-254 Reserved for local use -255 255 Missing +# 0-49 Reserved +50 50 No-snow/no-cloud +# 51-99 Reserved +100 100 Clouds +# 101-249 Reserved +250 250 Snow +# 251-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.216.table b/definitions/grib2/tables/9/4.216.table index cc62ca5e3..2fd143724 100644 --- a/definitions/grib2/tables/9/4.216.table +++ b/definitions/grib2/tables/9/4.216.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit # 0-90 Elevation in increments of 100 m -# 91-253 Reserved -254 254 Clouds -255 255 Missing +# 91-253 Reserved +254 254 Clouds +255 255 Missing diff --git a/definitions/grib2/tables/9/4.217.table b/definitions/grib2/tables/9/4.217.table index 51a263a99..6a014c9c3 100644 --- a/definitions/grib2/tables/9/4.217.table +++ b/definitions/grib2/tables/9/4.217.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Clear over water -1 1 Clear over land -2 2 Cloud -3 3 No data -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Clear over water +1 1 Clear over land +2 2 Cloud +3 3 No data +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.218.table b/definitions/grib2/tables/9/4.218.table index d4b2ab843..b6087448f 100644 --- a/definitions/grib2/tables/9/4.218.table +++ b/definitions/grib2/tables/9/4.218.table @@ -1,38 +1,38 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No scene identified -1 1 Green needle-leafed forest -2 2 Green broad-leafed forest -3 3 Deciduous needle-leafed forest -4 4 Deciduous broad-leafed forest -5 5 Deciduous mixed forest -6 6 Closed shrub-land -7 7 Open shrub-land -8 8 Woody savannah -9 9 Savannah -10 10 Grassland -11 11 Permanent wetland -12 12 Cropland -13 13 Urban -14 14 Vegetation / crops -15 15 Permanent snow / ice -16 16 Barren desert -17 17 Water bodies -18 18 Tundra -# 19-96 Reserved -97 97 Snow / ice on land -98 98 Snow / ice on water -99 99 Sun-glint -100 100 General cloud -101 101 Low cloud / fog / Stratus -102 102 Low cloud / Stratocumulus -103 103 Low cloud / unknown type -104 104 Medium cloud / Nimbostratus -105 105 Medium cloud / Altostratus -106 106 Medium cloud / unknown type -107 107 High cloud / Cumulus -108 108 High cloud / Cirrus -109 109 High cloud / unknown -110 110 Unknown cloud type -# 111-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No scene identified +1 1 Green needle-leafed forest +2 2 Green broad-leafed forest +3 3 Deciduous needle-leafed forest +4 4 Deciduous broad-leafed forest +5 5 Deciduous mixed forest +6 6 Closed shrub-land +7 7 Open shrub-land +8 8 Woody savannah +9 9 Savannah +10 10 Grassland +11 11 Permanent wetland +12 12 Cropland +13 13 Urban +14 14 Vegetation / crops +15 15 Permanent snow / ice +16 16 Barren desert +17 17 Water bodies +18 18 Tundra +# 19-96 Reserved +97 97 Snow / ice on land +98 98 Snow / ice on water +99 99 Sun-glint +100 100 General cloud +101 101 Low cloud / fog / Stratus +102 102 Low cloud / Stratocumulus +103 103 Low cloud / unknown type +104 104 Medium cloud / Nimbostratus +105 105 Medium cloud / Altostratus +106 106 Medium cloud / unknown type +107 107 High cloud / Cumulus +108 108 High cloud / Cirrus +109 109 High cloud / unknown +110 110 Unknown cloud type +# 111-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.219.table b/definitions/grib2/tables/9/4.219.table index f10ce468e..a02452fc4 100644 --- a/definitions/grib2/tables/9/4.219.table +++ b/definitions/grib2/tables/9/4.219.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Nominal cloud top height quality -1 1 Fog in segment -2 2 Poor quality height estimation -3 3 Fog in segment and poor quality height estimation -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Nominal cloud top height quality +1 1 Fog in segment +2 2 Poor quality height estimation +3 3 Fog in segment and poor quality height estimation +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.220.table b/definitions/grib2/tables/9/4.220.table index 9c957eb01..7a18fa1fd 100644 --- a/definitions/grib2/tables/9/4.220.table +++ b/definitions/grib2/tables/9/4.220.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Latitude -1 1 Longitude -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Latitude +1 1 Longitude +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.221.table b/definitions/grib2/tables/9/4.221.table index 5466929c7..eb0b64502 100644 --- a/definitions/grib2/tables/9/4.221.table +++ b/definitions/grib2/tables/9/4.221.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Not included -1 1 Extrapolated -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Not included +1 1 Extrapolated +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.222.table b/definitions/grib2/tables/9/4.222.table index c54194e29..f554a7f3d 100644 --- a/definitions/grib2/tables/9/4.222.table +++ b/definitions/grib2/tables/9/4.222.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No -1 1 Yes -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No +1 1 Yes +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.223.table b/definitions/grib2/tables/9/4.223.table index b6a9be136..706abab78 100644 --- a/definitions/grib2/tables/9/4.223.table +++ b/definitions/grib2/tables/9/4.223.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No fire detected -1 1 Possible fire detected -2 2 Probable fire detected -3 3 Missing value +0 0 No fire detected +1 1 Possible fire detected +2 2 Probable fire detected +3 3 Missing value diff --git a/definitions/grib2/tables/9/4.224.table b/definitions/grib2/tables/9/4.224.table index af846f841..cf67496b8 100644 --- a/definitions/grib2/tables/9/4.224.table +++ b/definitions/grib2/tables/9/4.224.table @@ -1,18 +1,18 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No risk area -1 1 Reserved -2 2 General thunderstorm risk area -3 3 Reserved -4 4 Slight risk area -5 5 Reserved -6 6 Moderate risk area -7 7 Reserved -8 8 High risk area -# 9-10 Reserved -11 11 Dry thunderstorm (dry lightning) risk area -# 12-13 Reserved -14 14 Critical risk area -# 15-17 Reserved -18 18 Extremely critical risk area -# 19-254 Reserved -255 255 Missing +0 0 No risk area +1 1 Reserved +2 2 General thunderstorm risk area +3 3 Reserved +4 4 Slight risk area +5 5 Reserved +6 6 Moderate risk area +7 7 Reserved +8 8 High risk area +# 9-10 Reserved +11 11 Dry thunderstorm (dry lightning) risk area +# 12-13 Reserved +14 14 Critical risk area +# 15-17 Reserved +18 18 Extremely critical risk area +# 19-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/9/4.227.table b/definitions/grib2/tables/9/4.227.table index 56fa0e752..5a0771c0f 100644 --- a/definitions/grib2/tables/9/4.227.table +++ b/definitions/grib2/tables/9/4.227.table @@ -5,6 +5,6 @@ 2 2 Convective 3 3 Stratiform 4 4 Freezing -# 5-191 Reserved +# 5-191 Reserved # 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/9/4.3.table b/definitions/grib2/tables/9/4.3.table index 68e2cc83f..8a4e919c9 100644 --- a/definitions/grib2/tables/9/4.3.table +++ b/definitions/grib2/tables/9/4.3.table @@ -1,16 +1,16 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Analysis -1 1 Initialization -2 2 Forecast -3 3 Bias corrected forecast -4 4 Ensemble forecast -5 5 Probability forecast -6 6 Forecast error -7 7 Analysis error -8 8 Observation -9 9 Climatological -10 10 Probability-weighted forecast -11 11 Bias-corrected ensemble forecast -# 12-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Analysis +1 1 Initialization +2 2 Forecast +3 3 Bias corrected forecast +4 4 Ensemble forecast +5 5 Probability forecast +6 6 Forecast error +7 7 Analysis error +8 8 Observation +9 9 Climatological +10 10 Probability-weighted forecast +11 11 Bias-corrected ensemble forecast +# 12-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.4.table b/definitions/grib2/tables/9/4.4.table index df5272d2f..511c76aa9 100644 --- a/definitions/grib2/tables/9/4.4.table +++ b/definitions/grib2/tables/9/4.4.table @@ -1,17 +1,17 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 m Minute -1 h Hour -2 D Day -3 M Month -4 Y Year -5 10Y Decade (10 years) -6 30Y Normal (30 years) -7 C Century (100 years) -# 8-9 Reserved -10 3h 3 hours -11 6h 6 hours -12 12h 12 hours -13 s Second -# 14-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 m Minute +1 h Hour +2 D Day +3 M Month +4 Y Year +5 10Y Decade (10 years) +6 30Y Normal (30 years) +7 C Century (100 years) +# 8-9 Reserved +10 3h 3 hours +11 6h 6 hours +12 12h 12 hours +13 s Second +# 14-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.5.table b/definitions/grib2/tables/9/4.5.table index 9a46a3aa0..d07c799a8 100644 --- a/definitions/grib2/tables/9/4.5.table +++ b/definitions/grib2/tables/9/4.5.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface 2 2 Cloud base level 3 3 Level of cloud tops @@ -12,11 +12,11 @@ 10 10 Entire atmosphere 11 11 Cumulonimbus (CB) base (m) 12 12 Cumulonimbus (CB) top (m) -# 13-19 Reserved +# 13-19 Reserved 20 20 Isothermal level (K) -# 21-99 Reserved +# 21-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -25,7 +25,7 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level 112 112 Reserved 113 113 Logarithmic hybrid level @@ -35,14 +35,14 @@ 119 hpl Hybrid pressure level # 120-149 Reserved 150 150 Generalized vertical height coordinate -# 151-159 Reserved -160 160 Depth below sea level m +# 151-159 Reserved +160 160 Depth below sea level m 161 161 Depth below water surface (m) 162 sfc Lake or river bottom 163 163 Bottom of sediment layer 164 164 Bottom of thermally active sediment layer 165 165 Bottom of sediment layer penetrated by thermal wave 166 sfc Mixing layer -# 167-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +# 167-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.6.table b/definitions/grib2/tables/9/4.6.table index 54f2993c3..eaa5c4362 100644 --- a/definitions/grib2/tables/9/4.6.table +++ b/definitions/grib2/tables/9/4.6.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Unperturbed high-resolution control forecast -1 1 Unperturbed low-resolution control forecast -2 2 Negatively perturbed forecast -3 3 Positively perturbed forecast -4 4 Multi-model forecast -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unperturbed high-resolution control forecast +1 1 Unperturbed low-resolution control forecast +2 2 Negatively perturbed forecast +3 3 Positively perturbed forecast +4 4 Multi-model forecast +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.7.table b/definitions/grib2/tables/9/4.7.table index 23e0d457e..e6d887bdb 100644 --- a/definitions/grib2/tables/9/4.7.table +++ b/definitions/grib2/tables/9/4.7.table @@ -1,14 +1,14 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Unweighted mean of all members -1 1 Weighted mean of all members -2 2 Standard deviation with respect to cluster mean -3 3 Standard deviation with respect to cluster mean, normalized -4 4 Spread of all members -5 5 Large anomaly index of all members -6 6 Unweighted mean of the cluster members -7 7 Interquartile range (range between the 25th and 75th quantile) -8 8 Minimum of all ensemble members -9 9 Maximum of all ensemble members -# 10-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Unweighted mean of all members +1 1 Weighted mean of all members +2 2 Standard deviation with respect to cluster mean +3 3 Standard deviation with respect to cluster mean, normalized +4 4 Spread of all members +5 5 Large anomaly index of all members +6 6 Unweighted mean of the cluster members +7 7 Interquartile range (range between the 25th and 75th quantile) +8 8 Minimum of all ensemble members +9 9 Maximum of all ensemble members +# 10-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.8.table b/definitions/grib2/tables/9/4.8.table index 37a6cf767..d06153079 100644 --- a/definitions/grib2/tables/9/4.8.table +++ b/definitions/grib2/tables/9/4.8.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Anomaly correlation -1 1 Root mean square -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Anomaly correlation +1 1 Root mean square +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.9.table b/definitions/grib2/tables/9/4.9.table index 19e64a3d2..5243e58dd 100644 --- a/definitions/grib2/tables/9/4.9.table +++ b/definitions/grib2/tables/9/4.9.table @@ -1,9 +1,9 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Probability of event below lower limit -1 1 Probability of event above upper limit -2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) -3 3 Probability of event above lower limit -4 4 Probability of event below upper limit -# 5-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Probability of event below lower limit +1 1 Probability of event above upper limit +2 2 Probability of event between lower and upper limits (the range includes the lower limit but not the upper limit) +3 3 Probability of event above lower limit +4 4 Probability of event below upper limit +# 5-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/4.91.table b/definitions/grib2/tables/9/4.91.table index 5d975ad8e..cea421695 100644 --- a/definitions/grib2/tables/9/4.91.table +++ b/definitions/grib2/tables/9/4.91.table @@ -1,16 +1,16 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Smaller than first limit -1 1 Greater than second limit -2 2 Between first and second limit. The range includes the first limit but not the second limit -3 3 Greater than first limit -4 4 Smaller than second limit -5 5 Smaller or equal first limit -6 6 Greater or equal second limit -7 7 Between first and second. The range includes the first limit and the second limit -8 8 Greater or equal first limit -9 9 Smaller or equal second limit -10 10 Between first and second limit. The range includes the second limit but not the first limit -11 11 Equal to first limit. +0 0 Smaller than first limit +1 1 Greater than second limit +2 2 Between first and second limit. The range includes the first limit but not the second limit +3 3 Greater than first limit +4 4 Smaller than second limit +5 5 Smaller or equal first limit +6 6 Greater or equal second limit +7 7 Between first and second. The range includes the first limit and the second limit +8 8 Greater or equal first limit +9 9 Smaller or equal second limit +10 10 Between first and second limit. The range includes the second limit but not the first limit +11 11 Equal to first limit. # 12-191 Reserved # 192-254 Reserved for local use -255 missing Missing +255 missing Missing diff --git a/definitions/grib2/tables/9/5.1.table b/definitions/grib2/tables/9/5.1.table index 100d4106d..158a35850 100644 --- a/definitions/grib2/tables/9/5.1.table +++ b/definitions/grib2/tables/9/5.1.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Floating point -1 1 Integer -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Floating point +1 1 Integer +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/5.2.table b/definitions/grib2/tables/9/5.2.table index 4d0808be6..d9896e11f 100644 --- a/definitions/grib2/tables/9/5.2.table +++ b/definitions/grib2/tables/9/5.2.table @@ -1,8 +1,8 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Explicit coordinate values set -1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 -# 2-10 Reserved +0 0 Explicit coordinate values set +1 1 Linear coordinates f(1)=C1, f(n)=f(n-1)+C2 +# 2-10 Reserved 11 11 Geometric coordinates f(1)=C1, f(n)=C2*f(n-1) -# 12-191 Reserved -# 192-254 Reserved for local use +# 12-191 Reserved +# 192-254 Reserved for local use 255 255 Missing diff --git a/definitions/grib2/tables/9/5.3.table b/definitions/grib2/tables/9/5.3.table index 705fa6524..6f228aeec 100644 --- a/definitions/grib2/tables/9/5.3.table +++ b/definitions/grib2/tables/9/5.3.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -1 1 Direction degrees true -2 2 Frequency (s-1) -3 3 Radial number (2pi/lambda) (m-1) -# 4-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +1 1 Direction degrees true +2 2 Frequency (s-1) +3 3 Radial number (2pi/lambda) (m-1) +# 4-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/5.4.table b/definitions/grib2/tables/9/5.4.table index 8133367a5..f844f557e 100644 --- a/definitions/grib2/tables/9/5.4.table +++ b/definitions/grib2/tables/9/5.4.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Row by row splitting -1 1 General group splitting -# 2-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 Row by row splitting +1 1 General group splitting +# 2-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/5.40.table b/definitions/grib2/tables/9/5.40.table index 0d56ad0e0..2431eb547 100644 --- a/definitions/grib2/tables/9/5.40.table +++ b/definitions/grib2/tables/9/5.40.table @@ -1,5 +1,5 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Lossless -1 1 Lossy -# 2-254 Reserved -255 255 Missing +0 0 Lossless +1 1 Lossy +# 2-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/9/5.5.table b/definitions/grib2/tables/9/5.5.table index 5d625dbda..f2216e273 100644 --- a/definitions/grib2/tables/9/5.5.table +++ b/definitions/grib2/tables/9/5.5.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 No explicit missing values included within data values -1 1 Primary missing values included within data values -2 2 Primary and secondary missing values included within data values -# 3-191 Reserved -# 192-254 Reserved for local use -255 255 Missing +0 0 No explicit missing values included within data values +1 1 Primary missing values included within data values +2 2 Primary and secondary missing values included within data values +# 3-191 Reserved +# 192-254 Reserved for local use +255 255 Missing diff --git a/definitions/grib2/tables/9/5.6.table b/definitions/grib2/tables/9/5.6.table index 16f4c25f3..3b0892d37 100644 --- a/definitions/grib2/tables/9/5.6.table +++ b/definitions/grib2/tables/9/5.6.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 First-order spatial differencing -2 2 Second-order spatial differencing -# 3-191 Reserved +0 0 Reserved +1 1 First-order spatial differencing +2 2 Second-order spatial differencing +# 3-191 Reserved # 192-254 Reserved for local use -255 255 Missing +255 255 Missing diff --git a/definitions/grib2/tables/9/5.7.table b/definitions/grib2/tables/9/5.7.table index b93aa8130..f056d3059 100644 --- a/definitions/grib2/tables/9/5.7.table +++ b/definitions/grib2/tables/9/5.7.table @@ -1,7 +1,7 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit -0 0 Reserved -1 1 IEEE 32-bit (I=4 in section 7) -2 2 IEEE 64-bit (I=8 in section 7) -3 3 IEEE 128-bit (I=16 in section 7) -# 4-254 Reserved -255 255 Missing +0 0 Reserved +1 1 IEEE 32-bit (I=4 in section 7) +2 2 IEEE 64-bit (I=8 in section 7) +3 3 IEEE 128-bit (I=16 in section 7) +# 4-254 Reserved +255 255 Missing diff --git a/definitions/grib2/tables/9/6.0.table b/definitions/grib2/tables/9/6.0.table index aecdc6e5e..9c9dba372 100644 --- a/definitions/grib2/tables/9/6.0.table +++ b/definitions/grib2/tables/9/6.0.table @@ -1,6 +1,6 @@ # Automatically generated by ./create_tables.pl from database fm92_grib2@grib-param-db-prod.ecmwf.int, do not edit 0 0 A bit map applies to this product and is specified in this Section 1 1 A bit map pre-determined by the originating/generating Centre applies to this product and is not specified in this Section -# 1-253 A bit map predetermined by the originating/generating Centre applies to this product and is not specified in this Section -254 254 A bit map defined previously in the same GRIB message applies to this product -255 255 A bit map does not apply to this product +# 1-253 A bit map predetermined by the originating/generating Centre applies to this product and is not specified in this Section +254 254 A bit map defined previously in the same GRIB message applies to this product +255 255 A bit map does not apply to this product diff --git a/definitions/grib2/tables/local/ecmf/obstat.5.0.table b/definitions/grib2/tables/local/ecmf/obstat.5.0.table index 71a9a0e8c..ef4ea724d 100644 --- a/definitions/grib2/tables/local/ecmf/obstat.5.0.table +++ b/definitions/grib2/tables/local/ecmf/obstat.5.0.table @@ -1,13 +1,13 @@ #Code Table obstat.5.0: List of satellite instruments -0 HIRS HIRS +0 HIRS HIRS 1 MSU MSU 2 SSU SSU 3 AMSUA AMSUA 4 AMSUB AMSUB 6 SSM/I SSM/I 9 TMI TMI -10 SSMI/S SSMI/S -11 AIRS AIRS +10 SSMI/S SSMI/S +11 AIRS AIRS 15 MHS MHS 16 IASI IASI 17 AMSRE AMSR-E @@ -33,20 +33,20 @@ 516 TANSO TANSO 624 SBUV-2 SBUV-2 2000 AMV_WV_CLOUDY AMV WV cloudy -2001 AMV_IR AMV IR +2001 AMV_IR AMV IR 2002 AMV_VIS AMV VIS 2003 AMV_WVMIX AMV WVMIX 2005 AMV_WV_Clear AMV Water Vapor clear 2100 AMV_WV_6.2_cloudy AMV WV 6.2 cloudy -2101 AMV_IR_ch1 AMV IR ch1 +2101 AMV_IR_ch1 AMV IR ch1 2102 AMV_VIS_ch1 AMV VIS ch1 -2105 AMV_WV_6.2_clear AMV WV_6.2 clear +2105 AMV_WV_6.2_clear AMV WV_6.2 clear 2200 AMV_WV_7.3_cloudy AMV WV 7.3 cloudy 2201 AMV_IR_ch2 AMV IR ch2 2202 AMV_VIS-2 AMV VIS-2 2205 AMV_WV_7.3_clear AMV WV 7.3 clear 2300 AMV_WV_cloudy_ch3 AMV WV cloudy ch 3 -2301 AMV_IR-10 AMV IR-10 +2301 AMV_IR-10 AMV IR-10 2305 AMV_WV_clear_Ch3 AMV WV clear Ch3 2350 QUIKSCAT QUIKSCAT 2150 SCAT SCAT diff --git a/definitions/grib2/tables/local/ecmf/obstat.7.0.table b/definitions/grib2/tables/local/ecmf/obstat.7.0.table index fcd1c2e02..688485882 100644 --- a/definitions/grib2/tables/local/ecmf/obstat.7.0.table +++ b/definitions/grib2/tables/local/ecmf/obstat.7.0.table @@ -1,5 +1,5 @@ #Code Table obstat.7.0: Vertical coordinate types -1 1 Channel +1 1 Channel 2 2 Pressure level 3 3 Pressure layer 4 4 Surface diff --git a/definitions/grib2/tables/local/ecmf/obstat.8.0.table b/definitions/grib2/tables/local/ecmf/obstat.8.0.table index 382402473..0e167b7dd 100644 --- a/definitions/grib2/tables/local/ecmf/obstat.8.0.table +++ b/definitions/grib2/tables/local/ecmf/obstat.8.0.table @@ -2,5 +2,5 @@ 1 Land Land 2 Sea Sea 3 Sea-ice Sea-ice -4 All_surfaces All surface types combined +4 All_surfaces All surface types combined #5-255 Reserved diff --git a/definitions/grib2/tables/local/ecmf/obstat.9.0.table b/definitions/grib2/tables/local/ecmf/obstat.9.0.table index 8520066bd..38be1bfe3 100644 --- a/definitions/grib2/tables/local/ecmf/obstat.9.0.table +++ b/definitions/grib2/tables/local/ecmf/obstat.9.0.table @@ -1,14 +1,14 @@ -#Code Table obstat.9.0: Observation diagnostics -1 count data count +# Code Table obstat.9.0: Observation diagnostics +1 count data count 2 obs Average of observed values -3 obs_stdv Standard deviation of observed values -4 fgdep Average of first guess departure +3 obs_stdv Standard deviation of observed values +4 fgdep Average of first guess departure 5 fgdep_stdv Standard deviation of first guess departure 6 andep Average of analysis departure 7 andep_stdv Standard deviation of analysis departure 8 obs_error Average of observation standard error 9 obs_error_stdv Standard deviation of observation standard error -10 bkg_error Average of background standard error +10 bkg_error Average of background standard error 11 bkg_error_stdv Standard deviation of background standard error 12 lr_andep1 Average of low resolution analysis departure update 1 13 lr_andep1_stdv Standard deviation of low resolution analysis departure update 1 @@ -19,7 +19,7 @@ 18 bcor Average of Bias correction 19 bcor_stdv Standard deviation of bias correction 20 vbcor average of Variational bias correction -21 vbcor_stdv Standard deviation of variational bias correction +21 vbcor_stdv Standard deviation of variational bias correction 22 fgdep_nbcor Average of background departure without bias correction 23 fgdep_nbcor_stdv Standard deviation of background departure without bias correction 24 windspeed Average of wind speed @@ -45,8 +45,7 @@ 60 far_rate False alarm rate 62 miss_rate Miss rate 64 hit_rate hit rate -66 corr_nul correct nuls +66 corr_nul correct nuls 68 est_fg_err Estimated variance of the first guess error 70 edafgspr EDA first guess variance 72 edaanspr EDA Analysis variance -#36-255 Reserved diff --git a/definitions/grib2/tables/local/era6/1.1.table b/definitions/grib2/tables/local/era6/1.1.table index 720161860..a0c8af15c 100644 --- a/definitions/grib2/tables/local/era6/1.1.table +++ b/definitions/grib2/tables/local/era6/1.1.table @@ -1,6 +1,6 @@ # Code Table 1.1 GRIB Local Tables Version Number -0 0 Local tables not used -# . Only table entries and templates from the current Master table are valid. +0 0 Local tables not used +# Only table entries and templates from the current Master table are valid. # 1-254 Number of local tables version used 1 1 ERA6 local tables version 1 255 255 Missing diff --git a/definitions/grib2/tables/local/kwbc/1/4.5.table b/definitions/grib2/tables/local/kwbc/1/4.5.table index f1cfbfbe6..f89c21674 100644 --- a/definitions/grib2/tables/local/kwbc/1/4.5.table +++ b/definitions/grib2/tables/local/kwbc/1/4.5.table @@ -1,5 +1,5 @@ # Code table 4.5 - Fixed surface types and units -0 0 Reserved +0 0 Reserved 1 sfc Ground or water surface (-) 2 2 Cloud base level (-) 3 3 Level of cloud tops (-) @@ -16,15 +16,15 @@ 14 14 Level of free convection (LFC) 15 15 Convective condensation level (CCL) 16 16 Level of neutral buoyancy or equilibrium level (LNB) -# 17-19 Reserved +# 17-19 Reserved 20 20 Isothermal level (K) 21 21 Lowest level where mass density exceeds the specified value (base for a given threshold of mass density) (kg m-3) 22 22 Highest level where mass density exceeds the specified value (top for a given threshold of mass density) (kg m-3) 23 23 Lowest level where air concentration exceeds the specified value (base for a given threshold of air concentration) (Bq m-3) 24 24 Highest level where air concentration exceeds the specified value (top for a given threshold of air concentration) (Bq m-3) -# 25-99 Reserved +# 25-99 Reserved 100 pl Isobaric surface (Pa) -101 sfc Mean sea level +101 sfc Mean sea level 102 102 Specific altitude above mean sea level (m) 103 sfc Specified height level above ground (m) 104 104 Sigma level (sigma value) @@ -33,20 +33,20 @@ 107 pt Isentropic (theta) level (K) 108 108 Level at specified pressure difference from ground to level (Pa) 109 pv Potential vorticity surface (K m2 kg-1 s-1) -110 110 Reserved +110 110 Reserved 111 111 Eta level (-) -112 112 Reserved -113 113 Logarithmic hybrid level +112 112 Reserved +113 113 Logarithmic hybrid level 114 114 Snow level (Numeric) 115 115 Sigma height level # 116 Reserved 117 117 Mixed layer depth (m) 118 hhl Hybrid height level (-) 119 hpl Hybrid pressure level (-) -# 120-149 Reserved -150 150 Generalized vertical height coordinate +# 120-149 Reserved +150 150 Generalized vertical height coordinate 151 sol Soil level (Numeric) -# 152-159 Reserved +# 152-159 Reserved 160 160 Depth below sea level (m) 161 161 Depth below water surface (m) 162 162 Lake or river bottom (-) @@ -55,7 +55,7 @@ 165 165 Bottom of sediment layer penetrated by thermal wave (-) 166 166 Mixing layer (-) 167 167 Bottom of root zone (-) -# 168-173 Reserved +# 168-173 Reserved 174 174 Top surface of ice on sea, lake or river 175 175 Top surface of ice, under snow cover, on sea, lake or river 176 176 Bottom surface (underside) ice on sea, lake or river diff --git a/definitions/grib2/template.3.healpix.def b/definitions/grib2/template.3.healpix.def index bf0429a5b..136904194 100644 --- a/definitions/grib2/template.3.healpix.def +++ b/definitions/grib2/template.3.healpix.def @@ -32,8 +32,8 @@ alias geography.orderingConvention = orderingConvention; flags[1] scanningMode 'grib2/tables/[tablesVersion]/3.13.table'; flagbit iScansNegatively(scanningMode,7) : dump; # WMO bit 1 flagbit jScansPositively(scanningMode,6) : dump; # WMO bit 2 -transient iScansPositively = !iScansNegatively : constraint; -transient jScansNegatively = !jScansPositively : constraint; +transient iScansPositively = !iScansNegatively : constraint, read_only; +transient jScansNegatively = !jScansPositively : constraint, read_only; iterator healpix(numberOfPoints,missingValue,values,Nside,orderingConvention); nearest healpix(values,radius,Nx,Ny); diff --git a/definitions/grib2/template.3.scanning_mode.def b/definitions/grib2/template.3.scanning_mode.def index 2eb2ca71e..1be608f41 100644 --- a/definitions/grib2/template.3.scanning_mode.def +++ b/definitions/grib2/template.3.scanning_mode.def @@ -20,8 +20,8 @@ alias geography.iScansNegatively=iScansNegatively; alias geography.jScansPositively=jScansPositively; alias geography.jPointsAreConsecutive=jPointsAreConsecutive; -transient iScansPositively = !iScansNegatively : constraint; -transient jScansNegatively = !jScansPositively : constraint; +transient iScansPositively = !iScansNegatively : constraint, read_only; +transient jScansNegatively = !jScansPositively : constraint, read_only; flagbit scanningMode5(scanningMode,3) = 0: read_only; flagbit scanningMode6(scanningMode,2) = 0: read_only; diff --git a/definitions/grib2/template.4.119.def b/definitions/grib2/template.4.119.def new file mode 100644 index 000000000..ef464a00f --- /dev/null +++ b/definitions/grib2/template.4.119.def @@ -0,0 +1,10 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.119, Probability forecasts from large ensembles at a horizontal level or in a horizontal layer at a point in time + +include "grib2/template.4.parameter.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.point_in_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.probabilityLargeEnsemble.def" diff --git a/definitions/grib2/template.4.120.def b/definitions/grib2/template.4.120.def new file mode 100644 index 000000000..9ad2f90bd --- /dev/null +++ b/definitions/grib2/template.4.120.def @@ -0,0 +1,10 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.120, Probability forecasts from large ensembles at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval + +include "grib2/template.4.parameter.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.probabilityLargeEnsemble.def" +include "grib2/template.4.statistical.def" diff --git a/definitions/grib2/template.4.121.def b/definitions/grib2/template.4.121.def new file mode 100644 index 000000000..73bba193b --- /dev/null +++ b/definitions/grib2/template.4.121.def @@ -0,0 +1,11 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.121, Probability forecasts with spatiotemporal processing based on focal (moving window) statistics at a horizontal level or in a horizontal layer at a point in time + +include "grib2/template.4.parameter.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.point_in_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.probabilityLargeEnsemble.def" +include "grib2/template.4.focalStatistics.def" diff --git a/definitions/grib2/template.4.122.def b/definitions/grib2/template.4.122.def new file mode 100644 index 000000000..40bf98240 --- /dev/null +++ b/definitions/grib2/template.4.122.def @@ -0,0 +1,11 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.122, Probability forecasts with spatiotemporal processing based on focal (moving window) statistics at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval + +include "grib2/template.4.parameter.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.probabilityLargeEnsemble.def" +include "grib2/template.4.statistical.def" +include "grib2/template.4.focalStatistics.def" diff --git a/definitions/grib2/template.4.123.def b/definitions/grib2/template.4.123.def new file mode 100644 index 000000000..a70b9643c --- /dev/null +++ b/definitions/grib2/template.4.123.def @@ -0,0 +1,12 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.123, Probability forecasts from large ensembles with spatiotemporal processing based on focal (moving window) statistics in relation to a reference period at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval + +include "grib2/template.4.parameter.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.statistical.def" +include "grib2/template.4.probabilityLargeEnsemble.def" +include "grib2/template.4.referenceperiod.def" +include "grib2/template.4.focalStatistics.def" diff --git a/definitions/grib2/template.4.124.def b/definitions/grib2/template.4.124.def new file mode 100644 index 000000000..a3b83980e --- /dev/null +++ b/definitions/grib2/template.4.124.def @@ -0,0 +1,12 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.124, Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for radionuclides + +include "grib2/template.4.parameter.def" +include "grib2/template.4.chemical.def" +include "grib2/template.4.source.def" +include "grib2/template.4.radionuclides.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.point_in_time.def" +include "grib2/template.4.horizontal.def" diff --git a/definitions/grib2/template.4.125.def b/definitions/grib2/template.4.125.def new file mode 100644 index 000000000..88ebd7894 --- /dev/null +++ b/definitions/grib2/template.4.125.def @@ -0,0 +1,13 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.125, Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for radionuclides + +include "grib2/template.4.parameter.def" +include "grib2/template.4.chemical.def" +include "grib2/template.4.source.def" +include "grib2/template.4.radionuclides.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.point_in_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.eps.def" diff --git a/definitions/grib2/template.4.126.def b/definitions/grib2/template.4.126.def new file mode 100644 index 000000000..fed3fbac1 --- /dev/null +++ b/definitions/grib2/template.4.126.def @@ -0,0 +1,12 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.126, Average, accumulation, and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for radionuclides + +include "grib2/template.4.parameter.def" +include "grib2/template.4.chemical.def" +include "grib2/template.4.source.def" +include "grib2/template.4.radionuclides.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.statistical.def" diff --git a/definitions/grib2/template.4.127.def b/definitions/grib2/template.4.127.def new file mode 100644 index 000000000..baa754fca --- /dev/null +++ b/definitions/grib2/template.4.127.def @@ -0,0 +1,14 @@ +# (C) Copyright 2005- ECMWF. + +# TEMPLATE 4.127, Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for radionuclides + +include "grib2/template.4.parameter.def" +include "grib2/template.4.chemical.def" +include "grib2/template.4.source.def" +include "grib2/template.4.radionuclides.def" +include "grib2/template.4.generating_process.def" +include "grib2/template.4.forecast_time.def" +include "grib2/template.4.horizontal.def" +include "grib2/template.4.eps.def" +include "grib2/template.4.statistical.def" + diff --git a/definitions/grib2/template.4.20.def b/definitions/grib2/template.4.20.def index b739bf6bb..882691250 100644 --- a/definitions/grib2/template.4.20.def +++ b/definitions/grib2/template.4.20.def @@ -1,60 +1,60 @@ # (C) Copyright 2005- ECMWF. # TEMPLATE 4.20, Radar product -codetable[1] parameterCategory ('4.1.[discipline:l].table',masterDir,localDir) : dump; +codetable[1] parameterCategory('4.1.[discipline:l].table',masterDir,localDir) : dump; # Parameter number -codetable[1] parameterNumber ('4.2.[discipline:l].[parameterCategory:l].table',masterDir,localDir) : dump; +codetable[1] parameterNumber('4.2.[discipline:l].[parameterCategory:l].table',masterDir,localDir) : dump; meta parameterUnits codetable_units(parameterNumber) : dump; meta parameterName codetable_title(parameterNumber) : dump; -codetable[1] typeOfGeneratingProcess ('4.3.table',masterDir,localDir) : dump; +codetable[1] typeOfGeneratingProcess('4.3.table',masterDir,localDir) : dump; # Number of radar sites used -unsigned[1] numberOfRadarSitesUsed : dump; +unsigned[1] numberOfRadarSitesUsed : dump; -codetable[1] indicatorOfUnitOfTimeRange ('4.4.table',masterDir,localDir) : dump; -alias indicatorOfUnitForForecastTime = indicatorOfUnitOfTimeRange; +codetable[1] indicatorOfUnitForForecastTime('4.4.table',masterDir,localDir) : dump; +alias indicatorOfUnitOfTimeRange = indicatorOfUnitForForecastTime; include "grib2/stepUnits.def" # Site latitude (in microdegrees) -unsigned[4] siteLatitude : dump; +unsigned[4] siteLatitude : dump; # Site longitude (in microdegrees) -unsigned[4] siteLongitude : dump; +unsigned[4] siteLongitude : dump; # Site elevation (meters) -unsigned[2] siteElevation : dump; +unsigned[2] siteElevation : dump; # Site ID (alphanumeric) -unsigned[4] siteId : dump; +unsigned[4] siteId : dump; # Site ID (numeric) -unsigned[2] siteId : dump; +unsigned[2] siteId : dump; # Operating mode -codetable[1] operatingMode ('4.12.table',masterDir,localDir) : dump; +codetable[1] operatingMode('4.12.table',masterDir,localDir) : dump; # Reflectivity calibration constant (tenths of dB) -unsigned[1] reflectivityCalibrationConstant : dump; +unsigned[1] reflectivityCalibrationConstant : dump; # Quality control indicator -codetable[1] qualityControlIndicator ('4.13.table',masterDir,localDir) : dump; +codetable[1] qualityControlIndicator('4.13.table',masterDir,localDir) : dump; # Clutter filter indicator -codetable[1] clutterFilterIndicator ('4.14.table',masterDir,localDir) : dump; +codetable[1] clutterFilterIndicator('4.14.table',masterDir,localDir) : dump; # Constant antenna elevation angle (tenths of degree true) -unsigned[1] constantAntennaElevationAngle : dump; +unsigned[1] constantAntennaElevationAngle : dump; # Accumulation interval (minutes) -unsigned[2] accumulationInterval : dump; +unsigned[2] accumulationInterval : dump; # Reference reflectivity for echo top (dB) -unsigned[1] referenceReflectivityForEchoTop : dump; +unsigned[1] referenceReflectivityForEchoTop : dump; # Range bin spacing (meters) -unsigned[3] rangeBinSpacing : dump; +unsigned[3] rangeBinSpacing : dump; # Radial angular spacing (tenths of degree true) -unsigned[2] radialAngularSpacing : dump; +unsigned[2] radialAngularSpacing : dump; diff --git a/definitions/grib2/template.4.30.def b/definitions/grib2/template.4.30.def index eef3b680d..9416d4789 100644 --- a/definitions/grib2/template.4.30.def +++ b/definitions/grib2/template.4.30.def @@ -2,6 +2,7 @@ # TEMPLATE 4.30, Satellite Product # Note: This template is deprecated. Template 4.31 should be used instead. +transient template_is_deprecated = 1 : hidden; include "grib2/template.4.parameter.def" diff --git a/definitions/grib2/template.4.47.def b/definitions/grib2/template.4.47.def index 64c222032..892820635 100644 --- a/definitions/grib2/template.4.47.def +++ b/definitions/grib2/template.4.47.def @@ -2,6 +2,7 @@ # TEMPLATE 4.47, Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval # Note: This template is deprecated. Template 4.85 should be used instead. +transient template_is_deprecated = 1 : hidden; include "grib2/template.4.parameter.def" include "grib2/template.4.aerosol.def" diff --git a/definitions/grib2/template.4.56.def b/definitions/grib2/template.4.56.def index 23735e972..9f48c957b 100644 --- a/definitions/grib2/template.4.56.def +++ b/definitions/grib2/template.4.56.def @@ -1,6 +1,6 @@ - # TEMPLATE 4.56, Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for spatio-temporal changing tile parameters # Note: This template is deprecated. Template 4.59 should be used instead. +transient template_is_deprecated = 1 : hidden; include "grib2/template.4.parameter.def" include "grib2/template.4.tile.def" diff --git a/definitions/grib2/template.4.7.def b/definitions/grib2/template.4.7.def index fa6f007c8..7c79ced72 100644 --- a/definitions/grib2/template.4.7.def +++ b/definitions/grib2/template.4.7.def @@ -1,2 +1,4 @@ # Note: This template is deprecated. Template 4.0 should be used instead. +transient template_is_deprecated = 1 : hidden; + include "grib2/template.4.0.def" diff --git a/definitions/grib2/template.4.categorical.def b/definitions/grib2/template.4.categorical.def index 6d0393f94..006e46a3a 100644 --- a/definitions/grib2/template.4.categorical.def +++ b/definitions/grib2/template.4.categorical.def @@ -11,4 +11,9 @@ categories list(numberOfCategories) { unsigned[4] scaledValueOfLowerLimit : can_be_missing,dump ; unsigned[1] scaleFactorOfUpperLimit : can_be_missing,dump; unsigned[4] scaledValueOfUpperLimit : can_be_missing,dump; + + alias scaleFactorOfFirstLimit = scaleFactorOfLowerLimit; + alias scaledValueOfFirstLimit = scaledValueOfLowerLimit; + alias scaleFactorOfSecondLimit = scaleFactorOfUpperLimit; + alias scaledValueOfSecondLimit = scaledValueOfUpperLimit; } diff --git a/definitions/grib2/template.4.focalStatistics.def b/definitions/grib2/template.4.focalStatistics.def new file mode 100644 index 000000000..490919bbc --- /dev/null +++ b/definitions/grib2/template.4.focalStatistics.def @@ -0,0 +1,35 @@ +# (C) Copyright 2005- ECMWF. +codetable[1] spatialVicinityType ('4.103.table',masterDir,localDir)=255 ; + +unsigned[1] numberOfSpatialVicinityValues = 1 : edition_specific; +alias nspatvals = numberOfSpatialVicinityValues; + +spatialVicintiyList list(numberOfSpatialVicinityValues) +{ + # n-th spatial vicinity value + unsigned[4] spatialVicinityValue=0 : dump; +} + +codetable[1] spatialVicinityProcessing ('4.104.table',masterDir,localDir)=255 ; + +signed[2] spatialVicinityProcessingArgument1 = 255 : dump ; + +signed[2] spatialVicinityProcessingArgument2 = 255 : dump ; + +codetable[1] spatialVicinityMissingData ('4.105.table',masterDir,localDir)=0 ; + +## UUID of irregular kernel +#byte[16] uuidOfIrregularKernel : dump; + +## UUID of spatial vicinity weights +#byte[16] uuidOfSpatialVicinityWeights : dump; + +codetable[1] temporalVicinityProcessing ('4.104.table',masterDir,localDir)=255 ; + +codetable[1] temporalVicinityUnit ('4.4.table',masterDir,localDir)=255 ; + +unsigned[4] temporalVicinityTowardsPast : dump; +unsigned[4] temporalVicinityTowardsFuture : dump; + +## UUID of temporal vicinity weights +#byte[16] uuidOfTemporalVicinityWeights : dump; diff --git a/definitions/grib2/template.4.forecast_time.def b/definitions/grib2/template.4.forecast_time.def index c12da70e3..e1c2822d9 100644 --- a/definitions/grib2/template.4.forecast_time.def +++ b/definitions/grib2/template.4.forecast_time.def @@ -9,8 +9,8 @@ unsigned[1] minutesAfterDataCutoff = missing() : edition_specific,can_be_missin alias minutesAfterReferenceTimeOfDataCutoff=minutesAfterDataCutoff; # Indicator of unit for forecastTime (ECC-1709) -codetable[1] indicatorOfUnitOfTimeRange ('4.4.table',masterDir,localDir) : dump; -alias indicatorOfUnitForForecastTime = indicatorOfUnitOfTimeRange; +codetable[1] indicatorOfUnitForForecastTime ('4.4.table',masterDir,localDir) : dump; +alias indicatorOfUnitOfTimeRange = indicatorOfUnitForForecastTime; include "grib2/stepUnits.def" diff --git a/definitions/grib2/template.4.forecast_time_44.def b/definitions/grib2/template.4.forecast_time_44.def index 0b4ad445b..30723622e 100644 --- a/definitions/grib2/template.4.forecast_time_44.def +++ b/definitions/grib2/template.4.forecast_time_44.def @@ -11,8 +11,8 @@ unsigned[1] minutesAfterDataCutoff = missing() : edition_specific,can_be_missin alias minutesAfterReferenceTimeOfDataCutoff=minutesAfterDataCutoff; # Indicator of unit for forecastTime (ECC-1709) -codetable[1] indicatorOfUnitOfTimeRange ('4.4.table',masterDir,localDir) : dump; -alias indicatorOfUnitForForecastTime = indicatorOfUnitOfTimeRange; +codetable[1] indicatorOfUnitForForecastTime ('4.4.table',masterDir,localDir) : dump; +alias indicatorOfUnitOfTimeRange = indicatorOfUnitForForecastTime; include "grib2/stepUnits.def" diff --git a/definitions/grib2/template.4.horizontal.def b/definitions/grib2/template.4.horizontal.def index db0913dbc..2dc64c033 100644 --- a/definitions/grib2/template.4.horizontal.def +++ b/definitions/grib2/template.4.horizontal.def @@ -66,7 +66,9 @@ if (extraDim) { } else { # See GRIB-74 why we store the pressureUnits in a transient transient tempPressureUnits=pressureUnits; - if (!(typeOfLevel is "surface")) { + # Same as typeOfLevel != "surface" but much quicker to evaluate + # than via the concept + if ( ! (typeOfFirstFixedSurface == 1 && typeOfSecondFixedSurface == 255) ) { if (tempPressureUnits is "Pa") { meta marsLevel scale(level,one,hundred) : read_only; alias mars.levelist=marsLevel; @@ -77,7 +79,8 @@ if (extraDim) { # ECC-1333: levtype should be read-only in GRIB2 concept mars.levtype(unknown,"marsLevtypeConcept.def",conceptsDir2,conceptsDir1):no_copy, read_only; # GRIB-372: levelist alias does not pertain to surface parameters - if (levtype is "sfc" || levtype is "o2d") { + transient tempLevtype = levtype; # Faster to copy the concept so we evaluate it once + if (tempLevtype is "sfc" || tempLevtype is "o2d") { unalias mars.levelist; } } diff --git a/definitions/grib2/template.4.localtime.def b/definitions/grib2/template.4.localtime.def index 96d655d68..336d90068 100644 --- a/definitions/grib2/template.4.localtime.def +++ b/definitions/grib2/template.4.localtime.def @@ -34,7 +34,7 @@ localTimeForecastList list(numberOfForecastsUsedInLocalTime) unsigned[1] secondOfForecastUsedInLocalTime=0 : dump, edition_specific; # Indicator of unit of time for ForecastTime - codetable[1] indicatorOfUnitForForecastTime ('4.4.table',masterDir,localDir)=1 : dump; + codetable[1] indicatorOfUnitForForecastTime('4.4.table',masterDir,localDir)=1 : dump; # Length of the time range over which statistical processing is done, in units defined by the previous octet unsigned[4] forecastTime=0 : dump; @@ -43,7 +43,7 @@ localTimeForecastList list(numberOfForecastsUsedInLocalTime) unsigned[1] numberOfTimeIncrementsOfForecastsUsedInLocalTime=1 : dump; # Indicator of unit of time for the increment between the successive steps used - codetable[1] indicatorOfUnitForTimeIncrement ('4.4.table',masterDir,localDir)=255 : dump; + codetable[1] indicatorOfUnitForTimeIncrement('4.4.table',masterDir,localDir)=255 : dump; # Time increment between successive fields, in units defined by the previous octet unsigned[4] timeIncrement=0 : dump; diff --git a/definitions/grib2/template.4.probabilityLargeEnsemble.def b/definitions/grib2/template.4.probabilityLargeEnsemble.def new file mode 100644 index 000000000..cb309e4a9 --- /dev/null +++ b/definitions/grib2/template.4.probabilityLargeEnsemble.def @@ -0,0 +1,27 @@ +# (C) Copyright 2005- ECMWF. + +# Type of ensemble forecast +codetable[1] typeOfEnsembleForecast ('4.6.table',masterDir,localDir) = 255 : dump; + +# Number of forecasts in ensemble +unsigned[4] numberOfForecastsInEnsemble : dump; +alias totalNumber=numberOfForecastsInEnsemble; + +unsigned[1] forecastProbabilityNumber : dump; + +unsigned[1] totalNumberOfForecastProbabilities : dump; + +codetable[1] probabilityType ('4.9.table',masterDir,localDir) : dump; +meta probabilityTypeName codetable_title(probabilityType): read_only; + +signed[1] scaleFactorOfLowerLimit : can_be_missing,dump ; +signed[4] scaledValueOfLowerLimit : can_be_missing,dump ; + +meta lowerLimit from_scale_factor_scaled_value( + scaleFactorOfLowerLimit, scaledValueOfLowerLimit): can_be_missing; + +signed[1] scaleFactorOfUpperLimit : can_be_missing,dump; +signed[4] scaledValueOfUpperLimit : can_be_missing,dump; + +meta upperLimit from_scale_factor_scaled_value( + scaleFactorOfUpperLimit, scaledValueOfUpperLimit): can_be_missing; diff --git a/definitions/grib2/template.4.radionuclides.def b/definitions/grib2/template.4.radionuclides.def new file mode 100644 index 000000000..c51ffa6c1 --- /dev/null +++ b/definitions/grib2/template.4.radionuclides.def @@ -0,0 +1,23 @@ +# (C) Copyright 2005- ECMWF + +codetable[2] transportModelUsed ('4.333.table',masterDir,localDir) = 255 : dump; + +codetable[2] requestedByEntity 'common/c-11.table' : dump,string_type; + +codetable[2] scenarioOrigin ('4.335.table',masterDir,localDir) = 255 : dump; + +codetable[2] NWPused ('4.336.table',masterDir,localDir) = 255 : dump; + +unsigned[2] releaseStartYear : dump; +unsigned[1] releaseStartMonth : dump; +unsigned[1] releaseStartDay : dump; +unsigned[1] releaseStartHour : dump; +unsigned[1] releaseStartMinute : dump; +unsigned[1] releaseStartSecond : dump; + +unsigned[2] wallClockInitialTimeOfExecutionYear : dump; +unsigned[1] wallClockInitialTimeOfExecutionMonth : dump; +unsigned[1] wallClockInitialTimeOfExecutionDay : dump; +unsigned[1] wallClockInitialTimeOfExecutionHour : dump; +unsigned[1] wallClockInitialTimeOfExecutionMinute : dump; +unsigned[1] wallClockInitialTimeOfExecutionSecond : dump; diff --git a/definitions/grib2/template.4.referenceperiod.def b/definitions/grib2/template.4.referenceperiod.def index 90c05351f..49a45d571 100644 --- a/definitions/grib2/template.4.referenceperiod.def +++ b/definitions/grib2/template.4.referenceperiod.def @@ -1,10 +1,11 @@ -# Type of reference dataset +# (C) Copyright 2005- ECMWF. +# Type of reference dataset codetable[1] typeOfReferenceDataset ('4.100.table',masterDir,localDir) = 255 : dump,edition_specific; -# Type of relation to reference dataset +# Type of relation to reference dataset codetable[1] typeOfRelationToReferenceDataset ('4.101.table',masterDir,localDir) = 255 : dump,edition_specific; -# number of additional parameters +# Number of additional parameters unsigned[1] numberOfAdditionalParametersForReferencePeriod=0 ; additionalParameter list(numberOfAdditionalParametersForReferencePeriod) { @@ -32,7 +33,7 @@ meta startDateOfReferencePeriod g2date(yearOfStartOfReferencePeriod,monthOfStart unsigned[4] sampleSizeOfReferencePeriod = 0; -# n - number of time range specifications describing the time intervals used to calculate the statistically-processed field +# Number of time range specifications describing the time intervals used to calculate the statistically-processed field unsigned[1] numberOfReferencePeriodTimeRanges = 1 : edition_specific; alias nref = numberOfReferencePeriodTimeRanges; diff --git a/definitions/grib2/template.4.reforecast.def b/definitions/grib2/template.4.reforecast.def index f415ce80a..a8a431936 100644 --- a/definitions/grib2/template.4.reforecast.def +++ b/definitions/grib2/template.4.reforecast.def @@ -1,3 +1,4 @@ +# (C) Copyright 2005- ECMWF. # The Model Version Date # This is the date when the reforecast is produced with a particular version of the model diff --git a/definitions/grib2/template.4.wave.def b/definitions/grib2/template.4.wave.def index 37c3f4523..742c0ece4 100644 --- a/definitions/grib2/template.4.wave.def +++ b/definitions/grib2/template.4.wave.def @@ -1,3 +1,4 @@ +# (C) Copyright 2005- ECMWF. # Template for wave parameters ## Direction part diff --git a/definitions/grib2/template.4.wave_period_range.def b/definitions/grib2/template.4.wave_period_range.def index 3bd02fa4f..278ddf689 100644 --- a/definitions/grib2/template.4.wave_period_range.def +++ b/definitions/grib2/template.4.wave_period_range.def @@ -1,3 +1,4 @@ +# (C) Copyright 2005- ECMWF. # Template for wave parameters defined on a certain period range # Type of period interval diff --git a/definitions/grib2/template.4.wave_spectra_formula.def b/definitions/grib2/template.4.wave_spectra_formula.def index c0893da1a..4a5e61fdd 100644 --- a/definitions/grib2/template.4.wave_spectra_formula.def +++ b/definitions/grib2/template.4.wave_spectra_formula.def @@ -1,3 +1,4 @@ +# (C) Copyright 2005- ECMWF. # Template for wave spectra defined using a formula for frequency and direction ## Direction part diff --git a/definitions/grib2/template.4.wave_spectra_list.def b/definitions/grib2/template.4.wave_spectra_list.def index 85fa6fc7d..ca7768604 100644 --- a/definitions/grib2/template.4.wave_spectra_list.def +++ b/definitions/grib2/template.4.wave_spectra_list.def @@ -1,3 +1,5 @@ +# (C) Copyright 2005- ECMWF. + # Template for wave spectra defined using an array of frequencies and directions ## Direction part diff --git a/definitions/grib2/units.def b/definitions/grib2/units.def index a20c036c4..eceea516a 100644 --- a/definitions/grib2/units.def +++ b/definitions/grib2/units.def @@ -194,13 +194,13 @@ parameterNumber = 54 ; } #Type of low vegetation -'(code table 4.234)' = { +'(Code table 4.234)' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 57 ; } #Type of high vegetation -'(code table 4.234)' = { +'(Code table 4.234)' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 58 ; @@ -226,7 +226,7 @@ typeOfFirstFixedSurface = 1 ; } #Soil type -'~' = { +'(Code table 4.213)' = { discipline = 2 ; parameterCategory = 3 ; parameterNumber = 0 ; @@ -3377,7 +3377,7 @@ parameterNumber = 45 ; } #Wetland type -'Code table 4.239' = { +'(Code table 4.239)' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 46 ; @@ -4916,6 +4916,48 @@ parameterNumber = 18 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean wind speed +'m s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean pressure +'Pa' = { + discipline = 0 ; + parameterCategory = 3 ; + parameterNumber = 0 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean potential vorticity +'K m**2 kg**-1 s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 14 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific rain water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 85 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific snow water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 86 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean eta-coordinate vertical velocity +'s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean geopotential 'm**2 s**-2' = { discipline = 0 ; @@ -4984,6 +5026,13 @@ typeOfSecondFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean vorticity (relative) +'s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 12 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean mean sea level pressure 'Pa' = { discipline = 0 ; @@ -4992,6 +5041,13 @@ typeOfFirstFixedSurface = 101 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean divergence +'s**-1' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 13 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean relative humidity '%' = { discipline = 0 ; @@ -5036,6 +5092,13 @@ scaleFactorOfFirstFixedSurface = 0 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean ozone mass mixing ratio +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 14 ; + parameterNumber = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Time-mean temperature of snow layer 'K' = { discipline = 2 ; @@ -5059,6 +5122,152 @@ typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 0 ; } +#Time-mean specific cloud liquid water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 83 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean specific cloud ice water content +'kg kg**-1' = { + discipline = 0 ; + parameterCategory = 1 ; + parameterNumber = 84 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of cloud cover +'(0 - 1)' = { + discipline = 0 ; + parameterCategory = 6 ; + parameterNumber = 32 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean K index +'K' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 2 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean total totals index +'K' = { + discipline = 0 ; + parameterCategory = 7 ; + parameterNumber = 4 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean clear air turbulence (CAT) +'m**2/3 s**-1' = { + discipline = 0 ; + parameterCategory = 19 ; + parameterNumber = 29 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean discharge from rivers or streams +'m**3 s**-1' = { + discipline = 1 ; + parameterCategory = 0 ; + parameterNumber = 7 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (total layer) +'Numeric' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index (root zone) +'Numeric' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 1 ; + typeOfSecondFixedSurface = 167 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean soil wetness index(layer) +'Numeric' = { + discipline = 2 ; + parameterCategory = 3 ; + parameterNumber = 30 ; + typeOfFirstFixedSurface = 151 ; + typeOfSecondFixedSurface = 151 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain depth +'m' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded fraction +'Proportion' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean floodplain flooded area +'m**2' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river fraction +'Proportion' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean river area +'m**2' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean fraction of river coverage plus river related flooding +'Proportion' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-mean area of river coverage plus river related flooding +'m**2' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + typeOfStatisticalProcessing = 0 ; + } +#Time-maximum volumetric soil moisture +'m**3 m**-3' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 2 ; + } +#Time-minimum volumetric soil moisture +'m**3 m**-3' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 3 ; + } +#Time-standard-deviation volumetric soil moisture +'m**3 m**-3' = { + discipline = 2 ; + parameterCategory = 0 ; + parameterNumber = 25 ; + typeOfStatisticalProcessing = 6 ; + } #Cross sectional area of flow in channel 'm**2' = { discipline = 1 ; @@ -5125,26 +5334,6 @@ parameterCategory = 0 ; parameterNumber = 15 ; } -#Mean discharge in the last 6 hours -'m**3 s**-1' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 6 ; - } -#Mean discharge in the last 24 hours -'m**3 s**-1' = { - discipline = 1 ; - parameterCategory = 0 ; - parameterNumber = 7 ; - typeOfFirstFixedSurface = 1 ; - indicatorOfUnitForTimeRange = 1 ; - typeOfStatisticalProcessing = 0 ; - lengthOfTimeRange = 24 ; - } #Snow depth at elevation bands 'kg m**-2' = { discipline = 2 ; @@ -5197,6 +5386,48 @@ parameterCategory = 0 ; parameterNumber = 19 ; } +#Floodplain depth +'m' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Floodplain flooded fraction +'Proportion' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } +#Floodplain flooded area +'m**2' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 19 ; + } +#River fraction +'Proportion' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 20 ; + } +#River area +'m**2' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 21 ; + } +#Fraction of river coverage plus river related flooding +'Proportion' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 22 ; + } +#Area of river coverage plus river related flooding +'m**2' = { + discipline = 1 ; + parameterCategory = 2 ; + parameterNumber = 23 ; + } #Latitude 'Degree N' = { discipline = 0 ; @@ -5370,7 +5601,7 @@ parameterNumber = 18 ; } #Precipitation type -'code table (4.201)' = { +'(Code table 4.201)' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 19 ; @@ -5438,7 +5669,7 @@ typeOfStatisticalProcessing = 1 ; } #Precipitable water category -'code table (4.202)' = { +'(Code table 4.202)' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 30 ; @@ -5855,7 +6086,7 @@ parameterNumber = 7 ; } #Cloud type -'code table (4.203)' = { +'(Code table 4.203)' = { discipline = 0 ; parameterCategory = 6 ; parameterNumber = 8 ; @@ -5867,7 +6098,7 @@ parameterNumber = 9 ; } #Thunderstorm coverage -'code table (4.204)' = { +'(Code table 4.204)' = { discipline = 0 ; parameterCategory = 6 ; parameterNumber = 10 ; @@ -5999,7 +6230,7 @@ parameterNumber = 11 ; } #Aerosol type -'code table (4.205)' = { +'(Code table 4.205)' = { discipline = 0 ; parameterCategory = 13 ; parameterNumber = 0 ; @@ -6109,7 +6340,7 @@ parameterNumber = 8 ; } #Volcanic ash -'code table (4.206)' = { +'(Code table 4.206)' = { discipline = 0 ; parameterCategory = 19 ; parameterNumber = 4 ; @@ -6127,7 +6358,7 @@ parameterNumber = 6 ; } #Icing -'code table (4.207)' = { +'(Code table 4.207)' = { discipline = 0 ; parameterCategory = 19 ; parameterNumber = 7 ; @@ -6145,7 +6376,7 @@ parameterNumber = 9 ; } #Turbulence -'code table (4.208)' = { +'(Code table 4.208)' = { discipline = 0 ; parameterCategory = 19 ; parameterNumber = 10 ; @@ -6157,19 +6388,19 @@ parameterNumber = 11 ; } #Planetary boundary layer regime -'code table (4.209)' = { +'(Code table 4.209)' = { discipline = 0 ; parameterCategory = 19 ; parameterNumber = 12 ; } #Contrail intensity -'code table (4.210)' = { +'(Code table 4.210)' = { discipline = 0 ; parameterCategory = 19 ; parameterNumber = 13 ; } #Contrail engine type -'code table (4.211)' = { +'(Code table 4.211)' = { discipline = 0 ; parameterCategory = 19 ; parameterNumber = 14 ; @@ -6247,13 +6478,13 @@ parameterNumber = 1 ; } #Remotely sensed snow cover -'(code table 4.215)' = { +'(Code table 4.215)' = { discipline = 1 ; parameterCategory = 0 ; parameterNumber = 2 ; } #Elevation of snow covered terrain -'(code table 4.216)' = { +'(Code table 4.216)' = { discipline = 1 ; parameterCategory = 0 ; parameterNumber = 3 ; @@ -6319,7 +6550,7 @@ parameterNumber = 7 ; } #Land use -'code table (4.212)' = { +'(Code table 4.212)' = { discipline = 2 ; parameterCategory = 0 ; parameterNumber = 8 ; @@ -6487,7 +6718,7 @@ parameterNumber = 2 ; } #Cloud top height quality indicator -'Code table 4.219' = { +'(Code table 4.219)' = { discipline = 3 ; parameterCategory = 1 ; parameterNumber = 3 ; @@ -6693,7 +6924,7 @@ parameterNumber = 0 ; } #Precipitation type (most severe) in the last 1 hour -'code table (4.201)' = { +'(Code table 4.201)' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 19 ; @@ -6702,7 +6933,7 @@ lengthOfTimeRange = 1 ; } #Precipitation type (most severe) in the last 3 hours -'code table (4.201)' = { +'(Code table 4.201)' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 19 ; @@ -6711,7 +6942,7 @@ lengthOfTimeRange = 3 ; } #Precipitation type (most frequent) in the last 1 hour -'code table (4.201)' = { +'(Code table 4.201)' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 19 ; @@ -6720,7 +6951,7 @@ lengthOfTimeRange = 1 ; } #Precipitation type (most frequent) in the last 3 hours -'code table (4.201)' = { +'(Code table 4.201)' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 19 ; @@ -6729,7 +6960,7 @@ lengthOfTimeRange = 3 ; } #Precipitation type (most severe) in the last 6 hours -'code table (4.201)' = { +'(Code table 4.201)' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 19 ; @@ -6738,7 +6969,7 @@ lengthOfTimeRange = 6 ; } #Precipitation type (most frequent) in the last 6 hours -'code table (4.201)' = { +'(Code table 4.201)' = { discipline = 0 ; parameterCategory = 1 ; parameterNumber = 19 ; @@ -6914,19 +7145,19 @@ parameterNumber = 6 ; } #Cloud mask -'Code table 4.217' = { +'(Code table 4.217)' = { discipline = 3 ; parameterCategory = 0 ; parameterNumber = 7 ; } #Pixel scene type -'Code table 4.218' = { +'(Code table 4.218)' = { discipline = 3 ; parameterCategory = 0 ; parameterNumber = 8 ; } #Fire detection indicator -'Code table 4.223' = { +'(Code table 4.223)' = { discipline = 3 ; parameterCategory = 0 ; parameterNumber = 9 ; @@ -7154,6 +7385,48 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Standardised Precipitation Index (SPI) +'Numeric' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 0 ; + } +#Standardised Precipitation Evapotranspiration Index (SPEI) +'Numeric' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 1 ; + } +#Standardised Streamflow Index (SSFI) +'Numeric' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 2 ; + } +#Standardised Reservoir Supply Index (SRSI) +'Numeric' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 3 ; + } +#Standardised Water-level Index (SWI) +'Numeric' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 4 ; + } +#Standardised Snowmelt and Rain Index (SMRI) +'Numeric' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 5 ; + } +#Streamflow Drought Index (SDI) +'Numeric' = { + discipline = 0 ; + parameterCategory = 22 ; + parameterNumber = 6 ; + } #Universal thermal climate index 'K' = { discipline = 20 ; @@ -7291,12 +7564,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea ice area fraction 'Fraction' = { @@ -7561,12 +7828,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Sea surface temperature 'K' = { @@ -7657,36 +7918,18 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Northward surface stress 'N m**-2' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface stress 'N m**-2' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Y-component of surface stress 'N m**-2' = { @@ -7849,12 +8092,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Steric change in sea surface height 'm' = { @@ -8029,24 +8266,12 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Eastward surface sea water velocity 'm s**-1' = { discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Heat Content surface to 26C isotherm 'J m**-2' = { @@ -8095,12 +8320,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; } #Vertically integrated sea water practical salinity in the upper 300 m 'g kg**-1 m' = { @@ -8401,12 +8620,6 @@ discipline = 10 ; parameterCategory = 2 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 174 ; - typeOfSecondFixedSurface = 176 ; - scaledValueOfFirstFixedSurface = missing() ; - scaleFactorOfFirstFixedSurface = missing() ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea ice area fraction @@ -8694,12 +8907,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean sea surface temperature @@ -8798,12 +9005,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 4 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean northward surface stress @@ -8811,12 +9012,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 6 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface stress @@ -8824,12 +9019,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 5 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time mean Y-component of surface stress @@ -9006,12 +9195,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 1 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean steric change in sea surface height @@ -9201,12 +9384,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 15 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean eastward surface sea water velocity @@ -9214,12 +9391,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 14 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean heat content surface to 26C isotherm @@ -9273,12 +9444,6 @@ discipline = 10 ; parameterCategory = 3 ; parameterNumber = 21 ; - typeOfFirstFixedSurface = 160 ; - typeOfSecondFixedSurface = 255 ; - scaledValueOfFirstFixedSurface = 0 ; - scaleFactorOfFirstFixedSurface = 0 ; - scaledValueOfSecondFixedSurface = missing() ; - scaleFactorOfSecondFixedSurface = missing() ; typeOfStatisticalProcessing = 0 ; } #Time-mean vertically integrated sea water practical salinity in the upper 300 m @@ -10018,6 +10183,44 @@ is_chemical_srcsink = 1 ; sourceSinkChemicalPhysicalProcess = 7 ; } +#Aerosol optical depth +'Numeric' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 102 ; + } +#Single scattering albedo +'(0 - 1)' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 103 ; + } +#Asymmetry Factor +'Numeric' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 104 ; + } +#Aerosol backscatter from top of atmosphere +'m**-1 sr**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 107 ; + typeOfFirstFixedSurface = 8 ; + } +#Aerosol backscatter from ground +'m**-1 sr**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 108 ; + typeOfFirstFixedSurface = 1 ; + } +#Aerosol extinction coefficient +'m**-1' = { + discipline = 0 ; + parameterCategory = 20 ; + parameterNumber = 105 ; + } #Pressure tendency 'Pa s**-1' = { discipline = 0 ; @@ -10180,18 +10383,6 @@ parameterCategory = 2 ; parameterNumber = 16 ; } -#U-component of current -'m s**-1' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - } -#V-component of current -'m s**-1' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - } #Precipitable water 'kg m**-2' = { discipline = 0 ; @@ -10558,19 +10749,11 @@ parameterCategory = 0 ; parameterNumber = 44 ; } -#Eastward sea water velocity -'m s**-1' = { +#Wave spectral peakedness +'dimensionless' = { discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 2 ; - typeOfFirstFixedSurface = 160 ; - } -#Northward sea water velocity -'m s**-1' = { - discipline = 10 ; - parameterCategory = 1 ; - parameterNumber = 3 ; - typeOfFirstFixedSurface = 160 ; + parameterCategory = 0 ; + parameterNumber = 98 ; } #Skin reservoir content 'kg m**-2' = { diff --git a/definitions/grib3/centre.table b/definitions/grib3/centre.table index 206305d7b..59bb85cec 100644 --- a/definitions/grib3/centre.table +++ b/definitions/grib3/centre.table @@ -63,7 +63,7 @@ 96 96 Athens 97 97 European Space Agency (ESA) 98 ecmf European Centre for Medium-Range Weather Forecasts -99 99 DeBilt, Netherlands +99 knmi DeBilt, Netherlands #100 to 109 Reserved for centres in Region I which are not in the list above 110 110 Hong-Kong #111 to 133 Reserved for centres in Region II which are not in the list above @@ -104,9 +104,9 @@ 241 241 Monaco 242 242 Romania (NMC) 244 vuwien VUWien -245 knmi KNMI +245 245 Ukraine (NMC) 246 ifmk IfM-Kiel -247 hadc Hadley Centre +247 247 Operational Programme for the Exchange of weather RAdar information (OPERA) - EUMETNET 250 cosmo COnsortium for Small scale MOdelling (COSMO) 251 251 Meteorological Cooperation on Operational NWP (MetCoOp) 252 mpim Max Planck Institute for Meteorology (MPI-M) diff --git a/definitions/grib3/modelName.def b/definitions/grib3/modelName.def deleted file mode 100644 index 25b89c3d1..000000000 --- a/definitions/grib3/modelName.def +++ /dev/null @@ -1,43 +0,0 @@ -# modelName: Contribution from Daniel Lee @ DWD - -# COSMO -# general definition -'cosmo' = { originatingCentre=250; } -'cosmo' = { subCentre=250; } - -# definitions for ARPA-SIMC -'cosmo-i2' = { originatingCentre=200; - generatingProcessIdentifier=36; } -'cosmo-i2' = { originatingCentre=200; - generatingProcessIdentifier=139; } -'cosmo-i2' = { originatingCentre=200; - generatingProcessIdentifier=144; } -'cosmo-i2' = { originatingCentre=200; - generatingProcessIdentifier=148; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=31; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=32; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=34; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=38; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=42; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=46; } -'cosmo-i7' = { originatingCentre=200; - generatingProcessIdentifier=131; } -# definitions for Moscow -'cosmo_ru' = { originatingCentre=76; - generatingProcessIdentifier=135; } -'cosmo_ru-eps' = { originatingCentre=76; - generatingProcessIdentifier=235;} - -# definitions for Athens -'cosmo-greece' = { originatingCentre=96;} -# definitions for Warsaw / Poland -'cosmo-poland' = { originatingCentre=220;} -# definitions for Romania -'cosmo-romania' = { originatingCentre=242;} - diff --git a/definitions/grib3/parameters.def b/definitions/grib3/parameters.def index 907431c7b..322d0cd21 100644 --- a/definitions/grib3/parameters.def +++ b/definitions/grib3/parameters.def @@ -23,9 +23,6 @@ concept cfName (cfNameECMF,"cfName.def",conceptsMasterDir,conceptsLocalDirAll) : concept cfVarNameECMF (defaultShortName,"cfVarName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy,dump; concept cfVarName (cfVarNameECMF,"cfVarName.def",conceptsMasterDir,conceptsLocalDirAll) : no_copy,dump; -# modelName: Contribution from Daniel Lee @ DWD -concept modelName (defaultName,"modelName.def",conceptsMasterDir,conceptsLocalDirAll): no_copy,dump,read_only; - template_nofail names "grib3/products_[productionStatusOfProcessedData].def"; meta ifsParam ifs_param(paramId,type); diff --git a/definitions/grib3/template.4.scanning_mode.def b/definitions/grib3/template.4.scanning_mode.def index 4fcd2fabb..31414321f 100644 --- a/definitions/grib3/template.4.scanning_mode.def +++ b/definitions/grib3/template.4.scanning_mode.def @@ -20,7 +20,7 @@ alias geography.iScansNegatively=iScansNegatively; alias geography.jScansPositively=jScansPositively; alias geography.jPointsAreConsecutive=jPointsAreConsecutive; -transient iScansPositively = !iScansNegatively : constraint; +transient iScansPositively = !iScansNegatively : constraint, read_only; flagbit scanningMode5(scanningMode,3) = 0: read_only; flagbit scanningMode6(scanningMode,2) = 0: read_only; diff --git a/definitions/mars/class.table b/definitions/mars/class.table index bb740e63a..046db71d6 100644 --- a/definitions/mars/class.table +++ b/definitions/mars/class.table @@ -51,6 +51,7 @@ 50 ci CERISE project 51 ai Operational AIFS 52 ed EERIE project +53 ng nextGEMS project 99 te Test 100 at Austria 101 be Belgium diff --git a/definitions/param_limits.def b/definitions/param_limits.def index 1bbcd18d6..215cbfec0 100644 --- a/definitions/param_limits.def +++ b/definitions/param_limits.def @@ -18,6 +18,7 @@ concept param_value_min(default_min_val) { -60000 = { paramId=228001; } 0 = { paramId=151163; } -3.5 = { paramId=151131; } + -3.5 = { paramId=262140; } -10 = { paramId=260259; } -13000 = { paramId=129; } -1300 = { paramId=156; } @@ -103,6 +104,7 @@ concept param_value_max(default_max_val) { 1000 = { paramId=228001; } 1500 = { paramId=151163; } 3.5 = { paramId=151131; } + 3.5 = { paramId=262140; } 5 = { paramId=260259; } 3500000 = { paramId=129; } 35000 = { paramId=156; } diff --git a/examples/C/grib_pthreads.c b/examples/C/grib_pthreads.c index 2dce9a4cd..eab0a5e74 100644 --- a/examples/C/grib_pthreads.c +++ b/examples/C/grib_pthreads.c @@ -9,11 +9,22 @@ */ #include -#include "grib_api_internal.h" +#include +#include +/*#include "grib_api_internal.h"*/ #include "eccodes.h" #define NUM_THREADS 4 +void Assert(int condition) +{ + if (!condition) { + printf("Assertion failed\n"); + exit(1); + } +} + + /* Return 0 if numbers considered equal, otherwise 1 */ static int compare_doubles(double a, double b, double tolerance) { @@ -40,7 +51,7 @@ static void* process_grib(void* threadID) ProductKind prod_kind = 0; codes_handle* h = codes_grib_handle_new_from_samples(0, "regular_ll_pl_grib2"); - Assert(h); + Assert(h != NULL); CODES_CHECK(codes_get_product_kind(h, &prod_kind), 0); Assert(prod_kind == PRODUCT_GRIB); printf("Thread %ld running\n", tid); diff --git a/examples/C/new_sample.c b/examples/C/new_sample.c index 9560e3924..82524b022 100644 --- a/examples/C/new_sample.c +++ b/examples/C/new_sample.c @@ -25,8 +25,7 @@ int main(int argc, char** argv) exit(1); } - /* h = codes_grib_handle_new_from_samples(NULL, "GRIB2"); */ - h = codes_handle_new_from_samples(NULL, "just a test"); + h = codes_handle_new_from_samples(NULL, "nonexistentsample"); if (h) return 1; h = codes_handle_new_from_samples(NULL, "GRIB2"); @@ -148,12 +147,6 @@ int main(int argc, char** argv) CODES_CHECK(codes_set_long(h, "jScansPositively", 0), 0); CODES_CHECK(codes_set_long(h, "jPointsAreConsecutive", 0), 0); CODES_CHECK(codes_set_long(h, "alternativeRowScanning", 0), 0); - CODES_CHECK(codes_set_long(h, "iScansPositively", 1), 0); - - /* ITERATOR */ - - - /* NEAREST */ CODES_CHECK(codes_set_long(h, "timeRangeIndicator", 0), 0); CODES_CHECK(codes_set_long(h, "NV", 0), 0); @@ -165,15 +158,12 @@ int main(int argc, char** argv) /* Parameter information */ - /* 0 = Temperature (grib2/tables/4/4.1.0.table) */ CODES_CHECK(codes_set_long(h, "parameterCategory", 0), 0); - /* 0 = Temperature (K) (grib2/tables/4/4.2.0.0.table) */ CODES_CHECK(codes_set_long(h, "parameterNumber", 0), 0); - /* 0 = Analysis (grib2/tables/4/4.3.table) */ CODES_CHECK(codes_set_long(h, "typeOfGeneratingProcess", 0), 0); @@ -185,7 +175,6 @@ int main(int argc, char** argv) /* 1 = Hour (grib2/tables/4/4.4.table) */ CODES_CHECK(codes_set_long(h, "indicatorOfUnitOfTimeRange", 1), 0); - /* 1 = Hour (stepUnits.table) */ CODES_CHECK(codes_set_long(h, "stepUnits", 1), 0); @@ -226,7 +215,6 @@ int main(int argc, char** argv) /* grib 2 Section 6 BIT-MAP SECTION */ - /* 255 = A bit map does not apply to this product (grib2/tables/4/6.0.table) */ CODES_CHECK(codes_set_long(h, "bitMapIndicator", 255), 0); diff --git a/examples/F90/codes_dump.f90 b/examples/F90/codes_dump.f90 index b68c68e51..ab547ec04 100644 --- a/examples/F90/codes_dump.f90 +++ b/examples/F90/codes_dump.f90 @@ -12,7 +12,7 @@ program codes_dump_test implicit none integer :: ifile, iret, msgid integer :: product_kind - character(len=10) :: product_string + character(len=512) :: product_string character(len=512) :: infile_name call getarg(1, product_string) diff --git a/examples/F90/grib_count_messages_multi.f90 b/examples/F90/grib_count_messages_multi.f90 index 5e4fe92d9..67178fa6f 100644 --- a/examples/F90/grib_count_messages_multi.f90 +++ b/examples/F90/grib_count_messages_multi.f90 @@ -13,10 +13,10 @@ program grib_count_messages_multi use eccodes implicit none - integer :: ifile - character(len=100) :: grib_file - integer :: n, stat - character(len=1) :: multi_flag + integer :: ifile + character(len=100) :: multi_flag + character(len=100) :: grib_file + integer :: n, stat call getarg(1, multi_flag) call getarg(2, grib_file) diff --git a/examples/F90/grib_read_bytes.f90 b/examples/F90/grib_read_bytes.f90 index 950eb2924..c118bdab4 100644 --- a/examples/F90/grib_read_bytes.f90 +++ b/examples/F90/grib_read_bytes.f90 @@ -7,7 +7,7 @@ ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! ! -program grib_read_bytes +program read_bytes use eccodes implicit none integer :: ifile diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index 979ad0652..66b6e598f 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -42,7 +42,7 @@ if( HAVE_FORTRAN ) # Note: $ will be present only while building (for the whole bundle), # whereas $ is only present once you install the package / bundle ecbuild_add_library( TARGET eccodes_f90 - SOURCES grib_fortran.c grib_f90.f90 eccodes_f90.f90 grib_kinds.h + SOURCES grib_fortran.cc grib_f90.f90 eccodes_f90.f90 grib_kinds.h GENERATED grib_f90.f90 eccodes_f90.f90 PUBLIC_INCLUDES $ $ diff --git a/fortran/grib_fortran.c b/fortran/grib_fortran.cc similarity index 99% rename from fortran/grib_fortran.c rename to fortran/grib_fortran.cc index ce9298348..972118384 100644 --- a/fortran/grib_fortran.c +++ b/fortran/grib_fortran.cc @@ -9,6 +9,7 @@ */ #include "grib_api_internal.h" +#include "grib_fortran_prototypes.h" #if HAVE_SYS_TYPES_H # include @@ -41,7 +42,7 @@ static pthread_mutex_t multi_handle_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t iterator_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t keys_iterator_mutex = PTHREAD_MUTEX_INITIALIZER; -static void init() { +static void init(void) { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); @@ -986,7 +987,7 @@ void grib_f_write_on_fail(int* gid) { file_count++; GRIB_MUTEX_UNLOCK(&handle_mutex) - sprintf(filename,"%ld_%d_error.grib",(long)pid,file_count); + snprintf(filename, sizeof(filename), "%ld_%d_error.grib",(long)pid,file_count); h=get_handle(*gid); if (h) grib_write_message(h,filename,"w"); @@ -996,13 +997,13 @@ void grib_f_write_on_fail_(int* gid) { grib_f_write_on_fail(gid); } /*****************************************************************************/ -int grib_f_multi_support_on_() +int grib_f_multi_support_on_(void) { grib_multi_support_on(0); return GRIB_SUCCESS; } -int grib_f_multi_support_off_() +int grib_f_multi_support_off_(void) { grib_multi_support_off(0); return GRIB_SUCCESS; @@ -1181,13 +1182,13 @@ int grib_f_keys_iterator_delete_(int* iterid) } /*****************************************************************************/ -int grib_f_gribex_mode_on_() +int grib_f_gribex_mode_on_(void) { grib_gribex_mode_on(0); return GRIB_SUCCESS; } -int grib_f_gribex_mode_off_() +int grib_f_gribex_mode_off_(void) { grib_gribex_mode_off(0); return GRIB_SUCCESS; @@ -1249,7 +1250,7 @@ int grib_f_keys_iterator_get_name_(int* iterid,char* name,int len) fort_char_clean(name, len); - sprintf(buf,"%s",grib_keys_iterator_get_name(kiter)); + snprintf(buf, sizeof(buf), "%s",grib_keys_iterator_get_name(kiter)); lsize = strlen(buf); if (input_len < lsize) return GRIB_ARRAY_TOO_SMALL; @@ -1321,7 +1322,7 @@ int codes_f_bufr_keys_iterator_get_name_(int* iterid, char* name, int len) fort_char_clean(name, len); - sprintf(buf, "%s", codes_bufr_keys_iterator_get_name(kiter)); + snprintf(buf, sizeof(buf), "%s", codes_bufr_keys_iterator_get_name(kiter)); lsize = strlen(buf); if (input_len < lsize) return GRIB_ARRAY_TOO_SMALL; @@ -2877,13 +2878,13 @@ int grib_f_multi_append_(int* ingid, int* sec,int* mgid) } /*****************************************************************************/ -int codes_f_bufr_multi_element_constant_arrays_on_() +int codes_f_bufr_multi_element_constant_arrays_on_(void) { codes_bufr_multi_element_constant_arrays_on(NULL); return GRIB_SUCCESS; } -int codes_f_bufr_multi_element_constant_arrays_off_() +int codes_f_bufr_multi_element_constant_arrays_off_(void) { codes_bufr_multi_element_constant_arrays_off(NULL); return GRIB_SUCCESS; diff --git a/fortran/grib_fortran_prototypes.h b/fortran/grib_fortran_prototypes.h new file mode 100644 index 000000000..4eb0a313d --- /dev/null +++ b/fortran/grib_fortran_prototypes.h @@ -0,0 +1,332 @@ +/* + * Copyright 2005-2018 ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +/* grib_fortran.c */ +#ifdef __cplusplus +extern "C" { +#endif + +int grib_f_read_any_headers_only_from_file_(int *fid, char *buffer, size_t *nbytes); +int grib_f_write_file_(int* fid, void* buffer, size_t* nbytes); +int any_f_new_from_loaded_(int* msgid, int* gid); +int codes_f_bufr_copy_data_(int* gid1,int* gid2); +int grib_f_get_string_array_(int* gid, char* key, char* val,int* nvals,int* slen, int len); +int codes_f_bufr_keys_iterator_rewind_(int* kiter); +int any_f_scan_file_(int* fid, int* n); +int grib_f_new_from_message_int_(int* gid, int* buffer , size_t* bufsize); +int grib_f_copy_key_(int* gidsrc, char* key, int* giddest, int len); +int grib_f_set_samples_path_(char* path, int len); + +int grib_f_read_file(int *fid, char *buffer, size_t *nbytes); +int grib_f_open_file_(int *fid, char *name, char *op, int lname, int lop); +int grib_f_open_file__(int *fid, char *name, char *op, int lname, int lop); +int grib_f_open_file(int *fid, char *name, char *op, int lname, int lop); +int grib_f_close_file_(int *fid); +int grib_f_close_file__(int *fid); +int grib_f_close_file(int *fid); +void grib_f_write_on_fail(int *gid); +void grib_f_write_on_fail_(int* gid); +void grib_f_write_on_fail__(int* gid); +int grib_f_multi_support_on_(void); +int grib_f_multi_support_on__(void); +int grib_f_multi_support_on(void); +int grib_f_multi_support_off_(void); +int grib_f_multi_support_off__(void); +int grib_f_multi_support_off(void); +int grib_f_iterator_new_(int *gid, int *iterid, int *mode); +int grib_f_iterator_new__(int *gid, int *iterid, int *mode); +int grib_f_iterator_new(int *gid, int *iterid, int *mode); +int grib_f_iterator_next_(int *iterid, double *lat, double *lon, double *value); +int grib_f_iterator_next__(int *iterid, double *lat, double *lon, double *value); +int grib_f_iterator_next(int *iterid, double *lat, double *lon, double *value); +int grib_f_iterator_delete_(int *iterid); +int grib_f_iterator_delete__(int *iterid); +int grib_f_iterator_delete(int *iterid); +int grib_f_keys_iterator_new_(int *gid, int *iterid, char *name_space, int len); +int grib_f_keys_iterator_new__(int *gid, int *iterid, char *name_space, int len); +int grib_f_keys_iterator_new(int *gid, int *iterid, char *name_space, int len); +int grib_f_keys_iterator_next_(int *iterid); +int grib_f_keys_iterator_next__(int *iterid); +int grib_f_keys_iterator_next(int *iterid); +int grib_f_keys_iterator_delete_(int *iterid); +int grib_f_keys_iterator_delete__(int *iterid); +int grib_f_keys_iterator_delete(int *iterid); +int grib_f_gribex_mode_on_(void); +int grib_f_gribex_mode_on__(void); +int grib_f_gribex_mode_on(void); +int grib_f_gribex_mode_off_(void); +int grib_f_gribex_mode_off__(void); +int grib_f_gribex_mode_off(void); +int grib_f_skip_computed_(int *iterid); +int grib_f_skip_computed__(int *iterid); +int grib_f_skip_computed(int *iterid); +int grib_f_skip_coded_(int *iterid); +int grib_f_skip_coded__(int *iterid); +int grib_f_skip_coded(int *iterid); +int grib_f_skip_edition_specific_(int *iterid); +int grib_f_skip_edition_specific__(int *iterid); +int grib_f_skip_edition_specific(int *iterid); +int grib_f_skip_duplicates_(int *iterid); +int grib_f_skip_duplicates__(int *iterid); +int grib_f_skip_duplicates(int *iterid); +int grib_f_skip_read_only_(int *iterid); +int grib_f_skip_read_only__(int *iterid); +int grib_f_skip_read_only(int *iterid); +int grib_f_skip_function_(int *iterid); +int grib_f_skip_function__(int *iterid); +int grib_f_skip_function(int *iterid); +int grib_f_keys_iterator_get_name_(int *iterid, char *name, int len); +int grib_f_keys_iterator_get_name__(int *kiter, char *name, int len); +int grib_f_keys_iterator_get_name(int *kiter, char *name, int len); +int grib_f_keys_iterator_rewind_(int *kiter); +int grib_f_keys_iterator_rewind__(int *kiter); +int grib_f_keys_iterator_rewind(int *kiter); +int grib_f_new_from_message_(int *gid, void *buffer, size_t *bufsize); +int grib_f_new_from_message__(int *gid, void *buffer, size_t *bufsize); +int grib_f_new_from_message(int *gid, void *buffer, size_t *bufsize); +int grib_f_new_from_message_copy_(int *gid, void *buffer, size_t *bufsize); +int grib_f_new_from_message_copy__(int *gid, void *buffer, size_t *bufsize); +int grib_f_new_from_message_copy(int *gid, void *buffer, size_t *bufsize); +int grib_f_new_from_samples_(int *gid, char *name, int lname); +int grib_f_new_from_samples__(int *gid, char *name, int lname); +int grib_f_new_from_samples(int *gid, char *name, int lname); +int grib_f_new_from_template_(int *gid, char *name, int lname); +int grib_f_new_from_template__(int *gid, char *name, int lname); +int grib_f_new_from_template(int *gid, char *name, int lname); +int grib_f_clone_(int *gidsrc, int *giddest); +int grib_f_clone__(int *gidsrc, int *giddest); +int grib_f_clone(int *gidsrc, int *giddest); +int grib_f_util_sections_copy_(int *gidfrom, int *gidto, int *what, int *gidout); +int grib_f_util_sections_copy__(int *gidfrom, int *gidto, int *what, int *gidout); +int grib_f_util_sections_copy(int *gidfrom, int *gidto, int *what, int *gidout); +int grib_f_copy_namespace_(int *gidsrc, char *name, int *giddest, int len); +int grib_f_copy_namespace__(int *gidsrc, char *name, int *giddest, int len); +int grib_f_copy_namespace(int *gidsrc, char *name, int *giddest, int len); +int grib_f_count_in_file(int *fid, int *n); +int grib_f_count_in_file_(int *fid, int *n); +int grib_f_count_in_file__(int *fid, int *n); +int grib_f_new_from_file_(int *fid, int *gid); +int grib_f_new_from_file__(int *fid, int *gid); +int grib_f_new_from_file(int *fid, int *gid); +int grib_f_headers_only_new_from_file_(int *fid, int *gid); +int grib_f_headers_only_new_from_file__(int *fid, int *gid); +int grib_f_headers_only_new_from_file(int *fid, int *gid); +int grib_f_new_from_index_(int *iid, int *gid); +int grib_f_new_from_index__(int *iid, int *gid); +int grib_f_new_from_index(int *iid, int *gid); +int grib_f_index_new_from_file_(char *file, char *keys, int *gid, int lfile, int lkeys); +int grib_f_index_new_from_file__(char *file, char *keys, int *gid, int lfile, int lkeys); +int grib_f_index_new_from_file(char *file, char *keys, int *gid, int lfile, int lkeys); +int grib_f_index_add_file_(int* iid, char* file, int lfile); +int grib_f_index_add_file__(int* iid, char* file, int lfile); +int grib_f_index_add_file(int* iid, char* file, int lfile); +int grib_f_index_read_(char *file, int *gid, int lfile); +int grib_f_index_read__(char *file, int *gid, int lfile); +int grib_f_index_read(char *file, int *gid, int lfile); +int grib_f_index_write_(int *gid, char *file, int lfile); +int grib_f_index_write__(int *gid, char *file, int lfile); +int grib_f_index_write(int *gid, char *file, int lfile); +int grib_f_index_release_(int *hid); +int grib_f_index_release__(int *hid); +int grib_f_index_release(int *hid); +int grib_f_multi_handle_release_(int *hid); +int grib_f_multi_handle_release__(int *hid); +int grib_f_multi_handle_release(int *hid); +int grib_f_release_(int *hid); +int grib_f_release__(int *hid); +int grib_f_release(int *hid); +int grib_f_dump_(int *gid); +int grib_f_dump__(int *gid); +int grib_f_dump(int *gid); +int grib_f_print_(int *gid, char *key, int len); +int grib_f_print__(int *gid, char *key, int len); +int grib_f_print(int *gid, char *key, int len); +int grib_f_get_error_string_(int *err, char *buf, int len); +int grib_f_get_error_string__(int *err, char *buf, int len); +int grib_f_get_error_string(int *err, char *buf, int len); +int grib_f_get_size_int_(int *gid, char *key, int *val, int len); +int grib_f_get_size_int__(int *gid, char *key, int *val, int len); +int grib_f_get_size_int(int *gid, char *key, int *val, int len); +int grib_f_get_size_long_(int *gid, char *key, long *val, int len); +int grib_f_get_size_long__(int *gid, char *key, long *val, int len); +int grib_f_get_size_long(int *gid, char *key, long *val, int len); +int grib_f_index_get_size_int_(int *gid, char *key, int *val, int len); +int grib_f_index_get_size_int__(int *gid, char *key, int *val, int len); +int grib_f_index_get_size_int(int *gid, char *key, int *val, int len); +int grib_f_index_get_size_long_(int *gid, char *key, long *val, int len); +int grib_f_index_get_size_long__(int *gid, char *key, long *val, int len); +int grib_f_index_get_size_long(int *gid, char *key, long *val, int len); +int grib_f_get_int_(int *gid, char *key, int *val, int len); +int grib_f_get_int__(int *gid, char *key, int *val, int len); +int grib_f_get_int(int *gid, char *key, int *val, int len); +int grib_f_get_long_(int *gid, char *key, long *val, int len); +int grib_f_get_long__(int *gid, char *key, long *val, int len); +int grib_f_get_long(int *gid, char *key, long *val, int len); +int grib_f_get_int_array_(int *gid, char *key, int *val, int *size, int len); +int grib_f_get_int_array__(int *gid, char *key, int *val, int *size, int len); +int grib_f_get_int_array(int *gid, char *key, int *val, int *size, int len); +int grib_f_get_long_array_(int *gid, char *key, long *val, int *size, int len); +int grib_f_get_long_array__(int *gid, char *key, long *val, int *size, int len); +int grib_f_get_long_array(int *gid, char *key, long *val, int *size, int len); +int grib_f_get_byte_array_(int* gid, char* key, unsigned char *val, int* size, int len, int lenv); +int grib_f_get_byte_array__(int* gid, char* key, unsigned char *val, int* size, int len, int lenv); +int grib_f_get_byte_array(int* gid, char* key, unsigned char *val, int* size, int len, int lenv); +int grib_f_index_get_string_(int *gid, char *key, char *val, int *eachsize, int *size, int len); +int grib_f_index_get_string__(int *gid, char *key, char *val, int *eachsize, int *size, int len); +int grib_f_index_get_string(int *gid, char *key, char *val, int *eachsize, int *size, int len); +int grib_f_index_get_long_(int *gid, char *key, long *val, int *size, int len); +int grib_f_index_get_long__(int *gid, char *key, long *val, int *size, int len); +int grib_f_index_get_long(int *gid, char *key, long *val, int *size, int len); +int grib_f_index_get_int_(int *gid, char *key, int *val, int *size, int len); +int grib_f_index_get_int__(int *gid, char *key, int *val, int *size, int len); +int grib_f_index_get_int(int *gid, char *key, int *val, int *size, int len); +int grib_f_index_get_real8_(int *gid, char *key, double *val, int *size, int len); +int grib_f_index_get_real8__(int *gid, char *key, double *val, int *size, int len); +int grib_f_index_get_real8(int *gid, char *key, double *val, int *size, int len); +int grib_f_set_int_array_(int *gid, char *key, int *val, int *size, int len); +int grib_f_set_int_array__(int *gid, char *key, int *val, int *size, int len); +int grib_f_set_int_array(int *gid, char *key, int *val, int *size, int len); +int grib_f_set_long_array_(int *gid, char *key, long *val, int *size, int len); +int grib_f_set_long_array__(int *gid, char *key, long *val, int *size, int len); +int grib_f_set_long_array(int *gid, char *key, long *val, int *size, int len); +int grib_f_set_byte_array_(int* gid, char* key, unsigned char *val, int* size, int len, int lenv); +int grib_f_set_byte_array__(int* gid, char* key, unsigned char *val, int* size, int len, int lenv); +int grib_f_set_byte_array(int* gid, char* key, unsigned char *val, int* size, int len, int lenv); +int grib_f_set_int_(int *gid, char *key, int *val, int len); +int grib_f_set_int__(int *gid, char *key, int *val, int len); +int grib_f_set_int(int *gid, char *key, int *val, int len); +int grib_f_set_long_(int *gid, char *key, long *val, int len); +int grib_f_set_long__(int *gid, char *key, long *val, int len); +int grib_f_set_long(int *gid, char *key, long *val, int len); +int grib_f_set_missing_(int *gid, char *key, int len); +int grib_f_set_missing__(int *gid, char *key, int len); +int grib_f_set_missing(int *gid, char *key, int len); +int grib_f_is_missing_(int *gid, char *key, int *isMissing, int len); +int grib_f_is_defined_(int *gid, char *key, int *isDefined, int len); +int grib_f_is_missing__(int *gid, char *key, int *isMissing, int len); +int grib_f_is_missing(int *gid, char *key, int *isMissing, int len); +int grib_f_set_real4_(int *gid, char *key, float *val, int len); +int grib_f_set_real4__(int *gid, char *key, float *val, int len); +int grib_f_set_real4(int *gid, char *key, float *val, int len); +int grib_f_get_real4_element_(int *gid, char *key, int *index, float *val, int len); +int grib_f_get_real4_element__(int *gid, char *key, int *index, float *val, int len); +int grib_f_get_real4_element(int *gid, char *key, int *index, float *val, int len); +int grib_f_get_real4_elements_(int *gid, char *key, int *index, float *val, int *size, int len); +int grib_f_get_real4_elements__(int *gid, char *key, int *index, float *val, int *len, int size); +int grib_f_get_real4_elements(int *gid, char *key, int *index, float *val, int *len, int size); +int grib_f_get_real4_(int *gid, char *key, float *val, int len); +int grib_f_get_real4__(int *gid, char *key, float *val, int len); +int grib_f_get_real4(int *gid, char *key, float *val, int len); +int grib_f_get_real4_array_(int *gid, char *key, float *val, int *size, int len); +int grib_f_get_real4_array__(int *gid, char *key, float *val, int *size, int len); +int grib_f_get_real4_array(int *gid, char *key, float *val, int *size, int len); +int grib_f_set_real4_array_(int *gid, char *key, float *val, int *size, int len); +int grib_f_set_real4_array__(int *gid, char *key, float *val, int *size, int len); +int grib_f_set_real4_array(int *gid, char *key, float *val, int *size, int len); +int grib_f_set_force_real4_array_(int *gid, char *key, float *val, int *size, int len); +int grib_f_set_force_real4_array__(int *gid, char *key, float *val, int *size, int len); +int grib_f_set_force_real4_array(int *gid, char *key, float *val, int *size, int len); +int grib_f_index_select_real8_(int *gid, char *key, double *val, int len); +int grib_f_index_select_real8__(int *gid, char *key, double *val, int len); +int grib_f_index_select_real8(int *gid, char *key, double *val, int len); +int grib_f_index_select_string_(int *gid, char *key, char *val, int len, int vallen); +int grib_f_index_select_string__(int *gid, char *key, char *val, int len, int vallen); +int grib_f_index_select_string(int *gid, char *key, char *val, int len, int vallen); +int grib_f_index_select_int_(int *gid, char *key, int *val, int len); +int grib_f_index_select_int__(int *gid, char *key, int *val, int len); +int grib_f_index_select_int(int *gid, char *key, int *val, int len); +int grib_f_index_select_long_(int *gid, char *key, long *val, int len); +int grib_f_index_select_long__(int *gid, char *key, long *val, int len); +int grib_f_index_select_long(int *gid, char *key, long *val, int len); +int grib_f_set_real8_(int *gid, char *key, double *val, int len); +int grib_f_set_real8__(int *gid, char *key, double *val, int len); +int grib_f_set_real8(int *gid, char *key, double *val, int len); +int grib_f_get_real8_(int *gid, char *key, double *val, int len); +int grib_f_get_real8__(int *gid, char *key, double *val, int len); +int grib_f_get_real8(int *gid, char *key, double *val, int len); +int grib_f_get_real8_element_(int *gid, char *key, int *index, double *val, int len); +int grib_f_get_real8_element__(int *gid, char *key, int *index, double *val, int len); +int grib_f_get_real8_element(int *gid, char *key, int *index, double *val, int len); +int grib_f_get_real8_elements_(int *gid, char *key, int *index, double *val, int *size, int len); +int grib_f_get_real8_elements__(int *gid, char *key, int *index, double *val, int *len, int size); +int grib_f_get_real8_elements(int *gid, char *key, int *index, double *val, int *len, int size); +int grib_f_find_nearest_four_single_(int *gid, int *is_lsm, double *inlat, double *inlon, double *outlats, double *outlons, double *values, double *distances, int *indexes); +int grib_f_find_nearest_four_single__(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes); +int grib_f_find_nearest_four_single(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes); +int grib_f_find_nearest_single_(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes); +int grib_f_find_nearest_single__(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes); +int grib_f_find_nearest_single(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes); +int grib_f_find_nearest_multiple_(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes, int *npoints); +int grib_f_find_nearest_multiple__(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes, int *npoints); +int grib_f_find_nearest_multiple(int *gid, int *is_lsm, double *inlats, double *inlons, double *outlats, double *outlons, double *values, double *distances, int *indexes, int *npoints); +int grib_f_get_real8_array_(int *gid, char *key, double *val, int *size, int len); +int grib_f_get_real8_array__(int *gid, char *key, double *val, int *size, int len); +int grib_f_get_real8_array(int *gid, char *key, double *val, int *size, int len); +int grib_f_set_real8_array_(int *gid, char *key, double *val, int *size, int len); +int grib_f_set_real8_array__(int *gid, char *key, double *val, int *size, int len); +int grib_f_set_real8_array(int *gid, char *key, double *val, int *size, int len); +int grib_f_set_force_real8_array_(int *gid, char *key, double *val, int *size, int len); +int grib_f_set_force_real8_array__(int *gid, char *key, double *val, int *size, int len); +int grib_f_set_force_real8_array(int *gid, char *key, double *val, int *size, int len); +int grib_f_get_string_(int *gid, char *key, char *val, int len, int len2); +int grib_f_get_string__(int *gid, char *key, char *val, int len, int len2); +int grib_f_get_string(int *gid, char *key, char *val, int len, int len2); +int grib_f_set_string_(int *gid, char *key, char *val, int len, int len2); +int grib_f_set_string__(int *gid, char *key, char *val, int len, int len2); +int grib_f_set_string(int *gid, char *key, char *val, int len, int len2); +int grib_f_get_data_real4_(int *gid, float *lats, float *lons, float *values, size_t *size); +int grib_f_get_data_real4__(int *gid, float *lats, float *lons, float *values, size_t *size); +int grib_f_get_data_real4(int *gid, float *lats, float *lons, float *values, size_t *size); +int grib_f_get_data_real8_(int *gid, double *lats, double *lons, double *values, size_t *size); +int grib_f_get_data_real8__(int *gid, double *lats, double *lons, double *values, size_t *size); +int grib_f_get_data_real8(int *gid, double *lats, double *lons, double *values, size_t *size); +int grib_f_get_message_size_(int *gid, size_t *len); +int grib_f_get_message_size__(int *gid, size_t *len); +int grib_f_get_message_size(int *gid, size_t *len); +int grib_f_copy_message_(int *gid, void *mess, size_t *len); +int grib_f_copy_message__(int *gid, void *mess, size_t *len); +int grib_f_copy_message(int *gid, void *mess, size_t *len); +void grib_f_check_(int *err, char *call, char *str, int lencall, int lenstr); +void grib_f_check__(int *err, char *call, char *key, int lencall, int lenkey); +void grib_f_check(int *err, char *call, char *key, int lencall, int lenkey); +int grib_f_write_(int *gid, int *fid); +int grib_f_write__(int *gid, int *fid); +int grib_f_write(int *gid, int *fid); +int grib_f_multi_write_(int *gid, int *fid); +int grib_f_multi_write__(int *gid, int *fid); +int grib_f_multi_write(int *gid, int *fid); +int grib_f_multi_append_(int *ingid, int *sec, int *mgid); +int grib_f_multi_append(int *ingid, int *sec, int *mgid); +int grib_f_multi_append__(int *ingid, int *sec, int *mgid); + +int codes_f_bufr_keys_iterator_new_(int* gid,int* iterid); +int grib_f_read_file_(int* fid, void* buffer, size_t* nbytes); +int codes_f_bufr_keys_iterator_delete_(int* iterid); +int grib_f_set_definitions_path_(char* path, int len); +int grib_f_read_any_from_file_(int* fid, void* buffer, size_t* nbytes); +int any_f_new_from_file_(int* fid, int* gid); +int grib_f_get_native_type_(int* gid, char* key, int* val, int len); +int grib_f_get_api_version_(int* apiVersion,int len); +int codes_bufr_f_new_from_samples_(int* gid, char* name, int lname); +int any_f_load_all_from_file_(int* fid, int* n); +int codes_f_bufr_multi_element_constant_arrays_on_(); +int bufr_f_new_from_file_(int* fid, int* gid); +int grib_f_julian_to_datetime_(double* jd,long* year,long* month,long* day,long *hour,long *minute,long *second); +int any_f_new_from_scanned_file_(int* fid, int* msgid, int* gid); +int codes_f_bufr_keys_iterator_next_(int* iterid); +int grib_f_datetime_to_julian_(long* year,long* month,long* day, long* hour,long* minute,long* second,double* jd); +int grib_f_set_string_array_(int* gid, char* key, char* val,int* nvals,int* slen, int len); +int codes_f_bufr_keys_iterator_get_name_(int* iterid, char* name, int len); +int codes_f_bufr_multi_element_constant_arrays_off_(); + + +#ifdef __cplusplus +} +#endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 97cd81dfc..fce6d88d8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,6 +9,10 @@ # nor does it submit to any jurisdiction. # list( APPEND eccodes_src_files + accessor/grib_accessor.cc + accessor/grib_accessors_list.cc + grib_accessor_class.cc + shared_functions.cc step_unit.cc step.cc step_utilities.cc @@ -20,9 +24,9 @@ list( APPEND eccodes_src_files action_class_gen.cc action_class_if.cc action_class_switch.cc - grib_accessor_class_g1fcperiod.cc - grib_accessor_class_g1end_of_interval_monthly.cc - grib_accessor_class_mars_param.cc + accessor/grib_accessor_class_g1fcperiod.cc + accessor/grib_accessor_class_g1end_of_interval_monthly.cc + accessor/grib_accessor_class_mars_param.cc action_class_section.cc action_class_list.cc action_class_while.cc @@ -47,7 +51,6 @@ list( APPEND eccodes_src_files action_class_modify.cc action_class_transient_darray.cc eccodes.cc - grib_accessor.cc grib_concept.cc grib_hash_array.cc grib_bufr_descriptor.cc @@ -60,208 +63,207 @@ list( APPEND eccodes_src_files grib_iarray.cc grib_viarray.cc codes_memfs.cc - grib_accessor_class_ascii.cc - grib_accessor_class_bit.cc - grib_accessor_class_bitmap.cc - grib_accessor_class_bits.cc - grib_accessor_class_bits_per_value.cc - grib_accessor_class_bufr_elements_table.cc - grib_accessor_class_bufr_data_array.cc - grib_accessor_class_bufr_data_element.cc - grib_accessor_class_bufr_group.cc - grib_accessor_class_bufr_string_values.cc - grib_accessor_class_pack_bufr_values.cc - grib_accessor_class_unpack_bufr_values.cc - grib_accessor_class_group.cc - grib_accessor_class_non_alpha.cc - grib_accessor_class_g1bitmap.cc - grib_accessor_class_g2bitmap.cc - grib_accessor_class_concept.cc - grib_accessor_class_hash_array.cc - grib_accessor_class_decimal_precision.cc - grib_accessor_class_divdouble.cc - grib_accessor_class_multdouble.cc - grib_accessor_class_budgdate.cc - grib_accessor_class_validity_date.cc - grib_accessor_class_validity_time.cc - grib_accessor_class_bytes.cc - grib_accessor_class.cc - grib_accessor_class_change_alternative_row_scanning.cc - grib_accessor_class_change_scanning_direction.cc - grib_accessor_class_check_internal_version.cc - grib_accessor_class_codeflag.cc - grib_accessor_class_smart_table.cc - grib_accessor_class_smart_table_column.cc - grib_accessor_class_codetable.cc - grib_accessor_class_codetable_units.cc - grib_accessor_class_codetable_title.cc - grib_accessor_class_step_human_readable.cc - grib_accessor_class_count_file.cc - grib_accessor_class_count_total.cc - grib_accessor_class_double.cc - grib_accessor_class_element.cc - grib_accessor_class_evaluate.cc - grib_accessor_class_g1date.cc - grib_accessor_class_g1monthlydate.cc - grib_accessor_class_library_version.cc - grib_accessor_class_when.cc - grib_accessor_class_g1verificationdate.cc - grib_accessor_class_g1day_of_the_year_date.cc - grib_accessor_class_g1_half_byte_codeflag.cc - grib_accessor_class_g1forecastmonth.cc - grib_accessor_class_g1step_range.cc - grib_accessor_class_g2step_range.cc - grib_accessor_class_data_g22order_packing.cc - grib_accessor_class_mars_step.cc - grib_accessor_class_message_copy.cc - grib_accessor_class_dictionary.cc - grib_accessor_class_latlon_increment.cc - grib_accessor_class_g2date.cc - grib_accessor_class_g2level.cc - grib_accessor_class_g2end_step.cc - grib_accessor_class_g2latlon.cc - grib_accessor_class_g2lon.cc - grib_accessor_class_global_gaussian.cc - grib_accessor_class_gaussian_grid_name.cc - grib_accessor_class_gen.cc - grib_accessor_class_getenv.cc - grib_accessor_class_gts_header.cc - grib_accessor_class_ifs_param.cc - grib_accessor_class_julian_day.cc - grib_accessor_class_julian_date.cc - grib_accessor_class_closest_date.cc - grib_accessor_class_latlonvalues.cc - grib_accessor_class_latitudes.cc - grib_accessor_class_longitudes.cc - grib_accessor_class_offset_file.cc - grib_accessor_class_scale.cc - grib_accessor_class_from_scale_factor_scaled_value.cc - grib_accessor_class_g2bitmap_present.cc - grib_accessor_class_ibmfloat.cc - grib_accessor_class_ieeefloat.cc - grib_accessor_class_constant.cc - grib_accessor_class_iterator.cc - grib_accessor_class_message.cc - grib_accessor_class_nearest.cc - grib_accessor_class_ksec1expver.cc - grib_accessor_class_label.cc - grib_accessor_class_long.cc - grib_accessor_class_lookup.cc - grib_accessor_class_octahedral_gaussian.cc - grib_accessor_class_octet_number.cc - grib_accessor_class_headers_only.cc - grib_accessor_class_padding.cc - grib_accessor_class_pad.cc - grib_accessor_class_padto.cc - grib_accessor_class_padtoeven.cc - grib_accessor_class_padtomultiple.cc - grib_accessor_class_section_padding.cc - grib_accessor_class_packing_type.cc - grib_accessor_class_section_pointer.cc - grib_accessor_class_position.cc - grib_accessor_class_signed.cc - grib_accessor_class_signed_bits.cc - grib_accessor_class_section.cc - grib_accessor_class_step_in_units.cc - grib_accessor_class_optimal_step_units.cc - grib_accessor_class_section_length.cc - grib_accessor_class_g1_message_length.cc - grib_accessor_class_g1_section4_length.cc - grib_accessor_class_size.cc - grib_accessor_class_rdbtime_guess_date.cc - grib_accessor_class_scale_values.cc - grib_accessor_class_offset_values.cc - grib_accessor_class_sprintf.cc - grib_accessor_class_round.cc - grib_accessor_class_spectral_truncation.cc - grib_accessor_class_time.cc - grib_accessor_class_transient.cc - grib_accessor_class_trim.cc - grib_accessor_class_transient_darray.cc - grib_accessor_class_values.cc - grib_accessor_class_simple_packing_error.cc - grib_accessor_class_data_simple_packing.cc - grib_accessor_class_count_missing.cc - grib_accessor_class_data_sh_packed.cc - grib_accessor_class_data_sh_unpacked.cc - grib_accessor_class_number_of_values_data_raw_packing.cc - grib_accessor_class_data_g1simple_packing.cc - grib_accessor_class_data_g1shsimple_packing.cc - grib_accessor_class_data_shsimple_packing.cc - grib_accessor_class_data_dummy_field.cc - grib_accessor_class_variable.cc - grib_accessor_class_second_order_bits_per_value.cc - grib_accessor_class_data_g2simple_packing.cc - grib_accessor_class_data_g2simple_packing_with_preprocessing.cc - grib_accessor_class_data_g2shsimple_packing.cc - grib_accessor_class_data_g2complex_packing.cc - grib_accessor_class_data_g1second_order_row_by_row_packing.cc - grib_accessor_class_data_g1second_order_constant_width_packing.cc - grib_accessor_class_data_g1second_order_general_packing.cc - grib_accessor_class_data_g1second_order_general_extended_packing.cc - grib_accessor_class_g2grid.cc - grib_accessor_class_unexpanded_descriptors.cc - grib_accessor_class_expanded_descriptors.cc - grib_accessor_class_bufrdc_expanded_descriptors.cc - grib_accessor_class_data_apply_bitmap.cc - grib_accessor_class_data_apply_boustrophedonic.cc - grib_accessor_class_data_apply_boustrophedonic_bitmap.cc - grib_accessor_class_data_secondary_bitmap.cc - grib_accessor_class_data_g1secondary_bitmap.cc - grib_accessor_class_data_g2secondary_bitmap.cc - grib_accessor_class_data_jpeg2000_packing.cc - grib_accessor_class_data_png_packing.cc - grib_accessor_class_data_ccsds_packing.cc - grib_accessor_class_data_raw_packing.cc - grib_accessor_class_data_complex_packing.cc - grib_accessor_class_data_g1complex_packing.cc - grib_accessor_class_gds_not_present_bitmap.cc - grib_accessor_class_gds_is_present.cc - grib_accessor_class_select_step_template.cc - grib_accessor_class_local_definition.cc - grib_accessor_class_g2_eps.cc - grib_accessor_class_g2_aerosol.cc - grib_accessor_class_g2_chemical.cc - grib_accessor_class_g2_mars_labeling.cc - grib_accessor_class_md5.cc - grib_accessor_class_proj_string.cc + accessor/grib_accessor_class_gen.cc + accessor/grib_accessor_class_ascii.cc + accessor/grib_accessor_class_bit.cc + accessor/grib_accessor_class_bitmap.cc + accessor/grib_accessor_class_bits.cc + accessor/grib_accessor_class_bits_per_value.cc + accessor/grib_accessor_class_bufr_elements_table.cc + accessor/grib_accessor_class_bufr_data_array.cc + accessor/grib_accessor_class_bufr_data_element.cc + accessor/grib_accessor_class_bufr_group.cc + accessor/grib_accessor_class_bufr_string_values.cc + accessor/grib_accessor_class_pack_bufr_values.cc + accessor/grib_accessor_class_unpack_bufr_values.cc + accessor/grib_accessor_class_group.cc + accessor/grib_accessor_class_non_alpha.cc + accessor/grib_accessor_class_g1bitmap.cc + accessor/grib_accessor_class_g2bitmap.cc + accessor/grib_accessor_class_concept.cc + accessor/grib_accessor_class_hash_array.cc + accessor/grib_accessor_class_decimal_precision.cc + accessor/grib_accessor_class_divdouble.cc + accessor/grib_accessor_class_multdouble.cc + accessor/grib_accessor_class_budgdate.cc + accessor/grib_accessor_class_validity_date.cc + accessor/grib_accessor_class_validity_time.cc + accessor/grib_accessor_class_bytes.cc + accessor/grib_accessor_class_change_alternative_row_scanning.cc + accessor/grib_accessor_class_change_scanning_direction.cc + accessor/grib_accessor_class_check_internal_version.cc + accessor/grib_accessor_class_codeflag.cc + accessor/grib_accessor_class_smart_table.cc + accessor/grib_accessor_class_smart_table_column.cc + accessor/grib_accessor_class_codetable.cc + accessor/grib_accessor_class_codetable_units.cc + accessor/grib_accessor_class_codetable_title.cc + accessor/grib_accessor_class_step_human_readable.cc + accessor/grib_accessor_class_count_file.cc + accessor/grib_accessor_class_count_total.cc + accessor/grib_accessor_class_double.cc + accessor/grib_accessor_class_element.cc + accessor/grib_accessor_class_evaluate.cc + accessor/grib_accessor_class_g1date.cc + accessor/grib_accessor_class_g1monthlydate.cc + accessor/grib_accessor_class_library_version.cc + accessor/grib_accessor_class_when.cc + accessor/grib_accessor_class_g1verificationdate.cc + accessor/grib_accessor_class_g1day_of_the_year_date.cc + accessor/grib_accessor_class_g1_half_byte_codeflag.cc + accessor/grib_accessor_class_g1forecastmonth.cc + accessor/grib_accessor_class_g1step_range.cc + accessor/grib_accessor_class_g2step_range.cc + accessor/grib_accessor_class_data_g22order_packing.cc + accessor/grib_accessor_class_mars_step.cc + accessor/grib_accessor_class_message_copy.cc + accessor/grib_accessor_class_dictionary.cc + accessor/grib_accessor_class_latlon_increment.cc + accessor/grib_accessor_class_g2date.cc + accessor/grib_accessor_class_g2level.cc + accessor/grib_accessor_class_g2end_step.cc + accessor/grib_accessor_class_g2latlon.cc + accessor/grib_accessor_class_g2lon.cc + accessor/grib_accessor_class_global_gaussian.cc + accessor/grib_accessor_class_gaussian_grid_name.cc + accessor/grib_accessor_class_getenv.cc + accessor/grib_accessor_class_gts_header.cc + accessor/grib_accessor_class_ifs_param.cc + accessor/grib_accessor_class_julian_day.cc + accessor/grib_accessor_class_julian_date.cc + accessor/grib_accessor_class_closest_date.cc + accessor/grib_accessor_class_latlonvalues.cc + accessor/grib_accessor_class_latitudes.cc + accessor/grib_accessor_class_longitudes.cc + accessor/grib_accessor_class_offset_file.cc + accessor/grib_accessor_class_scale.cc + accessor/grib_accessor_class_from_scale_factor_scaled_value.cc + accessor/grib_accessor_class_g2bitmap_present.cc + accessor/grib_accessor_class_ibmfloat.cc + accessor/grib_accessor_class_ieeefloat.cc + accessor/grib_accessor_class_constant.cc + accessor/grib_accessor_class_iterator.cc + accessor/grib_accessor_class_message.cc + accessor/grib_accessor_class_nearest.cc + accessor/grib_accessor_class_ksec1expver.cc + accessor/grib_accessor_class_label.cc + accessor/grib_accessor_class_long.cc + accessor/grib_accessor_class_lookup.cc + accessor/grib_accessor_class_octahedral_gaussian.cc + accessor/grib_accessor_class_octet_number.cc + accessor/grib_accessor_class_headers_only.cc + accessor/grib_accessor_class_padding.cc + accessor/grib_accessor_class_pad.cc + accessor/grib_accessor_class_padto.cc + accessor/grib_accessor_class_padtoeven.cc + accessor/grib_accessor_class_padtomultiple.cc + accessor/grib_accessor_class_section_padding.cc + accessor/grib_accessor_class_packing_type.cc + accessor/grib_accessor_class_section_pointer.cc + accessor/grib_accessor_class_position.cc + accessor/grib_accessor_class_signed.cc + accessor/grib_accessor_class_signed_bits.cc + accessor/grib_accessor_class_section.cc + accessor/grib_accessor_class_step_in_units.cc + accessor/grib_accessor_class_optimal_step_units.cc + accessor/grib_accessor_class_section_length.cc + accessor/grib_accessor_class_g1_message_length.cc + accessor/grib_accessor_class_g1_section4_length.cc + accessor/grib_accessor_class_size.cc + accessor/grib_accessor_class_rdbtime_guess_date.cc + accessor/grib_accessor_class_scale_values.cc + accessor/grib_accessor_class_offset_values.cc + accessor/grib_accessor_class_sprintf.cc + accessor/grib_accessor_class_round.cc + accessor/grib_accessor_class_spectral_truncation.cc + accessor/grib_accessor_class_time.cc + accessor/grib_accessor_class_transient.cc + accessor/grib_accessor_class_trim.cc + accessor/grib_accessor_class_transient_darray.cc + accessor/grib_accessor_class_values.cc + accessor/grib_accessor_class_simple_packing_error.cc + accessor/grib_accessor_class_data_simple_packing.cc + accessor/grib_accessor_class_count_missing.cc + accessor/grib_accessor_class_data_sh_packed.cc + accessor/grib_accessor_class_data_sh_unpacked.cc + accessor/grib_accessor_class_number_of_values_data_raw_packing.cc + accessor/grib_accessor_class_data_g1simple_packing.cc + accessor/grib_accessor_class_data_g1shsimple_packing.cc + accessor/grib_accessor_class_data_shsimple_packing.cc + accessor/grib_accessor_class_data_dummy_field.cc + accessor/grib_accessor_class_variable.cc + accessor/grib_accessor_class_second_order_bits_per_value.cc + accessor/grib_accessor_class_data_g2simple_packing.cc + accessor/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc + accessor/grib_accessor_class_data_g2shsimple_packing.cc + accessor/grib_accessor_class_data_g2complex_packing.cc + accessor/grib_accessor_class_data_g1second_order_row_by_row_packing.cc + accessor/grib_accessor_class_data_g1second_order_constant_width_packing.cc + accessor/grib_accessor_class_data_g1second_order_general_packing.cc + accessor/grib_accessor_class_data_g1second_order_general_extended_packing.cc + accessor/grib_accessor_class_g2grid.cc + accessor/grib_accessor_class_unexpanded_descriptors.cc + accessor/grib_accessor_class_expanded_descriptors.cc + accessor/grib_accessor_class_bufrdc_expanded_descriptors.cc + accessor/grib_accessor_class_data_apply_bitmap.cc + accessor/grib_accessor_class_data_apply_boustrophedonic.cc + accessor/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc + accessor/grib_accessor_class_data_secondary_bitmap.cc + accessor/grib_accessor_class_data_g1secondary_bitmap.cc + accessor/grib_accessor_class_data_g2secondary_bitmap.cc + accessor/grib_accessor_class_data_jpeg2000_packing.cc + accessor/grib_accessor_class_data_png_packing.cc + accessor/grib_accessor_class_data_ccsds_packing.cc + accessor/grib_accessor_class_data_raw_packing.cc + accessor/grib_accessor_class_data_complex_packing.cc + accessor/grib_accessor_class_data_g1complex_packing.cc + accessor/grib_accessor_class_gds_not_present_bitmap.cc + accessor/grib_accessor_class_gds_is_present.cc + accessor/grib_accessor_class_select_step_template.cc + accessor/grib_accessor_class_local_definition.cc + accessor/grib_accessor_class_g2_eps.cc + accessor/grib_accessor_class_g2_aerosol.cc + accessor/grib_accessor_class_g2_chemical.cc + accessor/grib_accessor_class_g2_mars_labeling.cc + accessor/grib_accessor_class_md5.cc + accessor/grib_accessor_class_proj_string.cc grib_jasper_encoding.cc grib_openjpeg_encoding.cc action_class_set_missing.cc - grib_accessor_class_number_of_points.cc - grib_accessor_class_suppressed.cc + accessor/grib_accessor_class_number_of_points.cc + accessor/grib_accessor_class_suppressed.cc grib_index.cc - grib_accessor_class_number_of_points_gaussian.cc - grib_accessor_class_number_of_values.cc - grib_accessor_class_number_of_coded_values.cc - grib_accessor_class_g1number_of_coded_values_sh_complex.cc - grib_accessor_class_g1number_of_coded_values_sh_simple.cc - grib_accessor_class_dirty.cc - grib_accessor_class_statistics.cc - grib_accessor_class_statistics_spectral.cc - grib_accessor_class_unsigned.cc - grib_accessor_class_unsigned_bits.cc - grib_accessor_class_raw.cc - grib_accessor_class_bufr_simple_thinning.cc - grib_accessor_class_bufr_extract_subsets.cc - grib_accessor_class_bufr_extract_area_subsets.cc - grib_accessor_class_bufr_extract_datetime_subsets.cc - grib_accessor_class_spd.cc - grib_accessor_class_sum.cc - grib_accessor_class_to_integer.cc - grib_accessor_class_to_double.cc - grib_accessor_class_to_string.cc - grib_accessor_class_sexagesimal2decimal.cc - grib_accessor_class_vector.cc - grib_accessor_class_long_vector.cc + accessor/grib_accessor_class_number_of_points_gaussian.cc + accessor/grib_accessor_class_number_of_values.cc + accessor/grib_accessor_class_number_of_coded_values.cc + accessor/grib_accessor_class_g1number_of_coded_values_sh_complex.cc + accessor/grib_accessor_class_g1number_of_coded_values_sh_simple.cc + accessor/grib_accessor_class_dirty.cc + accessor/grib_accessor_class_statistics.cc + accessor/grib_accessor_class_statistics_spectral.cc + accessor/grib_accessor_class_unsigned.cc + accessor/grib_accessor_class_unsigned_bits.cc + accessor/grib_accessor_class_raw.cc + accessor/grib_accessor_class_bufr_simple_thinning.cc + accessor/grib_accessor_class_bufr_extract_subsets.cc + accessor/grib_accessor_class_bufr_extract_area_subsets.cc + accessor/grib_accessor_class_bufr_extract_datetime_subsets.cc + accessor/grib_accessor_class_spd.cc + accessor/grib_accessor_class_sum.cc + accessor/grib_accessor_class_to_integer.cc + accessor/grib_accessor_class_to_double.cc + accessor/grib_accessor_class_to_string.cc + accessor/grib_accessor_class_sexagesimal2decimal.cc + accessor/grib_accessor_class_vector.cc + accessor/grib_accessor_class_long_vector.cc grib_gaussian_reduced.cc - grib_accessor_class_abstract_vector.cc - grib_accessor_class_abstract_long_vector.cc + accessor/grib_accessor_class_abstract_vector.cc + accessor/grib_accessor_class_abstract_long_vector.cc grib_loader_from_handle.cc grib_bits.cc grib_ibmfloat.cc grib_ieeefloat.cc - grib_accessor_class_reference_value_error.cc + accessor/grib_accessor_class_reference_value_error.cc grib_memory.cc grib_buffer.cc grib_dumper.cc @@ -364,16 +366,16 @@ list( APPEND eccodes_src_files grib_yacc.h md5.h md5.cc - grib_accessor_class_uint16.cc - grib_accessor_class_uint32.cc - grib_accessor_class_uint32_little_endian.cc - grib_accessor_class_uint64.cc - grib_accessor_class_uint64_little_endian.cc - grib_accessor_class_uint8.cc - grib_accessor_class_blob.cc + accessor/grib_accessor_class_uint16.cc + accessor/grib_accessor_class_uint32.cc + accessor/grib_accessor_class_uint32_little_endian.cc + accessor/grib_accessor_class_uint64.cc + accessor/grib_accessor_class_uint64_little_endian.cc + accessor/grib_accessor_class_uint8.cc + accessor/grib_accessor_class_blob.cc grib_optimize_decimal_factor.cc - grib_accessor_class_data_g2bifourier_packing.cc - grib_accessor_class_data_run_length_packing.cc + accessor/grib_accessor_class_data_g2bifourier_packing.cc + accessor/grib_accessor_class_data_run_length_packing.cc eccodes_windef.h # We ship our own generated lex/yacc C files grib_yacc.cc grib_lex.cc ) diff --git a/src/accessor/grib_accessor.cc b/src/accessor/grib_accessor.cc new file mode 100644 index 000000000..23c52c888 --- /dev/null +++ b/src/accessor/grib_accessor.cc @@ -0,0 +1,135 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +/*************************************************************************** + * Jean Baptiste Filippi - 01.11.2005 + ***************************************************************************/ + +#include "grib_accessor.h" +#include + +// Note: A fast cut-down version of strcmp which does NOT return -1 +// 0 means input strings are equal and 1 means not equal +GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b) +{ + if (*a != *b) + return 1; + while ((*a != 0 && *b != 0) && *(a) == *(b)) { + a++; + b++; + } + return (*a == 0 && *b == 0) ? 0 : 1; +} + +int grib_accessor::compare_accessors(grib_accessor* a2, int compare_flags) +{ + int ret = 0; + long type1 = 0; + long type2 = 0; + int type_mismatch = 0; + grib_accessor_class* c1 = NULL; + grib_accessor* a1 = this; + + if ((compare_flags & GRIB_COMPARE_NAMES) && grib_inline_strcmp(a1->name, a2->name)) + return GRIB_NAME_MISMATCH; + + if (compare_flags & GRIB_COMPARE_TYPES) { + type1 = a1->get_native_type(); + type2 = a2->get_native_type(); + + type_mismatch = type1 != type2 ? 1 : 0; + } + + // ret = GRIB_UNABLE_TO_COMPARE_ACCESSORS; + c1 = a1->cclass; + ret = c1->compare(a1, a2); + + if (ret == GRIB_VALUE_MISMATCH && type_mismatch) + ret = GRIB_TYPE_AND_VALUE_MISMATCH; + + return ret; +} + +int grib_accessor::add_attribute(grib_accessor* attr, int nest_if_clash) +{ + int id = 0; + int idx = 0; + grib_accessor* pSame = NULL; + grib_accessor* pAloc = this; + + if (this->has_attributes()) { + pSame = this->get_attribute_index(attr->name, &id); + } + + if (pSame) { + if (nest_if_clash == 0) + return GRIB_ATTRIBUTE_CLASH; + pAloc = pSame; + } + + for (id = 0; id < MAX_ACCESSOR_ATTRIBUTES; id++) { + if (pAloc->attributes[id] == NULL) { + // attr->parent=a->parent; + pAloc->attributes[id] = attr; + attr->parent_as_attribute = pAloc; + if (pAloc->same) + attr->same = pAloc->same->get_attribute_index(attr->name, &idx); + + grib_context_log(this->context, GRIB_LOG_DEBUG, "added attribute %s->%s", this->name, attr->name); + return GRIB_SUCCESS; + } + } + return GRIB_TOO_MANY_ATTRIBUTES; +} + +grib_accessor* grib_accessor::get_attribute_index(const char* name, int* index) +{ + int i = 0; + while (i < MAX_ACCESSOR_ATTRIBUTES && this->attributes[i]) { + if (!grib_inline_strcmp(this->attributes[i]->name, name)) { + *index = i; + return this->attributes[i]; + } + i++; + } + return NULL; +} + +int grib_accessor::has_attributes() +{ + return this->attributes[0] ? 1 : 0; +} + +grib_accessor* grib_accessor::get_attribute(const char* name) +{ + int index = 0; + const char* p = 0; + char* basename = NULL; + const char* attribute_name = NULL; + grib_accessor* acc = NULL; + p = name; + while (*(p + 1) != '\0' && (*p != '-' || *(p + 1) != '>')) + p++; + if (*(p + 1) == '\0') { + return this->get_attribute_index(name, &index); + } + else { + size_t size = p - name; + attribute_name = p + 2; + basename = (char*)grib_context_malloc_clear(this->context, size + 1); + basename = (char*)memcpy(basename, name, size); + acc = this->get_attribute_index(basename, &index); + grib_context_free(this->context, basename); + if (acc) + return acc->get_attribute(attribute_name); + else + return NULL; + } +} diff --git a/src/accessor/grib_accessor.h b/src/accessor/grib_accessor.h new file mode 100644 index 000000000..7fe8aad19 --- /dev/null +++ b/src/accessor/grib_accessor.h @@ -0,0 +1,147 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_api_internal.h" +#include "grib_value.h" + +class grib_accessor +{ +public: + grib_accessor() : + name(nullptr), name_space(nullptr), context(nullptr), h(nullptr), creator(nullptr), + length(0), offset(0), parent(nullptr), next_(nullptr), previous_(nullptr), cclass(nullptr), + flags(0), sub_section(nullptr), dirty(0), same(nullptr), loop(0), vvalue(nullptr), + set(nullptr), parent_as_attribute(nullptr) {} + virtual ~grib_accessor() {} + + virtual void init_accessor(const long, grib_arguments*) = 0; + virtual void dump(grib_dumper* f) = 0; + virtual int pack_missing() = 0; + //virtual int grib_pack_zero(grib_accessor* a) = 0; + virtual int is_missing_internal() = 0; + virtual int pack_double(const double* v, size_t* len) = 0; + virtual int pack_float(const float* v, size_t* len) = 0; + virtual int pack_expression(grib_expression* e) = 0; + virtual int pack_string(const char* v, size_t* len) = 0; + virtual int pack_string_array(const char** v, size_t* len) = 0; + virtual int pack_long(const long* v, size_t* len) = 0; + virtual int pack_bytes(const unsigned char* v, size_t* len) = 0; + virtual int unpack_bytes(unsigned char* v, size_t* len) = 0; + virtual int unpack_double_subarray(double* v, size_t start, size_t len) = 0; + virtual int unpack_double(double* v, size_t* len) = 0; + virtual int unpack_float(float* v, size_t* len) = 0; + virtual int unpack_double_element(size_t i, double* v) = 0; + virtual int unpack_float_element(size_t i, float* v) = 0; + virtual int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) = 0; + virtual int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) = 0; + virtual int unpack_string(char* v, size_t* len) = 0; + virtual int unpack_string_array(char** v, size_t* len) = 0; + virtual int unpack_long(long* v, size_t* len) = 0; + virtual long get_native_type() = 0; + virtual long get_next_position_offset() = 0; + virtual long string_length() = 0; + virtual long byte_offset() = 0; + virtual long byte_count() = 0; + virtual int value_count(long* count) = 0; + virtual int notify_change(grib_accessor* changed) = 0; + virtual grib_accessor* clone(grib_section* s, int* err) = 0; + virtual void update_size(size_t len) = 0; + virtual int nearest_smaller_value(double val, double* nearest) = 0; + virtual size_t preferred_size(int from_handle) = 0; + virtual grib_accessor* next_accessor() = 0; + virtual void resize(size_t new_size) = 0; + virtual void destroy(grib_context* ct) = 0; + + virtual int compare_accessors(grib_accessor* a2, int compare_flags); + virtual int add_attribute(grib_accessor* attr, int nest_if_clash); + virtual grib_accessor* get_attribute_index(const char* name, int* index); + virtual int has_attributes(); + virtual grib_accessor* get_attribute(const char* name); + + + const char* name; /** < name of the accessor */ + const char* name_space; /** < namespace to which the accessor belongs */ + grib_context* context; + grib_handle* h; + grib_action* creator; /** < action that created the accessor */ + long length; /** < byte length of the accessor */ + long offset; /** < offset of the data in the buffer */ + grib_section* parent; /** < section to which the accessor is attached */ + grib_accessor* next_; /** < next accessor in list */ + grib_accessor* previous_; /** < next accessor in list */ + grib_accessor_class* cclass; /** < behaviour of the accessor */ + unsigned long flags; /** < Various flags */ + grib_section* sub_section; + + const char* all_names[MAX_ACCESSOR_NAMES]= {0,}; /** < name of the accessor */ + const char* all_name_spaces[MAX_ACCESSOR_NAMES] = {0,}; /** < namespace to which the accessor belongs */ + int dirty; + + grib_accessor* same; /** < accessors with the same name */ + long loop; /** < used in lists */ + grib_virtual_value* vvalue; /** < virtual value used when transient flag on **/ + const char* set; + grib_accessor* attributes[MAX_ACCESSOR_ATTRIBUTES] = {0,}; /** < attributes are accessors */ + grib_accessor* parent_as_attribute; +}; + + +class grib_accessor_class +{ +public: + const char* name; + + grib_accessor_class(const char* name) : name(name){} + virtual ~grib_accessor_class(){} + + virtual grib_accessor* create_empty_accessor() = 0; + virtual grib_section* sub_section(grib_accessor* a) = 0; + virtual int get_native_type(grib_accessor*) = 0; + virtual int pack_missing(grib_accessor*) = 0; + virtual int is_missing(grib_accessor*) = 0; + virtual int pack_bytes(grib_accessor*, const unsigned char*, size_t* len) = 0; + virtual int pack_double(grib_accessor*, const double* val, size_t* len) = 0; + virtual int pack_float(grib_accessor*, const float* val, size_t* len) = 0; + virtual int pack_long(grib_accessor*, const long* val, size_t* len) = 0; + virtual int pack_string(grib_accessor*, const char*, size_t* len) = 0; + virtual int pack_string_array(grib_accessor*, const char**, size_t* len) = 0; + virtual int pack_expression(grib_accessor*, grib_expression*) = 0; + virtual int unpack_bytes(grib_accessor*, unsigned char*, size_t* len) = 0; + virtual int unpack_double(grib_accessor*, double* val, size_t* len) = 0; + virtual int unpack_float(grib_accessor*, float* val, size_t* len) = 0; + virtual int unpack_long(grib_accessor*, long* val, size_t* len) = 0; + virtual int unpack_string(grib_accessor*, char*, size_t* len) = 0; + virtual int unpack_string_array(grib_accessor*, char**, size_t* len) = 0; + virtual size_t string_length(grib_accessor*) = 0; + virtual long byte_count(grib_accessor*) = 0; + virtual long byte_offset(grib_accessor*) = 0; + virtual long next_offset(grib_accessor*) = 0; + virtual int value_count(grib_accessor*, long*) = 0; + virtual void destroy(grib_context*, grib_accessor*) = 0; + virtual void dump(grib_accessor*, grib_dumper*) = 0; + virtual void init(grib_accessor*, const long, grib_arguments*) = 0; + virtual void post_init(grib_accessor*) = 0; + virtual int notify_change(grib_accessor*, grib_accessor*) = 0; + virtual void update_size(grib_accessor*, size_t) = 0; + virtual size_t preferred_size(grib_accessor*, int) = 0; + virtual void resize(grib_accessor*,size_t) = 0; + virtual int nearest_smaller_value (grib_accessor*, double, double*) = 0; + virtual grib_accessor* next(grib_accessor*, int) = 0; + virtual int compare(grib_accessor*, grib_accessor*) = 0; + virtual int unpack_double_element(grib_accessor*, size_t i, double* val) = 0; + virtual int unpack_float_element(grib_accessor*, size_t i, float* val) = 0; + virtual int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) = 0; + virtual int unpack_float_element_set(grib_accessor*, const size_t* index_array, size_t len, float* val_array) = 0; + virtual int unpack_double_subarray(grib_accessor*, double* val, size_t start, size_t len) = 0; + virtual int clear(grib_accessor*) = 0; + virtual grib_accessor* make_clone(grib_accessor*, grib_section*, int*) = 0; +}; diff --git a/src/accessor/grib_accessor_class_abstract_long_vector.cc b/src/accessor/grib_accessor_class_abstract_long_vector.cc new file mode 100644 index 000000000..0f4514aa1 --- /dev/null +++ b/src/accessor/grib_accessor_class_abstract_long_vector.cc @@ -0,0 +1,15 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_abstract_long_vector.h" + +grib_accessor_class_abstract_long_vector_t _grib_accessor_class_abstract_long_vector{"abstract_long_vector"}; +grib_accessor_class* grib_accessor_class_abstract_long_vector = &_grib_accessor_class_abstract_long_vector; diff --git a/src/accessor/grib_accessor_class_abstract_long_vector.h b/src/accessor/grib_accessor_class_abstract_long_vector.h new file mode 100644 index 000000000..94ed9d636 --- /dev/null +++ b/src/accessor/grib_accessor_class_abstract_long_vector.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_abstract_long_vector_t : public grib_accessor_gen_t +{ +public: + /* Members defined in abstract_long_vector */ + long* v; + long pack_index; + int number_of_elements; +}; + +class grib_accessor_class_abstract_long_vector_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_abstract_long_vector_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_abstract_long_vector_t{}; } +}; diff --git a/src/grib_accessor.h b/src/accessor/grib_accessor_class_abstract_vector.cc similarity index 62% rename from src/grib_accessor.h rename to src/accessor/grib_accessor_class_abstract_vector.cc index 10fa228f7..2ee141e8f 100644 --- a/src/grib_accessor.h +++ b/src/accessor/grib_accessor_class_abstract_vector.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,8 +9,7 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#pragma once +#include "grib_accessor_class_abstract_vector.h" -#include "grib_api_internal.h" - -template int grib_unpack(grib_accessor* a, T* v, size_t* len); +grib_accessor_class_abstract_vector_t _grib_accessor_class_abstract_vector{"abstract_vector"}; +grib_accessor_class* grib_accessor_class_abstract_vector = &_grib_accessor_class_abstract_vector; diff --git a/src/accessor/grib_accessor_class_abstract_vector.h b/src/accessor/grib_accessor_class_abstract_vector.h new file mode 100644 index 000000000..b721a3adb --- /dev/null +++ b/src/accessor/grib_accessor_class_abstract_vector.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_abstract_vector_t : public grib_accessor_double_t +{ +public: + /* Members defined in abstract_vector */ + double* v; + int number_of_elements; +}; + +class grib_accessor_class_abstract_vector_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_abstract_vector_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_abstract_vector_t{}; } +}; diff --git a/src/accessor/grib_accessor_class_ascii.cc b/src/accessor/grib_accessor_class_ascii.cc new file mode 100644 index 000000000..b3e9f6a8a --- /dev/null +++ b/src/accessor/grib_accessor_class_ascii.cc @@ -0,0 +1,179 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_ascii.h" + +grib_accessor_class_ascii_t _grib_accessor_class_ascii{ "ascii" }; +grib_accessor_class* grib_accessor_class_ascii = &_grib_accessor_class_ascii; + + +void grib_accessor_class_ascii_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_gen_t::init(a, len, arg); + a->length = len; + Assert(a->length >= 0); +} + +int grib_accessor_class_ascii_t::value_count(grib_accessor* a, long* count) +{ + *count = 1; + return 0; +} + +size_t grib_accessor_class_ascii_t::string_length(grib_accessor* a) +{ + return a->length; +} + +void grib_accessor_class_ascii_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + grib_dump_string(dumper, a, NULL); +} + +int grib_accessor_class_ascii_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_STRING; +} + +int grib_accessor_class_ascii_t::unpack_string(grib_accessor* a, char* val, size_t* len) +{ + grib_handle* hand = grib_handle_of_accessor(a); + const size_t alen = a->length; + + if (*len < (alen + 1)) { + const char* cclass_name = a->cclass->name; + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, alen + 1, *len); + *len = alen + 1; + return GRIB_BUFFER_TOO_SMALL; + } + + size_t i = 0; + for (i = 0; i < alen; i++) + val[i] = hand->buffer->data[a->offset + i]; + val[i] = 0; + *len = i; + return GRIB_SUCCESS; +} + +int grib_accessor_class_ascii_t::pack_string(grib_accessor* a, const char* val, size_t* len) +{ + grib_handle* hand = grib_handle_of_accessor(a); + const size_t alen = a->length; + if (len[0] > (alen + 1)) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "pack_string: Wrong size (%zu) for %s, it contains %ld values", + len[0], a->name, a->length + 1); + len[0] = 0; + return GRIB_BUFFER_TOO_SMALL; + } + + for (size_t i = 0; i < alen; i++) { + if (i < len[0]) + hand->buffer->data[a->offset + i] = val[i]; + else + hand->buffer->data[a->offset + i] = 0; + } + + return GRIB_SUCCESS; +} + +int grib_accessor_class_ascii_t::pack_long(grib_accessor* a, const long* v, size_t* len) +{ + grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as long (It's a string)", a->name); + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_ascii_t::pack_double(grib_accessor* a, const double* v, size_t* len) +{ + grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as double (It's a string)", a->name); + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_ascii_t::unpack_long(grib_accessor* a, long* v, size_t* len) +{ + char val[1024] = {0,}; + size_t l = sizeof(val); + size_t i = 0; + char* last = NULL; + int err = a->unpack_string(val, &l); + if (err) + return err; + + i = 0; + while (i < l - 1 && val[i] == ' ') + i++; + + if (val[i] == 0) { + *v = 0; + return 0; + } + if (val[i + 1] == ' ' && i < l - 2) + val[i + 1] = 0; + + *v = strtol(val, &last, 10); + + grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name); + return GRIB_SUCCESS; +} + +int grib_accessor_class_ascii_t::unpack_double(grib_accessor* a, double* v, size_t* len) +{ + char val[1024]; + size_t l = sizeof(val); + char* last = NULL; + + int err = a->unpack_string(val, &l); + if (err) return err; + + *v = strtod(val, &last); + + if (*last == 0) { + grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name); + return GRIB_SUCCESS; + } + + grib_context_log(a->context, GRIB_LOG_WARNING, "Cannot unpack %s as double. Hint: Try unpacking as string", a->name); + + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_ascii_t::compare(grib_accessor* a, grib_accessor* b) +{ + int retval = 0; + char* aval = 0; + char* bval = 0; + int err = 0; + + size_t alen = a->length + 1; + size_t blen = b->length + 1; + + if (alen != blen) + return GRIB_COUNT_MISMATCH; + + aval = (char*)grib_context_malloc(a->context, alen * sizeof(char)); + bval = (char*)grib_context_malloc(b->context, blen * sizeof(char)); + + err = a->unpack_string(aval, &alen); + if (err) return err; + err = b->unpack_string(bval, &blen); + if (err) return err; + + retval = GRIB_SUCCESS; + if (!STR_EQUAL(aval, bval)) + retval = GRIB_STRING_VALUE_MISMATCH; + + grib_context_free(a->context, aval); + grib_context_free(b->context, bval); + + return retval; +} diff --git a/src/accessor/grib_accessor_class_ascii.h b/src/accessor/grib_accessor_class_ascii.h new file mode 100644 index 000000000..8bef5eaac --- /dev/null +++ b/src/accessor/grib_accessor_class_ascii.h @@ -0,0 +1,39 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_ascii_t : public grib_accessor_gen_t +{ +public: + /* Members defined in ascii */ +}; + +class grib_accessor_class_ascii_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_ascii_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_ascii_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_bit.cc b/src/accessor/grib_accessor_class_bit.cc new file mode 100644 index 000000000..c1efac202 --- /dev/null +++ b/src/accessor/grib_accessor_class_bit.cc @@ -0,0 +1,82 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_bit.h" + +grib_accessor_class_bit_t _grib_accessor_class_bit{ "bit" }; +grib_accessor_class* grib_accessor_class_bit = &_grib_accessor_class_bit; + + +void grib_accessor_class_bit_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_long_t::init(a, len, arg); + grib_accessor_bit_t* self = (grib_accessor_bit_t*)a; + a->length = 0; + self->owner = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 0); + self->bit_index = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 1); +} + +int grib_accessor_class_bit_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_bit_t* self = (grib_accessor_bit_t*)a; + int ret = 0; + long data = 0; + + if (*len < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_bit_t: unpack_long: Wrong size for %s, it contains %d values ", a->name, 1); + *len = 1; + return GRIB_ARRAY_TOO_SMALL; + } + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->owner, &data)) != GRIB_SUCCESS) { + *len = 0; + return ret; + } + + if (data & (1 << self->bit_index)) + *val = 1; + else + *val = 0; + + *len = 1; + return GRIB_SUCCESS; +} + +int grib_accessor_class_bit_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + grib_accessor_bit_t* self = (grib_accessor_bit_t*)a; + + if (*len < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_bit_t: pack_long: At least one value to pack for %s", a->name); + *len = 1; + return GRIB_ARRAY_TOO_SMALL; + } + + grib_accessor* owner = grib_find_accessor(grib_handle_of_accessor(a), self->owner); + if (!owner) { + grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_bit_t: Cannot get the owner %s for computing the bit value of %s", + self->owner, a->name); + *len = 0; + return GRIB_NOT_FOUND; + } + + unsigned char* mdata = grib_handle_of_accessor(a)->buffer->data; + mdata += owner->byte_offset(); + /* Note: In the definitions, flagbit numbers go from 7 to 0 (the bit_index), while WMO convention is from 1 to 8 */ + if (a->context->debug) { + /* Print bit positions from 1 (MSB) */ + fprintf(stderr, "ECCODES DEBUG Setting bit %d in %s to %d\n", 8 - self->bit_index, owner->name, (*val > 0)); + } + grib_set_bit(mdata, 7 - self->bit_index, *val > 0); + + *len = 1; + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_bit.h b/src/accessor/grib_accessor_class_bit.h new file mode 100644 index 000000000..188d5e370 --- /dev/null +++ b/src/accessor/grib_accessor_class_bit.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_bit_t : public grib_accessor_long_t +{ +public: + /* Members defined in bit */ + const char* owner; + int bit_index; +}; + +class grib_accessor_class_bit_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_bit_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bit_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_bitmap.cc b/src/accessor/grib_accessor_class_bitmap.cc new file mode 100644 index 000000000..05d9db3bf --- /dev/null +++ b/src/accessor/grib_accessor_class_bitmap.cc @@ -0,0 +1,189 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_bitmap.h" + +grib_accessor_class_bitmap_t _grib_accessor_class_bitmap{ "bitmap" }; +grib_accessor_class* grib_accessor_class_bitmap = &_grib_accessor_class_bitmap; + +static void compute_size(grib_accessor* a) +{ + long slen = 0; + long off = 0; + grib_handle* hand = grib_handle_of_accessor(a); + + grib_accessor_bitmap_t* self = (grib_accessor_bitmap_t*)a; + grib_get_long_internal(hand, self->offsetbsec, &off); + grib_get_long_internal(hand, self->sLength, &slen); + + if (slen == 0) { + grib_accessor* seclen; + size_t size; + /* Assume reparsing */ + Assert(hand->loader != 0); + if (hand->loader != 0) { + seclen = grib_find_accessor(hand, self->sLength); + Assert(seclen); + grib_get_block_length(seclen->parent, &size); + slen = size; + } + } + + // printf("compute_size off=%ld slen=%ld a->offset=%ld\n", (long)off,(long)slen,(long)a->offset); + + a->length = off + (slen - a->offset); + + if (a->length < 0) { + /* Assume reparsing */ + /*Assert(hand->loader != 0);*/ + a->length = 0; + } + + Assert(a->length >= 0); +} + +void grib_accessor_class_bitmap_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_bytes_t::init(a, len, arg); + grib_accessor_bitmap_t* self = (grib_accessor_bitmap_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int n = 0; + + self->tableReference = grib_arguments_get_name(hand, arg, n++); + self->missing_value = grib_arguments_get_name(hand, arg, n++); + self->offsetbsec = grib_arguments_get_name(hand, arg, n++); + self->sLength = grib_arguments_get_name(hand, arg, n++); + + compute_size(a); +} + +long grib_accessor_class_bitmap_t::next_offset(grib_accessor* a) +{ + return a->byte_offset() + a->byte_count(); +} + +void grib_accessor_class_bitmap_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + long len = 0; + char label[1024]; + + a->value_count(&len); + snprintf(label, sizeof(label), "Bitmap of %ld values", len); + grib_dump_bytes(dumper, a, label); +} + +int grib_accessor_class_bitmap_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + long pos = a->offset * 8; + long tlen = 0; + const grib_handle* hand = grib_handle_of_accessor(a); + + int err = a->value_count(&tlen); + if (err) + return err; + + if (*len < tlen) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %ld values", a->name, tlen); + *len = tlen; + return GRIB_ARRAY_TOO_SMALL; + } + + for (long i = 0; i < tlen; i++) { + val[i] = (long)grib_decode_unsigned_long(hand->buffer->data, &pos, 1); + } + *len = tlen; + return GRIB_SUCCESS; +} + +template +static int unpack(grib_accessor* a, T* val, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating points numbers"); + long pos = a->offset * 8; + long tlen; + grib_handle* hand = grib_handle_of_accessor(a); + + int err = a->value_count(&tlen); + if (err) + return err; + + if (*len < tlen) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %ld values", a->name, tlen); + *len = tlen; + return GRIB_ARRAY_TOO_SMALL; + } + + for (long i = 0; i < tlen; i++) { + val[i] = (T)grib_decode_unsigned_long(hand->buffer->data, &pos, 1); + } + *len = tlen; + return GRIB_SUCCESS; +} + +int grib_accessor_class_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + return unpack(a, val, len); +} + +int grib_accessor_class_bitmap_t::unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); +} + +int grib_accessor_class_bitmap_t::unpack_double_element(grib_accessor* a, size_t idx, double* val) +{ + long pos = a->offset * 8; + + pos += idx; + *val = (double)grib_decode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, &pos, 1); + + return GRIB_SUCCESS; +} +int grib_accessor_class_bitmap_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +{ + for (size_t i = 0; i < len; ++i) { + unpack_double_element(a, index_array[i], val_array + i); + } + return GRIB_SUCCESS; +} + +void grib_accessor_class_bitmap_t::update_size(grib_accessor* a, size_t s) +{ + a->length = s; +} + +size_t grib_accessor_class_bitmap_t::string_length(grib_accessor* a) +{ + return a->length; +} + +int grib_accessor_class_bitmap_t::unpack_string(grib_accessor* a, char* val, size_t* len) +{ + grib_handle* hand = grib_handle_of_accessor(a); + const size_t l = a->length; + + if (*len < l) { + const char* cclass_name = a->cclass->name; + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, l, *len); + *len = l; + return GRIB_BUFFER_TOO_SMALL; + } + + for (long i = 0; i < a->length; i++) { + val[i] = hand->buffer->data[a->offset + i]; + } + + *len = a->length; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_bitmap.h b/src/accessor/grib_accessor_class_bitmap.h new file mode 100644 index 000000000..4f07f3a6c --- /dev/null +++ b/src/accessor/grib_accessor_class_bitmap.h @@ -0,0 +1,42 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_bytes.h" + +class grib_accessor_bitmap_t : public grib_accessor_bytes_t +{ +public: + /* Members defined in bitmap */ + const char* tableReference; + const char* missing_value; + const char* offsetbsec; + const char* sLength; +}; + +class grib_accessor_class_bitmap_t : public grib_accessor_class_bytes_t +{ +public: + grib_accessor_class_bitmap_t(const char* name) : grib_accessor_class_bytes_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bitmap_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + long next_offset(grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; +}; diff --git a/src/grib_accessor_class_bits.cc b/src/accessor/grib_accessor_class_bits.cc similarity index 50% rename from src/grib_accessor_class_bits.cc rename to src/accessor/grib_accessor_class_bits.cc index 5e86e2fef..e0a9e7d8d 100644 --- a/src/grib_accessor_class_bits.cc +++ b/src/accessor/grib_accessor_class_bits.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,127 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" - - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = get_native_type - IMPLEMENTS = unpack_long; pack_long - IMPLEMENTS = unpack_bytes; byte_count - IMPLEMENTS = unpack_double; pack_double - IMPLEMENTS = unpack_string - IMPLEMENTS = init - MEMBERS=const char* argument - MEMBERS=long start - MEMBERS=long len - MEMBERS=double referenceValue - MEMBERS=double referenceValuePresent - MEMBERS=double scale - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_bytes(grib_accessor*, unsigned char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static long byte_count(grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bits -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bits */ - const char* argument; - long start; - long len; - double referenceValue; - double referenceValuePresent; - double scale; -} grib_accessor_bits; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_bits = { - &grib_accessor_class_gen, /* super */ - "bits", /* name */ - sizeof(grib_accessor_bits), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - &byte_count, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - &unpack_bytes, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_bits.h" +grib_accessor_class_bits_t _grib_accessor_class_bits{"bits"}; grib_accessor_class* grib_accessor_class_bits = &_grib_accessor_class_bits; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_bits* self = (grib_accessor_bits*)a; +void grib_accessor_class_bits_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_gen_t::init(a, l, c); + grib_accessor_bits_t* self = (grib_accessor_bits_t*)a; grib_handle* hand = grib_handle_of_accessor(a); grib_expression* e = NULL; int n = 0; @@ -154,9 +43,8 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) a->length = 0; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_bits* self = (grib_accessor_bits*)a; +int grib_accessor_class_bits_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_bits_t* self = (grib_accessor_bits_t*)a; grib_accessor* x = NULL; unsigned char* p = NULL; grib_handle* h = grib_handle_of_accessor(a); @@ -173,17 +61,15 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) if (!x) return GRIB_NOT_FOUND; - p = h->buffer->data + grib_byte_offset(x); - *val = grib_decode_unsigned_long(p, &start, length); + p = h->buffer->data + x->byte_offset(); *val = grib_decode_unsigned_long(p, &start, length); *len = 1; return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_bits* self = (grib_accessor_bits*)a; +int grib_accessor_class_bits_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_bits_t* self = (grib_accessor_bits_t*)a; grib_accessor* x = NULL; unsigned char* p = NULL; grib_handle* h = grib_handle_of_accessor(a); @@ -200,8 +86,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) if (!x) return GRIB_NOT_FOUND; - p = h->buffer->data + grib_byte_offset(x); - *val = grib_decode_unsigned_long(p, &start, length); + p = h->buffer->data + x->byte_offset(); *val = grib_decode_unsigned_long(p, &start, length); *val = ((long)*val + self->referenceValue) / self->scale; @@ -210,9 +95,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_bits* self = (grib_accessor_bits*)a; +int grib_accessor_class_bits_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_bits_t* self = (grib_accessor_bits_t*)a; grib_accessor* x = NULL; grib_handle* h = grib_handle_of_accessor(a); unsigned char* p = NULL; @@ -228,15 +112,13 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if (!x) return GRIB_NOT_FOUND; - p = h->buffer->data + grib_byte_offset(x); - + p = h->buffer->data + x->byte_offset(); lval = round(*val * self->scale) - self->referenceValue; return grib_encode_unsigned_longb(p, lval, &start, length); } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_bits* self = (grib_accessor_bits*)a; +int grib_accessor_class_bits_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_bits_t* self = (grib_accessor_bits_t*)a; grib_accessor* x = NULL; grib_handle* h = grib_handle_of_accessor(a); unsigned char* p = NULL; @@ -285,14 +167,12 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_ENCODING_ERROR; } - p = h->buffer->data + grib_byte_offset(x); - return grib_encode_unsigned_longb(p, *val, &start, length); + p = h->buffer->data + x->byte_offset(); return grib_encode_unsigned_longb(p, *val, &start, length); } -static int get_native_type(grib_accessor* a) -{ +int grib_accessor_class_bits_t::get_native_type(grib_accessor* a){ int type = GRIB_TYPE_BYTES; - grib_accessor_bits* self = (grib_accessor_bits*)a; + grib_accessor_bits_t* self = (grib_accessor_bits_t*)a; if (a->flags & GRIB_ACCESSOR_FLAG_STRING_TYPE) type = GRIB_TYPE_STRING; @@ -306,13 +186,11 @@ static int get_native_type(grib_accessor* a) return type; } -static int unpack_string(grib_accessor* a, char* v, size_t* len) -{ +int grib_accessor_class_bits_t::unpack_string(grib_accessor* a, char* v, size_t* len){ int ret = 0; double dval = 0; long lval = 0; size_t llen = 1; - grib_accessor_class* super = NULL; switch (get_native_type(a)) { case GRIB_TYPE_LONG: @@ -328,20 +206,17 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len) break; default: - super = *(a->cclass->super); - ret = super->unpack_string(a, v, len); + ret = grib_accessor_class_gen_t::unpack_string(a, v, len); } return ret; } -static long byte_count(grib_accessor* a) -{ +long grib_accessor_class_bits_t::byte_count(grib_accessor* a){ grib_context_log(a->context, GRIB_LOG_DEBUG, "byte_count of %s = %ld", a->name, a->length); return a->length; } -static int unpack_bytes(grib_accessor* a, unsigned char* buffer, size_t* len) -{ +int grib_accessor_class_bits_t::unpack_bytes(grib_accessor* a, unsigned char* buffer, size_t* len){ if (*len < a->length) { *len = a->length; return GRIB_ARRAY_TOO_SMALL; diff --git a/src/accessor/grib_accessor_class_bits.h b/src/accessor/grib_accessor_class_bits.h new file mode 100644 index 000000000..19ec26b35 --- /dev/null +++ b/src/accessor/grib_accessor_class_bits.h @@ -0,0 +1,42 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_bits_t : public grib_accessor_gen_t +{ +public: + /* Members defined in bits */ + const char* argument; + long start; + long len; + double referenceValue; + double referenceValuePresent; + double scale; +}; + +class grib_accessor_class_bits_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_bits_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bits_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_bytes(grib_accessor*, unsigned char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + long byte_count(grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_bits_per_value.cc b/src/accessor/grib_accessor_class_bits_per_value.cc new file mode 100644 index 000000000..dbdef54cb --- /dev/null +++ b/src/accessor/grib_accessor_class_bits_per_value.cc @@ -0,0 +1,78 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_bits_per_value.h" + +grib_accessor_class_bits_per_value_t _grib_accessor_class_bits_per_value{ "bits_per_value" }; +grib_accessor_class* grib_accessor_class_bits_per_value = &_grib_accessor_class_bits_per_value; + + +void grib_accessor_class_bits_per_value_t::init(grib_accessor* a, const long l, grib_arguments* args) +{ + grib_accessor_class_long_t::init(a, l, args); + int n = 0; + grib_accessor_bits_per_value_t* self = (grib_accessor_bits_per_value_t*)a; + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->bits_per_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_bits_per_value_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_bits_per_value_t* self = (grib_accessor_bits_per_value_t*)a; + + int ret = 0; + grib_handle* h = grib_handle_of_accessor(a); + + if ((ret = grib_get_long_internal(h, self->bits_per_value, val)) != GRIB_SUCCESS) + return ret; + + *len = 1; + return ret; +} + +int grib_accessor_class_bits_per_value_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + grib_accessor_bits_per_value_t* self = (grib_accessor_bits_per_value_t*)a; + + double* values = NULL; + size_t size = 0; + int ret = 0; + grib_context* c = a->context; + grib_handle* h = grib_handle_of_accessor(a); + + if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) + return ret; + + values = (double*)grib_context_malloc(c, size * sizeof(double)); + if (!values) + return GRIB_OUT_OF_MEMORY; + + if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + if ((ret = grib_set_long_internal(h, self->bits_per_value, *val)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + grib_context_free(c, values); + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_bits_per_value.h b/src/accessor/grib_accessor_class_bits_per_value.h new file mode 100644 index 000000000..741ecd0e5 --- /dev/null +++ b/src/accessor/grib_accessor_class_bits_per_value.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_bits_per_value_t : public grib_accessor_long_t +{ +public: + /* Members defined in bits_per_value */ + const char* values; + const char* bits_per_value; +}; + +class grib_accessor_class_bits_per_value_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_bits_per_value_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bits_per_value_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_blob.cc b/src/accessor/grib_accessor_class_blob.cc new file mode 100644 index 000000000..4629de93a --- /dev/null +++ b/src/accessor/grib_accessor_class_blob.cc @@ -0,0 +1,47 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_blob.h" + +grib_accessor_class_blob_t _grib_accessor_class_blob{ "blob" }; +grib_accessor_class* grib_accessor_class_blob = &_grib_accessor_class_blob; + + +void grib_accessor_class_blob_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_gen_t::init(a, len, arg); + grib_get_long_internal(grib_handle_of_accessor(a), + grib_arguments_get_name(a->parent->h, arg, 0), &a->length); + Assert(a->length >= 0); +} + +int grib_accessor_class_blob_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_BYTES; +} + +int grib_accessor_class_blob_t::unpack_bytes(grib_accessor* a, unsigned char* buffer, size_t* len) +{ + if (*len < (size_t)a->length) { + *len = a->length; + return GRIB_ARRAY_TOO_SMALL; + } + *len = a->length; + + memcpy(buffer, grib_handle_of_accessor(a)->buffer->data + a->offset, *len); + + return GRIB_SUCCESS; +} + +void grib_accessor_class_blob_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + grib_dump_bytes(dumper, a, NULL); +} diff --git a/src/accessor/grib_accessor_class_blob.h b/src/accessor/grib_accessor_class_blob.h new file mode 100644 index 000000000..10dad4b7b --- /dev/null +++ b/src/accessor/grib_accessor_class_blob.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_blob_t : public grib_accessor_gen_t +{ +public: + /* Members defined in blob */ +}; + +class grib_accessor_class_blob_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_blob_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_blob_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_bytes(grib_accessor*, unsigned char*, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_budgdate.cc b/src/accessor/grib_accessor_class_budgdate.cc new file mode 100644 index 000000000..4c58c20f2 --- /dev/null +++ b/src/accessor/grib_accessor_class_budgdate.cc @@ -0,0 +1,82 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_budgdate.h" + +grib_accessor_class_budgdate_t _grib_accessor_class_budgdate{"budgdate"}; +grib_accessor_class* grib_accessor_class_budgdate = &_grib_accessor_class_budgdate; + + +void grib_accessor_class_budgdate_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_budgdate_t* self = (grib_accessor_budgdate_t*)a; + int n = 0; + + self->year = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->month = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->day = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); +} + +int grib_accessor_class_budgdate_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + int ret = 0; + grib_accessor_budgdate_t* self = (grib_accessor_budgdate_t*)a; + + long year = 0; + long month = 0; + long day = 0; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->day, &day)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->month, &month)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->year, &year)) != GRIB_SUCCESS) + return ret; + + if (*len < 1) + return GRIB_WRONG_ARRAY_SIZE; + + val[0] = (1900 + year) * 10000 + month * 100 + day; + + return ret; +} + +/* TODO: Check for a valid date */ +int grib_accessor_class_budgdate_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + int ret = 0; + long v = val[0]; + grib_accessor_budgdate_t* self = (grib_accessor_budgdate_t*)a; + + long year = 0; + long month = 0; + long day = 0; + + if (*len != 1) + return GRIB_WRONG_ARRAY_SIZE; + + year = v / 10000; + v %= 10000; + month = v / 100; + v %= 100; + day = v; + + year -= 1900; + + Assert(year < 255); + + if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->day, day)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->month, month)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->year, year)) != GRIB_SUCCESS) + return ret; + + return ret; +} diff --git a/src/accessor/grib_accessor_class_budgdate.h b/src/accessor/grib_accessor_class_budgdate.h new file mode 100644 index 000000000..ee18250e2 --- /dev/null +++ b/src/accessor/grib_accessor_class_budgdate.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_budgdate_t : public grib_accessor_long_t +{ +public: + /* Members defined in budgdate */ + const char* year; + const char* month; + const char* day; +}; + +class grib_accessor_class_budgdate_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_budgdate_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_budgdate_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_bufr_data_array.cc b/src/accessor/grib_accessor_class_bufr_data_array.cc similarity index 89% rename from src/grib_accessor_class_bufr_data_array.cc rename to src/accessor/grib_accessor_class_bufr_data_array.cc index 3d044835a..e0c998950 100644 --- a/src/grib_accessor_class_bufr_data_array.cc +++ b/src/accessor/grib_accessor_class_bufr_data_array.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -9,203 +10,11 @@ */ #include "grib_scaling.h" -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init - IMPLEMENTS = dump;destroy - IMPLEMENTS = next_offset - IMPLEMENTS = byte_count; value_count - IMPLEMENTS = byte_offset; unpack_double - IMPLEMENTS = get_native_type - IMPLEMENTS = pack_long; unpack_double; pack_double - MEMBERS = const char* bufrDataEncodedName - MEMBERS = const char* numberOfSubsetsName - MEMBERS = const char* expandedDescriptorsName - MEMBERS = const char* flagsName - MEMBERS = const char* unitsName - MEMBERS = const char* elementsDescriptorsIndexName - MEMBERS = const char* compressedDataName - MEMBERS = bufr_descriptors_array* expanded - MEMBERS = grib_accessor* expandedAccessor - MEMBERS = int* canBeMissing - MEMBERS = long numberOfSubsets - MEMBERS = long compressedData - MEMBERS = grib_vdarray* numericValues - MEMBERS = grib_vsarray* stringValues - MEMBERS = grib_viarray* elementsDescriptorsIndex - MEMBERS = int do_decode - MEMBERS = int bitmapStartElementsDescriptorsIndex - MEMBERS = int bitmapCurrentElementsDescriptorsIndex - MEMBERS = int bitmapSize - MEMBERS = int bitmapStart - MEMBERS = int bitmapCurrent - MEMBERS = grib_accessors_list* dataAccessors - MEMBERS = int unpackMode - MEMBERS = int bitsToEndData - MEMBERS = grib_section* dataKeys - MEMBERS = double* inputBitmap - MEMBERS = int nInputBitmap - MEMBERS = int iInputBitmap - MEMBERS = long* inputReplications - MEMBERS = int nInputReplications - MEMBERS = int iInputReplications - MEMBERS = long* inputExtendedReplications - MEMBERS = int nInputExtendedReplications - MEMBERS = int iInputExtendedReplications - MEMBERS = long* inputShortReplications - MEMBERS = int nInputShortReplications - MEMBERS = int iInputShortReplications - MEMBERS = grib_iarray* iss_list - MEMBERS = grib_trie_with_rank* dataAccessorsTrie - MEMBERS = grib_sarray* tempStrings - MEMBERS = grib_vdarray* tempDoubleValues - MEMBERS = int change_ref_value_operand - MEMBERS = size_t refValListSize - MEMBERS = long* refValList - MEMBERS = long refValIndex - MEMBERS = bufr_tableb_override* tableb_override - MEMBERS = int set_to_missing_if_out_of_range - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bufr_data_array -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bufr_data_array */ - const char* bufrDataEncodedName; - const char* numberOfSubsetsName; - const char* expandedDescriptorsName; - const char* flagsName; - const char* unitsName; - const char* elementsDescriptorsIndexName; - const char* compressedDataName; - bufr_descriptors_array* expanded; - grib_accessor* expandedAccessor; - int* canBeMissing; - long numberOfSubsets; - long compressedData; - grib_vdarray* numericValues; - grib_vsarray* stringValues; - grib_viarray* elementsDescriptorsIndex; - int do_decode; - int bitmapStartElementsDescriptorsIndex; - int bitmapCurrentElementsDescriptorsIndex; - int bitmapSize; - int bitmapStart; - int bitmapCurrent; - grib_accessors_list* dataAccessors; - int unpackMode; - int bitsToEndData; - grib_section* dataKeys; - double* inputBitmap; - int nInputBitmap; - int iInputBitmap; - long* inputReplications; - int nInputReplications; - int iInputReplications; - long* inputExtendedReplications; - int nInputExtendedReplications; - int iInputExtendedReplications; - long* inputShortReplications; - int nInputShortReplications; - int iInputShortReplications; - grib_iarray* iss_list; - grib_trie_with_rank* dataAccessorsTrie; - grib_sarray* tempStrings; - grib_vdarray* tempDoubleValues; - int change_ref_value_operand; - size_t refValListSize; - long* refValList; - long refValIndex; - bufr_tableb_override* tableb_override; - int set_to_missing_if_out_of_range; -} grib_accessor_bufr_data_array; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_bufr_data_array = { - &grib_accessor_class_gen, /* super */ - "bufr_data_array", /* name */ - sizeof(grib_accessor_bufr_data_array), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_bufr_data_array.h" +grib_accessor_class_bufr_data_array_t _grib_accessor_class_bufr_data_array{"bufr_data_array"}; grib_accessor_class* grib_accessor_class_bufr_data_array = &_grib_accessor_class_bufr_data_array; -/* END_CLASS_IMP */ #define MAX_NESTED_REPLICATIONS 8 @@ -226,33 +35,31 @@ grib_accessor_class* grib_accessor_class_bufr_data_array = &_grib_accessor_class } static int process_elements(grib_accessor* a, int flag, long onlySubset, long startSubset, long endSubset); +typedef int (*codec_element_proc)(grib_context* c, grib_accessor_bufr_data_array_t* self, int subsetIndex, grib_buffer* b, unsigned char* data, long* pos, int i, bufr_descriptor* descriptor, long elementIndex, grib_darray* dval, grib_sarray* sval); +typedef int (*codec_replication_proc)(grib_context* c, grib_accessor_bufr_data_array_t* self, int subsetIndex, grib_buffer* buff, unsigned char* data, long* pos, int i, long elementIndex, grib_darray* dval, long* numberOfRepetitions); +static int create_keys(const grib_accessor* a, long onlySubset, long startSubset, long endSubset); -typedef int (*codec_element_proc)(grib_context* c, grib_accessor_bufr_data_array* self, int subsetIndex, grib_buffer* b, unsigned char* data, long* pos, int i, bufr_descriptor* descriptor, long elementIndex, grib_darray* dval, grib_sarray* sval); -typedef int (*codec_replication_proc)(grib_context* c, grib_accessor_bufr_data_array* self, int subsetIndex, grib_buffer* buff, unsigned char* data, long* pos, int i, long elementIndex, grib_darray* dval, long* numberOfRepetitions); - -static int create_keys(const grib_accessor* a, long onlySubset, long startSubset, long endSubset); - -static void restart_bitmap(grib_accessor_bufr_data_array* self) +static void restart_bitmap(grib_accessor_bufr_data_array_t* self) { self->bitmapCurrent = -1; self->bitmapCurrentElementsDescriptorsIndex = self->bitmapStartElementsDescriptorsIndex - 1; } -static void cancel_bitmap(grib_accessor_bufr_data_array* self) +static void cancel_bitmap(grib_accessor_bufr_data_array_t* self) { self->bitmapCurrent = -1; self->bitmapStart = -1; } -static int is_bitmap_start_defined(grib_accessor_bufr_data_array* self) +static int is_bitmap_start_defined(grib_accessor_bufr_data_array_t* self) { return self->bitmapStart == -1 ? 0 : 1; } -static size_t get_length(grib_accessor* a) +size_t get_length(grib_accessor* a) { - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; - size_t len = 0; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; + size_t len = 0; const grib_handle* h = grib_handle_of_accessor(a); @@ -262,7 +69,7 @@ static size_t get_length(grib_accessor* a) } /* Operator 203YYY: Store the TableB code and changed reference value in linked list */ -static void tableB_override_store_ref_val(grib_context* c, grib_accessor_bufr_data_array* self, int code, long new_ref_val) +static void tableB_override_store_ref_val(grib_context* c, grib_accessor_bufr_data_array_t* self, int code, long new_ref_val) { bufr_tableb_override* tb = (bufr_tableb_override*)grib_context_malloc_clear(c, sizeof(bufr_tableb_override)); tb->code = code; @@ -280,7 +87,7 @@ static void tableB_override_store_ref_val(grib_context* c, grib_accessor_bufr_da } /* Operator 203YYY: Retrieve changed reference value from linked list */ -static int tableB_override_get_ref_val(grib_accessor_bufr_data_array* self, int code, long* out_ref_val) +static int tableB_override_get_ref_val(grib_accessor_bufr_data_array_t* self, int code, long* out_ref_val) { bufr_tableb_override* p = self->tableb_override; while (p) { @@ -294,7 +101,7 @@ static int tableB_override_get_ref_val(grib_accessor_bufr_data_array* self, int } /* Operator 203YYY: Clear and free linked list */ -static void tableB_override_clear(grib_context* c, grib_accessor_bufr_data_array* self) +void tableB_override_clear(grib_context* c, grib_accessor_bufr_data_array_t* self) { bufr_tableb_override* tb = self->tableb_override; while (tb) { @@ -306,7 +113,7 @@ static void tableB_override_clear(grib_context* c, grib_accessor_bufr_data_array } /* Operator 203YYY: Copy contents of linked list to the transient array key */ -static int tableB_override_set_key(grib_handle* h, grib_accessor_bufr_data_array* self) +int tableB_override_set_key(grib_handle* h, grib_accessor_bufr_data_array_t* self) { int err = GRIB_SUCCESS; size_t size = 0; @@ -343,7 +150,7 @@ static int check_overridden_reference_values(const grib_context* c, long* refVal return GRIB_SUCCESS; } -// static void tableB_override_dump(grib_accessor_bufr_data_array *self) +// void tableB_override_dump(grib_accessor_bufr_data_array_t *self) // { // bufr_tableb_override* p = self->tableb_override; // int i = 1; @@ -357,9 +164,9 @@ static int check_overridden_reference_values(const grib_context* c, long* refVal #define DYN_ARRAY_SIZE_INIT 1000 /* Initial size for grib_iarray_new and grib_darray_new */ #define DYN_ARRAY_SIZE_INCR 1000 /* Increment size for grib_iarray_new and grib_darray_new */ -static void init(grib_accessor* a, const long v, grib_arguments* params) -{ - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; +void grib_accessor_class_bufr_data_array_t::init(grib_accessor* a, const long v, grib_arguments* params){ + grib_accessor_class_gen_t::init(a, v, params); + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; int n = 0; const char* dataKeysName = NULL; grib_accessor* dataKeysAcc = NULL; @@ -397,7 +204,7 @@ static void init(grib_accessor* a, const long v, grib_arguments* params) /* Assert(a->length>=0); */ } -// static void clean_string(char* s,int len) +// void clean_string(char* s,int len) // { // int i=len-1; // while (i) { @@ -407,7 +214,7 @@ static void init(grib_accessor* a, const long v, grib_arguments* params) // } // } -static int check_end_data(grib_context* c, bufr_descriptor* bd, grib_accessor_bufr_data_array* self, int size) +static int check_end_data(grib_context* c, bufr_descriptor* bd, grib_accessor_bufr_data_array_t* self, int size) { const int saved_bitsToEndData = self->bitsToEndData; if (c->debug == 1) @@ -422,8 +229,7 @@ static int check_end_data(grib_context* c, bufr_descriptor* bd, grib_accessor_bu return 0; } -static void self_clear(grib_context* c, grib_accessor_bufr_data_array* self) -{ +void self_clear(grib_context* c, grib_accessor_bufr_data_array_t* self){ grib_context_free(c, self->canBeMissing); grib_vdarray_delete_content(c, self->numericValues); grib_vdarray_delete(c, self->numericValues); @@ -452,69 +258,63 @@ static void self_clear(grib_context* c, grib_accessor_bufr_data_array* self) if (self->inputBitmap) grib_context_free(c, self->inputBitmap); } -static int get_native_type(grib_accessor* a) -{ +int grib_accessor_class_bufr_data_array_t::get_native_type(grib_accessor* a){ return GRIB_TYPE_DOUBLE; } -static long byte_count(grib_accessor* a) -{ +long grib_accessor_class_bufr_data_array_t::byte_count(grib_accessor* a){ return 0; } -static long byte_offset(grib_accessor* a) -{ +long grib_accessor_class_bufr_data_array_t::byte_offset(grib_accessor* a){ return a->offset; } -static long next_offset(grib_accessor* a) -{ +long grib_accessor_class_bufr_data_array_t::next_offset(grib_accessor* a){ return a->offset; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; +int grib_accessor_class_bufr_data_array_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; self->do_decode = 1; return GRIB_NOT_IMPLEMENTED; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; +int grib_accessor_class_bufr_data_array_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; self->do_decode = 1; return process_elements(a, PROCESS_ENCODE, 0, 0, 0); } grib_vsarray* accessor_bufr_data_array_get_stringValues(grib_accessor* a) { - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; process_elements(a, PROCESS_DECODE, 0, 0, 0); return self->stringValues; } grib_accessors_list* accessor_bufr_data_array_get_dataAccessors(grib_accessor* a) { - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; return self->dataAccessors; } grib_trie_with_rank* accessor_bufr_data_array_get_dataAccessorsTrie(grib_accessor* a) { - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; return self->dataAccessorsTrie; } void accessor_bufr_data_array_set_unpackMode(grib_accessor* a, int unpackMode) { - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; self->unpackMode = unpackMode; } static int get_descriptors(grib_accessor* a) { - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; int ret = 0, i, numberOfDescriptors; grib_handle* h = grib_handle_of_accessor(a); grib_context* c = a->context; @@ -540,7 +340,7 @@ static int get_descriptors(grib_accessor* a) } static int decode_string_array(grib_context* c, unsigned char* data, long* pos, bufr_descriptor* bd, - grib_accessor_bufr_data_array* self) + grib_accessor_bufr_data_array_t* self) { int ret = 0; int* err = &ret; @@ -597,9 +397,9 @@ static int decode_string_array(grib_context* c, unsigned char* data, long* pos, return ret; } -static grib_darray* decode_double_array(grib_context* c, unsigned char* data, long* pos, +grib_darray* decode_double_array(grib_context* c, unsigned char* data, long* pos, bufr_descriptor* bd, int canBeMissing, - grib_accessor_bufr_data_array* self, int* err) + grib_accessor_bufr_data_array_t* self, int* err) { grib_darray* ret = NULL; int j; @@ -681,7 +481,7 @@ static grib_darray* decode_double_array(grib_context* c, unsigned char* data, lo } static int encode_string_array(grib_context* c, grib_buffer* buff, long* pos, bufr_descriptor* bd, - grib_accessor_bufr_data_array* self, grib_sarray* stringValues) + grib_accessor_bufr_data_array_t* self, grib_sarray* stringValues) { int err = 0, n, ival; int k, j, modifiedWidth, width; @@ -737,8 +537,7 @@ static int encode_string_array(grib_context* c, grib_buffer* buff, long* pos, bu return err; } -static void set_missing_long_to_double(grib_darray* dvalues) -{ +void set_missing_long_to_double(grib_darray* dvalues){ size_t i, n = grib_darray_used_size(dvalues); for (i = 0; i < n; i++) { if (dvalues->v[i] == GRIB_MISSING_LONG) @@ -764,7 +563,7 @@ static int descriptor_get_min_max(bufr_descriptor* bd, long width, long referenc } static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bufr_descriptor* bd, - grib_accessor_bufr_data_array* self, grib_darray* dvalues) + grib_accessor_bufr_data_array_t* self, grib_darray* dvalues) { int err = 0; int j, i; @@ -982,7 +781,7 @@ static int encode_double_array(grib_context* c, grib_buffer* buff, long* pos, bu } static int encode_double_value(grib_context* c, grib_buffer* buff, long* pos, bufr_descriptor* bd, - grib_accessor_bufr_data_array* self, double value) + grib_accessor_bufr_data_array_t* self, double value) { size_t lval; double maxAllowed, minAllowed; @@ -1029,7 +828,7 @@ static int encode_double_value(grib_context* c, grib_buffer* buff, long* pos, bu } static int encode_string_value(grib_context* c, grib_buffer* buff, long* pos, bufr_descriptor* bd, - grib_accessor_bufr_data_array* self, char* sval) + grib_accessor_bufr_data_array_t* self, char* sval) { int err = 0; int len; @@ -1045,7 +844,7 @@ static int encode_string_value(grib_context* c, grib_buffer* buff, long* pos, bu } static char* decode_string_value(grib_context* c, unsigned char* data, long* pos, bufr_descriptor* bd, - grib_accessor_bufr_data_array* self, int* err) + grib_accessor_bufr_data_array_t* self, int* err) { char* sval = 0; int len; @@ -1069,7 +868,7 @@ static char* decode_string_value(grib_context* c, unsigned char* data, long* pos static double decode_double_value(grib_context* c, unsigned char* data, long* pos, bufr_descriptor* bd, int canBeMissing, - grib_accessor_bufr_data_array* self, int* err) + grib_accessor_bufr_data_array_t* self, int* err) { size_t lval; int modifiedWidth, modifiedReference; @@ -1098,7 +897,7 @@ static double decode_double_value(grib_context* c, unsigned char* data, long* po return dval; } -static int decode_element(grib_context* c, grib_accessor_bufr_data_array* self, int subsetIndex, +static int decode_element(grib_context* c, grib_accessor_bufr_data_array_t* self, int subsetIndex, grib_buffer* b, unsigned char* data, long* pos, int i, bufr_descriptor* descriptor, long elementIndex, grib_darray* dval, grib_sarray* sval) { @@ -1180,7 +979,7 @@ static int decode_element(grib_context* c, grib_accessor_bufr_data_array* self, return err; } -static int decode_replication(grib_context* c, grib_accessor_bufr_data_array* self, int subsetIndex, +static int decode_replication(grib_context* c, grib_accessor_bufr_data_array_t* self, int subsetIndex, grib_buffer* buff, unsigned char* data, long* pos, int i, long elementIndex, grib_darray* dval, long* numberOfRepetitions) { int ret = 0; @@ -1245,7 +1044,7 @@ static int decode_replication(grib_context* c, grib_accessor_bufr_data_array* se return ret; } -static int encode_new_bitmap(grib_context* c, grib_buffer* buff, long* pos, int idx, grib_accessor_bufr_data_array* self) +static int encode_new_bitmap(grib_context* c, grib_buffer* buff, long* pos, int idx, grib_accessor_bufr_data_array_t* self) { grib_darray* doubleValues = NULL; int err = 0; @@ -1268,7 +1067,7 @@ static int encode_new_bitmap(grib_context* c, grib_buffer* buff, long* pos, int } /* Operator 203YYY: Change Reference Values: Encoding definition phase */ -static int encode_overridden_reference_value(grib_context* c, grib_accessor_bufr_data_array* self, +static int encode_overridden_reference_value(grib_context* c, grib_accessor_bufr_data_array_t* self, grib_buffer* buff, long* pos, bufr_descriptor* bd) { int err = 0; @@ -1307,7 +1106,7 @@ static int encode_overridden_reference_value(grib_context* c, grib_accessor_bufr return err; } -static int encode_new_element(grib_context* c, grib_accessor_bufr_data_array* self, int subsetIndex, +static int encode_new_element(grib_context* c, grib_accessor_bufr_data_array_t* self, int subsetIndex, grib_buffer* buff, unsigned char* data, long* pos, int i, bufr_descriptor* descriptor, long elementIndex, grib_darray* dval, grib_sarray* sval) { @@ -1367,7 +1166,7 @@ static int encode_new_element(grib_context* c, grib_accessor_bufr_data_array* se return err; } -static int encode_new_replication(grib_context* c, grib_accessor_bufr_data_array* self, int subsetIndex, +static int encode_new_replication(grib_context* c, grib_accessor_bufr_data_array_t* self, int subsetIndex, grib_buffer* buff, unsigned char* data, long* pos, int i, long elementIndex, grib_darray* dval, long* numberOfRepetitions) { int err = 0; @@ -1430,7 +1229,7 @@ static int encode_new_replication(grib_context* c, grib_accessor_bufr_data_array return err; } -static int encode_element(grib_context* c, grib_accessor_bufr_data_array* self, int subsetIndex, +static int encode_element(grib_context* c, grib_accessor_bufr_data_array_t* self, int subsetIndex, grib_buffer* buff, unsigned char* data, long* pos, int i, bufr_descriptor* descriptor, long elementIndex, grib_darray* dval, grib_sarray* sval) { @@ -1501,7 +1300,7 @@ static int encode_element(grib_context* c, grib_accessor_bufr_data_array* self, return err; } -static int encode_replication(grib_context* c, grib_accessor_bufr_data_array* self, int subsetIndex, +static int encode_replication(grib_context* c, grib_accessor_bufr_data_array_t* self, int subsetIndex, grib_buffer* buff, unsigned char* data, long* pos, int i, long elementIndex, grib_darray* dval, long* numberOfRepetitions) { @@ -1517,7 +1316,7 @@ static int encode_replication(grib_context* c, grib_accessor_bufr_data_array* se return encode_element(c, self, subsetIndex, buff, data, pos, i, 0, elementIndex, dval, 0); } -static int build_bitmap(grib_accessor_bufr_data_array* self, unsigned char* data, long* pos, +static int build_bitmap(grib_accessor_bufr_data_array_t* self, unsigned char* data, long* pos, int iel, grib_iarray* elementsDescriptorsIndex, int iBitmapOperator) { int bitmapSize = 0, iDelayedReplication = 0; @@ -1615,7 +1414,7 @@ static int build_bitmap(grib_accessor_bufr_data_array* self, unsigned char* data return GRIB_SUCCESS; } -static int consume_bitmap(grib_accessor_bufr_data_array* self, int iBitmapOperator) +static int consume_bitmap(grib_accessor_bufr_data_array_t* self, int iBitmapOperator) { int bitmapSize = 0, iDelayedReplication; int i; @@ -1646,7 +1445,7 @@ static int consume_bitmap(grib_accessor_bufr_data_array* self, int iBitmapOperat return GRIB_SUCCESS; } -static int build_bitmap_new_data(grib_accessor_bufr_data_array* self, unsigned char* data, long* pos, +static int build_bitmap_new_data(grib_accessor_bufr_data_array_t* self, unsigned char* data, long* pos, int iel, grib_iarray* elementsDescriptorsIndex, int iBitmapOperator) { int bitmapSize = 0, iDelayedReplication = 0; @@ -1733,7 +1532,7 @@ static int build_bitmap_new_data(grib_accessor_bufr_data_array* self, unsigned c } /* ECC-1304: Will return an index if successful. In case of an error, a negative number is returned e.g. GRIB_WRONG_BITMAP_SIZE */ -static int get_next_bitmap_descriptor_index_new_bitmap(grib_accessor_bufr_data_array* self, grib_iarray* elementsDescriptorsIndex, int compressedData) +static int get_next_bitmap_descriptor_index_new_bitmap(grib_accessor_bufr_data_array_t* self, grib_iarray* elementsDescriptorsIndex, int compressedData) { int i; bufr_descriptor** descriptors = self->expanded->v; @@ -1771,7 +1570,7 @@ static int get_next_bitmap_descriptor_index_new_bitmap(grib_accessor_bufr_data_a } /* ECC-1304: Will return an index if successful. In case of an error, a negative number is returned e.g. GRIB_WRONG_BITMAP_SIZE */ -static int get_next_bitmap_descriptor_index(grib_accessor_bufr_data_array* self, grib_iarray* elementsDescriptorsIndex, grib_darray* numericValues) +static int get_next_bitmap_descriptor_index(grib_accessor_bufr_data_array_t* self, grib_iarray* elementsDescriptorsIndex, grib_darray* numericValues) { int i; bufr_descriptor** descriptors = self->expanded->v; @@ -1813,7 +1612,7 @@ static int get_next_bitmap_descriptor_index(grib_accessor_bufr_data_array* self, return elementsDescriptorsIndex->v[self->bitmapCurrentElementsDescriptorsIndex]; } -static void push_zero_element(grib_accessor_bufr_data_array* self, grib_darray* dval) +static void push_zero_element(grib_accessor_bufr_data_array_t* self, grib_darray* dval) { grib_darray* d = 0; grib_accessor* a = (grib_accessor*)self; @@ -1846,19 +1645,16 @@ static grib_accessor* create_attribute_variable(const char* name, grib_section* len = 1; switch (type) { case GRIB_TYPE_LONG: - grib_pack_long(a, &lval, &len); - break; + a->pack_long(&lval, &len); break; case GRIB_TYPE_DOUBLE: - grib_pack_double(a, &dval, &len); - break; + a->pack_double(&dval, &len); break; case GRIB_TYPE_STRING: if (!sval) return NULL; /* Performance: No need for len=strlen(sval). It's not used. */ /* See grib_accessor_class_variable.c, pack_string() */ len = 0; - grib_pack_string(a, sval, &len); - break; + a->pack_string(sval, &len); break; } return a; @@ -1951,7 +1747,7 @@ static grib_accessor* create_accessor_from_descriptor(const grib_accessor* a, gr long ide, long subset, int add_dump_flag, int add_coord_flag, int count, int add_extra_attributes) { - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; char code[10] = {0,}; char* temp_str = NULL; int idx = 0; @@ -2014,13 +1810,13 @@ static grib_accessor* create_accessor_from_descriptor(const grib_accessor* a, gr if (attribute->attributes[i]) attribute->attributes[i]->parent=elementAccessor->parent; } */ - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); } attribute = create_attribute_variable("index", section, GRIB_TYPE_LONG, 0, 0, count, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); snprintf(code, sizeof(code), "%06ld", self->expanded->v[idx]->code); temp_str = grib_context_strdup(a->context, code); @@ -2028,28 +1824,28 @@ static grib_accessor* create_accessor_from_descriptor(const grib_accessor* a, gr if (!attribute) return NULL; grib_sarray_push(a->context, self->tempStrings, temp_str); /* ECC-325: store alloc'd string (due to strdup) for clean up later */ - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); if (add_extra_attributes) { attribute = create_attribute_variable("units", section, GRIB_TYPE_STRING, self->expanded->v[idx]->units, 0, 0, GRIB_ACCESSOR_FLAG_DUMP | flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); attribute = create_attribute_variable("scale", section, GRIB_TYPE_LONG, 0, 0, self->expanded->v[idx]->scale, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); attribute = create_attribute_variable("reference", section, GRIB_TYPE_DOUBLE, 0, self->expanded->v[idx]->reference, 0, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); attribute = create_attribute_variable("width", section, GRIB_TYPE_LONG, 0, 0, self->expanded->v[idx]->width, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); } break; case 2: @@ -2071,7 +1867,7 @@ static grib_accessor* create_accessor_from_descriptor(const grib_accessor* a, gr attribute = create_attribute_variable("index", section, GRIB_TYPE_LONG, 0, 0, count, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); } else { elementAccessor = grib_accessor_factory(section, &operatorCreator, 0, NULL); @@ -2080,13 +1876,13 @@ static grib_accessor* create_accessor_from_descriptor(const grib_accessor* a, gr attribute = create_attribute_variable("index", section, GRIB_TYPE_LONG, 0, 0, count, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); snprintf(code, sizeof(code), "%06ld", self->expanded->v[idx]->code); attribute = create_attribute_variable("code", section, GRIB_TYPE_STRING, code, 0, 0, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); } self->expanded->v[idx]->a = elementAccessor; break; @@ -2106,34 +1902,34 @@ static grib_accessor* create_accessor_from_descriptor(const grib_accessor* a, gr attribute = create_attribute_variable("index", section, GRIB_TYPE_LONG, 0, 0, count, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); snprintf(code, sizeof(code), "%06ld", self->expanded->v[idx]->code); attribute = create_attribute_variable("code", section, GRIB_TYPE_STRING, code, 0, 0, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); if (add_extra_attributes) { attribute = create_attribute_variable("units", section, GRIB_TYPE_STRING, self->expanded->v[idx]->units, 0, 0, GRIB_ACCESSOR_FLAG_DUMP); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); attribute = create_attribute_variable("scale", section, GRIB_TYPE_LONG, 0, 0, self->expanded->v[idx]->scale, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); attribute = create_attribute_variable("reference", section, GRIB_TYPE_DOUBLE, 0, self->expanded->v[idx]->reference, 0, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); attribute = create_attribute_variable("width", section, GRIB_TYPE_LONG, 0, 0, self->expanded->v[idx]->width, flags); if (!attribute) return NULL; - grib_accessor_add_attribute(elementAccessor, attribute, 0); + elementAccessor->add_attribute(attribute, 0); } break; } @@ -2179,19 +1975,18 @@ static grib_accessor* get_element_from_bitmap(const grib_accessor* a, bitmap_s* while (bitmapVal) { len = 1; if (bitmap->cursor && bitmap->cursor->accessor) { - ret = grib_unpack_long(bitmap->cursor->accessor, &bitmapVal, &len); - } + ret = bitmap->cursor->accessor->unpack_long(&bitmapVal, &len); } else { return NULL; } if (ret != 0) return NULL; - bitmap->cursor = bitmap->cursor->next; + bitmap->cursor = bitmap->cursor->next_; if (bitmap->referredElement) - bitmap->referredElement = bitmap->referredElement->next; + bitmap->referredElement = bitmap->referredElement->next_; } - return bitmap->referredElement ? bitmap->referredElement->prev->accessor : NULL; + return bitmap->referredElement ? bitmap->referredElement->prev_->accessor : NULL; } // static GRIB_INLINE void reset_qualifiers(grib_accessor* significanceQualifierGroup[]) @@ -2211,7 +2006,7 @@ static void grib_convert_to_attribute(grib_accessor* a) /* subsetList can be NULL in which case subsetListSize will be 0 */ static grib_iarray* set_subset_list( - grib_context* c, grib_accessor_bufr_data_array* self, + grib_context* c, grib_accessor_bufr_data_array_t* self, long onlySubset, long startSubset, long endSubset, const long* subsetList, size_t subsetListSize) { grib_iarray* list = grib_iarray_new(c, self->numberOfSubsets, 10); @@ -2258,11 +2053,10 @@ static int bitmap_ref_skip(grib_accessors_list* al, int* err) if (!al || !al->accessor) return 0; - acode = grib_accessor_get_attribute(al->accessor, "code"); + acode = al->accessor->get_attribute("code"); if (acode) - *err = grib_unpack_long(acode, code, &l); - else + *err = acode->unpack_long(code, &l); else return 1; switch (code[0]) { @@ -2291,9 +2085,9 @@ static int is_bitmap_start_descriptor(grib_accessors_list* al, int* err) if (!al || !al->accessor) return 0; - acode = grib_accessor_get_attribute(al->accessor, "code"); + acode = al->accessor->get_attribute("code"); if (acode) - *err = grib_unpack_long(acode, code, &l); + *err = acode->unpack_long(code, &l); else return 1; @@ -2309,7 +2103,7 @@ static int is_bitmap_start_descriptor(grib_accessors_list* al, int* err) { //long index[1]; //grib_accessor* anindex=grib_accessor_get_attribute(al->accessor,"index"); - //grib_unpack_long(anindex,index,&l); + //anindex->unpack_long(index,&l); return 1; } } @@ -2320,7 +2114,7 @@ static void print_bitmap_debug_info(grib_context* c, bitmap_s* bitmap, grib_acce { int i = 0, ret = 0; fprintf(stderr, "ECCODES DEBUG: bitmap_init: bitmapSize=%d\n", bitmapSize); - bitmap->cursor = bitmapStart->next; + bitmap->cursor = bitmapStart->next_; bitmap->referredElement = bitmapStart; while (bitmap_ref_skip(bitmap->referredElement, &ret)) { @@ -2328,7 +2122,7 @@ static void print_bitmap_debug_info(grib_context* c, bitmap_s* bitmap, grib_acce if (is_bitmap_start_descriptor(bitmap->referredElement, &ret)) { is_bmp = 1; } - bitmap->referredElement = bitmap->referredElement->prev; + bitmap->referredElement = bitmap->referredElement->prev_; if (is_bmp) { break; } @@ -2337,7 +2131,7 @@ static void print_bitmap_debug_info(grib_context* c, bitmap_s* bitmap, grib_acce for (i = 1; i < bitmapSize; i++) { if (bitmap->referredElement) { fprintf(stderr, "ECCODES DEBUG:\t bitmap_init: i=%d |%s|\n", i, bitmap->referredElement->accessor->name); - bitmap->referredElement = bitmap->referredElement->prev; + bitmap->referredElement = bitmap->referredElement->prev_; } } } @@ -2346,13 +2140,13 @@ static int bitmap_init(grib_context* c, bitmap_s* bitmap, grib_accessors_list* bitmapStart, int bitmapSize, grib_accessors_list* lastAccessorInList) { int ret = 0, i; - bitmap->cursor = bitmapStart->next; + bitmap->cursor = bitmapStart->next_; if (bitmap->referredElementStart != NULL) { bitmap->referredElement = bitmap->referredElementStart; return ret; } bitmap->referredElement = bitmapStart; - /*while (bitmap_ref_skip(bitmap->referredElement,&ret)) bitmap->referredElement=bitmap->referredElement->prev;*/ + /*while (bitmap_ref_skip(bitmap->referredElement,&ret)) bitmap->referredElement=bitmap->referredElement->prev_;*/ /* See ECC-869 * We have to INCLUDE the replication factors that come after the bitmap operators */ @@ -2361,7 +2155,7 @@ static int bitmap_init(grib_context* c, bitmap_s* bitmap, if (is_bitmap_start_descriptor(bitmap->referredElement, &ret)) { is_bmp = 1; } - bitmap->referredElement = bitmap->referredElement->prev; + bitmap->referredElement = bitmap->referredElement->prev_; if (is_bmp) { break; } @@ -2375,7 +2169,7 @@ static int bitmap_init(grib_context* c, bitmap_s* bitmap, return GRIB_INTERNAL_ERROR; } /*printf(" bitmap_init: i=%d |%s|\n", i,bitmap->referredElement->accessor->name);*/ - bitmap->referredElement = bitmap->referredElement->prev; + bitmap->referredElement = bitmap->referredElement->prev_; } bitmap->referredElementStart = bitmap->referredElement; return ret; @@ -2383,13 +2177,13 @@ static int bitmap_init(grib_context* c, bitmap_s* bitmap, static grib_accessor* accessor_or_attribute_with_same_name(grib_accessor* a, const char* name) { - if (grib_accessor_has_attributes(a) == 0) { + if (a->has_attributes() == 0) { return a; } else { grib_accessor* ok = a; grib_accessor* next; - while ((next = grib_accessor_get_attribute(ok, name)) != NULL) { + while ((next = ok->get_attribute(name)) != NULL) { ok = next; } return ok; @@ -2408,14 +2202,14 @@ static grib_accessor* accessor_or_attribute_with_same_name(grib_accessor* a, con // return *r; // } -static int grib_data_accessors_trie_push(grib_trie_with_rank* accessorsTrie, grib_accessor* a) +int grib_data_accessors_trie_push(grib_trie_with_rank* accessorsTrie, grib_accessor* a) { return grib_trie_with_rank_insert(accessorsTrie, a->name, a); } static int create_keys(const grib_accessor* a, long onlySubset, long startSubset, long endSubset) { - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; int err = 0; int rank; grib_accessor* elementAccessor = 0; @@ -2509,7 +2303,7 @@ static int create_keys(const grib_accessor* a, long onlySubset, long startSubset /*if (associatedFieldAccessor) grib_accessor_delete(c, associatedFieldAccessor);*/ associatedFieldAccessor = NULL; if (associatedFieldSignificanceAccessor) { - grib_accessor_delete(c, associatedFieldSignificanceAccessor); + associatedFieldSignificanceAccessor->destroy(c); associatedFieldSignificanceAccessor = NULL; } for (ide = 0; ide < elementsInSubset; ide++) { @@ -2577,7 +2371,7 @@ static int create_keys(const grib_accessor* a, long onlySubset, long startSubset //return err; bitmapIndex--; } - bitmapStart[bitmapIndex] = grib_accessors_list_last(self->dataAccessors); + bitmapStart[bitmapIndex] = self->dataAccessors->last(); bitmapSize[bitmapIndex] = 1; if (self->expanded->v[idx - 1]->code == 31002 || self->expanded->v[idx - 1]->code == 31001) extraElement += 1; @@ -2659,11 +2453,10 @@ static int create_keys(const grib_accessor* a, long onlySubset, long startSubset creatorsn.name = (char*)"subsetNumber"; asn = grib_accessor_factory(section, &creatorsn, 0, NULL); accessor_variable_set_type(asn, GRIB_TYPE_LONG); - grib_pack_long(asn, &subsetNumber, &len); - + asn->pack_long(&subsetNumber, &len); grib_push_accessor(asn, section->block); rank = grib_data_accessors_trie_push(self->dataAccessorsTrie, asn); - grib_accessors_list_push(self->dataAccessors, asn, rank); + self->dataAccessors->push(asn, rank); } count++; elementAccessor = create_accessor_from_descriptor(a, associatedFieldAccessor, section, ide, iss, @@ -2681,16 +2474,17 @@ static int create_keys(const grib_accessor* a, long onlySubset, long startSubset if (elementFromBitmap && self->unpackMode == CODES_BUFR_UNPACK_STRUCTURE) { if (descriptor->code != 33007 && descriptor->code != 223255) { char* aname = grib_context_strdup(c, elementFromBitmap->name); - grib_accessor* newAccessor = grib_accessor_clone(elementAccessor, section, &err); + grib_accessor* newAccessor = elementAccessor->clone(section, &err); newAccessor->parent = groupSection; newAccessor->name = aname; grib_sarray_push(a->context, self->tempStrings, aname); grib_push_accessor(newAccessor, groupSection->block); rank = grib_data_accessors_trie_push(self->dataAccessorsTrie, newAccessor); - grib_accessors_list_push(self->dataAccessors, newAccessor, rank); + self->dataAccessors->push(newAccessor, rank); } - err = grib_accessor_add_attribute(accessor_or_attribute_with_same_name(elementFromBitmap, elementAccessor->name), elementAccessor, 1); + //err = grib_accessor_add_attribute(accessor_or_attribute_with_same_name(elementFromBitmap, elementAccessor->name), elementAccessor, 1); + err = accessor_or_attribute_with_same_name(elementFromBitmap, elementAccessor->name)->add_attribute( elementAccessor, 1); } else if (elementAccessor) { int add_key = 1; @@ -2700,17 +2494,17 @@ static int create_keys(const grib_accessor* a, long onlySubset, long startSubset associatedFieldAccessor = elementAccessor; grib_convert_to_attribute(associatedFieldAccessor); if (associatedFieldSignificanceAccessor) { - grib_accessor* newAccessor = grib_accessor_clone(associatedFieldSignificanceAccessor, section, &err); + grib_accessor* newAccessor = associatedFieldSignificanceAccessor->clone(section, &err); if (err) { grib_context_log(a->context, GRIB_LOG_ERROR,"Unable to clone accessor '%s'\n", associatedFieldSignificanceAccessor->name); return err; } - grib_accessor_add_attribute(associatedFieldAccessor, newAccessor, 1); + associatedFieldAccessor->add_attribute(newAccessor, 1); } break; case 31021: if (associatedFieldSignificanceAccessor) - grib_accessor_delete(c, associatedFieldSignificanceAccessor); + associatedFieldSignificanceAccessor->destroy(c); associatedFieldSignificanceAccessor = elementAccessor; break; /*case 33007:*/ @@ -2728,8 +2522,8 @@ static int create_keys(const grib_accessor* a, long onlySubset, long startSubset if (add_key) { grib_push_accessor(elementAccessor, section->block); rank = grib_data_accessors_trie_push(self->dataAccessorsTrie, elementAccessor); - grib_accessors_list_push(self->dataAccessors, elementAccessor, rank); - lastAccessorInList = grib_accessors_list_last(self->dataAccessors); + self->dataAccessors->push(elementAccessor, rank); + lastAccessorInList = self->dataAccessors->last(); } } } @@ -2739,7 +2533,7 @@ static int create_keys(const grib_accessor* a, long onlySubset, long startSubset return err; } -static void set_input_replications(grib_handle* h, grib_accessor_bufr_data_array* self) +static void set_input_replications(grib_handle* h, grib_accessor_bufr_data_array_t* self) { size_t nInputReplications; size_t nInputExtendedReplications; @@ -2785,7 +2579,7 @@ static void set_input_replications(grib_handle* h, grib_accessor_bufr_data_array } } -static void set_input_bitmap(grib_handle* h, grib_accessor_bufr_data_array* self) +static void set_input_bitmap(grib_handle* h, grib_accessor_bufr_data_array_t* self) { size_t nInputBitmap; self->nInputBitmap = -1; @@ -2846,7 +2640,7 @@ static int process_elements(grib_accessor* a, int flag, long onlySubset, long st grib_darray* dval = NULL; grib_sarray* sval = NULL; - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; grib_handle* h = grib_handle_of_accessor(a); grib_context* c = h->context; @@ -3373,19 +3167,17 @@ static int process_elements(grib_accessor* a, int flag, long onlySubset, long st return err; } -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - // grib_accessor_bufr_data_array *self =(grib_accessor_bufr_data_array*)a; +void grib_accessor_class_bufr_data_array_t::dump(grib_accessor* a, grib_dumper* dumper){ + // grib_accessor_bufr_data_array_t *self =(grib_accessor_bufr_data_array_t*)a; // int err=process_elements(a,PROCESS_DECODE); // grib_dump_section(dumper,a,self->dataKeys->block); return; } -static int value_count(grib_accessor* a, long* count) -{ +int grib_accessor_class_bufr_data_array_t::value_count(grib_accessor* a, long* count){ int err = 0, l; long i; - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; err = process_elements(a, PROCESS_DECODE, 0, 0, 0); if (err) @@ -3405,13 +3197,12 @@ static int value_count(grib_accessor* a, long* count) return err; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ +int grib_accessor_class_bufr_data_array_t::unpack_double(grib_accessor* a, double* val, size_t* len){ int err = 0, i, k, ii; int proc_flag = PROCESS_DECODE; size_t l = 0, elementsInSubset; long numberOfSubsets = 0; - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; if (self->unpackMode == CODES_BUFR_NEW_DATA) proc_flag = PROCESS_NEW_DATA; @@ -3459,9 +3250,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return GRIB_SUCCESS; } -static void destroy(grib_context* c, grib_accessor* a) -{ - grib_accessor_bufr_data_array* self = (grib_accessor_bufr_data_array*)a; +void grib_accessor_class_bufr_data_array_t::destroy(grib_context* c, grib_accessor* a){ + grib_accessor_bufr_data_array_t* self = (grib_accessor_bufr_data_array_t*)a; self_clear(c, self); if (self->dataAccessors) grib_accessors_list_delete(c, self->dataAccessors); @@ -3481,4 +3271,5 @@ static void destroy(grib_context* c, grib_accessor* a) } grib_iarray_delete(self->iss_list); + grib_accessor_class_gen_t::destroy(c, a); } diff --git a/src/accessor/grib_accessor_class_bufr_data_array.h b/src/accessor/grib_accessor_class_bufr_data_array.h new file mode 100644 index 000000000..75d02b9b4 --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_data_array.h @@ -0,0 +1,89 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_bufr_data_array_t : public grib_accessor_gen_t +{ +public: + const char* bufrDataEncodedName; + const char* numberOfSubsetsName; + const char* expandedDescriptorsName; + const char* flagsName; + const char* unitsName; + const char* elementsDescriptorsIndexName; + const char* compressedDataName; + bufr_descriptors_array* expanded; + grib_accessor* expandedAccessor; + int* canBeMissing; + long numberOfSubsets; + long compressedData; + grib_vdarray* numericValues; + grib_vsarray* stringValues; + grib_viarray* elementsDescriptorsIndex; + int do_decode; + int bitmapStartElementsDescriptorsIndex; + int bitmapCurrentElementsDescriptorsIndex; + int bitmapSize; + int bitmapStart; + int bitmapCurrent; + grib_accessors_list* dataAccessors; + int unpackMode; + int bitsToEndData; + grib_section* dataKeys; + double* inputBitmap; + int nInputBitmap; + int iInputBitmap; + long* inputReplications; + int nInputReplications; + int iInputReplications; + long* inputExtendedReplications; + int nInputExtendedReplications; + int iInputExtendedReplications; + long* inputShortReplications; + int nInputShortReplications; + int iInputShortReplications; + grib_iarray* iss_list; + grib_trie_with_rank* dataAccessorsTrie; + grib_sarray* tempStrings; + grib_vdarray* tempDoubleValues; + int change_ref_value_operand; + size_t refValListSize; + long* refValList; + long refValIndex; + bufr_tableb_override* tableb_override; + int set_to_missing_if_out_of_range; +}; + +class grib_accessor_class_bufr_data_array_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_bufr_data_array_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufr_data_array_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; + +grib_vsarray* accessor_bufr_data_array_get_stringValues(grib_accessor* a); +grib_accessors_list* accessor_bufr_data_array_get_dataAccessors(grib_accessor* a); +grib_trie_with_rank* accessor_bufr_data_array_get_dataAccessorsTrie(grib_accessor* a); +void accessor_bufr_data_array_set_unpackMode(grib_accessor* a, int unpackMode); + diff --git a/src/grib_accessor_class_bufr_data_element.cc b/src/accessor/grib_accessor_class_bufr_data_element.cc similarity index 62% rename from src/grib_accessor_class_bufr_data_element.cc rename to src/accessor/grib_accessor_class_bufr_data_element.cc index 3301eb10f..8d483b96d 100644 --- a/src/grib_accessor_class_bufr_data_element.cc +++ b/src/accessor/grib_accessor_class_bufr_data_element.cc @@ -8,147 +8,22 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/***************************************** - * Enrico Fucile - ****************************************/ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;dump - IMPLEMENTS = unpack_string;unpack_string_array;unpack_long; unpack_double - IMPLEMENTS = unpack_double_element ; is_missing - IMPLEMENTS = pack_long; pack_double ; pack_string_array; pack_string; pack_missing - IMPLEMENTS = value_count; get_native_type; make_clone; destroy - MEMBERS = long index - MEMBERS = int type - MEMBERS = long compressedData - MEMBERS = long subsetNumber - MEMBERS = long numberOfSubsets - MEMBERS = bufr_descriptors_array* descriptors - MEMBERS = grib_vdarray* numericValues - MEMBERS = grib_vsarray* stringValues - MEMBERS = grib_viarray* elementsDescriptorsIndex - MEMBERS = char* cname - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_missing(grib_accessor*); -static int is_missing(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int pack_string_array(grib_accessor*, const char**, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int unpack_string_array(grib_accessor*, char**, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static grib_accessor* make_clone(grib_accessor*, grib_section*, int*); - -typedef struct grib_accessor_bufr_data_element -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bufr_data_element */ - long index; - int type; - long compressedData; - long subsetNumber; - long numberOfSubsets; - bufr_descriptors_array* descriptors; - grib_vdarray* numericValues; - grib_vsarray* stringValues; - grib_viarray* elementsDescriptorsIndex; - char* cname; -} grib_accessor_bufr_data_element; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_bufr_data_element = { - &grib_accessor_class_gen, /* super */ - "bufr_data_element", /* name */ - sizeof(grib_accessor_bufr_data_element), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - &pack_missing, /* pack_missing */ - &is_missing, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - &pack_string_array, /* pack_string_array */ - &unpack_string_array, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - &make_clone, /* clone accessor */ -}; - +#include "grib_accessor_class_bufr_data_element.h" +grib_accessor_class_bufr_data_element_t _grib_accessor_class_bufr_data_element{ "bufr_data_element" }; grib_accessor_class* grib_accessor_class_bufr_data_element = &_grib_accessor_class_bufr_data_element; -/* END_CLASS_IMP */ - -static grib_accessor* make_clone(grib_accessor* a, grib_section* s, int* err) +grib_accessor* grib_accessor_class_bufr_data_element_t::make_clone(grib_accessor* a, grib_section* s, int* err) { grib_accessor* the_clone = NULL; grib_accessor* attribute = NULL; - grib_accessor_bufr_data_element* elementAccessor; - grib_accessor_bufr_data_element* self; + grib_accessor_bufr_data_element_t* elementAccessor; + grib_accessor_bufr_data_element_t* self; char* copied_name = NULL; int i; - grib_action creator = {0,}; + grib_action creator = { + 0, + }; creator.op = (char*)"bufr_data_element"; creator.name_space = (char*)""; creator.set = 0; @@ -161,8 +36,8 @@ static grib_accessor* make_clone(grib_accessor* a, grib_section* s, int* err) the_clone = grib_accessor_factory(s, &creator, 0, NULL); copied_name = grib_context_strdup(a->context, a->name); the_clone->name = copied_name; - elementAccessor = (grib_accessor_bufr_data_element*)the_clone; - self = (grib_accessor_bufr_data_element*)a; + elementAccessor = (grib_accessor_bufr_data_element_t*)the_clone; + self = (grib_accessor_bufr_data_element_t*)a; the_clone->flags = a->flags; the_clone->parent = NULL; the_clone->h = s->h; @@ -179,9 +54,9 @@ static grib_accessor* make_clone(grib_accessor* a, grib_section* s, int* err) i = 0; while (a->attributes[i]) { - attribute = grib_accessor_clone(a->attributes[i], s, err); + attribute = a->attributes[i]->clone(s, err); /* attribute->parent=a->parent; */ - grib_accessor_add_attribute(the_clone, attribute, 0); + the_clone->add_attribute(attribute, 0); i++; } @@ -190,68 +65,69 @@ static grib_accessor* make_clone(grib_accessor* a, grib_section* s, int* err) void accessor_bufr_data_element_set_index(grib_accessor* a, long index) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - self->index = index; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + self->index = index; } void accessor_bufr_data_element_set_type(grib_accessor* a, int type) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - self->type = type; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + self->type = type; } void accessor_bufr_data_element_set_numberOfSubsets(grib_accessor* a, long numberOfSubsets) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - self->numberOfSubsets = numberOfSubsets; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + self->numberOfSubsets = numberOfSubsets; } void accessor_bufr_data_element_set_subsetNumber(grib_accessor* a, long subsetNumber) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - self->subsetNumber = subsetNumber; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + self->subsetNumber = subsetNumber; } void accessor_bufr_data_element_set_compressedData(grib_accessor* a, int compressedData) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - self->compressedData = compressedData; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + self->compressedData = compressedData; } void accessor_bufr_data_element_set_descriptors(grib_accessor* a, bufr_descriptors_array* descriptors) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - self->descriptors = descriptors; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + self->descriptors = descriptors; } void accessor_bufr_data_element_set_numericValues(grib_accessor* a, grib_vdarray* numericValues) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - self->numericValues = numericValues; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + self->numericValues = numericValues; } void accessor_bufr_data_element_set_stringValues(grib_accessor* a, grib_vsarray* stringValues) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - self->stringValues = stringValues; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + self->stringValues = stringValues; } void accessor_bufr_data_element_set_elementsDescriptorsIndex(grib_accessor* a, grib_viarray* elementsDescriptorsIndex) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - self->elementsDescriptorsIndex = elementsDescriptorsIndex; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + self->elementsDescriptorsIndex = elementsDescriptorsIndex; } -static void init(grib_accessor* a, const long len, grib_arguments* params) +void grib_accessor_class_bufr_data_element_t::init(grib_accessor* a, const long len, grib_arguments* params) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - a->length = 0; + grib_accessor_class_gen_t::init(a, len, params); + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + a->length = 0; a->flags |= GRIB_ACCESSOR_FLAG_BUFR_DATA; /* a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; */ self->cname = NULL; } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_bufr_data_element_t::dump(grib_accessor* a, grib_dumper* dumper) { int type = get_native_type(a); @@ -268,9 +144,9 @@ static void dump(grib_accessor* a, grib_dumper* dumper) } } -static int unpack_string_array(grib_accessor* a, char** val, size_t* len) +int grib_accessor_class_bufr_data_element_t::unpack_string_array(grib_accessor* a, char** val, size_t* len) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; int ret = 0, idx = 0; size_t count = 0, i = 0; @@ -289,7 +165,7 @@ static int unpack_string_array(grib_accessor* a, char** val, size_t* len) else { DEBUG_ASSERT(self->subsetNumber < self->numericValues->n); DEBUG_ASSERT(self->index < self->numericValues->v[self->subsetNumber]->n); - idx = (int)self->numericValues->v[self->subsetNumber]->v[self->index] / 1000 - 1; + idx = (int)self->numericValues->v[self->subsetNumber]->v[self->index] / 1000 - 1; val[0] = grib_context_strdup(c, self->stringValues->v[idx]->v[0]); *len = 1; } @@ -297,13 +173,13 @@ static int unpack_string_array(grib_accessor* a, char** val, size_t* len) return ret; } -static int pack_string_array(grib_accessor* a, const char** v, size_t* len) +int grib_accessor_class_bufr_data_element_t::pack_string_array(grib_accessor* a, const char** v, size_t* len) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; int ret = GRIB_SUCCESS, idx = 0; - size_t i = 0; - char* s = NULL; + size_t i = 0; + char* s = NULL; grib_context* c = a->context; if (self->compressedData) { @@ -322,32 +198,32 @@ static int pack_string_array(grib_accessor* a, const char** v, size_t* len) } } else { - //ECC-1623 + // ECC-1623 if (*len != (size_t)self->numberOfSubsets) { grib_context_log(c, GRIB_LOG_ERROR, - "Number of values mismatch for '%s': %zu strings provided but expected %ld (=number of subsets)", - a->name, *len, self->numberOfSubsets); + "Number of values mismatch for '%s': %zu strings provided but expected %ld (=number of subsets)", + a->name, *len, self->numberOfSubsets); return GRIB_WRONG_ARRAY_SIZE; } for (i = 0; i < *len; i++) { - //idx = (int)self->numericValues->v[self->subsetNumber]->v[self->index] / 1000 - 1; - idx = (int)self->numericValues->v[i]->v[self->index] / 1000 - 1; + // idx = (int)self->numericValues->v[self->subsetNumber]->v[self->index] / 1000 - 1; + idx = (int)self->numericValues->v[i]->v[self->index] / 1000 - 1; self->stringValues->v[idx]->v[0] = strdup(v[i]); } - *len=1; + *len = 1; } return ret; } -static int unpack_string(grib_accessor* a, char* val, size_t* len) +int grib_accessor_class_bufr_data_element_t::unpack_string(grib_accessor* a, char* val, size_t* len) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - char* str = NULL; - char* p = 0; - size_t slen = 0; - double dval = 0; - size_t dlen = 1; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + char* str = NULL; + char* p = 0; + size_t slen = 0; + double dval = 0; + size_t dlen = 1; int idx = 0, err = 0; grib_context* c = a->context; @@ -409,12 +285,12 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) return GRIB_SUCCESS; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) +int grib_accessor_class_bufr_data_element_t::pack_string(grib_accessor* a, const char* val, size_t* len) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; int ret = GRIB_SUCCESS, idx = 0; - char* s = NULL; + char* s = NULL; grib_context* c = a->context; if (self->compressedData) { @@ -426,16 +302,16 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) grib_sarray_delete_content(c, self->stringValues->v[idx]); /* ECC-1172 */ grib_sarray_delete(c, self->stringValues->v[idx]); self->stringValues->v[idx] = grib_sarray_new(c, 1, 1); - s = grib_context_strdup(c, val); + s = grib_context_strdup(c, val); grib_sarray_push(c, self->stringValues->v[idx], s); return ret; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_bufr_data_element_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - int ret = GRIB_SUCCESS; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + int ret = GRIB_SUCCESS; long count = 0, i = 0; value_count(a, &count); @@ -461,10 +337,10 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_bufr_data_element_t::unpack_double(grib_accessor* a, double* val, size_t* len) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - int ret = GRIB_SUCCESS; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + int ret = GRIB_SUCCESS; long count = 0, i = 0; value_count(a, &count); @@ -490,10 +366,10 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_bufr_data_element_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - int ret = GRIB_SUCCESS; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + int ret = GRIB_SUCCESS; size_t count = 1, i = 0; grib_context* c = a->context; @@ -514,16 +390,16 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) } else { self->numericValues->v[self->subsetNumber]->v[self->index] = val[0]; - *len = 1; + *len = 1; } return ret; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_bufr_data_element_t::pack_long(grib_accessor* a, const long* val, size_t* len) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - int ret = 0; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + int ret = 0; size_t count = 1, i = 0; grib_context* c = a->context; @@ -544,17 +420,17 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) } else { self->numericValues->v[self->subsetNumber]->v[self->index] = val[0] == GRIB_MISSING_LONG ? GRIB_MISSING_DOUBLE : val[0]; - *len = 1; + *len = 1; } return ret; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_bufr_data_element_t::value_count(grib_accessor* a, long* count) { int ret = 0, type = 0, idx = 0; - size_t size = 0; - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; + size_t size = 0; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; if (!self->compressedData) { *count = 1; @@ -577,12 +453,12 @@ static int value_count(grib_accessor* a, long* count) return ret; } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) +int grib_accessor_class_bufr_data_element_t::unpack_double_element(grib_accessor* a, size_t idx, double* val) { /* ECC-415 */ - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - int ret = GRIB_SUCCESS; - long count = 0; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + int ret = GRIB_SUCCESS; + long count = 0; value_count(a, &count); if (idx >= (size_t)count) { @@ -598,10 +474,10 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return ret; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_bufr_data_element_t::get_native_type(grib_accessor* a) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - int ret = GRIB_TYPE_DOUBLE; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + int ret = GRIB_TYPE_DOUBLE; DEBUG_ASSERT(self); switch (self->type) { case BUFR_DESCRIPTOR_TYPE_STRING: @@ -624,24 +500,25 @@ static int get_native_type(grib_accessor* a) return ret; } -static void destroy(grib_context* ct, grib_accessor* a) +void grib_accessor_class_bufr_data_element_t::destroy(grib_context* ct, grib_accessor* a) { - grib_accessor_bufr_data_element* self = (grib_accessor_bufr_data_element*)a; - int i = 0; + grib_accessor_bufr_data_element_t* self = (grib_accessor_bufr_data_element_t*)a; + int i = 0; if (self->cname) grib_context_free(ct, self->cname); /* ECC-765 */ while (i < MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) { /*grib_context_log(ct,GRIB_LOG_DEBUG,"deleting attribute %s->%s",a->name,a->attributes[i]->name);*/ /*printf("bufr_data_element destroy %s %p\n", a->attributes[i]->name, (void*)a->attributes[i]);*/ - grib_accessor_delete(ct, a->attributes[i]); + a->attributes[i]->destroy(ct); a->attributes[i] = NULL; i++; } + grib_accessor_class_gen_t::destroy(ct, a); } #define MAX_STRING_SIZE 4096 /* Return 1 if BUFR element(s) is/are missing, 0 otherwise. In case of decoding errors, also return 0 */ -static int is_missing(grib_accessor* a) +int grib_accessor_class_bufr_data_element_t::is_missing(grib_accessor* a) { const int ktype = get_native_type(a); int err = 0, result = 1; /* default: assume all are missing */ @@ -651,16 +528,16 @@ static int is_missing(grib_accessor* a) if (ktype == GRIB_TYPE_LONG) { long* values = NULL; - long value = 0; + long value = 0; value_count(a, &count); size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(c, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } if (err) return 0; /* TODO: no way of propagating the error up */ Assert(size2 == size); @@ -672,22 +549,23 @@ static int is_missing(grib_accessor* a) } } grib_context_free(c, values); - } else { + } + else { result = grib_is_missing_long(a, value); } } else if (ktype == GRIB_TYPE_DOUBLE) { - double value = 0; + double value = 0; double* values = NULL; value_count(a, &count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } if (err) return 0; /* TODO: no way of propagating the error up */ Assert(size2 == size); @@ -710,7 +588,7 @@ static int is_missing(grib_accessor* a) size = count; if (size > 1) { values = (char**)grib_context_malloc_clear(a->context, size * sizeof(char*)); - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); if (err) return 0; /* TODO: no way of propagating the error up */ for (i = 0; i < size; i++) { if (!grib_is_missing_string(a, (unsigned char*)values[i], size)) { @@ -718,12 +596,14 @@ static int is_missing(grib_accessor* a) break; } } - for (i = 0; i < size; i++) grib_context_free(c, values[i]); + for (i = 0; i < size; i++) + grib_context_free(c, values[i]); grib_context_free(c, values); - } else { + } + else { char value[MAX_STRING_SIZE] = {0,}; /* See ECC-710 */ size = MAX_STRING_SIZE; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); if (err) return 0; /* TODO: no way of propagating the error up */ result = grib_is_missing_string(a, (unsigned char*)value, size); } @@ -734,11 +614,11 @@ static int is_missing(grib_accessor* a) return result; } -static int pack_missing(grib_accessor* a) +int grib_accessor_class_bufr_data_element_t::pack_missing(grib_accessor* a) { - int ktype = GRIB_TYPE_UNDEFINED; - int err = 0; - size_t size = 1; + int ktype = GRIB_TYPE_UNDEFINED; + int err = 0; + size_t size = 1; const int can_be_missing = (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING); if (!can_be_missing) return GRIB_VALUE_CANNOT_BE_MISSING; @@ -746,11 +626,11 @@ static int pack_missing(grib_accessor* a) ktype = get_native_type(a); if (ktype == GRIB_TYPE_LONG) { long missing = GRIB_MISSING_LONG; - err = pack_long(a, &missing, &size); + err = pack_long(a, &missing, &size); } else if (ktype == GRIB_TYPE_DOUBLE) { double missing = GRIB_MISSING_DOUBLE; - err = pack_double(a, &missing, &size); + err = pack_double(a, &missing, &size); } else if (ktype == GRIB_TYPE_STRING) { err = pack_string(a, "", &size); diff --git a/src/accessor/grib_accessor_class_bufr_data_element.h b/src/accessor/grib_accessor_class_bufr_data_element.h new file mode 100644 index 000000000..bbed1785b --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_data_element.h @@ -0,0 +1,54 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_bufr_data_element_t : public grib_accessor_gen_t +{ +public: + /* Members defined in bufr_data_element */ + long index; + int type; + long compressedData; + long subsetNumber; + long numberOfSubsets; + bufr_descriptors_array* descriptors; + grib_vdarray* numericValues; + grib_vsarray* stringValues; + grib_viarray* elementsDescriptorsIndex; + char* cname; +}; + +class grib_accessor_class_bufr_data_element_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_bufr_data_element_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufr_data_element_t{}; } + int get_native_type(grib_accessor*) override; + int pack_missing(grib_accessor*) override; + int is_missing(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int pack_string_array(grib_accessor*, const char**, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int unpack_string_array(grib_accessor*, char**, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + grib_accessor* make_clone(grib_accessor*, grib_section*, int*) override; +}; diff --git a/src/grib_accessor_class_bufr_elements_table.cc b/src/accessor/grib_accessor_class_bufr_elements_table.cc similarity index 63% rename from src/grib_accessor_class_bufr_elements_table.cc rename to src/accessor/grib_accessor_class_bufr_elements_table.cc index 4858ff63d..ddd055544 100644 --- a/src/grib_accessor_class_bufr_elements_table.cc +++ b/src/accessor/grib_accessor_class_bufr_elements_table.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,12 +9,8 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/***************************************** - * Enrico Fucile - ****************************************/ - +#include "grib_accessor_class_bufr_elements_table.h" #include "grib_scaling.h" -#include "grib_api_internal.h" #if GRIB_PTHREADS static pthread_once_t once = PTHREAD_ONCE_INIT; @@ -31,7 +28,7 @@ static void thread_init() static int once = 0; static omp_nest_lock_t mutex1; -static void thread_init() +void thread_init() { GRIB_OMP_CRITICAL(lock_grib_accessor_class_bufr_elements_table_c) { @@ -43,107 +40,16 @@ static void thread_init() } #endif -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;unpack_string;unpack_long;unpack_double - IMPLEMENTS = value_count; get_native_type; - MEMBERS = const char* dictionary - MEMBERS = const char* masterDir - MEMBERS = const char* localDir - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bufr_elements_table -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bufr_elements_table */ - const char* dictionary; - const char* masterDir; - const char* localDir; -} grib_accessor_bufr_elements_table; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_bufr_elements_table = { - &grib_accessor_class_gen, /* super */ - "bufr_elements_table", /* name */ - sizeof(grib_accessor_bufr_elements_table), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_bufr_elements_table_t _grib_accessor_class_bufr_elements_table{ "bufr_elements_table" }; grib_accessor_class* grib_accessor_class_bufr_elements_table = &_grib_accessor_class_bufr_elements_table; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long len, grib_arguments* params) +void grib_accessor_class_bufr_elements_table_t::init(grib_accessor* a, const long len, grib_arguments* params) { - int n = 0; - grib_accessor_bufr_elements_table* self = (grib_accessor_bufr_elements_table*)a; + grib_accessor_class_gen_t::init(a, len, params); + int n = 0; + grib_accessor_bufr_elements_table_t* self = (grib_accessor_bufr_elements_table_t*)a; self->dictionary = grib_arguments_get_string(grib_handle_of_accessor(a), params, n++); self->masterDir = grib_arguments_get_name(grib_handle_of_accessor(a), params, n++); @@ -155,7 +61,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* params) static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err) { - grib_accessor_bufr_elements_table* self = (grib_accessor_bufr_elements_table*)a; + grib_accessor_bufr_elements_table_t* self = (grib_accessor_bufr_elements_table_t*)a; char* filename = NULL; char line[1024] = {0,}; @@ -163,7 +69,9 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err) char localDir[1024] = {0,}; char dictName[1024] = {0,}; char masterRecomposed[1024] = {0,}; /*e.g. bufr/tables/0/wmo/36/element.table */ - char localRecomposed[1024] = {0,}; /*e.g. bufr/tables/0/local/0/98/0/element.table */ + char localRecomposed[1024] = { + 0, + }; /*e.g. bufr/tables/0/local/0/98/0/element.table */ char* localFilename = 0; char** list = 0; char** cached_list = 0; @@ -208,9 +116,9 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err) if (!filename) { grib_context_log(c, GRIB_LOG_ERROR, "Unable to find definition file %s", self->dictionary); - if (strlen(masterRecomposed) > 0) grib_context_log(c, GRIB_LOG_DEBUG,"master path=%s", masterRecomposed); + if (strlen(masterRecomposed) > 0) grib_context_log(c, GRIB_LOG_DEBUG, "master path=%s", masterRecomposed); if (strlen(localRecomposed) > 0) grib_context_log(c, GRIB_LOG_DEBUG, "local path=%s", localRecomposed); - *err = GRIB_FILE_NOT_FOUND; + *err = GRIB_FILE_NOT_FOUND; dictionary = NULL; goto the_end; } @@ -234,7 +142,7 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err) dictionary = grib_trie_new(c); while (fgets(line, sizeof(line) - 1, f)) { - DEBUG_ASSERT( strlen(line) > 0 ); + DEBUG_ASSERT(strlen(line) > 0); if (line[0] == '#') continue; /* Ignore first line with column titles */ list = string_split(line, "|"); grib_trie_insert(dictionary, list[0], list); @@ -251,14 +159,15 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err) } while (fgets(line, sizeof(line) - 1, f)) { - DEBUG_ASSERT( strlen(line) > 0 ); - if (line[0] == '#') continue; /* Ignore first line with column titles */ + DEBUG_ASSERT(strlen(line) > 0); + if (line[0] == '#') continue; /* Ignore first line with column titles */ list = string_split(line, "|"); /* Look for the descriptor code in the trie. It might be there from before */ cached_list = (char**)grib_trie_get(dictionary, list[0]); if (cached_list) { /* If found, we are about to overwrite it. So free memory */ int i; - for (i = 0; cached_list[i] != NULL; ++i) free(cached_list[i]); + for (i = 0; cached_list[i] != NULL; ++i) + free(cached_list[i]); free(cached_list); } grib_trie_insert(dictionary, list[0], list); @@ -304,17 +213,18 @@ static int convert_type(const char* stype) return ret; } -static long atol_fast(const char* input) +long atol_fast(const char* input) { if (strcmp(input, "0") == 0) return 0; return atol(input); } -static int bufr_get_from_table(grib_accessor* a, bufr_descriptor* v) + +int bufr_get_from_table(grib_accessor* a, bufr_descriptor* v) { - int ret = 0; - char** list = 0; - char code[7] = { 0 }; + int ret = 0; + char** list = 0; + char code[7] = { 0 }; const size_t codeLen = sizeof(code); grib_trie* table = load_bufr_elements_table(a, &ret); @@ -332,8 +242,8 @@ static int bufr_get_from_table(grib_accessor* a, bufr_descriptor* v) /* ECC-1137: check descriptor key name and unit lengths */ const size_t maxlen_shortName = sizeof(v->shortName); const size_t maxlen_units = sizeof(v->units); - Assert( strlen(list[1]) < maxlen_shortName ); - Assert( strlen(list[4]) < maxlen_units ); + Assert(strlen(list[1]) < maxlen_shortName); + Assert(strlen(list[4]) < maxlen_units); } #endif @@ -407,28 +317,28 @@ bufr_descriptor* accessor_bufr_elements_table_get_descriptor(grib_accessor* a, i return v; } -static int unpack_string(grib_accessor* a, char* buffer, size_t* len) +int grib_accessor_class_bufr_elements_table_t::unpack_string(grib_accessor* a, char* buffer, size_t* len) { return GRIB_NOT_IMPLEMENTED; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_bufr_elements_table_t::value_count(grib_accessor* a, long* count) { *count = 1; return 0; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_bufr_elements_table_t::get_native_type(grib_accessor* a) { return GRIB_TYPE_STRING; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_bufr_elements_table_t::unpack_long(grib_accessor* a, long* val, size_t* len) { return GRIB_NOT_IMPLEMENTED; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_bufr_elements_table_t::unpack_double(grib_accessor* a, double* val, size_t* len) { return GRIB_NOT_IMPLEMENTED; } diff --git a/src/accessor/grib_accessor_class_bufr_elements_table.h b/src/accessor/grib_accessor_class_bufr_elements_table.h new file mode 100644 index 000000000..4f133c9e4 --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_elements_table.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_bufr_elements_table_t : public grib_accessor_gen_t +{ +public: + /* Members defined in bufr_elements_table */ + const char* dictionary; + const char* masterDir; + const char* localDir; +}; + +class grib_accessor_class_bufr_elements_table_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_bufr_elements_table_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufr_elements_table_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_bufr_extract_area_subsets.cc b/src/accessor/grib_accessor_class_bufr_extract_area_subsets.cc similarity index 55% rename from src/grib_accessor_class_bufr_extract_area_subsets.cc rename to src/accessor/grib_accessor_class_bufr_extract_area_subsets.cc index 473a5148d..91a34c72c 100644 --- a/src/grib_accessor_class_bufr_extract_area_subsets.cc +++ b/src/accessor/grib_accessor_class_bufr_extract_area_subsets.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,120 +9,18 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init; get_native_type - IMPLEMENTS = pack_long; - MEMBERS = const char* doExtractSubsets - MEMBERS = const char* numberOfSubsets - MEMBERS = const char* extractSubsetList - MEMBERS = const char* extractAreaWestLongitude - MEMBERS = const char* extractAreaEastLongitude - MEMBERS = const char* extractAreaNorthLatitude - MEMBERS = const char* extractAreaSouthLatitude - MEMBERS = const char* extractAreaLongitudeRank - MEMBERS = const char* extractAreaLatitudeRank - MEMBERS = const char* extractedAreaNumberOfSubsets - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bufr_extract_area_subsets -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bufr_extract_area_subsets */ - const char* doExtractSubsets; - const char* numberOfSubsets; - const char* extractSubsetList; - const char* extractAreaWestLongitude; - const char* extractAreaEastLongitude; - const char* extractAreaNorthLatitude; - const char* extractAreaSouthLatitude; - const char* extractAreaLongitudeRank; - const char* extractAreaLatitudeRank; - const char* extractedAreaNumberOfSubsets; -} grib_accessor_bufr_extract_area_subsets; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_bufr_extract_area_subsets = { - &grib_accessor_class_gen, /* super */ - "bufr_extract_area_subsets", /* name */ - sizeof(grib_accessor_bufr_extract_area_subsets), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_bufr_extract_area_subsets.h" +grib_accessor_class_bufr_extract_area_subsets_t _grib_accessor_class_bufr_extract_area_subsets{ "bufr_extract_area_subsets" }; grib_accessor_class* grib_accessor_class_bufr_extract_area_subsets = &_grib_accessor_class_bufr_extract_area_subsets; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long len, grib_arguments* arg) +void grib_accessor_class_bufr_extract_area_subsets_t::init(grib_accessor* a, const long len, grib_arguments* arg) { - grib_accessor_bufr_extract_area_subsets* self = (grib_accessor_bufr_extract_area_subsets*)a; - grib_handle* h = grib_handle_of_accessor(a); - int n = 0; + grib_accessor_class_gen_t::init(a, len, arg); + grib_accessor_bufr_extract_area_subsets_t* self = (grib_accessor_bufr_extract_area_subsets_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int n = 0; a->length = 0; self->doExtractSubsets = grib_arguments_get_name(h, arg, n++); @@ -138,7 +37,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg) a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_bufr_extract_area_subsets_t::get_native_type(grib_accessor* a) { return GRIB_TYPE_LONG; } @@ -153,11 +52,11 @@ static void fill_in(double a[], long length) static int select_area(grib_accessor* a) { - grib_accessor_bufr_extract_area_subsets* self = (grib_accessor_bufr_extract_area_subsets*)a; + grib_accessor_bufr_extract_area_subsets_t* self = (grib_accessor_bufr_extract_area_subsets_t*)a; - int ret = 0; + int ret = 0; long compressed = 0; - grib_handle* h = grib_handle_of_accessor(a); + grib_handle* h = grib_handle_of_accessor(a); grib_context* c = h->context; double* lat = NULL; @@ -166,8 +65,8 @@ static int select_area(grib_accessor* a) double lonWest, lonEast, latNorth, latSouth; long numberOfSubsets, i, latRank, lonRank; grib_iarray* subsets = NULL; - size_t nsubsets = 0; - char latstr[32] = {0,}; + size_t nsubsets = 0; + char latstr[32] = {0,}; char lonstr[32] = {0,}; ret = grib_get_long(h, "compressedData", &compressed); @@ -265,7 +164,7 @@ static int select_area(grib_accessor* a) if (nsubsets != 0) { long* subsets_ar = grib_iarray_get_array(subsets); - ret = grib_set_long_array(h, self->extractSubsetList, subsets_ar, nsubsets); + ret = grib_set_long_array(h, self->extractSubsetList, subsets_ar, nsubsets); grib_context_free(c, subsets_ar); if (ret) return ret; @@ -281,9 +180,9 @@ static int select_area(grib_accessor* a) return ret; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_bufr_extract_area_subsets_t::pack_long(grib_accessor* a, const long* val, size_t* len) { - /*grib_accessor_bufr_extract_area_subsets *self =(grib_accessor_bufr_extract_area_subsets*)a;*/ + /*grib_accessor_bufr_extract_area_subsets_t *self =(grib_accessor_bufr_extract_area_subsets_t*)a;*/ if (*len == 0) return GRIB_SUCCESS; diff --git a/src/accessor/grib_accessor_class_bufr_extract_area_subsets.h b/src/accessor/grib_accessor_class_bufr_extract_area_subsets.h new file mode 100644 index 000000000..941f38ac0 --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_extract_area_subsets.h @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_bufr_extract_area_subsets_t : public grib_accessor_gen_t +{ +public: + /* Members defined in bufr_extract_area_subsets */ + const char* doExtractSubsets; + const char* numberOfSubsets; + const char* extractSubsetList; + const char* extractAreaWestLongitude; + const char* extractAreaEastLongitude; + const char* extractAreaNorthLatitude; + const char* extractAreaSouthLatitude; + const char* extractAreaLongitudeRank; + const char* extractAreaLatitudeRank; + const char* extractedAreaNumberOfSubsets; +}; + +class grib_accessor_class_bufr_extract_area_subsets_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_bufr_extract_area_subsets_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufr_extract_area_subsets_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_bufr_extract_datetime_subsets.cc b/src/accessor/grib_accessor_class_bufr_extract_datetime_subsets.cc similarity index 71% rename from src/grib_accessor_class_bufr_extract_datetime_subsets.cc rename to src/accessor/grib_accessor_class_bufr_extract_datetime_subsets.cc index d5ec98bf6..d47652984 100644 --- a/src/grib_accessor_class_bufr_extract_datetime_subsets.cc +++ b/src/accessor/grib_accessor_class_bufr_extract_datetime_subsets.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,105 +9,17 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init; get_native_type - IMPLEMENTS = pack_long; - MEMBERS = const char* doExtractSubsets - MEMBERS = const char* numberOfSubsets - MEMBERS = const char* extractSubsetList - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bufr_extract_datetime_subsets -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bufr_extract_datetime_subsets */ - const char* doExtractSubsets; - const char* numberOfSubsets; - const char* extractSubsetList; -} grib_accessor_bufr_extract_datetime_subsets; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_bufr_extract_datetime_subsets = { - &grib_accessor_class_gen, /* super */ - "bufr_extract_datetime_subsets", /* name */ - sizeof(grib_accessor_bufr_extract_datetime_subsets), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_bufr_extract_datetime_subsets.h" +grib_accessor_class_bufr_extract_datetime_subsets_t _grib_accessor_class_bufr_extract_datetime_subsets{ "bufr_extract_datetime_subsets" }; grib_accessor_class* grib_accessor_class_bufr_extract_datetime_subsets = &_grib_accessor_class_bufr_extract_datetime_subsets; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long len, grib_arguments* arg) +void grib_accessor_class_bufr_extract_datetime_subsets_t::init(grib_accessor* a, const long len, grib_arguments* arg) { - int n = 0; - grib_accessor_bufr_extract_datetime_subsets* self = (grib_accessor_bufr_extract_datetime_subsets*)a; + grib_accessor_class_gen_t::init(a, len, arg); + int n = 0; + grib_accessor_bufr_extract_datetime_subsets_t* self = (grib_accessor_bufr_extract_datetime_subsets_t*)a; a->length = 0; self->doExtractSubsets = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); @@ -116,13 +29,13 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg) a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_bufr_extract_datetime_subsets_t::get_native_type(grib_accessor* a) { return GRIB_TYPE_LONG; } /* Convert input date to Julian number. If date is invalid, return -1 */ -static double date_to_julian(long year, long month, long day, long hour, long minute, double second) +double date_to_julian(long year, long month, long day, long hour, long minute, double second) { double result = 0; /* Julian number in units of days */ @@ -175,7 +88,9 @@ static int build_long_array(grib_context* c, grib_handle* h, int compressed, } else { /* uncompressed */ - char keystr[32] = {0,}; + char keystr[32] = { + 0, + }; size_t values_len = 0; for (i = 0; i < numberOfSubsets; ++i) { long lVal = 0; @@ -196,14 +111,22 @@ static int build_long_array(grib_context* c, grib_handle* h, int compressed, static int select_datetime(grib_accessor* a) { - int ret = 0; - long compressed = 0; - grib_accessor_bufr_extract_datetime_subsets* self = (grib_accessor_bufr_extract_datetime_subsets*)a; - grib_handle* h = grib_handle_of_accessor(a); - grib_context* c = h->context; + int ret = 0; + long compressed = 0; + grib_accessor_bufr_extract_datetime_subsets_t* self = (grib_accessor_bufr_extract_datetime_subsets_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + grib_context* c = h->context; size_t n; double julianStart = 0, julianEnd = 0, julianDT = 0; - char start_str[80] = {0,}, end_str[80] = {0,}, datetime_str[80] = {0,}; + char start_str[80] = { + 0, + }, + end_str[80] = { + 0, + }, + datetime_str[80] = { + 0, + }; long yearRank, monthRank, dayRank, hourRank, minuteRank, secondRank; long yearStart, monthStart, dayStart, hourStart, minuteStart, secondStart; long yearEnd, monthEnd, dayEnd, hourEnd, minuteEnd, secondEnd; @@ -211,13 +134,13 @@ static int select_datetime(grib_accessor* a) double* second = NULL; long numberOfSubsets, i; grib_iarray* subsets = NULL; - size_t nsubsets = 0; - char yearstr[32] = "year"; - char monthstr[32] = "month"; - char daystr[32] = "day"; - char hourstr[32] = "hour"; - char minutestr[32] = "minute"; - char secondstr[32] = "second"; + size_t nsubsets = 0; + char yearstr[32] = "year"; + char monthstr[32] = "month"; + char daystr[32] = "day"; + char hourstr[32] = "hour"; + char minutestr[32] = "minute"; + char secondstr[32] = "second"; ret = grib_get_long(h, "compressedData", &compressed); if (ret) return ret; @@ -356,7 +279,7 @@ static int select_datetime(grib_accessor* a) if (ret) secondEnd = 0; snprintf(end_str, sizeof(end_str), "%04ld/%02ld/%02ld %02ld:%02ld:%02ld", - yearEnd, monthEnd, dayEnd, hourEnd, minuteEnd, secondEnd); + yearEnd, monthEnd, dayEnd, hourEnd, minuteEnd, secondEnd); if (c->debug) fprintf(stderr, "ECCODES DEBUG bufr_extract_datetime_subsets: end =%s\n", end_str); julianEnd = date_to_julian(yearEnd, monthEnd, dayEnd, hourEnd, minuteEnd, secondEnd); if (julianEnd == -1) { @@ -402,7 +325,7 @@ static int select_datetime(grib_accessor* a) if (nsubsets != 0) { long* subsets_ar = grib_iarray_get_array(subsets); - ret = grib_set_long_array(h, self->extractSubsetList, subsets_ar, nsubsets); + ret = grib_set_long_array(h, self->extractSubsetList, subsets_ar, nsubsets); grib_context_free(c, subsets_ar); if (ret) return ret; @@ -423,9 +346,9 @@ cleanup: return ret; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_bufr_extract_datetime_subsets_t::pack_long(grib_accessor* a, const long* val, size_t* len) { - /*grib_accessor_bufr_extract_datetime_subsets *self =(grib_accessor_bufr_extract_datetime_subsets*)a;*/ + /*grib_accessor_bufr_extract_datetime_subsets_t *self =(grib_accessor_bufr_extract_datetime_subsets_t*)a;*/ if (*len == 0) return GRIB_SUCCESS; diff --git a/src/accessor/grib_accessor_class_bufr_extract_datetime_subsets.h b/src/accessor/grib_accessor_class_bufr_extract_datetime_subsets.h new file mode 100644 index 000000000..765786cd2 --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_extract_datetime_subsets.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_bufr_extract_datetime_subsets_t : public grib_accessor_gen_t +{ +public: + /* Members defined in bufr_extract_datetime_subsets */ + const char* doExtractSubsets; + const char* numberOfSubsets; + const char* extractSubsetList; +}; + +class grib_accessor_class_bufr_extract_datetime_subsets_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_bufr_extract_datetime_subsets_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufr_extract_datetime_subsets_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_bufr_extract_subsets.cc b/src/accessor/grib_accessor_class_bufr_extract_subsets.cc new file mode 100644 index 000000000..7d5a23652 --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_extract_subsets.cc @@ -0,0 +1,58 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_bufr_extract_subsets.h" + +grib_accessor_class_bufr_extract_subsets_t _grib_accessor_class_bufr_extract_subsets{"bufr_extract_subsets"}; +grib_accessor_class* grib_accessor_class_bufr_extract_subsets = &_grib_accessor_class_bufr_extract_subsets; + + +void get_accessors(grib_accessor* a){ + grib_accessor_bufr_extract_subsets_t* self = (grib_accessor_bufr_extract_subsets_t*)a; + const grib_handle* h = grib_handle_of_accessor(a); + + if (self->packAccessor) + return; + self->numericValuesAccessor = grib_find_accessor(h, self->numericValues); + self->packAccessor = grib_find_accessor(h, self->pack); +} + +void grib_accessor_class_bufr_extract_subsets_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + int n = 0; + grib_accessor_bufr_extract_subsets_t* self = (grib_accessor_bufr_extract_subsets_t*)a; + + a->length = 0; + self->numericValues = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); + self->pack = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; +} + +int grib_accessor_class_bufr_extract_subsets_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} + +int grib_accessor_class_bufr_extract_subsets_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_bufr_extract_subsets_t* self = (grib_accessor_bufr_extract_subsets_t*)a; + size_t l = 1; + long v[1]; + + get_accessors(a); + + v[0] = 1; + int err = self->packAccessor->pack_long(v, &l); if (err) { + if (err == GRIB_ENCODING_ERROR) + grib_context_log(a->context, GRIB_LOG_ERROR, "Could not extract subset(s).\n\tHint: Did you forget to set unpack=1?"); + return err; + } + + return err; +} diff --git a/src/accessor/grib_accessor_class_bufr_extract_subsets.h b/src/accessor/grib_accessor_class_bufr_extract_subsets.h new file mode 100644 index 000000000..3015d87ae --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_extract_subsets.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_bufr_extract_subsets_t : public grib_accessor_gen_t +{ +public: + /* Members defined in bufr_extract_subsets */ + const char* numericValues; + const char* pack; + grib_accessor* numericValuesAccessor; + grib_accessor* packAccessor; +}; + +class grib_accessor_class_bufr_extract_subsets_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_bufr_extract_subsets_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufr_extract_subsets_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_bufr_group.cc b/src/accessor/grib_accessor_class_bufr_group.cc new file mode 100644 index 000000000..71249f70d --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_group.cc @@ -0,0 +1,38 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_bufr_group.h" + +grib_accessor_class_bufr_group_t _grib_accessor_class_bufr_group{"bufr_group"}; +grib_accessor_class* grib_accessor_class_bufr_group = &_grib_accessor_class_bufr_group; + + +void grib_accessor_class_bufr_group_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_section(dumper, a, a->sub_section->block); +} + +grib_accessor* grib_accessor_class_bufr_group_t::next(grib_accessor* a, int explore) +{ + grib_accessor* next = NULL; + if (explore) { + next = a->sub_section->block->first; + if (!next) + next = a->next_; + } + else { + next = a->next_; + } + if (!next) { + if (a->parent->owner) + next = a->parent->owner->cclass->next(a->parent->owner, 0); + } + return next; +} diff --git a/src/accessor/grib_accessor_class_bufr_group.h b/src/accessor/grib_accessor_class_bufr_group.h new file mode 100644 index 000000000..758c5c772 --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_group.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_variable.h" + +class grib_accessor_bufr_group_t : public grib_accessor_variable_t +{ +public: + /* Members defined in bufr_group */ +}; + +class grib_accessor_class_bufr_group_t : public grib_accessor_class_variable_t +{ +public: + grib_accessor_class_bufr_group_t(const char* name) : grib_accessor_class_variable_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufr_group_t{}; } + void dump(grib_accessor*, grib_dumper*) override; + grib_accessor* next(grib_accessor* a, int explore) override; +}; diff --git a/src/accessor/grib_accessor_class_bufr_simple_thinning.cc b/src/accessor/grib_accessor_class_bufr_simple_thinning.cc new file mode 100644 index 000000000..a74d7a74c --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_simple_thinning.cc @@ -0,0 +1,118 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_bufr_simple_thinning.h" + +grib_accessor_class_bufr_simple_thinning_t _grib_accessor_class_bufr_simple_thinning{ "bufr_simple_thinning" }; +grib_accessor_class* grib_accessor_class_bufr_simple_thinning = &_grib_accessor_class_bufr_simple_thinning; + + +void grib_accessor_class_bufr_simple_thinning_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_gen_t::init(a, len, arg); + grib_accessor_bufr_simple_thinning_t* self = (grib_accessor_bufr_simple_thinning_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int n = 0; + + a->length = 0; + self->doExtractSubsets = grib_arguments_get_name(h, arg, n++); + self->numberOfSubsets = grib_arguments_get_name(h, arg, n++); + self->extractSubsetList = grib_arguments_get_name(h, arg, n++); + self->simpleThinningStart = grib_arguments_get_name(h, arg, n++); + self->simpleThinningMissingRadius = grib_arguments_get_name(h, arg, n++); + self->simpleThinningSkip = grib_arguments_get_name(h, arg, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; +} + +int grib_accessor_class_bufr_simple_thinning_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_LONG; +} + +static int apply_thinning(grib_accessor* a) +{ + const grib_accessor_bufr_simple_thinning_t* self = (grib_accessor_bufr_simple_thinning_t*)a; + + long skip; + grib_handle* h = grib_handle_of_accessor(a); + grib_context* c = h->context; + long compressed = 0, nsubsets; + grib_iarray* subsets; + long* subsets_ar = 0; + long start = 0, radius = 0; + + int ret = grib_get_long(h, "compressedData", &compressed); + if (ret) + return ret; + if (compressed) { + long numberOfSubsets = 0; + ret = grib_get_long(h, self->numberOfSubsets, &numberOfSubsets); + if (ret) + return ret; + + ret = grib_get_long(h, self->simpleThinningStart, &start); + if (ret) + return ret; + + ret = grib_get_long(h, self->simpleThinningSkip, &skip); + if (ret) + return ret; + if (skip <= 0) + return GRIB_INVALID_KEY_VALUE; + + ret = grib_get_long(h, self->simpleThinningMissingRadius, &radius); + if (ret) + return ret; + + subsets = grib_iarray_new(c, numberOfSubsets / skip + 1, 10); + for (long i = 0; i < numberOfSubsets; i += skip + 1) { + grib_iarray_push(subsets, i + 1); + } + + nsubsets = grib_iarray_used_size(subsets); + + if (nsubsets != 0) { + subsets_ar = grib_iarray_get_array(subsets); + ret = grib_set_long_array(h, self->extractSubsetList, subsets_ar, nsubsets); + grib_context_free(c, subsets_ar); + if (ret) + return ret; + + ret = grib_set_long(h, "unpack", 1); + if (ret) + return ret; + + ret = grib_set_long(h, self->doExtractSubsets, 1); + if (ret) + return ret; + } + grib_iarray_delete(subsets); + } + else { + return GRIB_NOT_IMPLEMENTED; + } + + return ret; +} + +int grib_accessor_class_bufr_simple_thinning_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + const grib_accessor_bufr_simple_thinning_t* self = (grib_accessor_bufr_simple_thinning_t*)a; + + if (*len == 0) + return GRIB_SUCCESS; + int err = apply_thinning(a); + if (err) + return err; + + return grib_set_long(a->parent->h, self->doExtractSubsets, 1); +} diff --git a/src/accessor/grib_accessor_class_bufr_simple_thinning.h b/src/accessor/grib_accessor_class_bufr_simple_thinning.h new file mode 100644 index 000000000..9b7467914 --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_simple_thinning.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_bufr_simple_thinning_t : public grib_accessor_gen_t +{ +public: + /* Members defined in bufr_simple_thinning */ + const char* doExtractSubsets; + const char* numberOfSubsets; + const char* extractSubsetList; + const char* simpleThinningStart; + const char* simpleThinningMissingRadius; + const char* simpleThinningSkip; +}; + +class grib_accessor_class_bufr_simple_thinning_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_bufr_simple_thinning_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufr_simple_thinning_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_bufr_string_values.cc b/src/accessor/grib_accessor_class_bufr_string_values.cc new file mode 100644 index 000000000..31e616b6f --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_string_values.cc @@ -0,0 +1,92 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_bufr_string_values.h" +#include "grib_accessor_class_bufr_data_array.h" + +grib_accessor_class_bufr_string_values_t _grib_accessor_class_bufr_string_values{ "bufr_string_values" }; +grib_accessor_class* grib_accessor_class_bufr_string_values = &_grib_accessor_class_bufr_string_values; + + +void grib_accessor_class_bufr_string_values_t::init(grib_accessor* a, const long len, grib_arguments* args) +{ + grib_accessor_class_ascii_t::init(a, len, args); + grib_accessor_bufr_string_values_t* self = (grib_accessor_bufr_string_values_t*)a; + int n = 0; + self->dataAccessorName = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->dataAccessor = NULL; + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +void grib_accessor_class_bufr_string_values_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + grib_dump_string_array(dumper, a, NULL); +} + +static grib_accessor* get_accessor(grib_accessor* a) +{ + grib_accessor_bufr_string_values_t* self = (grib_accessor_bufr_string_values_t*)a; + if (!self->dataAccessor) { + self->dataAccessor = grib_find_accessor(grib_handle_of_accessor(a), self->dataAccessorName); + } + return self->dataAccessor; +} + +int grib_accessor_class_bufr_string_values_t::unpack_string_array(grib_accessor* a, char** buffer, size_t* len) +{ + grib_accessor* data = 0; + grib_context* c = a->context; + grib_vsarray* stringValues = NULL; + size_t l = 0, tl; + size_t i, j, n = 0; + char** b = buffer; + + data = get_accessor(a); + if (!data) + return GRIB_NOT_FOUND; + + stringValues = accessor_bufr_data_array_get_stringValues(data); + + n = grib_vsarray_used_size(stringValues); + + tl = 0; + for (j = 0; j < n; j++) { + l = grib_sarray_used_size(stringValues->v[j]); + tl += l; + + if (tl > *len) + return GRIB_ARRAY_TOO_SMALL; + + for (i = 0; i < l; i++) { + *(b++) = grib_context_strdup(c, stringValues->v[j]->v[i]); + } + } + *len = tl; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_bufr_string_values_t::unpack_string(grib_accessor* a, char* val, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_bufr_string_values_t::value_count(grib_accessor* a, long* rlen) +{ + grib_accessor* descriptors = get_accessor(a); + return descriptors->value_count(rlen); +} + +void grib_accessor_class_bufr_string_values_t::destroy(grib_context* c, grib_accessor* a) +{ + grib_accessor_class_ascii_t::destroy(c, a); +} diff --git a/src/accessor/grib_accessor_class_bufr_string_values.h b/src/accessor/grib_accessor_class_bufr_string_values.h new file mode 100644 index 000000000..fe6c2acb7 --- /dev/null +++ b/src/accessor/grib_accessor_class_bufr_string_values.h @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_bufr_string_values_t : public grib_accessor_ascii_t +{ +public: + /* Members defined in bufr_string_values */ + const char* dataAccessorName; + grib_accessor* dataAccessor; +}; + +class grib_accessor_class_bufr_string_values_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_bufr_string_values_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufr_string_values_t{}; } + int unpack_string(grib_accessor*, char*, size_t* len) override; + int unpack_string_array(grib_accessor*, char**, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_bufrdc_expanded_descriptors.cc b/src/accessor/grib_accessor_class_bufrdc_expanded_descriptors.cc new file mode 100644 index 000000000..bd411d510 --- /dev/null +++ b/src/accessor/grib_accessor_class_bufrdc_expanded_descriptors.cc @@ -0,0 +1,99 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_bufrdc_expanded_descriptors.h" + +grib_accessor_class_bufrdc_expanded_descriptors_t _grib_accessor_class_bufrdc_expanded_descriptors{"bufrdc_expanded_descriptors"}; +grib_accessor_class* grib_accessor_class_bufrdc_expanded_descriptors = &_grib_accessor_class_bufrdc_expanded_descriptors; + + +void grib_accessor_class_bufrdc_expanded_descriptors_t::init(grib_accessor* a, const long len, grib_arguments* args){ + grib_accessor_class_long_t::init(a, len, args); + grib_accessor_bufrdc_expanded_descriptors_t* self = (grib_accessor_bufrdc_expanded_descriptors_t*)a; + int n = 0; + self->expandedDescriptors = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->expandedDescriptorsAccessor = 0; + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +static grib_accessor* get_accessor(grib_accessor* a) +{ + grib_accessor_bufrdc_expanded_descriptors_t* self = (grib_accessor_bufrdc_expanded_descriptors_t*)a; + if (!self->expandedDescriptorsAccessor) { + self->expandedDescriptorsAccessor = grib_find_accessor(grib_handle_of_accessor(a), self->expandedDescriptors); + } + return self->expandedDescriptorsAccessor; +} + +int grib_accessor_class_bufrdc_expanded_descriptors_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor* descriptors = 0; + size_t rlen = 0, l; + long lenall = 0; + size_t i = 0; + long* v = 0; + grib_context* c = a->context; + + descriptors = get_accessor(a); + if (!descriptors) return GRIB_NOT_FOUND; + + a->value_count(&lenall); v = (long*)grib_context_malloc_clear(c, sizeof(long) * lenall); + l = lenall; + descriptors->unpack_long(v, &l); + rlen = 0; + for (i = 0; i < l; i++) { + if ((v[i] < 100000 || v[i] > 221999)) + val[rlen++] = v[i]; + } + *len = rlen; + grib_context_free(c,v); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_bufrdc_expanded_descriptors_t::unpack_string_array(grib_accessor* a, char** buffer, size_t* len){ + int err = 0; + grib_accessor* descriptors = 0; + size_t l = 0; + long lenall = 0; + size_t i = 0; + long* v = 0; + char buf[25] = {0,}; + grib_context* c = a->context; + + descriptors = get_accessor(a); + if (!descriptors) return GRIB_NOT_FOUND; + + err = a->value_count(&lenall); if (err) return err; + l = lenall; + if (l > *len) return GRIB_ARRAY_TOO_SMALL; + + v = (long*)grib_context_malloc_clear(c, sizeof(long) * l); + err = descriptors->unpack_long(v, &l); if (err) return err; + + for (i = 0; i < l; i++) { + snprintf(buf, sizeof(buf), "%06ld", v[i]); + buffer[i] = grib_context_strdup(c, buf); + } + *len = l; + grib_context_free(c,v); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_bufrdc_expanded_descriptors_t::value_count(grib_accessor* a, long* rlen){ + grib_accessor* descriptors = get_accessor(a); + + return descriptors->value_count(rlen);} + +void grib_accessor_class_bufrdc_expanded_descriptors_t::destroy(grib_context* c, grib_accessor* a){ + grib_accessor_class_long_t::destroy(c, a); +} diff --git a/src/accessor/grib_accessor_class_bufrdc_expanded_descriptors.h b/src/accessor/grib_accessor_class_bufrdc_expanded_descriptors.h new file mode 100644 index 000000000..92cf595ad --- /dev/null +++ b/src/accessor/grib_accessor_class_bufrdc_expanded_descriptors.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_bufrdc_expanded_descriptors_t : public grib_accessor_long_t +{ +public: + /* Members defined in bufrdc_expanded_descriptors */ + const char* expandedDescriptors; + grib_accessor* expandedDescriptorsAccessor; +}; + +class grib_accessor_class_bufrdc_expanded_descriptors_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_bufrdc_expanded_descriptors_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bufrdc_expanded_descriptors_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string_array(grib_accessor*, char**, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_bytes.cc b/src/accessor/grib_accessor_class_bytes.cc new file mode 100644 index 000000000..47c8713ae --- /dev/null +++ b/src/accessor/grib_accessor_class_bytes.cc @@ -0,0 +1,99 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_bytes.h" + +grib_accessor_class_bytes_t _grib_accessor_class_bytes{"bytes"}; +grib_accessor_class* grib_accessor_class_bytes = &_grib_accessor_class_bytes; + + +void grib_accessor_class_bytes_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + /*grib_accessor_signed* self = (grib_accessor_signed*)a; */ + a->length = len; + Assert(a->length >= 0); +} + +int grib_accessor_class_bytes_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_BYTES; +} + +int grib_accessor_class_bytes_t::compare(grib_accessor* a, grib_accessor* b){ + int retval = GRIB_SUCCESS; + + size_t alen = (size_t)a->byte_count(); size_t blen = (size_t)b->byte_count(); + if (alen != blen) + return GRIB_COUNT_MISMATCH; + + return retval; +} + +int grib_accessor_class_bytes_t::unpack_string(grib_accessor* a, char* v, size_t* len){ + unsigned char* p = NULL; + char* s = v; + long i = 0; + const long length = a->byte_count(); const long slength = 2 * length; + + if (*len < (size_t)slength) { + *len = slength; + return GRIB_BUFFER_TOO_SMALL; + } + + p = grib_handle_of_accessor(a)->buffer->data + a->byte_offset(); + for (i = 0; i < length; i++) { + snprintf(s, INT_MAX, "%02x", *(p++)); + s += 2; + } + + *len = slength; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_bytes_t::pack_string(grib_accessor* a, const char* val, size_t* len){ + /* The string representation (val) of the byte array will have two chars + * per byte e.g. 4C5B means the 2 bytes 0114 and 0133 in octal + * so has to be twice the length of the byte array + */ + int err = 0; + grib_context* c = a->context; + size_t nbytes = a->length; + const size_t expected_blen = nbytes; + const size_t expected_slen = 2 * expected_blen; + unsigned char* bytearray = NULL; + size_t i = 0, slen = strlen(val); + + if (slen != expected_slen || *len != expected_slen) { + grib_context_log(c, GRIB_LOG_ERROR, + "%s: Key %s is %lu bytes. Expected a string with %lu characters (actual length=%zu)", + __func__, a->name, expected_blen, expected_slen, *len); + return GRIB_WRONG_ARRAY_SIZE; + } + + bytearray = (unsigned char*)grib_context_malloc(c, nbytes * (sizeof(unsigned char))); + if (!bytearray) return GRIB_OUT_OF_MEMORY; + + for (i = 0; i < (slen/2); i++) { + unsigned int byteVal = 0; + if (sscanf(val + 2*i, "%02x", &byteVal) != 1) { + grib_context_log(c, GRIB_LOG_ERROR,"%s: Invalid hex byte specfication '%.2s'", __func__, val + 2*i); + grib_context_free(c, bytearray); + return GRIB_INVALID_KEY_VALUE; + } + Assert(byteVal < 256); + bytearray[i] = (int)byteVal; + } + + /* Forward to base class to pack the byte array */ + err = grib_accessor_class_gen_t::pack_bytes(a, bytearray, &nbytes); + grib_context_free(c, bytearray); + return err; +} diff --git a/src/accessor/grib_accessor_class_bytes.h b/src/accessor/grib_accessor_class_bytes.h new file mode 100644 index 000000000..676cf55c4 --- /dev/null +++ b/src/accessor/grib_accessor_class_bytes.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_bytes_t : public grib_accessor_gen_t +{ +public: + /* Members defined in bytes */ +}; + +class grib_accessor_class_bytes_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_bytes_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_bytes_t{}; } + int get_native_type(grib_accessor*) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_change_alternative_row_scanning.cc b/src/accessor/grib_accessor_class_change_alternative_row_scanning.cc new file mode 100644 index 000000000..50475b6a6 --- /dev/null +++ b/src/accessor/grib_accessor_class_change_alternative_row_scanning.cc @@ -0,0 +1,117 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_change_alternative_row_scanning.h" + +grib_accessor_class_change_alternative_row_scanning_t _grib_accessor_class_change_alternative_row_scanning{"change_alternative_row_scanning"}; +grib_accessor_class* grib_accessor_class_change_alternative_row_scanning = &_grib_accessor_class_change_alternative_row_scanning; + + +void grib_accessor_class_change_alternative_row_scanning_t::init(grib_accessor* a, const long len, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, len, args); + int n = 0; + grib_accessor_change_alternative_row_scanning_t* self = (grib_accessor_change_alternative_row_scanning_t*)a; + + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->Ni = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->Nj = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->alternativeRowScanning = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_change_alternative_row_scanning_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + int err = 0; + grib_accessor_change_alternative_row_scanning_t* self = (grib_accessor_change_alternative_row_scanning_t*)a; + const grib_context* c = a->context; + grib_handle* h = grib_handle_of_accessor(a); + long i, j, jr, theEnd, Ni, Nj, k, kp, alternativeRowScanning; + size_t size = 0; + double* values = NULL; + double tmp = 0.0; + + if (*val == 0) + return 0; + + /* Make sure Ni / Nj are not missing */ + if (grib_is_missing(h, self->Ni, &err) && !err) { + grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: Key %s cannot be 'missing'!", self->Ni); + return GRIB_WRONG_GRID; + } + if (grib_is_missing(h, self->Nj, &err) && !err) { + grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: Key %s cannot be 'missing'!", self->Nj); + return GRIB_WRONG_GRID; + } + + if ((err = grib_get_long_internal(h, self->Ni, &Ni)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(h, self->Nj, &Nj)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(h, self->alternativeRowScanning, &alternativeRowScanning)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) + return err; + + if ( size > (size_t)(Ni * Nj) ) { + grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: wrong values size!=Ni*Nj (%zu!=%ld*%ld)", size, Ni, Nj); + return GRIB_WRONG_ARRAY_SIZE; + } + + values = (double*)grib_context_malloc(c, size * sizeof(double)); + if (!values) + return GRIB_OUT_OF_MEMORY; + + if ((err = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return err; + } + + theEnd = Ni / 2; + for (j = 0; j < Nj; j++) { + jr = Ni * j; + for (i = 0; i < theEnd; i++) { + if (j % 2 == 1) { + /* Swap first and last value on every odd row */ + k = jr + i; + kp = jr + Ni - i - 1; + tmp = values[k]; + values[k] = values[kp]; + values[kp] = tmp; + } + } + } + alternativeRowScanning = !alternativeRowScanning; + if ((err = grib_set_long_internal(h, self->alternativeRowScanning, alternativeRowScanning)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return err; + } + + if ((err = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return err; + } + + grib_context_free(c, values); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_change_alternative_row_scanning_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} + +int grib_accessor_class_change_alternative_row_scanning_t::unpack_long(grib_accessor* a, long* v, size_t* len){ + /* Decoding this accessor doesn't make sense so we return a dummy value */ + *v = -1; + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_change_alternative_row_scanning.h b/src/accessor/grib_accessor_class_change_alternative_row_scanning.h new file mode 100644 index 000000000..f889931a0 --- /dev/null +++ b/src/accessor/grib_accessor_class_change_alternative_row_scanning.h @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_change_alternative_row_scanning_t : public grib_accessor_gen_t +{ +public: + /* Members defined in change_alternative_row_scanning */ + const char* values; + const char* Ni; + const char* Nj; + const char* alternativeRowScanning; +}; + +class grib_accessor_class_change_alternative_row_scanning_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_change_alternative_row_scanning_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_change_alternative_row_scanning_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_change_scanning_direction.cc b/src/accessor/grib_accessor_class_change_scanning_direction.cc similarity index 56% rename from src/grib_accessor_class_change_scanning_direction.cc rename to src/accessor/grib_accessor_class_change_scanning_direction.cc index f951c9083..e3b6144c9 100644 --- a/src/grib_accessor_class_change_scanning_direction.cc +++ b/src/accessor/grib_accessor_class_change_scanning_direction.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,116 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = pack_long; - IMPLEMENTS = unpack_long - IMPLEMENTS = init;get_native_type - MEMBERS = const char* values - MEMBERS = const char* Ni - MEMBERS = const char* Nj - MEMBERS = const char* i_scans_negatively - MEMBERS = const char* j_scans_positively - MEMBERS = const char* first - MEMBERS = const char* last - MEMBERS = const char* axis - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_change_scanning_direction -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in change_scanning_direction */ - const char* values; - const char* Ni; - const char* Nj; - const char* i_scans_negatively; - const char* j_scans_positively; - const char* first; - const char* last; - const char* axis; -} grib_accessor_change_scanning_direction; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_change_scanning_direction = { - &grib_accessor_class_gen, /* super */ - "change_scanning_direction", /* name */ - sizeof(grib_accessor_change_scanning_direction), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_change_scanning_direction.h" +grib_accessor_class_change_scanning_direction_t _grib_accessor_class_change_scanning_direction{"change_scanning_direction"}; grib_accessor_class* grib_accessor_class_change_scanning_direction = &_grib_accessor_class_change_scanning_direction; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_change_scanning_direction* self = (grib_accessor_change_scanning_direction*)a; +void grib_accessor_class_change_scanning_direction_t::init(grib_accessor* a, const long len, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, len, args); + grib_accessor_change_scanning_direction_t* self = (grib_accessor_change_scanning_direction_t*)a; grib_handle* h = grib_handle_of_accessor(a); int n = 0; @@ -134,8 +34,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* args) a->length = 0; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ +int grib_accessor_class_change_scanning_direction_t::pack_long(grib_accessor* a, const long* val, size_t* len){ int err = 0; long i, j, jr, theEnd, Ni, Nj, k, kp; double tmp; @@ -145,7 +44,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) double last = 0; size_t size = 0; double* values = NULL; - grib_accessor_change_scanning_direction* self = (grib_accessor_change_scanning_direction*)a; + grib_accessor_change_scanning_direction_t* self = (grib_accessor_change_scanning_direction_t*)a; const grib_context* c = a->context; grib_handle* h = grib_handle_of_accessor(a); const char* cclass_name = a->cclass->name; @@ -248,13 +147,11 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_SUCCESS; } -static int get_native_type(grib_accessor* a) -{ +int grib_accessor_class_change_scanning_direction_t::get_native_type(grib_accessor* a){ return GRIB_TYPE_LONG; } -static int unpack_long(grib_accessor* a, long* v, size_t* len) -{ +int grib_accessor_class_change_scanning_direction_t::unpack_long(grib_accessor* a, long* v, size_t* len){ /* ECC-976: decoding this accessor doesn't make sense so we return a dummy value */ *v = -1; return GRIB_SUCCESS; diff --git a/src/accessor/grib_accessor_class_change_scanning_direction.h b/src/accessor/grib_accessor_class_change_scanning_direction.h new file mode 100644 index 000000000..ead274485 --- /dev/null +++ b/src/accessor/grib_accessor_class_change_scanning_direction.h @@ -0,0 +1,39 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_change_scanning_direction_t : public grib_accessor_gen_t +{ +public: + /* Members defined in change_scanning_direction */ + const char* values; + const char* Ni; + const char* Nj; + const char* i_scans_negatively; + const char* j_scans_positively; + const char* first; + const char* last; + const char* axis; +}; + +class grib_accessor_class_change_scanning_direction_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_change_scanning_direction_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_change_scanning_direction_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_check_internal_version.cc b/src/accessor/grib_accessor_class_check_internal_version.cc new file mode 100644 index 000000000..f8ceb1896 --- /dev/null +++ b/src/accessor/grib_accessor_class_check_internal_version.cc @@ -0,0 +1,51 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_check_internal_version.h" + +grib_accessor_class_check_internal_version_t _grib_accessor_class_check_internal_version{"check_internal_version"}; +grib_accessor_class* grib_accessor_class_check_internal_version = &_grib_accessor_class_check_internal_version; + + +/* This is the internal engine version number */ +/* We check this against the version number found in the definitions boot.def file */ +/* See the key "internalVersion" */ +#define LATEST_ENGINE_VERSION 30 + +void grib_accessor_class_check_internal_version_t::init(grib_accessor* a, const long l, grib_arguments* args){ + grib_accessor_class_ascii_t::init(a, l, args); + /* Check version of definition files is compatible with the engine */ + int err = 0; + long defs_file_version = 0; + grib_handle* h = grib_handle_of_accessor(a); + const char* s_defn_version = grib_arguments_get_name(h, args, 0); + Assert(s_defn_version); + + err = grib_get_long_internal(h, s_defn_version, &defs_file_version); + if (!err) { + if (defs_file_version > LATEST_ENGINE_VERSION) { + grib_context_log(h->context, GRIB_LOG_FATAL, + "Definition files version (%d) is greater than engine version (%d)!\n" + " " /* indent for 2nd line */ + "These definition files are for a later version of the ecCodes engine.", + defs_file_version, LATEST_ENGINE_VERSION); + } + } +} + +int grib_accessor_class_check_internal_version_t::value_count(grib_accessor* a, long* count){ + *count = 1; + return 0; +} + +size_t grib_accessor_class_check_internal_version_t::string_length(grib_accessor* a){ + return 255; +} diff --git a/src/accessor/grib_accessor_class_check_internal_version.h b/src/accessor/grib_accessor_class_check_internal_version.h new file mode 100644 index 000000000..d37b57282 --- /dev/null +++ b/src/accessor/grib_accessor_class_check_internal_version.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_check_internal_version_t : public grib_accessor_ascii_t +{ +public: + /* Members defined in check_internal_version */ +}; + +class grib_accessor_class_check_internal_version_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_check_internal_version_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_check_internal_version_t{}; } + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_closest_date.cc b/src/accessor/grib_accessor_class_closest_date.cc similarity index 57% rename from src/grib_accessor_class_closest_date.cc rename to src/accessor/grib_accessor_class_closest_date.cc index 08ba9f333..b0b3bb512 100644 --- a/src/grib_accessor_class_closest_date.cc +++ b/src/accessor/grib_accessor_class_closest_date.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,122 +9,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" +#include "grib_accessor_class_closest_date.h" #include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = dump - IMPLEMENTS = init - MEMBERS = const char *dateLocal - MEMBERS = const char *timeLocal - MEMBERS = const char *numForecasts - MEMBERS = const char *year - MEMBERS = const char *month - MEMBERS = const char *day - MEMBERS = const char *hour - MEMBERS = const char *minute - MEMBERS = const char *second - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_closest_date -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in closest_date */ - const char *dateLocal; - const char *timeLocal; - const char *numForecasts; - const char *year; - const char *month; - const char *day; - const char *hour; - const char *minute; - const char *second; -} grib_accessor_closest_date; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_closest_date = { - &grib_accessor_class_double, /* super */ - "closest_date", /* name */ - sizeof(grib_accessor_closest_date), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - +grib_accessor_class_closest_date_t _grib_accessor_class_closest_date{"closest_date"}; grib_accessor_class* grib_accessor_class_closest_date = &_grib_accessor_class_closest_date; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_closest_date* self = (grib_accessor_closest_date*)a; +void grib_accessor_class_closest_date_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_closest_date_t* self = (grib_accessor_closest_date_t*)a; grib_handle* h = grib_handle_of_accessor(a); int n = 0; @@ -140,13 +35,11 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) a->length = 0; } -static void dump(grib_accessor* a, grib_dumper* dumper) -{ +void grib_accessor_class_closest_date_t::dump(grib_accessor* a, grib_dumper* dumper){ grib_dump_string(dumper, a, NULL); } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ +int grib_accessor_class_closest_date_t::unpack_long(grib_accessor* a, long* val, size_t* len){ int ret = 0; double v = 0; @@ -157,9 +50,8 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) } /* Sets val to the 'index' of the closes date */ -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - const grib_accessor_closest_date* self = (grib_accessor_closest_date*)a; +int grib_accessor_class_closest_date_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + const grib_accessor_closest_date_t* self = (grib_accessor_closest_date_t*)a; int err = 0; long num_forecasts = 0; /* numberOfForecastsUsedInLocalTime */ diff --git a/src/accessor/grib_accessor_class_closest_date.h b/src/accessor/grib_accessor_class_closest_date.h new file mode 100644 index 000000000..ebd3cb6d4 --- /dev/null +++ b/src/accessor/grib_accessor_class_closest_date.h @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_closest_date_t : public grib_accessor_double_t +{ +public: + /* Members defined in closest_date */ + const char *dateLocal; + const char *timeLocal; + const char *numForecasts; + const char *year; + const char *month; + const char *day; + const char *hour; + const char *minute; + const char *second; +}; + +class grib_accessor_class_closest_date_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_closest_date_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_closest_date_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_codeflag.cc b/src/accessor/grib_accessor_class_codeflag.cc new file mode 100644 index 000000000..6cfda6942 --- /dev/null +++ b/src/accessor/grib_accessor_class_codeflag.cc @@ -0,0 +1,124 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_codeflag.h" + +grib_accessor_class_codeflag_t _grib_accessor_class_codeflag{ "codeflag" }; +grib_accessor_class* grib_accessor_class_codeflag = &_grib_accessor_class_codeflag; + + +void grib_accessor_class_codeflag_t::init(grib_accessor* a, const long len, grib_arguments* param) +{ + grib_accessor_class_unsigned_t::init(a, len, param); + grib_accessor_codeflag_t* self = (grib_accessor_codeflag_t*)a; + a->length = len; + self->tablename = grib_arguments_get_string(grib_handle_of_accessor(a), param, 0); + Assert(a->length >= 0); +} + +static int test_bit(long a, long b) +{ + DEBUG_ASSERT(b >= 0); + return a & (1 << b); +} + +static int grib_get_codeflag(grib_accessor* a, long code, char* codename) +{ + const grib_accessor_codeflag_t* self = (grib_accessor_codeflag_t*)a; + FILE* f = NULL; + char fname[1024]; + char bval[50]; + char num[50]; + char* filename = 0; + char line[1024]; + size_t i = 0; + int j = 0; + int err = 0; + + err = grib_recompose_name(grib_handle_of_accessor(a), NULL, self->tablename, fname, 1); + if (err) { + strncpy(fname, self->tablename, sizeof(fname) - 1); + fname[sizeof(fname) - 1] = '\0'; + } + + if ((filename = grib_context_full_defs_path(a->context, fname)) == NULL) { + grib_context_log(a->context, GRIB_LOG_WARNING, "Cannot open flag table %s", filename); + strcpy(codename, "Cannot open flag table"); + return GRIB_FILE_NOT_FOUND; + } + + f = codes_fopen(filename, "r"); + if (!f) { + grib_context_log(a->context, (GRIB_LOG_WARNING) | (GRIB_LOG_PERROR), "Cannot open flag table %s", filename); + strcpy(codename, "Cannot open flag table"); + return GRIB_FILE_NOT_FOUND; + } + + // strcpy(codename, self->tablename); + // strcat(codename,": "); + // j = strlen(codename); + + while (fgets(line, sizeof(line) - 1, f)) { + sscanf(line, "%49s %49s", num, bval); + + if (num[0] != '#') { + if ((test_bit(code, a->length * 8 - atol(num)) > 0) == atol(bval)) { + size_t linelen = strlen(line); + codename[j++] = '('; + codename[j++] = num[0]; + codename[j++] = '='; + codename[j++] = bval[0]; + codename[j++] = ')'; + codename[j++] = ' '; + if (j) + codename[j++] = ' '; + + for (i = (strlen(num) + strlen(bval) + 2); i < linelen - 1; i++) + codename[j++] = line[i]; + if (line[i] != '\n') + codename[j++] = line[i]; + codename[j++] = ';'; + } + } + } + + if (j > 1 && codename[j - 1] == ';') + j--; + codename[j] = 0; + + strcat(codename, ":"); + strcat(codename, fname); + + fclose(f); + return GRIB_SUCCESS; +} + +int grib_accessor_class_codeflag_t::value_count(grib_accessor* a, long* count) +{ + *count = 1; + return 0; +} + +void grib_accessor_class_codeflag_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + const grib_accessor_codeflag_t* self = (grib_accessor_codeflag_t*)a; + long v = 0; + char flagname[1024] = {0,}; + char fname[1024] = {0,}; + + size_t llen = 1; + + grib_recompose_name(grib_handle_of_accessor(a), NULL, self->tablename, fname, 1); + a->unpack_long(&v, &llen); + grib_get_codeflag(a, v, flagname); + + grib_dump_bits(dumper, a, flagname); +} diff --git a/src/accessor/grib_accessor_class_codeflag.h b/src/accessor/grib_accessor_class_codeflag.h new file mode 100644 index 000000000..82c8cc77b --- /dev/null +++ b/src/accessor/grib_accessor_class_codeflag.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_unsigned.h" + +class grib_accessor_codeflag_t : public grib_accessor_unsigned_t +{ +public: + /* Members defined in codeflag */ + const char* tablename; +}; + +class grib_accessor_class_codeflag_t : public grib_accessor_class_unsigned_t +{ +public: + grib_accessor_class_codeflag_t(const char* name) : grib_accessor_class_unsigned_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_codeflag_t{}; } + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_codetable.cc b/src/accessor/grib_accessor_class_codetable.cc similarity index 80% rename from src/grib_accessor_class_codetable.cc rename to src/accessor/grib_accessor_class_codetable.cc index 9e39ed633..f21ef0f86 100644 --- a/src/grib_accessor_class_codetable.cc +++ b/src/accessor/grib_accessor_class_codetable.cc @@ -8,18 +8,19 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/***************************************** - * Enrico Fucile - ****************************************/ - -#include "grib_api_internal.h" +#include "grib_accessor_class_codetable.h" #include + +grib_accessor_class_codetable_t _grib_accessor_class_codetable("codetable"); +grib_accessor_class* grib_accessor_class_codetable = &_grib_accessor_class_codetable; + + #if GRIB_PTHREADS static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; -static void thread_init() +void thread_init() { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); @@ -31,7 +32,7 @@ static void thread_init() static int once = 0; static omp_nest_lock_t mutex1; -static void thread_init() +void thread_init() { GRIB_OMP_CRITICAL(lock_grib_accessor_class_codetable_c) { @@ -43,123 +44,16 @@ static void thread_init() } #endif -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_unsigned - IMPLEMENTS = init;dump;unpack_string;pack_expression;unpack_long - IMPLEMENTS = value_count;pack_string; destroy; get_native_type;pack_missing - MEMBERS = const char* tablename - MEMBERS = const char* masterDir - MEMBERS = const char* localDir - MEMBERS = grib_codetable* table - MEMBERS = int table_loaded - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_missing(grib_accessor*); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int pack_expression(grib_accessor*, grib_expression*); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_codetable -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in codetable */ - const char* tablename; - const char* masterDir; - const char* localDir; - grib_codetable* table; - int table_loaded; -} grib_accessor_codetable; - -extern grib_accessor_class* grib_accessor_class_unsigned; - -static grib_accessor_class _grib_accessor_class_codetable = { - &grib_accessor_class_unsigned, /* super */ - "codetable", /* name */ - sizeof(grib_accessor_codetable), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - &pack_missing, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - &pack_expression, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_codetable = &_grib_accessor_class_codetable; - -/* END_CLASS_IMP */ - static int grib_load_codetable(grib_context* c, const char* filename, const char* recomposed_name, size_t size, grib_codetable* t); -static void init(grib_accessor* a, const long len, grib_arguments* params) +void grib_accessor_class_codetable_t::init(grib_accessor* a, const long len, grib_arguments* params) { + grib_accessor_class_unsigned_t::init(a, len, params); + int n = 0; long new_len = len; grib_handle* hand = grib_handle_of_accessor(a); - grib_accessor_codetable* self = (grib_accessor_codetable*)a; + grib_accessor_codetable_t* self = (grib_accessor_codetable_t*)a; grib_action* act = (grib_action*)(a->creator); DEBUG_ASSERT(len == self->nbytes); @@ -195,7 +89,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* params) a->length = 0; if (!a->vvalue) a->vvalue = (grib_virtual_value*)grib_context_malloc_clear(a->context, sizeof(grib_virtual_value)); - a->vvalue->type = grib_accessor_get_native_type(a); + a->vvalue->type = a->get_native_type(); a->vvalue->length = new_len; if (act->default_value != NULL) { const char* p = 0; @@ -209,12 +103,12 @@ static void init(grib_accessor* a, const long len, grib_arguments* params) switch (type) { case GRIB_TYPE_DOUBLE: grib_expression_evaluate_double(hand, expression, &d); - grib_pack_double(a, &d, &s_len); + a->pack_double(&d, &s_len); break; case GRIB_TYPE_LONG: grib_expression_evaluate_long(grib_handle_of_accessor(a), expression, &l); - grib_pack_long(a, &l, &s_len); + a->pack_long(&l, &s_len); break; default: @@ -248,6 +142,7 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b) return (*a == 0 && *b == 0) ? 0 : 1; } +// Cater for parameters being NULL static int str_eq(const char* a, const char* b) { if (a && b && (grib_inline_strcmp(a, b) == 0)) @@ -271,7 +166,7 @@ static void dump_codetable(grib_codetable* atable) #endif static grib_codetable* load_table(grib_accessor* a) { - grib_accessor_codetable* self = (grib_accessor_codetable*)a; + grib_accessor_codetable_t* self = (grib_accessor_codetable_t*)a; size_t size = 0; grib_handle* h = ((grib_accessor*)self)->parent->h; grib_context* c = h->context; @@ -342,7 +237,7 @@ static grib_codetable* load_table(grib_accessor* a) size = a->vvalue->length * 8; } else { - size = grib_byte_count((grib_accessor*)self) * 8; + size = ((grib_accessor*)self)->byte_count() * 8; } size = (1ULL << size); /* 2^size - 64bits */ @@ -538,10 +433,10 @@ int codes_codetable_get_contents_malloc(const grib_handle* h, const char* key, c return GRIB_INVALID_ARGUMENT; // key is not a codetable } - const grib_accessor_codetable* ca = (const grib_accessor_codetable*)aa; // could be dynamic_cast + const grib_accessor_codetable_t* ca = (const grib_accessor_codetable_t*)aa; // could be dynamic_cast // Decode the key itself. This will either fetch it from the cache or place it there - if ((err = grib_unpack_long(aa, &lvalue, &size)) != GRIB_SUCCESS) { + if ((err = aa->unpack_long(&lvalue, &size)) != GRIB_SUCCESS) { return err; } @@ -612,9 +507,9 @@ int codes_codetable_check_abbreviation(const grib_handle* h, const char* key, co return err; } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_codetable_t::dump(grib_accessor* a, grib_dumper* dumper) { - grib_accessor_codetable* self = (grib_accessor_codetable*)a; + grib_accessor_codetable_t* self = (grib_accessor_codetable_t*)a; char comment[2048]; grib_codetable* table; @@ -627,7 +522,7 @@ static void dump(grib_accessor* a, grib_dumper* dumper) } table = self->table; - grib_unpack_long(a, &value, &llen); + a->unpack_long(&value, &llen); if (value == GRIB_MISSING_LONG) { if (a->length < 4) { @@ -670,9 +565,9 @@ static void dump(grib_accessor* a, grib_dumper* dumper) grib_dump_long(dumper, a, comment); } -static int unpack_string(grib_accessor* a, char* buffer, size_t* len) +int grib_accessor_class_codetable_t::unpack_string(grib_accessor* a, char* buffer, size_t* len) { - grib_accessor_codetable* self = (grib_accessor_codetable*)a; + grib_accessor_codetable_t* self = (grib_accessor_codetable_t*)a; grib_codetable* table = NULL; size_t size = 1; @@ -681,7 +576,7 @@ static int unpack_string(grib_accessor* a, char* buffer, size_t* len) char tmp[1024]; size_t l = 0; - if ((err = grib_unpack_long(a, &value, &size)) != GRIB_SUCCESS) + if ((err = a->unpack_long(&value, &size)) != GRIB_SUCCESS) return err; if (!self->table_loaded) { @@ -714,14 +609,14 @@ static int unpack_string(grib_accessor* a, char* buffer, size_t* len) return GRIB_SUCCESS; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_codetable_t::value_count(grib_accessor* a, long* count) { *count = 1; return 0; } // Return true if the input is an integer (non-negative) -static bool is_number(const char* s) +bool is_number(const char* s) { while (*s) { if (!isdigit(*s)) @@ -731,27 +626,27 @@ static bool is_number(const char* s) return true; } -static bool strings_equal(const char* s1, const char* s2, bool case_sensitive) +bool strings_equal(const char* s1, const char* s2, bool case_sensitive) { if (case_sensitive) return (strcmp(s1, s2) == 0); return (strcmp_nocase(s1, s2) == 0); } -static int pack_string(grib_accessor* a, const char* buffer, size_t* len) +int grib_accessor_class_codetable_t::pack_string(grib_accessor* a, const char* buffer, size_t* len) { long lValue = 0; Assert(buffer); if (is_number(buffer) && string_to_long(buffer, &lValue, 1) == GRIB_SUCCESS) { // ECC-1654: If value is a pure number, just pack as long size_t l = 1; - return grib_pack_long(a, &lValue, &l); + return a->pack_long(&lValue, &l); } if (STR_EQUAL_NOCASE(buffer, "missing")) { return pack_missing(a); } - grib_accessor_codetable* self = (grib_accessor_codetable*)a; + grib_accessor_codetable_t* self = (grib_accessor_codetable_t*)a; grib_codetable* table = NULL; long i = 0; size_t size = 1; @@ -779,7 +674,7 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t* len) for (i = 0; i < table->size; i++) { if (table->entries[i].abbreviation) { if (strings_equal(table->entries[i].abbreviation, buffer, case_sensitive)) { - return grib_pack_long(a, &i, &size); + return a->pack_long(&i, &size); } } } @@ -798,12 +693,12 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t* len) switch (type) { case GRIB_TYPE_DOUBLE: grib_expression_evaluate_double(grib_handle_of_accessor(a), expression, &d); - grib_pack_double(a, &d, &s_len); + a->pack_double(&d, &s_len); break; case GRIB_TYPE_LONG: grib_expression_evaluate_long(grib_handle_of_accessor(a), expression, &l); - grib_pack_long(a, &l, &s_len); + a->pack_long(&l, &s_len); break; default: @@ -837,7 +732,7 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t* len) return GRIB_ENCODING_ERROR; } -static int pack_expression(grib_accessor* a, grib_expression* e) +int grib_accessor_class_codetable_t::pack_expression(grib_accessor* a, grib_expression* e) { const char* cval = NULL; int ret = 0; @@ -848,7 +743,7 @@ static int pack_expression(grib_accessor* a, grib_expression* e) if (strcmp(e->cclass->name, "long") == 0) { grib_expression_evaluate_long(hand, e, &lval); /* TODO: check return value */ //if (hand->context->debug) printf("ECCODES DEBUG grib_accessor_class_codetable::pack_expression %s %ld\n", a->name,lval); - ret = grib_pack_long(a, &lval, &len); + ret = a->pack_long(&lval, &len); } else { char tmp[1024]; @@ -863,20 +758,21 @@ static int pack_expression(grib_accessor* a, grib_expression* e) len = strlen(cval) + 1; //if (hand->context->debug) // printf("ECCODES DEBUG grib_accessor_class_codetable::pack_expression %s %s\n", a->name, cval); - ret = grib_pack_string(a, cval, &len); + ret = a->pack_string(cval, &len); } return ret; } -static void destroy(grib_context* context, grib_accessor* a) +void grib_accessor_class_codetable_t::destroy(grib_context* context, grib_accessor* a) { if (a->vvalue != NULL) { grib_context_free(context, a->vvalue); a->vvalue = NULL; } + grib_accessor_class_unsigned_t::destroy(context, a); } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_codetable_t::get_native_type(grib_accessor* a) { int type = GRIB_TYPE_LONG; /*printf("---------- %s flags=%ld GRIB_ACCESSOR_FLAG_STRING_TYPE=%d\n", @@ -886,16 +782,16 @@ static int get_native_type(grib_accessor* a) return type; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_codetable_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_codetable* self = (grib_accessor_codetable*)a; + grib_accessor_codetable_t* self = (grib_accessor_codetable_t*)a; long rlen = 0, i = 0; long pos = a->offset * 8; grib_handle* hand = NULL; #ifdef DEBUG { - int err = grib_value_count(a, &rlen); + int err = a->value_count(&rlen); Assert(!err); Assert(rlen == 1); } @@ -908,9 +804,9 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) } if (*len < rlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %ld values", + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%lu) for %s, it contains %ld values", *len, a->name, rlen); - *len = rlen; + *len = 0; return GRIB_ARRAY_TOO_SMALL; } @@ -934,12 +830,12 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int pack_missing(grib_accessor* a) +int grib_accessor_class_codetable_t::pack_missing(grib_accessor* a) { // Many of the code tables do have a 'Missing' entry (all bits = 1) // So it is more user-friendly to allow setting codetable keys to // missing. For tables that do not have such an entry, an error is issued - grib_accessor_codetable* self = (grib_accessor_codetable*)a; + grib_accessor_codetable_t* self = (grib_accessor_codetable_t*)a; grib_handle* h = grib_handle_of_accessor(a); const long nbytes = a->length; @@ -949,7 +845,7 @@ static int pack_missing(grib_accessor* a) int err = codes_codetable_check_code_figure(h, a->name, maxVal); if (!err) { size_t l = 1; - return grib_pack_long(a, &maxVal, &l); + return a->pack_long(&maxVal, &l); } grib_context_log(a->context, GRIB_LOG_ERROR, "There is no 'missing' entry in Code Table %s (%s)", diff --git a/src/accessor/grib_accessor_class_codetable.h b/src/accessor/grib_accessor_class_codetable.h new file mode 100644 index 000000000..8a16d9113 --- /dev/null +++ b/src/accessor/grib_accessor_class_codetable.h @@ -0,0 +1,41 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_unsigned.h" +#include + +class grib_accessor_codetable_t : public grib_accessor_unsigned_t +{ +public: + const char* tablename; + const char* masterDir; + const char* localDir; + grib_codetable* table; + int table_loaded; +}; + +class grib_accessor_class_codetable_t : public grib_accessor_class_unsigned_t +{ +public: + grib_accessor* create_empty_accessor() override { return new grib_accessor_codetable_t{}; } + grib_accessor_class_codetable_t(const char* name) : grib_accessor_class_unsigned_t(name) {} + int get_native_type(grib_accessor*) override; + int pack_missing(grib_accessor*) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int pack_expression(grib_accessor*, grib_expression*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_codetable_title.cc b/src/accessor/grib_accessor_class_codetable_title.cc new file mode 100644 index 000000000..2bcdfd215 --- /dev/null +++ b/src/accessor/grib_accessor_class_codetable_title.cc @@ -0,0 +1,72 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_codetable_title.h" +#include "grib_accessor_class_codetable.h" + +grib_accessor_class_codetable_title_t _grib_accessor_class_codetable_title{ "codetable_title" }; +grib_accessor_class* grib_accessor_class_codetable_title = &_grib_accessor_class_codetable_title; + +void grib_accessor_class_codetable_title_t::init(grib_accessor* a, const long len, grib_arguments* params) +{ + grib_accessor_class_gen_t::init(a, len, params); + grib_accessor_codetable_title_t* self = (grib_accessor_codetable_title_t*)a; + int n = 0; + self->codetable = grib_arguments_get_name(grib_handle_of_accessor(a), params, n++); + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_codetable_title_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_STRING; +} + +int grib_accessor_class_codetable_title_t::unpack_string(grib_accessor* a, char* buffer, size_t* len) +{ + grib_accessor_codetable_title_t* self = (grib_accessor_codetable_title_t*)a; + grib_codetable* table = NULL; + + size_t size = 1; + long value; + int err = GRIB_SUCCESS; + char tmp[1024]; + size_t l = 1024; + grib_accessor_codetable_t* ca = (grib_accessor_codetable_t*)grib_find_accessor(grib_handle_of_accessor(a), self->codetable); + + if ((err = ((grib_accessor*)ca)->unpack_long(&value, &size)) != GRIB_SUCCESS) + return err; + + table = ca->table; + + if (table && (value >= 0) && (value < table->size) && table->entries[value].title) { + strcpy(tmp, table->entries[value].title); + } + else { + snprintf(tmp, sizeof(tmp), "%d", (int)value); + } + + l = strlen(tmp) + 1; + + if (*len < l) { + const char* cclass_name = a->cclass->name; + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, l, *len); + *len = l; + return GRIB_BUFFER_TOO_SMALL; + } + + strcpy(buffer, tmp); + *len = l; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_codetable_title.h b/src/accessor/grib_accessor_class_codetable_title.h new file mode 100644 index 000000000..f820c585c --- /dev/null +++ b/src/accessor/grib_accessor_class_codetable_title.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_codetable_title_t : public grib_accessor_gen_t +{ +public: + /* Members defined in codetable_title */ + const char* codetable; +}; + +class grib_accessor_class_codetable_title_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_codetable_title_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_codetable_title_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_codetable_units.cc b/src/accessor/grib_accessor_class_codetable_units.cc new file mode 100644 index 000000000..cc91ae2e2 --- /dev/null +++ b/src/accessor/grib_accessor_class_codetable_units.cc @@ -0,0 +1,73 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_codetable_units.h" +#include "grib_accessor_class_codetable.h" + +grib_accessor_class_codetable_units_t _grib_accessor_class_codetable_units{ "codetable_units" }; +grib_accessor_class* grib_accessor_class_codetable_units = &_grib_accessor_class_codetable_units; + +void grib_accessor_class_codetable_units_t::init(grib_accessor* a, const long len, grib_arguments* params) +{ + grib_accessor_class_gen_t::init(a, len, params); + grib_accessor_codetable_units_t* self = (grib_accessor_codetable_units_t*)a; + + int n = 0; + self->codetable = grib_arguments_get_name(grib_handle_of_accessor(a), params, n++); + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_codetable_units_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_STRING; +} + +int grib_accessor_class_codetable_units_t::unpack_string(grib_accessor* a, char* buffer, size_t* len) +{ + grib_accessor_codetable_units_t* self = (grib_accessor_codetable_units_t*)a; + grib_codetable* table = NULL; + + size_t size = 1; + long value; + int err = GRIB_SUCCESS; + char tmp[1024]; + size_t l = sizeof(tmp); + grib_accessor_codetable_t* ca = (grib_accessor_codetable_t*)grib_find_accessor(grib_handle_of_accessor(a), self->codetable); + + if ((err = ((grib_accessor*)ca)->unpack_long(&value, &size)) != GRIB_SUCCESS) + return err; + + table = ca->table; + + if (table && (value >= 0) && (value < table->size) && table->entries[value].units) { + strcpy(tmp, table->entries[value].units); + } + else { + snprintf(tmp, sizeof(tmp), "%d", (int)value); + } + + l = strlen(tmp) + 1; + + if (*len < l) { + const char* cclass_name = a->cclass->name; + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, l, *len); + *len = l; + return GRIB_BUFFER_TOO_SMALL; + } + + strcpy(buffer, tmp); + *len = l; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_codetable_units.h b/src/accessor/grib_accessor_class_codetable_units.h new file mode 100644 index 000000000..0a8c9389d --- /dev/null +++ b/src/accessor/grib_accessor_class_codetable_units.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_codetable_units_t : public grib_accessor_gen_t +{ +public: + /* Members defined in codetable_units */ + const char* codetable; +}; + +class grib_accessor_class_codetable_units_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_codetable_units_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_codetable_units_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_concept.cc b/src/accessor/grib_accessor_class_concept.cc similarity index 68% rename from src/grib_accessor_class_concept.cc rename to src/accessor/grib_accessor_class_concept.cc index 6fa4122f8..98f0fb35c 100644 --- a/src/grib_accessor_class_concept.cc +++ b/src/accessor/grib_accessor_class_concept.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,113 +9,11 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ +#include "grib_accessor_class_concept.h" -/******************************************************* - * Enrico Fucile - ******************************************************/ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = unpack_string;pack_string;string_length - IMPLEMENTS = unpack_long;pack_long;destroy - IMPLEMENTS = init;dump;value_count;get_native_type - IMPLEMENTS = compare - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_concept -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in concept */ -} grib_accessor_concept; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_concept = { - &grib_accessor_class_gen, /* super */ - "concept", /* name */ - sizeof(grib_accessor_concept), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - +grib_accessor_class_concept_t _grib_accessor_class_concept{ "concept" }; grib_accessor_class* grib_accessor_class_concept = &_grib_accessor_class_concept; -/* END_CLASS_IMP */ #define MAX_CONCEPT_STRING_LENGTH 255 @@ -134,12 +33,13 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b) return (*a == 0 && *b == 0) ? 0 : 1; } -static void init(grib_accessor* a, const long len, grib_arguments* args) +void grib_accessor_class_concept_t::init(grib_accessor* a, const long len, grib_arguments* args) { + grib_accessor_class_gen_t::init(a, len, args); a->length = 0; } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_concept_t::dump(grib_accessor* a, grib_dumper* dumper) { grib_dump_string(dumper, a, NULL); } @@ -192,7 +92,7 @@ static int concept_condition_expression_true(grib_handle* h, grib_concept_condit /* Return 1 (=True) or 0 (=False) */ static int concept_condition_iarray_true(grib_handle* h, grib_concept_condition* c) { - long* val = NULL; + long* val = NULL; size_t size = 0, i; int ret; /* Boolean */ int err = 0; @@ -237,6 +137,7 @@ static const char* concept_evaluate(grib_accessor* a) grib_concept_value* c = action_concept_get_concept(a); grib_handle* h = grib_handle_of_accessor(a); + // fprintf(stderr, "DEBUG: concept_evaluate: %s %s\n", a->name, c->name); while (c) { grib_concept_condition* e = c->conditions; int cnt = 0; @@ -262,7 +163,6 @@ static const char* concept_evaluate(grib_accessor* a) } #define MAX_NUM_CONCEPT_VALUES 40 - static int concept_conditions_expression_apply(grib_handle* h, grib_concept_condition* e, grib_values* values, grib_sarray* sa, int* n) { long lres = 0; @@ -317,9 +217,9 @@ static int cmpstringp(const void* p1, const void* p2) return strcmp(*(char* const*)p1, *(char* const*)p2); } -static bool blacklisted(grib_handle* h, long edition, const char* concept_name, const char* concept_value) +bool blacklisted(grib_handle* h, long edition, const char* concept_name, const char* concept_value) { - if ( strcmp(concept_name, "packingType")==0 ) { + if (strcmp(concept_name, "packingType") == 0) { char input_packing_type[100]; size_t len = sizeof(input_packing_type); if (strstr(concept_value, "SPD")) { @@ -335,10 +235,10 @@ static bool blacklisted(grib_handle* h, long edition, const char* concept_name, return true; } grib_get_string(h, "packingType", input_packing_type, &len); - if (strstr(input_packing_type,"grid_") && !strstr(concept_value,"grid_")) { + if (strstr(input_packing_type, "grid_") && !strstr(concept_value, "grid_")) { return true; } - if (strstr(input_packing_type,"spectral_") && !strstr(concept_value,"spectral_")) { + if (strstr(input_packing_type, "spectral_") && !strstr(concept_value, "spectral_")) { return true; } } @@ -371,8 +271,10 @@ static int grib_concept_apply(grib_accessor* a, const char* name) size_t i = 0, concept_count = 0; long dummy = 0, editionNumber = 0; char centre_s[32] = {0,}; - size_t centre_len = sizeof(centre_s); - char* all_concept_vals[MAX_NUM_CONCEPT_VALUES] = {NULL,}; /* sorted array containing concept values */ + size_t centre_len = sizeof(centre_s); + char* all_concept_vals[MAX_NUM_CONCEPT_VALUES] = { + NULL, + }; /* sorted array containing concept values */ grib_concept_value* pCon = concepts; grib_context_log(h->context, GRIB_LOG_ERROR, "concept: no match for %s=%s", act->name, name); @@ -380,15 +282,21 @@ static int grib_concept_apply(grib_accessor* a, const char* name) grib_get_string(h, "centre", centre_s, ¢re_len) == GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_ERROR, "concept: input handle edition=%ld, centre=%s", editionNumber, centre_s); } + char dataset_s[80]; + size_t dataset_len = sizeof(dataset_s); + if (grib_get_string(h, "datasetForLocal", dataset_s, &dataset_len) == GRIB_SUCCESS && !STR_EQUAL(dataset_s, "unknown")) { + grib_context_log(h->context, GRIB_LOG_ERROR, "concept: input handle dataset=%s", dataset_s); + } if (strcmp(act->name, "paramId") == 0) { if (string_to_long(name, &dummy, 1) == GRIB_SUCCESS) { // The paramId value is an integer. Show them the param DB grib_context_log(h->context, GRIB_LOG_ERROR, - "Please check the Parameter Database 'https://codes.ecmwf.int/grib/param-db/?id=%s'", name); - } else { + "Please check the Parameter Database 'https://codes.ecmwf.int/grib/param-db/?id=%s'", name); + } + else { // paramId being set to a non-integer grib_context_log(h->context, GRIB_LOG_ERROR, - "The paramId value should be an integer. Are you trying to set the shortName?"); + "The paramId value should be an integer. Are you trying to set the shortName?"); } } if (strcmp(act->name, "shortName") == 0) { @@ -440,25 +348,42 @@ static int grib_concept_apply(grib_accessor* a, const char* name) return err; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_concept_t::pack_double(grib_accessor* a, const double* val, size_t* len) { return GRIB_NOT_IMPLEMENTED; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_concept_t::pack_long(grib_accessor* a, const long* val, size_t* len) { char buf[80]; size_t s; snprintf(buf, sizeof(buf), "%ld", *val); - //if(*len > 1) - // return GRIB_NOT_IMPLEMENTED; + // if(*len > 1) + // return GRIB_NOT_IMPLEMENTED; + + // ECC-1806: GRIB: Change of paramId in conversion from GRIB1 to GRIB2 + if (STR_EQUAL(a->name, "paramId")) { + grib_handle* h = grib_handle_of_accessor(a); + long edition = 0; + if (grib_get_long(h, "edition", &edition) == GRIB_SUCCESS && edition == 2) { + long newParamId = 0; + if (grib_get_long(h, "paramIdForConversion", &newParamId) == GRIB_SUCCESS && newParamId > 0) { + if (a->context->debug) { + const char* cclass_name = a->cclass->name; + fprintf(stderr, "ECCODES DEBUG %s::%s: Changing %s from %ld to %ld\n", + cclass_name, __func__, a->name, *val, newParamId); + } + snprintf(buf, sizeof(buf), "%ld", newParamId); + } + } + } s = strlen(buf) + 1; return pack_string(a, buf, &s); } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_concept_t::unpack_double(grib_accessor* a, double* val, size_t* len) { /* * If we want to have a condition which contains tests for paramId as well @@ -491,7 +416,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_concept_t::unpack_long(grib_accessor* a, long* val, size_t* len) { const char* p = concept_evaluate(a); @@ -511,14 +436,14 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) * Keep this check in DEBUG mode only */ { - char *endptr; + char* endptr; *val = strtol(p, &endptr, 10); if (endptr == p || *endptr != '\0') { /* Failed to convert string into integer */ int type = GRIB_TYPE_UNDEFINED; - grib_context_log(a->context,GRIB_LOG_ERROR,"Cannot unpack %s as long",a->name); + grib_context_log(a->context, GRIB_LOG_ERROR, "Cannot unpack %s as long", a->name); if (grib_get_native_type(grib_handle_of_accessor(a), a->name, &type) == GRIB_SUCCESS) { - grib_context_log(a->context,GRIB_LOG_ERROR,"Hint: Try unpacking as %s", grib_get_type_name(type)); + grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Try unpacking as %s", grib_get_type_name(type)); } return GRIB_DECODING_ERROR; } @@ -527,7 +452,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_concept_t::get_native_type(grib_accessor* a) { int type = GRIB_TYPE_STRING; if (a->flags & GRIB_ACCESSOR_FLAG_LONG_TYPE) @@ -536,13 +461,14 @@ static int get_native_type(grib_accessor* a) return type; } -static void destroy(grib_context* c, grib_accessor* a) +void grib_accessor_class_concept_t::destroy(grib_context* c, grib_accessor* a) { - //grib_accessor_concept *self = (grib_accessor_concept*)a; - //grib_context_free(c,self->cval); + // grib_accessor_concept_t *self = (grib_accessor_concept_t*)a; + // grib_context_free(c,self->cval); + grib_accessor_class_gen_t::destroy(c, a); } -static int unpack_string(grib_accessor* a, char* val, size_t* len) +int grib_accessor_class_concept_t::unpack_string(grib_accessor* a, char* val, size_t* len) { size_t slen; const char* p = concept_evaluate(a); @@ -558,7 +484,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) slen = strlen(p) + 1; if (*len < slen) { grib_context_log(a->context, GRIB_LOG_ERROR, - "Concept unpack_string. Buffer too small for %s, value='%s' which requires %lu bytes (len=%lu)", + "Concept unpack_string. Buffer too small for %s, value='%s' which requires %lu bytes (len=%lu)", a->name, p, slen, *len); *len = slen; return GRIB_BUFFER_TOO_SMALL; @@ -566,33 +492,33 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) strcpy(val, p); /* NOLINT: CWE-119 clang-analyzer-security.insecureAPI.strcpy */ *len = slen; -// if (a->context->debug==1) { -// int err = 0; -// char result[1024] = {0,}; -// err = get_concept_condition_string(grib_handle_of_accessor(a), a->name, val, result); -// if (!err) fprintf(stderr, "ECCODES DEBUG concept name=%s, value=%s, conditions=%s\n", a->name, val, result); -// } + // if (a->context->debug==1) { + // int err = 0; + // char result[1024] = {0,}; + // err = get_concept_condition_string(grib_handle_of_accessor(a), a->name, val, result); + // if (!err) fprintf(stderr, "ECCODES DEBUG concept name=%s, value=%s, conditions=%s\n", a->name, val, result); + // } return GRIB_SUCCESS; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) +int grib_accessor_class_concept_t::pack_string(grib_accessor* a, const char* val, size_t* len) { return grib_concept_apply(a, val); } -static size_t string_length(grib_accessor* a) +size_t grib_accessor_class_concept_t::string_length(grib_accessor* a) { return MAX_CONCEPT_STRING_LENGTH; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_concept_t::value_count(grib_accessor* a, long* count) { *count = 1; return 0; } -static int compare(grib_accessor* a, grib_accessor* b) +int grib_accessor_class_concept_t::compare(grib_accessor* a, grib_accessor* b) { int retval = 0; char* aval = 0; @@ -603,11 +529,11 @@ static int compare(grib_accessor* a, grib_accessor* b) int err = 0; long count = 0; - err = grib_value_count(a, &count); + err = a->value_count(&count); if (err) return err; alen = count; - err = grib_value_count(b, &count); + err = b->value_count(&count); if (err) return err; blen = count; @@ -619,9 +545,9 @@ static int compare(grib_accessor* a, grib_accessor* b) aval = (char*)grib_context_malloc(a->context, alen * sizeof(char)); bval = (char*)grib_context_malloc(b->context, blen * sizeof(char)); - err = grib_unpack_string(a, aval, &alen); + err = a->unpack_string(aval, &alen); if (err) return err; - err = grib_unpack_string(b, bval, &blen); + err = b->unpack_string(bval, &blen); if (err) return err; retval = GRIB_SUCCESS; diff --git a/src/accessor/grib_accessor_class_concept.h b/src/accessor/grib_accessor_class_concept.h new file mode 100644 index 000000000..7b9ea11d0 --- /dev/null +++ b/src/accessor/grib_accessor_class_concept.h @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_concept_t : public grib_accessor_gen_t +{ +public: + /* Members defined in concept */ +}; + +class grib_accessor_class_concept_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_concept_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_concept_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_constant.cc b/src/accessor/grib_accessor_class_constant.cc new file mode 100644 index 000000000..ed30a6365 --- /dev/null +++ b/src/accessor/grib_accessor_class_constant.cc @@ -0,0 +1,20 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_constant.h" + +grib_accessor_class_constant_t _grib_accessor_class_constant{"constant"}; +grib_accessor_class* grib_accessor_class_constant = &_grib_accessor_class_constant; + +void grib_accessor_class_constant_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_variable_t::init(a, len, arg); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} diff --git a/src/accessor/grib_accessor_class_constant.h b/src/accessor/grib_accessor_class_constant.h new file mode 100644 index 000000000..916df88e9 --- /dev/null +++ b/src/accessor/grib_accessor_class_constant.h @@ -0,0 +1,21 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_variable.h" + +class grib_accessor_constant_t : public grib_accessor_variable_t {}; + +class grib_accessor_class_constant_t : public grib_accessor_class_variable_t +{ +public: + grib_accessor_class_constant_t(const char* name) : grib_accessor_class_variable_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_constant_t{}; } + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_count_file.cc b/src/accessor/grib_accessor_class_count_file.cc new file mode 100644 index 000000000..268ba8051 --- /dev/null +++ b/src/accessor/grib_accessor_class_count_file.cc @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_count_file.h" + +grib_accessor_class_count_file_t _grib_accessor_class_count_file{ "count_file" }; +grib_accessor_class* grib_accessor_class_count_file = &_grib_accessor_class_count_file; + + +void grib_accessor_class_count_file_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +int grib_accessor_class_count_file_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + *val = grib_context_get_handle_file_count(a->context); + *len = 1; + return 0; +} diff --git a/src/accessor/grib_accessor_class_count_file.h b/src/accessor/grib_accessor_class_count_file.h new file mode 100644 index 000000000..25092b0a4 --- /dev/null +++ b/src/accessor/grib_accessor_class_count_file.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_count_file_t : public grib_accessor_long_t +{ +public: + /* Members defined in count_file */ +}; + +class grib_accessor_class_count_file_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_count_file_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_count_file_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_count_missing.cc b/src/accessor/grib_accessor_class_count_missing.cc similarity index 50% rename from src/grib_accessor_class_count_missing.cc rename to src/accessor/grib_accessor_class_count_missing.cc index a4ed76841..7a3232175 100644 --- a/src/grib_accessor_class_count_missing.cc +++ b/src/accessor/grib_accessor_class_count_missing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,104 +9,11 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init; - IMPLEMENTS = value_count - MEMBERS = const char* bitmap - MEMBERS = const char* unusedBitsInBitmap - MEMBERS = const char* numberOfDataPoints - MEMBERS = const char* missingValueManagementUsed - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_count_missing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in count_missing */ - const char* bitmap; - const char* unusedBitsInBitmap; - const char* numberOfDataPoints; - const char* missingValueManagementUsed; -} grib_accessor_count_missing; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_count_missing = { - &grib_accessor_class_long, /* super */ - "count_missing", /* name */ - sizeof(grib_accessor_count_missing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_count_missing.h" +grib_accessor_class_count_missing_t _grib_accessor_class_count_missing{ "count_missing" }; grib_accessor_class* grib_accessor_class_count_missing = &_grib_accessor_class_count_missing; -/* END_CLASS_IMP */ static const unsigned char bitsoff[] = { 8, 7, 7, 6, 7, 6, 6, 5, 7, 6, 6, 5, 6, 5, 5, 4, 7, @@ -126,16 +34,17 @@ static const unsigned char bitsoff[] = { 0 }; -static void init(grib_accessor* a, const long len, grib_arguments* arg) +void grib_accessor_class_count_missing_t::init(grib_accessor* a, const long len, grib_arguments* arg) { - int n = 0; - grib_accessor_count_missing* self = (grib_accessor_count_missing*)a; - grib_handle* h = grib_handle_of_accessor(a); - a->length = 0; + grib_accessor_class_long_t::init(a, len, arg); + int n = 0; + grib_accessor_count_missing_t* self = (grib_accessor_count_missing_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + a->length = 0; a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - self->bitmap = grib_arguments_get_name(h, arg, n++); - self->unusedBitsInBitmap = grib_arguments_get_name(h, arg, n++); - self->numberOfDataPoints = grib_arguments_get_name(h, arg, n++); + self->bitmap = grib_arguments_get_name(h, arg, n++); + self->unusedBitsInBitmap = grib_arguments_get_name(h, arg, n++); + self->numberOfDataPoints = grib_arguments_get_name(h, arg, n++); self->missingValueManagementUsed = grib_arguments_get_name(h, arg, n++); /* Can be NULL */ } @@ -165,9 +74,9 @@ static int get_count_of_missing_values(grib_handle* h, long* p_count_of_missing) return GRIB_SUCCESS; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_count_missing_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_count_missing* self = (grib_accessor_count_missing*)a; + grib_accessor_count_missing_t* self = (grib_accessor_count_missing_t*)a; unsigned char* p; int i; long size = 0; @@ -182,11 +91,10 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) if (!bitmap) { long mvmu = 0; if (self->missingValueManagementUsed && - grib_get_long(h, self->missingValueManagementUsed, &mvmu) == GRIB_SUCCESS && mvmu != 0) - { + grib_get_long(h, self->missingValueManagementUsed, &mvmu) == GRIB_SUCCESS && mvmu != 0) { /* ECC-523: No bitmap. Missing values are encoded in the Data Section. * So we must decode all the data values and count how many are missing - */ + */ long count_of_missing = 0; if (get_count_of_missing_values(h, &count_of_missing) == GRIB_SUCCESS) { *val = count_of_missing; @@ -195,9 +103,8 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } - size = grib_byte_count(bitmap); - offset = grib_byte_offset(bitmap); - + size = bitmap->byte_count(); + offset = bitmap->byte_offset(); if (grib_get_long(h, self->unusedBitsInBitmap, &unusedBitsInBitmap) != GRIB_SUCCESS) { if (grib_get_long(h, self->numberOfDataPoints, &numberOfDataPoints) != GRIB_SUCCESS) { grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to count missing values"); @@ -206,7 +113,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) unusedBitsInBitmap = size * 8 - numberOfDataPoints; if (unusedBitsInBitmap < 0) { grib_context_log(a->context, GRIB_LOG_ERROR, "Inconsistent number of bitmap points: Check the bitmap and data sections!"); - grib_context_log(a->context, GRIB_LOG_ERROR, "Bitmap size=%ld, numberOfDataPoints=%ld", size*8, numberOfDataPoints); + grib_context_log(a->context, GRIB_LOG_ERROR, "Bitmap size=%ld, numberOfDataPoints=%ld", size * 8, numberOfDataPoints); return GRIB_DECODING_ERROR; } } @@ -224,7 +131,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_count_missing_t::value_count(grib_accessor* a, long* count) { *count = 1; return 0; diff --git a/src/accessor/grib_accessor_class_count_missing.h b/src/accessor/grib_accessor_class_count_missing.h new file mode 100644 index 000000000..3e2cf7330 --- /dev/null +++ b/src/accessor/grib_accessor_class_count_missing.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_count_missing_t : public grib_accessor_long_t +{ +public: + /* Members defined in count_missing */ + const char* bitmap; + const char* unusedBitsInBitmap; + const char* numberOfDataPoints; + const char* missingValueManagementUsed; +}; + +class grib_accessor_class_count_missing_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_count_missing_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_count_missing_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_count_total.cc b/src/accessor/grib_accessor_class_count_total.cc new file mode 100644 index 000000000..dc708b4b6 --- /dev/null +++ b/src/accessor/grib_accessor_class_count_total.cc @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_count_total.h" + +grib_accessor_class_count_total_t _grib_accessor_class_count_total{ "count_total" }; +grib_accessor_class* grib_accessor_class_count_total = &_grib_accessor_class_count_total; + + +void grib_accessor_class_count_total_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +int grib_accessor_class_count_total_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + *val = grib_context_get_handle_total_count(a->context); + *len = 1; + return 0; +} diff --git a/src/accessor/grib_accessor_class_count_total.h b/src/accessor/grib_accessor_class_count_total.h new file mode 100644 index 000000000..6fa89df0e --- /dev/null +++ b/src/accessor/grib_accessor_class_count_total.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_count_total_t : public grib_accessor_long_t +{ +public: + /* Members defined in count_total */ +}; + +class grib_accessor_class_count_total_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_count_total_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_count_total_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_data_apply_bitmap.cc b/src/accessor/grib_accessor_class_data_apply_bitmap.cc similarity index 58% rename from src/grib_accessor_class_data_apply_bitmap.cc rename to src/accessor/grib_accessor_class_data_apply_bitmap.cc index 675e7b3de..cf3d5f4a5 100644 --- a/src/grib_accessor_class_data_apply_bitmap.cc +++ b/src/accessor/grib_accessor_class_data_apply_bitmap.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,123 +9,17 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_value.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init - IMPLEMENTS = unpack_double;unpack_double_element;unpack_double_element_set - IMPLEMENTS = unpack_float - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - IMPLEMENTS = dump;get_native_type - IMPLEMENTS = compare - MEMBERS=const char* coded_values - MEMBERS=const char* bitmap - MEMBERS=const char* missing_value - MEMBERS=const char* number_of_data_points - MEMBERS=const char* number_of_values - MEMBERS=const char* binary_scale_factor - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_data_apply_bitmap -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in data_apply_bitmap */ - const char* coded_values; - const char* bitmap; - const char* missing_value; - const char* number_of_data_points; - const char* number_of_values; - const char* binary_scale_factor; -} grib_accessor_data_apply_bitmap; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_data_apply_bitmap = { - &grib_accessor_class_gen, /* super */ - "data_apply_bitmap", /* name */ - sizeof(grib_accessor_data_apply_bitmap), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_data_apply_bitmap.h" +grib_accessor_class_data_apply_bitmap_t _grib_accessor_class_data_apply_bitmap{ "data_apply_bitmap" }; grib_accessor_class* grib_accessor_class_data_apply_bitmap = &_grib_accessor_class_data_apply_bitmap; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) +void grib_accessor_class_data_apply_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args) { - int n = 0; - grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; + grib_accessor_class_gen_t::init(a, v, args); + int n = 0; + grib_accessor_data_apply_bitmap_t* self = (grib_accessor_data_apply_bitmap_t*)a; self->coded_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); self->bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); @@ -135,16 +30,16 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->length = 0; } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_data_apply_bitmap_t::dump(grib_accessor* a, grib_dumper* dumper) { grib_dump_values(dumper, a); } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_data_apply_bitmap_t::value_count(grib_accessor* a, long* count) { - grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; - size_t len = 0; - int ret = 0; + grib_accessor_data_apply_bitmap_t* self = (grib_accessor_data_apply_bitmap_t*)a; + size_t len = 0; + int ret = GRIB_SUCCESS; if (grib_find_accessor(grib_handle_of_accessor(a), self->bitmap)) ret = grib_get_size(grib_handle_of_accessor(a), self->bitmap, &len); @@ -156,18 +51,17 @@ static int value_count(grib_accessor* a, long* count) return ret; } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) +int grib_accessor_class_data_apply_bitmap_t::unpack_double_element(grib_accessor* a, size_t idx, double* val) { - grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; - grib_handle* gh = grib_handle_of_accessor(a); - int err = 0, i = 0; - size_t cidx = 0; + grib_accessor_data_apply_bitmap_t* self = (grib_accessor_data_apply_bitmap_t*)a; + grib_handle* gh = grib_handle_of_accessor(a); + size_t i = 0, cidx = 0; double missing_value = 0; double* bvals = NULL; size_t n_vals = 0; long nn = 0; - err = grib_value_count(a, &nn); + int err = a->value_count(&nn); n_vals = nn; if (err) return err; @@ -203,20 +97,20 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return grib_get_double_element_internal(gh, self->coded_values, cidx, val); } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +int grib_accessor_class_data_apply_bitmap_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) { - grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; - grib_handle* gh = grib_handle_of_accessor(a); + grib_accessor_data_apply_bitmap_t* self = (grib_accessor_data_apply_bitmap_t*)a; + grib_handle* gh = grib_handle_of_accessor(a); int err = 0, all_missing = 1; - size_t cidx = 0; /* index into the coded_values array */ - size_t* cidx_array = NULL; /* array of indexes into the coded_values */ - double* cval_array = NULL; /* array of values of the coded_values */ + size_t cidx = 0; /* index into the coded_values array */ + size_t* cidx_array = NULL; /* array of indexes into the coded_values */ + double* cval_array = NULL; /* array of values of the coded_values */ double missing_value = 0; double* bvals = NULL; size_t n_vals = 0, i = 0, j = 0, idx = 0, count_1s = 0, ci = 0; long nn = 0; - err = grib_value_count(a, &nn); + err = a->value_count(&nn); n_vals = nn; if (err) return err; @@ -231,7 +125,8 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array for (i = 0; i < len; i++) { if (val_array[i] == 0) { val_array[i] = missing_value; - } else { + } + else { all_missing = 0; count_1s++; } @@ -256,7 +151,7 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array ci = 0; for (i = 0; i < len; i++) { if (val_array[i] == 1) { - idx = index_array[i]; + idx = index_array[i]; cidx = 0; for (j = 0; j < idx; j++) { cidx += bvals[j]; @@ -283,18 +178,18 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array return GRIB_SUCCESS; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_data_apply_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; - int err = 0; - size_t bmaplen = *len; - long coded_n_vals = 0; - double* coded_vals = NULL; - long i = 0; - long j = 0; - double missing_value = 0; - grib_handle* hand = grib_handle_of_accessor(a); - grib_context* ctxt = a->context; + grib_accessor_data_apply_bitmap_t* self = (grib_accessor_data_apply_bitmap_t*)a; + int err = 0; + size_t bmaplen = *len; + long coded_n_vals = 0; + double* coded_vals = NULL; + long i = 0; + long j = 0; + double missing_value = 0; + grib_handle* hand = grib_handle_of_accessor(a); + grib_context* ctxt = a->context; if (*len == 0) return GRIB_NO_VALUES; @@ -343,22 +238,22 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return err; } + template static int unpack(grib_accessor* a, T* val, size_t* len) { static_assert(std::is_floating_point::value, "Requires floating point numbers"); - grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; + grib_accessor_data_apply_bitmap_t* self = (grib_accessor_data_apply_bitmap_t*)a; size_t i = 0; size_t j = 0; size_t n_vals = 0; long nn = 0; - int err = 0; size_t coded_n_vals = 0; - T* coded_vals = NULL; + T* coded_vals = NULL; double missing_value = 0; - err = grib_value_count(a, &nn); + int err = a->value_count(&nn); n_vals = nn; if (err) return err; @@ -399,8 +294,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len) grib_context_log(a->context, GRIB_LOG_DEBUG, "grib_accessor_class_data_apply_bitmap: %s : creating %s, %d values", - __func__, - a->name, n_vals); + __func__, a->name, n_vals); for (i = 0; i < n_vals; i++) { if (val[i] == 0) { @@ -426,25 +320,24 @@ static int unpack(grib_accessor* a, T* val, size_t* len) return err; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_data_apply_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len) { return unpack(a, val, len); } -static int unpack_float(grib_accessor* a, float* val, size_t* len) +int grib_accessor_class_data_apply_bitmap_t::unpack_float(grib_accessor* a, float* val, size_t* len) { return unpack(a, val, len); } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_data_apply_bitmap_t::get_native_type(grib_accessor* a) { - //grib_accessor_data_apply_bitmap* self = (grib_accessor_data_apply_bitmap*)a; - //return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values)); - + // grib_accessor_data_apply_bitmap_t* self = (grib_accessor_data_apply_bitmap_t*)a; + // return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values)); return GRIB_TYPE_DOUBLE; } -static int compare(grib_accessor* a, grib_accessor* b) +int grib_accessor_class_data_apply_bitmap_t::compare(grib_accessor* a, grib_accessor* b) { int retval = GRIB_SUCCESS; double* aval = 0; @@ -455,12 +348,12 @@ static int compare(grib_accessor* a, grib_accessor* b) int err = 0; long count = 0; - err = grib_value_count(a, &count); + err = a->value_count(&count); if (err) return err; alen = count; - err = grib_value_count(b, &count); + err = b->value_count(&count); if (err) return err; blen = count; @@ -471,11 +364,10 @@ static int compare(grib_accessor* a, grib_accessor* b) aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); - grib_unpack_double(a, aval, &alen); - grib_unpack_double(b, bval, &blen); - + a->unpack_double(aval, &alen); + b->unpack_double(bval, &blen); retval = GRIB_SUCCESS; - for (size_t i=0; ivalues = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); self->numberOfRows = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); self->numberOfColumns = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); @@ -130,26 +29,23 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->length = 0; } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_data_apply_boustrophedonic_t::dump(grib_accessor* a, grib_dumper* dumper) { grib_dump_values(dumper, a); } -static int value_count(grib_accessor* a, long* numberOfPoints) +int grib_accessor_class_data_apply_boustrophedonic_t::value_count(grib_accessor* a, long* numberOfPoints) { - grib_accessor_data_apply_boustrophedonic* self = (grib_accessor_data_apply_boustrophedonic*)a; - int ret = 0; + grib_accessor_data_apply_boustrophedonic_t* self = (grib_accessor_data_apply_boustrophedonic_t*)a; *numberOfPoints = 0; - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, numberOfPoints); - - return ret; + return grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, numberOfPoints); } template static int unpack(grib_accessor* a, T* val, size_t* len) { - grib_accessor_data_apply_boustrophedonic* self = (grib_accessor_data_apply_boustrophedonic*)a; + grib_accessor_data_apply_boustrophedonic_t* self = (grib_accessor_data_apply_boustrophedonic_t*)a; size_t plSize = 0; long* pl = 0; @@ -242,24 +138,23 @@ static int unpack(grib_accessor* a, T* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_data_apply_boustrophedonic_t::unpack_double(grib_accessor* a, double* val, size_t* len) { return unpack(a, val, len); } -static int unpack_float(grib_accessor* a, float* val, size_t* len) +int grib_accessor_class_data_apply_boustrophedonic_t::unpack_float(grib_accessor* a, float* val, size_t* len) { return unpack(a, val, len); } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) +int grib_accessor_class_data_apply_boustrophedonic_t::unpack_double_element(grib_accessor* a, size_t idx, double* val) { size_t size; double* values; - int err = 0; /* GRIB-564: The index idx relates to codedValues NOT values! */ - err = grib_get_size(a->parent->h, "codedValues", &size); + int err = grib_get_size(a->parent->h, "codedValues", &size); if (err) return err; if (idx > size) @@ -276,7 +171,7 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return GRIB_SUCCESS; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +int grib_accessor_class_data_apply_boustrophedonic_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) { size_t size = 0, i = 0; double* values; @@ -304,9 +199,9 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array return GRIB_SUCCESS; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_data_apply_boustrophedonic_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_data_apply_boustrophedonic* self = (grib_accessor_data_apply_boustrophedonic*)a; + grib_accessor_data_apply_boustrophedonic_t* self = (grib_accessor_data_apply_boustrophedonic_t*)a; size_t plSize = 0; long* pl = 0; @@ -315,10 +210,9 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) double* pval = 0; size_t valuesSize = 0; long i, j; - int ret; long numberOfPoints, numberOfRows, numberOfColumns; - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, &numberOfPoints); + int ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, &numberOfPoints); if (ret) return ret; @@ -388,7 +282,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return GRIB_SUCCESS; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_data_apply_boustrophedonic_t::get_native_type(grib_accessor* a) { return GRIB_TYPE_DOUBLE; } diff --git a/src/accessor/grib_accessor_class_data_apply_boustrophedonic.h b/src/accessor/grib_accessor_class_data_apply_boustrophedonic.h new file mode 100644 index 000000000..97987d217 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_apply_boustrophedonic.h @@ -0,0 +1,40 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_data_apply_boustrophedonic_t : public grib_accessor_gen_t +{ +public: + /* Members defined in data_apply_boustrophedonic */ + const char* values; + const char* numberOfRows; + const char* numberOfColumns; + const char* numberOfPoints; + const char* pl; +}; + +class grib_accessor_class_data_apply_boustrophedonic_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_data_apply_boustrophedonic_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_apply_boustrophedonic_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; +}; diff --git a/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc b/src/accessor/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc similarity index 69% rename from src/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc rename to src/accessor/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc index b68e362db..f796cfb02 100644 --- a/src/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc +++ b/src/accessor/grib_accessor_class_data_apply_boustrophedonic_bitmap.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,122 +9,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init - IMPLEMENTS = unpack_double;unpack_double_element;unpack_double_element_set - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - IMPLEMENTS = dump;get_native_type - MEMBERS=const char* coded_values - MEMBERS=const char* bitmap - MEMBERS=const char* missing_value - MEMBERS=const char* binary_scale_factor - MEMBERS=const char* numberOfRows - MEMBERS=const char* numberOfColumns - MEMBERS=const char* numberOfPoints - - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_data_apply_boustrophedonic_bitmap -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in data_apply_boustrophedonic_bitmap */ - const char* coded_values; - const char* bitmap; - const char* missing_value; - const char* binary_scale_factor; - const char* numberOfRows; - const char* numberOfColumns; - const char* numberOfPoints; -} grib_accessor_data_apply_boustrophedonic_bitmap; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_data_apply_boustrophedonic_bitmap = { - &grib_accessor_class_gen, /* super */ - "data_apply_boustrophedonic_bitmap", /* name */ - sizeof(grib_accessor_data_apply_boustrophedonic_bitmap), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_data_apply_boustrophedonic_bitmap.h" +grib_accessor_class_data_apply_boustrophedonic_bitmap_t _grib_accessor_class_data_apply_boustrophedonic_bitmap{"data_apply_boustrophedonic_bitmap"}; grib_accessor_class* grib_accessor_class_data_apply_boustrophedonic_bitmap = &_grib_accessor_class_data_apply_boustrophedonic_bitmap; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ +void grib_accessor_class_data_apply_boustrophedonic_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, v, args); int n = 0; - grib_accessor_data_apply_boustrophedonic_bitmap* self = (grib_accessor_data_apply_boustrophedonic_bitmap*)a; + grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a; grib_handle* gh = grib_handle_of_accessor(a); self->coded_values = grib_arguments_get_name(gh, args, n++); @@ -138,14 +33,12 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->length = 0; } -static void dump(grib_accessor* a, grib_dumper* dumper) -{ +void grib_accessor_class_data_apply_boustrophedonic_bitmap_t::dump(grib_accessor* a, grib_dumper* dumper){ grib_dump_values(dumper, a); } -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_data_apply_boustrophedonic_bitmap* self = (grib_accessor_data_apply_boustrophedonic_bitmap*)a; +int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::value_count(grib_accessor* a, long* count){ + grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a; grib_handle* gh = grib_handle_of_accessor(a); size_t len = 0; int ret = 0; @@ -158,9 +51,8 @@ static int value_count(grib_accessor* a, long* count) return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_apply_boustrophedonic_bitmap* self = (grib_accessor_data_apply_boustrophedonic_bitmap*)a; +int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a; grib_handle* gh = grib_handle_of_accessor(a); size_t i = 0, j = 0, n_vals = 0, irow = 0; @@ -171,8 +63,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) double missing_value = 0; long numberOfPoints, numberOfRows, numberOfColumns; - err = grib_value_count(a, &nn); - n_vals = nn; + err = a->value_count(&nn); n_vals = nn; if (err) return err; @@ -268,9 +159,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return err; } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) -{ - grib_accessor_data_apply_boustrophedonic_bitmap* self = (grib_accessor_data_apply_boustrophedonic_bitmap*)a; +int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){ + grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a; grib_handle* gh = grib_handle_of_accessor(a); int err = 0, i = 0; size_t cidx = 0; @@ -279,8 +169,7 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) size_t n_vals = 0; long nn = 0; - err = grib_value_count(a, &nn); - n_vals = nn; + err = a->value_count(&nn); n_vals = nn; if (err) return err; @@ -315,9 +204,8 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return grib_get_double_element_internal(gh, self->coded_values, cidx, val); } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) -{ - grib_accessor_data_apply_boustrophedonic_bitmap* self = (grib_accessor_data_apply_boustrophedonic_bitmap*)a; +int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){ + grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a; grib_handle* gh = grib_handle_of_accessor(a); int err = 0, all_missing = 1; size_t cidx = 0; /* index into the coded_values array */ @@ -328,8 +216,7 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array size_t n_vals = 0, i = 0, j = 0, idx = 0, count_1s = 0, ci = 0; long nn = 0; - err = grib_value_count(a, &nn); - n_vals = nn; + err = a->value_count(&nn); n_vals = nn; if (err) return err; if (!grib_find_accessor(gh, self->bitmap)) @@ -395,9 +282,8 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array return GRIB_SUCCESS; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_apply_boustrophedonic_bitmap* self = (grib_accessor_data_apply_boustrophedonic_bitmap*)a; +int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a; grib_handle* gh = grib_handle_of_accessor(a); int err = 0; size_t bmaplen = *len; @@ -495,9 +381,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return err; } -static int get_native_type(grib_accessor* a) -{ - //grib_accessor_data_apply_boustrophedonic_bitmap* self = (grib_accessor_data_apply_boustrophedonic_bitmap*)a; +int grib_accessor_class_data_apply_boustrophedonic_bitmap_t::get_native_type(grib_accessor* a){ + //grib_accessor_data_apply_boustrophedonic_bitmap_t* self = (grib_accessor_data_apply_boustrophedonic_bitmap_t*)a; //return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values)); return GRIB_TYPE_DOUBLE; diff --git a/src/accessor/grib_accessor_class_data_apply_boustrophedonic_bitmap.h b/src/accessor/grib_accessor_class_data_apply_boustrophedonic_bitmap.h new file mode 100644 index 000000000..fee603876 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_apply_boustrophedonic_bitmap.h @@ -0,0 +1,41 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_data_apply_boustrophedonic_bitmap_t : public grib_accessor_gen_t +{ +public: + /* Members defined in data_apply_boustrophedonic_bitmap */ + const char* coded_values; + const char* bitmap; + const char* missing_value; + const char* binary_scale_factor; + const char* numberOfRows; + const char* numberOfColumns; + const char* numberOfPoints; +}; + +class grib_accessor_class_data_apply_boustrophedonic_bitmap_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_data_apply_boustrophedonic_bitmap_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_apply_boustrophedonic_bitmap_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; +}; diff --git a/src/grib_accessor_class_data_ccsds_packing.cc b/src/accessor/grib_accessor_class_data_ccsds_packing.cc similarity index 67% rename from src/grib_accessor_class_data_ccsds_packing.cc rename to src/accessor/grib_accessor_class_data_ccsds_packing.cc index ccfd48c03..5b0813bfd 100644 --- a/src/grib_accessor_class_data_ccsds_packing.cc +++ b/src/accessor/grib_accessor_class_data_ccsds_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,138 +9,26 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_bits_any_endian_simple.h" -#include "grib_scaling.h" -#include -#include +#include "grib_accessor_class_data_ccsds_packing.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_values - IMPLEMENTS = init - IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_float - IMPLEMENTS = pack_double - IMPLEMENTS = unpack_double_element;unpack_double_element_set - IMPLEMENTS = value_count - MEMBERS=const char* number_of_values - MEMBERS=const char* reference_value - MEMBERS=const char* binary_scale_factor - MEMBERS=const char* decimal_scale_factor - MEMBERS=const char* optimize_scaling_factor - MEMBERS=const char* bits_per_value - MEMBERS=const char* number_of_data_points - MEMBERS=const char* ccsds_flags - MEMBERS=const char* ccsds_block_size - MEMBERS=const char* ccsds_rsi - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_data_ccsds_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_ccsds_packing */ - const char* number_of_values; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - const char* bits_per_value; - const char* number_of_data_points; - const char* ccsds_flags; - const char* ccsds_block_size; - const char* ccsds_rsi; -} grib_accessor_data_ccsds_packing; - -extern grib_accessor_class* grib_accessor_class_values; - -static grib_accessor_class _grib_accessor_class_data_ccsds_packing = { - &grib_accessor_class_values, /* super */ - "data_ccsds_packing", /* name */ - sizeof(grib_accessor_data_ccsds_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; +#if defined(HAVE_LIBAEC) || defined(HAVE_AEC) + #include + #ifndef LIBAEC_DLL_EXPORTED + #error Version of libaec appears to be too old. Please upgrade. + #endif +#endif +grib_accessor_class_data_ccsds_packing_t _grib_accessor_class_data_ccsds_packing{ "data_ccsds_packing" }; grib_accessor_class* grib_accessor_class_data_ccsds_packing = &_grib_accessor_class_data_ccsds_packing; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) +void grib_accessor_class_data_ccsds_packing_t::init(grib_accessor* a, const long v, grib_arguments* args) { - grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; - grib_handle* h = grib_handle_of_accessor(a); + grib_accessor_class_values_t::init(a, v, args); + grib_accessor_data_ccsds_packing_t* self = (grib_accessor_data_ccsds_packing_t*)a; + + grib_handle* h = grib_handle_of_accessor(a); self->number_of_values = grib_arguments_get_name(h, args, self->carg++); self->reference_value = grib_arguments_get_name(h, args, self->carg++); @@ -155,24 +44,18 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->flags |= GRIB_ACCESSOR_FLAG_DATA; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_data_ccsds_packing_t::value_count(grib_accessor* a, long* count) { - grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; + grib_accessor_data_ccsds_packing_t* self = (grib_accessor_data_ccsds_packing_t*)a; *count = 0; return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, count); } #if defined(HAVE_LIBAEC) || defined(HAVE_AEC) -#include - -#ifndef LIBAEC_DLL_EXPORTED - #error Version of libaec appears to be too old. Please upgrade. -#endif - static bool is_big_endian() { - unsigned char is_big_endian = 0; + unsigned char is_big_endian = 0; unsigned short endianess_test = 1; return reinterpret_cast(&endianess_test)[0] == is_big_endian; } @@ -182,38 +65,38 @@ static void modify_aec_flags(long* flags) // ECC-1602: Performance improvement: enabled the use of native data types *flags &= ~AEC_DATA_3BYTE; // disable support for 3-bytes per value if (is_big_endian()) - *flags |= AEC_DATA_MSB; // enable big-endian + *flags |= AEC_DATA_MSB; // enable big-endian else *flags &= ~AEC_DATA_MSB; // enable little-endian } static const char* aec_get_error_message(int code) { - if (code == AEC_MEM_ERROR) return "AEC_MEM_ERROR"; - if (code == AEC_DATA_ERROR) return "AEC_DATA_ERROR"; + if (code == AEC_MEM_ERROR) return "AEC_MEM_ERROR"; + if (code == AEC_DATA_ERROR) return "AEC_DATA_ERROR"; if (code == AEC_STREAM_ERROR) return "AEC_STREAM_ERROR"; - if (code == AEC_CONF_ERROR) return "AEC_CONF_ERROR"; - if (code == AEC_OK) return "AEC_OK"; + if (code == AEC_CONF_ERROR) return "AEC_CONF_ERROR"; + if (code == AEC_OK) return "AEC_OK"; return "Unknown error code"; } static void print_aec_stream_info(struct aec_stream* strm, const char* func) { - fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.flags=%u\n", func, strm->flags); + fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.flags=%u\n", func, strm->flags); fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.bits_per_sample=%u\n", func, strm->bits_per_sample); - fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.block_size=%u\n", func, strm->block_size); - fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.rsi=%u\n", func, strm->rsi); - fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.avail_out=%lu\n", func, strm->avail_out); - fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.avail_in=%lu\n", func, strm->avail_in); + fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.block_size=%u\n", func, strm->block_size); + fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.rsi=%u\n", func, strm->rsi); + fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.avail_out=%lu\n", func, strm->avail_out); + fprintf(stderr, "ECCODES DEBUG CCSDS %s aec_stream.avail_in=%lu\n", func, strm->avail_in); } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_data_ccsds_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; + grib_accessor_data_ccsds_packing_t* self = (grib_accessor_data_ccsds_packing_t*)a; - grib_handle* hand = grib_handle_of_accessor(a); + grib_handle* hand = grib_handle_of_accessor(a); const char* cclass_name = a->cclass->name; - int err = GRIB_SUCCESS; + int err = GRIB_SUCCESS; size_t buflen = 0, i = 0; bool is_constant_field = false; @@ -223,9 +106,9 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) long binary_scale_factor = 0; long decimal_scale_factor = 0; - //long optimize_scaling_factor = 0; - double reference_value = 0; - long bits_per_value = 0; + // long optimize_scaling_factor = 0; + double reference_value = 0; + long bits_per_value = 0; double max, min, d, divisor; long number_of_data_points; @@ -249,8 +132,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if ((err = grib_get_long_internal(hand, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) return err; - //if ((err = grib_get_long_internal(gh, self->optimize_scaling_factor, &optimize_scaling_factor)) != GRIB_SUCCESS) - // return err; + // if ((err = grib_get_long_internal(gh, self->optimize_scaling_factor, &optimize_scaling_factor)) != GRIB_SUCCESS) + // return err; if ((err = grib_get_long_internal(hand, self->ccsds_flags, &ccsds_flags)) != GRIB_SUCCESS) return err; @@ -270,8 +153,10 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) max = val[0]; min = max; for (i = 1; i < n_vals; i++) { - if (val[i] > max) max = val[i]; - else if (val[i] < min) min = val[i]; + if (val[i] > max) + max = val[i]; + else if (val[i] < min) + min = val[i]; } if ((err = grib_check_data_values_minmax(hand, min, max)) != GRIB_SUCCESS) { @@ -280,10 +165,11 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if (min == max) { is_constant_field = true; - } else { + } + else { if (bits_per_value == 0) { // ECC-1202: A non-constant field with bitsPerValue==0! - bits_per_value = 24; //Set sane value + bits_per_value = 24; // Set sane value } } @@ -303,7 +189,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if ((err = grib_set_long_internal(hand, self->number_of_values, n_vals)) != GRIB_SUCCESS) return err; - bits_per_value = 0; // ECC-1387 + bits_per_value = 0; // ECC-1387 if ((err = grib_set_long_internal(hand, self->bits_per_value, bits_per_value)) != GRIB_SUCCESS) return err; @@ -322,25 +208,25 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if (grib_get_nearest_smaller_value(hand, self->reference_value, min, &reference_value) != GRIB_SUCCESS) { grib_context_log(a->context, GRIB_LOG_ERROR, - "%s %s: Unable to find nearest_smaller_value of %g for %s", cclass_name, __func__, min, self->reference_value); + "%s %s: Unable to find nearest_smaller_value of %g for %s", cclass_name, __func__, min, self->reference_value); return GRIB_INTERNAL_ERROR; } if (reference_value > min) { grib_context_log(a->context, GRIB_LOG_ERROR, - "%s %s: reference_value=%g min_value=%g diff=%g", cclass_name, __func__, reference_value, min, reference_value - min); + "%s %s: reference_value=%g min_value=%g diff=%g", cclass_name, __func__, reference_value, min, reference_value - min); DEBUG_ASSERT(reference_value <= min); return GRIB_INTERNAL_ERROR; } } else { - int last = 127; // last must be a parameter coming from the def file - double range = 0; + int last = 127; // last must be a parameter coming from the def file + double range = 0; double minrange = 0, maxrange = 0; double unscaled_max = 0; double unscaled_min = 0; - double f = 0; - double decimal = 1; + double f = 0; + double decimal = 1; decimal_scale_factor = 0; range = (max - min); @@ -423,17 +309,17 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) } break; default: - grib_context_log(a->context, GRIB_LOG_ERROR,"%s pack_double: packing %s, bits_per_value=%ld (max 32)", - cclass_name, a->name, bits_per_value); + grib_context_log(a->context, GRIB_LOG_ERROR, "%s pack_double: packing %s, bits_per_value=%ld (max 32)", + cclass_name, a->name, bits_per_value); err = GRIB_INVALID_BPV; goto cleanup; } - grib_context_log(a->context, GRIB_LOG_DEBUG,"%s pack_double: packing %s, %zu values", cclass_name, a->name, n_vals); + grib_context_log(a->context, GRIB_LOG_DEBUG, "%s pack_double: packing %s, %zu values", cclass_name, a->name, n_vals); // ECC-1431: GRIB2: CCSDS encoding failure AEC_STREAM_ERROR buflen = (nbytes * n_vals) * 67 / 64 + 256; - buf = (unsigned char*)grib_context_buffer_malloc_clear(a->context, buflen); + buf = (unsigned char*)grib_context_buffer_malloc_clear(a->context, buflen); if (!buf) { err = GRIB_OUT_OF_MEMORY; @@ -448,7 +334,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) grib_get_double_internal(hand, self->reference_value, &ref); if (ref != reference_value) { grib_context_log(a->context, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)", - cclass_name, __func__, self->reference_value, ref, reference_value); + cclass_name, __func__, self->reference_value, ref, reference_value); return GRIB_INTERNAL_ERROR; } } @@ -469,7 +355,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) strm.next_in = encoded; strm.avail_in = nbytes * n_vals; - // This does not support spherical harmonics, and treats 24 differently than: // see http://cdo.sourcearchive.com/documentation/1.5.1.dfsg.1-1/cgribexlib_8c_source.html @@ -477,7 +362,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if ((err = aec_buffer_encode(&strm)) != AEC_OK) { grib_context_log(a->context, GRIB_LOG_ERROR, "%s %s: aec_buffer_encode error %d (%s)", - cclass_name, __func__, err, aec_get_error_message(err)); + cclass_name, __func__, err, aec_get_error_message(err)); err = GRIB_ENCODING_ERROR; goto cleanup; } @@ -502,21 +387,21 @@ template static int unpack(grib_accessor* a, T* val, size_t* len) { static_assert(std::is_floating_point::value, "Requires floating point numbers"); - grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; - grib_handle* hand = grib_handle_of_accessor(a); + grib_accessor_data_ccsds_packing_t* self = (grib_accessor_data_ccsds_packing_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); const char* cclass_name = a->cclass->name; int err = GRIB_SUCCESS, i = 0; size_t buflen = 0; struct aec_stream strm; - double bscale = 0; - double dscale = 0; - unsigned char* buf = NULL; - size_t n_vals = 0; - size_t size = 0; + double bscale = 0; + double dscale = 0; + unsigned char* buf = NULL; + size_t n_vals = 0; + size_t size = 0; unsigned char* decoded = NULL; // unsigned char* p = NULL; - long nn = 0; + long nn = 0; long binary_scale_factor = 0; long decimal_scale_factor = 0; @@ -530,7 +415,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len) self->dirty = 0; - if ((err = grib_value_count(a, &nn)) != GRIB_SUCCESS) + if ((err = a->value_count(&nn)) != GRIB_SUCCESS) return err; n_vals = nn; @@ -569,10 +454,9 @@ static int unpack(grib_accessor* a, T* val, size_t* len) bscale = codes_power(binary_scale_factor, 2); dscale = codes_power(-decimal_scale_factor, 10); - buflen = grib_byte_count(a); - buf = (unsigned char*)hand->buffer->data; - buf += grib_byte_offset(a); - + buflen = a->byte_count(); + buf = (unsigned char*)hand->buffer->data; + buf += a->byte_offset(); strm.flags = ccsds_flags; strm.bits_per_sample = bits_per_value; strm.block_size = ccsds_block_size; @@ -598,13 +482,13 @@ static int unpack(grib_accessor* a, T* val, size_t* len) if ((err = aec_buffer_decode(&strm)) != AEC_OK) { grib_context_log(a->context, GRIB_LOG_ERROR, "%s %s: aec_buffer_decode error %d (%s)", - cclass_name, __func__, err, aec_get_error_message(err)); + cclass_name, __func__, err, aec_get_error_message(err)); err = GRIB_DECODING_ERROR; goto cleanup; } // ECC-1427: Performance improvement (replaced by ECC-1602) - //grib_decode_array(decoded, &pos, bits8 , reference_value, bscale, dscale, n_vals, val); + // grib_decode_array(decoded, &pos, bits8 , reference_value, bscale, dscale, n_vals, val); // ECC-1602: Performance improvement switch (nbytes) { @@ -625,7 +509,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len) break; default: grib_context_log(a->context, GRIB_LOG_ERROR, "%s %s: unpacking %s, bits_per_value=%ld (max 32)", - cclass_name, __func__, a->name, bits_per_value); + cclass_name, __func__, a->name, bits_per_value); err = GRIB_INVALID_BPV; goto cleanup; } @@ -637,26 +521,27 @@ cleanup: return err; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_data_ccsds_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len) { return unpack(a, val, len); } -static int unpack_float(grib_accessor* a, float* val, size_t* len) +int grib_accessor_class_data_ccsds_packing_t::unpack_float(grib_accessor* a, float* val, size_t* len) { return unpack(a, val, len); } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) +int grib_accessor_class_data_ccsds_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val) { // The index idx relates to codedValues NOT values! - const grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int err = 0; - size_t size = 0; - long bits_per_value = 0; + const grib_accessor_data_ccsds_packing_t* self = (grib_accessor_data_ccsds_packing_t*)a; + + grib_handle* hand = grib_handle_of_accessor(a); + int err = 0; + size_t size = 0; + long bits_per_value = 0; double reference_value = 0; - double* values = NULL; + double* values = NULL; if ((err = grib_get_long_internal(hand, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) return err; @@ -684,14 +569,14 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return GRIB_SUCCESS; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +int grib_accessor_class_data_ccsds_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) { - const grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; + const grib_accessor_data_ccsds_packing_t* self = (grib_accessor_data_ccsds_packing_t*)a; grib_handle* hand = grib_handle_of_accessor(a); size_t size = 0, i = 0; - double* values = NULL; - int err = 0; - long bits_per_value = 0; + double* values = NULL; + int err = 0; + long bits_per_value = 0; double reference_value = 0; if ((err = grib_get_long_internal(hand, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) @@ -738,27 +623,27 @@ static void print_error_feature_not_enabled(grib_context* c) "CCSDS support not enabled. " "Please rebuild with -DENABLE_AEC=ON (Adaptive Entropy Coding library)"); } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_data_ccsds_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len) { print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_data_ccsds_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len) { print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int unpack_float(grib_accessor* a, float* val, size_t* len) +int grib_accessor_class_data_ccsds_packing_t::unpack_float(grib_accessor* a, float* val, size_t* len) { print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) +int grib_accessor_class_data_ccsds_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val) { print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +int grib_accessor_class_data_ccsds_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) { print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; diff --git a/src/accessor/grib_accessor_class_data_ccsds_packing.h b/src/accessor/grib_accessor_class_data_ccsds_packing.h new file mode 100644 index 000000000..0f9430232 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_ccsds_packing.h @@ -0,0 +1,45 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_values.h" +#include "grib_scaling.h" + +class grib_accessor_data_ccsds_packing_t : public grib_accessor_values_t +{ +public: + /* Members defined in data_ccsds_packing */ + const char* number_of_values; + const char* reference_value; + const char* binary_scale_factor; + const char* decimal_scale_factor; + const char* optimize_scaling_factor; + const char* bits_per_value; + const char* number_of_data_points; + const char* ccsds_flags; + const char* ccsds_block_size; + const char* ccsds_rsi; +}; + + +class grib_accessor_class_data_ccsds_packing_t : public grib_accessor_class_values_t +{ +public: + grib_accessor_class_data_ccsds_packing_t(const char* name) : grib_accessor_class_values_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_ccsds_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; +}; diff --git a/src/grib_accessor_class_data_complex_packing.cc b/src/accessor/grib_accessor_class_data_complex_packing.cc similarity index 77% rename from src/grib_accessor_class_data_complex_packing.cc rename to src/accessor/grib_accessor_class_data_complex_packing.cc index 49d312611..81e402303 100644 --- a/src/grib_accessor_class_data_complex_packing.cc +++ b/src/accessor/grib_accessor_class_data_complex_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,148 +9,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_ieeefloat.h" -#include "grib_scaling.h" -#include -#include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_float - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - IMPLEMENTS = init - MEMBERS= const char* GRIBEX_sh_bug_present - MEMBERS= const char* ieee_floats - MEMBERS= const char* laplacianOperatorIsSet - MEMBERS= const char* laplacianOperator - MEMBERS= const char* sub_j - MEMBERS= const char* sub_k - MEMBERS= const char* sub_m - MEMBERS= const char* pen_j - MEMBERS= const char* pen_k - MEMBERS= const char* pen_m - END_CLASS_DEF - - */ - - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_complex_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_complex_packing */ - const char* GRIBEX_sh_bug_present; - const char* ieee_floats; - const char* laplacianOperatorIsSet; - const char* laplacianOperator; - const char* sub_j; - const char* sub_k; - const char* sub_m; - const char* pen_j; - const char* pen_k; - const char* pen_m; -} grib_accessor_data_complex_packing; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_complex_packing = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_complex_packing", /* name */ - sizeof(grib_accessor_data_complex_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_data_complex_packing.h" +grib_accessor_class_data_complex_packing_t _grib_accessor_class_data_complex_packing{ "data_complex_packing" }; grib_accessor_class* grib_accessor_class_data_complex_packing = &_grib_accessor_class_data_complex_packing; -/* END_CLASS_IMP */ - -typedef unsigned long (*encode_float_proc)(double); -typedef double (*decode_float_proc)(unsigned long); - -static void init(grib_accessor* a, const long v, grib_arguments* args) +void grib_accessor_class_data_complex_packing_t::init(grib_accessor* a, const long v, grib_arguments* args) { - grib_accessor_data_complex_packing* self = (grib_accessor_data_complex_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_complex_packing_t* self = (grib_accessor_data_complex_packing_t*)a; + grib_handle* gh = grib_handle_of_accessor(a); self->GRIBEX_sh_bug_present = grib_arguments_get_name(gh, args, self->carg++); self->ieee_floats = grib_arguments_get_name(gh, args, self->carg++); @@ -165,15 +34,16 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->flags |= GRIB_ACCESSOR_FLAG_DATA; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_data_complex_packing_t::value_count(grib_accessor* a, long* count) { - grib_accessor_data_complex_packing* self = (grib_accessor_data_complex_packing*)a; - int ret = 0; + grib_accessor_data_complex_packing_t* self = (grib_accessor_data_complex_packing_t*)a; + + int ret = GRIB_SUCCESS; grib_handle* gh = grib_handle_of_accessor(a); - long pen_j = 0; - long pen_k = 0; - long pen_m = 0; - *count = 0; + long pen_j = 0; + long pen_k = 0; + long pen_m = 0; + *count = 0; if (a->length == 0) return 0; @@ -195,7 +65,7 @@ static int value_count(grib_accessor* a, long* count) return ret; } -static double calculate_pfactor(const grib_context* ctx, const double* spectralField, long fieldTruncation, long subsetTruncation) +double calculate_pfactor(const grib_context* ctx, const double* spectralField, long fieldTruncation, long subsetTruncation) { /*long n_vals = ((fieldTruncation+1)*(fieldTruncation+2));*/ long loop, index, m, n = 0; @@ -229,7 +99,6 @@ static double calculate_pfactor(const grib_context* ctx, const double* spectralF /* * Form norms for the rows which contain part of the unscaled subset. */ - index = -2; for (m = 0; m < subsetTruncation; m++) { for (n = m; n <= fieldTruncation; n++) { @@ -244,7 +113,6 @@ static double calculate_pfactor(const grib_context* ctx, const double* spectralF /* * Form norms for the rows which do not contain part of the unscaled subset. */ - for (m = subsetTruncation; m <= fieldTruncation; m++) { for (n = m; n <= fieldTruncation; n++) { index += 2; @@ -280,7 +148,6 @@ static double calculate_pfactor(const grib_context* ctx, const double* spectralF /* * Perform a least square fit for the equation */ - for (loop = ismin; loop <= ismax; loop++) { x = log((double)(loop * (loop + 1))); y = log(norms[loop]); @@ -302,11 +169,11 @@ static double calculate_pfactor(const grib_context* ctx, const double* spectralF return pFactor; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_data_complex_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_data_complex_packing* self = (grib_accessor_data_complex_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); - const char* cclass_name = a->cclass->name; + grib_accessor_data_complex_packing_t* self = (grib_accessor_data_complex_packing_t*)a; + grib_handle* gh = grib_handle_of_accessor(a); + const char* cclass_name = a->cclass->name; size_t i = 0; int ret = GRIB_SUCCESS; @@ -654,7 +521,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) grib_get_double_internal(gh, self->reference_value, &ref); if (ref != reference_value) { grib_context_log(a->context, GRIB_LOG_ERROR, "%s %s: %s (ref=%.10e != reference_value=%.10e)", - cclass_name, __func__, self->reference_value, ref, reference_value); + cclass_name, __func__, self->reference_value, ref, reference_value); return GRIB_INTERNAL_ERROR; } } @@ -671,32 +538,31 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return ret; } - template -static int unpack(grib_accessor* a, T* val, size_t* len) +static int unpack_real(grib_accessor* a, T* val, size_t* len) { static_assert(std::is_floating_point::value, "Requires floating point numbers"); - grib_accessor_data_complex_packing* self = (grib_accessor_data_complex_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); - const char* cclass_name = a->cclass->name; + grib_accessor_data_complex_packing_t* self = (grib_accessor_data_complex_packing_t*)a; + grib_handle* gh = grib_handle_of_accessor(a); + const char* cclass_name = a->cclass->name; - size_t i = 0; - int ret = GRIB_SUCCESS; - long hcount = 0; - long lcount = 0; - long hpos = 0; - long lup = 0; - long mmax = 0; - long n_vals = 0; - T* scals = NULL; - T* pscals = NULL, *pval = NULL; + size_t i = 0; + int ret = GRIB_SUCCESS; + long hcount = 0; + long lcount = 0; + long hpos = 0; + long lup = 0; + long mmax = 0; + long n_vals = 0; + T* scals = NULL; + T *pscals = NULL, *pval = NULL; T s = 0; T d = 0; T laplacianOperator = 0; - unsigned char* buf = NULL; - unsigned char* hres = NULL; - unsigned char* lres = NULL; + unsigned char* buf = NULL; + unsigned char* hres = NULL; + unsigned char* lres = NULL; unsigned long packed_offset; long lpos = 0; @@ -706,7 +572,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len) long offsetdata = 0; long bits_per_value = 0; - T reference_value = 0; + T reference_value = 0; long binary_scale_factor = 0; long decimal_scale_factor = 0; @@ -724,7 +590,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len) decode_float_proc decode_float = NULL; - err = grib_value_count(a, &n_vals); + err = a->value_count(&n_vals); if (err) return err; @@ -798,7 +664,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len) maxv = pen_j + 1; - buf += grib_byte_offset(a); + buf += a->byte_offset(); hres = buf; lres = buf; @@ -814,9 +680,8 @@ static int unpack(grib_accessor* a, T* val, size_t* len) return 0; } - packed_offset = grib_byte_offset(a) + bytes * (sub_k + 1) * (sub_k + 2); - - lpos = 8 * (packed_offset - offsetdata); + packed_offset = a->byte_offset() + bytes * (sub_k + 1) * (sub_k + 2); + lpos = 8 * (packed_offset - offsetdata); s = codes_power(binary_scale_factor, 2); d = codes_power(-decimal_scale_factor, 10); @@ -831,7 +696,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len) scals[i] = (1.0 / operat); else { grib_context_log(a->context, GRIB_LOG_WARNING, - "%s: Problem with operator div by zero at index %d of %d", cclass_name, i, maxv); + "%s: Problem with operator div by zero at index %d of %d", cclass_name, i, maxv); scals[i] = 0; } } @@ -895,34 +760,31 @@ static int unpack(grib_accessor* a, T* val, size_t* len) return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_data_complex_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len) { - return unpack(a, val, len); + return unpack_real(a, val, len); } -static int unpack_float(grib_accessor* a, float* val, size_t* len) +int grib_accessor_class_data_complex_packing_t::unpack_float(grib_accessor* a, float* val, size_t* len) { // TODO(maee): See ECC-1579 // Investigate why results are not bit-identical // return unpack(a, val, len); - int err = 0; - size_t i = 0; - size_t size = *len; - double* val8 = NULL; - val8 = (double*)grib_context_malloc(a->context, size*(sizeof(double))); + size_t size = *len; + double* val8 = (double*)grib_context_malloc(a->context, size * (sizeof(double))); if (!val8) return GRIB_OUT_OF_MEMORY; - err = unpack(a, val8, len); + int err = unpack_real(a, val8, len); if (err) { - grib_context_free(a->context,val8); + grib_context_free(a->context, val8); return err; } - for(i=0; icontext,val8); + grib_context_free(a->context, val8); return GRIB_SUCCESS; } diff --git a/src/accessor/grib_accessor_class_data_complex_packing.h b/src/accessor/grib_accessor_class_data_complex_packing.h new file mode 100644 index 000000000..ee19b195c --- /dev/null +++ b/src/accessor/grib_accessor_class_data_complex_packing.h @@ -0,0 +1,46 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" +#include "grib_scaling.h" +#include "grib_ieeefloat.h" + +typedef unsigned long (*encode_float_proc)(double); +typedef double (*decode_float_proc)(unsigned long); + +class grib_accessor_data_complex_packing_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_complex_packing */ + const char* GRIBEX_sh_bug_present; + const char* ieee_floats; + const char* laplacianOperatorIsSet; + const char* laplacianOperator; + const char* sub_j; + const char* sub_k; + const char* sub_m; + const char* pen_j; + const char* pen_k; + const char* pen_m; +}; + +class grib_accessor_class_data_complex_packing_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_complex_packing_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_complex_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_dummy_field.cc b/src/accessor/grib_accessor_class_data_dummy_field.cc new file mode 100644 index 000000000..eddadcc08 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_dummy_field.cc @@ -0,0 +1,102 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_dummy_field.h" + +grib_accessor_class_data_dummy_field_t _grib_accessor_class_data_dummy_field{"data_dummy_field"}; +grib_accessor_class* grib_accessor_class_data_dummy_field = &_grib_accessor_class_data_dummy_field; + + +void grib_accessor_class_data_dummy_field_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_g1simple_packing_t::init(a, v, args); + grib_accessor_data_dummy_field_t* self = (grib_accessor_data_dummy_field_t*)a; + self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->numberOfPoints = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); +} + +int grib_accessor_class_data_dummy_field_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_dummy_field_t* self = (grib_accessor_data_dummy_field_t*)a; + size_t i = 0, n_vals = 0; + long numberOfPoints; + double missing_value = 0; + int err = 0; + + if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, &numberOfPoints)) != GRIB_SUCCESS) + return err; + n_vals = numberOfPoints; + + if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &missing_value)) != GRIB_SUCCESS) + return err; + + if (*len < n_vals) { + *len = n_vals; + return GRIB_ARRAY_TOO_SMALL; + } + + for (i = 0; i < n_vals; i++) + val[i] = missing_value; + + if (grib_find_accessor(grib_handle_of_accessor(a), self->bitmap)) { + if ((err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->bitmap, val, n_vals)) != GRIB_SUCCESS) + return err; + } + + *len = (long)n_vals; + return err; +} + +int grib_accessor_class_data_dummy_field_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_dummy_field_t* self = (grib_accessor_data_dummy_field_t*)a; + + size_t n_vals = *len; + int err = 0; + long bits_per_value = 0; + long half_byte = 0; + size_t buflen = 0; + unsigned char* buf = NULL; + + if (*len == 0) + return GRIB_NO_VALUES; + + if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) + return err; + + buflen = (1 + ((bits_per_value * n_vals) / 8)) * sizeof(unsigned char); + + buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen); + if (!buf) + return GRIB_OUT_OF_MEMORY; + + half_byte = (buflen * 8) - ((*len) * bits_per_value); + + if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->half_byte, half_byte)) != GRIB_SUCCESS) { + grib_context_free(a->context, buf); + return err; + } + grib_buffer_replace(a, buf, buflen, 1, 1); + + grib_context_free(a->context, buf); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_data_dummy_field_t::value_count(grib_accessor* a, long* numberOfPoints){ + grib_accessor_data_dummy_field_t* self = (grib_accessor_data_dummy_field_t*)a; + int err = 0; + *numberOfPoints = 0; + + if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, numberOfPoints)) != GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to get count of %s (%s)", a->name, grib_get_error_message(err)); + } + + return err; +} diff --git a/src/accessor/grib_accessor_class_data_dummy_field.h b/src/accessor/grib_accessor_class_data_dummy_field.h new file mode 100644 index 000000000..c846abb98 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_dummy_field.h @@ -0,0 +1,33 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_g1simple_packing.h" + +class grib_accessor_data_dummy_field_t : public grib_accessor_data_g1simple_packing_t +{ +public: + /* Members defined in data_dummy_field */ + const char* missing_value; + const char* numberOfPoints; + const char* bitmap; +}; + +class grib_accessor_class_data_dummy_field_t : public grib_accessor_class_data_g1simple_packing_t +{ +public: + grib_accessor_class_data_dummy_field_t(const char* name) : grib_accessor_class_data_g1simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_dummy_field_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_g1complex_packing.cc b/src/accessor/grib_accessor_class_data_g1complex_packing.cc new file mode 100644 index 000000000..5ac11346e --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1complex_packing.cc @@ -0,0 +1,112 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_g1complex_packing.h" + +grib_accessor_class_data_g1complex_packing_t _grib_accessor_class_data_g1complex_packing{"data_g1complex_packing"}; +grib_accessor_class* grib_accessor_class_data_g1complex_packing = &_grib_accessor_class_data_g1complex_packing; + + +void grib_accessor_class_data_g1complex_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_complex_packing_t::init(a, v, args); + grib_accessor_data_g1complex_packing_t* self = (grib_accessor_data_g1complex_packing_t*)a; + self->half_byte = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->N = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->packingType = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->ieee_packing = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->edition = 1; + a->flags |= GRIB_ACCESSOR_FLAG_DATA; +} + +int grib_accessor_class_data_g1complex_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_g1complex_packing_t* self = (grib_accessor_data_g1complex_packing_t*)a; + int ret = GRIB_SUCCESS; + long seclen = 0; + long sub_j = 0; + long sub_k = 0; + long sub_m = 0; + long n = 0; + long half_byte = 0; + long bits_per_value = 0; + size_t buflen = 0; + + if (*len == 0) + return GRIB_NO_VALUES; + +// /* TODO: spectral_ieee does not work */ +// if (c->ieee_packing && self->ieee_packing) { +// grib_handle* h = grib_handle_of_accessor(a); +// grib_context* c = a->context; +// char* packingType_s = NULL; +// char* ieee_packing_s = NULL; +// long precision = c->ieee_packing == 32 ? 1 : 2; +// size_t lenstr = strlen(self->ieee_packing); + +// packingType_s = grib_context_strdup(c, self->packingType); +// ieee_packing_s = grib_context_strdup(c, self->ieee_packing); +// precision_s = grib_context_strdup(c, self->precision); + +// grib_set_string(h, packingType_s, ieee_packing_s, &lenstr); +// grib_set_long(h, precision_s, precision); + +// grib_context_free(c, packingType_s); +// grib_context_free(c, ieee_packing_s); +// grib_context_free(c, precision_s); +// return grib_set_double_array(h, "values", val, *len); +// } + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->sub_j, &sub_j)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->sub_k, &sub_k)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->sub_m, &sub_m)) != GRIB_SUCCESS) + return ret; + + self->dirty = 1; + + Assert((sub_j == sub_k) && (sub_m == sub_j)); + + ret = grib_accessor_class_data_complex_packing_t::pack_double(a, val, len); + + if (ret == GRIB_SUCCESS) { + n = a->offset + 4 * ((sub_k + 1) * (sub_k + 2)); + + /* Octet number starts from beginning of message but shouldn't */ + if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->N, n)) != GRIB_SUCCESS) + return ret; + + // ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetsection, &offsetsection); + // if (ret != GRIB_SUCCESS) + // return ret; + // if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->N, n - offsetsection)) != GRIB_SUCCESS) + // return ret; + + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bits_per_value, &bits_per_value); + if (ret != GRIB_SUCCESS) + return ret; + + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->seclen, &seclen); + if (ret != GRIB_SUCCESS) + return ret; + + buflen = 32 * (sub_k + 1) * (sub_k + 2) + (*len - (sub_k + 1) * (sub_k + 2)) * bits_per_value + 18 * 8; + half_byte = seclen * 8 - buflen; + if (a->context->debug == -1) { + fprintf(stderr, "ECCODES DEBUG: half_byte=%ld\n", half_byte); + } + + ret = grib_set_long_internal(grib_handle_of_accessor(a), self->half_byte, half_byte); + if (ret != GRIB_SUCCESS) + return ret; + } + return ret; +} diff --git a/src/accessor/grib_accessor_class_data_g1complex_packing.h b/src/accessor/grib_accessor_class_data_g1complex_packing.h new file mode 100644 index 000000000..51457e40e --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1complex_packing.h @@ -0,0 +1,33 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_complex_packing.h" + +class grib_accessor_data_g1complex_packing_t : public grib_accessor_data_complex_packing_t +{ +public: + /* Members defined in data_g1complex_packing */ + const char* N; + const char* half_byte; + const char* packingType; + const char* ieee_packing; + const char* precision; +}; + +class grib_accessor_class_data_g1complex_packing_t : public grib_accessor_class_data_complex_packing_t +{ +public: + grib_accessor_class_data_g1complex_packing_t(const char* name) : grib_accessor_class_data_complex_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g1complex_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_data_g1second_order_constant_width_packing.cc b/src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.cc similarity index 57% rename from src/grib_accessor_class_data_g1second_order_constant_width_packing.cc rename to src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.cc index 079e91829..579fbd8cb 100644 --- a/src/grib_accessor_class_data_g1second_order_constant_width_packing.cc +++ b/src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,157 +9,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ +#include "grib_accessor_class_data_g1second_order_constant_width_packing.h" #include "grib_scaling.h" -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = unpack_double;unpack_float - IMPLEMENTS = unpack_double_element;unpack_double_element_set - IMPLEMENTS = value_count - MEMBERS=const char* half_byte - MEMBERS=const char* packingType - MEMBERS=const char* ieee_packing - MEMBERS=const char* precision - MEMBERS=const char* widthOfFirstOrderValues - MEMBERS=const char* N1 - MEMBERS=const char* N2 - MEMBERS=const char* numberOfGroups - MEMBERS=const char* numberOfSecondOrderPackedValues - MEMBERS=const char* extraValues - MEMBERS=const char* pl - MEMBERS=const char* Ni - MEMBERS=const char* Nj - MEMBERS=const char* jPointsAreConsecutive - MEMBERS=const char* bitmap - MEMBERS=const char* groupWidth - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_data_g1second_order_constant_width_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_g1second_order_constant_width_packing */ - const char* half_byte; - const char* packingType; - const char* ieee_packing; - const char* precision; - const char* widthOfFirstOrderValues; - const char* N1; - const char* N2; - const char* numberOfGroups; - const char* numberOfSecondOrderPackedValues; - const char* extraValues; - const char* pl; - const char* Ni; - const char* Nj; - const char* jPointsAreConsecutive; - const char* bitmap; - const char* groupWidth; -} grib_accessor_data_g1second_order_constant_width_packing; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_g1second_order_constant_width_packing = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_g1second_order_constant_width_packing", /* name */ - sizeof(grib_accessor_data_g1second_order_constant_width_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_data_g1second_order_constant_width_packing_t _grib_accessor_class_data_g1second_order_constant_width_packing{"data_g1second_order_constant_width_packing"}; grib_accessor_class* grib_accessor_class_data_g1second_order_constant_width_packing = &_grib_accessor_class_data_g1second_order_constant_width_packing; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g1second_order_constant_width_packing* self = (grib_accessor_data_g1second_order_constant_width_packing*)a; +void grib_accessor_class_data_g1second_order_constant_width_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_g1second_order_constant_width_packing_t* self = (grib_accessor_data_g1second_order_constant_width_packing_t*)a; grib_handle* hand = grib_handle_of_accessor(a); self->half_byte = grib_arguments_get_name(hand, args, self->carg++); @@ -181,10 +41,9 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->flags |= GRIB_ACCESSOR_FLAG_DATA; } -static int value_count(grib_accessor* a, long* numberOfSecondOrderPackedValues) -{ +int grib_accessor_class_data_g1second_order_constant_width_packing_t::value_count(grib_accessor* a, long* numberOfSecondOrderPackedValues){ int err = 0; - grib_accessor_data_g1second_order_constant_width_packing* self = (grib_accessor_data_g1second_order_constant_width_packing*)a; + grib_accessor_data_g1second_order_constant_width_packing_t* self = (grib_accessor_data_g1second_order_constant_width_packing_t*)a; *numberOfSecondOrderPackedValues = 0; err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfSecondOrderPackedValues, numberOfSecondOrderPackedValues); @@ -192,14 +51,12 @@ static int value_count(grib_accessor* a, long* numberOfSecondOrderPackedValues) return err; } -static int unpack_float(grib_accessor*, float* val, size_t* len) -{ +int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_float(grib_accessor*, float* val, size_t* len){ return GRIB_NOT_IMPLEMENTED; } -static int unpack_double(grib_accessor* a, double* values, size_t* len) -{ - grib_accessor_data_g1second_order_constant_width_packing* self = (grib_accessor_data_g1second_order_constant_width_packing*)a; +int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_double(grib_accessor* a, double* values, size_t* len){ + grib_accessor_data_g1second_order_constant_width_packing_t* self = (grib_accessor_data_g1second_order_constant_width_packing_t*)a; int ret = 0; long numberOfGroups, numberOfSecondOrderPackedValues; long groupWidth = 0; @@ -218,8 +75,7 @@ static int unpack_double(grib_accessor* a, double* values, size_t* len) long* secondaryBitmap; grib_handle* hand = grib_handle_of_accessor(a); - buf += grib_byte_offset(a); - + buf += a->byte_offset(); if ((ret = grib_get_long_internal(hand, self->numberOfGroups, &numberOfGroups)) != GRIB_SUCCESS) return ret; @@ -321,15 +177,13 @@ static int unpack_double(grib_accessor* a, double* values, size_t* len) return ret; } -static int pack_double(grib_accessor* a, const double* cval, size_t* len) -{ +int grib_accessor_class_data_g1second_order_constant_width_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len){ const char* cclass_name = a->cclass->name; grib_context_log(a->context, GRIB_LOG_ERROR, "%s: %s: Not implemented", cclass_name, __func__); return GRIB_NOT_IMPLEMENTED; } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) -{ +int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){ grib_handle* hand = grib_handle_of_accessor(a); size_t size = 0; double* values = NULL; @@ -354,8 +208,7 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return GRIB_SUCCESS; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) -{ +int grib_accessor_class_data_g1second_order_constant_width_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){ grib_handle* hand = grib_handle_of_accessor(a); size_t size = 0, i = 0; double* values = NULL; diff --git a/src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.h b/src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.h new file mode 100644 index 000000000..8d2d53f0a --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1second_order_constant_width_packing.h @@ -0,0 +1,49 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" + +class grib_accessor_data_g1second_order_constant_width_packing_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_g1second_order_constant_width_packing */ + const char* half_byte; + const char* packingType; + const char* ieee_packing; + const char* precision; + const char* widthOfFirstOrderValues; + const char* N1; + const char* N2; + const char* numberOfGroups; + const char* numberOfSecondOrderPackedValues; + const char* extraValues; + const char* pl; + const char* Ni; + const char* Nj; + const char* jPointsAreConsecutive; + const char* bitmap; + const char* groupWidth; +}; + +class grib_accessor_class_data_g1second_order_constant_width_packing_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_g1second_order_constant_width_packing_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g1second_order_constant_width_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; +}; diff --git a/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc b/src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.cc similarity index 84% rename from src/grib_accessor_class_data_g1second_order_general_extended_packing.cc rename to src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.cc index d337dba48..f78bb1806 100644 --- a/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc +++ b/src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,181 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ +#include "grib_accessor_class_data_g1second_order_general_extended_packing.h" #include "grib_scaling.h" -#include "grib_api_internal.h" -#include "grib_optimize_decimal_factor.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = unpack_double;unpack_float - IMPLEMENTS = unpack_double_element;unpack_double_element_set - IMPLEMENTS = value_count - IMPLEMENTS = destroy - MEMBERS=const char* half_byte - MEMBERS=const char* packingType - MEMBERS=const char* ieee_packing - MEMBERS=const char* precision - MEMBERS=const char* widthOfFirstOrderValues - MEMBERS=const char* firstOrderValues - MEMBERS=const char* N1 - MEMBERS=const char* N2 - MEMBERS=const char* numberOfGroups - MEMBERS=const char* codedNumberOfGroups - MEMBERS=const char* numberOfSecondOrderPackedValues - MEMBERS=const char* extraValues - MEMBERS=const char* groupWidths - MEMBERS=const char* widthOfWidths - MEMBERS=const char* groupLengths - MEMBERS=const char* widthOfLengths - MEMBERS=const char* NL - MEMBERS=const char* SPD - MEMBERS=const char* widthOfSPD - MEMBERS=const char* orderOfSPD - MEMBERS=const char* numberOfPoints - MEMBERS=const char* dataFlag - MEMBERS=double* dvalues - MEMBERS=float* fvalues - MEMBERS=int double_dirty - MEMBERS=int float_dirty - MEMBERS=size_t size - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_data_g1second_order_general_extended_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_g1second_order_general_extended_packing */ - const char* half_byte; - const char* packingType; - const char* ieee_packing; - const char* precision; - const char* widthOfFirstOrderValues; - const char* firstOrderValues; - const char* N1; - const char* N2; - const char* numberOfGroups; - const char* codedNumberOfGroups; - const char* numberOfSecondOrderPackedValues; - const char* extraValues; - const char* groupWidths; - const char* widthOfWidths; - const char* groupLengths; - const char* widthOfLengths; - const char* NL; - const char* SPD; - const char* widthOfSPD; - const char* orderOfSPD; - const char* numberOfPoints; - const char* dataFlag; - double* dvalues; - float* fvalues; - int double_dirty; - int float_dirty; - size_t size; -} grib_accessor_data_g1second_order_general_extended_packing; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_g1second_order_general_extended_packing = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_g1second_order_general_extended_packing", /* name */ - sizeof(grib_accessor_data_g1second_order_general_extended_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_data_g1second_order_general_extended_packing_t _grib_accessor_class_data_g1second_order_general_extended_packing{ "data_g1second_order_general_extended_packing" }; grib_accessor_class* grib_accessor_class_data_g1second_order_general_extended_packing = &_grib_accessor_class_data_g1second_order_general_extended_packing; -/* END_CLASS_IMP */ #define MAX_NUMBER_OF_GROUPS 65534 -#define EFDEBUG 0 +#define EFDEBUG 0 static const unsigned long nbits[64] = { 0x1, 0x2, 0x4, 0x8, @@ -203,7 +38,7 @@ static const unsigned long nbits[64] = { 0x1000000000000000, 0x2000000000000000, 0x4000000000000000, 0x8000000000000000 }; -static long number_of_bits(grib_handle* h, unsigned long x) +long number_of_bits(grib_handle* h, unsigned long x) { const unsigned long* n = nbits; const int count = sizeof(nbits) / sizeof(nbits[0]); @@ -220,10 +55,11 @@ static long number_of_bits(grib_handle* h, unsigned long x) return i; } -static void init(grib_accessor* a, const long v, grib_arguments* args) +void grib_accessor_class_data_g1second_order_general_extended_packing_t::init(grib_accessor* a, const long v, grib_arguments* args) { - grib_accessor_data_g1second_order_general_extended_packing* self = (grib_accessor_data_g1second_order_general_extended_packing*)a; - grib_handle* handle = grib_handle_of_accessor(a); + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_g1second_order_general_extended_packing_t* self = (grib_accessor_data_g1second_order_general_extended_packing_t*)a; + grib_handle* handle = grib_handle_of_accessor(a); self->half_byte = grib_arguments_get_name(handle, args, self->carg++); self->packingType = grib_arguments_get_name(handle, args, self->carg++); @@ -249,18 +85,18 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) self->dataFlag = grib_arguments_get_name(handle, args, self->carg++); self->edition = 1; self->dirty = 1; - self->dvalues = NULL; - self->fvalues = NULL; + self->dvalues = NULL; + self->fvalues = NULL; self->double_dirty = self->float_dirty = 1; - self->size = 0; + self->size = 0; a->flags |= GRIB_ACCESSOR_FLAG_DATA; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_data_g1second_order_general_extended_packing_t::value_count(grib_accessor* a, long* count) { - grib_accessor_data_g1second_order_general_extended_packing* self = (grib_accessor_data_g1second_order_general_extended_packing*)a; - long numberOfCodedValues = 0; - long numberOfGroups = 0; + grib_accessor_data_g1second_order_general_extended_packing_t* self = (grib_accessor_data_g1second_order_general_extended_packing_t*)a; + long numberOfCodedValues = 0; + long numberOfGroups = 0; size_t ngroups; long* groupLengths; long orderOfSPD = 0; @@ -293,7 +129,7 @@ static int value_count(grib_accessor* a, long* count) return err; } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) +int grib_accessor_class_data_g1second_order_general_extended_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val) { size_t size; double* values; @@ -317,7 +153,7 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return GRIB_SUCCESS; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +int grib_accessor_class_data_g1second_order_general_extended_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) { size_t size = 0, i = 0; double* values; @@ -345,10 +181,10 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array return GRIB_SUCCESS; } -static int unpack(grib_accessor* a, double* dvalues, float* fvalues, size_t* len) +int grib_accessor_class_data_g1second_order_general_extended_packing_t::unpack(grib_accessor* a, double* dvalues, float* fvalues, size_t* len) { - grib_accessor_data_g1second_order_general_extended_packing* self = (grib_accessor_data_g1second_order_general_extended_packing*)a; - int ret = 0; + grib_accessor_data_g1second_order_general_extended_packing_t* self = (grib_accessor_data_g1second_order_general_extended_packing_t*)a; + int ret = 0; long numberOfGroups, numberOfSecondOrderPackedValues; long* firstOrderValues = 0; long* X = 0; @@ -396,8 +232,9 @@ static int unpack(grib_accessor* a, double* dvalues, float* fvalues, size_t* len self->float_dirty = 0; } - buf += grib_byte_offset(a); - ret = value_count(a, &numberOfValues); + buf += a->byte_offset(); + ret = a->value_count(&numberOfValues); + if (ret) return ret; @@ -461,14 +298,13 @@ static int unpack(grib_accessor* a, double* dvalues, float* fvalues, size_t* len n++; } -// for (j=0;jdvalues) { if (numberOfValues != self->size) { grib_context_free(a->context, self->dvalues); @@ -565,12 +401,12 @@ static int unpack(grib_accessor* a, double* dvalues, float* fvalues, size_t* len return ret; } -static int unpack_float(grib_accessor* a, float* values, size_t* len) +int grib_accessor_class_data_g1second_order_general_extended_packing_t::unpack_float(grib_accessor* a, float* values, size_t* len) { return unpack(a, NULL, values, len); } -static int unpack_double(grib_accessor* a, double* values, size_t* len) +int grib_accessor_class_data_g1second_order_general_extended_packing_t::unpack_double(grib_accessor* a, double* values, size_t* len) { return unpack(a, values, NULL, len); } @@ -698,7 +534,8 @@ static int get_bits_per_value(grib_handle* h, const char* bits_per_value_str, lo /* Note: on a 32bit system, the most significant bit is for signedness, so we have to drop one bit */ if (sizeof(long) == 4) { *bits_per_value = 31; - } else { + } + else { *bits_per_value = 32; } } @@ -708,11 +545,11 @@ static int get_bits_per_value(grib_handle* h, const char* bits_per_value_str, lo // For the old implementation of pack_double, see // src/deprecated/grib_accessor_class_data_g1second_order_general_extended_packing.pack_double.cc // See ECC-441 and ECC-261 -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_data_g1second_order_general_extended_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_data_g1second_order_general_extended_packing* self = (grib_accessor_data_g1second_order_general_extended_packing*)a; - int ret = 0; - int grib2 = 0; + grib_accessor_data_g1second_order_general_extended_packing_t* self = (grib_accessor_data_g1second_order_general_extended_packing_t*)a; + int ret = 0; + int grib2 = 0; long bits_per_value, orderOfSPD, binary_scale_factor; long numberOfValues; double max, min; @@ -1303,7 +1140,9 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) pos = 0; if (orderOfSPD) { - long SPD[4] = {0,}; + long SPD[4] = { + 0, + }; size_t nSPD = orderOfSPD + 1; Assert(orderOfSPD <= 3); for (i = 0; i < orderOfSPD; i++) @@ -1365,9 +1204,9 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return GRIB_SUCCESS; } -static void destroy(grib_context* context, grib_accessor* a) +void grib_accessor_class_data_g1second_order_general_extended_packing_t::destroy(grib_context* context, grib_accessor* a) { - grib_accessor_data_g1second_order_general_extended_packing* self = (grib_accessor_data_g1second_order_general_extended_packing*)a; + grib_accessor_data_g1second_order_general_extended_packing_t* self = (grib_accessor_data_g1second_order_general_extended_packing_t*)a; if (self->dvalues != NULL) { grib_context_free(context, self->dvalues); self->dvalues = NULL; @@ -1376,4 +1215,5 @@ static void destroy(grib_context* context, grib_accessor* a) grib_context_free(context, self->fvalues); self->fvalues = NULL; } + grib_accessor_class_data_simple_packing_t::destroy(context, a); } diff --git a/src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.h b/src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.h new file mode 100644 index 000000000..4bb50ae34 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1second_order_general_extended_packing.h @@ -0,0 +1,64 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" + +class grib_accessor_data_g1second_order_general_extended_packing_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_g1second_order_general_extended_packing */ + const char* half_byte; + const char* packingType; + const char* ieee_packing; + const char* precision; + const char* widthOfFirstOrderValues; + const char* firstOrderValues; + const char* N1; + const char* N2; + const char* numberOfGroups; + const char* codedNumberOfGroups; + const char* numberOfSecondOrderPackedValues; + const char* extraValues; + const char* groupWidths; + const char* widthOfWidths; + const char* groupLengths; + const char* widthOfLengths; + const char* NL; + const char* SPD; + const char* widthOfSPD; + const char* orderOfSPD; + const char* numberOfPoints; + const char* dataFlag; + double* dvalues; + float* fvalues; + int double_dirty; + int float_dirty; + size_t size; +}; + +class grib_accessor_class_data_g1second_order_general_extended_packing_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_g1second_order_general_extended_packing_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g1second_order_general_extended_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; + +private: + int unpack(grib_accessor* a, double*, float*, size_t*); +}; diff --git a/src/grib_accessor_class_data_g1second_order_general_packing.cc b/src/accessor/grib_accessor_class_data_g1second_order_general_packing.cc similarity index 50% rename from src/grib_accessor_class_data_g1second_order_general_packing.cc rename to src/accessor/grib_accessor_class_data_g1second_order_general_packing.cc index 3e41fd3e0..8fb0165d0 100644 --- a/src/grib_accessor_class_data_g1second_order_general_packing.cc +++ b/src/accessor/grib_accessor_class_data_g1second_order_general_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,157 +9,17 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_scaling.h" -#include "grib_api_internal.h" -#include - - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = unpack_double;unpack_float - IMPLEMENTS = value_count - MEMBERS=const char* half_byte - MEMBERS=const char* packingType - MEMBERS=const char* ieee_packing - MEMBERS=const char* precision - MEMBERS=const char* widthOfFirstOrderValues - MEMBERS=const char* N1 - MEMBERS=const char* N2 - MEMBERS=const char* numberOfGroups - MEMBERS=const char* numberOfSecondOrderPackedValues - MEMBERS=const char* extraValues - MEMBERS=const char* pl - MEMBERS=const char* Ni - MEMBERS=const char* Nj - MEMBERS=const char* jPointsAreConsecutive - MEMBERS=const char* bitmap - MEMBERS=const char* groupWidths - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g1second_order_general_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_g1second_order_general_packing */ - const char* half_byte; - const char* packingType; - const char* ieee_packing; - const char* precision; - const char* widthOfFirstOrderValues; - const char* N1; - const char* N2; - const char* numberOfGroups; - const char* numberOfSecondOrderPackedValues; - const char* extraValues; - const char* pl; - const char* Ni; - const char* Nj; - const char* jPointsAreConsecutive; - const char* bitmap; - const char* groupWidths; -} grib_accessor_data_g1second_order_general_packing; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_g1second_order_general_packing = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_g1second_order_general_packing", /* name */ - sizeof(grib_accessor_data_g1second_order_general_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_data_g1second_order_general_packing.h" +grib_accessor_class_data_g1second_order_general_packing_t _grib_accessor_class_data_g1second_order_general_packing{ "data_g1second_order_general_packing" }; grib_accessor_class* grib_accessor_class_data_g1second_order_general_packing = &_grib_accessor_class_data_g1second_order_general_packing; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) +void grib_accessor_class_data_g1second_order_general_packing_t::init(grib_accessor* a, const long v, grib_arguments* args) { - grib_accessor_data_g1second_order_general_packing* self = (grib_accessor_data_g1second_order_general_packing*)a; - grib_handle* hand = grib_handle_of_accessor(a); + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_g1second_order_general_packing_t* self = (grib_accessor_data_g1second_order_general_packing_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); self->half_byte = grib_arguments_get_name(hand, args, self->carg++); self->packingType = grib_arguments_get_name(hand, args, self->carg++); @@ -180,23 +41,22 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->flags |= GRIB_ACCESSOR_FLAG_DATA; } -static int value_count(grib_accessor* a, long* numberOfSecondOrderPackedValues) +int grib_accessor_class_data_g1second_order_general_packing_t::value_count(grib_accessor* a, long* numberOfSecondOrderPackedValues) { - int err = 0; - grib_accessor_data_g1second_order_general_packing* self = (grib_accessor_data_g1second_order_general_packing*)a; - *numberOfSecondOrderPackedValues = 0; + grib_accessor_data_g1second_order_general_packing_t* self = (grib_accessor_data_g1second_order_general_packing_t*)a; + *numberOfSecondOrderPackedValues = 0; - err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfSecondOrderPackedValues, numberOfSecondOrderPackedValues); + int err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfSecondOrderPackedValues, numberOfSecondOrderPackedValues); return err; } template -static int unpack(grib_accessor* a, T* values, size_t* len) +static int unpack_real(grib_accessor* a, T* values, size_t* len) { static_assert(std::is_floating_point::value, "Requires floating point numbers"); - grib_accessor_data_g1second_order_general_packing* self = (grib_accessor_data_g1second_order_general_packing*)a; - int ret = 0; + grib_accessor_data_g1second_order_general_packing_t* self = (grib_accessor_data_g1second_order_general_packing_t*)a; + int ret = 0; long numberOfGroups, numberOfSecondOrderPackedValues; long* groupWidths = 0; long* firstOrderValues = 0; @@ -213,8 +73,7 @@ static int unpack(grib_accessor* a, T* values, size_t* len) long groupLength, j; size_t groupWidthsSize; - buf += grib_byte_offset(a); - + buf += a->byte_offset(); if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfGroups, &numberOfGroups)) != GRIB_SUCCESS) return ret; @@ -296,25 +155,24 @@ static int unpack(grib_accessor* a, T* values, size_t* len) return ret; } -static int unpack_float(grib_accessor* a, float* values, size_t* len) +int grib_accessor_class_data_g1second_order_general_packing_t::unpack_float(grib_accessor* a, float* values, size_t* len) { - return unpack(a, values, len); + return unpack_real(a, values, len); } -static int unpack_double(grib_accessor* a, double* values, size_t* len) +int grib_accessor_class_data_g1second_order_general_packing_t::unpack_double(grib_accessor* a, double* values, size_t* len) { - return unpack(a, values, len); + return unpack_real(a, values, len); } -static int pack_double(grib_accessor* a, const double* cval, size_t* len) +int grib_accessor_class_data_g1second_order_general_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len) { /* return GRIB_NOT_IMPLEMENTED; */ - int err = 0; char type[] = "grid_second_order"; size_t size = strlen(type); grib_handle* hand = grib_handle_of_accessor(a); - err = grib_set_string(hand, "packingType", type, &size); + int err = grib_set_string(hand, "packingType", type, &size); if (err) return err; diff --git a/src/accessor/grib_accessor_class_data_g1second_order_general_packing.h b/src/accessor/grib_accessor_class_data_g1second_order_general_packing.h new file mode 100644 index 000000000..95295dae1 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1second_order_general_packing.h @@ -0,0 +1,48 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" +#include "grib_scaling.h" + +class grib_accessor_data_g1second_order_general_packing_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_g1second_order_general_packing */ + const char* half_byte; + const char* packingType; + const char* ieee_packing; + const char* precision; + const char* widthOfFirstOrderValues; + const char* N1; + const char* N2; + const char* numberOfGroups; + const char* numberOfSecondOrderPackedValues; + const char* extraValues; + const char* pl; + const char* Ni; + const char* Nj; + const char* jPointsAreConsecutive; + const char* bitmap; + const char* groupWidths; +}; + +class grib_accessor_class_data_g1second_order_general_packing_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_g1second_order_general_packing_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g1second_order_general_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_data_g1second_order_row_by_row_packing.cc b/src/accessor/grib_accessor_class_data_g1second_order_row_by_row_packing.cc similarity index 61% rename from src/grib_accessor_class_data_g1second_order_row_by_row_packing.cc rename to src/accessor/grib_accessor_class_data_g1second_order_row_by_row_packing.cc index b801b3b1c..afed13ca2 100644 --- a/src/grib_accessor_class_data_g1second_order_row_by_row_packing.cc +++ b/src/accessor/grib_accessor_class_data_g1second_order_row_by_row_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,155 +9,17 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_scaling.h" -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = unpack_double;unpack_float - IMPLEMENTS = value_count - MEMBERS=const char* half_byte - MEMBERS=const char* packingType - MEMBERS=const char* ieee_packing - MEMBERS=const char* precision - MEMBERS=const char* widthOfFirstOrderValues - MEMBERS=const char* N1 - MEMBERS=const char* N2 - MEMBERS=const char* numberOfGroups - MEMBERS=const char* numberOfSecondOrderPackedValues - MEMBERS=const char* extraValues - MEMBERS=const char* pl - MEMBERS=const char* Ni - MEMBERS=const char* Nj - MEMBERS=const char* jPointsAreConsecutive - MEMBERS=const char* bitmap - MEMBERS=const char* groupWidths - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g1second_order_row_by_row_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_g1second_order_row_by_row_packing */ - const char* half_byte; - const char* packingType; - const char* ieee_packing; - const char* precision; - const char* widthOfFirstOrderValues; - const char* N1; - const char* N2; - const char* numberOfGroups; - const char* numberOfSecondOrderPackedValues; - const char* extraValues; - const char* pl; - const char* Ni; - const char* Nj; - const char* jPointsAreConsecutive; - const char* bitmap; - const char* groupWidths; -} grib_accessor_data_g1second_order_row_by_row_packing; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_g1second_order_row_by_row_packing = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_g1second_order_row_by_row_packing", /* name */ - sizeof(grib_accessor_data_g1second_order_row_by_row_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_data_g1second_order_row_by_row_packing.h" +grib_accessor_class_data_g1second_order_row_by_row_packing_t _grib_accessor_class_data_g1second_order_row_by_row_packing{ "data_g1second_order_row_by_row_packing" }; grib_accessor_class* grib_accessor_class_data_g1second_order_row_by_row_packing = &_grib_accessor_class_data_g1second_order_row_by_row_packing; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) +void grib_accessor_class_data_g1second_order_row_by_row_packing_t::init(grib_accessor* a, const long v, grib_arguments* args) { - grib_accessor_data_g1second_order_row_by_row_packing* self = (grib_accessor_data_g1second_order_row_by_row_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_g1second_order_row_by_row_packing_t* self = (grib_accessor_data_g1second_order_row_by_row_packing_t*)a; + grib_handle* gh = grib_handle_of_accessor(a); self->half_byte = grib_arguments_get_name(gh, args, self->carg++); self->packingType = grib_arguments_get_name(gh, args, self->carg++); @@ -178,12 +41,13 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->flags |= GRIB_ACCESSOR_FLAG_DATA; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_data_g1second_order_row_by_row_packing_t::value_count(grib_accessor* a, long* count) { - grib_accessor_data_g1second_order_row_by_row_packing* self = (grib_accessor_data_g1second_order_row_by_row_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); + grib_accessor_data_g1second_order_row_by_row_packing_t* self = (grib_accessor_data_g1second_order_row_by_row_packing_t*)a; + + grib_handle* gh = grib_handle_of_accessor(a); long n = 0, i = 0; - long numberOfRows = 0; + long numberOfRows = 0; long jPointsAreConsecutive = 0; long Ni = 0, Nj = 0; int bitmapPresent = 0; @@ -254,11 +118,12 @@ static int value_count(grib_accessor* a, long* count) } template -static int unpack(grib_accessor* a, T* values, size_t* len) +static int unpack_real(grib_accessor* a, T* values, size_t* len) { - grib_accessor_data_g1second_order_row_by_row_packing* self = (grib_accessor_data_g1second_order_row_by_row_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); - int ret = 0; + grib_accessor_data_g1second_order_row_by_row_packing_t* self = (grib_accessor_data_g1second_order_row_by_row_packing_t*)a; + + grib_handle* gh = grib_handle_of_accessor(a); + int ret = 0; long numberOfGroups, numberOfSecondOrderPackedValues; long* groupWidths = 0; long* firstOrderValues = 0; @@ -279,8 +144,7 @@ static int unpack(grib_accessor* a, T* values, size_t* len) size_t plSize = 0; long* pl = 0; - buf += grib_byte_offset(a); - + buf += a->byte_offset(); if ((ret = grib_get_long_internal(gh, self->numberOfGroups, &numberOfGroups)) != GRIB_SUCCESS) return ret; @@ -421,17 +285,17 @@ static int unpack(grib_accessor* a, T* values, size_t* len) return ret; } -static int unpack_float(grib_accessor* a, float* values, size_t* len) +int grib_accessor_class_data_g1second_order_row_by_row_packing_t::unpack_float(grib_accessor* a, float* values, size_t* len) { - return unpack(a, values, len); + return unpack_real(a, values, len); } -static int unpack_double(grib_accessor* a, double* values, size_t* len) +int grib_accessor_class_data_g1second_order_row_by_row_packing_t::unpack_double(grib_accessor* a, double* values, size_t* len) { - return unpack(a, values, len); + return unpack_real(a, values, len); } -static int pack_double(grib_accessor* a, const double* cval, size_t* len) +int grib_accessor_class_data_g1second_order_row_by_row_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len) { int err = 0; grib_handle* gh = grib_handle_of_accessor(a); diff --git a/src/accessor/grib_accessor_class_data_g1second_order_row_by_row_packing.h b/src/accessor/grib_accessor_class_data_g1second_order_row_by_row_packing.h new file mode 100644 index 000000000..eca551669 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1second_order_row_by_row_packing.h @@ -0,0 +1,48 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" +#include "grib_scaling.h" + +class grib_accessor_data_g1second_order_row_by_row_packing_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_g1second_order_row_by_row_packing */ + const char* half_byte; + const char* packingType; + const char* ieee_packing; + const char* precision; + const char* widthOfFirstOrderValues; + const char* N1; + const char* N2; + const char* numberOfGroups; + const char* numberOfSecondOrderPackedValues; + const char* extraValues; + const char* pl; + const char* Ni; + const char* Nj; + const char* jPointsAreConsecutive; + const char* bitmap; + const char* groupWidths; +}; + +class grib_accessor_class_data_g1second_order_row_by_row_packing_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_g1second_order_row_by_row_packing_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g1second_order_row_by_row_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_g1secondary_bitmap.cc b/src/accessor/grib_accessor_class_data_g1secondary_bitmap.cc new file mode 100644 index 000000000..3697f6f75 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1secondary_bitmap.cc @@ -0,0 +1,128 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_g1secondary_bitmap.h" + +grib_accessor_class_data_g1secondary_bitmap_t _grib_accessor_class_data_g1secondary_bitmap{"data_g1secondary_bitmap"}; +grib_accessor_class* grib_accessor_class_data_g1secondary_bitmap = &_grib_accessor_class_data_g1secondary_bitmap; + + +void grib_accessor_class_data_g1secondary_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_secondary_bitmap_t::init(a, v, args); + grib_accessor_data_g1secondary_bitmap_t* self = (grib_accessor_data_g1secondary_bitmap_t*)a; + self->number_of_ones = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4); +} + +int grib_accessor_class_data_g1secondary_bitmap_t::value_count(grib_accessor* a, long* count){ + grib_accessor_data_g1secondary_bitmap_t* self = (grib_accessor_data_g1secondary_bitmap_t*)a; + size_t len = 0; + int err = 0; + long expand_by; + *count = 0; + + err = grib_get_long_internal(grib_handle_of_accessor(a), self->expand_by, &expand_by); + if (err) + return err; + + err = grib_get_size(grib_handle_of_accessor(a), self->primary_bitmap, &len); + if (err) + return err; + + *count = expand_by * len; + return GRIB_SUCCESS; +} + +int grib_accessor_class_data_g1secondary_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_g1secondary_bitmap_t* self = (grib_accessor_data_g1secondary_bitmap_t*)a; + + int err = 0; + + long primary_len = 0; + long secondary_len = 0; + double* primary_bitmap = NULL; + double* secondary_bitmap = NULL; + long i = 0; + long j = 0; + long on = 0; + long k; + long m; + double missing_value = 0; + double present_value = 0; + long expand_by = 0; + + if (*len == 0) + return GRIB_NO_VALUES; + + if ((err = grib_get_long(grib_handle_of_accessor(a), self->expand_by, &expand_by)) != GRIB_SUCCESS) + return err; + if (expand_by <= 0) + return GRIB_ENCODING_ERROR; + + if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &missing_value)) != GRIB_SUCCESS) + return err; + + if (*len % expand_by) { + /*TODO: issue warning */ + return GRIB_ENCODING_ERROR; + } + + primary_len = *len / expand_by; + primary_bitmap = (double*)grib_context_malloc_clear(a->context, primary_len * sizeof(double)); + if (!primary_bitmap) + return GRIB_OUT_OF_MEMORY; + + secondary_len = *len; + secondary_bitmap = (double*)grib_context_malloc_clear(a->context, secondary_len * sizeof(double)); + if (!secondary_bitmap) { + grib_context_free(a->context, primary_bitmap); + return GRIB_OUT_OF_MEMORY; + } + + if (missing_value == 0) + present_value = 1; + else + present_value = 0; + + k = 0; + m = 0; + for (i = 0; i < *len; i += expand_by) { + int cnt = 0; + for (j = 0; j < expand_by; j++) + if (val[i + j] == missing_value) + cnt++; + + if (cnt == expand_by) /* all expand_by values are missing */ + primary_bitmap[k++] = missing_value; + else { + primary_bitmap[k++] = present_value; + for (j = 0; j < expand_by; j++) + secondary_bitmap[m++] = val[i + j]; + on++; + } + } + + *len = k; + + /*printf("QQQQQQQ %ld %ld second=%ld\n",primary_len,on,m);*/ + Assert(k == primary_len); + + err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->primary_bitmap, primary_bitmap, k); + if (err == GRIB_SUCCESS) + err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->secondary_bitmap, secondary_bitmap, m); + + grib_context_free(a->context, primary_bitmap); + grib_context_free(a->context, secondary_bitmap); + + if (err == GRIB_SUCCESS) + err = grib_set_long_internal(grib_handle_of_accessor(a), self->number_of_ones, on); + + return err; +} diff --git a/src/accessor/grib_accessor_class_data_g1secondary_bitmap.h b/src/accessor/grib_accessor_class_data_g1secondary_bitmap.h new file mode 100644 index 000000000..63ee792ae --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1secondary_bitmap.h @@ -0,0 +1,30 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_secondary_bitmap.h" + +class grib_accessor_data_g1secondary_bitmap_t : public grib_accessor_data_secondary_bitmap_t +{ +public: + /* Members defined in data_g1secondary_bitmap */ + const char* number_of_ones; +}; + +class grib_accessor_class_data_g1secondary_bitmap_t : public grib_accessor_class_data_secondary_bitmap_t +{ +public: + grib_accessor_class_data_g1secondary_bitmap_t(const char* name) : grib_accessor_class_data_secondary_bitmap_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g1secondary_bitmap_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_g1shsimple_packing.cc b/src/accessor/grib_accessor_class_data_g1shsimple_packing.cc new file mode 100644 index 000000000..f1f06d654 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1shsimple_packing.cc @@ -0,0 +1,63 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_g1shsimple_packing.h" + +grib_accessor_class_data_g1shsimple_packing_t _grib_accessor_class_data_g1shsimple_packing{"data_g1shsimple_packing"}; +grib_accessor_class* grib_accessor_class_data_g1shsimple_packing = &_grib_accessor_class_data_g1shsimple_packing; + + + +int grib_accessor_class_data_g1shsimple_packing_t::value_count(grib_accessor* a, long* count){ + grib_accessor_data_g1shsimple_packing_t* self = (grib_accessor_data_g1shsimple_packing_t*)a; + size_t len = 0; + int err = 0; + + err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &len); + len += 1; + + *count = len; + return err; +} + +int grib_accessor_class_data_g1shsimple_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_g1shsimple_packing_t* self = (grib_accessor_data_g1shsimple_packing_t*)a; + int err = GRIB_SUCCESS; + + size_t coded_n_vals = 0; + size_t n_vals = 0; + + if ((err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &coded_n_vals)) != GRIB_SUCCESS) + return err; + + n_vals = coded_n_vals + 1; + + if (*len < n_vals) { + *len = n_vals; + return GRIB_ARRAY_TOO_SMALL; + } + + if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->real_part, val)) != GRIB_SUCCESS) + return err; + + val++; + + if ((err = grib_get_double_array_internal(grib_handle_of_accessor(a), self->coded_values, val, &coded_n_vals)) != GRIB_SUCCESS) + return err; + + grib_context_log(a->context, GRIB_LOG_DEBUG, + "grib_accessor_data_g1shsimple_packing_t_bitmap : unpack_double : creating %s, %d values", + a->name, n_vals); + + *len = n_vals; + + return err; +} diff --git a/src/accessor/grib_accessor_class_data_g1shsimple_packing.h b/src/accessor/grib_accessor_class_data_g1shsimple_packing.h new file mode 100644 index 000000000..c852c7213 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1shsimple_packing.h @@ -0,0 +1,28 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_shsimple_packing.h" + +class grib_accessor_data_g1shsimple_packing_t : public grib_accessor_data_shsimple_packing_t +{ +public: + /* Members defined in data_g1shsimple_packing */ +}; + +class grib_accessor_class_data_g1shsimple_packing_t : public grib_accessor_class_data_shsimple_packing_t +{ +public: + grib_accessor_class_data_g1shsimple_packing_t(const char* name) : grib_accessor_class_data_shsimple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g1shsimple_packing_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; +}; diff --git a/src/grib_accessor_class_data_g1simple_packing.cc b/src/accessor/grib_accessor_class_data_g1simple_packing.cc similarity index 64% rename from src/grib_accessor_class_data_g1simple_packing.cc rename to src/accessor/grib_accessor_class_data_g1simple_packing.cc index cc810e4ae..a19132f1a 100644 --- a/src/grib_accessor_class_data_g1simple_packing.cc +++ b/src/accessor/grib_accessor_class_data_g1simple_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,126 +9,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ +#include "grib_accessor_class_data_g1simple_packing.h" #include "grib_scaling.h" -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - MEMBERS=const char* half_byte - MEMBERS=const char* packingType - MEMBERS=const char* ieee_packing - MEMBERS=const char* precision - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g1simple_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_g1simple_packing */ - const char* half_byte; - const char* packingType; - const char* ieee_packing; - const char* precision; -} grib_accessor_data_g1simple_packing; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_g1simple_packing = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_g1simple_packing", /* name */ - sizeof(grib_accessor_data_g1simple_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_data_g1simple_packing_t _grib_accessor_class_data_g1simple_packing{"data_g1simple_packing"}; grib_accessor_class* grib_accessor_class_data_g1simple_packing = &_grib_accessor_class_data_g1simple_packing; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g1simple_packing* self = (grib_accessor_data_g1simple_packing*)a; +void grib_accessor_class_data_g1simple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_g1simple_packing_t* self = (grib_accessor_data_g1simple_packing_t*)a; self->half_byte = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); self->packingType = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); @@ -137,9 +28,8 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->flags |= GRIB_ACCESSOR_FLAG_DATA; } -static int value_count(grib_accessor* a, long* number_of_values) -{ - grib_accessor_data_g1simple_packing* self = (grib_accessor_data_g1simple_packing*)a; +int grib_accessor_class_data_g1simple_packing_t::value_count(grib_accessor* a, long* number_of_values){ + grib_accessor_data_g1simple_packing_t* self = (grib_accessor_data_g1simple_packing_t*)a; *number_of_values = 0; /* Special case for when values are cleared */ @@ -149,10 +39,8 @@ static int value_count(grib_accessor* a, long* number_of_values) return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, number_of_values); } -static int pack_double(grib_accessor* a, const double* cval, size_t* len) -{ - grib_accessor_data_g1simple_packing* self = (grib_accessor_data_g1simple_packing*)a; - grib_accessor_class* super = *(a->cclass->super); +int grib_accessor_class_data_g1simple_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len){ + grib_accessor_data_g1simple_packing_t* self = (grib_accessor_data_g1simple_packing_t*)a; size_t n_vals = *len; long half_byte = 0; @@ -234,7 +122,7 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len) } } - ret = super->pack_double(a, val, len); + ret = grib_accessor_class_data_simple_packing_t::pack_double(a, val, len); switch (ret) { case GRIB_CONSTANT_FIELD: ret = grib_get_long(grib_handle_of_accessor(a), "constantFieldHalfByte", &constantFieldHalfByte); @@ -319,7 +207,7 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len) grib_encode_double_array(n_vals, val, bits_per_value, reference_value, decimal, divisor, encoded, &off); grib_context_log(a->context, GRIB_LOG_DEBUG, - "grib_accessor_data_g1simple_packing : pack_double : packing %s, %d values", a->name, n_vals); + "grib_accessor_data_g1simple_packing_t : pack_double : packing %s, %d values", a->name, n_vals); ret = grib_buffer_replace(a, buf, buflen, 1, 1); if (ret != GRIB_SUCCESS) return ret; diff --git a/src/accessor/grib_accessor_class_data_g1simple_packing.h b/src/accessor/grib_accessor_class_data_g1simple_packing.h new file mode 100644 index 000000000..c82532361 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g1simple_packing.h @@ -0,0 +1,33 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" + +class grib_accessor_data_g1simple_packing_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_g1simple_packing */ + const char* half_byte; + const char* packingType; + const char* ieee_packing; + const char* precision; +}; + +class grib_accessor_class_data_g1simple_packing_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_g1simple_packing_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g1simple_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_data_g22order_packing.cc b/src/accessor/grib_accessor_class_data_g22order_packing.cc similarity index 85% rename from src/grib_accessor_class_data_g22order_packing.cc rename to src/accessor/grib_accessor_class_data_g22order_packing.cc index 4ed535d29..bbc698100 100644 --- a/src/grib_accessor_class_data_g22order_packing.cc +++ b/src/accessor/grib_accessor_class_data_g22order_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,164 +9,23 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ +#include "grib_accessor_class_data_g22order_packing.h" -#include "grib_scaling.h" -#include "grib_api_internal.h" -#include - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_values - IMPLEMENTS = init - IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_float - IMPLEMENTS = pack_double - IMPLEMENTS = unpack_double_element;unpack_double_element_set - IMPLEMENTS = value_count - MEMBERS=const char* numberOfValues - MEMBERS=const char* bits_per_value - MEMBERS=const char* reference_value - MEMBERS=const char* binary_scale_factor - MEMBERS=const char* decimal_scale_factor - MEMBERS=const char* optimize_scale_factor - MEMBERS=const char* typeOfOriginalFieldValues - MEMBERS=const char* groupSplittingMethodUsed - MEMBERS=const char* missingValueManagementUsed - MEMBERS=const char* primaryMissingValueSubstitute - MEMBERS=const char* secondaryMissingValueSubstitute - MEMBERS=const char* numberOfGroupsOfDataValues - MEMBERS=const char* referenceForGroupWidths - MEMBERS=const char* numberOfBitsUsedForTheGroupWidths - MEMBERS=const char* referenceForGroupLengths - MEMBERS=const char* lengthIncrementForTheGroupLengths - MEMBERS=const char* trueLengthOfLastGroup - MEMBERS=const char* numberOfBitsUsedForTheScaledGroupLengths - MEMBERS=const char* orderOfSpatialDifferencing - MEMBERS=const char* numberOfOctetsExtraDescriptors - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_data_g22order_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_g22order_packing */ - const char* numberOfValues; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scale_factor; - const char* typeOfOriginalFieldValues; - const char* groupSplittingMethodUsed; - const char* missingValueManagementUsed; - const char* primaryMissingValueSubstitute; - const char* secondaryMissingValueSubstitute; - const char* numberOfGroupsOfDataValues; - const char* referenceForGroupWidths; - const char* numberOfBitsUsedForTheGroupWidths; - const char* referenceForGroupLengths; - const char* lengthIncrementForTheGroupLengths; - const char* trueLengthOfLastGroup; - const char* numberOfBitsUsedForTheScaledGroupLengths; - const char* orderOfSpatialDifferencing; - const char* numberOfOctetsExtraDescriptors; -} grib_accessor_data_g22order_packing; - -extern grib_accessor_class* grib_accessor_class_values; - -static grib_accessor_class _grib_accessor_class_data_g22order_packing = { - &grib_accessor_class_values, /* super */ - "data_g22order_packing", /* name */ - sizeof(grib_accessor_data_g22order_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - +grib_accessor_class_data_g22order_packing_t _grib_accessor_class_data_g22order_packing{ "data_g22order_packing" }; grib_accessor_class* grib_accessor_class_data_g22order_packing = &_grib_accessor_class_data_g22order_packing; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) +void grib_accessor_class_data_g22order_packing_t::init(grib_accessor* a, const long v, grib_arguments* args) { - grib_accessor_data_g22order_packing* self = reinterpret_cast(a); - grib_handle* gh = grib_handle_of_accessor(a); + grib_accessor_class_values_t::init(a, v, args); + grib_accessor_data_g22order_packing_t* self = reinterpret_cast(a); + grib_handle* gh = grib_handle_of_accessor(a); - self->numberOfValues = grib_arguments_get_name(gh, args, self->carg++); - self->bits_per_value = grib_arguments_get_name(gh, args, self->carg++); - self->reference_value = grib_arguments_get_name(gh, args, self->carg++); - self->binary_scale_factor = grib_arguments_get_name(gh, args, self->carg++); - self->decimal_scale_factor = grib_arguments_get_name(gh, args, self->carg++); + self->numberOfValues = grib_arguments_get_name(gh, args, self->carg++); + self->bits_per_value = grib_arguments_get_name(gh, args, self->carg++); + self->reference_value = grib_arguments_get_name(gh, args, self->carg++); + self->binary_scale_factor = grib_arguments_get_name(gh, args, self->carg++); + self->decimal_scale_factor = grib_arguments_get_name(gh, args, self->carg++); self->optimize_scale_factor = grib_arguments_get_name(gh, args, self->carg++); self->typeOfOriginalFieldValues = grib_arguments_get_name(gh, args, self->carg++); @@ -186,33 +46,33 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->flags |= GRIB_ACCESSOR_FLAG_DATA; } - #define ONES (~(int)0) // #define UNDEFINED 9.999e20 // #define UNDEFINED_LOW 9.9989e20 // #define UNDEFINED_HIGH 9.9991e20 -#define UNDEFINED 9999.0 -#define UNDEFINED_LOW 9998.9 -#define UNDEFINED_HIGH 9999.1 +#define UNDEFINED 9999.0 +#define UNDEFINED_LOW 9998.9 +#define UNDEFINED_HIGH 9999.1 #define UNDEFINED_VAL(x) ((x) >= UNDEFINED_LOW && (x) <= UNDEFINED_HIGH) -#define DEFINED_VAL(x) ((x) < UNDEFINED_LOW || (x) > UNDEFINED_HIGH) -#define UNDEFINED_ANGLE 999.0 +#define DEFINED_VAL(x) ((x) < UNDEFINED_LOW || (x) > UNDEFINED_HIGH) +#define UNDEFINED_ANGLE 999.0 -struct bitstream_context { +struct bitstream_context +{ unsigned char* bitstream; int rbits; int reg; int n_bitstream; }; -static void init_bitstream(bitstream_context *ctx, unsigned char* new_bitstream) +void init_bitstream(bitstream_context* ctx, unsigned char* new_bitstream) { ctx->bitstream = new_bitstream; ctx->n_bitstream = ctx->reg = ctx->rbits = 0; } -static void finish_bitstream(bitstream_context *ctx) +void finish_bitstream(bitstream_context* ctx) { if (ctx->rbits) { ctx->n_bitstream++; @@ -221,7 +81,7 @@ static void finish_bitstream(bitstream_context *ctx) } } -static void add_many_bitstream(bitstream_context *ctx, grib_accessor* a, int* t, int n, int n_bits) +void add_many_bitstream(bitstream_context* ctx, grib_accessor* a, int* t, int n, int n_bits) { unsigned int jmask; int i; @@ -245,7 +105,7 @@ static void add_many_bitstream(bitstream_context *ctx, grib_accessor* a, int* t, } } -static void add_bitstream(bitstream_context *ctx, grib_accessor* a, int t, int n_bits) +void add_bitstream(bitstream_context* ctx, grib_accessor* a, int t, int n_bits) { unsigned int jmask; const int max_numbits = 25; @@ -506,255 +366,6 @@ static int post_process(grib_context* c, long* vals, long len, long order, long return GRIB_SUCCESS; } -template -static int unpack(grib_accessor* a, T* val, const size_t* len) -{ - static_assert(std::is_floating_point::value, "Requires floating points numbers"); - grib_accessor_data_g22order_packing* self = reinterpret_cast(a); - const char* cclass_name = a->cclass->name; - grib_handle* gh = grib_handle_of_accessor(a); - - size_t i = 0; - size_t j = 0; - long n_vals = 0; - long vcount = 0; - int err = GRIB_SUCCESS; - long* sec_val = NULL; - unsigned char* buf = reinterpret_cast(gh->buffer->data); - unsigned char* buf_ref = NULL; - unsigned char* buf_width = NULL; - unsigned char* buf_length = NULL; - unsigned char* buf_vals = NULL; - - long length_p = 0; - long ref_p = 0; - long width_p = 0; - long vals_p = 0; - long nvals_per_group = 0; - long nbits_per_group_val = 0; - long group_ref_val = 0; - - long bits_per_value = 0; - T binary_s = 0; - T decimal_s = 0; - double reference_value = 0; - - long binary_scale_factor; - long decimal_scale_factor; - long typeOfOriginalFieldValues; - long groupSplittingMethodUsed; - long missingValueManagementUsed; - long primaryMissingValueSubstitute; - long secondaryMissingValueSubstitute; - long numberOfGroupsOfDataValues; - long referenceForGroupWidths; - long numberOfBitsUsedForTheGroupWidths; - long referenceForGroupLengths; - long lengthIncrementForTheGroupLengths; - long trueLengthOfLastGroup; - long numberOfBitsUsedForTheScaledGroupLengths; - long orderOfSpatialDifferencing = 0; - long numberOfOctetsExtraDescriptors = 0; - double missingValue = 0; - - err = grib_value_count(a, &n_vals); - if (err) - return err; - - if (*len < static_cast(n_vals)) - return GRIB_ARRAY_TOO_SMALL; - - if ((err = grib_get_long_internal(gh, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_double_internal(gh, self->reference_value, &reference_value)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->typeOfOriginalFieldValues, &typeOfOriginalFieldValues)) != GRIB_SUCCESS) - return err; - - // Don't call grib_get_long_internal to suppress error message being output - if ((err = grib_get_long(gh, self->groupSplittingMethodUsed, &groupSplittingMethodUsed)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_long_internal(gh, self->missingValueManagementUsed, &missingValueManagementUsed)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->primaryMissingValueSubstitute, &primaryMissingValueSubstitute)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->secondaryMissingValueSubstitute, &secondaryMissingValueSubstitute)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->numberOfGroupsOfDataValues, &numberOfGroupsOfDataValues)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->referenceForGroupWidths, &referenceForGroupWidths)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->numberOfBitsUsedForTheGroupWidths, &numberOfBitsUsedForTheGroupWidths)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->referenceForGroupLengths, &referenceForGroupLengths)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_long_internal(gh, self->lengthIncrementForTheGroupLengths, &lengthIncrementForTheGroupLengths)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->trueLengthOfLastGroup, &trueLengthOfLastGroup)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->numberOfBitsUsedForTheScaledGroupLengths, &numberOfBitsUsedForTheScaledGroupLengths)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->orderOfSpatialDifferencing, &orderOfSpatialDifferencing)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(gh, self->numberOfOctetsExtraDescriptors, &numberOfOctetsExtraDescriptors)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_double_internal(gh, "missingValue", &missingValue)) != GRIB_SUCCESS) - return err; - - self->dirty = 0; - - sec_val = (long*)grib_context_malloc(a->context, (n_vals) * sizeof(long)); - if (!sec_val) return GRIB_OUT_OF_MEMORY; - memset(sec_val, 0, (n_vals) * sizeof(long)); // See SUP-718 - - buf_ref = buf + a->offset; - - ref_p = (numberOfGroupsOfDataValues * bits_per_value); - - if (orderOfSpatialDifferencing) - ref_p += (1 + orderOfSpatialDifferencing) * (numberOfOctetsExtraDescriptors * 8); - - buf_width = buf_ref + (ref_p / 8) + ((ref_p % 8) ? 1 : 0); - - width_p = (numberOfGroupsOfDataValues * numberOfBitsUsedForTheGroupWidths); - buf_length = buf_width + (width_p / 8) + ((width_p % 8) ? 1 : 0); - - length_p = (numberOfGroupsOfDataValues * numberOfBitsUsedForTheScaledGroupLengths); - buf_vals = buf_length + (length_p / 8) + ((length_p % 8) ? 1 : 0); - - length_p = 0; - ref_p = orderOfSpatialDifferencing ? (orderOfSpatialDifferencing + 1) * (numberOfOctetsExtraDescriptors * 8) : 0; - width_p = 0; - vals_p = 0; - vcount = 0; - - for (i = 0; i < numberOfGroupsOfDataValues; i++) { - group_ref_val = grib_decode_unsigned_long(buf_ref, &ref_p, bits_per_value); - nvals_per_group = grib_decode_unsigned_long(buf_length, &length_p, numberOfBitsUsedForTheScaledGroupLengths); - nbits_per_group_val = grib_decode_unsigned_long(buf_width, &width_p, numberOfBitsUsedForTheGroupWidths); - - nvals_per_group *= lengthIncrementForTheGroupLengths; - nvals_per_group += referenceForGroupLengths; - nbits_per_group_val += referenceForGroupWidths; - - if (i == numberOfGroupsOfDataValues - 1) - nvals_per_group = trueLengthOfLastGroup; - if (n_vals < vcount + nvals_per_group) { - return GRIB_DECODING_ERROR; - } - - // grib_decode_long_array(buf_vals, &vals_p, nbits_per_group_val, nvals_per_group, &sec_val[vcount]); - if (missingValueManagementUsed == 0) { - // No explicit missing values included within data values - for (j = 0; j < nvals_per_group; j++) { - DEBUG_ASSERT_ACCESS(sec_val, (long)(vcount + j), n_vals); - sec_val[vcount + j] = group_ref_val + grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); - // printf("sec_val[%ld]=%ld\n", vcount+j, sec_val[vcount+j]); - } - } - else if (missingValueManagementUsed == 1) { - // Primary missing values included within data values - long maxn = 0; // (1 << bits_per_value) - 1; - for (j = 0; j < nvals_per_group; j++) { - if (nbits_per_group_val == 0) { - maxn = (1 << bits_per_value) - 1; - if (group_ref_val == maxn) { - sec_val[vcount + j] = LONG_MAX; // missing value - } - else { - long temp = grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); - sec_val[vcount + j] = group_ref_val + temp; - } - } - else { - long temp = grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); - maxn = (1 << nbits_per_group_val) - 1; - if (temp == maxn) { - sec_val[vcount + j] = LONG_MAX; // missing value - } - else { - sec_val[vcount + j] = group_ref_val + temp; - } - } - } - } - else if (missingValueManagementUsed == 2) { - // Primary and secondary missing values included within data values - long maxn = (1 << bits_per_value) - 1; - long maxn2 = 0; // maxn - 1 - for (j = 0; j < nvals_per_group; j++) { - if (nbits_per_group_val == 0) { - maxn2 = maxn - 1; - if (group_ref_val == maxn || group_ref_val == maxn2) { - sec_val[vcount + j] = LONG_MAX; // missing value - } - else { - long temp = grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); - sec_val[vcount + j] = group_ref_val + temp; - } - } - else { - long temp = grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); - maxn = (1 << nbits_per_group_val) - 1; - maxn2 = maxn - 1; - if (temp == maxn || temp == maxn2) { - sec_val[vcount + j] = LONG_MAX; // missing value - } - else { - sec_val[vcount + j] = group_ref_val + temp; - } - } - } - } - - vcount += nvals_per_group; - } - - if (orderOfSpatialDifferencing) { - long bias = 0; - unsigned long extras[2] = {0, }; - ref_p = 0; - - // For Complex packing, order == 0 - // For Complex packing and spatial differencing, order == 1 or 2 (code table 5.6) - if (orderOfSpatialDifferencing != 1 && orderOfSpatialDifferencing != 2) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s unpacking: Unsupported order of spatial differencing %ld", cclass_name, orderOfSpatialDifferencing); - return GRIB_INTERNAL_ERROR; - } - - for (i = 0; i < orderOfSpatialDifferencing; i++) { - extras[i] = grib_decode_unsigned_long(buf_ref, &ref_p, numberOfOctetsExtraDescriptors * 8); - } - - bias = grib_decode_signed_longb(buf_ref, &ref_p, numberOfOctetsExtraDescriptors * 8); - - post_process(a->context, sec_val, n_vals, orderOfSpatialDifferencing, bias, extras); - // de_spatial_difference (a->context, sec_val, n_vals, orderOfSpatialDifferencing, bias); - } - - binary_s = (T)codes_power(binary_scale_factor, 2); - decimal_s = (T)codes_power(-decimal_scale_factor, 10); - - for (i = 0; i < n_vals; i++) { - if (sec_val[i] == LONG_MAX) { - val[i] = (T)missingValue; - } - else { - val[i] = (T)((((T)sec_val[i]) * binary_s) + reference_value) * decimal_s; - } - } - - grib_context_free(a->context, sec_val); - return err; -} - static int find_nbits(unsigned int i) { #if !defined __GNUC__ || __GNUC__ < 4 @@ -1164,9 +775,9 @@ static void merge_j(struct section* h, int ref_bits, int width_bits, int has_und } } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_data_g22order_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_data_g22order_packing* self = reinterpret_cast(a); + grib_accessor_data_g22order_packing_t* self = reinterpret_cast(a); grib_handle* gh = grib_handle_of_accessor(a); const char* cclass_name = a->cclass->name; @@ -1205,7 +816,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) return err; - optimize_scale_factor = 1; // TODO(masn): To be reviewed + optimize_scale_factor = 1; // TODO(masn): To be reviewed if ((err = grib_get_long_internal(gh, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS) return err; @@ -1235,7 +846,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) // orderOfSpatialDifferencing = 1 means "grid_complex_spatial_differencing" with orderOfSpatialDifferencing=1 // orderOfSpatialDifferencing = 2 means "grid_complex_spatial_differencing" with orderOfSpatialDifferencing=2 - use_bitmap = bitmap_present; + use_bitmap = bitmap_present; wanted_bits = bits_per_value; for (i = 0; i < *len; i++) { @@ -1247,7 +858,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if (ndef == 0) { // Special case: All undefined values // Section 5 const char* packing_type = "grid_complex"; - size_t packing_type_len = strlen(packing_type); + size_t packing_type_len = strlen(packing_type); grib_set_string_internal(gh, "packingType", packing_type, &packing_type_len); if ((err = grib_set_double_internal(gh, self->reference_value, grib_ieee_to_long(0.0))) != GRIB_SUCCESS) @@ -1287,8 +898,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) if ((err = grib_set_long_internal(gh, "bitmapPresent", 0)) != GRIB_SUCCESS) return err; // Section 7 - constexpr size_t sec7_size = 3; - unsigned char empty_sec7[sec7_size] = {255, 0, 0}; // group reference, group width, group length + constexpr size_t sec7_size = 3; + unsigned char empty_sec7[sec7_size] = { 255, 0, 0 }; // group reference, group width, group length grib_buffer_replace(a, empty_sec7, sec7_size, 1, 1); return GRIB_SUCCESS; } @@ -1304,12 +915,12 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) dec_scale = -decimal_scale_factor; bin_scale = binary_scale_factor; - //compute bitmap section - //if (use_bitmap == 0 || ndef == ndata) { - // if ((err = grib_set_long_internal(gh, "bitmapPresent", 0)) != GRIB_SUCCESS) return err; - //} else { - // if ((err = grib_set_long_internal(gh, "bitmapPresent", 1)) != GRIB_SUCCESS) return err; - //} + // compute bitmap section + // if (use_bitmap == 0 || ndef == ndata) { + // if ((err = grib_set_long_internal(gh, "bitmapPresent", 0)) != GRIB_SUCCESS) return err; + // } else { + // if ((err = grib_set_long_internal(gh, "bitmapPresent", 1)) != GRIB_SUCCESS) return err; + // } nndata = use_bitmap ? ndef : ndata; has_undef = use_bitmap ? 0 : ndata != ndef; @@ -1478,7 +1089,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) #ifdef DEBUG grib_context_log(a->context, GRIB_LOG_DEBUG, "COMPLEX: 2: vmx %d vmn %d nbits %d", vmx, vmn, - find_nbits(vmx - vmn + has_undef)); + find_nbits(vmx - vmn + has_undef)); #endif for (i = 0; i < nndata; i++) { @@ -1499,7 +1110,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) list = reinterpret_cast(grib_context_malloc_clear(a->context, nstruct * sizeof(section))); if (list == NULL) { - grib_context_log(a->context, GRIB_LOG_ERROR, "%s packing: memory allocation of list failed",cclass_name); + grib_context_log(a->context, GRIB_LOG_ERROR, "%s packing: memory allocation of list failed", cclass_name); return GRIB_OUT_OF_MEMORY; } @@ -1575,10 +1186,10 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) LEN_SEC_MAX); j = size_all(start.tail, vbits, LEN_BITS + est_group_width, has_undef); #ifdef DEBUG - grib_context_log(a->context, GRIB_LOG_DEBUG, - "COMPLEX: complex inc segments size size0 %d size1 %d segsize %d " - "LEN_BITS=%d", - j0, j, LEN_SEC_MAX, LEN_BITS); + grib_context_log(a->context, GRIB_LOG_DEBUG, + "COMPLEX: complex inc segments size size0 %d size1 %d segsize %d " + "LEN_BITS=%d", + j0, j, LEN_SEC_MAX, LEN_BITS); #endif if (j > j0) { memcpy(list, list_backup, nstruct * sizeof(struct section)); @@ -1586,7 +1197,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) LEN_SEC_MAX = (LEN_SEC_MAX - 1) / 2; } } - grib_context_free(a->context,list_backup); + grib_context_free(a->context, list_backup); exchange(start.tail, v, has_undef, LEN_SEC_MAX); #ifdef DEBUG @@ -1637,7 +1248,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) itmp2 = reinterpret_cast(grib_context_malloc(a->context, ngroups * sizeof(int))); if (lens == NULL || widths == NULL || refs == NULL || itmp == NULL || itmp2 == NULL) { - grib_context_log(a->context, GRIB_LOG_ERROR, "%s packing: memory alloc of lens/widths/refs/itmp/itmp2 failed",cclass_name); + grib_context_log(a->context, GRIB_LOG_ERROR, "%s packing: memory alloc of lens/widths/refs/itmp/itmp2 failed", cclass_name); return GRIB_OUT_OF_MEMORY; } @@ -1694,7 +1305,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) } } - bits_per_value = find_nbits(grefmx + has_undef); + bits_per_value = find_nbits(grefmx + has_undef); numberOfBitsUsedForTheGroupWidths = find_nbits(gwidmx - gwidmn + has_undef); if ((err = grib_set_long_internal(gh, self->bits_per_value, bits_per_value)) != GRIB_SUCCESS) @@ -1850,17 +1461,268 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +template +static int unpack(grib_accessor* a, T* val, const size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating points numbers"); + grib_accessor_data_g22order_packing_t* self = reinterpret_cast(a); + const char* cclass_name = a->cclass->name; + grib_handle* gh = grib_handle_of_accessor(a); + + size_t i = 0; + size_t j = 0; + long n_vals = 0; + long vcount = 0; + int err = GRIB_SUCCESS; + long* sec_val = NULL; + unsigned char* buf = reinterpret_cast(gh->buffer->data); + unsigned char* buf_ref = NULL; + unsigned char* buf_width = NULL; + unsigned char* buf_length = NULL; + unsigned char* buf_vals = NULL; + + long length_p = 0; + long ref_p = 0; + long width_p = 0; + long vals_p = 0; + long nvals_per_group = 0; + long nbits_per_group_val = 0; + long group_ref_val = 0; + + long bits_per_value = 0; + T binary_s = 0; + T decimal_s = 0; + double reference_value = 0; + + long binary_scale_factor; + long decimal_scale_factor; + long typeOfOriginalFieldValues; + long groupSplittingMethodUsed; + long missingValueManagementUsed; + long primaryMissingValueSubstitute; + long secondaryMissingValueSubstitute; + long numberOfGroupsOfDataValues; + long referenceForGroupWidths; + long numberOfBitsUsedForTheGroupWidths; + long referenceForGroupLengths; + long lengthIncrementForTheGroupLengths; + long trueLengthOfLastGroup; + long numberOfBitsUsedForTheScaledGroupLengths; + long orderOfSpatialDifferencing = 0; + long numberOfOctetsExtraDescriptors = 0; + double missingValue = 0; + + err = a->value_count(&n_vals); + if (err) + return err; + + if (*len < static_cast(n_vals)) + return GRIB_ARRAY_TOO_SMALL; + + if ((err = grib_get_long_internal(gh, self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(gh, self->reference_value, &reference_value)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->binary_scale_factor, &binary_scale_factor)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->decimal_scale_factor, &decimal_scale_factor)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->typeOfOriginalFieldValues, &typeOfOriginalFieldValues)) != GRIB_SUCCESS) + return err; + + // Don't call grib_get_long_internal to suppress error message being output + if ((err = grib_get_long(gh, self->groupSplittingMethodUsed, &groupSplittingMethodUsed)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_long_internal(gh, self->missingValueManagementUsed, &missingValueManagementUsed)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->primaryMissingValueSubstitute, &primaryMissingValueSubstitute)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->secondaryMissingValueSubstitute, &secondaryMissingValueSubstitute)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->numberOfGroupsOfDataValues, &numberOfGroupsOfDataValues)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->referenceForGroupWidths, &referenceForGroupWidths)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->numberOfBitsUsedForTheGroupWidths, &numberOfBitsUsedForTheGroupWidths)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->referenceForGroupLengths, &referenceForGroupLengths)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_long_internal(gh, self->lengthIncrementForTheGroupLengths, &lengthIncrementForTheGroupLengths)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->trueLengthOfLastGroup, &trueLengthOfLastGroup)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->numberOfBitsUsedForTheScaledGroupLengths, &numberOfBitsUsedForTheScaledGroupLengths)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->orderOfSpatialDifferencing, &orderOfSpatialDifferencing)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(gh, self->numberOfOctetsExtraDescriptors, &numberOfOctetsExtraDescriptors)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(gh, "missingValue", &missingValue)) != GRIB_SUCCESS) + return err; + + self->dirty = 0; + + sec_val = (long*)grib_context_malloc(a->context, (n_vals) * sizeof(long)); + if (!sec_val) return GRIB_OUT_OF_MEMORY; + memset(sec_val, 0, (n_vals) * sizeof(long)); // See SUP-718 + + buf_ref = buf + a->offset; + + ref_p = (numberOfGroupsOfDataValues * bits_per_value); + + if (orderOfSpatialDifferencing) + ref_p += (1 + orderOfSpatialDifferencing) * (numberOfOctetsExtraDescriptors * 8); + + buf_width = buf_ref + (ref_p / 8) + ((ref_p % 8) ? 1 : 0); + + width_p = (numberOfGroupsOfDataValues * numberOfBitsUsedForTheGroupWidths); + buf_length = buf_width + (width_p / 8) + ((width_p % 8) ? 1 : 0); + + length_p = (numberOfGroupsOfDataValues * numberOfBitsUsedForTheScaledGroupLengths); + buf_vals = buf_length + (length_p / 8) + ((length_p % 8) ? 1 : 0); + + length_p = 0; + ref_p = orderOfSpatialDifferencing ? (orderOfSpatialDifferencing + 1) * (numberOfOctetsExtraDescriptors * 8) : 0; + width_p = 0; + vals_p = 0; + vcount = 0; + + for (i = 0; i < numberOfGroupsOfDataValues; i++) { + group_ref_val = grib_decode_unsigned_long(buf_ref, &ref_p, bits_per_value); + nvals_per_group = grib_decode_unsigned_long(buf_length, &length_p, numberOfBitsUsedForTheScaledGroupLengths); + nbits_per_group_val = grib_decode_unsigned_long(buf_width, &width_p, numberOfBitsUsedForTheGroupWidths); + + nvals_per_group *= lengthIncrementForTheGroupLengths; + nvals_per_group += referenceForGroupLengths; + nbits_per_group_val += referenceForGroupWidths; + + if (i == numberOfGroupsOfDataValues - 1) + nvals_per_group = trueLengthOfLastGroup; + if (n_vals < vcount + nvals_per_group) { + return GRIB_DECODING_ERROR; + } + + // grib_decode_long_array(buf_vals, &vals_p, nbits_per_group_val, nvals_per_group, &sec_val[vcount]); + if (missingValueManagementUsed == 0) { + // No explicit missing values included within data values + for (j = 0; j < nvals_per_group; j++) { + DEBUG_ASSERT_ACCESS(sec_val, (long)(vcount + j), n_vals); + sec_val[vcount + j] = group_ref_val + grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); + // printf("sec_val[%ld]=%ld\n", vcount+j, sec_val[vcount+j]); + } + } + else if (missingValueManagementUsed == 1) { + // Primary missing values included within data values + long maxn = 0; // (1 << bits_per_value) - 1; + for (j = 0; j < nvals_per_group; j++) { + if (nbits_per_group_val == 0) { + maxn = (1 << bits_per_value) - 1; + if (group_ref_val == maxn) { + sec_val[vcount + j] = LONG_MAX; // missing value + } + else { + long temp = grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); + sec_val[vcount + j] = group_ref_val + temp; + } + } + else { + long temp = grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); + maxn = (1 << nbits_per_group_val) - 1; + if (temp == maxn) { + sec_val[vcount + j] = LONG_MAX; // missing value + } + else { + sec_val[vcount + j] = group_ref_val + temp; + } + } + } + } + else if (missingValueManagementUsed == 2) { + // Primary and secondary missing values included within data values + long maxn = (1 << bits_per_value) - 1; + long maxn2 = 0; // maxn - 1 + for (j = 0; j < nvals_per_group; j++) { + if (nbits_per_group_val == 0) { + maxn2 = maxn - 1; + if (group_ref_val == maxn || group_ref_val == maxn2) { + sec_val[vcount + j] = LONG_MAX; // missing value + } + else { + long temp = grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); + sec_val[vcount + j] = group_ref_val + temp; + } + } + else { + long temp = grib_decode_unsigned_long(buf_vals, &vals_p, nbits_per_group_val); + maxn = (1 << nbits_per_group_val) - 1; + maxn2 = maxn - 1; + if (temp == maxn || temp == maxn2) { + sec_val[vcount + j] = LONG_MAX; // missing value + } + else { + sec_val[vcount + j] = group_ref_val + temp; + } + } + } + } + + vcount += nvals_per_group; + } + + if (orderOfSpatialDifferencing) { + long bias = 0; + unsigned long extras[2] = { + 0, + }; + ref_p = 0; + + // For Complex packing, order == 0 + // For Complex packing and spatial differencing, order == 1 or 2 (code table 5.6) + if (orderOfSpatialDifferencing != 1 && orderOfSpatialDifferencing != 2) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s unpacking: Unsupported order of spatial differencing %ld", cclass_name, orderOfSpatialDifferencing); + return GRIB_INTERNAL_ERROR; + } + + for (i = 0; i < orderOfSpatialDifferencing; i++) { + extras[i] = grib_decode_unsigned_long(buf_ref, &ref_p, numberOfOctetsExtraDescriptors * 8); + } + + bias = grib_decode_signed_longb(buf_ref, &ref_p, numberOfOctetsExtraDescriptors * 8); + + post_process(a->context, sec_val, n_vals, orderOfSpatialDifferencing, bias, extras); + // de_spatial_difference (a->context, sec_val, n_vals, orderOfSpatialDifferencing, bias); + } + + binary_s = (T)codes_power(binary_scale_factor, 2); + decimal_s = (T)codes_power(-decimal_scale_factor, 10); + + for (i = 0; i < n_vals; i++) { + if (sec_val[i] == LONG_MAX) { + val[i] = (T)missingValue; + } + else { + val[i] = (T)((((T)sec_val[i]) * binary_s) + reference_value) * decimal_s; + } + } + + grib_context_free(a->context, sec_val); + return err; +} + +int grib_accessor_class_data_g22order_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len) { return unpack(a, val, len); } -static int unpack_float(grib_accessor* a, float* val, size_t* len) +int grib_accessor_class_data_g22order_packing_t::unpack_float(grib_accessor* a, float* val, size_t* len) { return unpack(a, val, len); } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) +int grib_accessor_class_data_g22order_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val) { size_t size = 0; double* values = NULL; @@ -1881,7 +1743,7 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return GRIB_SUCCESS; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +int grib_accessor_class_data_g22order_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) { size_t size = 0, i = 0; double* values; @@ -1909,9 +1771,9 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array return GRIB_SUCCESS; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_data_g22order_packing_t::value_count(grib_accessor* a, long* count) { - grib_accessor_data_g22order_packing* self = reinterpret_cast(a); - *count = 0; + grib_accessor_data_g22order_packing_t* self = reinterpret_cast(a); + *count = 0; return grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues, count); } diff --git a/src/accessor/grib_accessor_class_data_g22order_packing.h b/src/accessor/grib_accessor_class_data_g22order_packing.h new file mode 100644 index 000000000..329823633 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g22order_packing.h @@ -0,0 +1,54 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_values.h" +#include "grib_scaling.h" + +class grib_accessor_data_g22order_packing_t : public grib_accessor_values_t +{ +public: + /* Members defined in data_g22order_packing */ + const char* numberOfValues; + const char* bits_per_value; + const char* reference_value; + const char* binary_scale_factor; + const char* decimal_scale_factor; + const char* optimize_scale_factor; + const char* typeOfOriginalFieldValues; + const char* groupSplittingMethodUsed; + const char* missingValueManagementUsed; + const char* primaryMissingValueSubstitute; + const char* secondaryMissingValueSubstitute; + const char* numberOfGroupsOfDataValues; + const char* referenceForGroupWidths; + const char* numberOfBitsUsedForTheGroupWidths; + const char* referenceForGroupLengths; + const char* lengthIncrementForTheGroupLengths; + const char* trueLengthOfLastGroup; + const char* numberOfBitsUsedForTheScaledGroupLengths; + const char* orderOfSpatialDifferencing; + const char* numberOfOctetsExtraDescriptors; +}; + +class grib_accessor_class_data_g22order_packing_t : public grib_accessor_class_values_t +{ +public: + grib_accessor_class_data_g22order_packing_t(const char* name) : grib_accessor_class_values_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g22order_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; +}; diff --git a/src/grib_accessor_class_data_g2bifourier_packing.cc b/src/accessor/grib_accessor_class_data_g2bifourier_packing.cc similarity index 79% rename from src/grib_accessor_class_data_g2bifourier_packing.cc rename to src/accessor/grib_accessor_class_data_g2bifourier_packing.cc index 86275d470..a014ef3c2 100644 --- a/src/grib_accessor_class_data_g2bifourier_packing.cc +++ b/src/accessor/grib_accessor_class_data_g2bifourier_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,156 +9,19 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/******************************** - * philippe.marguinaud@meteo.fr - *******************************/ - +#include "grib_accessor_class_data_g2bifourier_packing.h" #include "grib_scaling.h" -#include "grib_api_internal.h" -#include "grib_optimize_decimal_factor.h" -#include -#include - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = init - IMPLEMENTS = unpack_double - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - MEMBERS= const char* ieee_floats - MEMBERS= const char* laplacianOperatorIsSet - MEMBERS= const char* laplacianOperator - MEMBERS= const char* biFourierTruncationType - MEMBERS= const char* sub_i - MEMBERS= const char* sub_j - MEMBERS= const char* bif_i - MEMBERS= const char* bif_j - MEMBERS= const char* biFourierSubTruncationType - MEMBERS= const char* biFourierDoNotPackAxes - MEMBERS= const char* biFourierMakeTemplate - MEMBERS= const char* totalNumberOfValuesInUnpackedSubset - MEMBERS=const char* numberOfValues - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g2bifourier_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_g2bifourier_packing */ - const char* ieee_floats; - const char* laplacianOperatorIsSet; - const char* laplacianOperator; - const char* biFourierTruncationType; - const char* sub_i; - const char* sub_j; - const char* bif_i; - const char* bif_j; - const char* biFourierSubTruncationType; - const char* biFourierDoNotPackAxes; - const char* biFourierMakeTemplate; - const char* totalNumberOfValuesInUnpackedSubset; - const char* numberOfValues; -} grib_accessor_data_g2bifourier_packing; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_g2bifourier_packing = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_g2bifourier_packing", /* name */ - sizeof(grib_accessor_data_g2bifourier_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_data_g2bifourier_packing_t _grib_accessor_class_data_g2bifourier_packing{"data_g2bifourier_packing"}; grib_accessor_class* grib_accessor_class_data_g2bifourier_packing = &_grib_accessor_class_data_g2bifourier_packing; -/* END_CLASS_IMP */ typedef unsigned long (*encode_float_proc)(double); typedef double (*decode_float_proc)(unsigned long); -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g2bifourier_packing* self = (grib_accessor_data_g2bifourier_packing*)a; +void grib_accessor_class_data_g2bifourier_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_g2bifourier_packing_t* self = (grib_accessor_data_g2bifourier_packing_t*)a; grib_handle* gh = grib_handle_of_accessor(a); self->ieee_floats = grib_arguments_get_name(gh, args, self->carg++); @@ -178,9 +42,8 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) self->dirty = 1; } -static int value_count(grib_accessor* a, long* numberOfValues) -{ - grib_accessor_data_g2bifourier_packing* self = (grib_accessor_data_g2bifourier_packing*)a; +int grib_accessor_class_data_g2bifourier_packing_t::value_count(grib_accessor* a, long* numberOfValues){ + grib_accessor_data_g2bifourier_packing_t* self = (grib_accessor_data_g2bifourier_packing_t*)a; grib_handle* gh = grib_handle_of_accessor(a); *numberOfValues = 0; @@ -496,7 +359,7 @@ static void free_bif_trunc(bif_trunc_t* bt, grib_accessor* a) static bif_trunc_t* new_bif_trunc(grib_accessor* a) { int ret; - grib_accessor_data_g2bifourier_packing* self = (grib_accessor_data_g2bifourier_packing*)a; + grib_accessor_data_g2bifourier_packing_t* self = (grib_accessor_data_g2bifourier_packing_t*)a; grib_handle* gh = grib_handle_of_accessor(a); bif_trunc_t* bt = (bif_trunc_t*)grib_context_malloc(gh->context, sizeof(bif_trunc_t)); @@ -607,9 +470,8 @@ cleanup: return NULL; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_g2bifourier_packing* self = (grib_accessor_data_g2bifourier_packing*)a; +int grib_accessor_class_data_g2bifourier_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_g2bifourier_packing_t* self = (grib_accessor_data_g2bifourier_packing_t*)a; grib_handle* gh = grib_handle_of_accessor(a); unsigned char* buf = NULL; @@ -633,7 +495,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) int ret = GRIB_SUCCESS; int i, j, k; - if ((ret = grib_value_count(a, &count)) != GRIB_SUCCESS) + if ((ret = a->value_count(&count)) != GRIB_SUCCESS) goto cleanup; bt = new_bif_trunc(a); @@ -659,8 +521,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) self->dirty = 0; buf = (unsigned char*)gh->buffer->data; - buf += grib_byte_offset(a); - + buf += a->byte_offset(); s = codes_power(bt->binary_scale_factor, 2); d = codes_power(-bt->decimal_scale_factor, 10); @@ -670,7 +531,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) hres = buf; lres = buf; - packed_offset = grib_byte_offset(a) + bt->bytes * bt->n_vals_sub; + packed_offset = a->byte_offset() + bt->bytes * bt->n_vals_sub; lpos = 8 * (packed_offset - offsetdata); hpos = 0; @@ -706,9 +567,8 @@ cleanup: return ret; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_g2bifourier_packing* self = (grib_accessor_data_g2bifourier_packing*)a; +int grib_accessor_class_data_g2bifourier_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_g2bifourier_packing_t* self = (grib_accessor_data_g2bifourier_packing_t*)a; grib_handle* gh = grib_handle_of_accessor(a); const char* cclass_name = a->cclass->name; diff --git a/src/accessor/grib_accessor_class_data_g2bifourier_packing.h b/src/accessor/grib_accessor_class_data_g2bifourier_packing.h new file mode 100644 index 000000000..2fd7378a5 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2bifourier_packing.h @@ -0,0 +1,43 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" + +class grib_accessor_data_g2bifourier_packing_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_g2bifourier_packing */ + const char* ieee_floats; + const char* laplacianOperatorIsSet; + const char* laplacianOperator; + const char* biFourierTruncationType; + const char* sub_i; + const char* sub_j; + const char* bif_i; + const char* bif_j; + const char* biFourierSubTruncationType; + const char* biFourierDoNotPackAxes; + const char* biFourierMakeTemplate; + const char* totalNumberOfValuesInUnpackedSubset; + const char* numberOfValues; +}; + +class grib_accessor_class_data_g2bifourier_packing_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_g2bifourier_packing_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g2bifourier_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_g2complex_packing.cc b/src/accessor/grib_accessor_class_data_g2complex_packing.cc new file mode 100644 index 000000000..c1e5e7aad --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2complex_packing.cc @@ -0,0 +1,47 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_g2complex_packing.h" + +grib_accessor_class_data_g2complex_packing_t _grib_accessor_class_data_g2complex_packing{"data_g2complex_packing"}; +grib_accessor_class* grib_accessor_class_data_g2complex_packing = &_grib_accessor_class_data_g2complex_packing; + + +void grib_accessor_class_data_g2complex_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_complex_packing_t::init(a, v, args); + grib_accessor_data_g2complex_packing_t* self = (grib_accessor_data_g2complex_packing_t*)a; + self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->edition = 2; + + a->flags |= GRIB_ACCESSOR_FLAG_DATA; +} + +int grib_accessor_class_data_g2complex_packing_t::value_count(grib_accessor* a, long* numberOfValues){ + grib_accessor_data_g2complex_packing_t* self = (grib_accessor_data_g2complex_packing_t*)a; + *numberOfValues = 0; + + return grib_get_long(grib_handle_of_accessor(a), self->numberOfValues, numberOfValues); +} + +int grib_accessor_class_data_g2complex_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_g2complex_packing_t* self = (grib_accessor_data_g2complex_packing_t*)a; + int ret = GRIB_SUCCESS; + + if (*len == 0) + return GRIB_NO_VALUES; + + ret = grib_accessor_class_data_complex_packing_t::pack_double(a, val, len); + + if (ret == GRIB_SUCCESS) + ret = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfValues, *len); + + return ret; +} diff --git a/src/accessor/grib_accessor_class_data_g2complex_packing.h b/src/accessor/grib_accessor_class_data_g2complex_packing.h new file mode 100644 index 000000000..49f33a711 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2complex_packing.h @@ -0,0 +1,30 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_complex_packing.h" + +class grib_accessor_data_g2complex_packing_t : public grib_accessor_data_complex_packing_t +{ +public: + /* Members defined in data_g2complex_packing */ + const char* numberOfValues; +}; + +class grib_accessor_class_data_g2complex_packing_t : public grib_accessor_class_data_complex_packing_t +{ +public: + grib_accessor_class_data_g2complex_packing_t(const char* name) : grib_accessor_class_data_complex_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g2complex_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_g2secondary_bitmap.cc b/src/accessor/grib_accessor_class_data_g2secondary_bitmap.cc new file mode 100644 index 000000000..a6fd7bd46 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2secondary_bitmap.cc @@ -0,0 +1,107 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_g2secondary_bitmap.h" + +grib_accessor_class_data_g2secondary_bitmap_t _grib_accessor_class_data_g2secondary_bitmap{"data_g2secondary_bitmap"}; +grib_accessor_class* grib_accessor_class_data_g2secondary_bitmap = &_grib_accessor_class_data_g2secondary_bitmap; + + +void grib_accessor_class_data_g2secondary_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_secondary_bitmap_t::init(a, v, args); + grib_accessor_data_g2secondary_bitmap_t* self = (grib_accessor_data_g2secondary_bitmap_t*)a; + self->number_of_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4); +} + +int grib_accessor_class_data_g2secondary_bitmap_t::value_count(grib_accessor* a, long* len){ + grib_accessor_data_g2secondary_bitmap_t* self = (grib_accessor_data_g2secondary_bitmap_t*)a; + *len = 0; + return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, len); +} + +int grib_accessor_class_data_g2secondary_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_g2secondary_bitmap_t* self = (grib_accessor_data_g2secondary_bitmap_t*)a; + int err = 0; + + long primary_len = 0, secondary_len = 0; + double* primary_bitmap = NULL; + double* secondary_bitmap = NULL; + long i = 0, j = 0, k = 0, m = 0; + double missing_value = 0, present_value = 0; + long expand_by = 0; + + if (*len == 0) + return GRIB_NO_VALUES; + + if ((err = grib_get_long(grib_handle_of_accessor(a), self->expand_by, &expand_by)) != GRIB_SUCCESS) + return err; + if (expand_by <= 0) + return GRIB_ENCODING_ERROR; + + if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &missing_value)) != GRIB_SUCCESS) + return err; + + if (*len % expand_by) { + /*TODO: issue warning */ + return GRIB_ENCODING_ERROR; + } + + primary_len = *len / expand_by; + primary_bitmap = (double*)grib_context_malloc_clear(a->context, primary_len * sizeof(double)); + if (!primary_bitmap) + return GRIB_OUT_OF_MEMORY; + + secondary_len = *len; + secondary_bitmap = (double*)grib_context_malloc_clear(a->context, secondary_len * sizeof(double)); + if (!secondary_bitmap) { + grib_context_free(a->context, primary_bitmap); + return GRIB_OUT_OF_MEMORY; + } + + if (missing_value == 0) + present_value = 1; + else + present_value = 0; + + k = 0; + m = 0; + for (i = 0; i < *len; i += expand_by) { + int cnt = 0; + for (j = 0; j < expand_by; j++) + if (val[i + j] == missing_value) + cnt++; + + if (cnt == expand_by) /* all expand_by values are missing */ + primary_bitmap[k++] = missing_value; + else { + primary_bitmap[k++] = present_value; + for (j = 0; j < expand_by; j++) + secondary_bitmap[m++] = val[i + j]; + //on++; + } + } + + *len = k; + + Assert(k == primary_len); + + err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->primary_bitmap, primary_bitmap, k); + if (err == GRIB_SUCCESS) + err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->secondary_bitmap, secondary_bitmap, m); + + grib_context_free(a->context, primary_bitmap); + grib_context_free(a->context, secondary_bitmap); + + if (err == GRIB_SUCCESS) + err = grib_set_long_internal(grib_handle_of_accessor(a), self->number_of_values, *len * expand_by); + + return err; +} diff --git a/src/accessor/grib_accessor_class_data_g2secondary_bitmap.h b/src/accessor/grib_accessor_class_data_g2secondary_bitmap.h new file mode 100644 index 000000000..f981e1e6c --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2secondary_bitmap.h @@ -0,0 +1,30 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_secondary_bitmap.h" + +class grib_accessor_data_g2secondary_bitmap_t : public grib_accessor_data_secondary_bitmap_t +{ +public: + /* Members defined in data_g2secondary_bitmap */ + const char* number_of_values; +}; + +class grib_accessor_class_data_g2secondary_bitmap_t : public grib_accessor_class_data_secondary_bitmap_t +{ +public: + grib_accessor_class_data_g2secondary_bitmap_t(const char* name) : grib_accessor_class_data_secondary_bitmap_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g2secondary_bitmap_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_g2shsimple_packing.cc b/src/accessor/grib_accessor_class_data_g2shsimple_packing.cc new file mode 100644 index 000000000..7e2b5cd54 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2shsimple_packing.cc @@ -0,0 +1,92 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_g2shsimple_packing.h" + +grib_accessor_class_data_g2shsimple_packing_t _grib_accessor_class_data_g2shsimple_packing{"data_g2shsimple_packing"}; +grib_accessor_class* grib_accessor_class_data_g2shsimple_packing = &_grib_accessor_class_data_g2shsimple_packing; + + +void grib_accessor_class_data_g2shsimple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_shsimple_packing_t::init(a, v, args); + grib_accessor_data_g2shsimple_packing_t* self = (grib_accessor_data_g2shsimple_packing_t*)a; + + self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), args, 2); + self->numberOfDataPoints = grib_arguments_get_name(grib_handle_of_accessor(a), args, 3); + a->flags |= GRIB_ACCESSOR_FLAG_DATA; +} + +int grib_accessor_class_data_g2shsimple_packing_t::value_count(grib_accessor* a, long* len){ + grib_accessor_data_g2shsimple_packing_t* self = (grib_accessor_data_g2shsimple_packing_t*)a; + *len = 0; + return grib_get_long(grib_handle_of_accessor(a), self->numberOfValues, len); +} + +int grib_accessor_class_data_g2shsimple_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_g2shsimple_packing_t* self = (grib_accessor_data_g2shsimple_packing_t*)a; + int err = GRIB_SUCCESS; + + size_t n_vals = 0; + + if ((err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &n_vals)) != GRIB_SUCCESS) + return err; + + self->dirty = 0; + + /* n_vals = coded_n_vals+1; */ + + if (*len < n_vals) { + *len = n_vals; + return GRIB_ARRAY_TOO_SMALL; + } + + if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->real_part, val)) != GRIB_SUCCESS) + return err; + + val++; + + if ((err = grib_get_double_array_internal(grib_handle_of_accessor(a), self->coded_values, val, &n_vals)) != GRIB_SUCCESS) + return err; + + *len = n_vals; + + return err; +} + +int grib_accessor_class_data_g2shsimple_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_g2shsimple_packing_t* self = (grib_accessor_data_g2shsimple_packing_t*)a; + int err = GRIB_SUCCESS; + + size_t coded_n_vals = *len - 1; + size_t n_vals = *len; + + if (*len == 0) + return GRIB_NO_VALUES; + + self->dirty = 1; + + if ((err = grib_set_double_internal(grib_handle_of_accessor(a), self->real_part, *val)) != GRIB_SUCCESS) + return err; + + val++; + + if ((err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->coded_values, val, coded_n_vals)) != GRIB_SUCCESS) + return err; + + *len = n_vals; + + if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfValues, (long)n_vals)) != GRIB_SUCCESS) + return err; + if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfDataPoints, (long)n_vals)) != GRIB_SUCCESS) + return err; + + return err; +} diff --git a/src/accessor/grib_accessor_class_data_g2shsimple_packing.h b/src/accessor/grib_accessor_class_data_g2shsimple_packing.h new file mode 100644 index 000000000..02da8345e --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2shsimple_packing.h @@ -0,0 +1,32 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_shsimple_packing.h" + +class grib_accessor_data_g2shsimple_packing_t : public grib_accessor_data_shsimple_packing_t +{ +public: + /* Members defined in data_g2shsimple_packing */ + const char* numberOfValues; + const char* numberOfDataPoints; +}; + +class grib_accessor_class_data_g2shsimple_packing_t : public grib_accessor_class_data_shsimple_packing_t +{ +public: + grib_accessor_class_data_g2shsimple_packing_t(const char* name) : grib_accessor_class_data_shsimple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g2shsimple_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_data_g2simple_packing.cc b/src/accessor/grib_accessor_class_data_g2simple_packing.cc similarity index 51% rename from src/grib_accessor_class_data_g2simple_packing.cc rename to src/accessor/grib_accessor_class_data_g2simple_packing.cc index 56441fc96..08aa11699 100644 --- a/src/grib_accessor_class_data_g2simple_packing.cc +++ b/src/accessor/grib_accessor_class_data_g2simple_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,135 +9,29 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ +#include "grib_accessor_class_data_g2simple_packing.h" #include "grib_scaling.h" -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = pack_bytes - IMPLEMENTS = value_count - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_bytes(grib_accessor*, const unsigned char*, size_t* len); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g2simple_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_g2simple_packing */ -} grib_accessor_data_g2simple_packing; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_g2simple_packing = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_g2simple_packing", /* name */ - sizeof(grib_accessor_data_g2simple_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - &pack_bytes, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_data_g2simple_packing_t _grib_accessor_class_data_g2simple_packing{"data_g2simple_packing"}; grib_accessor_class* grib_accessor_class_data_g2simple_packing = &_grib_accessor_class_data_g2simple_packing; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g2simple_packing* self = (grib_accessor_data_g2simple_packing*)a; +void grib_accessor_class_data_g2simple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_g2simple_packing_t* self = (grib_accessor_data_g2simple_packing_t*)a; a->flags |= GRIB_ACCESSOR_FLAG_DATA; self->edition = 2; } -static int value_count(grib_accessor* a, long* n_vals) -{ - grib_accessor_data_g2simple_packing* self = (grib_accessor_data_g2simple_packing*)a; +int grib_accessor_class_data_g2simple_packing_t::value_count(grib_accessor* a, long* n_vals){ + grib_accessor_data_g2simple_packing_t* self = (grib_accessor_data_g2simple_packing_t*)a; *n_vals = 0; return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals); } -static int pack_double(grib_accessor* a, const double* cval, size_t* len) -{ - grib_accessor_data_g2simple_packing* self = (grib_accessor_data_g2simple_packing*)a; - grib_accessor_class* super = *(a->cclass->super); +int grib_accessor_class_data_g2simple_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len){ + grib_accessor_data_g2simple_packing_t* self = (grib_accessor_data_g2simple_packing_t*)a; + //grib_accessor_class* super = *(a->cclass->super); size_t n_vals = *len; double reference_value = 0; long binary_scale_factor = 0; @@ -209,17 +104,7 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len) return grib_set_double_array(h, "values", val, *len); } - if (super != grib_accessor_class_data_g2simple_packing) { - /* Normal case: parent not same as me! */ - ret = super->pack_double(a, val, len); - } - else { - /* GRIB-364: simple packing with logarithm pre-processing */ - grib_accessor_class* super2 = NULL; - Assert(super->super); - super2 = *(super->super); - ret = super2->pack_double(a, val, len); - } + ret = grib_accessor_class_data_simple_packing_t::pack_double(a, cval, len); switch (ret) { case GRIB_CONSTANT_FIELD: grib_buffer_replace(a, NULL, 0, 1, 1); @@ -253,7 +138,7 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len) grib_encode_double_array(n_vals, val, bits_per_value, reference_value, decimal, divisor, encoded, &off); grib_context_log(a->context, GRIB_LOG_DEBUG, - "grib_accessor_data_g2simple_packing : pack_double : packing %s, %d values", a->name, n_vals); + "grib_accessor_data_g2simple_packing_t : pack_double : packing %s, %d values", a->name, n_vals); grib_buffer_replace(a, buf, buflen, 1, 1); @@ -262,8 +147,7 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len) return ret; } -static int pack_bytes(grib_accessor* a, const unsigned char* val, size_t* len) -{ +int grib_accessor_class_data_g2simple_packing_t::pack_bytes(grib_accessor* a, const unsigned char* val, size_t* len){ size_t length = *len; grib_buffer_replace(a, val, length, 1, 1); return GRIB_SUCCESS; diff --git a/src/accessor/grib_accessor_class_data_g2simple_packing.h b/src/accessor/grib_accessor_class_data_g2simple_packing.h new file mode 100644 index 000000000..a88cccac0 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2simple_packing.h @@ -0,0 +1,26 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" + +class grib_accessor_data_g2simple_packing_t : public grib_accessor_data_simple_packing_t {}; + +class grib_accessor_class_data_g2simple_packing_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_g2simple_packing_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g2simple_packing_t{}; } + int pack_bytes(grib_accessor*, const unsigned char*, size_t* len) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc b/src/accessor/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc new file mode 100644 index 000000000..fc87df231 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc @@ -0,0 +1,175 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_g2simple_packing_with_preprocessing.h" +#define DIRECT 0 +#define INVERSE 1 + +grib_accessor_class_data_g2simple_packing_with_preprocessing_t _grib_accessor_class_data_g2simple_packing_with_preprocessing{ "data_g2simple_packing_with_preprocessing" }; +grib_accessor_class* grib_accessor_class_data_g2simple_packing_with_preprocessing = &_grib_accessor_class_data_g2simple_packing_with_preprocessing; + + +void grib_accessor_class_data_g2simple_packing_with_preprocessing_t::init(grib_accessor* a, const long v, grib_arguments* args) +{ + grib_accessor_class_data_g2simple_packing_t::init(a, v, args); + grib_accessor_data_g2simple_packing_with_preprocessing_t* self = (grib_accessor_data_g2simple_packing_with_preprocessing_t*)a; + self->pre_processing = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->pre_processing_parameter = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + a->flags |= GRIB_ACCESSOR_FLAG_DATA; +} + +int grib_accessor_class_data_g2simple_packing_with_preprocessing_t::value_count(grib_accessor* a, long* n_vals) +{ + grib_accessor_data_g2simple_packing_with_preprocessing_t* self = (grib_accessor_data_g2simple_packing_with_preprocessing_t*)a; + *n_vals = 0; + + return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals); +} + +static int pre_processing_func(double* values, long length, long pre_processing, + double* pre_processing_parameter, int mode) +{ + int i = 0, ret = 0; + double min = values[0]; + double next_min = values[0]; + Assert(length > 0); + + switch (pre_processing) { + /* NONE */ + case 0: + break; + /* LOGARITHM */ + case 1: + if (mode == DIRECT) { + for (i = 0; i < length; i++) { + if (values[i] < min) + min = values[i]; + if (values[i] > next_min) + next_min = values[i]; + } + for (i = 0; i < length; i++) { + if (values[i] > min && values[i] < next_min) + next_min = values[i]; + } + if (min > 0) { + *pre_processing_parameter = 0; + for (i = 0; i < length; i++) { + DEBUG_ASSERT(values[i] > 0); + values[i] = log(values[i]); + } + } + else { + double ppp = 0; + *pre_processing_parameter = next_min - 2 * min; + if (next_min == min) + return ret; + ppp = *pre_processing_parameter; + for (i = 0; i < length; i++) { + DEBUG_ASSERT((values[i] + ppp) > 0); + values[i] = log(values[i] + ppp); + } + } + } + else { + Assert(mode == INVERSE); + if (*pre_processing_parameter == 0) { + for (i = 0; i < length; i++) + values[i] = exp(values[i]); + } + else { + for (i = 0; i < length; i++) + values[i] = exp(values[i]) - *pre_processing_parameter; + } + } + break; + default: + ret = GRIB_NOT_IMPLEMENTED; + break; + } + + return ret; +} + +int grib_accessor_class_data_g2simple_packing_with_preprocessing_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + grib_accessor_data_g2simple_packing_with_preprocessing_t* self = (grib_accessor_data_g2simple_packing_with_preprocessing_t*)a; + + size_t n_vals = 0; + long nn = 0; + int err = 0; + + long pre_processing; + double pre_processing_parameter; + + err = a->value_count(&nn); + n_vals = nn; + if (err) + return err; + + if (n_vals == 0) { + *len = 0; + return GRIB_SUCCESS; + } + + self->dirty = 0; + + if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->pre_processing, &pre_processing)) != GRIB_SUCCESS) { + return err; + } + + if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->pre_processing_parameter, &pre_processing_parameter)) != GRIB_SUCCESS) { + return err; + } + + err = grib_accessor_class_data_simple_packing_t::unpack_double(a, val, &n_vals); + if (err != GRIB_SUCCESS) + return err; + + err = pre_processing_func(val, n_vals, pre_processing, &pre_processing_parameter, INVERSE); + if (err != GRIB_SUCCESS) + return err; + + *len = (long)n_vals; + + return err; +} + +int grib_accessor_class_data_g2simple_packing_with_preprocessing_t::pack_double(grib_accessor* a, const double* val, size_t* len) +{ + grib_accessor_data_g2simple_packing_with_preprocessing_t* self = (grib_accessor_data_g2simple_packing_with_preprocessing_t*)a; + + size_t n_vals = *len; + int err = 0; + + long pre_processing = 0; + double pre_processing_parameter = 0; + + self->dirty = 1; + + if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->pre_processing, &pre_processing)) != GRIB_SUCCESS) + return err; + + err = pre_processing_func((double*)val, n_vals, pre_processing, &pre_processing_parameter, DIRECT); + if (err != GRIB_SUCCESS) + return err; + + err = grib_accessor_class_data_g2simple_packing_t::pack_double(a, val, len); + if (err != GRIB_SUCCESS) + return err; + + if ((err = grib_set_double_internal(grib_handle_of_accessor(a), self->pre_processing_parameter, pre_processing_parameter)) != GRIB_SUCCESS) + return err; + + if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals)) != GRIB_SUCCESS) + return err; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_data_g2simple_packing_with_preprocessing.h b/src/accessor/grib_accessor_class_data_g2simple_packing_with_preprocessing.h new file mode 100644 index 000000000..4e2437e8b --- /dev/null +++ b/src/accessor/grib_accessor_class_data_g2simple_packing_with_preprocessing.h @@ -0,0 +1,32 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_g2simple_packing.h" + +class grib_accessor_data_g2simple_packing_with_preprocessing_t : public grib_accessor_data_g2simple_packing_t +{ +public: + /* Members defined in data_g2simple_packing_with_preprocessing */ + const char* pre_processing; + const char* pre_processing_parameter; +}; + +class grib_accessor_class_data_g2simple_packing_with_preprocessing_t : public grib_accessor_class_data_g2simple_packing_t +{ +public: + grib_accessor_class_data_g2simple_packing_with_preprocessing_t(const char* name) : grib_accessor_class_data_g2simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_g2simple_packing_with_preprocessing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_data_jpeg2000_packing.cc b/src/accessor/grib_accessor_class_data_jpeg2000_packing.cc similarity index 73% rename from src/grib_accessor_class_data_jpeg2000_packing.cc rename to src/accessor/grib_accessor_class_data_jpeg2000_packing.cc index a1a43b6f7..5ce5ae154 100644 --- a/src/grib_accessor_class_data_jpeg2000_packing.cc +++ b/src/accessor/grib_accessor_class_data_jpeg2000_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,148 +9,21 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_scaling.h" -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = init - IMPLEMENTS = unpack_double - IMPLEMENTS = pack_double;unpack_float - IMPLEMENTS = unpack_double_element;unpack_double_element_set - IMPLEMENTS = value_count - MEMBERS=const char* type_of_compression_used - MEMBERS=const char* target_compression_ratio - MEMBERS=const char* ni - MEMBERS=const char* nj - MEMBERS=const char* list_defining_points - MEMBERS=const char* number_of_data_points - MEMBERS=const char* scanning_mode - MEMBERS=int jpeg_lib - MEMBERS=const char* dump_jpg - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_data_jpeg2000_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_jpeg2000_packing */ - const char* type_of_compression_used; - const char* target_compression_ratio; - const char* ni; - const char* nj; - const char* list_defining_points; - const char* number_of_data_points; - const char* scanning_mode; - int jpeg_lib; - const char* dump_jpg; -} grib_accessor_data_jpeg2000_packing; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_jpeg2000_packing = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_jpeg2000_packing", /* name */ - sizeof(grib_accessor_data_jpeg2000_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_data_jpeg2000_packing.h" +grib_accessor_class_data_jpeg2000_packing_t _grib_accessor_class_data_jpeg2000_packing{"data_jpeg2000_packing"}; grib_accessor_class* grib_accessor_class_data_jpeg2000_packing = &_grib_accessor_class_data_jpeg2000_packing; -/* END_CLASS_IMP */ static int first = 1; #define JASPER_LIB 1 #define OPENJPEG_LIB 2 -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ +void grib_accessor_class_data_jpeg2000_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_simple_packing_t::init(a, v, args); const char* user_lib = NULL; - grib_accessor_data_jpeg2000_packing* self = (grib_accessor_data_jpeg2000_packing*)a; + grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a; grib_handle* hand = grib_handle_of_accessor(a); self->jpeg_lib = 0; @@ -204,9 +78,8 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) } } -static int value_count(grib_accessor* a, long* n_vals) -{ - grib_accessor_data_jpeg2000_packing* self = (grib_accessor_data_jpeg2000_packing*)a; +int grib_accessor_class_data_jpeg2000_packing_t::value_count(grib_accessor* a, long* n_vals){ + grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a; *n_vals = 0; return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals); @@ -215,19 +88,16 @@ static int value_count(grib_accessor* a, long* n_vals) #define EXTRA_BUFFER_SIZE 10240 #if HAVE_JPEG -static int unpack_float(grib_accessor*, float* val, size_t* len) -{ +int grib_accessor_class_data_jpeg2000_packing_t::unpack_float(grib_accessor*, float* val, size_t* len){ return GRIB_NOT_IMPLEMENTED; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_jpeg2000_packing* self = (grib_accessor_data_jpeg2000_packing*)a; +int grib_accessor_class_data_jpeg2000_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a; int err = GRIB_SUCCESS; size_t i = 0; - size_t buflen = grib_byte_count(a); - + size_t buflen = a->byte_count(); double bscale = 0; double dscale = 0; unsigned char* buf = NULL; @@ -242,8 +112,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) double units_bias = 0.0; n_vals = 0; - err = grib_value_count(a, &nn); - n_vals = nn; + err = a->value_count(&nn); n_vals = nn; if (err) return err; @@ -282,8 +151,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) } buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; - buf += grib_byte_offset(a); - + buf += a->byte_offset(); switch (self->jpeg_lib) { case OPENJPEG_LIB: if ((err = grib_openjpeg_decode(a->context, buf, &buflen, val, &n_vals)) != GRIB_SUCCESS) @@ -323,10 +191,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return err; } -static int pack_double(grib_accessor* a, const double* cval, size_t* len) -{ - grib_accessor_data_jpeg2000_packing* self = (grib_accessor_data_jpeg2000_packing*)a; - grib_accessor_class* super = *(a->cclass->super); +int grib_accessor_class_data_jpeg2000_packing_t::pack_double(grib_accessor* a, const double* cval, size_t* len){ + grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a; size_t n_vals = *len; int err = 0; int i; @@ -383,7 +249,8 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len) for (i = 0; i < n_vals; i++) val[i] += units_bias; - ret = super->pack_double(a, val, len); + ret = grib_accessor_class_data_simple_packing_t::pack_double(a, val, len); + switch (ret) { case GRIB_CONSTANT_FIELD: grib_buffer_replace(a, NULL, 0, 1, 1); @@ -561,33 +428,28 @@ cleanup: } #else -static void print_error_feature_not_enabled(grib_context* c) -{ +static void print_error_feature_not_enabled(grib_context* c){ grib_context_log(c, GRIB_LOG_ERROR, "JPEG support not enabled. Please rebuild with -DENABLE_JPG=ON"); } -static int unpack_float(grib_accessor* a, float* val, size_t* len) -{ +int grib_accessor_class_data_jpeg2000_packing_t::unpack_float(grib_accessor* a, float* val, size_t* len){ print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ +int grib_accessor_class_data_jpeg2000_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ +int grib_accessor_class_data_jpeg2000_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } #endif -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) -{ - grib_accessor_data_jpeg2000_packing* self = (grib_accessor_data_jpeg2000_packing*)a; +int grib_accessor_class_data_jpeg2000_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){ + grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a; grib_handle* hand = grib_handle_of_accessor(a); size_t size = 0; double* values = NULL; @@ -624,9 +486,8 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return GRIB_SUCCESS; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) -{ - grib_accessor_data_jpeg2000_packing* self = (grib_accessor_data_jpeg2000_packing*)a; +int grib_accessor_class_data_jpeg2000_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){ + grib_accessor_data_jpeg2000_packing_t* self = (grib_accessor_data_jpeg2000_packing_t*)a; grib_handle* hand = grib_handle_of_accessor(a); size_t size = 0, i = 0; double* values = NULL; diff --git a/src/accessor/grib_accessor_class_data_jpeg2000_packing.h b/src/accessor/grib_accessor_class_data_jpeg2000_packing.h new file mode 100644 index 000000000..54dcc457c --- /dev/null +++ b/src/accessor/grib_accessor_class_data_jpeg2000_packing.h @@ -0,0 +1,42 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" + +class grib_accessor_data_jpeg2000_packing_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_jpeg2000_packing */ + const char* type_of_compression_used; + const char* target_compression_ratio; + const char* ni; + const char* nj; + const char* list_defining_points; + const char* number_of_data_points; + const char* scanning_mode; + int jpeg_lib; + const char* dump_jpg; +}; + +class grib_accessor_class_data_jpeg2000_packing_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_jpeg2000_packing_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_jpeg2000_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; +}; diff --git a/src/grib_accessor_class_data_png_packing.cc b/src/accessor/grib_accessor_class_data_png_packing.cc similarity index 76% rename from src/grib_accessor_class_data_png_packing.cc rename to src/accessor/grib_accessor_class_data_png_packing.cc index e9747b19d..690070214 100644 --- a/src/grib_accessor_class_data_png_packing.cc +++ b/src/accessor/grib_accessor_class_data_png_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,134 +9,18 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ +#include "grib_accessor_class_data_png_packing.h" #include "grib_scaling.h" -#include "grib_api_internal.h" + #define PNG_ANYBITS -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_values - IMPLEMENTS = init - IMPLEMENTS = unpack_double - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - IMPLEMENTS = unpack_double_element;unpack_double_element_set - MEMBERS=const char* number_of_values - MEMBERS=const char* reference_value - MEMBERS=const char* binary_scale_factor - MEMBERS=const char* decimal_scale_factor - MEMBERS=const char* bits_per_value - MEMBERS=const char* ni - MEMBERS=const char* nj - MEMBERS=const char* list_defining_points - MEMBERS=const char* number_of_data_points - MEMBERS=const char* scanning_mode - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_data_png_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_png_packing */ - const char* number_of_values; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* bits_per_value; - const char* ni; - const char* nj; - const char* list_defining_points; - const char* number_of_data_points; - const char* scanning_mode; -} grib_accessor_data_png_packing; - -extern grib_accessor_class* grib_accessor_class_values; - -static grib_accessor_class _grib_accessor_class_data_png_packing = { - &grib_accessor_class_values, /* super */ - "data_png_packing", /* name */ - sizeof(grib_accessor_data_png_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - +grib_accessor_class_data_png_packing_t _grib_accessor_class_data_png_packing{"data_png_packing"}; grib_accessor_class* grib_accessor_class_data_png_packing = &_grib_accessor_class_data_png_packing; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_png_packing* self = (grib_accessor_data_png_packing*)a; +void grib_accessor_class_data_png_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_values_t::init(a, v, args); + grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a; grib_handle* h = grib_handle_of_accessor(a); self->number_of_values = grib_arguments_get_name(h, args, self->carg++); @@ -151,9 +36,8 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->flags |= GRIB_ACCESSOR_FLAG_DATA; } -static int value_count(grib_accessor* a, long* n_vals) -{ - grib_accessor_data_png_packing* self = (grib_accessor_data_png_packing*)a; +int grib_accessor_class_data_png_packing_t::value_count(grib_accessor* a, long* n_vals){ + grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a; *n_vals = 0; return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals); } @@ -196,14 +80,12 @@ static void png_flush_callback(png_structp png) /* Empty */ } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_png_packing* self = (grib_accessor_data_png_packing*)a; +int grib_accessor_class_data_png_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a; int err = GRIB_SUCCESS; int i, j; - size_t buflen = grib_byte_count(a); - + size_t buflen = a->byte_count(); double bscale = 0; double dscale = 0; unsigned char* buf = NULL; @@ -227,8 +109,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) self->dirty = 0; - err = grib_value_count(a, &nn); - n_vals = nn; + err = a->value_count(&nn); n_vals = nn; if (err) return err; if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) @@ -257,8 +138,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) } buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; - buf += grib_byte_offset(a); - + buf += a->byte_offset(); if (png_sig_cmp(buf, 0, 8) != 0) return GRIB_INVALID_MESSAGE; @@ -356,9 +236,8 @@ static bool is_constant(const double* values, size_t n_vals) return isConstant; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_png_packing* self = (grib_accessor_data_png_packing*)a; +int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a; const char* cclass_name = a->cclass->name; int err = GRIB_SUCCESS; @@ -545,7 +424,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) } /* buflen = n_vals*(bits_per_value/8); */ grib_context_log(a->context, GRIB_LOG_DEBUG, - "grib_accessor_data_png_packing : pack_double : packing %s, %d values", a->name, n_vals); + "grib_accessor_data_png_packing_t : pack_double : packing %s, %d values", a->name, n_vals); buf = (unsigned char*)grib_context_buffer_malloc_clear(a->context, buflen); if (!buf) { @@ -652,10 +531,9 @@ cleanup: return err; } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) -{ +int grib_accessor_class_data_png_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){ /* The index idx relates to codedValues NOT values! */ - grib_accessor_data_png_packing* self = (grib_accessor_data_png_packing*)a; + grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int err = 0; size_t size = 0; @@ -688,10 +566,9 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return GRIB_SUCCESS; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) -{ +int grib_accessor_class_data_png_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){ /* The index idx relates to codedValues NOT values! */ - grib_accessor_data_png_packing* self = (grib_accessor_data_png_packing*)a; + grib_accessor_data_png_packing_t* self = (grib_accessor_data_png_packing_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int err = 0; size_t size = 0, i = 0; @@ -735,29 +612,24 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array #else -static void print_error_feature_not_enabled(grib_context* c) -{ +static void print_error_feature_not_enabled(grib_context* c){ grib_context_log(c, GRIB_LOG_ERROR, "PNG support not enabled. Please rebuild with -DENABLE_PNG=ON"); } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ +int grib_accessor_class_data_png_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ +int grib_accessor_class_data_png_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) -{ +int grib_accessor_class_data_png_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){ print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) -{ +int grib_accessor_class_data_png_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){ print_error_feature_not_enabled(a->context); return GRIB_FUNCTIONALITY_NOT_ENABLED; } diff --git a/src/accessor/grib_accessor_class_data_png_packing.h b/src/accessor/grib_accessor_class_data_png_packing.h new file mode 100644 index 000000000..841ed9d31 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_png_packing.h @@ -0,0 +1,41 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_values.h" + +class grib_accessor_data_png_packing_t : public grib_accessor_values_t +{ +public: + const char* number_of_values; + const char* reference_value; + const char* binary_scale_factor; + const char* decimal_scale_factor; + const char* bits_per_value; + const char* ni; + const char* nj; + const char* list_defining_points; + const char* number_of_data_points; + const char* scanning_mode; +}; + +class grib_accessor_class_data_png_packing_t : public grib_accessor_class_values_t +{ +public: + grib_accessor_class_data_png_packing_t(const char* name) : grib_accessor_class_values_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_png_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; +}; diff --git a/src/accessor/grib_accessor_class_data_raw_packing.cc b/src/accessor/grib_accessor_class_data_raw_packing.cc new file mode 100644 index 000000000..499b46bec --- /dev/null +++ b/src/accessor/grib_accessor_class_data_raw_packing.cc @@ -0,0 +1,194 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_raw_packing.h" +#include "grib_ieeefloat.h" + +grib_accessor_class_data_raw_packing_t _grib_accessor_class_data_raw_packing{"data_raw_packing"}; +grib_accessor_class* grib_accessor_class_data_raw_packing = &_grib_accessor_class_data_raw_packing; + + +void grib_accessor_class_data_raw_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_values_t::init(a, v, args); + grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a; + + self->number_of_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + self->precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); + a->flags |= GRIB_ACCESSOR_FLAG_DATA; +} + +int grib_accessor_class_data_raw_packing_t::value_count(grib_accessor* a, long* n_vals){ + grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a; + *n_vals = 0; + return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals); +} + +int grib_accessor_class_data_raw_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a; + unsigned char* buf = NULL; + int bytes = 0; + size_t nvals = 0; + long inlen = a->byte_count(); + long precision = 0; + + int code = GRIB_SUCCESS; + + if ((code = grib_get_long(grib_handle_of_accessor(a), self->precision, &precision)) != GRIB_SUCCESS) + return code; + + self->dirty = 0; + + buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; + buf += a->byte_offset(); + switch (precision) { + case 1: + bytes = 4; + break; + case 2: + bytes = 8; + break; + default: + return GRIB_NOT_IMPLEMENTED; + } + + nvals = inlen / bytes; + + if (*len < nvals) + return GRIB_ARRAY_TOO_SMALL; + + code = grib_ieee_decode_array(a->context, buf, nvals, bytes, val); + + *len = nvals; + + return code; +} + +int grib_accessor_class_data_raw_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a; + + int bytes = 0; + unsigned char* buffer = NULL; + + long precision = 0; + + double* values = (double*)val; + size_t inlen = *len; + + /*int free_buffer = 0; + *int free_values = 0;*/ + + int code = GRIB_SUCCESS; + + size_t bufsize = 0; + + if (*len == 0) + return GRIB_NO_VALUES; + + if ((code = grib_get_long_internal(grib_handle_of_accessor(a), self->precision, &precision)) != GRIB_SUCCESS) + return code; + + self->dirty = 1; + + switch (precision) { + case 1: + bytes = 4; + break; + + case 2: + bytes = 8; + break; + + default: + code = GRIB_NOT_IMPLEMENTED; + goto clean_up; + } + + bufsize = bytes * inlen; + + buffer = (unsigned char*)grib_context_malloc(a->context, bufsize); + + if (!buffer) { + code = GRIB_OUT_OF_MEMORY; + goto clean_up; + } + + code = grib_ieee_encode_array(a->context, values, inlen, bytes, buffer); + +clean_up: + /*if (free_buffer) + * free(buffer); + * if (free_values) + * free(values); + */ + + grib_buffer_replace(a, buffer, bufsize, 1, 1); + + grib_context_buffer_free(a->context, buffer); + + if (code == GRIB_SUCCESS) { + code = grib_set_long(grib_handle_of_accessor(a), self->number_of_values, inlen); + if (code == GRIB_READ_ONLY) + code = 0; + } + + return code; +} + +int grib_accessor_class_data_raw_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val){ + int ret = 0; + grib_accessor_data_raw_packing_t* self = (grib_accessor_data_raw_packing_t*)a; + unsigned char* buf = NULL; + int bytes = 0; + size_t nvals = 0; + long inlen = a->byte_count(); long pos = 0; + long precision = 0; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->precision, &precision)) != GRIB_SUCCESS) + return ret; + + self->dirty = 0; + + buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; + buf += a->byte_offset(); + switch (precision) { + case 1: + bytes = 4; + break; + + case 2: + bytes = 8; + break; + + default: + return GRIB_NOT_IMPLEMENTED; + } + + pos = bytes * idx; + + Assert(pos <= inlen); + + nvals = 1; + buf += pos; + + ret = grib_ieee_decode_array(a->context, buf, nvals, bytes, val); + + return ret; +} + +int grib_accessor_class_data_raw_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array){ + int err = 0; + size_t i = 0; + for (i=0; inumber_of_values = grib_arguments_get_name(gh, args, self->carg++); self->bits_per_value = grib_arguments_get_name(gh, args, self->carg++); @@ -133,16 +29,14 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->flags |= GRIB_ACCESSOR_FLAG_DATA; } -static int value_count(grib_accessor* a, long* number_of_values) -{ - grib_accessor_data_run_length_packing* self = (grib_accessor_data_run_length_packing*)a; +int grib_accessor_class_data_run_length_packing_t::value_count(grib_accessor* a, long* number_of_values){ + grib_accessor_data_run_length_packing_t* self = (grib_accessor_data_run_length_packing_t*)a; *number_of_values = 0; return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, number_of_values); } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_run_length_packing* self = (grib_accessor_data_run_length_packing*)a; +int grib_accessor_class_data_run_length_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_run_length_packing_t* self = (grib_accessor_data_run_length_packing_t*)a; grib_handle* gh = grib_handle_of_accessor(a); const char* cclass_name = a->cclass->name; int err = GRIB_SUCCESS; @@ -204,8 +98,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) } compressed_values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * number_of_compressed_values); buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; - offsetBeforeData = grib_byte_offset(a); - buf += offsetBeforeData; + offsetBeforeData = a->byte_offset(); buf += offsetBeforeData; pos = 0; grib_decode_long_array(buf, &pos, bits_per_value, number_of_compressed_values, compressed_values); j = 0; @@ -246,9 +139,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return err; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_run_length_packing* self = (grib_accessor_data_run_length_packing*)a; +int grib_accessor_class_data_run_length_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_run_length_packing_t* self = (grib_accessor_data_run_length_packing_t*)a; grib_handle* gh = grib_handle_of_accessor(a); const char* cclass_name = a->cclass->name; int err = GRIB_SUCCESS; diff --git a/src/accessor/grib_accessor_class_data_run_length_packing.h b/src/accessor/grib_accessor_class_data_run_length_packing.h new file mode 100644 index 000000000..5a69a7ba0 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_run_length_packing.h @@ -0,0 +1,36 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_values.h" + +class grib_accessor_data_run_length_packing_t : public grib_accessor_values_t +{ +public: + /* Members defined in data_run_length_packing */ + const char* number_of_values; + const char* bits_per_value; + const char* max_level_value; + const char* number_of_level_values; + const char* decimal_scale_factor; + const char* level_values; +}; + +class grib_accessor_class_data_run_length_packing_t : public grib_accessor_class_values_t +{ +public: + grib_accessor_class_data_run_length_packing_t(const char* name) : grib_accessor_class_values_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_run_length_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_secondary_bitmap.cc b/src/accessor/grib_accessor_class_data_secondary_bitmap.cc new file mode 100644 index 000000000..f79098f84 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_secondary_bitmap.cc @@ -0,0 +1,118 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_secondary_bitmap.h" + +grib_accessor_class_data_secondary_bitmap_t _grib_accessor_class_data_secondary_bitmap{"data_secondary_bitmap"}; +grib_accessor_class* grib_accessor_class_data_secondary_bitmap = &_grib_accessor_class_data_secondary_bitmap; + + +void grib_accessor_class_data_secondary_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, v, args); + grib_accessor_data_secondary_bitmap_t* self = (grib_accessor_data_secondary_bitmap_t*)a; + self->primary_bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0); + self->secondary_bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, 1); + self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, 2); + self->expand_by = grib_arguments_get_name(grib_handle_of_accessor(a), args, 3); + + a->length = 0; +} + +void grib_accessor_class_data_secondary_bitmap_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_values(dumper, a); +} + +int grib_accessor_class_data_secondary_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_secondary_bitmap_t* self = (grib_accessor_data_secondary_bitmap_t*)a; + + size_t i = 0; + size_t j = 0; + size_t k = 0; + size_t m = 0; + size_t n_vals = 0; + long nn = 0; + long expand_by = 0; + int err = 0; + size_t primary_len; + size_t secondary_len; + double* primary_vals; + double* secondary_vals; + err = a->value_count(&nn); n_vals = nn; + if (err) + return err; + + if (*len < n_vals) { + *len = n_vals; + return GRIB_ARRAY_TOO_SMALL; + } + + if ((err = grib_get_long(grib_handle_of_accessor(a), self->expand_by, &expand_by)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_size(grib_handle_of_accessor(a), self->primary_bitmap, &primary_len)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_size(grib_handle_of_accessor(a), self->secondary_bitmap, &secondary_len)) != GRIB_SUCCESS) + return err; + + primary_vals = (double*)grib_context_malloc(a->context, primary_len * sizeof(double)); + if (!primary_vals) + return GRIB_OUT_OF_MEMORY; + + secondary_vals = (double*)grib_context_malloc(a->context, secondary_len * sizeof(double)); + if (!secondary_vals) { + grib_context_free(a->context, primary_vals); + return GRIB_OUT_OF_MEMORY; + } + + if ((err = grib_get_double_array_internal(grib_handle_of_accessor(a), self->primary_bitmap, primary_vals, &primary_len)) != GRIB_SUCCESS) { + grib_context_free(a->context, secondary_vals); + grib_context_free(a->context, primary_vals); + return err; + } + + if ((err = grib_get_double_array_internal(grib_handle_of_accessor(a), self->secondary_bitmap, secondary_vals, &secondary_len)) != GRIB_SUCCESS) { + grib_context_free(a->context, secondary_vals); + grib_context_free(a->context, primary_vals); + return err; + } + + k = 0; + m = 0; + for (i = 0; i < primary_len; i++) { + /* if(primary_vals[i]) f++; */ + if (primary_vals[i]) { + for (j = 0; j < expand_by; j++) + val[k++] = secondary_vals[m++]; + } + else { + for (j = 0; j < expand_by; j++) + val[k++] = 0; + } + } + + Assert(k <= *len); + Assert(m <= secondary_len); + + /*printf("FOOBAR %d %d %ld %d\n",f,primary_len,expand_by,n_vals);*/ + + *len = n_vals; + + grib_context_free(a->context, primary_vals); + grib_context_free(a->context, secondary_vals); + return err; +} + +int grib_accessor_class_data_secondary_bitmap_t::get_native_type(grib_accessor* a){ + // grib_accessor_data_secondary_bitmap_t* self = (grib_accessor_data_secondary_bitmap_t*)a; + //return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values)); + return GRIB_TYPE_DOUBLE; +} diff --git a/src/accessor/grib_accessor_class_data_secondary_bitmap.h b/src/accessor/grib_accessor_class_data_secondary_bitmap.h new file mode 100644 index 000000000..a24772be4 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_secondary_bitmap.h @@ -0,0 +1,34 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_data_secondary_bitmap_t : public grib_accessor_gen_t +{ +public: + /* Members defined in data_secondary_bitmap */ + const char* primary_bitmap; + const char* secondary_bitmap; + const char* missing_value; + const char* expand_by; +}; + +class grib_accessor_class_data_secondary_bitmap_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_data_secondary_bitmap_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_secondary_bitmap_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_data_sh_packed.cc b/src/accessor/grib_accessor_class_data_sh_packed.cc similarity index 63% rename from src/grib_accessor_class_data_sh_packed.cc rename to src/accessor/grib_accessor_class_data_sh_packed.cc index 25687d262..80bc7648f 100644 --- a/src/grib_accessor_class_data_sh_packed.cc +++ b/src/accessor/grib_accessor_class_data_sh_packed.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,142 +9,19 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ +#include "grib_accessor_class_data_sh_packed.h" #include "grib_scaling.h" -#include "grib_api_internal.h" -#include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = unpack_double - IMPLEMENTS = value_count - IMPLEMENTS = init - MEMBERS= const char* GRIBEX_sh_bug_present - MEMBERS= const char* ieee_floats - MEMBERS= const char* laplacianOperatorIsSet - MEMBERS= const char* laplacianOperator - MEMBERS= const char* sub_j - MEMBERS= const char* sub_k - MEMBERS= const char* sub_m - MEMBERS= const char* pen_j - MEMBERS= const char* pen_k - MEMBERS= const char* pen_m - END_CLASS_DEF - - */ - - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_sh_packed -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_sh_packed */ - const char* GRIBEX_sh_bug_present; - const char* ieee_floats; - const char* laplacianOperatorIsSet; - const char* laplacianOperator; - const char* sub_j; - const char* sub_k; - const char* sub_m; - const char* pen_j; - const char* pen_k; - const char* pen_m; -} grib_accessor_data_sh_packed; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_sh_packed = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_sh_packed", /* name */ - sizeof(grib_accessor_data_sh_packed), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_data_sh_packed_t _grib_accessor_class_data_sh_packed{"data_sh_packed"}; grib_accessor_class* grib_accessor_class_data_sh_packed = &_grib_accessor_class_data_sh_packed; -/* END_CLASS_IMP */ typedef unsigned long (*encode_float_proc)(double); typedef double (*decode_float_proc)(unsigned long); -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_sh_packed* self = (grib_accessor_data_sh_packed*)a; +void grib_accessor_class_data_sh_packed_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_sh_packed_t* self = (grib_accessor_data_sh_packed_t*)a; grib_handle* hand = grib_handle_of_accessor(a); self->GRIBEX_sh_bug_present = grib_arguments_get_name(hand, args, self->carg++); @@ -161,9 +39,8 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->length = 0; } -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_data_sh_packed* self = (grib_accessor_data_sh_packed*)a; +int grib_accessor_class_data_sh_packed_t::value_count(grib_accessor* a, long* count){ + grib_accessor_data_sh_packed_t* self = (grib_accessor_data_sh_packed_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int ret = 0; const char* cclass_name = a->cclass->name; @@ -198,9 +75,8 @@ static int value_count(grib_accessor* a, long* count) return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_sh_packed* self = (grib_accessor_data_sh_packed*)a; +int grib_accessor_class_data_sh_packed_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_sh_packed_t* self = (grib_accessor_data_sh_packed_t*)a; size_t i = 0; int ret = GRIB_SUCCESS; @@ -234,8 +110,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) decode_float_proc decode_float = NULL; n_vals = 0; - err = grib_value_count(a, &n_vals); - if (err) + err = a->value_count(&n_vals); if (err) return err; if (*len < n_vals) { diff --git a/src/accessor/grib_accessor_class_data_sh_packed.h b/src/accessor/grib_accessor_class_data_sh_packed.h new file mode 100644 index 000000000..bbe3caafe --- /dev/null +++ b/src/accessor/grib_accessor_class_data_sh_packed.h @@ -0,0 +1,39 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" + +class grib_accessor_data_sh_packed_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_sh_packed */ + const char* GRIBEX_sh_bug_present; + const char* ieee_floats; + const char* laplacianOperatorIsSet; + const char* laplacianOperator; + const char* sub_j; + const char* sub_k; + const char* sub_m; + const char* pen_j; + const char* pen_k; + const char* pen_m; +}; + +class grib_accessor_class_data_sh_packed_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_sh_packed_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_sh_packed_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_data_sh_unpacked.cc b/src/accessor/grib_accessor_class_data_sh_unpacked.cc similarity index 61% rename from src/grib_accessor_class_data_sh_unpacked.cc rename to src/accessor/grib_accessor_class_data_sh_unpacked.cc index 394793612..efa738c65 100644 --- a/src/grib_accessor_class_data_sh_unpacked.cc +++ b/src/accessor/grib_accessor_class_data_sh_unpacked.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,142 +9,19 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ +#include "grib_accessor_class_data_sh_unpacked.h" #include "grib_scaling.h" -#include "grib_api_internal.h" -#include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_simple_packing - IMPLEMENTS = unpack_double - IMPLEMENTS = value_count - IMPLEMENTS = init - MEMBERS= const char* GRIBEX_sh_bug_present - MEMBERS= const char* ieee_floats - MEMBERS= const char* laplacianOperatorIsSet - MEMBERS= const char* laplacianOperator - MEMBERS= const char* sub_j - MEMBERS= const char* sub_k - MEMBERS= const char* sub_m - MEMBERS= const char* pen_j - MEMBERS= const char* pen_k - MEMBERS= const char* pen_m - END_CLASS_DEF - - */ - - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_sh_unpacked -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_sh_unpacked */ - const char* GRIBEX_sh_bug_present; - const char* ieee_floats; - const char* laplacianOperatorIsSet; - const char* laplacianOperator; - const char* sub_j; - const char* sub_k; - const char* sub_m; - const char* pen_j; - const char* pen_k; - const char* pen_m; -} grib_accessor_data_sh_unpacked; - -extern grib_accessor_class* grib_accessor_class_data_simple_packing; - -static grib_accessor_class _grib_accessor_class_data_sh_unpacked = { - &grib_accessor_class_data_simple_packing, /* super */ - "data_sh_unpacked", /* name */ - sizeof(grib_accessor_data_sh_unpacked), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_data_sh_unpacked_t _grib_accessor_class_data_sh_unpacked{"data_sh_unpacked"}; grib_accessor_class* grib_accessor_class_data_sh_unpacked = &_grib_accessor_class_data_sh_unpacked; -/* END_CLASS_IMP */ typedef unsigned long (*encode_float_proc)(double); typedef double (*decode_float_proc)(unsigned long); -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_sh_unpacked* self = (grib_accessor_data_sh_unpacked*)a; +void grib_accessor_class_data_sh_unpacked_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_data_simple_packing_t::init(a, v, args); + grib_accessor_data_sh_unpacked_t* self = (grib_accessor_data_sh_unpacked_t*)a; grib_handle* hand = grib_handle_of_accessor(a); self->GRIBEX_sh_bug_present = grib_arguments_get_name(hand, args, self->carg++); @@ -161,9 +39,8 @@ static void init(grib_accessor* a, const long v, grib_arguments* args) a->length = 0; } -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_data_sh_unpacked* self = (grib_accessor_data_sh_unpacked*)a; +int grib_accessor_class_data_sh_unpacked_t::value_count(grib_accessor* a, long* count){ + grib_accessor_data_sh_unpacked_t* self = (grib_accessor_data_sh_unpacked_t*)a; int ret = 0; long sub_j = 0; @@ -185,9 +62,8 @@ static int value_count(grib_accessor* a, long* count) return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_sh_unpacked* self = (grib_accessor_data_sh_unpacked*)a; +int grib_accessor_class_data_sh_unpacked_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_data_sh_unpacked_t* self = (grib_accessor_data_sh_unpacked_t*)a; size_t i = 0; int ret = GRIB_SUCCESS; @@ -234,8 +110,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) decode_float_proc decode_float = NULL; n_vals = 0; - err = grib_value_count(a, &n_vals); - if (err) + err = a->value_count(&n_vals); if (err) return err; if (*len < n_vals) { diff --git a/src/accessor/grib_accessor_class_data_sh_unpacked.h b/src/accessor/grib_accessor_class_data_sh_unpacked.h new file mode 100644 index 000000000..7907b8c68 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_sh_unpacked.h @@ -0,0 +1,39 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_data_simple_packing.h" + +class grib_accessor_data_sh_unpacked_t : public grib_accessor_data_simple_packing_t +{ +public: + /* Members defined in data_sh_unpacked */ + const char* GRIBEX_sh_bug_present; + const char* ieee_floats; + const char* laplacianOperatorIsSet; + const char* laplacianOperator; + const char* sub_j; + const char* sub_k; + const char* sub_m; + const char* pen_j; + const char* pen_k; + const char* pen_m; +}; + +class grib_accessor_class_data_sh_unpacked_t : public grib_accessor_class_data_simple_packing_t +{ +public: + grib_accessor_class_data_sh_unpacked_t(const char* name) : grib_accessor_class_data_simple_packing_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_sh_unpacked_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_data_shsimple_packing.cc b/src/accessor/grib_accessor_class_data_shsimple_packing.cc new file mode 100644 index 000000000..0de921d06 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_shsimple_packing.cc @@ -0,0 +1,60 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_data_shsimple_packing.h" + +grib_accessor_class_data_shsimple_packing_t _grib_accessor_class_data_shsimple_packing{"data_shsimple_packing"}; +grib_accessor_class* grib_accessor_class_data_shsimple_packing = &_grib_accessor_class_data_shsimple_packing; + + +void grib_accessor_class_data_shsimple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, v, args); + grib_accessor_data_shsimple_packing_t* self = (grib_accessor_data_shsimple_packing_t*)a; + + self->coded_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0); + self->real_part = grib_arguments_get_name(grib_handle_of_accessor(a), args, 1); + a->flags |= GRIB_ACCESSOR_FLAG_DATA; + + a->length = 0; +} + +void grib_accessor_class_data_shsimple_packing_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_values(dumper, a); +} + +int grib_accessor_class_data_shsimple_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_data_shsimple_packing_t* self = (grib_accessor_data_shsimple_packing_t*)a; + int err = GRIB_SUCCESS; + + size_t coded_n_vals = *len - 1; + size_t n_vals = *len; + + self->dirty = 1; + + if (*len == 0) + return GRIB_NO_VALUES; + + if ((err = grib_set_double_internal(grib_handle_of_accessor(a), self->real_part, *val)) != GRIB_SUCCESS) + return err; + + val++; + + if ((err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->coded_values, val, coded_n_vals)) != GRIB_SUCCESS) + return err; + + *len = n_vals; + + return err; +} + +int grib_accessor_class_data_shsimple_packing_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_DOUBLE; +} diff --git a/src/accessor/grib_accessor_class_data_shsimple_packing.h b/src/accessor/grib_accessor_class_data_shsimple_packing.h new file mode 100644 index 000000000..7b1620141 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_shsimple_packing.h @@ -0,0 +1,33 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_data_shsimple_packing_t : public grib_accessor_gen_t +{ +public: + /* Members defined in data_shsimple_packing */ + const char* coded_values; + const char* real_part; + int dirty; +}; + +class grib_accessor_class_data_shsimple_packing_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_data_shsimple_packing_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_shsimple_packing_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_data_simple_packing.cc b/src/accessor/grib_accessor_class_data_simple_packing.cc similarity index 71% rename from src/grib_accessor_class_data_simple_packing.cc rename to src/accessor/grib_accessor_class_data_simple_packing.cc index e78bda53c..591e89526 100644 --- a/src/grib_accessor_class_data_simple_packing.cc +++ b/src/accessor/grib_accessor_class_data_simple_packing.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,148 +9,30 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_scaling.h" -#include "grib_bits_any_endian_simple.h" +#include "grib_accessor_class_data_simple_packing.h" #include "grib_optimize_decimal_factor.h" +#include "grib_bits_any_endian_simple.h" #include #include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_values - IMPLEMENTS = init - IMPLEMENTS = unpack_double;unpack_float - IMPLEMENTS = unpack_double_element;unpack_double_element_set - IMPLEMENTS = unpack_double_subarray - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - MEMBERS=int edition - MEMBERS=const char* units_factor - MEMBERS=const char* units_bias - MEMBERS=const char* changing_precision - MEMBERS=const char* number_of_values - MEMBERS=const char* bits_per_value - MEMBERS=const char* reference_value - MEMBERS=const char* binary_scale_factor - MEMBERS=const char* decimal_scale_factor - MEMBERS=const char* optimize_scaling_factor - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); -static int unpack_double_subarray(grib_accessor*, double* val, size_t start, size_t len); - -typedef struct grib_accessor_data_simple_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; -} grib_accessor_data_simple_packing; - -extern grib_accessor_class* grib_accessor_class_values; - -static grib_accessor_class _grib_accessor_class_data_simple_packing = { - &grib_accessor_class_values, /* super */ - "data_simple_packing", /* name */ - sizeof(grib_accessor_data_simple_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - &unpack_double_subarray, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - +grib_accessor_class_data_simple_packing_t _grib_accessor_class_data_simple_packing{ "data_simple_packing" }; grib_accessor_class* grib_accessor_class_data_simple_packing = &_grib_accessor_class_data_simple_packing; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long v, grib_arguments* args) +void grib_accessor_class_data_simple_packing_t::init(grib_accessor* a, const long v, grib_arguments* args) { - grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); - self->units_factor = grib_arguments_get_name(gh, args, self->carg++); - self->units_bias = grib_arguments_get_name(gh, args, self->carg++); - self->changing_precision = grib_arguments_get_name(gh, args, self->carg++); - self->number_of_values = grib_arguments_get_name(gh, args, self->carg++); - self->bits_per_value = grib_arguments_get_name(gh, args, self->carg++); - self->reference_value = grib_arguments_get_name(gh, args, self->carg++); - self->binary_scale_factor = grib_arguments_get_name(gh, args, self->carg++); - self->decimal_scale_factor = grib_arguments_get_name(gh, args, self->carg++); - self->optimize_scaling_factor = grib_arguments_get_name(gh, args, self->carg++); + grib_accessor_class_values_t::init(a, v, args); + grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)a; + grib_handle* gh = grib_handle_of_accessor(a); + self->units_factor = grib_arguments_get_name(gh, args, self->carg++); + self->units_bias = grib_arguments_get_name(gh, args, self->carg++); + self->changing_precision = grib_arguments_get_name(gh, args, self->carg++); + self->number_of_values = grib_arguments_get_name(gh, args, self->carg++); + self->bits_per_value = grib_arguments_get_name(gh, args, self->carg++); + self->reference_value = grib_arguments_get_name(gh, args, self->carg++); + self->binary_scale_factor = grib_arguments_get_name(gh, args, self->carg++); + self->decimal_scale_factor = grib_arguments_get_name(gh, args, self->carg++); + self->optimize_scaling_factor = grib_arguments_get_name(gh, args, self->carg++); a->flags |= GRIB_ACCESSOR_FLAG_DATA; self->dirty = 1; } @@ -178,21 +61,21 @@ static int number_of_bits(unsigned long x, long* result) return GRIB_SUCCESS; } -static int value_count(grib_accessor* a, long* number_of_values) +int grib_accessor_class_data_simple_packing_t::value_count(grib_accessor* a, long* number_of_values) { - grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a; - *number_of_values = 0; + grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)a; + *number_of_values = 0; return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, number_of_values); } -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) +int grib_accessor_class_data_simple_packing_t::unpack_double_element(grib_accessor* a, size_t idx, double* val) { - grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a; - const char* cclass_name = a->cclass->name; + grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)a; + const char* cclass_name = a->cclass->name; - long n_vals; - int err = 0; + long n_vals = 0; + int err = 0; grib_handle* gh = grib_handle_of_accessor(a); double reference_value; @@ -200,12 +83,11 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) long bits_per_value; long decimal_scale_factor; unsigned char* buf = (unsigned char*)gh->buffer->data; - double s = 0; - double d = 0; - long pos = 0; + double s = 0; + double d = 0; + long pos = 0; - n_vals = 0; - err = grib_value_count(a, &n_vals); + err = a->value_count(&n_vals); if (err) return err; @@ -237,8 +119,7 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) "%s: %s: creating %s, %ld values (idx=%zu)", cclass_name, __func__, a->name, n_vals, idx); - buf += grib_byte_offset(a); - + buf += a->byte_offset(); /*Assert(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */ if (bits_per_value % 8) { @@ -270,12 +151,12 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val) return err; } -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +int grib_accessor_class_data_simple_packing_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) { - int err = 0; + int err = 0; size_t i = 0; - for (i=0; i::value, "Requires floating point numbers"); - grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a; - const char* cclass_name = a->cclass->name; - grib_handle* gh = grib_handle_of_accessor(a); - unsigned char* buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; + grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)a; + const char* cclass_name = a->cclass->name; + grib_handle* gh = grib_handle_of_accessor(a); + unsigned char* buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; size_t i = 0; int err = 0; @@ -307,7 +188,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len) double units_factor = 1.0; double units_bias = 0.0; - err = grib_value_count(a, &count); + err = a->value_count(&count); if (err) return err; n_vals = count; @@ -369,7 +250,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len) grib_context_log(a->context, GRIB_LOG_DEBUG, "%s %s: Creating %s, %zu values", cclass_name, __func__, a->name, n_vals); - offsetBeforeData = grib_byte_offset(a); + offsetBeforeData = a->byte_offset(); buf += offsetBeforeData; /*Assert(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */ @@ -383,9 +264,9 @@ static int unpack(grib_accessor* a, T* val, size_t* len) const long valuesSize = (bits_per_value * n_vals) / 8; /*in bytes*/ if (offsetBeforeData + valuesSize > offsetAfterData) { grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Data section size mismatch: " - "offset before data=%ld, offset after data=%ld (num values=%zu, bits per value=%ld)", - cclass_name, offsetBeforeData, offsetAfterData, n_vals, bits_per_value); + "%s: Data section size mismatch: " + "offset before data=%ld, offset after data=%ld (num values=%zu, bits per value=%ld)", + cclass_name, offsetBeforeData, offsetAfterData, n_vals, bits_per_value); return GRIB_DECODING_ERROR; } } @@ -410,7 +291,8 @@ static int unpack(grib_accessor* a, T* val, size_t* len) for (i = 0; i < n_vals; i++) { val[i] = val[i] * units_factor + units_bias; } - } else { + } + else { for (i = 0; i < n_vals; i++) { val[i] *= units_factor; } @@ -424,21 +306,21 @@ static int unpack(grib_accessor* a, T* val, size_t* len) return err; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_data_simple_packing_t::unpack_double(grib_accessor* a, double* val, size_t* len) { return unpack(a, val, len); } -static int unpack_float(grib_accessor* a, float* val, size_t* len) +int grib_accessor_class_data_simple_packing_t::unpack_float(grib_accessor* a, float* val, size_t* len) { return unpack(a, val, len); } static int _unpack_double(grib_accessor* a, double* val, size_t* len, unsigned char* buf, long pos, size_t n_vals) { - grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); - const char* cclass_name = a->cclass->name; + grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)a; + grib_handle* gh = grib_handle_of_accessor(a); + const char* cclass_name = a->cclass->name; size_t i = 0; int err = 0; @@ -510,7 +392,7 @@ static int _unpack_double(grib_accessor* a, double* val, size_t* len, unsigned c grib_context_log(a->context, GRIB_LOG_DEBUG, "%s %s: Creating %s, %zu values", cclass_name, __func__, a->name, n_vals); - offsetBeforeData = grib_byte_offset(a); + offsetBeforeData = a->byte_offset(); buf += offsetBeforeData; /*Assert(((bits_per_value*n_vals)/8) < (1<<29));*/ /* See GRIB-787 */ @@ -561,15 +443,16 @@ static int _unpack_double(grib_accessor* a, double* val, size_t* len, unsigned c return err; } -static int unpack_double_subarray(grib_accessor* a, double* val, size_t start, size_t len) +int grib_accessor_class_data_simple_packing_t::unpack_double_subarray(grib_accessor* a, double* val, size_t start, size_t len) { - grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a; - unsigned char* buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; - size_t nvals = len; - size_t* plen = &len; - long bits_per_value = 0; - long pos; - int err; + grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)a; + + unsigned char* buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; + size_t nvals = len; + size_t* plen = &len; + long bits_per_value = 0; + long pos = 0; + int err = GRIB_SUCCESS; if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) @@ -580,15 +463,15 @@ static int unpack_double_subarray(grib_accessor* a, double* val, size_t start, s return _unpack_double(a, val, plen, buf, pos, nvals); } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_data_simple_packing_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_data_simple_packing* self = (grib_accessor_data_simple_packing*)a; - grib_handle* gh = grib_handle_of_accessor(a); - const char* cclass_name = a->cclass->name; + grib_accessor_data_simple_packing_t* self = (grib_accessor_data_simple_packing_t*)a; + grib_handle* gh = grib_handle_of_accessor(a); + const char* cclass_name = a->cclass->name; - size_t i = 0; - size_t n_vals = *len; - int err = 0; + size_t i = 0; + size_t n_vals = *len; + int err = 0; double reference_value = 0; long binary_scale_factor = 0; long bits_per_value = 0; @@ -633,8 +516,10 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) max = val[0]; min = max; for (i = 1; i < n_vals; i++) { - if (val[i] > max) max = val[i]; - else if (val[i] < min) min = val[i]; + if (val[i] > max) + max = val[i]; + else if (val[i] < min) + min = val[i]; } if ((err = grib_check_data_values_minmax(gh, min, max)) != GRIB_SUCCESS) { @@ -733,7 +618,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) /* divisor=1; */ } else { - int last = 127; /* 'last' should be a parameter coming from a definitions file */ + int last = 127; /* 'last' should be a parameter coming from a definitions file */ if (c->gribex_mode_on && self->edition == 1) last = 99; /* bits_per_value is given and decimal_scale_factor and binary_scale_factor are calcualated */ diff --git a/src/accessor/grib_accessor_class_data_simple_packing.h b/src/accessor/grib_accessor_class_data_simple_packing.h new file mode 100644 index 000000000..3e50239a0 --- /dev/null +++ b/src/accessor/grib_accessor_class_data_simple_packing.h @@ -0,0 +1,45 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_values.h" +#include "grib_scaling.h" + +class grib_accessor_data_simple_packing_t : public grib_accessor_values_t +{ +public: + /* Members defined in data_simple_packing */ + int edition; + const char* units_factor; + const char* units_bias; + const char* changing_precision; + const char* number_of_values; + const char* bits_per_value; + const char* reference_value; + const char* binary_scale_factor; + const char* decimal_scale_factor; + const char* optimize_scaling_factor; +}; + +class grib_accessor_class_data_simple_packing_t : public grib_accessor_class_values_t +{ +public: + grib_accessor_class_data_simple_packing_t(const char* name) : grib_accessor_class_values_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_data_simple_packing_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; + int unpack_double_subarray(grib_accessor*, double* val, size_t start, size_t len) override; +}; diff --git a/src/accessor/grib_accessor_class_decimal_precision.cc b/src/accessor/grib_accessor_class_decimal_precision.cc new file mode 100644 index 000000000..6149de763 --- /dev/null +++ b/src/accessor/grib_accessor_class_decimal_precision.cc @@ -0,0 +1,103 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_decimal_precision.h" + +grib_accessor_class_decimal_precision_t _grib_accessor_class_decimal_precision{"decimal_precision"}; +grib_accessor_class* grib_accessor_class_decimal_precision = &_grib_accessor_class_decimal_precision; + + +void grib_accessor_class_decimal_precision_t::init(grib_accessor* a, const long l, grib_arguments* args){ + grib_accessor_class_long_t::init(a, l, args); + int n = 0; + grib_accessor_decimal_precision_t* self = (grib_accessor_decimal_precision_t*)a; + + self->bits_per_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->decimal_scale_factor = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->changing_precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_decimal_precision_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + int ret = 0; + grib_accessor_decimal_precision_t* self = (grib_accessor_decimal_precision_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + + if ((ret = grib_get_long_internal(h, self->decimal_scale_factor, val)) != GRIB_SUCCESS) + return ret; + + *len = 1; + return ret; +} + +int grib_accessor_class_decimal_precision_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + long bitsPerValue = 0; + double* values = NULL; + size_t size = 0; + int ret = 0; + grib_accessor_decimal_precision_t* self = (grib_accessor_decimal_precision_t*)a; + grib_context* c = a->context; + grib_handle* h = grib_handle_of_accessor(a); + + if (!self->values) { + if ((ret = grib_set_long_internal(h, self->bits_per_value, 0)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_set_long_internal(h, self->decimal_scale_factor, *val)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_set_long_internal(h, self->changing_precision, 1)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + return GRIB_SUCCESS; + } + + if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) + return ret; + + values = (double*)grib_context_malloc(c, size * sizeof(double)); + if (!values) + return GRIB_OUT_OF_MEMORY; + + if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { + grib_context_buffer_free(c, values); + return ret; + } + + if ((ret = grib_set_long_internal(h, self->decimal_scale_factor, *val)) != GRIB_SUCCESS) { + grib_context_buffer_free(c, values); + return ret; + } + + if ((ret = grib_set_long_internal(h, self->bits_per_value, bitsPerValue)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + if ((ret = grib_set_long_internal(h, self->changing_precision, 1)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { + grib_context_buffer_free(c, values); + return ret; + } + + grib_context_free(c, values); + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_decimal_precision.h b/src/accessor/grib_accessor_class_decimal_precision.h new file mode 100644 index 000000000..a6b6d4839 --- /dev/null +++ b/src/accessor/grib_accessor_class_decimal_precision.h @@ -0,0 +1,33 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_decimal_precision_t : public grib_accessor_long_t +{ +public: + /* Members defined in decimal_precision */ + const char* values; + const char* bits_per_value; + const char* changing_precision; + const char* decimal_scale_factor; +}; + +class grib_accessor_class_decimal_precision_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_decimal_precision_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_decimal_precision_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_dictionary.cc b/src/accessor/grib_accessor_class_dictionary.cc similarity index 61% rename from src/grib_accessor_class_dictionary.cc rename to src/accessor/grib_accessor_class_dictionary.cc index dde22abdc..9a0b3307d 100644 --- a/src/grib_accessor_class_dictionary.cc +++ b/src/accessor/grib_accessor_class_dictionary.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,114 +9,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;dump;unpack_string;unpack_long;unpack_double - IMPLEMENTS = value_count; get_native_type; - MEMBERS = const char* dictionary - MEMBERS = const char* key - MEMBERS = long column - MEMBERS = const char* masterDir - MEMBERS = const char* localDir - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_dictionary -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in dictionary */ - const char* dictionary; - const char* key; - long column; - const char* masterDir; - const char* localDir; -} grib_accessor_dictionary; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_dictionary = { - &grib_accessor_class_gen, /* super */ - "dictionary", /* name */ - sizeof(grib_accessor_dictionary), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_dictionary.h" +grib_accessor_class_dictionary_t _grib_accessor_class_dictionary{"dictionary"}; grib_accessor_class* grib_accessor_class_dictionary = &_grib_accessor_class_dictionary; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long len, grib_arguments* params) -{ +void grib_accessor_class_dictionary_t::init(grib_accessor* a, const long len, grib_arguments* params){ + grib_accessor_class_gen_t::init(a, len, params); int n = 0; - grib_accessor_dictionary* self = (grib_accessor_dictionary*)a; + grib_accessor_dictionary_t* self = (grib_accessor_dictionary_t*)a; self->dictionary = grib_arguments_get_string(grib_handle_of_accessor(a), params, n++); self->key = grib_arguments_get_name(grib_handle_of_accessor(a), params, n++); @@ -129,7 +32,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* params) static grib_trie* load_dictionary(grib_accessor* a, int* err) { - grib_accessor_dictionary* self = (grib_accessor_dictionary*)a; + grib_accessor_dictionary_t* self = (grib_accessor_dictionary_t*)a; char* filename = NULL; char line[1024] = {0,}; @@ -243,8 +146,7 @@ static grib_trie* load_dictionary(grib_accessor* a, int* err) return dictionary; } -static void dump(grib_accessor* a, grib_dumper* dumper) -{ +void grib_accessor_class_dictionary_t::dump(grib_accessor* a, grib_dumper* dumper){ switch (get_native_type(a)) { case GRIB_TYPE_STRING: grib_dump_string(dumper, a, NULL); @@ -258,9 +160,8 @@ static void dump(grib_accessor* a, grib_dumper* dumper) } } -static int unpack_string(grib_accessor* a, char* buffer, size_t* len) -{ - grib_accessor_dictionary* self = (grib_accessor_dictionary*)a; +int grib_accessor_class_dictionary_t::unpack_string(grib_accessor* a, char* buffer, size_t* len){ + grib_accessor_dictionary_t* self = (grib_accessor_dictionary_t*)a; int err = GRIB_SUCCESS; char key[1024] = {0,}; size_t size = 1024; @@ -313,14 +214,12 @@ static int unpack_string(grib_accessor* a, char* buffer, size_t* len) return err; } -static int value_count(grib_accessor* a, long* count) -{ +int grib_accessor_class_dictionary_t::value_count(grib_accessor* a, long* count){ *count = 1; return 0; } -static int get_native_type(grib_accessor* a) -{ +int grib_accessor_class_dictionary_t::get_native_type(grib_accessor* a){ int type = GRIB_TYPE_DOUBLE; if (a->flags & GRIB_ACCESSOR_FLAG_LONG_TYPE) type = GRIB_TYPE_LONG; @@ -329,8 +228,7 @@ static int get_native_type(grib_accessor* a) return type; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ +int grib_accessor_class_dictionary_t::unpack_long(grib_accessor* a, long* val, size_t* len){ int err = 0; char buffer[1024] = {0,}; size_t size = 1024; @@ -345,8 +243,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ +int grib_accessor_class_dictionary_t::unpack_double(grib_accessor* a, double* val, size_t* len){ int err = 0; char buffer[1024] = {0,}; size_t size = 1024; diff --git a/src/accessor/grib_accessor_class_dictionary.h b/src/accessor/grib_accessor_class_dictionary.h new file mode 100644 index 000000000..8dc976e51 --- /dev/null +++ b/src/accessor/grib_accessor_class_dictionary.h @@ -0,0 +1,38 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_dictionary_t : public grib_accessor_gen_t +{ +public: + /* Members defined in dictionary */ + const char* dictionary; + const char* key; + long column; + const char* masterDir; + const char* localDir; +}; + +class grib_accessor_class_dictionary_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_dictionary_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_dictionary_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_dirty.cc b/src/accessor/grib_accessor_class_dirty.cc new file mode 100644 index 000000000..73f11c9d7 --- /dev/null +++ b/src/accessor/grib_accessor_class_dirty.cc @@ -0,0 +1,50 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_dirty.h" + +grib_accessor_class_dirty_t _grib_accessor_class_dirty{ "dirty" }; +grib_accessor_class* grib_accessor_class_dirty = &_grib_accessor_class_dirty; + + +void grib_accessor_class_dirty_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_dirty_t* self = (grib_accessor_dirty_t*)a; + self->accessor = grib_arguments_get_name(grib_handle_of_accessor(a), c, 0); + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; + a->length = 0; +} + +int grib_accessor_class_dirty_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + grib_accessor_dirty_t* self = (grib_accessor_dirty_t*)a; + grib_accessor* x = grib_find_accessor(grib_handle_of_accessor(a), self->accessor); + + if (x) + x->dirty = *val; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_dirty_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_dirty_t* self = (grib_accessor_dirty_t*)a; + grib_accessor* x = grib_find_accessor(grib_handle_of_accessor(a), self->accessor); + + if (x) + x->dirty = 1; + + *val = 1; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_dirty.h b/src/accessor/grib_accessor_class_dirty.h new file mode 100644 index 000000000..b024b69f7 --- /dev/null +++ b/src/accessor/grib_accessor_class_dirty.h @@ -0,0 +1,30 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_dirty_t : public grib_accessor_long_t +{ +public: + /* Members defined in dirty */ + const char* accessor; +}; + +class grib_accessor_class_dirty_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_dirty_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_dirty_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_divdouble.cc b/src/accessor/grib_accessor_class_divdouble.cc new file mode 100644 index 000000000..a652752fa --- /dev/null +++ b/src/accessor/grib_accessor_class_divdouble.cc @@ -0,0 +1,43 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_divdouble.h" + +grib_accessor_class_divdouble_t _grib_accessor_class_divdouble{"divdouble"}; +grib_accessor_class* grib_accessor_class_divdouble = &_grib_accessor_class_divdouble; + + +void grib_accessor_class_divdouble_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_divdouble_t* self = (grib_accessor_divdouble_t*)a; + int n = 0; + + self->val = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->divisor = grib_arguments_get_double(grib_handle_of_accessor(a), c, n++); +} + +int grib_accessor_class_divdouble_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + const grib_accessor_divdouble_t* self = (grib_accessor_divdouble_t*)a; + int ret = GRIB_SUCCESS; + double value = 0; + + ret = grib_get_double_internal(grib_handle_of_accessor(a), self->val, &value); + if (ret != GRIB_SUCCESS) + return ret; + + if (self->divisor == 0) { + return GRIB_INVALID_ARGUMENT; + } + *val = value / self->divisor; + + *len = 1; + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_divdouble.h b/src/accessor/grib_accessor_class_divdouble.h new file mode 100644 index 000000000..9408b073a --- /dev/null +++ b/src/accessor/grib_accessor_class_divdouble.h @@ -0,0 +1,30 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_divdouble_t : public grib_accessor_double_t +{ +public: + /* Members defined in divdouble */ + const char* val; + double divisor; +}; + +class grib_accessor_class_divdouble_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_divdouble_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_divdouble_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_double.cc b/src/accessor/grib_accessor_class_double.cc new file mode 100644 index 000000000..a0e3a49b5 --- /dev/null +++ b/src/accessor/grib_accessor_class_double.cc @@ -0,0 +1,105 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_double.h" + +grib_accessor_class_double_t _grib_accessor_class_double{"double"}; +grib_accessor_class* grib_accessor_class_double = &_grib_accessor_class_double; + + +int grib_accessor_class_double_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_DOUBLE; +} + +int grib_accessor_class_double_t::unpack_string(grib_accessor* a, char* v, size_t* len){ + double val = 0; + size_t l = 1; + char repres[1024]; + char format[32] = "%g"; + grib_handle* h = grib_handle_of_accessor(a); + const char* cclass_name = a->cclass->name; + + a->unpack_double(&val, &l); + if ((val == GRIB_MISSING_DOUBLE) && ((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0)) { + snprintf(repres, sizeof(repres), "MISSING"); + } else { + size_t size = sizeof(format); + grib_get_string(h, "formatForDoubles", format, &size); + snprintf(repres, sizeof(repres), format, val); + } + + l = strlen(repres) + 1; + + if (l > *len) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, l, *len); + *len = l; + return GRIB_BUFFER_TOO_SMALL; + } + grib_context_log(a->context, GRIB_LOG_DEBUG, "grib_accessor_long: Casting double %s to string ", a->name); + + *len = l; + + strcpy(v, repres); + return GRIB_SUCCESS; +} + +void grib_accessor_class_double_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_values(dumper, a); +} + +int grib_accessor_class_double_t::compare(grib_accessor* a, grib_accessor* b){ + int retval = 0; + double* aval = 0; + double* bval = 0; + + size_t alen = 0; + size_t blen = 0; + long count = 0; + int err = 0; + + err = a->value_count(&count); if (err) + return err; + alen = count; + + err = b->value_count(&count); if (err) + return err; + blen = count; + + if (alen != blen) + return GRIB_COUNT_MISMATCH; + + aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); + bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); + + a->unpack_double(aval, &alen); b->unpack_double(bval, &blen); + retval = GRIB_SUCCESS; + while (alen != 0) { + if (*bval != *aval) + retval = GRIB_DOUBLE_VALUE_MISMATCH; + alen--; + } + + grib_context_free(a->context, aval); + grib_context_free(b->context, bval); + + return retval; +} + +int grib_accessor_class_double_t::pack_missing(grib_accessor* a){ + size_t len = 1; + double value = GRIB_MISSING_DOUBLE; + + if (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) + return a->pack_double(&value, &len); + return GRIB_VALUE_CANNOT_BE_MISSING; +} diff --git a/src/accessor/grib_accessor_class_double.h b/src/accessor/grib_accessor_class_double.h new file mode 100644 index 000000000..7ad9771c2 --- /dev/null +++ b/src/accessor/grib_accessor_class_double.h @@ -0,0 +1,27 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_double_t : public grib_accessor_gen_t {}; + +class grib_accessor_class_double_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_double_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_double_t{}; } + int get_native_type(grib_accessor*) override; + int pack_missing(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/grib_accessor_class_element.cc b/src/accessor/grib_accessor_class_element.cc similarity index 56% rename from src/grib_accessor_class_element.cc rename to src/accessor/grib_accessor_class_element.cc index 2041cd62d..3d150d79e 100644 --- a/src/grib_accessor_class_element.cc +++ b/src/accessor/grib_accessor_class_element.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,105 +9,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long; - IMPLEMENTS = unpack_double - IMPLEMENTS = init - MEMBERS=const char* array - MEMBERS=long element - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_element -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in element */ - const char* array; - long element; -} grib_accessor_element; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_element = { - &grib_accessor_class_long, /* super */ - "element", /* name */ - sizeof(grib_accessor_element), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_element.h" +grib_accessor_class_element_t _grib_accessor_class_element{"element"}; grib_accessor_class* grib_accessor_class_element = &_grib_accessor_class_element; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) +void grib_accessor_class_element_t::init(grib_accessor* a, const long l, grib_arguments* c) { - grib_accessor_element* self = (grib_accessor_element*)a; + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_element_t* self = (grib_accessor_element_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int n = 0; @@ -125,9 +37,9 @@ static int check_element_index(const char* func, const char* array_name, long in return GRIB_SUCCESS; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_element_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_element* self = (grib_accessor_element*)a; + grib_accessor_element_t* self = (grib_accessor_element_t*)a; int ret = 0; size_t size = 0; long* ar = NULL; @@ -168,9 +80,9 @@ the_end: return ret; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_element_t::pack_long(grib_accessor* a, const long* val, size_t* len) { - grib_accessor_element* self = (grib_accessor_element*)a; + grib_accessor_element_t* self = (grib_accessor_element_t*)a; int ret = 0; size_t size = 0; long* ar = NULL; @@ -216,9 +128,9 @@ the_end: return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_element_t::unpack_double(grib_accessor* a, double* val, size_t* len) { - grib_accessor_element* self = (grib_accessor_element*)a; + grib_accessor_element_t* self = (grib_accessor_element_t*)a; int ret = 0; size_t size = 0; double* ar = NULL; diff --git a/src/accessor/grib_accessor_class_element.h b/src/accessor/grib_accessor_class_element.h new file mode 100644 index 000000000..220b8ff84 --- /dev/null +++ b/src/accessor/grib_accessor_class_element.h @@ -0,0 +1,32 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_element_t : public grib_accessor_long_t +{ +public: + /* Members defined in element */ + const char* array; + long element; +}; + +class grib_accessor_class_element_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_element_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_element_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_evaluate.cc b/src/accessor/grib_accessor_class_evaluate.cc new file mode 100644 index 000000000..0312107a4 --- /dev/null +++ b/src/accessor/grib_accessor_class_evaluate.cc @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_evaluate.h" + +grib_accessor_class_evaluate_t _grib_accessor_class_evaluate{ "evaluate" }; +grib_accessor_class* grib_accessor_class_evaluate = &_grib_accessor_class_evaluate; + + +void grib_accessor_class_evaluate_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_evaluate_t* self = (grib_accessor_evaluate_t*)a; + self->arg = c; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_evaluate_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_evaluate_t* self = (grib_accessor_evaluate_t*)a; + grib_expression* e = grib_arguments_get_expression(grib_handle_of_accessor(a), self->arg, 0); + + int ret = grib_expression_evaluate_long(grib_handle_of_accessor(a), e, val); + *len = 1; + + return ret; +} diff --git a/src/accessor/grib_accessor_class_evaluate.h b/src/accessor/grib_accessor_class_evaluate.h new file mode 100644 index 000000000..0e40cf206 --- /dev/null +++ b/src/accessor/grib_accessor_class_evaluate.h @@ -0,0 +1,29 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_evaluate_t : public grib_accessor_long_t +{ +public: + /* Members defined in evaluate */ + grib_arguments* arg; +}; + +class grib_accessor_class_evaluate_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_evaluate_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_evaluate_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_expanded_descriptors.cc b/src/accessor/grib_accessor_class_expanded_descriptors.cc similarity index 80% rename from src/grib_accessor_class_expanded_descriptors.cc rename to src/accessor/grib_accessor_class_expanded_descriptors.cc index 11f4ba73b..b30e745a9 100644 --- a/src/grib_accessor_class_expanded_descriptors.cc +++ b/src/accessor/grib_accessor_class_expanded_descriptors.cc @@ -1,137 +1,20 @@ + /* -* (C) Copyright 2005- ECMWF. -* -* This software is licensed under the terms of the Apache Licence Version 2.0 -* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -* -* 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. -*/ - -/* Sequences and replication (not delayed) are resolved in this class. - Number of elements to which a delayed replication applies are recomputed to - take account of the expansion. - Expanded descriptors cannot contain sequences and only delayed replication - can appear -*/ + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ +#include "grib_accessor_class_expanded_descriptors.h" #include "grib_scaling.h" -#include "grib_api_internal.h" -/* -This is used by make_class.pl - -START_CLASS_DEF -CLASS = accessor -SUPER = grib_accessor_class_long -IMPLEMENTS = unpack_long;pack_long -IMPLEMENTS = unpack_double -IMPLEMENTS = unpack_string_array -IMPLEMENTS = init;destroy -IMPLEMENTS = value_count; get_native_type -MEMBERS = const char* unexpandedDescriptors -MEMBERS = const char* sequence -MEMBERS = const char* expandedName -MEMBERS = const char* tablesAccessorName -MEMBERS = bufr_descriptors_array* expanded -MEMBERS = int rank -MEMBERS = grib_accessor* expandedAccessor -MEMBERS = int do_expand -MEMBERS = grib_accessor* tablesAccessor - -END_CLASS_DEF - -*/ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string_array(grib_accessor*, char**, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_expanded_descriptors -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in expanded_descriptors */ - const char* unexpandedDescriptors; - const char* sequence; - const char* expandedName; - const char* tablesAccessorName; - bufr_descriptors_array* expanded; - int rank; - grib_accessor* expandedAccessor; - int do_expand; - grib_accessor* tablesAccessor; -} grib_accessor_expanded_descriptors; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_expanded_descriptors = { - &grib_accessor_class_long, /* super */ - "expanded_descriptors", /* name */ - sizeof(grib_accessor_expanded_descriptors), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - &unpack_string_array, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_expanded_descriptors_t _grib_accessor_class_expanded_descriptors{"expanded_descriptors"}; grib_accessor_class* grib_accessor_class_expanded_descriptors = &_grib_accessor_class_expanded_descriptors; -/* END_CLASS_IMP */ #define MYDEBUG 0 #define DESC_SIZE_INIT 400 /* Initial size for grib_bufr_descriptors_array_new */ @@ -158,9 +41,10 @@ typedef struct change_coding_params result = grib_bufr_descriptors_array_pop_front(array); \ } -static void init(grib_accessor* a, const long len, grib_arguments* args) +void grib_accessor_class_expanded_descriptors_t::init(grib_accessor* a, const long len, grib_arguments* args) { - grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_class_long_t::init(a, len, args); + grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; int n = 0; grib_handle* hand = grib_handle_of_accessor(a); self->tablesAccessorName = grib_arguments_get_name(hand, args, n++); @@ -208,7 +92,7 @@ static char* descriptor_type_name(int dtype) static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_descriptors_array* expanded, change_coding_params* ccp, int* err) { int k, j, i; - grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; size_t size = 0; long* v_array = NULL; bufr_descriptor* u = NULL; @@ -583,7 +467,7 @@ static bufr_descriptors_array* do_expand(grib_accessor* a, bufr_descriptors_arra static int expand(grib_accessor* a) { - grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; int err = 0; size_t unexpandedSize = 0; /* grib_iarray* unexp=0; */ @@ -605,7 +489,7 @@ static int expand(grib_accessor* a) self->do_expand = 0; if (self->rank != 0) { err = expand(self->expandedAccessor); - self->expanded = ((grib_accessor_expanded_descriptors*)self->expandedAccessor)->expanded; + self->expanded = ((grib_accessor_expanded_descriptors_t*)self->expandedAccessor)->expanded; return err; } @@ -706,21 +590,21 @@ static int expand(grib_accessor* a) int grib_accessor_class_expanded_descriptors_set_do_expand(grib_accessor* a, long do_expand) { - grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; self->do_expand = do_expand; return 0; } bufr_descriptors_array* grib_accessor_class_expanded_descriptors_get_expanded(grib_accessor* a, int* err) { - const grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + const grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; *err = expand(a); return self->expanded; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_expanded_descriptors_t::unpack_double(grib_accessor* a, double* val, size_t* len) { - grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; int ret = 0; size_t i = 0; size_t expandedSize; @@ -753,9 +637,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_expanded_descriptors_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; int ret = 0; size_t rlen = 0; size_t i = 0; @@ -799,7 +683,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) +int grib_accessor_class_expanded_descriptors_t::unpack_string_array(grib_accessor* a, char** buffer, size_t* len) { int err = 0; long* v = NULL; @@ -808,13 +692,11 @@ static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) size_t i = 0, size = 0; const grib_context* c = a->context; - err = grib_value_count(a, &llen); - if (err) return err; + err = a->value_count(&llen); if (err) return err; size = llen; v = (long*)grib_context_malloc_clear(c, sizeof(long) * size); - err = grib_unpack_long(a, v, &size); - if (err) return err; + err = a->unpack_long(v, &size); if (err) return err; for (i = 0; i < size; i++) { snprintf(buf, sizeof(buf), "%06ld", v[i]); @@ -826,16 +708,16 @@ static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) return GRIB_NOT_IMPLEMENTED; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_expanded_descriptors_t::pack_long(grib_accessor* a, const long* val, size_t* len) { - grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; self->do_expand = 1; return GRIB_NOT_IMPLEMENTED; } -static int value_count(grib_accessor* a, long* rlen) +int grib_accessor_class_expanded_descriptors_t::value_count(grib_accessor* a, long* rlen) { - grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; int err = 0; *rlen = 0; @@ -849,16 +731,17 @@ static int value_count(grib_accessor* a, long* rlen) return err; } -static void destroy(grib_context* c, grib_accessor* a) +void grib_accessor_class_expanded_descriptors_t::destroy(grib_context* c, grib_accessor* a) { - // grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_class_long_t::destroy(c, a); + // grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; // if (self->rank==0 && self->expanded) // grib_bufr_descriptors_array_delete(self->expanded); } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_expanded_descriptors_t::get_native_type(grib_accessor* a) { - grib_accessor_expanded_descriptors* self = (grib_accessor_expanded_descriptors*)a; + grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a; if (self->rank == 2) return GRIB_TYPE_DOUBLE; else diff --git a/src/accessor/grib_accessor_class_expanded_descriptors.h b/src/accessor/grib_accessor_class_expanded_descriptors.h new file mode 100644 index 000000000..7e42ad28c --- /dev/null +++ b/src/accessor/grib_accessor_class_expanded_descriptors.h @@ -0,0 +1,43 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_expanded_descriptors_t : public grib_accessor_long_t +{ +public: + /* Members defined in expanded_descriptors */ + const char* unexpandedDescriptors; + const char* sequence; + const char* expandedName; + const char* tablesAccessorName; + bufr_descriptors_array* expanded; + int rank; + grib_accessor* expandedAccessor; + int do_expand; + grib_accessor* tablesAccessor; +}; + +class grib_accessor_class_expanded_descriptors_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_expanded_descriptors_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_expanded_descriptors_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string_array(grib_accessor*, char**, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_from_scale_factor_scaled_value.cc b/src/accessor/grib_accessor_class_from_scale_factor_scaled_value.cc similarity index 59% rename from src/grib_accessor_class_from_scale_factor_scaled_value.cc rename to src/accessor/grib_accessor_class_from_scale_factor_scaled_value.cc index 53784e172..4168e1476 100644 --- a/src/grib_accessor_class_from_scale_factor_scaled_value.cc +++ b/src/accessor/grib_accessor_class_from_scale_factor_scaled_value.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,111 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -#include -#ifdef ECCODES_ON_WINDOWS - #include -#endif - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double;pack_double;is_missing - IMPLEMENTS = value_count - IMPLEMENTS = init - MEMBERS=const char* scaleFactor - MEMBERS=const char* scaledValue - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int is_missing(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_from_scale_factor_scaled_value -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in from_scale_factor_scaled_value */ - const char* scaleFactor; - const char* scaledValue; -} grib_accessor_from_scale_factor_scaled_value; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_from_scale_factor_scaled_value = { - &grib_accessor_class_double, /* super */ - "from_scale_factor_scaled_value", /* name */ - sizeof(grib_accessor_from_scale_factor_scaled_value), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - &is_missing, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_from_scale_factor_scaled_value.h" +grib_accessor_class_from_scale_factor_scaled_value_t _grib_accessor_class_from_scale_factor_scaled_value{"from_scale_factor_scaled_value"}; grib_accessor_class* grib_accessor_class_from_scale_factor_scaled_value = &_grib_accessor_class_from_scale_factor_scaled_value; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; +void grib_accessor_class_from_scale_factor_scaled_value_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_from_scale_factor_scaled_value_t* self = (grib_accessor_from_scale_factor_scaled_value_t*)a; int n = 0; grib_handle* hand = grib_handle_of_accessor(a); @@ -123,11 +28,10 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) // a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ +int grib_accessor_class_from_scale_factor_scaled_value_t::pack_double(grib_accessor* a, const double* val, size_t* len){ // See ECC-979 and ECC-1416 // Evaluate self->scaleFactor and self->scaledValue from input double '*val' - grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; + grib_accessor_from_scale_factor_scaled_value_t* self = (grib_accessor_from_scale_factor_scaled_value_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int err = 0; int64_t factor = 0; @@ -181,9 +85,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; +int grib_accessor_class_from_scale_factor_scaled_value_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_from_scale_factor_scaled_value_t* self = (grib_accessor_from_scale_factor_scaled_value_t*)a; int err = 0; long scaleFactor = 0, scaledValue = 0; grib_handle* hand = grib_handle_of_accessor(a); @@ -257,9 +160,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return err; } -static int is_missing(grib_accessor* a) -{ - grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; +int grib_accessor_class_from_scale_factor_scaled_value_t::is_missing(grib_accessor* a){ + grib_accessor_from_scale_factor_scaled_value_t* self = (grib_accessor_from_scale_factor_scaled_value_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int err = 0; long scaleFactor = 0, scaledValue = 0; @@ -273,9 +175,8 @@ static int is_missing(grib_accessor* a) return ((scaleFactor == GRIB_MISSING_LONG) || (scaledValue == GRIB_MISSING_LONG)); } -static int value_count(grib_accessor* a, long* len) -{ - grib_accessor_from_scale_factor_scaled_value* self = (grib_accessor_from_scale_factor_scaled_value*)a; +int grib_accessor_class_from_scale_factor_scaled_value_t::value_count(grib_accessor* a, long* len){ + grib_accessor_from_scale_factor_scaled_value_t* self = (grib_accessor_from_scale_factor_scaled_value_t*)a; int err = 0; grib_handle* hand = grib_handle_of_accessor(a); size_t vsize; diff --git a/src/accessor/grib_accessor_class_from_scale_factor_scaled_value.h b/src/accessor/grib_accessor_class_from_scale_factor_scaled_value.h new file mode 100644 index 000000000..d8dc1bcb8 --- /dev/null +++ b/src/accessor/grib_accessor_class_from_scale_factor_scaled_value.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_from_scale_factor_scaled_value_t : public grib_accessor_double_t +{ +public: + /* Members defined in from_scale_factor_scaled_value */ + const char* scaleFactor; + const char* scaledValue; +}; + +class grib_accessor_class_from_scale_factor_scaled_value_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_from_scale_factor_scaled_value_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_from_scale_factor_scaled_value_t{}; } + int is_missing(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1_half_byte_codeflag.cc b/src/accessor/grib_accessor_class_g1_half_byte_codeflag.cc new file mode 100644 index 000000000..2f757addc --- /dev/null +++ b/src/accessor/grib_accessor_class_g1_half_byte_codeflag.cc @@ -0,0 +1,60 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1_half_byte_codeflag.h" + +grib_accessor_class_g1_half_byte_codeflag_t _grib_accessor_class_g1_half_byte_codeflag{"g1_half_byte_codeflag"}; +grib_accessor_class* grib_accessor_class_g1_half_byte_codeflag = &_grib_accessor_class_g1_half_byte_codeflag; + + +void grib_accessor_class_g1_half_byte_codeflag_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; +} + +void grib_accessor_class_g1_half_byte_codeflag_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_long(dumper, a, NULL); +} + +int grib_accessor_class_g1_half_byte_codeflag_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + unsigned char dat = 0; + if (*len < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + dat = grib_handle_of_accessor(a)->buffer->data[a->offset] & 0x0f; + + *val = dat; + *len = 1; + return GRIB_SUCCESS; +} + +int grib_accessor_class_g1_half_byte_codeflag_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + int ret = 0; + if (*len < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + /* printf("HALF BYTE pack long %ld %02x\n",*val,grib_handle_of_accessor(a)->buffer->data[a->offset]);*/ + grib_handle_of_accessor(a)->buffer->data[a->offset] = (a->parent->h->buffer->data[a->offset] & 0xf0) | (*val & 0x0f); + /* printf("HALF BYTE pack long %ld %02x\n",*val,grib_handle_of_accessor(a)->buffer->data[a->offset]);*/ + + *len = 1; + return ret; +} + +int grib_accessor_class_g1_half_byte_codeflag_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_g1_half_byte_codeflag.h b/src/accessor/grib_accessor_class_g1_half_byte_codeflag.h new file mode 100644 index 000000000..662a75569 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1_half_byte_codeflag.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_g1_half_byte_codeflag_t : public grib_accessor_gen_t +{ +public: + /* Members defined in g1_half_byte_codeflag */ +}; + +class grib_accessor_class_g1_half_byte_codeflag_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_g1_half_byte_codeflag_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1_half_byte_codeflag_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_g1_message_length.cc b/src/accessor/grib_accessor_class_g1_message_length.cc similarity index 53% rename from src/grib_accessor_class_g1_message_length.cc rename to src/accessor/grib_accessor_class_g1_message_length.cc index 1d38e7ea4..89ce742c5 100644 --- a/src/grib_accessor_class_g1_message_length.cc +++ b/src/accessor/grib_accessor_class_g1_message_length.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,104 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_section_length - IMPLEMENTS = init;unpack_long;pack_long - MEMBERS = const char *sec4_length - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1_message_length -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in section_length */ - /* Members defined in g1_message_length */ - const char *sec4_length; -} grib_accessor_g1_message_length; - -extern grib_accessor_class* grib_accessor_class_section_length; - -static grib_accessor_class _grib_accessor_class_g1_message_length = { - &grib_accessor_class_section_length, /* super */ - "g1_message_length", /* name */ - sizeof(grib_accessor_g1_message_length), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_g1_message_length.h" +grib_accessor_class_g1_message_length_t _grib_accessor_class_g1_message_length{"g1_message_length"}; grib_accessor_class* grib_accessor_class_g1_message_length = &_grib_accessor_class_g1_message_length; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_g1_message_length* self = (grib_accessor_g1_message_length*)a; +void grib_accessor_class_g1_message_length_t::init(grib_accessor* a, const long len, grib_arguments* args){ + grib_accessor_class_section_length_t::init(a, len, args); + grib_accessor_g1_message_length_t* self = (grib_accessor_g1_message_length_t*)a; self->sec4_length = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0); } @@ -148,9 +60,8 @@ int grib_get_g1_message_size(grib_handle* h, grib_accessor* tl, grib_accessor* s return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_g1_message_length* self = (grib_accessor_g1_message_length*)a; +int grib_accessor_class_g1_message_length_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_g1_message_length_t* self = (grib_accessor_g1_message_length_t*)a; /*grib_accessor_class* super = *(a->cclass->super);*/ /* Here we assume that the totalLength will be coded AFTER the section4 length, and @@ -182,7 +93,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) tlen = 0x800000 | t120; *len = 1; - if ((ret = grib_pack_long(s4, &slen, len)) != GRIB_SUCCESS) + if ((ret = s4->pack_long(&slen, len)) != GRIB_SUCCESS) return ret; *len = 1; @@ -211,9 +122,8 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g1_message_length* self = (grib_accessor_g1_message_length*)a; +int grib_accessor_class_g1_message_length_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_g1_message_length_t* self = (grib_accessor_g1_message_length_t*)a; int ret; long total_length, sec4_length; diff --git a/src/accessor/grib_accessor_class_g1_message_length.h b/src/accessor/grib_accessor_class_g1_message_length.h new file mode 100644 index 000000000..9a24e3213 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1_message_length.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_section_length.h" + +class grib_accessor_g1_message_length_t : public grib_accessor_section_length_t +{ +public: + /* Members defined in g1_message_length */ + const char *sec4_length; +}; + +class grib_accessor_class_g1_message_length_t : public grib_accessor_class_section_length_t +{ +public: + grib_accessor_class_g1_message_length_t(const char* name) : grib_accessor_class_section_length_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1_message_length_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1_section4_length.cc b/src/accessor/grib_accessor_class_g1_section4_length.cc new file mode 100644 index 000000000..8eea656b0 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1_section4_length.cc @@ -0,0 +1,53 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1_section4_length.h" + +grib_accessor_class_g1_section4_length_t _grib_accessor_class_g1_section4_length{"g1_section4_length"}; +grib_accessor_class* grib_accessor_class_g1_section4_length = &_grib_accessor_class_g1_section4_length; + + +void grib_accessor_class_g1_section4_length_t::init(grib_accessor* a, const long len, grib_arguments* args){ + grib_accessor_class_section_length_t::init(a, len, args); + grib_accessor_g1_section4_length_t* self = (grib_accessor_g1_section4_length_t*)a; + self->total_length = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0); +} + +int grib_accessor_class_g1_section4_length_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + // Old implementation: + // Here we assume that the totalLength will be coded AFTER the section4 length, and + // the section4 length will be overwritten by the totalLength accessor for large GRIBs + // grib_accessor_class* super = *(a->cclass->super); + // return super->pack_long(a,val,len); + + // Note: Do not directly call pack_long on base class + // because in this special case we want to skip the checks. + // So we call the helper function which has an extra argument + return pack_long_unsigned_helper(a, val, len, /*check=*/0); +} + +int grib_accessor_class_g1_section4_length_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_g1_section4_length_t* self = (grib_accessor_g1_section4_length_t*)a; + int ret = 0; + long total_length = 0, sec4_length = 0; + + if ((ret = grib_get_g1_message_size(grib_handle_of_accessor(a), + grib_find_accessor(grib_handle_of_accessor(a), self->total_length), + a, + &total_length, + &sec4_length)) != GRIB_SUCCESS) { + return ret; + } + + *val = sec4_length; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_g1_section4_length.h b/src/accessor/grib_accessor_class_g1_section4_length.h new file mode 100644 index 000000000..9e805985c --- /dev/null +++ b/src/accessor/grib_accessor_class_g1_section4_length.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_section_length.h" + +class grib_accessor_g1_section4_length_t : public grib_accessor_section_length_t +{ +public: + /* Members defined in g1_section4_length */ + const char* total_length; +}; + +class grib_accessor_class_g1_section4_length_t : public grib_accessor_class_section_length_t +{ +public: + grib_accessor_class_g1_section4_length_t(const char* name) : grib_accessor_class_section_length_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1_section4_length_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1bitmap.cc b/src/accessor/grib_accessor_class_g1bitmap.cc new file mode 100644 index 000000000..e8c0645ad --- /dev/null +++ b/src/accessor/grib_accessor_class_g1bitmap.cc @@ -0,0 +1,98 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1bitmap.h" +#include "shared_functions.h" + +grib_accessor_class_g1bitmap_t _grib_accessor_class_g1bitmap{"g1bitmap"}; +grib_accessor_class* grib_accessor_class_g1bitmap = &_grib_accessor_class_g1bitmap; + + +void grib_accessor_class_g1bitmap_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_bitmap_t::init(a, len, arg); + grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a; + self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 4); +} + +int grib_accessor_class_g1bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a; + size_t tlen; + + unsigned char* buf = NULL; + size_t i; + int err = 0; + long pos = 0; + //long bmaplen = 0; + const int bit_padding = 16; + double miss_values = 0; + tlen = ((*len + bit_padding - 1) / bit_padding * bit_padding) / 8; + + if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &miss_values)) != GRIB_SUCCESS) + return err; + + buf = (unsigned char*)grib_context_malloc_clear(a->context, tlen); + if (!buf) + return GRIB_OUT_OF_MEMORY; + pos = 0; + for (i = 0; i < *len; i++) { + if (val[i] == miss_values) + pos++; + else { + //bmaplen++; + grib_set_bit_on(buf, &pos); + } + } + + if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->unusedBits, tlen * 8 - *len)) != GRIB_SUCCESS) + return err; + + err = grib_buffer_replace(a, buf, tlen, 1, 1); + if (err) return err; + + grib_context_free(a->context, buf); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_g1bitmap_t::value_count(grib_accessor* a, long* count){ + grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a; + long tlen; + int err; + + if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &tlen)) != GRIB_SUCCESS) + grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_class_bitmap.value_count : cannot get %s err=%d", self->unusedBits, err); + + *count = (a->length * 8) - tlen; + return err; +} + +int grib_accessor_class_g1bitmap_t::unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len){ + unsigned char* buf = grib_handle_of_accessor(a)->buffer->data; + grib_accessor_g1bitmap_t* self = (grib_accessor_g1bitmap_t*)a; + long tlen; + int err; + long length = a->byte_count(); long offset = a->byte_offset(); + if (*len < (size_t)length) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it is %ld bytes long\n", a->name, length); + *len = length; + return GRIB_ARRAY_TOO_SMALL; + } + + if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &tlen)) != GRIB_SUCCESS) + grib_context_log(a->context, GRIB_LOG_ERROR, + "grib_accessor_class_bitmap.unpack_bytes : cannot get %s err=%d", self->unusedBits, err); + + length -= tlen / 8; + memcpy(val, buf + offset, length); + *len = length; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_g1bitmap.h b/src/accessor/grib_accessor_class_g1bitmap.h new file mode 100644 index 000000000..28914c591 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1bitmap.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_bitmap.h" + +class grib_accessor_g1bitmap_t : public grib_accessor_bitmap_t +{ +public: + /* Members defined in g1bitmap */ + const char* unusedBits; +}; + +class grib_accessor_class_g1bitmap_t : public grib_accessor_class_bitmap_t +{ +public: + grib_accessor_class_g1bitmap_t(const char* name) : grib_accessor_class_bitmap_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1bitmap_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_bytes(grib_accessor*, unsigned char*, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_g1date.cc b/src/accessor/grib_accessor_class_g1date.cc similarity index 50% rename from src/grib_accessor_class_g1date.cc rename to src/accessor/grib_accessor_class_g1date.cc index c53b3768a..64631a1ea 100644 --- a/src/grib_accessor_class_g1date.cc +++ b/src/accessor/grib_accessor_class_g1date.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,110 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long;unpack_string - IMPLEMENTS = init;value_count - MEMBERS=const char* century - MEMBERS=const char* year - MEMBERS=const char* month - MEMBERS=const char* day - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1date -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g1date */ - const char* century; - const char* year; - const char* month; - const char* day; -} grib_accessor_g1date; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g1date = { - &grib_accessor_class_long, /* super */ - "g1date", /* name */ - sizeof(grib_accessor_g1date), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_g1date.h" +grib_accessor_class_g1date_t _grib_accessor_class_g1date{"g1date"}; grib_accessor_class* grib_accessor_class_g1date = &_grib_accessor_class_g1date; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g1date* self = (grib_accessor_g1date*)a; +void grib_accessor_class_g1date_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_g1date_t* self = (grib_accessor_g1date_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int n = 0; @@ -121,9 +27,8 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->day = grib_arguments_get_name(hand, c, n++); } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g1date* self = (grib_accessor_g1date*)a; +int grib_accessor_class_g1date_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_g1date_t* self = (grib_accessor_g1date_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int ret = 0; @@ -154,9 +59,8 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_g1date* self = (grib_accessor_g1date*)a; +int grib_accessor_class_g1date_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_g1date_t* self = (grib_accessor_g1date_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int ret = 0; @@ -168,7 +72,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) long d = grib_julian_to_date(grib_date_to_julian(v)); if (v != d) { - grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_g1date: pack_long invalid date %ld, changed to %ld", v, d); + grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_g1date_t: pack_long invalid date %ld, changed to %ld", v, d); return GRIB_ENCODING_ERROR; } @@ -212,9 +116,8 @@ static const char* months[] = { "dec", }; -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_g1date* self = (grib_accessor_g1date*)a; +int grib_accessor_class_g1date_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_g1date_t* self = (grib_accessor_g1date_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int ret = 0; @@ -256,8 +159,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) return GRIB_SUCCESS; } -static int value_count(grib_accessor* a, long* count) -{ +int grib_accessor_class_g1date_t::value_count(grib_accessor* a, long* count){ *count = 1; return 0; } diff --git a/src/accessor/grib_accessor_class_g1date.h b/src/accessor/grib_accessor_class_g1date.h new file mode 100644 index 000000000..1195ac01c --- /dev/null +++ b/src/accessor/grib_accessor_class_g1date.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g1date_t : public grib_accessor_long_t +{ +public: + /* Members defined in g1date */ + const char* century; + const char* year; + const char* month; + const char* day; +}; + +class grib_accessor_class_g1date_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g1date_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1date_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1day_of_the_year_date.cc b/src/accessor/grib_accessor_class_g1day_of_the_year_date.cc new file mode 100644 index 000000000..83d23ea92 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1day_of_the_year_date.cc @@ -0,0 +1,60 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1day_of_the_year_date.h" + +grib_accessor_class_g1day_of_the_year_date_t _grib_accessor_class_g1day_of_the_year_date{"g1day_of_the_year_date"}; +grib_accessor_class* grib_accessor_class_g1day_of_the_year_date = &_grib_accessor_class_g1day_of_the_year_date; + + + +void grib_accessor_class_g1day_of_the_year_date_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_g1date_t::init(a, l, c); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +void grib_accessor_class_g1day_of_the_year_date_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_string(dumper, a, NULL); +} + +int grib_accessor_class_g1day_of_the_year_date_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + /* special clim case where each mont have 30 days.. to comply with mars*/ + grib_accessor_g1day_of_the_year_date_t* self = (grib_accessor_g1day_of_the_year_date_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + char tmp[1024]; + + long year = 0; + long century = 0; + long month = 0; + long day = 0; + long fullyear = 0; + long fake_day_of_year = 0; + + grib_get_long_internal(hand, self->century, ¢ury); + grib_get_long_internal(hand, self->day, &day); + grib_get_long_internal(hand, self->month, &month); + grib_get_long_internal(hand, self->year, &year); + + fullyear = ((century - 1) * 100 + year); + fake_day_of_year = ((month - 1) * 30) + day; + snprintf(tmp, sizeof(tmp), "%04ld-%03ld", fullyear, fake_day_of_year); + + size_t l = strlen(tmp) + 1; + if (*len < l) { + *len = l; + return GRIB_BUFFER_TOO_SMALL; + } + + *len = l; + strcpy(val, tmp); + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_g1day_of_the_year_date.h b/src/accessor/grib_accessor_class_g1day_of_the_year_date.h new file mode 100644 index 000000000..5e484686c --- /dev/null +++ b/src/accessor/grib_accessor_class_g1day_of_the_year_date.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_g1date.h" + +class grib_accessor_g1day_of_the_year_date_t : public grib_accessor_g1date_t +{ +public: + /* Members defined in g1day_of_the_year_date */ +}; + +class grib_accessor_class_g1day_of_the_year_date_t : public grib_accessor_class_g1date_t +{ +public: + grib_accessor_class_g1day_of_the_year_date_t(const char* name) : grib_accessor_class_g1date_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1day_of_the_year_date_t{}; } + int unpack_string(grib_accessor*, char*, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1end_of_interval_monthly.cc b/src/accessor/grib_accessor_class_g1end_of_interval_monthly.cc new file mode 100644 index 000000000..ea48fc6cb --- /dev/null +++ b/src/accessor/grib_accessor_class_g1end_of_interval_monthly.cc @@ -0,0 +1,136 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1end_of_interval_monthly.h" + +grib_accessor_class_g1end_of_interval_monthly_t _grib_accessor_class_g1end_of_interval_monthly{"g1end_of_interval_monthly"}; +grib_accessor_class* grib_accessor_class_g1end_of_interval_monthly = &_grib_accessor_class_g1end_of_interval_monthly; + + +void grib_accessor_class_g1end_of_interval_monthly_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_abstract_vector_t::init(a, l, c); + grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a; + int n = 0; + + self->verifyingMonth = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; + + self->number_of_elements = 6; + self->v = (double*)grib_context_malloc(a->context, sizeof(double) * self->number_of_elements); + + a->length = 0; + a->dirty = 1; +} + +int grib_accessor_class_g1end_of_interval_monthly_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a; + int ret = 0; + char verifyingMonth[7] = {0,}; + size_t slen = 7; + long year = 0, month = 0, date = 0; + const long mdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + long days = 0; + + if (!a->dirty) + return GRIB_SUCCESS; + + if (*len != (size_t)self->number_of_elements) + return GRIB_ARRAY_TOO_SMALL; + + if ((ret = grib_get_string(grib_handle_of_accessor(a), self->verifyingMonth, verifyingMonth, &slen)) != GRIB_SUCCESS) + return ret; + + date = atoi(verifyingMonth); + if (date < 0) { + return GRIB_INVALID_ARGUMENT; + } + year = date / 100; + month = date - year * 100; + if (month == 2) { + days = 28; + if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) + days = 29; + } + else { + if (month < 1 || month > 12) return GRIB_INVALID_ARGUMENT; + days = mdays[month - 1]; + } + self->v[0] = year; + self->v[1] = month; + + self->v[2] = days; + self->v[3] = 24; + self->v[4] = 00; + self->v[5] = 00; + + a->dirty = 0; + + val[0] = self->v[0]; + val[1] = self->v[1]; + val[2] = self->v[2]; + val[3] = self->v[3]; + val[4] = self->v[4]; + val[5] = self->v[5]; + + return ret; +} + +int grib_accessor_class_g1end_of_interval_monthly_t::value_count(grib_accessor* a, long* count){ + grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a; + *count = self->number_of_elements; + return 0; +} + +void grib_accessor_class_g1end_of_interval_monthly_t::destroy(grib_context* c, grib_accessor* a){ + grib_accessor_g1end_of_interval_monthly_t* self = (grib_accessor_g1end_of_interval_monthly_t*)a; + grib_context_free(c, self->v); + grib_accessor_class_abstract_vector_t::destroy(c, a); +} + +int grib_accessor_class_g1end_of_interval_monthly_t::compare(grib_accessor* a, grib_accessor* b){ + int retval = GRIB_SUCCESS; + double* aval = 0; + double* bval = 0; + + long count = 0; + size_t alen = 0; + size_t blen = 0; + int err = 0; + + err = a->value_count(&count); if (err) + return err; + alen = count; + + err = b->value_count(&count); if (err) + return err; + blen = count; + + if (alen != blen) + return GRIB_COUNT_MISMATCH; + + aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); + bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); + + b->dirty = 1; + a->dirty = 1; + + err = a->unpack_double(aval, &alen); err = b->unpack_double(bval, &blen); + for(size_t i=0; icontext, aval); + grib_context_free(b->context, bval); + + return retval; +} diff --git a/src/accessor/grib_accessor_class_g1end_of_interval_monthly.h b/src/accessor/grib_accessor_class_g1end_of_interval_monthly.h new file mode 100644 index 000000000..baaea5320 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1end_of_interval_monthly.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_abstract_vector.h" + +class grib_accessor_g1end_of_interval_monthly_t : public grib_accessor_abstract_vector_t +{ +public: + /* Members defined in g1end_of_interval_monthly */ + const char* verifyingMonth; +}; + +class grib_accessor_class_g1end_of_interval_monthly_t : public grib_accessor_class_abstract_vector_t +{ +public: + grib_accessor_class_g1end_of_interval_monthly_t(const char* name) : grib_accessor_class_abstract_vector_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1end_of_interval_monthly_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1fcperiod.cc b/src/accessor/grib_accessor_class_g1fcperiod.cc new file mode 100644 index 000000000..fcf98d78d --- /dev/null +++ b/src/accessor/grib_accessor_class_g1fcperiod.cc @@ -0,0 +1,41 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1fcperiod.h" + +grib_accessor_class_g1fcperiod_t _grib_accessor_class_g1fcperiod{"g1fcperiod"}; +grib_accessor_class* grib_accessor_class_g1fcperiod = &_grib_accessor_class_g1fcperiod; + + +int grib_accessor_class_g1fcperiod_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + long start = 0, theEnd = 0; + char tmp[1024]; + const size_t tmpLen = sizeof(tmp); + int err = grib_g1_step_get_steps(a, &start, &theEnd); + size_t l = 0; + + if (err) + return err; + + snprintf(tmp, tmpLen, "%ld-%ld", start / 24, theEnd / 24); + /*printf("---- FCPERIOD %s [start:%g, end:%g]",tmp,start,end);*/ + + l = strlen(tmp) + 1; + if (*len < l) { + *len = l; + return GRIB_BUFFER_TOO_SMALL; + } + + *len = l; + strcpy(val, tmp); /* NOLINT: CWE-119 clang-analyzer-security.insecureAPI.strcpy */ + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_g1fcperiod.h b/src/accessor/grib_accessor_class_g1fcperiod.h new file mode 100644 index 000000000..1b5b8dc7e --- /dev/null +++ b/src/accessor/grib_accessor_class_g1fcperiod.h @@ -0,0 +1,28 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_g1step_range.h" + +class grib_accessor_g1fcperiod_t : public grib_accessor_g1step_range_t +{ +public: + /* Members defined in g1fcperiod */ +}; + +class grib_accessor_class_g1fcperiod_t : public grib_accessor_class_g1step_range_t +{ +public: + grib_accessor_class_g1fcperiod_t(const char* name) : grib_accessor_class_g1step_range_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1fcperiod_t{}; } + int unpack_string(grib_accessor*, char*, size_t* len) override; +}; diff --git a/src/grib_accessor_class_g1forecastmonth.cc b/src/accessor/grib_accessor_class_g1forecastmonth.cc similarity index 54% rename from src/grib_accessor_class_g1forecastmonth.cc rename to src/accessor/grib_accessor_class_g1forecastmonth.cc index e25db6930..7ec448cf6 100644 --- a/src/grib_accessor_class_g1forecastmonth.cc +++ b/src/accessor/grib_accessor_class_g1forecastmonth.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,113 +9,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init;dump - MEMBERS=const char* verification_yearmonth - MEMBERS=const char* base_date - MEMBERS=const char* day - MEMBERS=const char* hour - MEMBERS=const char* fcmonth - MEMBERS=const char* check - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1forecastmonth -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g1forecastmonth */ - const char* verification_yearmonth; - const char* base_date; - const char* day; - const char* hour; - const char* fcmonth; - const char* check; -} grib_accessor_g1forecastmonth; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g1forecastmonth = { - &grib_accessor_class_long, /* super */ - "g1forecastmonth", /* name */ - sizeof(grib_accessor_g1forecastmonth), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_g1forecastmonth.h" +grib_accessor_class_g1forecastmonth_t _grib_accessor_class_g1forecastmonth{ "g1forecastmonth" }; grib_accessor_class* grib_accessor_class_g1forecastmonth = &_grib_accessor_class_g1forecastmonth; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) +void grib_accessor_class_g1forecastmonth_t::init(grib_accessor* a, const long l, grib_arguments* c) { - grib_accessor_g1forecastmonth* self = (grib_accessor_g1forecastmonth*)a; + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_g1forecastmonth_t* self = (grib_accessor_g1forecastmonth_t*)a; grib_handle* h = grib_handle_of_accessor(a); int n = 0; const int count = grib_arguments_get_count(c); @@ -128,7 +32,7 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) } } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_g1forecastmonth_t::dump(grib_accessor* a, grib_dumper* dumper) { grib_dump_long(dumper, a, NULL); } @@ -136,11 +40,11 @@ static void dump(grib_accessor* a, grib_dumper* dumper) static int calculate_fcmonth(grib_accessor* a, long verification_yearmonth, long base_date, long day, long hour, long* result) { long base_yearmonth = 0; - long vyear = 0; - long vmonth = 0; - long byear = 0; - long bmonth = 0; - long fcmonth = 0; + long vyear = 0; + long vmonth = 0; + long byear = 0; + long bmonth = 0; + long fcmonth = 0; base_yearmonth = base_date / 100; @@ -167,10 +71,10 @@ static int unpack_long_edition2(grib_accessor* a, long* val, size_t* len) long forecastTime, indicatorOfUnitOfTimeRange; double jul_base, jul2, dstep; - if ((err = grib_get_long(h, "year", &year)) != GRIB_SUCCESS) return err; + if ((err = grib_get_long(h, "year", &year)) != GRIB_SUCCESS) return err; if ((err = grib_get_long(h, "month", &month)) != GRIB_SUCCESS) return err; - if ((err = grib_get_long(h, "day", &day)) != GRIB_SUCCESS) return err; - if ((err = grib_get_long(h, "hour", &hour)) != GRIB_SUCCESS) return err; + if ((err = grib_get_long(h, "day", &day)) != GRIB_SUCCESS) return err; + if ((err = grib_get_long(h, "hour", &hour)) != GRIB_SUCCESS) return err; if ((err = grib_get_long(h, "minute", &minute)) != GRIB_SUCCESS) return err; if ((err = grib_get_long(h, "second", &second)) != GRIB_SUCCESS) return err; @@ -190,30 +94,30 @@ static int unpack_long_edition2(grib_accessor* a, long* val, size_t* len) return err; dstep = (((double)forecastTime) * 3600) / 86400; /* as a fraction of a day */ - jul2 = jul_base + dstep; + jul2 = jul_base + dstep; if ((err = grib_julian_to_datetime(jul2, &year2, &month2, &day2, &hour2, &minute2, &second2)) != GRIB_SUCCESS) return err; - verification_yearmonth = year2*100 + month2; + verification_yearmonth = year2 * 100 + month2; if ((err = calculate_fcmonth(a, verification_yearmonth, dataDate, day, hour, val)) != GRIB_SUCCESS) return err; return GRIB_SUCCESS; } -static int unpack_long_edition1(grib_accessor* a, long* val, size_t* len) +int unpack_long_edition1(grib_accessor* a, long* val, size_t* len) { int err = 0; - grib_accessor_g1forecastmonth* self = (grib_accessor_g1forecastmonth*)a; + grib_accessor_g1forecastmonth_t* self = (grib_accessor_g1forecastmonth_t*)a; long verification_yearmonth = 0; long base_date = 0; long day = 0; long hour = 0; - long gribForecastMonth = 0; - long check = 0; - long fcmonth = 0; + long gribForecastMonth = 0; + long check = 0; + long fcmonth = 0; if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->verification_yearmonth, &verification_yearmonth)) != GRIB_SUCCESS) @@ -249,11 +153,11 @@ static int unpack_long_edition1(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_g1forecastmonth_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - int err = 0; + int err = 0; grib_handle* hand = grib_handle_of_accessor(a); - long edition = 0; + long edition = 0; if ((err = grib_get_long(hand, "edition", &edition)) != GRIB_SUCCESS) return err; @@ -267,8 +171,8 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) } /* TODO: Check for a valid date */ -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_g1forecastmonth_t::pack_long(grib_accessor* a, const long* val, size_t* len) { - grib_accessor_g1forecastmonth* self = (grib_accessor_g1forecastmonth*)a; + grib_accessor_g1forecastmonth_t* self = (grib_accessor_g1forecastmonth_t*)a; return grib_set_long_internal(grib_handle_of_accessor(a), self->fcmonth, *val); } diff --git a/src/accessor/grib_accessor_class_g1forecastmonth.h b/src/accessor/grib_accessor_class_g1forecastmonth.h new file mode 100644 index 000000000..cd3a6d5f6 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1forecastmonth.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g1forecastmonth_t : public grib_accessor_long_t +{ +public: + /* Members defined in g1forecastmonth */ + const char* verification_yearmonth; + const char* base_date; + const char* day; + const char* hour; + const char* fcmonth; + const char* check; +}; + +class grib_accessor_class_g1forecastmonth_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g1forecastmonth_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1forecastmonth_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1monthlydate.cc b/src/accessor/grib_accessor_class_g1monthlydate.cc new file mode 100644 index 000000000..420f96ef3 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1monthlydate.cc @@ -0,0 +1,41 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1monthlydate.h" + +grib_accessor_class_g1monthlydate_t _grib_accessor_class_g1monthlydate{"g1monthlydate"}; +grib_accessor_class* grib_accessor_class_g1monthlydate = &_grib_accessor_class_g1monthlydate; + + +void grib_accessor_class_g1monthlydate_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_g1monthlydate_t* self = (grib_accessor_g1monthlydate_t*)a; + int n = 0; + + self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_g1monthlydate_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_g1monthlydate_t* self = (grib_accessor_g1monthlydate_t*)a; + + long date = 0; + + grib_get_long_internal(grib_handle_of_accessor(a), self->date, &date); + + date /= 100; + date *= 100; + date += 1; + + *val = date; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_g1monthlydate.h b/src/accessor/grib_accessor_class_g1monthlydate.h new file mode 100644 index 000000000..8503fa0af --- /dev/null +++ b/src/accessor/grib_accessor_class_g1monthlydate.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g1monthlydate_t : public grib_accessor_long_t +{ +public: + /* Members defined in g1monthlydate */ + const char* date; +}; + +class grib_accessor_class_g1monthlydate_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g1monthlydate_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1monthlydate_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_complex.cc b/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_complex.cc new file mode 100644 index 000000000..9976ad812 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_complex.cc @@ -0,0 +1,81 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1number_of_coded_values_sh_complex.h" + +grib_accessor_class_g1number_of_coded_values_sh_complex_t _grib_accessor_class_g1number_of_coded_values_sh_complex{"g1number_of_coded_values_sh_complex"}; +grib_accessor_class* grib_accessor_class_g1number_of_coded_values_sh_complex = &_grib_accessor_class_g1number_of_coded_values_sh_complex; + + +void grib_accessor_class_g1number_of_coded_values_sh_complex_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + int n = 0; + grib_accessor_g1number_of_coded_values_sh_complex_t* self = (grib_accessor_g1number_of_coded_values_sh_complex_t*)a; + self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->JS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->KS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->MS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_g1number_of_coded_values_sh_complex_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + int ret = GRIB_SUCCESS; + long bpv = 0; + long offsetBeforeData = 0, offsetAfterData = 0, unusedBits = 0, numberOfValues; + long JS = 0, KS = 0, MS = 0, NS = 0; + + grib_accessor_g1number_of_coded_values_sh_complex_t* self = (grib_accessor_g1number_of_coded_values_sh_complex_t*)a; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitsPerValue, &bpv)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetBeforeData, &offsetBeforeData)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetAfterData, &offsetAfterData)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &unusedBits)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->JS, &JS)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->KS, &KS)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->MS, &MS)) != GRIB_SUCCESS) + return ret; + + if (JS != KS || KS != MS) + return GRIB_NOT_IMPLEMENTED; + + NS = (MS + 1) * (MS + 2); + + if (bpv != 0) { + DEBUG_ASSERT(offsetAfterData > offsetBeforeData); + *val = ((offsetAfterData - offsetBeforeData) * 8 - unusedBits + NS * (bpv - 32)) / bpv; + } + else { + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues, &numberOfValues)) != GRIB_SUCCESS) + return ret; + + *val = numberOfValues; + } + + return ret; +} diff --git a/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_complex.h b/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_complex.h new file mode 100644 index 000000000..97379631d --- /dev/null +++ b/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_complex.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g1number_of_coded_values_sh_complex_t : public grib_accessor_long_t +{ +public: + /* Members defined in g1number_of_coded_values_sh_complex */ + const char* numberOfValues; + const char* bitsPerValue; + const char* offsetBeforeData; + const char* offsetAfterData; + const char* unusedBits; + const char* JS; + const char* KS; + const char* MS; +}; + +class grib_accessor_class_g1number_of_coded_values_sh_complex_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g1number_of_coded_values_sh_complex_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1number_of_coded_values_sh_complex_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_simple.cc b/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_simple.cc new file mode 100644 index 000000000..802e6ceb7 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_simple.cc @@ -0,0 +1,62 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1number_of_coded_values_sh_simple.h" + +grib_accessor_class_g1number_of_coded_values_sh_simple_t _grib_accessor_class_g1number_of_coded_values_sh_simple{"g1number_of_coded_values_sh_simple"}; +grib_accessor_class* grib_accessor_class_g1number_of_coded_values_sh_simple = &_grib_accessor_class_g1number_of_coded_values_sh_simple; + + +void grib_accessor_class_g1number_of_coded_values_sh_simple_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + int n = 0; + grib_accessor_g1number_of_coded_values_sh_simple_t* self = (grib_accessor_g1number_of_coded_values_sh_simple_t*)a; + self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_g1number_of_coded_values_sh_simple_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + int ret = GRIB_SUCCESS; + long bpv = 0; + long offsetBeforeData = 0, offsetAfterData = 0, unusedBits = 0, numberOfValues; + + grib_accessor_g1number_of_coded_values_sh_simple_t* self = (grib_accessor_g1number_of_coded_values_sh_simple_t*)a; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitsPerValue, &bpv)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetBeforeData, &offsetBeforeData)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetAfterData, &offsetAfterData)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &unusedBits)) != GRIB_SUCCESS) + return ret; + + if (bpv != 0) { + DEBUG_ASSERT(offsetAfterData > offsetBeforeData); + *val = ((offsetAfterData - offsetBeforeData) * 8 - unusedBits) / bpv; + } + else { + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues, &numberOfValues)) != GRIB_SUCCESS) + return ret; + + *val = numberOfValues; + } + return ret; +} diff --git a/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_simple.h b/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_simple.h new file mode 100644 index 000000000..4dafe6b15 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1number_of_coded_values_sh_simple.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g1number_of_coded_values_sh_simple_t : public grib_accessor_long_t +{ +public: + /* Members defined in g1number_of_coded_values_sh_simple */ + const char* numberOfValues; + const char* bitsPerValue; + const char* offsetBeforeData; + const char* offsetAfterData; + const char* unusedBits; +}; + +class grib_accessor_class_g1number_of_coded_values_sh_simple_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g1number_of_coded_values_sh_simple_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1number_of_coded_values_sh_simple_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_g1step_range.cc b/src/accessor/grib_accessor_class_g1step_range.cc similarity index 78% rename from src/grib_accessor_class_g1step_range.cc rename to src/accessor/grib_accessor_class_g1step_range.cc index 46c7a3cc8..a2920a1cf 100644 --- a/src/grib_accessor_class_g1step_range.cc +++ b/src/accessor/grib_accessor_class_g1step_range.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,131 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/********************************************* - * Enrico Fucile - *******************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_abstract_long_vector - IMPLEMENTS = pack_string;unpack_string;value_count - IMPLEMENTS = pack_long;unpack_long;dump - IMPLEMENTS = get_native_type;string_length - IMPLEMENTS = init; destroy - MEMBERS = const char* p1 - MEMBERS = const char* p2 - MEMBERS = const char* timeRangeIndicator - MEMBERS = const char *unit - MEMBERS = const char *step_unit - MEMBERS = const char *stepType - MEMBERS = const char *patch_fp_precip - MEMBERS = int error_on_units - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1step_range -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in abstract_long_vector */ - long* v; - long pack_index; - int number_of_elements; - /* Members defined in g1step_range */ - const char* p1; - const char* p2; - const char* timeRangeIndicator; - const char *unit; - const char *step_unit; - const char *stepType; - const char *patch_fp_precip; - int error_on_units; -} grib_accessor_g1step_range; - -extern grib_accessor_class* grib_accessor_class_abstract_long_vector; - -static grib_accessor_class _grib_accessor_class_g1step_range = { - &grib_accessor_class_abstract_long_vector, /* super */ - "g1step_range", /* name */ - sizeof(grib_accessor_g1step_range), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_g1step_range.h" +grib_accessor_class_g1step_range_t _grib_accessor_class_g1step_range{"g1step_range"}; grib_accessor_class* grib_accessor_class_g1step_range = &_grib_accessor_class_g1step_range; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; +void grib_accessor_class_g1step_range_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_abstract_long_vector_t::init(a, l, c); + grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a; grib_handle* h = grib_handle_of_accessor(a); int n = 0; self->p1 = grib_arguments_get_name(h, c, n++); @@ -153,8 +38,7 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) a->length = 0; } -static void dump(grib_accessor* a, grib_dumper* dumper) -{ +void grib_accessor_class_g1step_range_t::dump(grib_accessor* a, grib_dumper* dumper){ grib_dump_string(dumper, a, NULL); } @@ -203,7 +87,7 @@ static const int u2s[] = { int grib_g1_step_get_steps(grib_accessor* a, long* start, long* theEnd) { - grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; + grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a; int err = 0; long p1 = 0, p2 = 0, unit = 0, timeRangeIndicator = 0, timeRangeIndicatorFromStepRange = 0; long step_unit = 1; @@ -298,9 +182,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) -{ - grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; +int grib_accessor_class_g1step_range_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a; char buf[100]; size_t size = 0; long start = 0, theEnd = 0; @@ -450,9 +333,8 @@ static int grib_g1_step_apply_units( return GRIB_WRONG_STEP; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; +int grib_accessor_class_g1step_range_t::pack_string(grib_accessor* a, const char* val, size_t* len){ + grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a; grib_handle* h = grib_handle_of_accessor(a); long timeRangeIndicator = 0, P1 = 0, P2 = 0; long start = 0, theEnd = -1, unit = 0, ounit = 0, step_unit = 1; @@ -631,25 +513,22 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) return 0; } -static int value_count(grib_accessor* a, long* count) -{ +int grib_accessor_class_g1step_range_t::value_count(grib_accessor* a, long* count){ *count = 1; return 0; } -static size_t string_length(grib_accessor* a) -{ +size_t grib_accessor_class_g1step_range_t::string_length(grib_accessor* a){ return 255; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ +int grib_accessor_class_g1step_range_t::pack_long(grib_accessor* a, const long* val, size_t* len){ char buff[256]; size_t bufflen = 100; char sval[100] = { 0 }; char* p = sval; size_t svallen = 100; - grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; + grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a; char stepType[20] = {0,}; size_t stepTypeLen = 20; long step_unit = 0; @@ -718,9 +597,8 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_INTERNAL_ERROR; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; +int grib_accessor_class_g1step_range_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a; char buff[100]; size_t bufflen = 100; long start, theEnd; @@ -749,13 +627,12 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return 0; } -static int get_native_type(grib_accessor* a) -{ +int grib_accessor_class_g1step_range_t::get_native_type(grib_accessor* a){ return GRIB_TYPE_STRING; } -static void destroy(grib_context* c, grib_accessor* a) -{ - grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; +void grib_accessor_class_g1step_range_t::destroy(grib_context* c, grib_accessor* a){ + grib_accessor_g1step_range_t* self = (grib_accessor_g1step_range_t*)a; grib_context_free(c, self->v); + grib_accessor_class_abstract_long_vector_t::destroy(c, a); } diff --git a/src/accessor/grib_accessor_class_g1step_range.h b/src/accessor/grib_accessor_class_g1step_range.h new file mode 100644 index 000000000..7ca19cb08 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1step_range.h @@ -0,0 +1,45 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_abstract_long_vector.h" + +class grib_accessor_g1step_range_t : public grib_accessor_abstract_long_vector_t +{ +public: + /* Members defined in g1step_range */ + const char* p1; + const char* p2; + const char* timeRangeIndicator; + const char *unit; + const char *step_unit; + const char *stepType; + const char *patch_fp_precip; + int error_on_units; +}; + +class grib_accessor_class_g1step_range_t : public grib_accessor_class_abstract_long_vector_t +{ +public: + grib_accessor_class_g1step_range_t(const char* name) : grib_accessor_class_abstract_long_vector_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1step_range_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g1verificationdate.cc b/src/accessor/grib_accessor_class_g1verificationdate.cc new file mode 100644 index 000000000..63a1f1356 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1verificationdate.cc @@ -0,0 +1,64 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g1verificationdate.h" + +grib_accessor_class_g1verificationdate_t _grib_accessor_class_g1verificationdate{"g1verificationdate"}; +grib_accessor_class* grib_accessor_class_g1verificationdate = &_grib_accessor_class_g1verificationdate; + + +void grib_accessor_class_g1verificationdate_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_g1verificationdate_t* self = (grib_accessor_g1verificationdate_t*)a; + int n = 0; + + self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->time = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->step = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_g1verificationdate_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_g1verificationdate_t* self = (grib_accessor_g1verificationdate_t*)a; + int ret = 0; + long date = 0; + long time = 0; + long cdate = 0; + long step = 0; + long vtime = 0; + long vdate = 0; + long vd = 0; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->date, &date)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->time, &time)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->step, &step)) != GRIB_SUCCESS) + return ret; + + time /= 100; + + cdate = (long)grib_date_to_julian(date); + vtime = cdate * 24 + time + step; + vd = vtime / 24; + vdate = grib_julian_to_date(vd); + + /* printf("\n********\n date %d, time %d, step %d, vdate: %d, cdate %d, vd %d\n********\n", date, time, step, vdate, cdate, vd); */ + + if (*len < 1) + return GRIB_ARRAY_TOO_SMALL; + + *val = vdate; + + /* fprintf(stdout,"\n********\n %d cdate %d vd %d\n********\n", vdate, cdate, step); */ + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_g1verificationdate.h b/src/accessor/grib_accessor_class_g1verificationdate.h new file mode 100644 index 000000000..0e0469926 --- /dev/null +++ b/src/accessor/grib_accessor_class_g1verificationdate.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g1verificationdate_t : public grib_accessor_long_t +{ +public: + /* Members defined in g1verificationdate */ + const char* date; + const char* time; + const char* step; +}; + +class grib_accessor_class_g1verificationdate_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g1verificationdate_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g1verificationdate_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g2_aerosol.cc b/src/accessor/grib_accessor_class_g2_aerosol.cc new file mode 100644 index 000000000..464563187 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2_aerosol.cc @@ -0,0 +1,114 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g2_aerosol.h" + +grib_accessor_class_g2_aerosol_t _grib_accessor_class_g2_aerosol{"g2_aerosol"}; +grib_accessor_class* grib_accessor_class_g2_aerosol = &_grib_accessor_class_g2_aerosol; + + +void grib_accessor_class_g2_aerosol_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_unsigned_t::init(a, l, c); + grib_accessor_g2_aerosol_t* self = (grib_accessor_g2_aerosol_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int n = 0; + + self->productDefinitionTemplateNumber = grib_arguments_get_name(hand, c, n++); + self->stepType = grib_arguments_get_name(hand, c, n++); + self->optical = grib_arguments_get_long(hand, c, n++); +} + +int grib_accessor_class_g2_aerosol_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_g2_aerosol_t* self = (grib_accessor_g2_aerosol_t*)a; + long productDefinitionTemplateNumber = 0; + grib_get_long(grib_handle_of_accessor(a), self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber); + + if (self->optical) + *val = grib2_is_PDTN_AerosolOptical(productDefinitionTemplateNumber); + else + *val = grib2_is_PDTN_Aerosol(productDefinitionTemplateNumber); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_g2_aerosol_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_g2_aerosol_t* self = (grib_accessor_g2_aerosol_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + long productDefinitionTemplateNumber = -1; + long productDefinitionTemplateNumberNew = -1; + /*long type=-1; + long stream=-1;*/ + long eps = -1; + char stepType[15] = {0,}; + size_t slen = 15; + /*int aerosol = *val;*/ + int isInstant = 0; + /*long derivedForecast=-1;*/ + int ret = 0; + + if (grib_get_long(hand, self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber) != GRIB_SUCCESS) + return GRIB_SUCCESS; + + /* + grib_get_long(hand, self->type,&type); + grib_get_long(hand, self->stream,&stream); + */ + ret = grib_get_string(hand, self->stepType, stepType, &slen); + Assert(ret == GRIB_SUCCESS); + + //eps = grib2_is_PDTN_EPS(productDefinitionTemplateNumber); + eps = grib_is_defined(hand, "perturbationNumber"); + + if (!strcmp(stepType, "instant")) + isInstant = 1; + + if (eps == 1) { + if (isInstant) { + productDefinitionTemplateNumberNew = 45; + } + else { + /*productDefinitionTemplateNumberNew = 47; PDT deprecated*/ + productDefinitionTemplateNumberNew = 85; + } + } + else { + if (isInstant) { + productDefinitionTemplateNumberNew = 48; /*44 is deprecated*/ + } + else { + productDefinitionTemplateNumberNew = 46; + } + } + + if (self->optical) { + /* Note: There is no interval based template for optical properties of aerosol! */ + if (eps) + productDefinitionTemplateNumberNew = 49; + else + productDefinitionTemplateNumberNew = 48; + if (!isInstant) { + grib_context_log(hand->context, GRIB_LOG_ERROR, + "The product definition templates for optical properties of aerosol are for a point-in-time only"); + } + } + + if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) { + grib_set_long(hand, self->productDefinitionTemplateNumber, productDefinitionTemplateNumberNew); + /*if (derivedForecast>=0) grib_set_long(hand, self->derivedForecast,derivedForecast);*/ + } + + return 0; +} + +int grib_accessor_class_g2_aerosol_t::value_count(grib_accessor* a, long* count){ + *count = 1; + return 0; +} diff --git a/src/accessor/grib_accessor_class_g2_aerosol.h b/src/accessor/grib_accessor_class_g2_aerosol.h new file mode 100644 index 000000000..9fbd0c79b --- /dev/null +++ b/src/accessor/grib_accessor_class_g2_aerosol.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_unsigned.h" + +class grib_accessor_g2_aerosol_t : public grib_accessor_unsigned_t +{ +public: + /* Members defined in g2_aerosol */ + const char* productDefinitionTemplateNumber; + const char* stepType; + int optical; +}; + +class grib_accessor_class_g2_aerosol_t : public grib_accessor_class_unsigned_t +{ +public: + grib_accessor_class_g2_aerosol_t(const char* name) : grib_accessor_class_unsigned_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2_aerosol_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_g2_chemical.cc b/src/accessor/grib_accessor_class_g2_chemical.cc similarity index 53% rename from src/grib_accessor_class_g2_chemical.cc rename to src/accessor/grib_accessor_class_g2_chemical.cc index 16d8e6f33..3d05886a5 100644 --- a/src/grib_accessor_class_g2_chemical.cc +++ b/src/accessor/grib_accessor_class_g2_chemical.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,109 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_unsigned - IMPLEMENTS = unpack_long;pack_long; value_count - IMPLEMENTS = init - MEMBERS=const char* productDefinitionTemplateNumber - MEMBERS=const char* stepType - MEMBERS=int chemical_type - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2_chemical -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in g2_chemical */ - const char* productDefinitionTemplateNumber; - const char* stepType; - int chemical_type; -} grib_accessor_g2_chemical; - -extern grib_accessor_class* grib_accessor_class_unsigned; - -static grib_accessor_class _grib_accessor_class_g2_chemical = { - &grib_accessor_class_unsigned, /* super */ - "g2_chemical", /* name */ - sizeof(grib_accessor_g2_chemical), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_g2_chemical.h" +grib_accessor_class_g2_chemical_t _grib_accessor_class_g2_chemical{"g2_chemical"}; grib_accessor_class* grib_accessor_class_g2_chemical = &_grib_accessor_class_g2_chemical; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g2_chemical* self = (grib_accessor_g2_chemical*)a; +void grib_accessor_class_g2_chemical_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_unsigned_t::init(a, l, c); + grib_accessor_g2_chemical_t* self = (grib_accessor_g2_chemical_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int n = 0; @@ -119,9 +26,8 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->chemical_type = grib_arguments_get_long(hand, c, n++); } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g2_chemical* self = (grib_accessor_g2_chemical*)a; +int grib_accessor_class_g2_chemical_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_g2_chemical_t* self = (grib_accessor_g2_chemical_t*)a; long productDefinitionTemplateNumber = 0; grib_get_long(grib_handle_of_accessor(a), self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber); @@ -141,9 +47,8 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_g2_chemical* self = (grib_accessor_g2_chemical*)a; +int grib_accessor_class_g2_chemical_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_g2_chemical_t* self = (grib_accessor_g2_chemical_t*)a; grib_handle* hand = grib_handle_of_accessor(a); long productDefinitionTemplateNumber = -1; long productDefinitionTemplateNumberNew = -1; @@ -214,8 +119,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return 0; } -static int value_count(grib_accessor* a, long* count) -{ +int grib_accessor_class_g2_chemical_t::value_count(grib_accessor* a, long* count){ *count = 1; return 0; } diff --git a/src/accessor/grib_accessor_class_g2_chemical.h b/src/accessor/grib_accessor_class_g2_chemical.h new file mode 100644 index 000000000..66bf945aa --- /dev/null +++ b/src/accessor/grib_accessor_class_g2_chemical.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_unsigned.h" + +class grib_accessor_g2_chemical_t : public grib_accessor_unsigned_t +{ +public: + /* Members defined in g2_chemical */ + const char* productDefinitionTemplateNumber; + const char* stepType; + int chemical_type; +}; + +class grib_accessor_class_g2_chemical_t : public grib_accessor_class_unsigned_t +{ +public: + grib_accessor_class_g2_chemical_t(const char* name) : grib_accessor_class_unsigned_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2_chemical_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_g2_eps.cc b/src/accessor/grib_accessor_class_g2_eps.cc similarity index 57% rename from src/grib_accessor_class_g2_eps.cc rename to src/accessor/grib_accessor_class_g2_eps.cc index fc202a572..6b6c42fd7 100644 --- a/src/grib_accessor_class_g2_eps.cc +++ b/src/accessor/grib_accessor_class_g2_eps.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,114 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_unsigned - IMPLEMENTS = unpack_long;pack_long; value_count - IMPLEMENTS = init - MEMBERS=const char* productDefinitionTemplateNumber - MEMBERS=const char* stream - MEMBERS=const char* type - MEMBERS=const char* stepType - MEMBERS=const char* derivedForecast - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2_eps -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in g2_eps */ - const char* productDefinitionTemplateNumber; - const char* stream; - const char* type; - const char* stepType; - const char* derivedForecast; -} grib_accessor_g2_eps; - -extern grib_accessor_class* grib_accessor_class_unsigned; - -static grib_accessor_class _grib_accessor_class_g2_eps = { - &grib_accessor_class_unsigned, /* super */ - "g2_eps", /* name */ - sizeof(grib_accessor_g2_eps), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_g2_eps.h" +grib_accessor_class_g2_eps_t _grib_accessor_class_g2_eps{"g2_eps"}; grib_accessor_class* grib_accessor_class_g2_eps = &_grib_accessor_class_g2_eps; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g2_eps* self = (grib_accessor_g2_eps*)a; +void grib_accessor_class_g2_eps_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_unsigned_t::init(a, l, c); + grib_accessor_g2_eps_t* self = (grib_accessor_g2_eps_t*)a; int n = 0; self->productDefinitionTemplateNumber = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); @@ -125,9 +27,8 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->derivedForecast = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g2_eps* self = (grib_accessor_g2_eps*)a; +int grib_accessor_class_g2_eps_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_g2_eps_t* self = (grib_accessor_g2_eps_t*)a; long productDefinitionTemplateNumber = 0; int err = 0; grib_handle* hand = grib_handle_of_accessor(a); @@ -145,9 +46,8 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_g2_eps* self = (grib_accessor_g2_eps*)a; +int grib_accessor_class_g2_eps_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_g2_eps_t* self = (grib_accessor_g2_eps_t*)a; grib_handle* hand = grib_handle_of_accessor(a); long productDefinitionTemplateNumber = -1; long productDefinitionTemplateNumberNew = -1; @@ -266,8 +166,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return 0; } -static int value_count(grib_accessor* a, long* count) -{ +int grib_accessor_class_g2_eps_t::value_count(grib_accessor* a, long* count){ *count = 1; return 0; } diff --git a/src/accessor/grib_accessor_class_g2_eps.h b/src/accessor/grib_accessor_class_g2_eps.h new file mode 100644 index 000000000..8453387fa --- /dev/null +++ b/src/accessor/grib_accessor_class_g2_eps.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_unsigned.h" + +class grib_accessor_g2_eps_t : public grib_accessor_unsigned_t +{ +public: + /* Members defined in g2_eps */ + const char* productDefinitionTemplateNumber; + const char* stream; + const char* type; + const char* stepType; + const char* derivedForecast; +}; + +class grib_accessor_class_g2_eps_t : public grib_accessor_class_unsigned_t +{ +public: + grib_accessor_class_g2_eps_t(const char* name) : grib_accessor_class_unsigned_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2_eps_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_g2_mars_labeling.cc b/src/accessor/grib_accessor_class_g2_mars_labeling.cc similarity index 72% rename from src/grib_accessor_class_g2_mars_labeling.cc rename to src/accessor/grib_accessor_class_g2_mars_labeling.cc index ad0647e30..b9059220f 100644 --- a/src/grib_accessor_class_g2_mars_labeling.cc +++ b/src/accessor/grib_accessor_class_g2_mars_labeling.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,131 +9,18 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long;pack_long; value_count - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = init; get_native_type - MEMBERS=int index - MEMBERS=const char* the_class - MEMBERS=const char* stream - MEMBERS=const char* type - MEMBERS=const char* expver - MEMBERS=const char* typeOfProcessedData - MEMBERS=const char* productDefinitionTemplateNumber - MEMBERS=const char* stepType - MEMBERS=const char* derivedForecast - MEMBERS=const char* typeOfGeneratingProcess - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2_mars_labeling -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in g2_mars_labeling */ - int index; - const char* the_class; - const char* stream; - const char* type; - const char* expver; - const char* typeOfProcessedData; - const char* productDefinitionTemplateNumber; - const char* stepType; - const char* derivedForecast; - const char* typeOfGeneratingProcess; -} grib_accessor_g2_mars_labeling; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_g2_mars_labeling = { - &grib_accessor_class_gen, /* super */ - "g2_mars_labeling", /* name */ - sizeof(grib_accessor_g2_mars_labeling), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_g2_mars_labeling.h" +grib_accessor_class_g2_mars_labeling_t _grib_accessor_class_g2_mars_labeling{ "g2_mars_labeling" }; grib_accessor_class* grib_accessor_class_g2_mars_labeling = &_grib_accessor_class_g2_mars_labeling; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) +void grib_accessor_class_g2_mars_labeling_t::init(grib_accessor* a, const long l, grib_arguments* c) { - grib_accessor_g2_mars_labeling* self = (grib_accessor_g2_mars_labeling*)a; - int n = 0; - grib_handle* hand = grib_handle_of_accessor(a); + grib_accessor_class_gen_t::init(a, l, c); + grib_accessor_g2_mars_labeling_t* self = (grib_accessor_g2_mars_labeling_t*)a; + int n = 0; + grib_handle* hand = grib_handle_of_accessor(a); self->index = grib_arguments_get_long(hand, c, n++); self->the_class = grib_arguments_get_name(hand, c, n++); @@ -146,10 +34,10 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->typeOfGeneratingProcess = grib_arguments_get_name(hand, c, n++); } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_g2_mars_labeling_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_g2_mars_labeling* self = (grib_accessor_g2_mars_labeling*)a; - char* key = NULL; + grib_accessor_g2_mars_labeling_t* self = (grib_accessor_g2_mars_labeling_t*)a; + char* key = NULL; switch (self->index) { case 0: @@ -170,10 +58,10 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return grib_get_long(grib_handle_of_accessor(a), key, val); } -static int unpack_string(grib_accessor* a, char* val, size_t* len) +int grib_accessor_class_g2_mars_labeling_t::unpack_string(grib_accessor* a, char* val, size_t* len) { - grib_accessor_g2_mars_labeling* self = (grib_accessor_g2_mars_labeling*)a; - char* key = NULL; + grib_accessor_g2_mars_labeling_t* self = (grib_accessor_g2_mars_labeling_t*)a; + char* key = NULL; switch (self->index) { case 0: @@ -196,10 +84,10 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) static int extra_set(grib_accessor* a, long val) { - int ret = 0; - grib_accessor_g2_mars_labeling* self = (grib_accessor_g2_mars_labeling*)a; - grib_handle* hand = grib_handle_of_accessor(a); - char stepType[30] = {0,}; + int ret = 0; + grib_accessor_g2_mars_labeling_t* self = (grib_accessor_g2_mars_labeling_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + char stepType[30] = {0,}; size_t stepTypelen = 30; long derivedForecast = -1; long productDefinitionTemplateNumberNew = -1; @@ -417,12 +305,12 @@ static int extra_set(grib_accessor* a, long val) return ret; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) +int grib_accessor_class_g2_mars_labeling_t::pack_string(grib_accessor* a, const char* val, size_t* len) { - grib_accessor_g2_mars_labeling* self = (grib_accessor_g2_mars_labeling*)a; - char* key = NULL; - int ret = 0; - long lval = 0; + grib_accessor_g2_mars_labeling_t* self = (grib_accessor_g2_mars_labeling_t*)a; + char* key = NULL; + int ret = 0; + long lval = 0; switch (self->index) { case 0: @@ -451,11 +339,11 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) return extra_set(a, lval); } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_g2_mars_labeling_t::pack_long(grib_accessor* a, const long* val, size_t* len) { - grib_accessor_g2_mars_labeling* self = (grib_accessor_g2_mars_labeling*)a; - char* key = NULL; - int ret = 0; + grib_accessor_g2_mars_labeling_t* self = (grib_accessor_g2_mars_labeling_t*)a; + char* key = NULL; + int ret = 0; switch (self->index) { case 0: @@ -480,18 +368,18 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return extra_set(a, *val); } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_g2_mars_labeling_t::value_count(grib_accessor* a, long* count) { *count = 1; return 0; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_g2_mars_labeling_t::get_native_type(grib_accessor* a) { - grib_accessor_g2_mars_labeling* self = (grib_accessor_g2_mars_labeling*)a; - char* key = NULL; - int ret = 0; - int type = 0; + grib_accessor_g2_mars_labeling_t* self = (grib_accessor_g2_mars_labeling_t*)a; + char* key = NULL; + int ret = 0; + int type = 0; switch (self->index) { case 0: diff --git a/src/accessor/grib_accessor_class_g2_mars_labeling.h b/src/accessor/grib_accessor_class_g2_mars_labeling.h new file mode 100644 index 000000000..d47848565 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2_mars_labeling.h @@ -0,0 +1,44 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_g2_mars_labeling_t : public grib_accessor_gen_t +{ +public: + /* Members defined in g2_mars_labeling */ + int index; + const char* the_class; + const char* stream; + const char* type; + const char* expver; + const char* typeOfProcessedData; + const char* productDefinitionTemplateNumber; + const char* stepType; + const char* derivedForecast; + const char* typeOfGeneratingProcess; +}; + +class grib_accessor_class_g2_mars_labeling_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_g2_mars_labeling_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2_mars_labeling_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g2bitmap.cc b/src/accessor/grib_accessor_class_g2bitmap.cc new file mode 100644 index 000000000..d5af880b3 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2bitmap.cc @@ -0,0 +1,75 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g2bitmap.h" +#include "shared_functions.h" + +grib_accessor_class_g2bitmap_t _grib_accessor_class_g2bitmap{"g2bitmap"}; +grib_accessor_class* grib_accessor_class_g2bitmap = &_grib_accessor_class_g2bitmap; + + +void grib_accessor_class_g2bitmap_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_bitmap_t::init(a, len, arg); + grib_accessor_g2bitmap_t* self = (grib_accessor_g2bitmap_t*)a; + + self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 4); +} + +int grib_accessor_class_g2bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_g2bitmap_t* self = (grib_accessor_g2bitmap_t*)a; + + size_t tlen; + + unsigned char* buf = NULL; + size_t i; + int err = 0; + long pos = 0; + // long bmaplen = 0; + double miss_values = 0; + tlen = (*len + 7) / 8; + + if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &miss_values)) != GRIB_SUCCESS) + return err; + + buf = (unsigned char*)grib_context_malloc_clear(a->context, tlen); + if (!buf) + return GRIB_OUT_OF_MEMORY; + pos = 0; + for (i = 0; i < *len; i++) { + if (val[i] == miss_values) + pos++; + else { + // bmaplen++; + grib_set_bit_on(buf, &pos); + } + } + + if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfValues, *len)) != GRIB_SUCCESS) { + grib_context_free(a->context, buf); + return err; + } + + grib_buffer_replace(a, buf, tlen, 1, 1); + + grib_context_free(a->context, buf); + + return GRIB_SUCCESS; +} + + +int grib_accessor_class_g2bitmap_t::value_count(grib_accessor* a, long* tlen){ + grib_accessor_g2bitmap_t* self = (grib_accessor_g2bitmap_t*)a; + int err; + *tlen = 0; + + err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues, tlen); + return err; +} diff --git a/src/accessor/grib_accessor_class_g2bitmap.h b/src/accessor/grib_accessor_class_g2bitmap.h new file mode 100644 index 000000000..2276b702c --- /dev/null +++ b/src/accessor/grib_accessor_class_g2bitmap.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_bitmap.h" + +class grib_accessor_g2bitmap_t : public grib_accessor_bitmap_t +{ +public: + /* Members defined in g2bitmap */ + const char* numberOfValues; +}; + +class grib_accessor_class_g2bitmap_t : public grib_accessor_class_bitmap_t +{ +public: + grib_accessor_class_g2bitmap_t(const char* name) : grib_accessor_class_bitmap_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2bitmap_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g2bitmap_present.cc b/src/accessor/grib_accessor_class_g2bitmap_present.cc new file mode 100644 index 000000000..1444783fe --- /dev/null +++ b/src/accessor/grib_accessor_class_g2bitmap_present.cc @@ -0,0 +1,59 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g2bitmap_present.h" + +grib_accessor_class_g2bitmap_present_t _grib_accessor_class_g2bitmap_present{"g2bitmap_present"}; +grib_accessor_class* grib_accessor_class_g2bitmap_present = &_grib_accessor_class_g2bitmap_present; + + +void grib_accessor_class_g2bitmap_present_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + int n = 0; + grib_accessor_g2bitmap_present_t* self = (grib_accessor_g2bitmap_present_t*)a; + self->bitmapIndicator = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + + a->length = 0; +} + +int grib_accessor_class_g2bitmap_present_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + int ret = GRIB_SUCCESS; + long bitmapIndicator = 0; + + grib_accessor_g2bitmap_present_t* self = (grib_accessor_g2bitmap_present_t*)a; + + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitmapIndicator, &bitmapIndicator); + if (ret) { + if (ret == GRIB_NOT_FOUND) { + *val = 0; + return 0; + } + else + return ret; + } + + *val = 1; + if (bitmapIndicator == 255) + *val = 0; + + *len = 1; + return ret; +} + +int grib_accessor_class_g2bitmap_present_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_g2bitmap_present_t* self = (grib_accessor_g2bitmap_present_t*)a; + long bitmapIndicator = 0; + + if (*val == 0) + bitmapIndicator = 255; + + return grib_set_long(grib_handle_of_accessor(a), self->bitmapIndicator, bitmapIndicator); +} diff --git a/src/accessor/grib_accessor_class_g2bitmap_present.h b/src/accessor/grib_accessor_class_g2bitmap_present.h new file mode 100644 index 000000000..87d603f54 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2bitmap_present.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g2bitmap_present_t : public grib_accessor_long_t +{ +public: + /* Members defined in g2bitmap_present */ + const char* bitmapIndicator; +}; + +class grib_accessor_class_g2bitmap_present_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g2bitmap_present_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2bitmap_present_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g2date.cc b/src/accessor/grib_accessor_class_g2date.cc new file mode 100644 index 000000000..238da76f7 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2date.cc @@ -0,0 +1,82 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g2date.h" + +grib_accessor_class_g2date_t _grib_accessor_class_g2date{"g2date"}; +grib_accessor_class* grib_accessor_class_g2date = &_grib_accessor_class_g2date; + +void grib_accessor_class_g2date_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_g2date_t* self = (grib_accessor_g2date_t*)a; + int n = 0; + + self->year = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->month = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->day = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); +} + +int grib_accessor_class_g2date_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + const grib_accessor_g2date_t* self = (grib_accessor_g2date_t*)a; + + int ret = 0; + long year = 0; + long month = 0; + long day = 0; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->day, &day)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->month, &month)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->year, &year)) != GRIB_SUCCESS) + return ret; + + if (*len < 1) + return GRIB_WRONG_ARRAY_SIZE; + + val[0] = year * 10000 + month * 100 + day; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_g2date_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + const grib_accessor_g2date_t* self = (grib_accessor_g2date_t*)a; + + int ret = GRIB_SUCCESS; + long v = val[0]; + long year = 0; + long month = 0; + long day = 0; + + if (*len != 1) + return GRIB_WRONG_ARRAY_SIZE; + + year = v / 10000; + v %= 10000; + month = v / 100; + v %= 100; + day = v; + + if (!is_date_valid(year, month, day, 0, 0, 0)) { + // ECC-1777: For now just a warning. Will later change to an error + fprintf(stderr, "ECCODES WARNING : %s:%s: Date is not valid! year=%ld month=%ld day=%ld\n", + a->cclass->name, __func__, year, month, day); + } + + if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->day, day)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->month, month)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->year, year)) != GRIB_SUCCESS) + return ret; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_g2date.h b/src/accessor/grib_accessor_class_g2date.h new file mode 100644 index 000000000..e6981665c --- /dev/null +++ b/src/accessor/grib_accessor_class_g2date.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g2date_t : public grib_accessor_long_t +{ +public: + /* Members defined in g2date */ + const char* century; + const char* year; + const char* month; + const char* day; +}; + +class grib_accessor_class_g2date_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g2date_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2date_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_g2end_step.cc b/src/accessor/grib_accessor_class_g2end_step.cc similarity index 67% rename from src/grib_accessor_class_g2end_step.cc rename to src/accessor/grib_accessor_class_g2end_step.cc index eed6b5d13..6e8cfcda3 100644 --- a/src/grib_accessor_class_g2end_step.cc +++ b/src/accessor/grib_accessor_class_g2end_step.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,153 +9,21 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" +#include "grib_accessor_class_g2end_step.h" #include "step.h" #include "step_utilities.h" #include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = init;dump - IMPLEMENTS = get_native_type - MEMBERS = const char* start_step_value - MEMBERS = const char* step_units - - MEMBERS = const char* year - MEMBERS = const char* month - MEMBERS = const char* day - MEMBERS = const char* hour - MEMBERS = const char* minute - MEMBERS = const char* second - - MEMBERS = const char* year_of_end_of_interval - MEMBERS = const char* month_of_end_of_interval - MEMBERS = const char* day_of_end_of_interval - MEMBERS = const char* hour_of_end_of_interval - MEMBERS = const char* minute_of_end_of_interval - MEMBERS = const char* second_of_end_of_interval - - MEMBERS = const char* time_range_unit - MEMBERS = const char* time_range_value - MEMBERS = const char* typeOfTimeIncrement - MEMBERS = const char* numberOfTimeRange - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2end_step -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g2end_step */ - const char* start_step_value; - const char* step_units; - const char* year; - const char* month; - const char* day; - const char* hour; - const char* minute; - const char* second; - const char* year_of_end_of_interval; - const char* month_of_end_of_interval; - const char* day_of_end_of_interval; - const char* hour_of_end_of_interval; - const char* minute_of_end_of_interval; - const char* second_of_end_of_interval; - const char* time_range_unit; - const char* time_range_value; - const char* typeOfTimeIncrement; - const char* numberOfTimeRange; -} grib_accessor_g2end_step; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g2end_step = { - &grib_accessor_class_long, /* super */ - "g2end_step", /* name */ - sizeof(grib_accessor_g2end_step), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - +grib_accessor_class_g2end_step_t _grib_accessor_class_g2end_step{ "g2end_step" }; grib_accessor_class* grib_accessor_class_g2end_step = &_grib_accessor_class_g2end_step; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) +void grib_accessor_class_g2end_step_t::init(grib_accessor* a, const long l, grib_arguments* c) { - grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a; - int n = 0; - grib_handle* h = grib_handle_of_accessor(a); + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_g2end_step_t* self = (grib_accessor_g2end_step_t*)a; + int n = 0; + grib_handle* h = grib_handle_of_accessor(a); self->start_step_value = grib_arguments_get_name(h, c, n++); self->step_units = grib_arguments_get_name(h, c, n++); @@ -173,31 +42,31 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->minute_of_end_of_interval = grib_arguments_get_name(h, c, n++); self->second_of_end_of_interval = grib_arguments_get_name(h, c, n++); - self->time_range_unit = grib_arguments_get_name(h, c, n++); + self->time_range_unit = grib_arguments_get_name(h, c, n++); self->time_range_value = grib_arguments_get_name(h, c, n++); self->typeOfTimeIncrement = grib_arguments_get_name(h, c, n++); self->numberOfTimeRange = grib_arguments_get_name(h, c, n++); } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_g2end_step_t::dump(grib_accessor* a, grib_dumper* dumper) { grib_dump_double(dumper, a, NULL); } // See GRIB-488 -static bool is_special_expver(const grib_handle* h) +bool is_special_expver(const grib_handle* h) { - int ret = 0; + int ret = 0; char strMarsExpVer[50] = {0,}; char strMarsClass[50] = {0,}; size_t slen = 50; - ret = grib_get_string(h, "mars.class", strMarsClass, &slen); + ret = grib_get_string(h, "mars.class", strMarsClass, &slen); if (ret == GRIB_SUCCESS && STR_EQUAL(strMarsClass, "em")) { // em = ERA-CLIM model integration for the 20th-century (ERA-20CM) slen = 50; - ret = grib_get_string(h, "experimentVersionNumber", strMarsExpVer, &slen); + ret = grib_get_string(h, "experimentVersionNumber", strMarsExpVer, &slen); if (ret == GRIB_SUCCESS && STR_EQUAL(strMarsExpVer, "1605")) { - return true; // Special case of expVer 1605 in class "em" + return true; // Special case of expVer 1605 in class "em" } } @@ -214,8 +83,8 @@ static int convert_time_range_long_( Assert(lengthOfTimeRange != NULL); if (indicatorOfUnitForTimeRange != stepUnits) { - eccodes::Step time_range{*lengthOfTimeRange, indicatorOfUnitForTimeRange}; - time_range.set_unit(eccodes::Unit{stepUnits}); + eccodes::Step time_range{ *lengthOfTimeRange, indicatorOfUnitForTimeRange }; + time_range.set_unit(eccodes::Unit{ stepUnits }); if (time_range.value() != time_range.value()) { return GRIB_DECODING_ERROR; } @@ -227,8 +96,8 @@ static int convert_time_range_long_( static int unpack_one_time_range_long_(grib_accessor* a, long* val, size_t* len) { - grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a; - int err = 0; + grib_accessor_g2end_step_t* self = (grib_accessor_g2end_step_t*)a; + int err = 0; long start_step_value; long step_units; long time_range_unit; @@ -274,10 +143,10 @@ static int unpack_one_time_range_long_(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_one_time_range_double_(grib_accessor* a, double *val , size_t* len) +static int unpack_one_time_range_double_(grib_accessor* a, double* val, size_t* len) { - grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a; - int err = 0; + grib_accessor_g2end_step_t* self = (grib_accessor_g2end_step_t*)a; + int err = 0; double start_step_value; long start_step_unit; long step_units; @@ -301,8 +170,8 @@ static int unpack_one_time_range_double_(grib_accessor* a, double *val , size_t* if ((err = grib_get_long_internal(h, self->typeOfTimeIncrement, &typeOfTimeIncrement))) return err; - eccodes::Step start_step{start_step_value, start_step_unit}; - eccodes::Step time_range{time_range_value, time_range_unit}; + eccodes::Step start_step{ start_step_value, start_step_unit }; + eccodes::Step time_range{ time_range_value, time_range_unit }; if (typeOfTimeIncrement == 1) { /* See GRIB-488 */ @@ -329,15 +198,21 @@ static int unpack_one_time_range_double_(grib_accessor* a, double *val , size_t* #define MAX_NUM_TIME_RANGES 16 /* maximum number of time range specifications */ static int unpack_multiple_time_ranges_long_(grib_accessor* a, long* val, size_t* len) { - grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a; + grib_accessor_g2end_step_t* self = (grib_accessor_g2end_step_t*)a; int i = 0, err = 0; - grib_handle* h = grib_handle_of_accessor(a); + grib_handle* h = grib_handle_of_accessor(a); long numberOfTimeRange = 0, step_units = 0, start_step_value = 0; - size_t count = 0; - long arr_typeOfTimeIncrement[MAX_NUM_TIME_RANGES] = {0,}; - long arr_coded_unit[MAX_NUM_TIME_RANGES] = {0,}; - long arr_coded_time_range[MAX_NUM_TIME_RANGES] = {0,}; + size_t count = 0; + long arr_typeOfTimeIncrement[MAX_NUM_TIME_RANGES] = { + 0, + }; + long arr_coded_unit[MAX_NUM_TIME_RANGES] = { + 0, + }; + long arr_coded_time_range[MAX_NUM_TIME_RANGES] = { + 0, + }; if ((err = grib_get_long_internal(h, self->start_step_value, &start_step_value))) return err; @@ -382,29 +257,35 @@ static int unpack_multiple_time_ranges_long_(grib_accessor* a, long* val, size_t static int unpack_multiple_time_ranges_double_(grib_accessor* a, double* val, size_t* len) { - grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a; + grib_accessor_g2end_step_t* self = (grib_accessor_g2end_step_t*)a; int i = 0, err = 0; - grib_handle* h = grib_handle_of_accessor(a); + grib_handle* h = grib_handle_of_accessor(a); long numberOfTimeRange = 0; - long step_units = 0; - long start_step_value = 0; - long start_step_unit = 0; + long step_units = 0; + long start_step_value = 0; + long start_step_unit = 0; - size_t count = 0; - long arr_typeOfTimeIncrement[MAX_NUM_TIME_RANGES] = {0, }; - long arr_coded_unit[MAX_NUM_TIME_RANGES] = {0, }; - long arr_coded_time_range[MAX_NUM_TIME_RANGES] = {0, }; + size_t count = 0; + long arr_typeOfTimeIncrement[MAX_NUM_TIME_RANGES] = { + 0, + }; + long arr_coded_unit[MAX_NUM_TIME_RANGES] = { + 0, + }; + long arr_coded_time_range[MAX_NUM_TIME_RANGES] = { + 0, + }; if ((err = grib_get_long_internal(h, self->start_step_value, &start_step_value))) return err; if ((err = grib_get_long_internal(h, "startStepUnit", &start_step_unit))) return err; - eccodes::Step start_step{start_step_value, start_step_unit}; + eccodes::Step start_step{ start_step_value, start_step_unit }; if ((err = grib_get_long_internal(h, self->step_units, &step_units))) return err; - + if ((err = grib_get_long_internal(h, self->numberOfTimeRange, &numberOfTimeRange))) return err; if (numberOfTimeRange > MAX_NUM_TIME_RANGES) { @@ -428,7 +309,7 @@ static int unpack_multiple_time_ranges_double_(grib_accessor* a, double* val, si long the_coded_unit = arr_coded_unit[i]; long the_coded_time_range = arr_coded_time_range[i]; - eccodes::Step time_range{the_coded_unit, the_coded_time_range}; + eccodes::Step time_range{ the_coded_unit, the_coded_time_range }; *val = (start_step + time_range).value(eccodes::Unit(step_units)); return GRIB_SUCCESS; @@ -443,11 +324,11 @@ static int unpack_multiple_time_ranges_double_(grib_accessor* a, double* val, si // For the old implementation of unpack_long, see // src/deprecated/grib_accessor_class_g2end_step.unpack_long.cc // -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_g2end_step_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a; - grib_handle* h = grib_handle_of_accessor(a); - int ret = 0; + grib_accessor_g2end_step_t* self = (grib_accessor_g2end_step_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int ret = 0; long start_step_value; long start_step_unit; long numberOfTimeRange; @@ -472,25 +353,25 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) try { if (numberOfTimeRange == 1) { - ret = unpack_one_time_range_long_(a, val, len); + ret = unpack_one_time_range_long_(a, val, len); } else { ret = unpack_multiple_time_ranges_long_(a, val, len); } } catch (std::exception& e) { - grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step::unpack_long: %s", e.what()); + grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step_t::unpack_long: %s", e.what()); ret = GRIB_DECODING_ERROR; } return ret; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_g2end_step_t::unpack_double(grib_accessor* a, double* val, size_t* len) { - grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a; - grib_handle* h = grib_handle_of_accessor(a); - int ret = 0; + grib_accessor_g2end_step_t* self = (grib_accessor_g2end_step_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int ret = 0; long start_step_value; long start_step_unit; long numberOfTimeRange; @@ -515,14 +396,14 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) try { if (numberOfTimeRange == 1) { - ret = unpack_one_time_range_double_(a, val, len); + ret = unpack_one_time_range_double_(a, val, len); } else { ret = unpack_multiple_time_ranges_double_(a, val, len); } } catch (std::exception& e) { - grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step::unpack_double: %s", e.what()); + grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step_t::unpack_double: %s", e.what()); ret = GRIB_DECODING_ERROR; } @@ -531,9 +412,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) static int pack_long_(grib_accessor* a, const long end_step_value, const long end_step_unit) { - grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a; - grib_handle* h = grib_handle_of_accessor(a); - int err = 0; + grib_accessor_g2end_step_t* self = (grib_accessor_g2end_step_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int err = 0; long year; long month; @@ -556,7 +437,7 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en double dend, dstep; const int show_units_for_hours = a->context->grib_hourly_steps_with_units; - eccodes::Step end_step{end_step_value, end_step_unit}; + eccodes::Step end_step{ end_step_value, end_step_unit }; /*point in time */ if (self->year == NULL) { @@ -587,10 +468,10 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en return err; long force_step_units; - if ((err= grib_get_long_internal(h, "forceStepUnits", &force_step_units)) != GRIB_SUCCESS) + if ((err = grib_get_long_internal(h, "forceStepUnits", &force_step_units)) != GRIB_SUCCESS) return err; - if (eccodes::Unit{start_step_unit} == eccodes::Unit{eccodes::Unit::Value::MISSING}) { + if (eccodes::Unit{ start_step_unit } == eccodes::Unit{ eccodes::Unit::Value::MISSING }) { grib_context_log(h->context, GRIB_LOG_ERROR, "missing start step unit"); return GRIB_WRONG_STEP_UNIT; @@ -599,7 +480,7 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en if ((err = grib_get_long_internal(h, self->typeOfTimeIncrement, &typeOfTimeIncrement))) return err; - eccodes::Step start_step{start_step_value, start_step_unit}; + eccodes::Step start_step{ start_step_value, start_step_unit }; eccodes::Step time_range = end_step - start_step; if (time_range.value() < 0) { @@ -614,7 +495,7 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en if (err != GRIB_SUCCESS) return err; - dstep = end_step.value(eccodes::Unit{eccodes::Unit::Value::DAY}); + dstep = end_step.value(eccodes::Unit{ eccodes::Unit::Value::DAY }); dend += dstep; err = grib_julian_to_datetime(dend, &year_of_end_of_interval, &month_of_end_of_interval, @@ -637,15 +518,15 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en return err; const char* forecast_time_value_key = "forecastTime"; - const char* forecast_time_unit_key = "indicatorOfUnitOfTimeRange"; + const char* forecast_time_unit_key = "indicatorOfUnitOfTimeRange"; eccodes::Step forecast_time_opt; eccodes::Step time_range_opt; - if (eccodes::Unit{force_step_units} == eccodes::Unit{eccodes::Unit::Value::MISSING}) { + if (eccodes::Unit{ force_step_units } == eccodes::Unit{ eccodes::Unit::Value::MISSING }) { std::tie(forecast_time_opt, time_range_opt) = find_common_units(start_step.optimize_unit(), time_range.optimize_unit()); } else { - forecast_time_opt = eccodes::Step{start_step.value(eccodes::Unit{force_step_units}), eccodes::Unit{force_step_units}}; - time_range_opt = eccodes::Step{time_range.value(eccodes::Unit{force_step_units}), eccodes::Unit{force_step_units}}; + forecast_time_opt = eccodes::Step{ start_step.value(eccodes::Unit{ force_step_units }), eccodes::Unit{ force_step_units } }; + time_range_opt = eccodes::Step{ time_range.value(eccodes::Unit{ force_step_units }), eccodes::Unit{ force_step_units } }; } if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->time_range_value, time_range_opt.value())) != GRIB_SUCCESS) @@ -660,14 +541,14 @@ static int pack_long_(grib_accessor* a, const long end_step_value, const long en return GRIB_SUCCESS; } -static int unpack_string(grib_accessor* a, char* val, size_t* len) +int grib_accessor_class_g2end_step_t::unpack_string(grib_accessor* a, char* val, size_t* len) { - grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a; - grib_handle* h = grib_handle_of_accessor(a); - int ret = 0; - char fp_format[128] = "%g"; - size_t fp_format_len = sizeof(fp_format); - size_t step_len = 0; + grib_accessor_g2end_step_t* self = (grib_accessor_g2end_step_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int ret = 0; + char fp_format[128] = "%g"; + size_t fp_format_len = sizeof(fp_format); + size_t step_len = 0; long step_value; long step_units; const int show_units_for_hours = a->context->grib_hourly_steps_with_units; @@ -697,14 +578,14 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) memcpy(val, ss.str().c_str(), size); } catch (std::exception& e) { - grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step::unpack_string: %s", e.what()); + grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step_t::unpack_string: %s", e.what()); return GRIB_DECODING_ERROR; } return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_g2end_step_t::pack_long(grib_accessor* a, const long* val, size_t* len) { grib_handle* h = grib_handle_of_accessor(a); int ret; @@ -715,12 +596,12 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) try { long end_step_unit; - if (eccodes::Unit{force_step_units} == eccodes::Unit{eccodes::Unit::Value::MISSING}) { + if (eccodes::Unit{ force_step_units } == eccodes::Unit{ eccodes::Unit::Value::MISSING }) { if ((ret = grib_get_long_internal(h, "endStepUnit", &end_step_unit)) != GRIB_SUCCESS) return ret; - if (eccodes::Unit{end_step_unit} == eccodes::Unit{eccodes::Unit::Value::MISSING}) - end_step_unit = eccodes::Unit{eccodes::Unit::Value::HOUR}.value(); + if (eccodes::Unit{ end_step_unit } == eccodes::Unit{ eccodes::Unit::Value::MISSING }) + end_step_unit = eccodes::Unit{ eccodes::Unit::Value::HOUR }.value(); } else { end_step_unit = force_step_units; @@ -728,22 +609,22 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) ret = pack_long_(a, *val, end_step_unit); } catch (std::exception& e) { - grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step::pack_long: %s", e.what()); + grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step_t::pack_long: %s", e.what()); return GRIB_DECODING_ERROR; } return ret; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) +int grib_accessor_class_g2end_step_t::pack_string(grib_accessor* a, const char* val, size_t* len) { grib_handle* h = grib_handle_of_accessor(a); - int ret = 0; + int ret = 0; long force_step_units; if ((ret = grib_get_long_internal(h, "forceStepUnits", &force_step_units)) != GRIB_SUCCESS) return ret; try { - eccodes::Step end_step = step_from_string(val, eccodes::Unit{force_step_units}); + eccodes::Step end_step = step_from_string(val, eccodes::Unit{ force_step_units }); end_step.optimize_unit(); if ((ret = grib_set_long_internal(h, "endStepUnit", end_step.unit().value())) != GRIB_SUCCESS) @@ -753,22 +634,22 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) return ret; } catch (std::exception& e) { - grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step::pack_string: %s", e.what()); + grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step_t::pack_string: %s", e.what()); return GRIB_DECODING_ERROR; } return GRIB_SUCCESS; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_g2end_step_t::get_native_type(grib_accessor* a) { - grib_handle* h = grib_handle_of_accessor(a); + grib_handle* h = grib_handle_of_accessor(a); const int show_units_for_hours = a->context->grib_hourly_steps_with_units; if (!show_units_for_hours) { long step_units = 0; if (grib_get_long_internal(h, "stepUnits", &step_units) == GRIB_SUCCESS) { - if (eccodes::Unit{step_units} == eccodes::Unit::Value::HOUR) { - return GRIB_TYPE_LONG; // For backward compatibility + if (eccodes::Unit{ step_units } == eccodes::Unit::Value::HOUR) { + return GRIB_TYPE_LONG; // For backward compatibility } } } diff --git a/src/accessor/grib_accessor_class_g2end_step.h b/src/accessor/grib_accessor_class_g2end_step.h new file mode 100644 index 000000000..d3a3b1433 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2end_step.h @@ -0,0 +1,53 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g2end_step_t : public grib_accessor_long_t +{ +public: + /* Members defined in g2end_step */ + const char* start_step_value; + const char* step_units; + const char* year; + const char* month; + const char* day; + const char* hour; + const char* minute; + const char* second; + const char* year_of_end_of_interval; + const char* month_of_end_of_interval; + const char* day_of_end_of_interval; + const char* hour_of_end_of_interval; + const char* minute_of_end_of_interval; + const char* second_of_end_of_interval; + const char* time_range_unit; + const char* time_range_value; + const char* typeOfTimeIncrement; + const char* numberOfTimeRange; +}; + +class grib_accessor_class_g2end_step_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g2end_step_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2end_step_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_g2grid.cc b/src/accessor/grib_accessor_class_g2grid.cc similarity index 57% rename from src/grib_accessor_class_g2grid.cc rename to src/accessor/grib_accessor_class_g2grid.cc index 40aaca628..3bc0a9a22 100644 --- a/src/grib_accessor_class_g2grid.cc +++ b/src/accessor/grib_accessor_class_g2grid.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,119 +9,18 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -#include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double;pack_double;value_count - IMPLEMENTS = init - MEMBERS=const char* latitude_first - MEMBERS=const char* longitude_first - MEMBERS=const char* latitude_last - MEMBERS=const char* longitude_last - MEMBERS=const char* i_increment - MEMBERS=const char* j_increment - MEMBERS=const char* basic_angle - MEMBERS=const char* sub_division - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2grid -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in g2grid */ - const char* latitude_first; - const char* longitude_first; - const char* latitude_last; - const char* longitude_last; - const char* i_increment; - const char* j_increment; - const char* basic_angle; - const char* sub_division; -} grib_accessor_g2grid; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_g2grid = { - &grib_accessor_class_double, /* super */ - "g2grid", /* name */ - sizeof(grib_accessor_g2grid), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_g2grid.h" +grib_accessor_class_g2grid_t _grib_accessor_class_g2grid{ "g2grid" }; grib_accessor_class* grib_accessor_class_g2grid = &_grib_accessor_class_g2grid; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) +void grib_accessor_class_g2grid_t::init(grib_accessor* a, const long l, grib_arguments* c) { - grib_accessor_g2grid* self = (grib_accessor_g2grid*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int n = 0; + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_g2grid_t* self = (grib_accessor_g2grid_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int n = 0; self->latitude_first = grib_arguments_get_name(hand, c, n++); self->longitude_first = grib_arguments_get_name(hand, c, n++); @@ -136,7 +36,7 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) GRIB_ACCESSOR_FLAG_READ_ONLY; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_g2grid_t::value_count(grib_accessor* a, long* count) { *count = 6; return 0; @@ -145,17 +45,16 @@ static int value_count(grib_accessor* a, long* count) // GRIB edition 2 uses microdegrees #define ANGLE_SUBDIVISIONS (1000 * 1000) -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_g2grid_t::unpack_double(grib_accessor* a, double* val, size_t* len) { - grib_accessor_g2grid* self = (grib_accessor_g2grid*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int ret = 0; + grib_accessor_g2grid_t* self = (grib_accessor_g2grid_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int ret = 0; long basic_angle = 0; long sub_division = 0; - int n = 0; + int n = 0; long v[6]; - int i; if (*len < 6) { ret = GRIB_ARRAY_TOO_SMALL; @@ -195,11 +94,12 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) if (!self->j_increment) { v[n++] = GRIB_MISSING_LONG; - } else { + } + else { if ((ret = grib_get_long_internal(hand, self->j_increment, &v[n++])) != GRIB_SUCCESS) return ret; } - for (i = 0; i < n; i++) + for (int i = 0; i < n; i++) if (v[i] == GRIB_MISSING_LONG) val[i] = GRIB_MISSING_DOUBLE; else @@ -278,10 +178,10 @@ static int trial(const double* val, long v[6], long* basic_angle, long* sub_divi return is_ok(val, v, *basic_angle, *sub_division); } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_g2grid_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_g2grid* self = (grib_accessor_g2grid*)a; - grib_handle* hand = grib_handle_of_accessor(a); + grib_accessor_g2grid_t* self = (grib_accessor_g2grid_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); int ret; long v[6]; int n; @@ -289,8 +189,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) long sub_division; if (*len < 6) { - ret = GRIB_ARRAY_TOO_SMALL; - return ret; + return GRIB_ARRAY_TOO_SMALL; } /* printf("pack_double %g %g %g %g %g %g\n",val[0],val[1],val[2],val[3],val[4],val[5]);*/ diff --git a/src/accessor/grib_accessor_class_g2grid.h b/src/accessor/grib_accessor_class_g2grid.h new file mode 100644 index 000000000..07c9f9862 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2grid.h @@ -0,0 +1,39 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_g2grid_t : public grib_accessor_double_t +{ +public: + /* Members defined in g2grid */ + const char* latitude_first; + const char* longitude_first; + const char* latitude_last; + const char* longitude_last; + const char* i_increment; + const char* j_increment; + const char* basic_angle; + const char* sub_division; +}; + +class grib_accessor_class_g2grid_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_g2grid_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2grid_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g2latlon.cc b/src/accessor/grib_accessor_class_g2latlon.cc new file mode 100644 index 000000000..afb3a2f7a --- /dev/null +++ b/src/accessor/grib_accessor_class_g2latlon.cc @@ -0,0 +1,120 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g2latlon.h" + +grib_accessor_class_g2latlon_t _grib_accessor_class_g2latlon{ "g2latlon" }; +grib_accessor_class* grib_accessor_class_g2latlon = &_grib_accessor_class_g2latlon; + + +void grib_accessor_class_g2latlon_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_g2latlon_t* self = (grib_accessor_g2latlon_t*)a; + int n = 0; + + self->grid = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->index = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); + self->given = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); +} + +int grib_accessor_class_g2latlon_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + grib_accessor_g2latlon_t* self = (grib_accessor_g2latlon_t*)a; + int ret = 0; + + long given = 1; + double grid[6]; + size_t size = 6; + + if (*len < 1) { + ret = GRIB_ARRAY_TOO_SMALL; + return ret; + } + + if (self->given) + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->given, &given)) != GRIB_SUCCESS) + return ret; + + if (!given) { + *val = GRIB_MISSING_DOUBLE; + return GRIB_SUCCESS; + } + + if ((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->grid, grid, &size)) != GRIB_SUCCESS) + return ret; + + *val = grid[self->index]; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_g2latlon_t::pack_double(grib_accessor* a, const double* val, size_t* len) +{ + grib_accessor_g2latlon_t* self = (grib_accessor_g2latlon_t*)a; + int ret = 0; + double grid[6]; + size_t size = 6; + double new_val = *val; + grib_handle* hand = grib_handle_of_accessor(a); + + if (*len < 1) { + ret = GRIB_ARRAY_TOO_SMALL; + return ret; + } + + if (self->given) { + long given = *val != GRIB_MISSING_DOUBLE; + if ((ret = grib_set_long_internal(hand, self->given, given)) != GRIB_SUCCESS) + return ret; + } + + if ((ret = grib_get_double_array_internal(hand, self->grid, grid, &size)) != GRIB_SUCCESS) + return ret; + + /* index 1 is longitudeOfFirstGridPointInDegrees + * index 3 is longitudeOfLastGridPointInDegrees + */ + if ((self->index == 1 || self->index == 3)) { + /* WMO regulation for GRIB edition 2: + * The longitude values shall be limited to the range 0 to 360 degrees inclusive */ + new_val = normalise_longitude_in_degrees(*val); + if (hand->context->debug && new_val != *val) { + fprintf(stderr, "ECCODES DEBUG pack_double g2latlon: normalise longitude %g -> %g\n", *val, new_val); + } + } + grid[self->index] = new_val; + + return grib_set_double_array_internal(hand, self->grid, grid, size); +} + +int grib_accessor_class_g2latlon_t::pack_missing(grib_accessor* a) +{ + grib_accessor_g2latlon_t* self = (grib_accessor_g2latlon_t*)a; + double missing = GRIB_MISSING_DOUBLE; + size_t size = 1; + + if (!self->given) + return GRIB_NOT_IMPLEMENTED; + + return pack_double(a, &missing, &size); +} + +int grib_accessor_class_g2latlon_t::is_missing(grib_accessor* a) +{ + grib_accessor_g2latlon_t* self = (grib_accessor_g2latlon_t*)a; + long given = 1; + + if (self->given) + grib_get_long_internal(grib_handle_of_accessor(a), self->given, &given); + + return !given; +} diff --git a/src/accessor/grib_accessor_class_g2latlon.h b/src/accessor/grib_accessor_class_g2latlon.h new file mode 100644 index 000000000..f4733757e --- /dev/null +++ b/src/accessor/grib_accessor_class_g2latlon.h @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_g2latlon_t : public grib_accessor_double_t +{ +public: + /* Members defined in g2latlon */ + const char* grid; + int index; + const char* given; +}; + +class grib_accessor_class_g2latlon_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_g2latlon_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2latlon_t{}; } + int pack_missing(grib_accessor*) override; + int is_missing(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_g2level.cc b/src/accessor/grib_accessor_class_g2level.cc similarity index 52% rename from src/grib_accessor_class_g2level.cc rename to src/accessor/grib_accessor_class_g2level.cc index 39bd79033..8da0be27f 100644 --- a/src/grib_accessor_class_g2level.cc +++ b/src/accessor/grib_accessor_class_g2level.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,113 +9,18 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = unpack_long;pack_long;init;is_missing - MEMBERS=const char* type_first - MEMBERS=const char* scale_first - MEMBERS=const char* value_first - MEMBERS=const char* pressure_units - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int is_missing(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2level -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g2level */ - const char* type_first; - const char* scale_first; - const char* value_first; - const char* pressure_units; -} grib_accessor_g2level; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g2level = { - &grib_accessor_class_long, /* super */ - "g2level", /* name */ - sizeof(grib_accessor_g2level), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - &is_missing, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_g2level.h" +grib_accessor_class_g2level_t _grib_accessor_class_g2level{ "g2level" }; grib_accessor_class* grib_accessor_class_g2level = &_grib_accessor_class_g2level; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) +void grib_accessor_class_g2level_t::init(grib_accessor* a, const long l, grib_arguments* c) { - grib_accessor_g2level* self = (grib_accessor_g2level*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int n = 0; + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_g2level_t* self = (grib_accessor_g2level_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int n = 0; self->type_first = grib_arguments_get_name(hand, c, n++); self->scale_first = grib_arguments_get_name(hand, c, n++); @@ -125,26 +31,26 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) a->flags |= GRIB_ACCESSOR_FLAG_COPY_IF_CHANGING_EDITION; } -static bool is_tigge(grib_handle* h) +bool is_tigge(grib_handle* h) { long productionStatus = 0; - int err = grib_get_long(h, "productionStatusOfProcessedData", &productionStatus); + int err = grib_get_long(h, "productionStatusOfProcessedData", &productionStatus); if (err) return false; return (productionStatus == 4 || productionStatus == 5); } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_g2level_t::unpack_double(grib_accessor* a, double* val, size_t* len) { - int ret = 0; - grib_accessor_g2level* self = (grib_accessor_g2level*)a; - grib_handle* hand = grib_handle_of_accessor(a); + int ret = 0; + grib_accessor_g2level_t* self = (grib_accessor_g2level_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); long type_first = 0; long scale_first = 0; long value_first = 0; char pressure_units[10] = {0,}; size_t pressure_units_len = 10; - bool tigge = is_tigge(hand); + bool tigge = is_tigge(hand); double v; @@ -172,8 +78,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) // GRIB-637, ECC-1081: Potential vorticity surface if (type_first == 109) { if (tigge) { - scale_first -= 6; // TIGGE data follows different rules - } else { + scale_first -= 6; // TIGGE data follows different rules + } + else { scale_first -= 9; } } @@ -189,9 +96,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) } switch (type_first) { - case 100: // Isobaric surface (Pa) + case 100: // Isobaric surface (Pa) if (!strcmp(pressure_units, "hPa")) { - long x = v / 100.0; // 1 hPa = 100 Pa + long x = v / 100.0; // 1 hPa = 100 Pa if (scale_first == 0 && x == 0) { // Switch to Pa instead of hPa as the value is less than a hectoPascal char pa[] = "Pa"; @@ -211,29 +118,29 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_g2level_t::unpack_long(grib_accessor* a, long* val, size_t* len) { double dval = 0; int ret = unpack_double(a, &dval, len); if (ret == GRIB_SUCCESS) { - *val = (long)(dval + 0.5); // round up + *val = (long)(dval + 0.5); // round up } return ret; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_g2level_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_g2level* self = (grib_accessor_g2level*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int ret = 0; - double value_first = *val; - //long scale_first = 0; - long type_first = 0; - char pressure_units[10] = {0,}; - size_t pressure_units_len = 10; - const long lval = (long)value_first; + grib_accessor_g2level_t* self = (grib_accessor_g2level_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int ret = 0; + double value_first = *val; + // long scale_first = 0; + long type_first = 0; + char pressure_units[10] = {0,}; + size_t pressure_units_len = 10; + const long lval = (long)value_first; - if (value_first == lval) { // input is a whole number; process it as an integer + if (value_first == lval) { // input is a whole number; process it as an integer return pack_long(a, &lval, len); } @@ -247,7 +154,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return ret; switch (type_first) { - case 100: // Pa + case 100: // Pa if (!strcmp(pressure_units, "hPa")) value_first *= 100; break; @@ -258,14 +165,14 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) // final = scaled_value * 10 ^ -scale_factor - //scale_first = 2; - //value_first *= 100; - //value_first = value_first + 0.5; //round up + // scale_first = 2; + // value_first *= 100; + // value_first = value_first + 0.5; //round up // TODO(masn): These maxima should come from the respective accessors - const int64_t scaled_value_max = (1ULL << 32) - 1; // scaledValueOf*FixedSurface is 4 octets - const int64_t scale_factor_max = (1ULL << 8) - 1; // scaleFactorOf*FixedSurface is 1 octet - int64_t lscaled_value=0, lscale_factor=0; + const int64_t scaled_value_max = (1ULL << 32) - 1; // scaledValueOf*FixedSurface is 4 octets + const int64_t scale_factor_max = (1ULL << 8) - 1; // scaleFactorOf*FixedSurface is 1 octet + int64_t lscaled_value = 0, lscale_factor = 0; ret = compute_scaled_value_and_scale_factor(value_first, scaled_value_max, scale_factor_max, &lscaled_value, &lscale_factor); if (ret) { @@ -284,7 +191,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_g2level_t::pack_long(grib_accessor* a, const long* val, size_t* len) { int ret = 0; long value_first = *val; @@ -293,10 +200,10 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) char pressure_units[10] = {0,}; size_t pressure_units_len = 10; - grib_accessor_g2level* self = (grib_accessor_g2level*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int change_scale_and_value = 1; - bool tigge = is_tigge(hand); + grib_accessor_g2level_t* self = (grib_accessor_g2level_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int change_scale_and_value = 1; + bool tigge = is_tigge(hand); if (*len != 1) return GRIB_WRONG_ARRAY_SIZE; @@ -317,16 +224,17 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return ret; switch (type_first) { - case 100: // Pa + case 100: // Pa scale_first = 0; if (!strcmp(pressure_units, "hPa")) value_first *= 100; break; - case 109: // Potential vorticity surface (See ECC-1081) + case 109: // Potential vorticity surface (See ECC-1081) if (!tigge) { scale_first = 9; - } else { - scale_first = 6; // TIGGE data follows different rules + } + else { + scale_first = 6; // TIGGE data follows different rules } break; @@ -359,14 +267,13 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_SUCCESS; } -static int is_missing(grib_accessor* a) +int grib_accessor_class_g2level_t::is_missing(grib_accessor* a) { - grib_accessor_g2level* self = (grib_accessor_g2level*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int err = 0; - int ret = 0; + grib_accessor_g2level_t* self = (grib_accessor_g2level_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int err = 0; - ret = grib_is_missing(hand, self->scale_first, &err) + + int ret = grib_is_missing(hand, self->scale_first, &err) + grib_is_missing(hand, self->value_first, &err); return ret; } diff --git a/src/accessor/grib_accessor_class_g2level.h b/src/accessor/grib_accessor_class_g2level.h new file mode 100644 index 000000000..55511b8f0 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2level.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_g2level_t : public grib_accessor_long_t +{ +public: + /* Members defined in g2level */ + const char* type_first; + const char* scale_first; + const char* value_first; + const char* pressure_units; +}; + +class grib_accessor_class_g2level_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_g2level_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2level_t{}; } + int is_missing(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g2lon.cc b/src/accessor/grib_accessor_class_g2lon.cc new file mode 100644 index 000000000..b7cb43d03 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2lon.cc @@ -0,0 +1,61 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g2lon.h" + +grib_accessor_class_g2lon_t _grib_accessor_class_g2lon{ "g2lon" }; +grib_accessor_class* grib_accessor_class_g2lon = &_grib_accessor_class_g2lon; + + +void grib_accessor_class_g2lon_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_g2lon_t* self = (grib_accessor_g2lon_t*)a; + int n = 0; + + self->longitude = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); +} + +int grib_accessor_class_g2lon_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + grib_accessor_g2lon_t* self = (grib_accessor_g2lon_t*)a; + int ret = 0; + long longitude; + + if ((ret = grib_get_long(grib_handle_of_accessor(a), self->longitude, &longitude)) != GRIB_SUCCESS) + return ret; + + if (longitude == GRIB_MISSING_LONG) { + *val = GRIB_MISSING_DOUBLE; + return GRIB_SUCCESS; + } + + *val = ((double)longitude) / 1000000.0; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_g2lon_t::pack_double(grib_accessor* a, const double* val, size_t* len) +{ + grib_accessor_g2lon_t* self = (grib_accessor_g2lon_t*)a; + long longitude; + double value = *val; + + if (value == GRIB_MISSING_DOUBLE) { + longitude = GRIB_MISSING_LONG; + } + else { + if (value < 0) + value += 360; + longitude = (long)(value * 1000000); + } + return grib_set_long(grib_handle_of_accessor(a), self->longitude, longitude); +} diff --git a/src/accessor/grib_accessor_class_g2lon.h b/src/accessor/grib_accessor_class_g2lon.h new file mode 100644 index 000000000..d3f5bd8ff --- /dev/null +++ b/src/accessor/grib_accessor_class_g2lon.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_g2lon_t : public grib_accessor_double_t +{ +public: + /* Members defined in g2lon */ + const char* longitude; +}; + +class grib_accessor_class_g2lon_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_g2lon_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2lon_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_g2step_range.cc b/src/accessor/grib_accessor_class_g2step_range.cc new file mode 100644 index 000000000..0c1b49e21 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2step_range.cc @@ -0,0 +1,275 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_g2step_range.h" +#include "step.h" +#include "step_utilities.h" +#include + + +grib_accessor_class_g2step_range_t _grib_accessor_class_g2step_range{ "g2step_range" }; +grib_accessor_class* grib_accessor_class_g2step_range = &_grib_accessor_class_g2step_range; + + +void grib_accessor_class_g2step_range_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_gen_t::init(a, l, c); + grib_accessor_g2step_range_t* self = (grib_accessor_g2step_range_t*)a; + + int n = 0; + + self->start_step = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->end_step = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + + a->length = 0; +} + +// static void dump(grib_accessor* a, grib_dumper* dumper) +//{ +// grib_dump_string(dumper, a, NULL); +//} + +int grib_accessor_class_g2step_range_t::unpack_string(grib_accessor* a, char* val, size_t* len) +{ + grib_accessor_g2step_range_t* self = (grib_accessor_g2step_range_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int ret = 0; + size_t size = 0; + double start_step_value = 0; + double end_step_value = 0; + long step_units; + + int show_hours = a->context->grib_hourly_steps_with_units; + + if ((ret = grib_get_double_internal(h, self->start_step, &start_step_value)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) + return ret; + try { + if (eccodes::Unit{ step_units } == eccodes::Unit{ eccodes::Unit::Value::MISSING }) { + if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) + return ret; + } + + char fp_format[128] = "%g"; + size_t fp_format_len = sizeof(fp_format); + if ((ret = grib_get_string_internal(h, "formatForDoubles", fp_format, &fp_format_len)) != GRIB_SUCCESS) + return ret; + std::stringstream ss; + + eccodes::Step start_step{ start_step_value, step_units }; + if (self->end_step == NULL) { + ss << start_step.value(fp_format, show_hours); + } + else { + if ((ret = grib_get_double_internal(h, self->end_step, &end_step_value)) != GRIB_SUCCESS) + return ret; + + eccodes::Step end_step{ end_step_value, step_units }; + + if (start_step_value == end_step_value) { + ss << end_step.value(fp_format, show_hours); + } + else { + ss << start_step.value(fp_format, show_hours) << "-" << end_step.value(fp_format, show_hours); + } + } + + size = ss.str().size() + 1; + + if (*len < size) + return GRIB_ARRAY_TOO_SMALL; + + *len = size; + + memcpy(val, ss.str().c_str(), size); + } + catch (std::exception& e) { + grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_g2step_range_t::unpack_string: %s", e.what()); + return GRIB_DECODING_ERROR; + } + + return GRIB_SUCCESS; +} + +// Step range format: [-] +// and can be in different units +// stepRange="X" in instantaneous field is equivalent to set step=X +// stepRange="X" in accumulated field is equivalent to startStep=X, endStep=startStep +int grib_accessor_class_g2step_range_t::pack_string(grib_accessor* a, const char* val, size_t* len) +{ + grib_accessor_g2step_range_t* self = (grib_accessor_g2step_range_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int ret = 0; + + long force_step_units; + if ((ret = grib_get_long_internal(h, "forceStepUnits", &force_step_units)) != GRIB_SUCCESS) + return ret; + + // Note: + // forceStepUnits is a special key that is used to identify the origin of the defined units + // i.e., whether they have been defined by the user. + // If this key is defined (!= 255), it indicates that the stepUnits have been defined by the user. + // Once this key is set, it has the highest priority: it automatically overrides certain units and the default value in stepUnits + + if (h->loader) { // h->loader is set only when rebuilding or reparsing + force_step_units = 255; // See ECC-1768 and ECC-1800 + } + + try { + std::vector steps = parse_range(val, eccodes::Unit{ force_step_units }); + if (steps.size() == 0) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Could not parse step range: %s", val); + return GRIB_INVALID_ARGUMENT; + } + + eccodes::Step step_0; + eccodes::Step step_1; + if (eccodes::Unit{ force_step_units } == eccodes::Unit{ eccodes::Unit::Value::MISSING }) { + if (steps.size() > 1) + std::tie(step_0, step_1) = find_common_units(steps[0].optimize_unit(), steps[1].optimize_unit()); + else + step_0 = steps[0].optimize_unit(); + } + else { + step_0 = eccodes::Step{ steps[0].value(eccodes::Unit{ force_step_units }), eccodes::Unit{ force_step_units } }; + if (steps.size() > 1) { + step_1 = eccodes::Step{ steps[1].value(eccodes::Unit{ force_step_units }), eccodes::Unit{ force_step_units } }; + } + } + + if ((ret = grib_set_long_internal(h, "startStepUnit", step_0.unit().value()))) + return ret; + if ((ret = set_step(h, "forecastTime", "indicatorOfUnitOfTimeRange", step_0)) != GRIB_SUCCESS) + return ret; + + if (self->end_step != NULL) { + if (steps.size() > 1) { + if ((ret = grib_set_long_internal(h, "endStepUnit", step_1.unit().value()))) + return ret; + if ((ret = grib_set_long_internal(h, self->end_step, step_1.value()))) + return ret; + } + else { + if ((ret = grib_set_long_internal(h, "endStepUnit", step_0.unit().value()))) + return ret; + if ((ret = grib_set_long_internal(h, self->end_step, step_0.value()))) + return ret; + } + } + } + catch (std::exception& e) { + grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_class_g2step_range::pack_string: %s", e.what()); + return GRIB_INVALID_ARGUMENT; + } + return GRIB_SUCCESS; +} + +int grib_accessor_class_g2step_range_t::value_count(grib_accessor* a, long* count) +{ + *count = 1; + return 0; +} + +size_t grib_accessor_class_g2step_range_t::string_length(grib_accessor* a) +{ + return 255; +} + +int grib_accessor_class_g2step_range_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + char buff[100]; + size_t bufflen = 100; + + snprintf(buff, sizeof(buff), "%ld", *val); + return pack_string(a, buff, &bufflen); +} + +int grib_accessor_class_g2step_range_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_g2step_range_t* self = (grib_accessor_g2step_range_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int ret = 0; + long end_start_value = 0; + long end_step_value = 0; + long step_units = 0; + + if ((ret = grib_get_long_internal(h, self->start_step, &end_start_value)) != GRIB_SUCCESS) + return ret; + try { + if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) + throw std::runtime_error("Failed to get stepUnits"); + if (eccodes::Unit{ step_units } == eccodes::Unit{ eccodes::Unit::Value::MISSING }) { + if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) + return ret; + } + + eccodes::Step start_step{ end_start_value, step_units }; + if (self->end_step == NULL) { + *val = start_step.value(); + } + else { + if ((ret = grib_get_long_internal(h, self->end_step, &end_step_value)) != GRIB_SUCCESS) + return ret; + eccodes::Step end_step{ end_step_value, step_units }; + *val = end_step.value(); + } + } + catch (std::exception& e) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Failed to unpack step range: %s", e.what()); + return GRIB_DECODING_ERROR; + } + + return GRIB_SUCCESS; +} + +int grib_accessor_class_g2step_range_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + grib_accessor_g2step_range_t* self = (grib_accessor_g2step_range_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int ret = 0; + double end_start_value = 0; + double end_step_value = 0; + long step_units = 0; + + if ((ret = grib_get_double_internal(h, self->start_step, &end_start_value)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) + throw std::runtime_error("Failed to get stepUnits"); + + try { + if (eccodes::Unit{ step_units } == eccodes::Unit{ eccodes::Unit::Value::MISSING }) { + if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) + return ret; + } + + eccodes::Step start_step{ end_start_value, step_units }; + if (self->end_step == NULL) { + *val = start_step.value(); + } + else { + if ((ret = grib_get_double_internal(h, self->end_step, &end_step_value)) != GRIB_SUCCESS) + return ret; + eccodes::Step end_step{ end_step_value, step_units }; + *val = end_step.value(); + } + } + catch (std::exception& e) { + grib_context_log(a->context, GRIB_LOG_ERROR, "grid_accessor_g2step_range::unpack_double: %s", e.what()); + return GRIB_DECODING_ERROR; + } + + return GRIB_SUCCESS; +} + +int grib_accessor_class_g2step_range_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_STRING; +} diff --git a/src/accessor/grib_accessor_class_g2step_range.h b/src/accessor/grib_accessor_class_g2step_range.h new file mode 100644 index 000000000..ec44546b3 --- /dev/null +++ b/src/accessor/grib_accessor_class_g2step_range.h @@ -0,0 +1,37 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_g2step_range_t : public grib_accessor_gen_t +{ +public: + /* Members defined in g2step_range */ + const char* start_step; + const char* end_step; +}; + +class grib_accessor_class_g2step_range_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_g2step_range_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_g2step_range_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_gaussian_grid_name.cc b/src/accessor/grib_accessor_class_gaussian_grid_name.cc new file mode 100644 index 000000000..f6b79e794 --- /dev/null +++ b/src/accessor/grib_accessor_class_gaussian_grid_name.cc @@ -0,0 +1,88 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_gaussian_grid_name.h" + +grib_accessor_class_gaussian_grid_name_t _grib_accessor_class_gaussian_grid_name{ "gaussian_grid_name" }; +grib_accessor_class* grib_accessor_class_gaussian_grid_name = &_grib_accessor_class_gaussian_grid_name; + + +void grib_accessor_class_gaussian_grid_name_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_gen_t::init(a, len, arg); + grib_accessor_gaussian_grid_name_t* self = (grib_accessor_gaussian_grid_name_t*)a; + int n = 0; + + self->N = grib_arguments_get_name(a->parent->h, arg, n++); + self->Ni = grib_arguments_get_name(a->parent->h, arg, n++); + self->isOctahedral = grib_arguments_get_name(a->parent->h, arg, n++); + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; +} + +int grib_accessor_class_gaussian_grid_name_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_STRING; +} + +#define MAX_GRIDNAME_LEN 16 + +int grib_accessor_class_gaussian_grid_name_t::unpack_string(grib_accessor* a, char* v, size_t* len) +{ + grib_accessor_gaussian_grid_name_t* self = (grib_accessor_gaussian_grid_name_t*)a; + + long N = 0, Ni = 0; + char tmp[MAX_GRIDNAME_LEN] = {0,}; + size_t length = 0; + int ret = GRIB_SUCCESS; + + if ((ret = grib_get_long_internal(a->parent->h, self->N, &N)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(a->parent->h, self->Ni, &Ni)) != GRIB_SUCCESS) + return ret; + + if (Ni == GRIB_MISSING_LONG) { + /* Reduced gaussian grid */ + long isOctahedral = 0; + if ((ret = grib_get_long_internal(a->parent->h, self->isOctahedral, &isOctahedral)) != GRIB_SUCCESS) + return ret; + if (isOctahedral == 1) { + snprintf(tmp, sizeof(tmp), "O%ld", N); + } + else { + snprintf(tmp, sizeof(tmp), "N%ld", N); /* Classic */ + } + } + else { + /* Regular gaussian grid */ + snprintf(tmp, sizeof(tmp), "F%ld", N); + } + length = strlen(tmp) + 1; + + if (*len < length) { + const char* cclass_name = a->cclass->name; + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, length, *len); + *len = length; + return GRIB_BUFFER_TOO_SMALL; + } + + strcpy(v, tmp); + *len = length; + return GRIB_SUCCESS; +} + +size_t grib_accessor_class_gaussian_grid_name_t::string_length(grib_accessor* a) +{ + return MAX_GRIDNAME_LEN; +} diff --git a/src/accessor/grib_accessor_class_gaussian_grid_name.h b/src/accessor/grib_accessor_class_gaussian_grid_name.h new file mode 100644 index 000000000..d67f80aa5 --- /dev/null +++ b/src/accessor/grib_accessor_class_gaussian_grid_name.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_gaussian_grid_name_t : public grib_accessor_gen_t +{ +public: + /* Members defined in gaussian_grid_name */ + const char* N; + const char* Ni; + const char* isOctahedral; +}; + +class grib_accessor_class_gaussian_grid_name_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_gaussian_grid_name_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_gaussian_grid_name_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_gds_is_present.cc b/src/accessor/grib_accessor_class_gds_is_present.cc new file mode 100644 index 000000000..b568b9bdd --- /dev/null +++ b/src/accessor/grib_accessor_class_gds_is_present.cc @@ -0,0 +1,89 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_gds_is_present.h" + +grib_accessor_class_gds_is_present_t _grib_accessor_class_gds_is_present{ "gds_is_present" }; +grib_accessor_class* grib_accessor_class_gds_is_present = &_grib_accessor_class_gds_is_present; + + +void grib_accessor_class_gds_is_present_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + int n = 0; + grib_accessor_gds_is_present_t* self = (grib_accessor_gds_is_present_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + self->gds_present = grib_arguments_get_name(h, c, n++); + self->grid_definition = grib_arguments_get_name(h, c, n++); + self->bitmap_present = grib_arguments_get_name(h, c, n++); + self->values = grib_arguments_get_name(h, c, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; + a->length = 0; +} + +int grib_accessor_class_gds_is_present_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + grib_accessor_gds_is_present_t* self = (grib_accessor_gds_is_present_t*)a; + long missing = 255; + int ret = 0; + size_t size = 0; + double* values = NULL; + grib_context* c = a->context; + grib_handle* h = grib_handle_of_accessor(a); + + if (*val != 1) + return GRIB_NOT_IMPLEMENTED; + + if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) + return ret; + + values = (double*)grib_context_malloc(c, size * sizeof(double)); + if (!values) + return GRIB_OUT_OF_MEMORY; + + if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + if ((ret = grib_set_long_internal(h, self->gds_present, *val)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_set_long_internal(h, self->bitmap_present, *val)) != GRIB_SUCCESS) + return ret; + + + if ((ret = grib_set_long_internal(h, self->grid_definition, missing)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) + return ret; + + grib_context_free(c, values); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_gds_is_present_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + int ret = 0; + grib_handle* h = grib_handle_of_accessor(a); + grib_accessor_gds_is_present_t* self = (grib_accessor_gds_is_present_t*)a; + + if ((ret = grib_get_long_internal(h, self->gds_present, val)) != GRIB_SUCCESS) + return ret; + + *len = 1; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_gds_is_present.h b/src/accessor/grib_accessor_class_gds_is_present.h new file mode 100644 index 000000000..d69619d44 --- /dev/null +++ b/src/accessor/grib_accessor_class_gds_is_present.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_gds_is_present_t : public grib_accessor_long_t +{ +public: + /* Members defined in gds_is_present */ + const char* gds_present; + const char* grid_definition; + const char* bitmap_present; + const char* values; +}; + +class grib_accessor_class_gds_is_present_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_gds_is_present_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_gds_is_present_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_gds_not_present_bitmap.cc b/src/accessor/grib_accessor_class_gds_not_present_bitmap.cc new file mode 100644 index 000000000..6691e2fea --- /dev/null +++ b/src/accessor/grib_accessor_class_gds_not_present_bitmap.cc @@ -0,0 +1,109 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_gds_not_present_bitmap.h" + +grib_accessor_class_gds_not_present_bitmap_t _grib_accessor_class_gds_not_present_bitmap{"gds_not_present_bitmap"}; +grib_accessor_class* grib_accessor_class_gds_not_present_bitmap = &_grib_accessor_class_gds_not_present_bitmap; + + +void grib_accessor_class_gds_not_present_bitmap_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, v, args); + int n = 0; + grib_accessor_gds_not_present_bitmap_t* self = (grib_accessor_gds_not_present_bitmap_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + + self->missing_value = grib_arguments_get_name(hand, args, n++); + self->number_of_values = grib_arguments_get_name(hand, args, n++); + self->number_of_points = grib_arguments_get_name(hand, args, n++); + self->latitude_of_first_point = grib_arguments_get_name(hand, args, n++); + self->ni = grib_arguments_get_name(hand, args, n++); + a->length = 0; +} + +int grib_accessor_class_gds_not_present_bitmap_t::value_count(grib_accessor* a, long* number_of_points){ + grib_accessor_gds_not_present_bitmap_t* self = (grib_accessor_gds_not_present_bitmap_t*)a; + *number_of_points = 0; + return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_points, number_of_points); +} + +int grib_accessor_class_gds_not_present_bitmap_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_gds_not_present_bitmap_t* self = (grib_accessor_gds_not_present_bitmap_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + + long number_of_points = 0, number_of_values = 0, ni = 0; + long latitude_of_first_point = 0; + size_t i = 0; + size_t n_vals = 0; + long nn = 0; + long missing_value; + + double* coded_vals = NULL; + int err = a->value_count(&nn); + n_vals = nn; + if (err) + return err; + + if ((err = grib_get_long(hand, self->number_of_points, &number_of_points)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_long(hand, self->number_of_values, &number_of_values)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_long(hand, self->latitude_of_first_point, &latitude_of_first_point)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_long(hand, self->missing_value, &missing_value)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_long(hand, self->ni, &ni)) != GRIB_SUCCESS) + return err; + + if (*len < number_of_points) { + *len = n_vals; + return GRIB_ARRAY_TOO_SMALL; + } + + if (number_of_values > 0) { + coded_vals = (double*)grib_context_malloc(a->context, number_of_values * sizeof(double)); + + if (coded_vals == NULL) + return GRIB_OUT_OF_MEMORY; + } + + if (latitude_of_first_point == 0) { + for (i = 0; i < number_of_values; i++) + val[i] = 1; + for (i = number_of_values; i < number_of_points; i++) + val[i] = 0; + } + else { + for (i = 0; i < ni - 1; i++) + val[i] = 0; + for (i = ni - 1; i < number_of_points; i++) + val[i] = 1; + } + + *len = number_of_points; + + grib_context_free(a->context, coded_vals); + return err; +} + +int grib_accessor_class_gds_not_present_bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + // See deprecated/grib_accessor_class_gds_not_present_bitmap.cc for + // a possible implementation + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_gds_not_present_bitmap_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_DOUBLE; +} diff --git a/src/accessor/grib_accessor_class_gds_not_present_bitmap.h b/src/accessor/grib_accessor_class_gds_not_present_bitmap.h new file mode 100644 index 000000000..bf9c0c012 --- /dev/null +++ b/src/accessor/grib_accessor_class_gds_not_present_bitmap.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_gds_not_present_bitmap_t : public grib_accessor_gen_t +{ +public: + /* Members defined in gds_not_present_bitmap */ + const char* missing_value; + const char* number_of_values; + const char* number_of_points; + const char* latitude_of_first_point; + const char* ni; +}; + +class grib_accessor_class_gds_not_present_bitmap_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_gds_not_present_bitmap_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_gds_not_present_bitmap_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_gen.cc b/src/accessor/grib_accessor_class_gen.cc new file mode 100644 index 000000000..7223f39a9 --- /dev/null +++ b/src/accessor/grib_accessor_class_gen.cc @@ -0,0 +1,751 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor.h" +#include "grib_accessor_class_gen.h" +#include + +// ======================== grib_accessor_gen ======================== +void grib_accessor_gen_t::dump(grib_dumper* f) +{ + return cclass->dump(this, f); +} +int grib_accessor_gen_t::pack_missing() +{ + // grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); + return cclass->pack_missing(this); +} +// int grib_accessor_gen_t::pack_zero(grib_accessor* a) +// { +// return cclass->clear(a); +// } + +int grib_accessor_gen_t::is_missing_internal() +{ + return cclass->is_missing(this); +} + +int grib_accessor_gen_t::pack_double(const double* v, size_t* len) +{ + return cclass->pack_double(this, v, len); +} + +int grib_accessor_gen_t::pack_float(const float* v, size_t* len) +{ + return cclass->pack_float(this, v, len); +} + +int grib_accessor_gen_t::pack_expression(grib_expression* e) +{ + return cclass->pack_expression(this, e); +} + +int grib_accessor_gen_t::pack_string(const char* v, size_t* len) +{ + return cclass->pack_string(this, v, len); +} + +int grib_accessor_gen_t::pack_string_array(const char** v, size_t* len) +{ + return cclass->pack_string_array(this, v, len); +} + +int grib_accessor_gen_t::pack_long(const long* v, size_t* len) +{ + return cclass->pack_long(this, v, len); +} + +int grib_accessor_gen_t::pack_bytes(const unsigned char* v, size_t* len) +{ + return cclass->pack_bytes(this, v, len); +} + +int grib_accessor_gen_t::unpack_bytes(unsigned char* v, size_t* len) +{ + return cclass->unpack_bytes(this, v, len); +} + +int grib_accessor_gen_t::unpack_double_subarray(double* v, size_t start, size_t len) +{ + return cclass->unpack_double_subarray(this, v, start, len); +} + +int grib_accessor_gen_t::unpack_double(double* v, size_t* len) +{ + return cclass->unpack_double(this, v, len); +} + +int grib_accessor_gen_t::unpack_float(float* v, size_t* len) +{ + return cclass->unpack_float(this, v, len); +} + +int grib_accessor_gen_t::unpack_double_element(size_t i, double* v) +{ + return cclass->unpack_double_element(this, i, v); +} + +int grib_accessor_gen_t::unpack_float_element(size_t i, float* v) +{ + // return cclass->unpack_float_element(this, i, v); + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_gen_t::unpack_long(long* v, size_t* len) +{ + return cclass->unpack_long(this, v, len); +} + +long grib_accessor_gen_t::get_native_type() +{ + return cclass->get_native_type(this); +} + +long grib_accessor_gen_t::get_next_position_offset() +{ + return cclass->next_offset(this); +} + +long grib_accessor_gen_t::string_length() +{ + return cclass->string_length(this); +} + +long grib_accessor_gen_t::byte_offset() +{ + return cclass->byte_offset(this); +} + +long grib_accessor_gen_t::byte_count() +{ + return cclass->byte_count(this); +} + +int grib_accessor_gen_t::value_count(long* count) +{ + return cclass->value_count(this, count); +} + +int grib_accessor_gen_t::notify_change(grib_accessor* changed) +{ + return cclass->notify_change(this, changed); +} + +// Get the values for the indices passed in. +// The length of the 'index_array' argument should be 'len' and 'val_array' should also contain at least 'len' elements +int grib_accessor_gen_t::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) +{ + return cclass->unpack_double_element_set(this, index_array, len, val_array); +} +int grib_accessor_gen_t::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) +{ + throw std::runtime_error("grib_unpack_float_element_set not implemented"); +} +int grib_accessor_gen_t::unpack_string(char* v, size_t* len) +{ + return cclass->unpack_string(this, v, len); +} +int grib_accessor_gen_t::unpack_string_array(char** v, size_t* len) +{ + return cclass->unpack_string_array(this, v, len); +} + +void grib_accessor_gen_t::init_accessor(const long len, grib_arguments* args) +{ + this->cclass->init(this, len, args); +} + +grib_accessor* grib_accessor_gen_t::clone(grib_section* s, int* err) +{ + grib_context* ct = this->context; + grib_context_log(ct, GRIB_LOG_DEBUG, "clone %s ==> %s", cclass->name, this->name); + return cclass->make_clone(this, s, err); +} + +void grib_accessor_gen_t::update_size(size_t len) +{ + cclass->update_size(this, len); +} + +int grib_accessor_gen_t::nearest_smaller_value(double val, double* nearest) +{ + return cclass->nearest_smaller_value(this, val, nearest); +} + +size_t grib_accessor_gen_t::preferred_size(int from_handle) +{ + return cclass->preferred_size(this, from_handle); +} + +grib_accessor* grib_accessor_gen_t::next_accessor() +{ + return cclass->next(this, 1); +} + +void grib_accessor_gen_t::resize(size_t new_size) +{ + cclass->resize(this, new_size); +} + +// For this one, ALL destroy are called +void grib_accessor_gen_t::destroy(grib_context* ct) +{ + cclass->destroy(ct, this); + delete this; +} + + + + +// ======================== grib_accessor_class_gen ======================== + + +grib_accessor_class_gen_t _grib_accessor_class_gen = grib_accessor_class_gen_t("gen"); +grib_accessor_class* grib_accessor_class_gen = &_grib_accessor_class_gen; + +void grib_accessor_class_gen_t::init(grib_accessor* a, const long len, grib_arguments* param) +{ + grib_action* act = (grib_action*)(a->creator); + if (a->flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { + a->length = 0; + if (!a->vvalue) + a->vvalue = (grib_virtual_value*)grib_context_malloc_clear(a->context, sizeof(grib_virtual_value)); + a->vvalue->type = a->get_native_type(); + a->vvalue->length = len; + if (act->default_value != NULL) { + const char* p = 0; + size_t s_len = 1; + long l; + int ret = 0; + double d; + char tmp[1024]; + grib_expression* expression = grib_arguments_get_expression(grib_handle_of_accessor(a), act->default_value, 0); + int type = grib_expression_native_type(grib_handle_of_accessor(a), expression); + switch (type) { + // TODO(maee): add single-precision case + + case GRIB_TYPE_DOUBLE: + grib_expression_evaluate_double(grib_handle_of_accessor(a), expression, &d); + a->pack_double(&d, &s_len); + break; + + case GRIB_TYPE_LONG: + grib_expression_evaluate_long(grib_handle_of_accessor(a), expression, &l); + a->pack_long(&l, &s_len); + break; + + default: + s_len = sizeof(tmp); + p = grib_expression_evaluate_string(grib_handle_of_accessor(a), expression, tmp, &s_len, &ret); + if (ret != GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to evaluate %s as string", a->name); + Assert(0); + } + s_len = strlen(p) + 1; + a->pack_string(p, &s_len); + break; + } + } + } + else { + a->length = len; + } +} + +void grib_accessor_class_gen_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + const int type = a->get_native_type(); + switch (type) { + case GRIB_TYPE_STRING: + grib_dump_string(dumper, a, NULL); + break; + case GRIB_TYPE_DOUBLE: + grib_dump_double(dumper, a, NULL); + break; + case GRIB_TYPE_LONG: + grib_dump_long(dumper, a, NULL); + break; + default: + grib_dump_bytes(dumper, a, NULL); + } +} + +long grib_accessor_class_gen_t::next_offset(grib_accessor* a) +{ + return a->offset + a->length; +} + +int grib_accessor_class_gen_t::value_count(grib_accessor* a, long* count) +{ + *count = 1; + return 0; +} + +size_t grib_accessor_class_gen_t::string_length(grib_accessor* a) +{ + return 1024; +} + +long grib_accessor_class_gen_t::byte_count(grib_accessor* a) +{ + return a->length; +} + +int grib_accessor_class_gen_t::get_native_type(grib_accessor* a) +{ + grib_context_log(a->context, GRIB_LOG_ERROR, + "Accessor %s [%s] must implement 'get_native_type'", a->name, a->cclass->name); + return GRIB_TYPE_UNDEFINED; +} + +long grib_accessor_class_gen_t::byte_offset(grib_accessor* a) +{ + return a->offset; +} + +int grib_accessor_class_gen_t::unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len) +{ + unsigned char* buf = grib_handle_of_accessor(a)->buffer->data; + const long length = a->byte_count(); + const long offset = a->byte_offset(); + + if (*len < length) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it is %ld bytes long", a->name, length); + *len = length; + return GRIB_ARRAY_TOO_SMALL; + } + + memcpy(val, buf + offset, length); + *len = length; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_gen_t::clear(grib_accessor* a) +{ + unsigned char* buf = grib_handle_of_accessor(a)->buffer->data; + const long length = a->byte_count(); + const long offset = a->byte_offset(); + + memset(buf + offset, 0, length); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_gen_t::unpack_long(grib_accessor* a, long* v, size_t* len) +{ + is_overridden_[UNPACK_LONG] = 0; + int type = GRIB_TYPE_UNDEFINED; + if (is_overridden_[UNPACK_DOUBLE] == 1) { + double val = 0.0; + size_t l = 1; + a->unpack_double(&val, &l); + if (is_overridden_[UNPACK_DOUBLE] == 1) { + if (val == GRIB_MISSING_DOUBLE) + *v = GRIB_MISSING_LONG; + else + *v = (long)val; + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting double %s to long", a->name); + return GRIB_SUCCESS; + } + } + + if (is_overridden_[UNPACK_STRING] == 1) { + char val[1024]; + size_t l = sizeof(val); + char* last = NULL; + a->unpack_string(val, &l); + + if (is_overridden_[UNPACK_STRING] == 1) { + *v = strtol(val, &last, 10); + + if (*last == 0) { + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting string %s to long", a->name); + return GRIB_SUCCESS; + } + } + } + + grib_context_log(a->context, GRIB_LOG_ERROR, "Cannot unpack key '%s' as long", a->name); + if (grib_get_native_type(grib_handle_of_accessor(a), a->name, &type) == GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Try unpacking as %s", grib_get_type_name(type)); + } + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_gen_t::unpack_double(grib_accessor* a, double* v, size_t* len) +{ + return unpack_helper(a, v, len); +} + +int grib_accessor_class_gen_t::unpack_float(grib_accessor* a, float* v, size_t* len) +{ + return unpack_helper(a, v, len); +} + +int grib_accessor_class_gen_t::unpack_string(grib_accessor* a, char* v, size_t* len) +{ + is_overridden_[UNPACK_STRING] = 0; + + int err = 0; + if (is_overridden_[UNPACK_DOUBLE] == 1) { + double val = 0.0; + size_t l = 1; + err = a->unpack_double(&val, &l); + if (is_overridden_[UNPACK_DOUBLE] == 1) { + if (err) return err; + snprintf(v, 64, "%g", val); + *len = strlen(v); + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting double %s to string", a->name); + return GRIB_SUCCESS; + } + } + + if (is_overridden_[UNPACK_LONG] == 1) { + long val = 0; + size_t l = 1; + err = a->unpack_long(&val, &l); + if (is_overridden_[UNPACK_LONG] == 1) { + if (err) return err; + snprintf(v, 64, "%ld", val); + *len = strlen(v); + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to string\n", a->name); + return GRIB_SUCCESS; + } + } + + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_gen_t::unpack_string_array(grib_accessor* a, char** v, size_t* len) +{ + size_t length = 0; + + int err = grib_get_string_length_acc(a, &length); + if (err) + return err; + v[0] = (char*)grib_context_malloc_clear(a->context, length); + a->unpack_string(v[0], &length); // TODO(masn): check return value + *len = 1; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_gen_t::pack_expression(grib_accessor* a, grib_expression* e) +{ + size_t len = 1; + long lval = 0; + double dval = 0; + const char* cval = NULL; + int ret = 0; + grib_handle* hand = grib_handle_of_accessor(a); + + // Use the native type of the expression not the accessor + switch (grib_expression_native_type(hand, e)) { + case GRIB_TYPE_LONG: { + len = 1; + ret = grib_expression_evaluate_long(hand, e, &lval); + if (ret != GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as long (from %s)", + a->name, e->cclass->name); + return ret; + } + /*if (hand->context->debug) + printf("ECCODES DEBUG grib_accessor_class_gen_t::pack_expression %s %ld\n", a->name,lval);*/ + return a->pack_long(&lval, &len); + } + + case GRIB_TYPE_DOUBLE: { + len = 1; + ret = grib_expression_evaluate_double(hand, e, &dval); + if (ret != GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as double (from %s)", + a->name, e->cclass->name); + return ret; + } + /*if (hand->context->debug) + printf("ECCODES DEBUG grib_accessor_class_gen_t::pack_expression %s %g\n", a->name, dval);*/ + return a->pack_double(&dval, &len); + } + + case GRIB_TYPE_STRING: { + char tmp[1024]; + len = sizeof(tmp); + cval = grib_expression_evaluate_string(hand, e, tmp, &len, &ret); + if (ret != GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as string (from %s)", + a->name, e->cclass->name); + return ret; + } + len = strlen(cval); + /*if (hand->context->debug) + printf("ECCODES DEBUG grib_accessor_class_gen_t::pack_expression %s %s\n", a->name, cval);*/ + return a->pack_string(cval, &len); + } + } + + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_gen_t::pack_long(grib_accessor* a, const long* v, size_t* len) +{ + is_overridden_[PACK_LONG] = 0; + grib_context* c = a->context; + if (is_overridden_[PACK_DOUBLE]) { + double* val = (double*)grib_context_malloc(c, *len * (sizeof(double))); + if (!val) { + grib_context_log(c, GRIB_LOG_ERROR, "Unable to allocate %zu bytes", *len * (sizeof(double))); + return GRIB_OUT_OF_MEMORY; + } + for (size_t i = 0; i < *len; i++) + val[i] = v[i]; + int ret = a->pack_double(val, len); + grib_context_free(c, val); + if (is_overridden_[PACK_DOUBLE]) { + return ret; + } + } + + grib_context_log(c, GRIB_LOG_ERROR, "Should not pack '%s' as an integer", a->name); + if (is_overridden_[PACK_STRING]) { + grib_context_log(c, GRIB_LOG_ERROR, "Try packing as a string"); + } + + return GRIB_NOT_IMPLEMENTED; +} + +int pack_double_array_as_long(grib_accessor* a, const double* v, size_t* len) +{ + grib_context* c = a->context; + int ret = GRIB_SUCCESS; + size_t numBytes = *len * (sizeof(long)); + long* lValues = (long*)grib_context_malloc(c, numBytes); + if (!lValues) { + grib_context_log(c, GRIB_LOG_ERROR, "Unable to allocate %ld bytes", numBytes); + return GRIB_OUT_OF_MEMORY; + } + for (size_t i = 0; i < *len; i++) + lValues[i] = (long)v[i]; /* convert from double to long */ + ret = a->pack_long(lValues, len); + grib_context_free(c, lValues); + return ret; +} + +int grib_accessor_class_gen_t::pack_double(grib_accessor* a, const double* v, size_t* len) +{ + is_overridden_[PACK_DOUBLE] = 0; + grib_context* c = a->context; + + if (is_overridden_[PACK_LONG] || strcmp(a->cclass->name, "codetable") == 0) { + /* ECC-648: Special case of codetable */ + return pack_double_array_as_long(a, v, len); + } + + grib_context_log(c, GRIB_LOG_ERROR, "Should not pack '%s' as a double", a->name); + if (is_overridden_[PACK_STRING]) { + grib_context_log(c, GRIB_LOG_ERROR, "Try packing as a string"); + } + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_gen_t::pack_string_array(grib_accessor* a, const char** v, size_t* len) +{ + int err = 0; + size_t length = 0; + grib_accessor* as = 0; + + as = a; + long i = (long)*len - 1; + while (as && i >= 0) { + length = strlen(v[i]); + err = as->pack_string(v[i], &length); + if (err) + return err; + --i; + as = as->same; + } + return GRIB_SUCCESS; +} + +int grib_accessor_class_gen_t::pack_string(grib_accessor* a, const char* v, size_t* len) +{ + is_overridden_[PACK_STRING] = 0; + if (is_overridden_[PACK_DOUBLE]) { + size_t l = 1; + char* endPtr = NULL; /* for error handling */ + double val = strtod(v, &endPtr); + if (*endPtr) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Invalid value (%s) for key '%s'. String cannot be converted to a double", + __func__, v, a->name); + return GRIB_WRONG_TYPE; + } + return a->pack_double(&val, &l); + } + + if (is_overridden_[PACK_LONG]) { + size_t l = 1; + long val = atol(v); + int err = a->pack_long(&val, &l); + if (is_overridden_[PACK_LONG]) { + return err; + } + } + + grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack '%s' as string", a->name); + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_gen_t::pack_bytes(grib_accessor* a, const unsigned char* val, size_t* len) +{ + const size_t length = *len; + if (length != a->length) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "pack_bytes: Wrong size (%zu) for %s. It is %ld bytes long", + length, a->name, a->length); + return GRIB_BUFFER_TOO_SMALL; + } + grib_buffer_replace(a, val, length, 1, 1); + return GRIB_SUCCESS; +} + +void grib_accessor_class_gen_t::destroy(grib_context* ct, grib_accessor* a) +{ + grib_dependency_remove_observed(a); + grib_dependency_remove_observer(a); + if (a->vvalue != NULL) { + grib_context_free(ct, a->vvalue); + a->vvalue = NULL; + } + /*grib_context_log(ct,GRIB_LOG_DEBUG,"address=%p",a);*/ +} + +grib_section* grib_accessor_class_gen_t::sub_section(grib_accessor* a) +{ + return NULL; +} + +int grib_accessor_class_gen_t::notify_change(grib_accessor* self, grib_accessor* observed) +{ + /* Default behaviour is to notify creator */ + return grib_action_notify_change(self->creator, self, observed); +} + +void grib_accessor_class_gen_t::update_size(grib_accessor* a, size_t s) +{ + grib_context_log(a->context, GRIB_LOG_FATAL, + "Accessor %s [%s] must implement 'update_size'", a->name, a->cclass->name); +} + +grib_accessor* grib_accessor_class_gen_t::next(grib_accessor* a, int mod) +{ + grib_accessor* next = NULL; + if (a->next_) { + next = a->next_; + } + else { + if (a->parent->owner) + next = a->parent->owner->cclass->next(a->parent->owner, 0); + } + return next; +} + +int grib_accessor_class_gen_t::compare(grib_accessor* a, grib_accessor* b) +{ + return GRIB_NOT_IMPLEMENTED; +} + +/* Redefined in all padding */ + +size_t grib_accessor_class_gen_t::preferred_size(grib_accessor* a, int from_handle) +{ + return a->length; +} + +int grib_accessor_class_gen_t::is_missing(grib_accessor* a) +{ + int i = 0; + int is_missing = 1; + unsigned char ones = 0xff; + unsigned char* v = NULL; + + if (a->flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { + if (a->vvalue == NULL) { + grib_context_log(a->context, GRIB_LOG_ERROR, "%s internal error (flags=0x%lX)", a->name, a->flags); + Assert(!"grib_accessor_class_gen_t::is_missing(): a->vvalue == NULL"); + return 0; + } + return a->vvalue->missing; + } + Assert(a->length >= 0); + + v = grib_handle_of_accessor(a)->buffer->data + a->offset; + + for (i = 0; i < a->length; i++) { + if (*v != ones) { + is_missing = 0; + break; + } + v++; + } + + return is_missing; +} + +int grib_accessor_class_gen_t::unpack_double_element(grib_accessor* a, size_t i, double* val) +{ + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_gen_t::unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) +{ + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_gen_t::unpack_double_subarray(grib_accessor* a, double* val, size_t start, size_t len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +grib_accessor* grib_accessor_class_gen_t::make_clone(grib_accessor* a, grib_section* s, int* err) +{ + *err = GRIB_NOT_IMPLEMENTED; + return NULL; +} + + + + +grib_accessor_class_gen_t::~grib_accessor_class_gen_t(){}; + +void grib_accessor_class_gen_t::post_init(grib_accessor*){ + return; +}; +int grib_accessor_class_gen_t::pack_missing(grib_accessor*) { + throw std::runtime_error("grib_accessor_class_gen_t::pack_missing not implemented"); +}; +int grib_accessor_class_gen_t::pack_float(grib_accessor*, const float*, size_t* len) { + throw std::runtime_error("grib_accessor_class_gen_t::pack_float not implemented"); +}; +void grib_accessor_class_gen_t::resize(grib_accessor*, size_t) { + throw std::runtime_error("grib_accessor_class_gen_t::resize not implemented"); +}; +int grib_accessor_class_gen_t::nearest_smaller_value(grib_accessor*, double, double*) { + throw std::runtime_error("grib_accessor_class_gen_t::nearest_smaller_value not implemented"); +}; +int grib_accessor_class_gen_t::unpack_float_element(grib_accessor*, size_t, float*) { + throw std::runtime_error("grib_accessor_class_gen_t::unpack_float_element not implemented"); +}; +int unpack_element_set(grib_accessor*, const size_t*, size_t, double*) { + throw std::runtime_error("grib_accessor_class_gen_t::unpack_element_set not implemented"); +}; +int grib_accessor_class_gen_t::unpack_float_element_set(grib_accessor*, const size_t*, size_t, float*) { + throw std::runtime_error("grib_accessor_class_gen_t::unpack_float_element_set not implemented"); +}; diff --git a/src/accessor/grib_accessor_class_gen.h b/src/accessor/grib_accessor_class_gen.h new file mode 100644 index 000000000..deba6cad2 --- /dev/null +++ b/src/accessor/grib_accessor_class_gen.h @@ -0,0 +1,168 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_api_internal.h" +#include "grib_accessor.h" +#include + +class grib_accessor_gen_t : public grib_accessor { + void init_accessor(const long, grib_arguments*) override; + void dump(grib_dumper* f) override; + int pack_missing() override; + //int grib_pack_zero(grib_accessor* a) override; + int is_missing_internal() override; + int pack_double(const double* v, size_t* len) override; + int pack_float(const float* v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int pack_string(const char* v, size_t* len) override; + int pack_string_array(const char** v, size_t* len) override; + int pack_long(const long* v, size_t* len) override; + int pack_bytes(const unsigned char* v, size_t* len) override; + int unpack_bytes(unsigned char* v, size_t* len) override; + int unpack_double_subarray(double* v, size_t start, size_t len) override; + int unpack_double(double* v, size_t* len) override; + int unpack_float(float* v, size_t* len) override; + int unpack_double_element(size_t i, double* v) override; + int unpack_float_element(size_t i, float* v) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_string(char* v, size_t* len) override; + int unpack_string_array(char** v, size_t* len) override; + int unpack_long(long* v, size_t* len) override; + long get_native_type() override; + long get_next_position_offset() override; + long string_length() override; + long byte_offset() override; + long byte_count() override; + int value_count(long* count) override; + int notify_change(grib_accessor* changed) override; + grib_accessor* clone(grib_section* s, int* err) override; + void update_size(size_t len) override; + int nearest_smaller_value(double val, double* nearest) override; + size_t preferred_size(int from_handle) override; + grib_accessor* next_accessor() override; + void resize(size_t new_size) override; + void destroy(grib_context* ct) override; +}; + +class grib_accessor_class_gen_t : public grib_accessor_class +{ +public: + grib_accessor_class_gen_t(const char* name) : grib_accessor_class{name} {} + ~grib_accessor_class_gen_t(); + + grib_accessor* create_empty_accessor() override{ return new grib_accessor_gen_t(); } + grib_section* sub_section(grib_accessor* a) override; + int get_native_type(grib_accessor*) override; + int pack_missing(grib_accessor*) override; + int is_missing(grib_accessor*) override; + int pack_bytes(grib_accessor*, const unsigned char*, size_t* len) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_float(grib_accessor*, const float* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int pack_string_array(grib_accessor*, const char**, size_t* len) override; + int pack_expression(grib_accessor*, grib_expression*) override; + int unpack_bytes(grib_accessor*, unsigned char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int unpack_string_array(grib_accessor*, char**, size_t* len) override; + size_t string_length(grib_accessor*) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void post_init(grib_accessor*) override; + int notify_change(grib_accessor*, grib_accessor*) override; + void update_size(grib_accessor*, size_t) override; + size_t preferred_size(grib_accessor*, int) override; + void resize(grib_accessor*, size_t) override; + int nearest_smaller_value(grib_accessor*, double, double*) override; + grib_accessor* next(grib_accessor*, int) override; + int compare(grib_accessor*, grib_accessor*) override; + int unpack_double_element(grib_accessor*, size_t i, double* val) override; + int unpack_float_element(grib_accessor*, size_t i, float* val) override; + int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(grib_accessor*, const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(grib_accessor*, double* val, size_t start, size_t len) override; + int clear(grib_accessor*) override; + grib_accessor* make_clone(grib_accessor*, grib_section*, int*) override; + + template + int unpack_helper(grib_accessor* a, T* v, size_t* len); + +private: + enum { + PACK_DOUBLE, + PACK_FLOAT, + PACK_LONG, + PACK_STRING, + UNPACK_DOUBLE, + UNPACK_FLOAT, + UNPACK_LONG, + UNPACK_STRING, + }; + std::bitset<8> is_overridden_ = 0b11111111; +}; + + +template +int grib_accessor_class_gen_t::unpack_helper(grib_accessor* a, T* v, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating point numbers"); + int type = GRIB_TYPE_UNDEFINED; + const char* Tname = type_to_string(*v); + + if constexpr (std::is_same_v) { + is_overridden_[UNPACK_FLOAT] = 0; + } + else if constexpr (std::is_same_v) { + is_overridden_[UNPACK_DOUBLE] = 0; + } + + if (is_overridden_[UNPACK_LONG]) { + long val = 0; + size_t l = 1; + a->unpack_long(&val, &l); + if (is_overridden_[UNPACK_LONG]) { + *v = val; + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to %s", a->name, Tname); + return GRIB_SUCCESS; + } + } + + if (is_overridden_[UNPACK_STRING]) { + char val[1024]; + size_t l = sizeof(val); + char* last = NULL; + a->unpack_string(val, &l); + if (is_overridden_[UNPACK_STRING]) { + *v = strtod(val, &last); + if (*last == 0) { /* conversion of string to double worked */ + grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting string %s to %s", a->name, Tname); + return GRIB_SUCCESS; + } + } + } + + grib_context_log(a->context, GRIB_LOG_ERROR, "Cannot unpack key '%s' as %s", a->name, Tname); + if (grib_get_native_type(grib_handle_of_accessor(a), a->name, &type) == GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Try unpacking as %s", grib_get_type_name(type)); + } + + return GRIB_NOT_IMPLEMENTED; +} diff --git a/src/accessor/grib_accessor_class_getenv.cc b/src/accessor/grib_accessor_class_getenv.cc new file mode 100644 index 000000000..d812cc276 --- /dev/null +++ b/src/accessor/grib_accessor_class_getenv.cc @@ -0,0 +1,62 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_getenv.h" + +grib_accessor_class_getenv_t _grib_accessor_class_getenv{"getenv"}; +grib_accessor_class* grib_accessor_class_getenv = &_grib_accessor_class_getenv; + + +void grib_accessor_class_getenv_t::init(grib_accessor* a, const long l, grib_arguments* args){ + grib_accessor_class_ascii_t::init(a, l, args); + grib_accessor_getenv_t* self = (grib_accessor_getenv_t*)a; + static char undefined[] = "undefined"; + + self->name = grib_arguments_get_string(grib_handle_of_accessor(a), args, 0); + self->default_value = grib_arguments_get_string(grib_handle_of_accessor(a), args, 1); + if (!self->default_value) + self->default_value = undefined; + self->value = 0; +} + +int grib_accessor_class_getenv_t::pack_string(grib_accessor* a, const char* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_getenv_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_getenv_t* self = (grib_accessor_getenv_t*)a; + char* v = 0; + size_t l = 0; + + if (!self->value) { + v = getenv(self->name); + if (!v) + v = (char*)self->default_value; + self->value = v; + } + + l = strlen(self->value); + if (*len < l) + return GRIB_BUFFER_TOO_SMALL; + snprintf(val, 1024, "%s", self->value); + *len = strlen(self->value); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_getenv_t::value_count(grib_accessor* a, long* count){ + *count = 1; + return 0; +} + +size_t grib_accessor_class_getenv_t::string_length(grib_accessor* a){ + return 1024; +} diff --git a/src/accessor/grib_accessor_class_getenv.h b/src/accessor/grib_accessor_class_getenv.h new file mode 100644 index 000000000..b04c58a4d --- /dev/null +++ b/src/accessor/grib_accessor_class_getenv.h @@ -0,0 +1,34 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_getenv_t : public grib_accessor_ascii_t +{ +public: + const char* name; + char* value; + const char* default_value; +}; + +class grib_accessor_class_getenv_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_getenv_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_getenv_t{}; } + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; + diff --git a/src/grib_accessor_class_global_gaussian.cc b/src/accessor/grib_accessor_class_global_gaussian.cc similarity index 64% rename from src/grib_accessor_class_global_gaussian.cc rename to src/accessor/grib_accessor_class_global_gaussian.cc index b39677da2..34ac67881 100644 --- a/src/grib_accessor_class_global_gaussian.cc +++ b/src/accessor/grib_accessor_class_global_gaussian.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,122 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init - MEMBERS=const char* N - MEMBERS=const char* Ni - MEMBERS=const char* di - MEMBERS=const char* latfirst - MEMBERS=const char* lonfirst - MEMBERS=const char* latlast - MEMBERS=const char* lonlast - MEMBERS=const char* plpresent - MEMBERS=const char* pl - MEMBERS=const char* basic_angle - MEMBERS=const char* subdivision - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_global_gaussian -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in global_gaussian */ - const char* N; - const char* Ni; - const char* di; - const char* latfirst; - const char* lonfirst; - const char* latlast; - const char* lonlast; - const char* plpresent; - const char* pl; - const char* basic_angle; - const char* subdivision; -} grib_accessor_global_gaussian; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_global_gaussian = { - &grib_accessor_class_long, /* super */ - "global_gaussian", /* name */ - sizeof(grib_accessor_global_gaussian), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_global_gaussian.h" +grib_accessor_class_global_gaussian_t _grib_accessor_class_global_gaussian{"global_gaussian"}; grib_accessor_class* grib_accessor_class_global_gaussian = &_grib_accessor_class_global_gaussian; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_global_gaussian* self = (grib_accessor_global_gaussian*)a; +void grib_accessor_class_global_gaussian_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_global_gaussian_t* self = (grib_accessor_global_gaussian_t*)a; int n = 0; grib_handle* h = grib_handle_of_accessor(a); @@ -140,9 +34,8 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->subdivision = grib_arguments_get_name(h, c, n++); } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_global_gaussian* self = (grib_accessor_global_gaussian*)a; +int grib_accessor_class_global_gaussian_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_global_gaussian_t* self = (grib_accessor_global_gaussian_t*)a; int ret = GRIB_SUCCESS; long latfirst, latlast, lonfirst, lonlast, basic_angle, subdivision, N, Ni; double dlatfirst, dlatlast, dlonfirst, dlonlast; @@ -247,9 +140,8 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return ret; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_global_gaussian* self = (grib_accessor_global_gaussian*)a; +int grib_accessor_class_global_gaussian_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_global_gaussian_t* self = (grib_accessor_global_gaussian_t*)a; int ret = GRIB_SUCCESS; long latfirst, latlast, lonfirst, lonlast, di, diold, basic_angle = 0, N, Ni; long factor; diff --git a/src/accessor/grib_accessor_class_global_gaussian.h b/src/accessor/grib_accessor_class_global_gaussian.h new file mode 100644 index 000000000..1d49c0c32 --- /dev/null +++ b/src/accessor/grib_accessor_class_global_gaussian.h @@ -0,0 +1,41 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_global_gaussian_t : public grib_accessor_long_t +{ +public: + /* Members defined in global_gaussian */ + const char* N; + const char* Ni; + const char* di; + const char* latfirst; + const char* lonfirst; + const char* latlast; + const char* lonlast; + const char* plpresent; + const char* pl; + const char* basic_angle; + const char* subdivision; +}; + +class grib_accessor_class_global_gaussian_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_global_gaussian_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_global_gaussian_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_group.cc b/src/accessor/grib_accessor_class_group.cc new file mode 100644 index 000000000..aef185022 --- /dev/null +++ b/src/accessor/grib_accessor_class_group.cc @@ -0,0 +1,160 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_group.h" + +grib_accessor_class_group_t _grib_accessor_class_group{"group"}; +grib_accessor_class* grib_accessor_class_group = &_grib_accessor_class_group; + + +void grib_accessor_class_group_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + grib_buffer* buffer = grib_handle_of_accessor(a)->buffer; + grib_accessor_group_t* self = (grib_accessor_group_t*)a; + + size_t i = 0; + unsigned char* v; + const char* s = grib_arguments_get_string(grib_handle_of_accessor(a), arg, 0); + + if (s && strlen(s) > 1) { + grib_context_log(a->context, GRIB_LOG_WARNING, + "Using only first character as group end of %s not the string %s", a->name, s); + } + + self->endCharacter = s ? s[0] : 0; + + v = buffer->data + a->offset; + i = 0; + if (s) { + while (*v != self->endCharacter && i <= buffer->ulength) { + if (*v > 126) + *v = 32; + v++; + i++; + } + } + else { + while (*v > 32 && *v != 61 && *v < 127 && i <= buffer->ulength) { + v++; + i++; + } + } + a->length = i; + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_group_t::value_count(grib_accessor* a, long* count){ + *count = 1; + return 0; +} + +size_t grib_accessor_class_group_t::string_length(grib_accessor* a){ + return a->length; +} + +void grib_accessor_class_group_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_string(dumper, a, NULL); +} + +int grib_accessor_class_group_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_STRING; +} + +int grib_accessor_class_group_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + long i = 0; + size_t l = a->length + 1; + grib_handle* h = grib_handle_of_accessor(a); + + if (*len < l) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + a->cclass->name, a->name, l, *len); + *len = l; + return GRIB_ARRAY_TOO_SMALL; + } + + for (i = 0; i < a->length; i++) + val[i] = h->buffer->data[a->offset + i]; + val[i] = 0; + *len = i; + return GRIB_SUCCESS; +} + +int grib_accessor_class_group_t::unpack_long(grib_accessor* a, long* v, size_t* len){ + char val[1024] = {0,}; + size_t l = sizeof(val); + size_t i = 0; + char* last = NULL; + int err = a->unpack_string(val, &l); + if (err) + return err; + + i = 0; + while (i < l - 1 && val[i] == ' ') + i++; + + if (val[i] == 0) { + *v = 0; + return 0; + } + if (val[i + 1] == ' ' && i < l - 2) + val[i + 1] = 0; + + *v = strtol(val, &last, 10); + + grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name); + return GRIB_SUCCESS; +} + +int grib_accessor_class_group_t::unpack_double(grib_accessor* a, double* v, size_t* len){ + char val[1024]; + size_t l = sizeof(val); + char* last = NULL; + a->unpack_string(val, &l); + *v = strtod(val, &last); + + if (*last == 0) { + grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name); + return GRIB_SUCCESS; + } + + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_group_t::compare(grib_accessor* a, grib_accessor* b){ + grib_context_log(a->context, GRIB_LOG_ERROR, "%s:%s not implemented", __func__, a->name); + return GRIB_NOT_IMPLEMENTED; + + // int retval = 0; + // char* aval = 0; + // char* bval = 0; + // int err = 0; + // size_t alen = 0; + // size_t blen = 0; + // long count = 0; + // err = a->value_count(&count); // if (err) return err; + // alen = count; + // err = b->value_count(&count); // if (err) return err; + // blen = count; + // if (alen != blen) return GRIB_COUNT_MISMATCH; + // aval = (char*)grib_context_malloc(a->context, alen * sizeof(char)); + // bval = (char*)grib_context_malloc(b->context, blen * sizeof(char)); + // a->unpack_string(aval, &alen); // b->unpack_string(bval, &blen); // retval = GRIB_SUCCESS; + // if (strcmp(aval, bval)) retval = GRIB_STRING_VALUE_MISMATCH; + // grib_context_free(a->context, aval); + // grib_context_free(b->context, bval); + // return retval; +} + +long grib_accessor_class_group_t::next_offset(grib_accessor* a){ + return a->offset + a->length; +} diff --git a/src/accessor/grib_accessor_class_group.h b/src/accessor/grib_accessor_class_group.h new file mode 100644 index 000000000..9f1c31a81 --- /dev/null +++ b/src/accessor/grib_accessor_class_group.h @@ -0,0 +1,38 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_group_t : public grib_accessor_gen_t +{ +public: + /* Members defined in group */ + char endCharacter; +}; + +class grib_accessor_class_group_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_group_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_group_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_gts_header.cc b/src/accessor/grib_accessor_class_gts_header.cc new file mode 100644 index 000000000..62a63bb8f --- /dev/null +++ b/src/accessor/grib_accessor_class_gts_header.cc @@ -0,0 +1,61 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_gts_header.h" + +grib_accessor_class_gts_header_t _grib_accessor_class_gts_header{"gts_header"}; +grib_accessor_class* grib_accessor_class_gts_header = &_grib_accessor_class_gts_header; + + +void grib_accessor_class_gts_header_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_ascii_t::init(a, l, c); + grib_accessor_gts_header_t* self = (grib_accessor_gts_header_t*)a; + self->gts_offset = -1; + self->gts_length = -1; + self->gts_offset = grib_arguments_get_long(grib_handle_of_accessor(a), c, 0); + self->gts_length = grib_arguments_get_long(grib_handle_of_accessor(a), c, 1); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_gts_header_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_gts_header_t* self = (grib_accessor_gts_header_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int offset = 0; + size_t length = 0; + + if (h->gts_header == NULL || h->gts_header_len < 8) { + if (*len < 8) + return GRIB_BUFFER_TOO_SMALL; + snprintf(val, 1024, "missing"); + return GRIB_SUCCESS; + } + if (*len < h->gts_header_len) + return GRIB_BUFFER_TOO_SMALL; + + offset = self->gts_offset > 0 ? self->gts_offset : 0; + length = self->gts_length > 0 ? self->gts_length : h->gts_header_len; + + memcpy(val, h->gts_header + offset, length); + + *len = length; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_gts_header_t::value_count(grib_accessor* a, long* count){ + *count = 1; + return 0; +} + +size_t grib_accessor_class_gts_header_t::string_length(grib_accessor* a){ + grib_handle* h = grib_handle_of_accessor(a); + return h->gts_header_len; +} diff --git a/src/accessor/grib_accessor_class_gts_header.h b/src/accessor/grib_accessor_class_gts_header.h new file mode 100644 index 000000000..8072986a7 --- /dev/null +++ b/src/accessor/grib_accessor_class_gts_header.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_gts_header_t : public grib_accessor_ascii_t +{ +public: + /* Members defined in gts_header */ + int gts_offset; + int gts_length; +}; + +class grib_accessor_class_gts_header_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_gts_header_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_gts_header_t{}; } + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_hash_array.cc b/src/accessor/grib_accessor_class_hash_array.cc new file mode 100644 index 000000000..1955dc07f --- /dev/null +++ b/src/accessor/grib_accessor_class_hash_array.cc @@ -0,0 +1,177 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_hash_array.h" + +grib_accessor_class_hash_array_t _grib_accessor_class_hash_array{"hash_array"}; +grib_accessor_class* grib_accessor_class_hash_array = &_grib_accessor_class_hash_array; + + +#define MAX_HASH_ARRAY_STRING_LENGTH 255 + +void grib_accessor_class_hash_array_t::init(grib_accessor* a, const long len, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, len, args); + grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a; + a->length = 0; + self->key = 0; + self->ha = NULL; +} + +void grib_accessor_class_hash_array_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_string(dumper, a, NULL); +} + +int grib_accessor_class_hash_array_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a; + char s[200] = {0,}; + snprintf(s, sizeof(s), "%g", *val); + self->key = grib_context_strdup(a->context, s); + self->ha = 0; + return GRIB_SUCCESS; +} + +int grib_accessor_class_hash_array_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a; + char s[200] = {0,}; + snprintf(s, sizeof(s), "%ld", *val); + if (self->key) + grib_context_free(a->context, self->key); + self->key = grib_context_strdup(a->context, s); + self->ha = 0; + return GRIB_SUCCESS; +} + +int grib_accessor_class_hash_array_t::pack_string(grib_accessor* a, const char* v, size_t* len){ + grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a; + self->key = grib_context_strdup(a->context, v); + self->ha = 0; + return GRIB_SUCCESS; +} + +int grib_accessor_class_hash_array_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} + +static grib_hash_array_value* find_hash_value(grib_accessor* a, int* err) +{ + grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a; + grib_hash_array_value* ha_ret = 0; + grib_hash_array_value* ha = NULL; + + ha = get_hash_array(grib_handle_of_accessor(a), a->creator); + if (!ha) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "unable to get hash value for %s", a->creator->name); + *err = GRIB_HASH_ARRAY_NO_MATCH; + return NULL; + } + + *err = GRIB_SUCCESS; + + Assert(ha != NULL); + if (!self->key) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "unable to get hash value for %s, set before getting", a->creator->name); + *err = GRIB_HASH_ARRAY_NO_MATCH; + return NULL; + } + + ha_ret = (grib_hash_array_value*)grib_trie_get(ha->index, self->key); + if (!ha_ret) + ha_ret = (grib_hash_array_value*)grib_trie_get(ha->index, "default"); + + if (!ha_ret) { + *err = GRIB_HASH_ARRAY_NO_MATCH; + grib_context_log(a->context, GRIB_LOG_ERROR, + "hash_array: no match for %s=%s", + a->creator->name, self->key); + const char* full_path = get_hash_array_full_path(a->creator); + if (full_path) { + grib_context_log(a->context, GRIB_LOG_ERROR, "hash_array: file path = %s", full_path); + } + grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Check the key 'masterTablesVersionNumber'"); + return NULL; + } + return ha_ret; +} + +int grib_accessor_class_hash_array_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_hash_array_value* ha = 0; + grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a; + int err = 0; + size_t i = 0; + + if (!self->ha) { + ha = find_hash_value(a, &err); + if (err) + return err; + self->ha = ha; + } + + switch (self->ha->type) { + case GRIB_HASH_ARRAY_TYPE_INTEGER: + if (*len < self->ha->iarray->n) { + return GRIB_ARRAY_TOO_SMALL; + } + *len = self->ha->iarray->n; + for (i = 0; i < *len; i++) + val[i] = self->ha->iarray->v[i]; + break; + + default: + return GRIB_NOT_IMPLEMENTED; + } + + return GRIB_SUCCESS; +} + +int grib_accessor_class_hash_array_t::get_native_type(grib_accessor* a){ + int type = GRIB_TYPE_STRING; + if (a->flags & GRIB_ACCESSOR_FLAG_LONG_TYPE) + type = GRIB_TYPE_LONG; + + return type; +} + +void grib_accessor_class_hash_array_t::destroy(grib_context* c, grib_accessor* a){ + grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a; + if (self->key) + grib_context_free(c, self->key); + grib_accessor_class_gen_t::destroy(c, a); +} + +int grib_accessor_class_hash_array_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} + +size_t grib_accessor_class_hash_array_t::string_length(grib_accessor* a){ + return MAX_HASH_ARRAY_STRING_LENGTH; +} + +int grib_accessor_class_hash_array_t::value_count(grib_accessor* a, long* count){ + int err = 0; + grib_accessor_hash_array_t* self = (grib_accessor_hash_array_t*)a; + grib_hash_array_value* ha = 0; + + if (!self->ha) { + ha = find_hash_value(a, &err); + if (err) + return err; + self->ha = ha; + } + + *count = self->ha->iarray->n; + return err; +} + +int grib_accessor_class_hash_array_t::compare(grib_accessor* a, grib_accessor* b){ + return GRIB_NOT_IMPLEMENTED; +} diff --git a/src/accessor/grib_accessor_class_hash_array.h b/src/accessor/grib_accessor_class_hash_array.h new file mode 100644 index 000000000..fa2732cac --- /dev/null +++ b/src/accessor/grib_accessor_class_hash_array.h @@ -0,0 +1,42 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_hash_array_t : public grib_accessor_gen_t +{ +public: + /* Members defined in hash_array */ + char* key; + grib_hash_array_value* ha; +}; + +class grib_accessor_class_hash_array_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_hash_array_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_hash_array_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_headers_only.cc b/src/accessor/grib_accessor_class_headers_only.cc new file mode 100644 index 000000000..9b053112d --- /dev/null +++ b/src/accessor/grib_accessor_class_headers_only.cc @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_headers_only.h" + +grib_accessor_class_headers_only_t _grib_accessor_class_headers_only{"headers_only"}; +grib_accessor_class* grib_accessor_class_headers_only = &_grib_accessor_class_headers_only; + + +void grib_accessor_class_headers_only_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_gen_t::init(a, l, c); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; + a->length = 0; +} + +int grib_accessor_class_headers_only_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + *val = grib_handle_of_accessor(a)->partial; + *len = 1; + return 0; +} + +int grib_accessor_class_headers_only_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_headers_only.h b/src/accessor/grib_accessor_class_headers_only.h new file mode 100644 index 000000000..a7dc81891 --- /dev/null +++ b/src/accessor/grib_accessor_class_headers_only.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_headers_only_t : public grib_accessor_gen_t +{ +public: + /* Members defined in headers_only */ +}; + +class grib_accessor_class_headers_only_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_headers_only_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_headers_only_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_ibmfloat.cc b/src/accessor/grib_accessor_class_ibmfloat.cc new file mode 100644 index 000000000..c5766db01 --- /dev/null +++ b/src/accessor/grib_accessor_class_ibmfloat.cc @@ -0,0 +1,165 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_ibmfloat.h" + +grib_accessor_class_ibmfloat_t _grib_accessor_class_ibmfloat{ "ibmfloat" }; +grib_accessor_class* grib_accessor_class_ibmfloat = &_grib_accessor_class_ibmfloat; + + +void grib_accessor_class_ibmfloat_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_double_t::init(a, len, arg); + grib_accessor_ibmfloat_t* self = (grib_accessor_ibmfloat_t*)a; + long count = 0; + + self->arg = arg; + a->value_count(&count); + a->length = 4 * count; + Assert(a->length >= 0); +} + + +template +static int unpack(grib_accessor* a, T* val, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating point numbers"); + unsigned long rlen = 0; + long count = 0; + int err = 0; + unsigned long i = 0; + long bitp = a->offset * 8; + grib_handle* hand = grib_handle_of_accessor(a); + + err = a->value_count(&count); + if (err) + return err; + rlen = count; + + if (*len < rlen) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %lu values", *len, a->name, rlen); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + for (i = 0; i < rlen; i++) + val[i] = (T)grib_long_to_ibm(grib_decode_unsigned_long(hand->buffer->data, &bitp, 32)); + + *len = rlen; + return GRIB_SUCCESS; +} + +int grib_accessor_class_ibmfloat_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + return unpack(a, val, len); +} + +int grib_accessor_class_ibmfloat_t::unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); +} + +int grib_accessor_class_ibmfloat_t::pack_double(grib_accessor* a, const double* val, size_t* len) +{ + grib_accessor_ibmfloat_t* self = (grib_accessor_ibmfloat_t*)a; + + int ret = 0; + unsigned long i = 0; + unsigned long rlen = *len; + size_t buflen = 0; + unsigned char* buf = NULL; + long off = 0; + + if (*len < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it packs at least 1 value", a->name); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + if (rlen == 1) { + // double x = 0; + // grib_nearest_smaller_ibm_float(val[0],&x); + // double y = grib_long_to_ibm(grib_ibm_to_long(val[0])); + // printf("IBMFLOAT val=%.20f nearest_smaller_ibm_float=%.20f long_to_ibm=%.20f\n",val[0],x ,y); + + off = a->byte_offset() * 8; + ret = grib_encode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, grib_ibm_to_long(val[0]), &off, 32); + if (*len > 1) + grib_context_log(a->context, GRIB_LOG_WARNING, "ibmfloat: Trying to pack %zu values in a scalar %s, packing first value", + *len, a->name); + if (ret == GRIB_SUCCESS) + len[0] = 1; + return ret; + } + + buflen = rlen * 4; + + buf = (unsigned char*)grib_context_malloc(a->context, buflen); + + for (i = 0; i < rlen; i++) { + grib_encode_unsigned_longb(buf, grib_ibm_to_long(val[i]), &off, 32); + } + ret = grib_set_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), rlen); + + if (ret == GRIB_SUCCESS) + grib_buffer_replace(a, buf, buflen, 1, 1); + else + *len = 0; + + grib_context_free(a->context, buf); + + a->length = a->byte_count(); + + return ret; +} + +long grib_accessor_class_ibmfloat_t::byte_count(grib_accessor* a) +{ + return a->length; +} + +int grib_accessor_class_ibmfloat_t::value_count(grib_accessor* a, long* len) +{ + grib_accessor_ibmfloat_t* self = (grib_accessor_ibmfloat_t*)a; + *len = 0; + if (!self->arg) { + *len = 1; + return 0; + } + return grib_get_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), len); +} + +long grib_accessor_class_ibmfloat_t::byte_offset(grib_accessor* a) +{ + return a->offset; +} + +void grib_accessor_class_ibmfloat_t::update_size(grib_accessor* a, size_t s) +{ + a->length = (long)s; + Assert(a->length >= 0); +} + +long grib_accessor_class_ibmfloat_t::next_offset(grib_accessor* a) +{ + return a->byte_offset() + a->byte_count(); +} + +int grib_accessor_class_ibmfloat_t::nearest_smaller_value(grib_accessor* a, double val, double* nearest) +{ + int ret = 0; + if (grib_nearest_smaller_ibm_float(val, nearest) == GRIB_INTERNAL_ERROR) { + grib_context_log(a->context, GRIB_LOG_ERROR, "ibm_float:nearest_smaller_value overflow value=%g", val); + grib_dump_content(grib_handle_of_accessor(a), stderr, "wmo", GRIB_DUMP_FLAG_HEXADECIMAL, 0); + ret = GRIB_INTERNAL_ERROR; + } + return ret; +} diff --git a/src/accessor/grib_accessor_class_ibmfloat.h b/src/accessor/grib_accessor_class_ibmfloat.h new file mode 100644 index 000000000..66bd01132 --- /dev/null +++ b/src/accessor/grib_accessor_class_ibmfloat.h @@ -0,0 +1,37 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_ibmfloat_t : public grib_accessor_double_t +{ +public: + /* Members defined in ibmfloat */ + grib_arguments* arg; +}; + +class grib_accessor_class_ibmfloat_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_ibmfloat_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_ibmfloat_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; + int nearest_smaller_value(grib_accessor*, double, double*) override; +}; diff --git a/src/accessor/grib_accessor_class_ieeefloat.cc b/src/accessor/grib_accessor_class_ieeefloat.cc new file mode 100644 index 000000000..64b08fe50 --- /dev/null +++ b/src/accessor/grib_accessor_class_ieeefloat.cc @@ -0,0 +1,136 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_ieeefloat.h" + +grib_accessor_class_ieeefloat_t _grib_accessor_class_ieeefloat{ "ieeefloat" }; +grib_accessor_class* grib_accessor_class_ieeefloat = &_grib_accessor_class_ieeefloat; + + +void grib_accessor_class_ieeefloat_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_double_t::init(a, len, arg); + grib_accessor_ieeefloat_t* self = (grib_accessor_ieeefloat_t*)a; + long count = 0; + self->arg = arg; + a->value_count(&count); + a->length = 4 * count; + Assert(a->length >= 0); +} + +int grib_accessor_class_ieeefloat_t::value_count(grib_accessor* a, long* len) +{ + grib_accessor_ieeefloat_t* self = (grib_accessor_ieeefloat_t*)a; + *len = 0; + + if (!self->arg) { + *len = 1; + return 0; + } + return grib_get_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), len); +} + +int grib_accessor_class_ieeefloat_t::pack_double(grib_accessor* a, const double* val, size_t* len) +{ + grib_accessor_ieeefloat_t* self = (grib_accessor_ieeefloat_t*)a; + + int ret = 0; + unsigned long i = 0; + unsigned long rlen = (unsigned long)*len; + size_t buflen = 0; + unsigned char* buf = NULL; + long off = 0; + + if (*len < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it packs at least 1 value", a->name); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + if (rlen == 1) { + off = a->offset * 8; + ret = grib_encode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, grib_ieee_to_long(val[0]), &off, 32); + if (*len > 1) + grib_context_log(a->context, GRIB_LOG_WARNING, "ieeefloat: Trying to pack %zu values in a scalar %s, packing first value", + *len, a->name); + if (ret == GRIB_SUCCESS) + len[0] = 1; + return ret; + } + + buflen = rlen * 4; + + buf = (unsigned char*)grib_context_malloc(a->context, buflen); + + for (i = 0; i < rlen; i++) { + grib_encode_unsigned_longb(buf, grib_ieee_to_long(val[i]), &off, 32); + } + ret = grib_set_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), rlen); + + if (ret == GRIB_SUCCESS) + grib_buffer_replace(a, buf, buflen, 1, 1); + else + *len = 0; + + grib_context_free(a->context, buf); + + return ret; +} + + +template +static int unpack(grib_accessor* a, T* val, size_t* len) +{ + static_assert(std::is_floating_point::value, "Requires floating point numbers"); + + long rlen = 0; + int err = 0; + long i = 0; + long bitp = a->offset * 8; + grib_handle* hand = grib_handle_of_accessor(a); + + err = a->value_count(&rlen); + if (err) + return err; + + if (*len < (size_t)rlen) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %ld values", *len, a->name, rlen); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + for (i = 0; i < rlen; i++) + val[i] = (T)grib_long_to_ieee(grib_decode_unsigned_long(hand->buffer->data, &bitp, 32)); + + *len = rlen; + return GRIB_SUCCESS; +} + +int grib_accessor_class_ieeefloat_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + return unpack(a, val, len); +} + +int grib_accessor_class_ieeefloat_t::unpack_float(grib_accessor* a, float* val, size_t* len) +{ + return unpack(a, val, len); +} + +void grib_accessor_class_ieeefloat_t::update_size(grib_accessor* a, size_t s) +{ + a->length = (long)s; + Assert(a->length >= 0); +} + +int grib_accessor_class_ieeefloat_t::nearest_smaller_value(grib_accessor* a, double val, double* nearest) +{ + return grib_nearest_smaller_ieee_float(val, nearest); +} diff --git a/src/accessor/grib_accessor_class_ieeefloat.h b/src/accessor/grib_accessor_class_ieeefloat.h new file mode 100644 index 000000000..27536169f --- /dev/null +++ b/src/accessor/grib_accessor_class_ieeefloat.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_ieeefloat_t : public grib_accessor_double_t +{ +public: + grib_arguments* arg; +}; + +class grib_accessor_class_ieeefloat_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_ieeefloat_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_ieeefloat_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; + int nearest_smaller_value(grib_accessor* a, double val, double* nearest) override; +}; diff --git a/src/accessor/grib_accessor_class_ifs_param.cc b/src/accessor/grib_accessor_class_ifs_param.cc new file mode 100644 index 000000000..32a972c7c --- /dev/null +++ b/src/accessor/grib_accessor_class_ifs_param.cc @@ -0,0 +1,93 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_ifs_param.h" + +grib_accessor_class_ifs_param_t _grib_accessor_class_ifs_param{"ifs_param"}; +grib_accessor_class* grib_accessor_class_ifs_param = &_grib_accessor_class_ifs_param; + + +void grib_accessor_class_ifs_param_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_gen_t::init(a, l, c); + grib_accessor_ifs_param_t* self = (grib_accessor_ifs_param_t*)a; + int n = 0; + + self->paramId = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->type = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); +} + +int grib_accessor_class_ifs_param_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_ifs_param_t* self = (grib_accessor_ifs_param_t*)a; + int ret = 0; + long paramId = 0; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->paramId, ¶mId)) != GRIB_SUCCESS) + return ret; + + if (paramId > 129000 && paramId < 129999) + *val = paramId - 129000; + else if (paramId > 200000 && paramId < 200999) + *val = paramId - 200000; + else if (paramId > 211000 && paramId < 211999) + *val = paramId - 1000; + else + *val = paramId; + + return ret; +} + +int grib_accessor_class_ifs_param_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_ifs_param_t* self = (grib_accessor_ifs_param_t*)a; + long type = 0; + long table = 128; + long paramId = *val; + long param; + + grib_get_long(grib_handle_of_accessor(a), self->type, &type); + + if (type == 33 || type == 35) { + if (paramId > 1000) { + table = paramId / 1000; + param = paramId - table * 1000; + paramId = param; + } + switch (table) { + case 210: + paramId += 211000; + break; + case 128: + paramId += 200000; + break; + default: + break; + } + } + if (type == 50 || type == 52) { + if (paramId > 1000) { + table = paramId / 1000; + param = paramId - table * 1000; + paramId = param; + } + switch (table) { + case 128: + paramId += 129000; + break; + default: + break; + } + } + + return grib_set_long_internal(grib_handle_of_accessor(a), self->paramId, paramId); +} + +int grib_accessor_class_ifs_param_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_ifs_param.h b/src/accessor/grib_accessor_class_ifs_param.h new file mode 100644 index 000000000..2beb90925 --- /dev/null +++ b/src/accessor/grib_accessor_class_ifs_param.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_ifs_param_t : public grib_accessor_gen_t +{ +public: + /* Members defined in ifs_param */ + const char* paramId; + const char* type; +}; + +class grib_accessor_class_ifs_param_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_ifs_param_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_ifs_param_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_iterator.cc b/src/accessor/grib_accessor_class_iterator.cc new file mode 100644 index 000000000..4cdfd6670 --- /dev/null +++ b/src/accessor/grib_accessor_class_iterator.cc @@ -0,0 +1,48 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_iterator.h" + +grib_accessor_class_iterator_t _grib_accessor_class_iterator{"iterator"}; +grib_accessor_class* grib_accessor_class_iterator = &_grib_accessor_class_iterator; + +void grib_accessor_class_iterator_t::init(grib_accessor* a, const long l, grib_arguments* args) +{ + grib_accessor_class_gen_t::init(a, l, args); + grib_accessor_iterator_t* self = (grib_accessor_iterator_t*)a; + self->args = args; +} + +void grib_accessor_class_iterator_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + /* TODO: pass args */ + grib_dump_label(dumper, a, NULL); +} + +grib_iterator* grib_iterator_new(const grib_handle* ch, unsigned long flags, int* error) +{ + grib_handle* h = (grib_handle*)ch; + grib_accessor* a = NULL; + grib_accessor_iterator_t* ita = NULL; + grib_iterator* iter = NULL; + *error = GRIB_NOT_IMPLEMENTED; + a = grib_find_accessor(h, "ITERATOR"); + ita = (grib_accessor_iterator_t*)a; + + if (!a) + return NULL; + + iter = grib_iterator_factory(h, ita->args, flags, error); + + if (iter) + *error = GRIB_SUCCESS; + + return iter; +} diff --git a/src/accessor/grib_accessor_class_iterator.h b/src/accessor/grib_accessor_class_iterator.h new file mode 100644 index 000000000..03fbdf5b6 --- /dev/null +++ b/src/accessor/grib_accessor_class_iterator.h @@ -0,0 +1,30 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_iterator_t : public grib_accessor_gen_t +{ +public: + grib_arguments* args; +}; + +class grib_accessor_class_iterator_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_iterator_t(const char* name) : grib_accessor_class_gen_t(name) {}; + grib_accessor* create_empty_accessor() override { return new grib_accessor_iterator_t{}; } + void init(grib_accessor* a, const long l, grib_arguments* args) override; + void dump(grib_accessor* a, grib_dumper* dumper) override; +}; + +//grib_iterator* grib_iterator_new(const grib_handle* ch, unsigned long flags, int* error) diff --git a/src/grib_accessor_class_julian_date.cc b/src/accessor/grib_accessor_class_julian_date.cc similarity index 66% rename from src/grib_accessor_class_julian_date.cc rename to src/accessor/grib_accessor_class_julian_date.cc index 61fd6959c..e633b42e4 100644 --- a/src/grib_accessor_class_julian_date.cc +++ b/src/accessor/grib_accessor_class_julian_date.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,129 +9,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double; pack_double - IMPLEMENTS = unpack_long; pack_long - IMPLEMENTS = unpack_string; pack_string - IMPLEMENTS = dump - IMPLEMENTS = init - IMPLEMENTS = pack_expression - MEMBERS = const char *year - MEMBERS = const char *month - MEMBERS = const char *day - MEMBERS = const char *hour - MEMBERS = const char *minute - MEMBERS = const char *second - MEMBERS = const char *ymd - MEMBERS = const char *hms - MEMBERS = char sep[5] - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int pack_expression(grib_accessor*, grib_expression*); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_julian_date -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in julian_date */ - const char *year; - const char *month; - const char *day; - const char *hour; - const char *minute; - const char *second; - const char *ymd; - const char *hms; - char sep[5]; -} grib_accessor_julian_date; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_julian_date = { - &grib_accessor_class_double, /* super */ - "julian_date", /* name */ - sizeof(grib_accessor_julian_date), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - &pack_expression, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_julian_date.h" +grib_accessor_class_julian_date_t _grib_accessor_class_julian_date{"julian_date"}; grib_accessor_class* grib_accessor_class_julian_date = &_grib_accessor_class_julian_date; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_julian_date* self = (grib_accessor_julian_date*)a; +void grib_accessor_class_julian_date_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a; int n = 0; grib_handle* h = grib_handle_of_accessor(a); @@ -163,18 +51,16 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) a->length = 0; } -static void dump(grib_accessor* a, grib_dumper* dumper) -{ +void grib_accessor_class_julian_date_t::dump(grib_accessor* a, grib_dumper* dumper){ grib_dump_string(dumper, a, NULL); } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ +int grib_accessor_class_julian_date_t::unpack_double(grib_accessor* a, double* val, size_t* len){ int ret = 0; long hour, minute, second; long year, month, day, ymd, hms; grib_handle* h = grib_handle_of_accessor(a); - grib_accessor_julian_date* self = (grib_accessor_julian_date*)a; + grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a; if (self->ymd == NULL) { ret = grib_get_long(h, self->year, &year); @@ -222,9 +108,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_julian_date* self = (grib_accessor_julian_date*)a; +int grib_accessor_class_julian_date_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a; int ret = 0; long hour = 0; long minute = 0; @@ -272,12 +157,11 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return ret; } -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ +int grib_accessor_class_julian_date_t::unpack_string(grib_accessor* a, char* val, size_t* len){ int ret = 0; long hour, minute, second; long year, month, day, ymd, hms; - grib_accessor_julian_date* self = (grib_accessor_julian_date*)a; + grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a; char* sep = self->sep; grib_handle* h = grib_handle_of_accessor(a); @@ -338,12 +222,11 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) return ret; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ +int grib_accessor_class_julian_date_t::pack_string(grib_accessor* a, const char* val, size_t* len){ int ret = 0; long hour, minute, second; long year, month, day, ymd, hms; - grib_accessor_julian_date* self = (grib_accessor_julian_date*)a; + grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a; char* sep = self->sep; grib_handle* h = grib_handle_of_accessor(a); @@ -409,19 +292,16 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) return ret; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ +int grib_accessor_class_julian_date_t::unpack_long(grib_accessor* a, long* val, size_t* len){ grib_context_log(a->context, GRIB_LOG_ERROR, " Cannot unpack %s as long", a->name); return GRIB_NOT_IMPLEMENTED; } -static int pack_long(grib_accessor* a, const long* v, size_t* len) -{ +int grib_accessor_class_julian_date_t::pack_long(grib_accessor* a, const long* v, size_t* len){ grib_context_log(a->context, GRIB_LOG_ERROR, " Cannot pack %s as long", a->name); return GRIB_NOT_IMPLEMENTED; } -static int pack_expression(grib_accessor* a, grib_expression* e) -{ +int grib_accessor_class_julian_date_t::pack_expression(grib_accessor* a, grib_expression* e){ size_t len = 1; long lval = 0; double dval = 0; @@ -439,16 +319,14 @@ static int pack_expression(grib_accessor* a, grib_expression* e) } /*if (hand->context->debug) printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %ld\n", a->name,lval);*/ - return grib_pack_long(a, &lval, &len); - } + return a->pack_long(&lval, &len); } case GRIB_TYPE_DOUBLE: { len = 1; ret = grib_expression_evaluate_double(hand, e, &dval); /*if (hand->context->debug) printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %g\n", a->name, dval);*/ - return grib_pack_double(a, &dval, &len); - } + return a->pack_double(&dval, &len); } case GRIB_TYPE_STRING: { char tmp[1024]; @@ -461,8 +339,7 @@ static int pack_expression(grib_accessor* a, grib_expression* e) len = strlen(cval); /*if (hand->context->debug) printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %s\n", a->name, cval);*/ - return grib_pack_string(a, cval, &len); - } + return a->pack_string(cval, &len); } } return GRIB_NOT_IMPLEMENTED; diff --git a/src/accessor/grib_accessor_class_julian_date.h b/src/accessor/grib_accessor_class_julian_date.h new file mode 100644 index 000000000..c52380e10 --- /dev/null +++ b/src/accessor/grib_accessor_class_julian_date.h @@ -0,0 +1,45 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_julian_date_t : public grib_accessor_double_t +{ +public: + /* Members defined in julian_date */ + const char *year; + const char *month; + const char *day; + const char *hour; + const char *minute; + const char *second; + const char *ymd; + const char *hms; + char sep[5]; +}; + +class grib_accessor_class_julian_date_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_julian_date_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_julian_date_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int pack_expression(grib_accessor*, grib_expression*) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_julian_day.cc b/src/accessor/grib_accessor_class_julian_day.cc new file mode 100644 index 000000000..e46751181 --- /dev/null +++ b/src/accessor/grib_accessor_class_julian_day.cc @@ -0,0 +1,107 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_julian_day.h" + +grib_accessor_class_julian_day_t _grib_accessor_class_julian_day{"julian_day"}; +grib_accessor_class* grib_accessor_class_julian_day = &_grib_accessor_class_julian_day; + + +void grib_accessor_class_julian_day_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_julian_day_t* self = (grib_accessor_julian_day_t*)a; + int n = 0; + + self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->hour = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->minute = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->second = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + + a->length = 0; +} + +void grib_accessor_class_julian_day_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_string(dumper, a, NULL); +} + +int grib_accessor_class_julian_day_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + const double v = *val; + return pack_double(a, &v, len); +} + +int grib_accessor_class_julian_day_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_julian_day_t* self = (grib_accessor_julian_day_t*)a; + int ret = 0; + long hour = 0; + long minute = 0; + long second = 0; + long date = 0; + long year, month, day; + + ret = grib_julian_to_datetime(*val, &year, &month, &day, &hour, &minute, &second); + if (ret != 0) + return ret; + + date = year * 10000 + month * 100 + day; + + ret = grib_set_long_internal(grib_handle_of_accessor(a), self->date, date); + if (ret != 0) + return ret; + ret = grib_set_long_internal(grib_handle_of_accessor(a), self->hour, hour); + if (ret != 0) + return ret; + ret = grib_set_long_internal(grib_handle_of_accessor(a), self->minute, minute); + if (ret != 0) + return ret; + ret = grib_set_long_internal(grib_handle_of_accessor(a), self->second, second); + + return ret; +} + +int grib_accessor_class_julian_day_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + int ret = 0; + double v = 0; + + ret = unpack_double(a, &v, len); + *val = (long)v; + + return ret; +} + +int grib_accessor_class_julian_day_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + int ret = 0; + long date, hour, minute, second; + long year, month, day; + grib_accessor_julian_day_t* self = (grib_accessor_julian_day_t*)a; + + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->date, &date); + if (ret != GRIB_SUCCESS) + return ret; + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->hour, &hour); + if (ret != GRIB_SUCCESS) + return ret; + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->minute, &minute); + if (ret != GRIB_SUCCESS) + return ret; + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->second, &second); + if (ret != GRIB_SUCCESS) + return ret; + + year = date / 10000; + date %= 10000; + month = date / 100; + date %= 100; + day = date; + + ret = grib_datetime_to_julian(year, month, day, hour, minute, second, val); + + return ret; +} diff --git a/src/accessor/grib_accessor_class_julian_day.h b/src/accessor/grib_accessor_class_julian_day.h new file mode 100644 index 000000000..5d06753b0 --- /dev/null +++ b/src/accessor/grib_accessor_class_julian_day.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_julian_day_t : public grib_accessor_double_t +{ +public: + /* Members defined in julian_day */ + const char *date; + const char *hour; + const char *minute; + const char *second; +}; + +class grib_accessor_class_julian_day_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_julian_day_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_julian_day_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_ksec1expver.cc b/src/accessor/grib_accessor_class_ksec1expver.cc new file mode 100644 index 000000000..0eb0af2c1 --- /dev/null +++ b/src/accessor/grib_accessor_class_ksec1expver.cc @@ -0,0 +1,95 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_ksec1expver.h" + +grib_accessor_class_ksec1expver_t _grib_accessor_class_ksec1expver{"ksec1expver"}; +grib_accessor_class* grib_accessor_class_ksec1expver = &_grib_accessor_class_ksec1expver; + + +void grib_accessor_class_ksec1expver_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_ascii_t::init(a, len, arg); + a->length = len; + Assert(a->length >= 0); +} + +int grib_accessor_class_ksec1expver_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + long value = 0; + long pos = a->offset * 8; + char* intc = NULL; + char* pTemp = NULL; + char expver[5]; + char refexpver[5]; + size_t llen = a->length + 1; + Assert(a->length == 4); + + if (*len < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + value = grib_decode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, &pos, a->length * 8); + + a->unpack_string(refexpver, &llen); + /* test for endian */ + intc = (char*)&value; + pTemp = intc; + + expver[0] = *pTemp++; + expver[1] = *pTemp++; + expver[2] = *pTemp++; + expver[3] = *pTemp++; + expver[4] = 0; + +// expver[0] = intc[0]; +// expver[1] = intc[1]; +// expver[2] = intc[2]; +// expver[3] = intc[3]; +// expver[4] = 0; + + /* if there is a difference, have to reverse*/ + if (strcmp(refexpver, expver)) { + intc[0] = expver[3]; + intc[1] = expver[2]; + intc[2] = expver[1]; + intc[3] = expver[0]; + } + + *val = value; + *len = 1; + return GRIB_SUCCESS; +} + +int grib_accessor_class_ksec1expver_t::pack_string(grib_accessor* a, const char* val, size_t* len){ + int i = 0; + if (len[0] != 4) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong length for %s. It has to be 4", a->name); + return GRIB_INVALID_KEY_VALUE; + } + if (len[0] > (a->length) + 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "pack_string: Wrong size (%lu) for %s, it contains %ld values", + len[0], a->name, a->length + 1); + len[0] = 0; + return GRIB_BUFFER_TOO_SMALL; + } + + for (i = 0; i < a->length; i++) + grib_handle_of_accessor(a)->buffer->data[a->offset + i] = val[i]; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_ksec1expver_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + char sval[5] = {0,}; + size_t slen = 4; + snprintf(sval, sizeof(sval), "%04d", (int)(*val)); + return pack_string(a, sval, &slen); +} diff --git a/src/accessor/grib_accessor_class_ksec1expver.h b/src/accessor/grib_accessor_class_ksec1expver.h new file mode 100644 index 000000000..098a40a14 --- /dev/null +++ b/src/accessor/grib_accessor_class_ksec1expver.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_ksec1expver_t : public grib_accessor_ascii_t +{ +public: + /* Members defined in ksec1expver */ +}; + +class grib_accessor_class_ksec1expver_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_ksec1expver_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_ksec1expver_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_label.cc b/src/accessor/grib_accessor_class_label.cc new file mode 100644 index 000000000..5b9448399 --- /dev/null +++ b/src/accessor/grib_accessor_class_label.cc @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_label.h" + +grib_accessor_class_label_t _grib_accessor_class_label{"label"}; +grib_accessor_class* grib_accessor_class_label = &_grib_accessor_class_label; + + +void grib_accessor_class_label_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; + a->length = 0; +} + +void grib_accessor_class_label_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_label(dumper, a, NULL); +} + +int grib_accessor_class_label_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LABEL; +} + +int grib_accessor_class_label_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + size_t vlen = strlen(a->name); + if (vlen > *len) + return GRIB_BUFFER_TOO_SMALL; + *len = vlen; + strcpy(val, a->name); + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_label.h b/src/accessor/grib_accessor_class_label.h new file mode 100644 index 000000000..59590e77c --- /dev/null +++ b/src/accessor/grib_accessor_class_label.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_label_t : public grib_accessor_gen_t +{ +public: + /* Members defined in label */ +}; + +class grib_accessor_class_label_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_label_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_label_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_latitudes.cc b/src/accessor/grib_accessor_class_latitudes.cc new file mode 100644 index 000000000..1c69d39e9 --- /dev/null +++ b/src/accessor/grib_accessor_class_latitudes.cc @@ -0,0 +1,217 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_latitudes.h" + +grib_accessor_class_latitudes_t _grib_accessor_class_latitudes{ "latitudes" }; +grib_accessor_class* grib_accessor_class_latitudes = &_grib_accessor_class_latitudes; + +static int get_distinct(grib_accessor* a, double** val, long* len); +int compare_doubles(const void* a, const void* b, int ascending) +{ + // ascending is a boolean: 0 or 1 + double* arg1 = (double*)a; + double* arg2 = (double*)b; + if (ascending) { + if (*arg1 < *arg2) + return -1; // Smaller values come before larger ones + } + else { + if (*arg1 > *arg2) + return -1; // Larger values come before smaller ones + } + if (*arg1 == *arg2) + return 0; + else + return 1; +} +int compare_doubles_ascending(const void* a, const void* b) +{ + return compare_doubles(a, b, 1); +} +int compare_doubles_descending(const void* a, const void* b) +{ + return compare_doubles(a, b, 0); +} + +void grib_accessor_class_latitudes_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_latitudes_t* self = (grib_accessor_latitudes_t*)a; + int n = 0; + + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->distinct = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); + self->save = 0; + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_latitudes_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + grib_context* c = a->context; + grib_accessor_latitudes_t* self = (grib_accessor_latitudes_t*)a; + int ret = 0; + double* v = val; + double dummyLon = 0; + size_t size = 0; + long count = 0; + grib_iterator* iter = NULL; + + self->save = 1; + ret = value_count(a, &count); + if (ret) return ret; + size = count; + if (*len < size) { + // self->lats are computed in value_count so must free + if (self->lats) { + grib_context_free(c, self->lats); + self->lats = NULL; + } + return GRIB_ARRAY_TOO_SMALL; + } + self->save = 0; + + // self->lats are computed in value_count + if (self->lats) { + int i; + *len = self->size; + for (i = 0; i < size; i++) + val[i] = self->lats[i]; + grib_context_free(c, self->lats); + self->lats = NULL; + self->size = 0; + return GRIB_SUCCESS; + } + + // ECC-1525 Performance: We do not need the values to be decoded + iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret); + if (ret != GRIB_SUCCESS) { + if (iter) + grib_iterator_delete(iter); + grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Unable to create iterator"); + return ret; + } + + while (grib_iterator_next(iter, v++, &dummyLon, NULL)) {} + grib_iterator_delete(iter); + + *len = size; + + return ret; +} + +int grib_accessor_class_latitudes_t::value_count(grib_accessor* a, long* len) +{ + grib_accessor_latitudes_t* self = (grib_accessor_latitudes_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + grib_context* c = a->context; + double* val = NULL; + int ret; + size_t size; + + *len = 0; + if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) { + grib_context_log(h->context, GRIB_LOG_ERROR, "latitudes: Unable to get size of %s", self->values); + return ret; + } + *len = size; + + // See ECC-1792 + // Give priority to the Grid Section (rather than the Data Section) + long numberOfDataPoints = 0; + if (grib_get_long(h, "numberOfDataPoints", &numberOfDataPoints) == GRIB_SUCCESS) { + *len = numberOfDataPoints; + } + + if (self->distinct) { + ret = get_distinct(a, &val, len); + if (ret != GRIB_SUCCESS) + return ret; + if (self->save) { + self->lats = val; + self->size = *len; + } + else { + grib_context_free(c, val); + } + } + + return ret; +} + +static int get_distinct(grib_accessor* a, double** val, long* len) +{ + long count = 0; + double prev; + double* v = NULL; + double* v1 = NULL; + double dummyLon = 0; + int ret = GRIB_SUCCESS; + int i; + long jScansPositively = 0; // default: north to south + size_t size = *len; + grib_context* c = a->context; + + // Performance: We do not need the values to be decoded + grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret); + if (ret != GRIB_SUCCESS) { + if (iter) + grib_iterator_delete(iter); + grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Unable to create iterator"); + return ret; + } + v = (double*)grib_context_malloc_clear(c, size * sizeof(double)); + if (!v) { + grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Error allocating %zu bytes", size * sizeof(double)); + return GRIB_OUT_OF_MEMORY; + } + *val = v; + + while (grib_iterator_next(iter, v++, &dummyLon, NULL)) {} + grib_iterator_delete(iter); + v = *val; + + // See which direction the latitudes are to be scanned + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), "jScansPositively", &jScansPositively))) + return ret; + if (jScansPositively) { + qsort(v, *len, sizeof(double), &compare_doubles_ascending); //South to North + } + else { + qsort(v, *len, sizeof(double), &compare_doubles_descending); //North to South + } + + v1 = (double*)grib_context_malloc_clear(c, size * sizeof(double)); + if (!v1) { + grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Error allocating %zu bytes", size * sizeof(double)); + return GRIB_OUT_OF_MEMORY; + } + + // Construct a unique set of lats by filtering out duplicates + prev = v[0]; + v1[0] = prev; + count = 1; + for (i = 1; i < *len; i++) { + if (v[i] != prev) { + prev = v[i]; + v1[count] = prev; // Value different from previous so store it + count++; + } + } + + grib_context_free(c, v); + + *val = v1; + + *len = count; + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_latitudes.h b/src/accessor/grib_accessor_class_latitudes.h new file mode 100644 index 000000000..cb1f6ada8 --- /dev/null +++ b/src/accessor/grib_accessor_class_latitudes.h @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_latitudes_t : public grib_accessor_double_t +{ +public: + /* Members defined in latitudes */ + const char* values; + long distinct; + double* lats; + long size; + int save; +}; + +class grib_accessor_class_latitudes_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_latitudes_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_latitudes_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_latlon_increment.cc b/src/accessor/grib_accessor_class_latlon_increment.cc similarity index 61% rename from src/grib_accessor_class_latlon_increment.cc rename to src/accessor/grib_accessor_class_latlon_increment.cc index de43e60c9..885a4cd61 100644 --- a/src/grib_accessor_class_latlon_increment.cc +++ b/src/accessor/grib_accessor_class_latlon_increment.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,118 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double;pack_double;is_missing - IMPLEMENTS = init - MEMBERS=const char* directionIncrementGiven - MEMBERS=const char* directionIncrement - MEMBERS=const char* scansPositively - MEMBERS=const char* first - MEMBERS=const char* last - MEMBERS=const char* numberOfPoints - MEMBERS=const char* angleMultiplier - MEMBERS=const char* angleDivisor - MEMBERS=long isLongitude - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int is_missing(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_latlon_increment -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in latlon_increment */ - const char* directionIncrementGiven; - const char* directionIncrement; - const char* scansPositively; - const char* first; - const char* last; - const char* numberOfPoints; - const char* angleMultiplier; - const char* angleDivisor; - long isLongitude; -} grib_accessor_latlon_increment; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_latlon_increment = { - &grib_accessor_class_double, /* super */ - "latlon_increment", /* name */ - sizeof(grib_accessor_latlon_increment), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - &is_missing, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_latlon_increment.h" +grib_accessor_class_latlon_increment_t _grib_accessor_class_latlon_increment{"latlon_increment"}; grib_accessor_class* grib_accessor_class_latlon_increment = &_grib_accessor_class_latlon_increment; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_latlon_increment* self = (grib_accessor_latlon_increment*)a; +void grib_accessor_class_latlon_increment_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_latlon_increment_t* self = (grib_accessor_latlon_increment_t*)a; int n = 0; grib_handle* hand = grib_handle_of_accessor(a); @@ -134,9 +32,8 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->isLongitude = grib_arguments_get_long(hand, c, n++); } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_latlon_increment* self = (grib_accessor_latlon_increment*)a; +int grib_accessor_class_latlon_increment_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_latlon_increment_t* self = (grib_accessor_latlon_increment_t*)a; int ret = 0; grib_handle* hand = grib_handle_of_accessor(a); @@ -221,9 +118,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_latlon_increment* self = (grib_accessor_latlon_increment*)a; +int grib_accessor_class_latlon_increment_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_latlon_increment_t* self = (grib_accessor_latlon_increment_t*)a; int ret = 0; long codedNumberOfPoints = 0; grib_handle* hand = grib_handle_of_accessor(a); @@ -305,8 +201,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return GRIB_SUCCESS; } -static int is_missing(grib_accessor* a) -{ +int grib_accessor_class_latlon_increment_t::is_missing(grib_accessor* a){ size_t len = 1; double val = 0; diff --git a/src/accessor/grib_accessor_class_latlon_increment.h b/src/accessor/grib_accessor_class_latlon_increment.h new file mode 100644 index 000000000..8dfa7cb93 --- /dev/null +++ b/src/accessor/grib_accessor_class_latlon_increment.h @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_latlon_increment_t : public grib_accessor_double_t +{ +public: + /* Members defined in latlon_increment */ + const char* directionIncrementGiven; + const char* directionIncrement; + const char* scansPositively; + const char* first; + const char* last; + const char* numberOfPoints; + const char* angleMultiplier; + const char* angleDivisor; + long isLongitude; +}; + +class grib_accessor_class_latlon_increment_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_latlon_increment_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_latlon_increment_t{}; } + int is_missing(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_latlonvalues.cc b/src/accessor/grib_accessor_class_latlonvalues.cc new file mode 100644 index 000000000..5d43d6be9 --- /dev/null +++ b/src/accessor/grib_accessor_class_latlonvalues.cc @@ -0,0 +1,76 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_latlonvalues.h" + +grib_accessor_class_latlonvalues_t _grib_accessor_class_latlonvalues{"latlonvalues"}; +grib_accessor_class* grib_accessor_class_latlonvalues = &_grib_accessor_class_latlonvalues; + + +void grib_accessor_class_latlonvalues_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_latlonvalues_t* self = (grib_accessor_latlonvalues_t*)a; + int n = 0; + + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_latlonvalues_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_context* c = a->context; + int err = 0; + double* v = val; + double lat, lon, value; + size_t size = 0; + long count = 0; + grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), 0, &err); + if (err) { + if (iter) grib_iterator_delete(iter); + grib_context_log(c, GRIB_LOG_ERROR, "latlonvalues: Unable to create iterator"); + return err; + } + + err = value_count(a, &count); + if (err) return err; + size = count; + + if (*len < size) { + if (iter) grib_iterator_delete(iter); + return GRIB_ARRAY_TOO_SMALL; + } + + while (grib_iterator_next(iter, &lat, &lon, &value)) { + *(v++) = lat; + *(v++) = lon; + *(v++) = value; + } + + grib_iterator_delete(iter); + + *len = size; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_latlonvalues_t::value_count(grib_accessor* a, long* count){ + grib_accessor_latlonvalues_t* self = (grib_accessor_latlonvalues_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + int ret = GRIB_SUCCESS; + size_t size; + if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) { + grib_context_log(h->context, GRIB_LOG_ERROR, "latlonvalues: Unable to get size of %s", self->values); + return ret; + } + + *count = 3 * size; + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_latlonvalues.h b/src/accessor/grib_accessor_class_latlonvalues.h new file mode 100644 index 000000000..7328688c6 --- /dev/null +++ b/src/accessor/grib_accessor_class_latlonvalues.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_latlonvalues_t : public grib_accessor_double_t +{ +public: + /* Members defined in latlonvalues */ + const char* values; +}; + +class grib_accessor_class_latlonvalues_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_latlonvalues_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_latlonvalues_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_library_version.cc b/src/accessor/grib_accessor_class_library_version.cc new file mode 100644 index 000000000..527b4809a --- /dev/null +++ b/src/accessor/grib_accessor_class_library_version.cc @@ -0,0 +1,45 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_library_version.h" + +grib_accessor_class_library_version_t _grib_accessor_class_library_version{"library_version"}; +grib_accessor_class* grib_accessor_class_library_version = &_grib_accessor_class_library_version; + + +int grib_accessor_class_library_version_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + char result[30] = {0,}; + size_t size; + + int major = ECCODES_MAJOR_VERSION; + int minor = ECCODES_MINOR_VERSION; + int revision = ECCODES_REVISION_VERSION; + + snprintf(result, sizeof(result), "%d.%d.%d", major, minor, revision); + size = sizeof(result); + + if (*len < size) + return GRIB_ARRAY_TOO_SMALL; + strcpy(val, result); + + *len = size; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_library_version_t::value_count(grib_accessor* a, long* count){ + *count = 1; + return 0; +} + +size_t grib_accessor_class_library_version_t::string_length(grib_accessor* a){ + return 255; +} diff --git a/src/accessor/grib_accessor_class_library_version.h b/src/accessor/grib_accessor_class_library_version.h new file mode 100644 index 000000000..cb2a45f04 --- /dev/null +++ b/src/accessor/grib_accessor_class_library_version.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_library_version_t : public grib_accessor_ascii_t +{ +public: + /* Members defined in library_version */ +}; + +class grib_accessor_class_library_version_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_library_version_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_library_version_t{}; } + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; +}; diff --git a/src/grib_accessor_class_local_definition.cc b/src/accessor/grib_accessor_class_local_definition.cc similarity index 72% rename from src/grib_accessor_class_local_definition.cc rename to src/accessor/grib_accessor_class_local_definition.cc index 782ce5fde..0964a3005 100644 --- a/src/grib_accessor_class_local_definition.cc +++ b/src/accessor/grib_accessor_class_local_definition.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,125 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/************************************** - * This pertains to GRIB edition 2 - **************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_unsigned - IMPLEMENTS = unpack_long;pack_long; value_count - IMPLEMENTS = init - MEMBERS=const char* productDefinitionTemplateNumber - MEMBERS=const char* productDefinitionTemplateNumberInternal - MEMBERS=const char* grib2LocalSectionNumber - MEMBERS=const char* type - MEMBERS=const char* stream - MEMBERS=const char* the_class - MEMBERS=const char* eps - MEMBERS=const char* stepType - MEMBERS=const char* derivedForecast - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_local_definition -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in local_definition */ - const char* productDefinitionTemplateNumber; - const char* productDefinitionTemplateNumberInternal; - const char* grib2LocalSectionNumber; - const char* type; - const char* stream; - const char* the_class; - const char* eps; - const char* stepType; - const char* derivedForecast; -} grib_accessor_local_definition; - -extern grib_accessor_class* grib_accessor_class_unsigned; - -static grib_accessor_class _grib_accessor_class_local_definition = { - &grib_accessor_class_unsigned, /* super */ - "local_definition", /* name */ - sizeof(grib_accessor_local_definition), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_local_definition.h" +grib_accessor_class_local_definition_t _grib_accessor_class_local_definition{"local_definition"}; grib_accessor_class* grib_accessor_class_local_definition = &_grib_accessor_class_local_definition; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_local_definition* self = (grib_accessor_local_definition*)a; +void grib_accessor_class_local_definition_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_unsigned_t::init(a, l, c); + grib_accessor_local_definition_t* self = (grib_accessor_local_definition_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int n = 0; @@ -141,16 +32,14 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->derivedForecast = grib_arguments_get_name(hand, c, n++); } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_local_definition* self = (grib_accessor_local_definition*)a; +int grib_accessor_class_local_definition_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_local_definition_t* self = (grib_accessor_local_definition_t*)a; return grib_get_long(grib_handle_of_accessor(a), self->grib2LocalSectionNumber, val); } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_local_definition* self = (grib_accessor_local_definition*)a; +int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_local_definition_t* self = (grib_accessor_local_definition_t*)a; grib_handle* hand = grib_handle_of_accessor(a); long productDefinitionTemplateNumber = -1; long productDefinitionTemplateNumberInternal = -1; @@ -316,7 +205,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) #ifdef DEBUG // In test & development mode, fail so we remember to adjust PDTN grib_context_log(a->context, GRIB_LOG_ERROR, - "grib_accessor_local_definition: Invalid localDefinitionNumber %d", localDefinitionNumber); + "grib_accessor_local_definition_t: Invalid localDefinitionNumber %d", localDefinitionNumber); return GRIB_ENCODING_ERROR; #endif // ECC-1253: Do not fail in operations. Leave PDTN as is @@ -419,7 +308,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) { if (a->context->debug) { - fprintf(stderr, "ECCODES DEBUG grib_accessor_local_definition: ldNumber=%d, newPDTN=%ld\n", + fprintf(stderr, "ECCODES DEBUG grib_accessor_local_definition_t: ldNumber=%d, newPDTN=%ld\n", localDefinitionNumber, productDefinitionTemplateNumberNew); } if (tooEarly) @@ -435,8 +324,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return 0; } -static int value_count(grib_accessor* a, long* count) -{ +int grib_accessor_class_local_definition_t::value_count(grib_accessor* a, long* count){ *count = 1; return 0; } diff --git a/src/accessor/grib_accessor_class_local_definition.h b/src/accessor/grib_accessor_class_local_definition.h new file mode 100644 index 000000000..f91ebbef4 --- /dev/null +++ b/src/accessor/grib_accessor_class_local_definition.h @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_unsigned.h" + +class grib_accessor_local_definition_t : public grib_accessor_unsigned_t +{ +public: + /* Members defined in local_definition */ + const char* productDefinitionTemplateNumber; + const char* productDefinitionTemplateNumberInternal; + const char* grib2LocalSectionNumber; + const char* type; + const char* stream; + const char* the_class; + const char* eps; + const char* stepType; + const char* derivedForecast; +}; + +class grib_accessor_class_local_definition_t : public grib_accessor_class_unsigned_t +{ +public: + grib_accessor_class_local_definition_t(const char* name) : grib_accessor_class_unsigned_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_local_definition_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_long.cc b/src/accessor/grib_accessor_class_long.cc new file mode 100644 index 000000000..588083c49 --- /dev/null +++ b/src/accessor/grib_accessor_class_long.cc @@ -0,0 +1,182 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_long.h" + +grib_accessor_class_long_t _grib_accessor_class_long{"long"}; +grib_accessor_class* grib_accessor_class_long = &_grib_accessor_class_long; + +void grib_accessor_class_long_t::init(grib_accessor* a, const long len, grib_arguments* arg) { + grib_accessor_class_gen_t::init(a, len, arg); +} + +int grib_accessor_class_long_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_LONG; +} + +void grib_accessor_class_long_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + grib_dump_long(dumper, a, NULL); +} + +int grib_accessor_class_long_t::unpack_string(grib_accessor* a, char* v, size_t* len) +{ + long val = 0; + size_t l = 1; + char repres[1024]; + char format[32] = "%ld"; + grib_handle* h = grib_handle_of_accessor(a); + + a->unpack_long(&val, &l); + /* TODO: We should catch all errors but in this case the test ERA_Gen.sh will fail + * as the output from grib_ls will be different */ + + if ((val == GRIB_MISSING_LONG) && ((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0)) { + snprintf(repres, sizeof(repres), "MISSING"); + } else { + size_t size = sizeof(format); + grib_get_string(h, "formatForLongs", format, &size); + snprintf(repres, sizeof(repres), format, val); + } + + l = strlen(repres) + 1; + + if (*len < l) { + const char* cclass_name = a->cclass->name; + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, l, *len); + *len = l; + return GRIB_BUFFER_TOO_SMALL; + } + /*grib_context_log(a->context,GRIB_LOG_DEBUG, "grib_accessor_long: Casting long %s to string ", a->name);*/ + + *len = l; + + strcpy(v, repres); + return GRIB_SUCCESS; +} + +int grib_accessor_class_long_t::pack_missing(grib_accessor* a) +{ + size_t len = 1; + long value = GRIB_MISSING_LONG; + + if (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) + return a->pack_long(&value, &len); + + return GRIB_VALUE_CANNOT_BE_MISSING; +} + +int grib_accessor_class_long_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + size_t rlen = 0; + long count = 0; + unsigned long i = 0; + long* values = NULL; + long oneval = 0; + int ret = GRIB_SUCCESS; + + ret = a->value_count(&count); + if (ret) + return ret; + rlen = count; + + if (*len < rlen) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %lu values", a->name, rlen); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + if (rlen == 1) { + ret = a->unpack_long(&oneval, &rlen); + if (ret != GRIB_SUCCESS) + return ret; + *val = oneval; + *len = 1; + return GRIB_SUCCESS; + } + + values = (long*)grib_context_malloc(a->context, rlen * sizeof(long)); + if (!values) + return GRIB_OUT_OF_MEMORY; + + ret = a->unpack_long(values, &rlen); + if (ret != GRIB_SUCCESS) { + grib_context_free(a->context, values); + return ret; + } + for (i = 0; i < rlen; i++) + val[i] = values[i]; + + grib_context_free(a->context, values); + + *len = rlen; + return GRIB_SUCCESS; +} + +int grib_accessor_class_long_t::compare(grib_accessor* a, grib_accessor* b) +{ + int retval = 0; + long* aval = 0; + long* bval = 0; + long count = 0; + + size_t alen = 0; + size_t blen = 0; + int err = 0; + + err = a->value_count(&count); + if (err) + return err; + alen = count; + + err = b->value_count(&count); + if (err) + return err; + blen = count; + + if (alen != blen) + return GRIB_COUNT_MISMATCH; + + aval = (long*)grib_context_malloc(a->context, alen * sizeof(long)); + bval = (long*)grib_context_malloc(b->context, blen * sizeof(long)); + + a->unpack_long(aval, &alen); + b->unpack_long(bval, &blen); + + retval = GRIB_SUCCESS; + for (size_t i=0; icontext, aval); + grib_context_free(b->context, bval); + + return retval; +} + +int grib_accessor_class_long_t::pack_string(grib_accessor* a, const char* val, size_t* len) +{ + long v = 0; /* The converted value */ + + // ECC-1722 + if (STR_EQUAL_NOCASE(val, "missing")) { + return pack_missing(a); + } + + if (string_to_long(val, &v, 1) != GRIB_SUCCESS) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Trying to pack \"%s\" as long. String cannot be converted to an integer", val); + return GRIB_WRONG_TYPE; + } + return a->pack_long(&v, len); +} diff --git a/src/accessor/grib_accessor_class_long.h b/src/accessor/grib_accessor_class_long.h new file mode 100644 index 000000000..72a67a8e5 --- /dev/null +++ b/src/accessor/grib_accessor_class_long.h @@ -0,0 +1,31 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_long_t : public grib_accessor_gen_t +{}; + +class grib_accessor_class_long_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_long_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_long_t{}; } + void init(grib_accessor* a, const long len, grib_arguments* arg) override; + int get_native_type(grib_accessor* a) override; + int pack_missing(grib_accessor* a) override; + int pack_string(grib_accessor* a, const char*, size_t* len) override; + int unpack_double(grib_accessor* a, double* val, size_t* len) override; + int unpack_string(grib_accessor* a, char*, size_t* len) override; + void dump(grib_accessor* a, grib_dumper*) override; + int compare(grib_accessor* a, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_long_vector.cc b/src/accessor/grib_accessor_class_long_vector.cc new file mode 100644 index 000000000..0aee8c8c9 --- /dev/null +++ b/src/accessor/grib_accessor_class_long_vector.cc @@ -0,0 +1,95 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_long_vector.h" +#include "grib_accessor_class_abstract_long_vector.h" + +grib_accessor_class_long_vector_t _grib_accessor_class_long_vector{"long_vector"}; +grib_accessor_class* grib_accessor_class_long_vector = &_grib_accessor_class_long_vector; + + +void grib_accessor_class_long_vector_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_abstract_long_vector_t::init(a, l, c); + grib_accessor_long_vector_t* self = (grib_accessor_long_vector_t*)a; + grib_accessor* va = NULL; + grib_accessor_abstract_long_vector_t* v = NULL; + int n = 0; + + self->vector = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); + v = (grib_accessor_abstract_long_vector_t*)va; + + self->index = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); + + /* check self->index on init and never change it */ + Assert(self->index < v->number_of_elements && self->index >= 0); + + a->length = 0; +} + +int grib_accessor_class_long_vector_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + size_t size = 0; + int err = 0; + long* vector; + grib_accessor_long_vector_t* self = (grib_accessor_long_vector_t*)a; + grib_accessor* va = NULL; + grib_accessor_abstract_long_vector_t* v = NULL; + + va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); + v = (grib_accessor_abstract_long_vector_t*)va; + + /*TODO implement the dirty mechanism to avoid to unpack every time */ + err = grib_get_size(grib_handle_of_accessor(a), self->vector, &size); + if (err) return err; + DEBUG_ASSERT(size > 0); + vector = (long*)grib_context_malloc(a->context, sizeof(long) * size); + err = va->unpack_long(vector, &size); grib_context_free(a->context, vector); + if (err) return err; + + *val = v->v[self->index]; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_long_vector_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + long lval = 0; + int err = 0; + grib_accessor_long_vector_t* self = (grib_accessor_long_vector_t*)a; + grib_accessor* va = NULL; + grib_accessor_abstract_long_vector_t* v = NULL; + va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); + v = (grib_accessor_abstract_long_vector_t*)va; + + err = unpack_long(a, &lval, len); + + *val = (double)v->v[self->index]; + + return err; +} + +int grib_accessor_class_long_vector_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + int err = 0; + grib_accessor_long_vector_t* self = (grib_accessor_long_vector_t*)a; + grib_accessor* va = NULL; + grib_accessor_abstract_long_vector_t* v = NULL; + + va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); + v = (grib_accessor_abstract_long_vector_t*)va; + + v->pack_index = self->index; + + err = va->pack_long(val, len); + return err; +} + +int grib_accessor_class_long_vector_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_long_vector.h b/src/accessor/grib_accessor_class_long_vector.h new file mode 100644 index 000000000..010a4ed7e --- /dev/null +++ b/src/accessor/grib_accessor_class_long_vector.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_abstract_long_vector.h" + +class grib_accessor_long_vector_t : public grib_accessor_abstract_long_vector_t +{ +public: + /* Members defined in long_vector */ + const char* vector; + int index; +}; + +class grib_accessor_class_long_vector_t : public grib_accessor_class_abstract_long_vector_t +{ +public: + grib_accessor_class_long_vector_t(const char* name) : grib_accessor_class_abstract_long_vector_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_long_vector_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_longitudes.cc b/src/accessor/grib_accessor_class_longitudes.cc similarity index 56% rename from src/grib_accessor_class_longitudes.cc rename to src/accessor/grib_accessor_class_longitudes.cc index 78fc7a733..a9ae31309 100644 --- a/src/grib_accessor_class_longitudes.cc +++ b/src/accessor/grib_accessor_class_longitudes.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,114 +9,17 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double; - IMPLEMENTS = value_count - IMPLEMENTS = init - MEMBERS =const char* values - MEMBERS =long distinct - MEMBERS =double* lons - MEMBERS =long size - MEMBERS =int save - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_longitudes -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in longitudes */ - const char* values; - long distinct; - double* lons; - long size; - int save; -} grib_accessor_longitudes; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_longitudes = { - &grib_accessor_class_double, /* super */ - "longitudes", /* name */ - sizeof(grib_accessor_longitudes), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_longitudes.h" +grib_accessor_class_longitudes_t _grib_accessor_class_longitudes{"longitudes"}; grib_accessor_class* grib_accessor_class_longitudes = &_grib_accessor_class_longitudes; -/* END_CLASS_IMP */ - static int get_distinct(grib_accessor* a, double** val, long* len); -static int compare_doubles(const void* a, const void* b); - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_longitudes* self = (grib_accessor_longitudes*)a; +int compare_doubles(const void* a, const void* b); +void grib_accessor_class_longitudes_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_longitudes_t* self = (grib_accessor_longitudes_t*)a; int n = 0; self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); @@ -126,10 +30,9 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ +int grib_accessor_class_longitudes_t::unpack_double(grib_accessor* a, double* val, size_t* len){ grib_context* c = a->context; - grib_accessor_longitudes* self = (grib_accessor_longitudes*)a; + grib_accessor_longitudes_t* self = (grib_accessor_longitudes_t*)a; int ret = 0; double* v = val; double dummyLat = 0; @@ -181,9 +84,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } -static int value_count(grib_accessor* a, long* len) -{ - grib_accessor_longitudes* self = (grib_accessor_longitudes*)a; +int grib_accessor_class_longitudes_t::value_count(grib_accessor* a, long* len){ + grib_accessor_longitudes_t* self = (grib_accessor_longitudes_t*)a; grib_handle* h = grib_handle_of_accessor(a); grib_context* c = a->context; double* val = NULL; @@ -219,15 +121,13 @@ static int value_count(grib_accessor* a, long* len) return ret; } -static int get_distinct(grib_accessor* a, double** val, long* len) -{ +static int get_distinct(grib_accessor* a, double** val, long* len){ long count = 0; double prev; double* v = NULL; double* v1 = NULL; double dummyLat = 0; int ret = 0; - int i; size_t size = *len; grib_context* c = a->context; @@ -261,7 +161,7 @@ static int get_distinct(grib_accessor* a, double** val, long* len) prev = v[0]; v1[0] = prev; count = 1; - for (i = 1; i < *len; i++) { + for (long i = 1; i < *len; i++) { if (v[i] != prev) { prev = v[i]; v1[count] = prev; @@ -277,8 +177,7 @@ static int get_distinct(grib_accessor* a, double** val, long* len) return GRIB_SUCCESS; } -static int compare_doubles(const void* a, const void* b) -{ +int compare_doubles(const void* a, const void* b){ double* arg1 = (double*)a; double* arg2 = (double*)b; if (*arg1 < *arg2) diff --git a/src/accessor/grib_accessor_class_longitudes.h b/src/accessor/grib_accessor_class_longitudes.h new file mode 100644 index 000000000..def174a74 --- /dev/null +++ b/src/accessor/grib_accessor_class_longitudes.h @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_longitudes_t : public grib_accessor_double_t +{ +public: + /* Members defined in longitudes */ + const char* values; + long distinct; + double* lons; + long size; + int save; +}; + +class grib_accessor_class_longitudes_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_longitudes_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_longitudes_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_lookup.cc b/src/accessor/grib_accessor_class_lookup.cc new file mode 100644 index 000000000..17ccd4d61 --- /dev/null +++ b/src/accessor/grib_accessor_class_lookup.cc @@ -0,0 +1,133 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_lookup.h" + +grib_accessor_class_lookup_t _grib_accessor_class_lookup{"lookup"}; +grib_accessor_class* grib_accessor_class_lookup = &_grib_accessor_class_lookup; + + +void grib_accessor_class_lookup_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_long_t::init(a, len, arg); + grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a; + a->length = 0; + self->llength = len; + self->loffset = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 0); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + self->real_name = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 1); +} + +void grib_accessor_class_lookup_t::post_init(grib_accessor* a){ + grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a; + if (self->real_name) { + grib_dependency_observe_expression(a, self->real_name); + } +} + +void grib_accessor_class_lookup_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a; + unsigned char bytes[1024] = {0,}; + char msg[1024] = {0,}; + char buf[2048]; + int i; + unsigned long v = 0; + + size_t llen = self->llength; + a->unpack_bytes(bytes, &llen); + bytes[llen] = 0; + for (i = 0; i < llen; i++) { + msg[i] = isprint(bytes[i]) ? bytes[i] : '?'; + v <<= 8; + v |= bytes[i]; + } + + msg[llen] = 0; + + snprintf(buf, sizeof(buf), "%s %lu %ld-%ld", msg, v, (long)a->offset + self->loffset, (long)self->llength); + + grib_dump_long(dumper, a, buf); +} + +int grib_accessor_class_lookup_t::unpack_string(grib_accessor* a, char* v, size_t* len){ + grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a; + unsigned char bytes[1024] = {0,}; + int i; + + size_t llen = self->llength; + a->unpack_bytes(bytes, &llen); + bytes[llen] = 0; + + for (i = 0; i < llen; i++) { + v[i] = isprint(bytes[i]) ? bytes[i] : '?'; + } + + v[llen] = 0; + if (llen == 1 && v[0] == '?') { + /* Try unpack as long */ + size_t length = 10; + long lval = 0; + int err = unpack_long(a, &lval, &length); + if (!err) { + char str[5]; + int conv = snprintf(str, sizeof(str), "%ld", lval); + if (conv == 1) { + v[0] = str[0]; + } + } + } + + return GRIB_SUCCESS; +} + +int grib_accessor_class_lookup_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + + long pos = (a->offset + self->loffset) * 8; + + if (len[0] < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); + len[0] = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + /* This is used when reparsing or rebuilding */ + if (h->loader) { + Assert(*len == 1); + return h->loader->lookup_long(h->context, h->loader, a->name, val); + } + + val[0] = grib_decode_unsigned_long(h->buffer->data, &pos, self->llength * 8); + len[0] = 1; + + /*printf("###########lookup unpack_long: %s %ld %ld\n",a->name, pos/8, val[0]);*/ + + return GRIB_SUCCESS; +} + +int grib_accessor_class_lookup_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} + +long grib_accessor_class_lookup_t::byte_count(grib_accessor* a){ + grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a; + return self->llength; +} + +long grib_accessor_class_lookup_t::byte_offset(grib_accessor* a){ + grib_accessor_lookup_t* self = (grib_accessor_lookup_t*)a; + return self->loffset; +} + +int grib_accessor_class_lookup_t::notify_change(grib_accessor* self, grib_accessor* changed){ + /* Forward changes */ + return grib_dependency_notify_change(self); +} diff --git a/src/accessor/grib_accessor_class_lookup.h b/src/accessor/grib_accessor_class_lookup.h new file mode 100644 index 000000000..be1663ae7 --- /dev/null +++ b/src/accessor/grib_accessor_class_lookup.h @@ -0,0 +1,38 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_lookup_t : public grib_accessor_long_t +{ +public: + long llength; + long loffset; + grib_expression* real_name; +}; + +class grib_accessor_class_lookup_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_lookup_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_lookup_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void post_init(grib_accessor*) override; + int notify_change(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_mars_param.cc b/src/accessor/grib_accessor_class_mars_param.cc new file mode 100644 index 000000000..feb5fc905 --- /dev/null +++ b/src/accessor/grib_accessor_class_mars_param.cc @@ -0,0 +1,53 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_mars_param.h" + +grib_accessor_class_mars_param_t _grib_accessor_class_mars_param{"mars_param"}; +grib_accessor_class* grib_accessor_class_mars_param = &_grib_accessor_class_mars_param; + + +void grib_accessor_class_mars_param_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_ascii_t::init(a, l, c); + int n = 0; + grib_accessor_mars_param_t* self = (grib_accessor_mars_param_t*)a; + self->paramId = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->table = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->param = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); +} + +// For an implementation of pack_string, see +// src/deprecated/grib_accessor_class_mars_param.cc + +// For an alternative implementation of unpack_string, see +// src/deprecated/grib_accessor_class_mars_param.cc +// +int grib_accessor_class_mars_param_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_mars_param_t* self = (grib_accessor_mars_param_t*)a; + long param = 0; + long table = 0; + int ret = 0; + + if (self->table != NULL && (ret = grib_get_long_internal(grib_handle_of_accessor(a), self->table, &table)) != GRIB_SUCCESS) + return ret; + if (self->param != NULL && (ret = grib_get_long_internal(grib_handle_of_accessor(a), self->param, ¶m)) != GRIB_SUCCESS) + return ret; + + /*if (table==200) table=128;*/ + snprintf(val, 32, "%ld.%ld", param, table); + *len = strlen(val) + 1; + + return GRIB_SUCCESS; +} + +size_t grib_accessor_class_mars_param_t::string_length(grib_accessor* a){ + return 7; +} diff --git a/src/accessor/grib_accessor_class_mars_param.h b/src/accessor/grib_accessor_class_mars_param.h new file mode 100644 index 000000000..1eab50fb6 --- /dev/null +++ b/src/accessor/grib_accessor_class_mars_param.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_mars_param_t : public grib_accessor_ascii_t +{ +public: + /* Members defined in mars_param */ + const char* paramId; + const char* table; + const char* param; +}; + +class grib_accessor_class_mars_param_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_mars_param_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_mars_param_t{}; } + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_mars_step.cc b/src/accessor/grib_accessor_class_mars_step.cc new file mode 100644 index 000000000..8fd9f9dfa --- /dev/null +++ b/src/accessor/grib_accessor_class_mars_step.cc @@ -0,0 +1,126 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_mars_step.h" + +grib_accessor_class_mars_step_t _grib_accessor_class_mars_step{ "mars_step" }; +grib_accessor_class* grib_accessor_class_mars_step = &_grib_accessor_class_mars_step; + + +void grib_accessor_class_mars_step_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_ascii_t::init(a, l, c); + int n = 0; + grib_accessor_mars_step_t* self = (grib_accessor_mars_step_t*)a; + self->stepRange = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->stepType = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); +} + +int grib_accessor_class_mars_step_t::pack_string(grib_accessor* a, const char* val, size_t* len) +{ + char stepType[100]; + size_t stepTypeLen = 100; + char buf[100] = {0,}; + int ret; + grib_accessor_mars_step_t* self = (grib_accessor_mars_step_t*)a; + grib_accessor* stepRangeAcc = grib_find_accessor(grib_handle_of_accessor(a), self->stepRange); + + if (!stepRangeAcc) { + grib_context_log(a->context, GRIB_LOG_ERROR, "%s not found", self->stepRange); + return GRIB_NOT_FOUND; + } + + if ((ret = grib_get_string(grib_handle_of_accessor(a), self->stepType, stepType, &stepTypeLen)) != GRIB_SUCCESS) + return ret; + + if (!strcmp(stepType, "instant")) + snprintf(buf, sizeof(buf), "%s", val); + else + snprintf(buf, sizeof(buf), "0-%s", val); + + return stepRangeAcc->pack_string(buf, len); +} + +int grib_accessor_class_mars_step_t::unpack_string(grib_accessor* a, char* val, size_t* len) +{ + grib_accessor_mars_step_t* self = (grib_accessor_mars_step_t*)a; + + int ret = 0; + char buf[100] = {0,}; + char* p = NULL; + size_t buflen = 100; + long step; + grib_accessor* stepRangeAcc = grib_find_accessor(grib_handle_of_accessor(a), self->stepRange); + const char* cclass_name = a->cclass->name; + + if (!stepRangeAcc) { + grib_context_log(a->context, GRIB_LOG_ERROR, "%s: %s not found", cclass_name, self->stepRange); + return GRIB_NOT_FOUND; + } + + if ((ret = stepRangeAcc->unpack_string(buf, &buflen)) != GRIB_SUCCESS) + return ret; + + if (*len < buflen) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, buflen, *len); + *len = buflen; + return GRIB_BUFFER_TOO_SMALL; + } + + strcpy(val, buf); + step = strtol(buf, &p, 10); + + if (p != NULL && *p == '-' && step == 0) + strcpy(val, ++p); + + *len = strlen(val); + + return ret; +} + +int grib_accessor_class_mars_step_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + char buff[100] = {0,}; + size_t bufflen = 100; + + snprintf(buff, sizeof(buff), "%ld", *val); + + return pack_string(a, buff, &bufflen); +} + +int grib_accessor_class_mars_step_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_mars_step_t* self = (grib_accessor_mars_step_t*)a; + grib_accessor* stepRangeAcc = grib_find_accessor(grib_handle_of_accessor(a), self->stepRange); + + if (!stepRangeAcc) + return GRIB_NOT_FOUND; + + return stepRangeAcc->unpack_long(val, len); +} + +int grib_accessor_class_mars_step_t::value_count(grib_accessor* a, long* count) +{ + *count = 1; + return 0; +} + +size_t grib_accessor_class_mars_step_t::string_length(grib_accessor* a) +{ + return 16; +} + +int grib_accessor_class_mars_step_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_mars_step.h b/src/accessor/grib_accessor_class_mars_step.h new file mode 100644 index 000000000..8a49f56a6 --- /dev/null +++ b/src/accessor/grib_accessor_class_mars_step.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_mars_step_t : public grib_accessor_ascii_t +{ +public: + /* Members defined in mars_step */ + const char* stepRange; + const char* stepType; +}; + +class grib_accessor_class_mars_step_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_mars_step_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_mars_step_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_md5.cc b/src/accessor/grib_accessor_class_md5.cc similarity index 51% rename from src/grib_accessor_class_md5.cc rename to src/accessor/grib_accessor_class_md5.cc index 6a57c1329..40cbae672 100644 --- a/src/grib_accessor_class_md5.cc +++ b/src/accessor/grib_accessor_class_md5.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,108 +9,17 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" +#include "grib_accessor_class_md5.h" #include "md5.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = get_native_type;init - IMPLEMENTS = compare;unpack_string;value_count;destroy - MEMBERS = const char* offset - MEMBERS = grib_expression* length - MEMBERS = grib_string_list* blocklist - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_md5 -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in md5 */ - const char* offset; - grib_expression* length; - grib_string_list* blocklist; -} grib_accessor_md5; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_md5 = { - &grib_accessor_class_gen, /* super */ - "md5", /* name */ - sizeof(grib_accessor_md5), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_md5_t _grib_accessor_class_md5{ "md5" }; grib_accessor_class* grib_accessor_class_md5 = &_grib_accessor_class_md5; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long len, grib_arguments* arg) +void grib_accessor_class_md5_t::init(grib_accessor* a, const long len, grib_arguments* arg) { - grib_accessor_md5* self = (grib_accessor_md5*)a; + grib_accessor_class_gen_t::init(a, len, arg); + grib_accessor_md5_t* self = (grib_accessor_md5_t*)a; char* b = 0; int n = 0; grib_string_list* current = 0; @@ -138,12 +48,12 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg) a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_md5_t::get_native_type(grib_accessor* a) { return GRIB_TYPE_STRING; } -static int compare(grib_accessor* a, grib_accessor* b) +int grib_accessor_class_md5_t::compare(grib_accessor* a, grib_accessor* b) { int retval = GRIB_SUCCESS; @@ -152,12 +62,12 @@ static int compare(grib_accessor* a, grib_accessor* b) int err = 0; long count = 0; - err = grib_value_count(a, &count); + err = a->value_count(&count); if (err) return err; alen = count; - err = grib_value_count(b, &count); + err = b->value_count(&count); if (err) return err; blen = count; @@ -168,16 +78,16 @@ static int compare(grib_accessor* a, grib_accessor* b) return retval; } -static int unpack_string(grib_accessor* a, char* v, size_t* len) +int grib_accessor_class_md5_t::unpack_string(grib_accessor* a, char* v, size_t* len) { - grib_accessor_md5* self = (grib_accessor_md5*)a; + grib_accessor_md5_t* self = (grib_accessor_md5_t*)a; unsigned mess_len; unsigned char* mess; unsigned char* p; long offset = 0, length = 0; grib_string_list* blocklist = NULL; int ret = GRIB_SUCCESS; - long i = 0; + long i = 0; struct grib_md5_state md5c; if (*len < 32) { @@ -226,9 +136,9 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len) return ret; } -static void destroy(grib_context* c, grib_accessor* a) +void grib_accessor_class_md5_t::destroy(grib_context* c, grib_accessor* a) { - grib_accessor_md5* self = (grib_accessor_md5*)a; + grib_accessor_md5_t* self = (grib_accessor_md5_t*)a; if (self->blocklist) { grib_string_list* next = self->blocklist; grib_string_list* cur = NULL; @@ -239,9 +149,10 @@ static void destroy(grib_context* c, grib_accessor* a) grib_context_free(c, cur); } } + grib_accessor_class_gen_t::destroy(c, a); } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_md5_t::value_count(grib_accessor* a, long* count) { *count = 1; /* ECC-1475 */ return 0; diff --git a/src/accessor/grib_accessor_class_md5.h b/src/accessor/grib_accessor_class_md5.h new file mode 100644 index 000000000..ae66f397f --- /dev/null +++ b/src/accessor/grib_accessor_class_md5.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_md5_t : public grib_accessor_gen_t +{ +public: + /* Members defined in md5 */ + const char* offset; + grib_expression* length; + grib_string_list* blocklist; +}; + +class grib_accessor_class_md5_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_md5_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_md5_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_message.cc b/src/accessor/grib_accessor_class_message.cc new file mode 100644 index 000000000..be704b1a1 --- /dev/null +++ b/src/accessor/grib_accessor_class_message.cc @@ -0,0 +1,75 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_message.h" + +grib_accessor_class_message_t _grib_accessor_class_message{"message"}; +grib_accessor_class* grib_accessor_class_message = &_grib_accessor_class_message; + + + +void grib_accessor_class_message_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_bytes_t::init(a, len, arg); + a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = grib_handle_of_accessor(a)->buffer->ulength - len - a->offset; +} + +// static int compare(grib_accessor* a, grib_accessor* b) +// { +// if (a->length != b->length) +// return GRIB_COUNT_MISMATCH; +// return GRIB_SUCCESS; +// } + +void grib_accessor_class_message_t::update_size(grib_accessor* a, size_t new_size){ + a->length = new_size; +} + +void grib_accessor_class_message_t::resize(grib_accessor* a, size_t new_size){ + grib_context_log(a->context, GRIB_LOG_FATAL, "%s %s: Not supported", a->cclass->name, __func__); + + // void* zero = grib_context_malloc_clear(a->context, new_size); + // grib_buffer_replace(a, (const unsigned char*)zero, new_size, 1, 0); + // grib_context_free(a->context, zero); + // grib_context_log(a->context, GRIB_LOG_DEBUG, "resize: grib_accessor_class_message %ld %ld %s %s", + // (long)new_size, (long)a->length, a->cclass->name, a->name); + // Assert(new_size == a->length); +} + +int grib_accessor_class_message_t::value_count(grib_accessor* a, long* count){ + *count = 1; + return 0; +} + +int grib_accessor_class_message_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + long i = 0; + size_t l = string_length(a) + 1; + grib_handle* h = grib_handle_of_accessor(a); + + if (*len < l) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + a->cclass->name, a->name, l, *len); + *len = l; + return GRIB_BUFFER_TOO_SMALL; + } + + for (i = 0; i < a->length; i++) + val[i] = h->buffer->data[a->offset + i]; + val[i] = 0; + *len = i; + return GRIB_SUCCESS; +} + +size_t grib_accessor_class_message_t::string_length(grib_accessor* a){ + return a->length; +} diff --git a/src/accessor/grib_accessor_class_message.h b/src/accessor/grib_accessor_class_message.h new file mode 100644 index 000000000..2e29d6ebd --- /dev/null +++ b/src/accessor/grib_accessor_class_message.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_bytes.h" + +class grib_accessor_message_t : public grib_accessor_bytes_t +{ +public: + /* Members defined in message */ +}; + +class grib_accessor_class_message_t : public grib_accessor_class_bytes_t +{ +public: + grib_accessor_class_message_t(const char* name) : grib_accessor_class_bytes_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_message_t{}; } + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; + void resize(grib_accessor*,size_t) override; +}; diff --git a/src/accessor/grib_accessor_class_message_copy.cc b/src/accessor/grib_accessor_class_message_copy.cc new file mode 100644 index 000000000..7927b6c60 --- /dev/null +++ b/src/accessor/grib_accessor_class_message_copy.cc @@ -0,0 +1,59 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_message_copy.h" + +grib_accessor_class_message_copy_t _grib_accessor_class_message_copy{"message_copy"}; +grib_accessor_class* grib_accessor_class_message_copy = &_grib_accessor_class_message_copy; + + +void grib_accessor_class_message_copy_t::init(grib_accessor* a, const long length, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, length, args); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +void grib_accessor_class_message_copy_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_string(dumper, a, NULL); +} + +int grib_accessor_class_message_copy_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_STRING; +} + +int grib_accessor_class_message_copy_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + size_t slen = grib_handle_of_accessor(a)->buffer->ulength; + size_t i; + unsigned char* v = 0; + + if (*len < slen) { + return GRIB_ARRAY_TOO_SMALL; + } + v = grib_handle_of_accessor(a)->buffer->data; + /* replace unprintable characters with space */ + for (i = 0; i < slen; i++) + if (v[i] > 126) + v[i] = 32; + memcpy(val, grib_handle_of_accessor(a)->buffer->data, slen); + val[i] = 0; + + *len = slen; + + return GRIB_SUCCESS; +} + +size_t grib_accessor_class_message_copy_t::string_length(grib_accessor* a){ + return grib_handle_of_accessor(a)->buffer->ulength; +} + +long grib_accessor_class_message_copy_t::byte_count(grib_accessor* a){ + return a->length; +} diff --git a/src/accessor/grib_accessor_class_message_copy.h b/src/accessor/grib_accessor_class_message_copy.h new file mode 100644 index 000000000..608817a93 --- /dev/null +++ b/src/accessor/grib_accessor_class_message_copy.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_message_copy_t : public grib_accessor_gen_t +{ +public: + /* Members defined in message_copy */ +}; + +class grib_accessor_class_message_copy_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_message_copy_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_message_copy_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + long byte_count(grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_multdouble.cc b/src/accessor/grib_accessor_class_multdouble.cc new file mode 100644 index 000000000..cbe5b42da --- /dev/null +++ b/src/accessor/grib_accessor_class_multdouble.cc @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_multdouble.h" + +grib_accessor_class_multdouble_t _grib_accessor_class_multdouble{"multdouble"}; +grib_accessor_class* grib_accessor_class_multdouble = &_grib_accessor_class_multdouble; + + +void grib_accessor_class_multdouble_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_multdouble_t* self = (grib_accessor_multdouble_t*)a; + int n = 0; + + self->val = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->multiplier = grib_arguments_get_double(grib_handle_of_accessor(a), c, n++); +} + +int grib_accessor_class_multdouble_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + const grib_accessor_multdouble_t* self = (grib_accessor_multdouble_t*)a; + int ret = GRIB_SUCCESS; + double value = 0; + + ret = grib_get_double_internal(grib_handle_of_accessor(a), self->val, &value); + if (ret != GRIB_SUCCESS) + return ret; + + *val = value * self->multiplier; + + *len = 1; + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_multdouble.h b/src/accessor/grib_accessor_class_multdouble.h new file mode 100644 index 000000000..025daf903 --- /dev/null +++ b/src/accessor/grib_accessor_class_multdouble.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_multdouble_t : public grib_accessor_double_t +{ +public: + /* Members defined in multdouble */ + const char* val; + double multiplier; +}; + +class grib_accessor_class_multdouble_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_multdouble_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_multdouble_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_nearest.cc b/src/accessor/grib_accessor_class_nearest.cc new file mode 100644 index 000000000..6dbac1722 --- /dev/null +++ b/src/accessor/grib_accessor_class_nearest.cc @@ -0,0 +1,49 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_nearest.h" + +grib_accessor_class_nearest_t _grib_accessor_class_nearest{"nearest"}; +grib_accessor_class* grib_accessor_class_nearest = &_grib_accessor_class_nearest; + + +void grib_accessor_class_nearest_t::init(grib_accessor* a, const long l, grib_arguments* args) +{ + grib_accessor_class_gen_t::init(a, l, args); + grib_accessor_nearest_t* self = (grib_accessor_nearest_t*)a; + self->args = args; +} + +void grib_accessor_class_nearest_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + /* TODO: pass args */ + grib_dump_label(dumper, a, NULL); +} + +grib_nearest* grib_nearest_new(const grib_handle* ch, int* error) +{ + grib_handle* h = (grib_handle*)ch; + grib_accessor* a = NULL; + grib_accessor_nearest_t* na = NULL; + grib_nearest* n = NULL; + *error = GRIB_NOT_IMPLEMENTED; + a = grib_find_accessor(h, "NEAREST"); + na = (grib_accessor_nearest_t*)a; + + if (!a) + return NULL; + + n = grib_nearest_factory(h, na->args, error); + + if (n) + *error = GRIB_SUCCESS; + + return n; +} diff --git a/src/accessor/grib_accessor_class_nearest.h b/src/accessor/grib_accessor_class_nearest.h new file mode 100644 index 000000000..3ac4fdae2 --- /dev/null +++ b/src/accessor/grib_accessor_class_nearest.h @@ -0,0 +1,31 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_nearest_t : public grib_accessor_gen_t +{ +public: + grib_arguments* args; +}; + + +class grib_accessor_class_nearest_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_nearest_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_nearest_t{}; } + void init(grib_accessor* a, const long l, grib_arguments* args) override; + void dump(grib_accessor* a, grib_dumper* dumper) override; +}; + +//grib_nearest* grib_nearest_new(const grib_handle* ch, int* error); diff --git a/src/accessor/grib_accessor_class_non_alpha.cc b/src/accessor/grib_accessor_class_non_alpha.cc new file mode 100644 index 000000000..68aaffdd7 --- /dev/null +++ b/src/accessor/grib_accessor_class_non_alpha.cc @@ -0,0 +1,112 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_non_alpha.h" + +grib_accessor_class_non_alpha_t _grib_accessor_class_non_alpha{"non_alpha"}; +grib_accessor_class* grib_accessor_class_non_alpha = &_grib_accessor_class_non_alpha; + + +void grib_accessor_class_non_alpha_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + grib_buffer* buffer = grib_handle_of_accessor(a)->buffer; + size_t i = 0; + unsigned char* v; + + v = buffer->data + a->offset; + i = 0; + while ((*v < 33 || *v > 126) && i <= buffer->ulength) { + v++; + i++; + } + a->length = i; + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_non_alpha_t::value_count(grib_accessor* a, long* count){ + *count = 1; + return 0; +} + +size_t grib_accessor_class_non_alpha_t::string_length(grib_accessor* a){ + return a->length; +} + +void grib_accessor_class_non_alpha_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_string(dumper, a, NULL); +} + +int grib_accessor_class_non_alpha_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_STRING; +} + +int grib_accessor_class_non_alpha_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_handle* hand = grib_handle_of_accessor(a); + long i = 0; + + if (*len < (a->length + 1)) { + grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values", + *len, a->name, a->length + 1); + *len = a->length + 1; + return GRIB_BUFFER_TOO_SMALL; + } + + for (i = 0; i < a->length; i++) { + val[i] = hand->buffer->data[a->offset + i]; + } + val[i] = 0; + *len = i; + return GRIB_SUCCESS; +} + +int grib_accessor_class_non_alpha_t::unpack_long(grib_accessor* a, long* v, size_t* len){ + char val[1024] = {0,}; + size_t l = sizeof(val); + size_t i = 0; + char* last = NULL; + int err = a->unpack_string(val, &l); + if (err) + return err; + + i = 0; + while (i < l - 1 && val[i] == ' ') + i++; + + if (val[i] == 0) { + *v = 0; + return 0; + } + if (val[i + 1] == ' ' && i < l - 2) + val[i + 1] = 0; + + *v = strtol(val, &last, 10); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_non_alpha_t::unpack_double(grib_accessor* a, double* v, size_t* len){ + char val[1024]; + size_t l = sizeof(val); + char* last = NULL; + a->unpack_string(val, &l); + *v = strtod(val, &last); + + if (*last == 0) { + return GRIB_SUCCESS; + } + + return GRIB_NOT_IMPLEMENTED; +} + +long grib_accessor_class_non_alpha_t::next_offset(grib_accessor* a){ + return a->offset + a->length; +} diff --git a/src/accessor/grib_accessor_class_non_alpha.h b/src/accessor/grib_accessor_class_non_alpha.h new file mode 100644 index 000000000..83b1ca9ba --- /dev/null +++ b/src/accessor/grib_accessor_class_non_alpha.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_non_alpha_t : public grib_accessor_gen_t +{ +public: + /* Members defined in non_alpha */ +}; + +class grib_accessor_class_non_alpha_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_non_alpha_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_non_alpha_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_number_of_coded_values.cc b/src/accessor/grib_accessor_class_number_of_coded_values.cc new file mode 100644 index 000000000..f1023dd2e --- /dev/null +++ b/src/accessor/grib_accessor_class_number_of_coded_values.cc @@ -0,0 +1,66 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_number_of_coded_values.h" + +grib_accessor_class_number_of_coded_values_t _grib_accessor_class_number_of_coded_values{"number_of_coded_values"}; +grib_accessor_class* grib_accessor_class_number_of_coded_values = &_grib_accessor_class_number_of_coded_values; + + +void grib_accessor_class_number_of_coded_values_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + int n = 0; + grib_accessor_number_of_coded_values_t* self = (grib_accessor_number_of_coded_values_t*)a; + self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_number_of_coded_values_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + int ret = GRIB_SUCCESS; + long bpv = 0; + long offsetBeforeData = 0, offsetAfterData = 0, unusedBits = 0, numberOfValues; + + grib_accessor_number_of_coded_values_t* self = (grib_accessor_number_of_coded_values_t*)a; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitsPerValue, &bpv)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetBeforeData, &offsetBeforeData)) != GRIB_SUCCESS) + return ret; + + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetAfterData, &offsetAfterData)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &unusedBits)) != GRIB_SUCCESS) + return ret; + + if (bpv != 0) { + grib_context_log(a->context, GRIB_LOG_DEBUG, "grib_accessor_number_of_coded_values_t: offsetAfterData=%ld offsetBeforeData=%ld unusedBits=%ld bpv=%ld\n", + offsetAfterData, offsetBeforeData, unusedBits, bpv); + DEBUG_ASSERT(offsetAfterData > offsetBeforeData); + *val = ((offsetAfterData - offsetBeforeData) * 8 - unusedBits) / bpv; + } + else { + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues, &numberOfValues)) != GRIB_SUCCESS) + return ret; + + *val = numberOfValues; + } + + return ret; +} diff --git a/src/accessor/grib_accessor_class_number_of_coded_values.h b/src/accessor/grib_accessor_class_number_of_coded_values.h new file mode 100644 index 000000000..6578e1dcf --- /dev/null +++ b/src/accessor/grib_accessor_class_number_of_coded_values.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_number_of_coded_values_t : public grib_accessor_long_t +{ +public: + /* Members defined in number_of_coded_values */ + const char* numberOfValues; + const char* bitsPerValue; + const char* offsetBeforeData; + const char* offsetAfterData; + const char* unusedBits; +}; + +class grib_accessor_class_number_of_coded_values_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_number_of_coded_values_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_number_of_coded_values_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_number_of_points.cc b/src/accessor/grib_accessor_class_number_of_points.cc new file mode 100644 index 000000000..c1b63f2a2 --- /dev/null +++ b/src/accessor/grib_accessor_class_number_of_points.cc @@ -0,0 +1,80 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_number_of_points.h" + +grib_accessor_class_number_of_points_t _grib_accessor_class_number_of_points{"number_of_points"}; +grib_accessor_class* grib_accessor_class_number_of_points = &_grib_accessor_class_number_of_points; + + +void grib_accessor_class_number_of_points_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + int n = 0; + grib_handle* hand = grib_handle_of_accessor(a); + + grib_accessor_number_of_points_t* self = (grib_accessor_number_of_points_t*)a; + self->ni = grib_arguments_get_name(hand, c, n++); + self->nj = grib_arguments_get_name(hand, c, n++); + self->plpresent = grib_arguments_get_name(hand, c, n++); + self->pl = grib_arguments_get_name(hand, c, n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_number_of_points_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_number_of_points_t* self = (grib_accessor_number_of_points_t*)a; + + int ret = GRIB_SUCCESS; + long ni = 0, nj = 0, plpresent = 0; + size_t plsize = 0; + long* pl = NULL; + int i = 0; + grib_context* c = a->context; + grib_handle* hand = grib_handle_of_accessor(a); + + if ((ret = grib_get_long_internal(hand, self->ni, &ni)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(hand, self->nj, &nj)) != GRIB_SUCCESS) + return ret; + + if (self->plpresent && + ((ret = grib_get_long_internal(hand, self->plpresent, &plpresent)) != GRIB_SUCCESS)) + return ret; + + if (grib_is_missing(hand, self->nj, &ret) && ret == GRIB_SUCCESS) { + grib_context_log(c, GRIB_LOG_ERROR, "grib_accessor_class_number_of_points: Key %s cannot be 'missing'!", self->nj); + return GRIB_GEOCALCULUS_PROBLEM; + } + + if (nj == 0) { + grib_context_log(c, GRIB_LOG_ERROR, "grib_accessor_class_number_of_points: Key %s cannot be 0!", self->nj); + return GRIB_GEOCALCULUS_PROBLEM; + } + + if (plpresent) { + /*reduced*/ + plsize = nj; + pl = (long*)grib_context_malloc(c, sizeof(long) * plsize); + grib_get_long_array_internal(hand, self->pl, pl, &plsize); + *val = 0; + for (i = 0; i < plsize; i++) + *val += pl[i]; + grib_context_free(c, pl); + } + else { + /*regular*/ + *val = ni * nj; + } + + return ret; +} diff --git a/src/accessor/grib_accessor_class_number_of_points.h b/src/accessor/grib_accessor_class_number_of_points.h new file mode 100644 index 000000000..f55d9bbeb --- /dev/null +++ b/src/accessor/grib_accessor_class_number_of_points.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_number_of_points_t : public grib_accessor_long_t +{ +public: + /* Members defined in number_of_points */ + const char* ni; + const char* nj; + const char* plpresent; + const char* pl; +}; + +class grib_accessor_class_number_of_points_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_number_of_points_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_number_of_points_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_number_of_points_gaussian.cc b/src/accessor/grib_accessor_class_number_of_points_gaussian.cc similarity index 64% rename from src/grib_accessor_class_number_of_points_gaussian.cc rename to src/accessor/grib_accessor_class_number_of_points_gaussian.cc index 2114a9c87..39324fbd3 100644 --- a/src/grib_accessor_class_number_of_points_gaussian.cc +++ b/src/accessor/grib_accessor_class_number_of_points_gaussian.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,137 +9,31 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/************************************** - * Enrico Fucile - ************************************/ - -#include "grib_api_internal.h" - - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS = const char* ni - MEMBERS = const char* nj - MEMBERS = const char* plpresent - MEMBERS = const char* pl - MEMBERS = const char* order - MEMBERS = const char* lat_first - MEMBERS = const char* lon_first - MEMBERS = const char* lat_last - MEMBERS = const char* lon_last - MEMBERS = const char* support_legacy - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_number_of_points_gaussian -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in number_of_points_gaussian */ - const char* ni; - const char* nj; - const char* plpresent; - const char* pl; - const char* order; - const char* lat_first; - const char* lon_first; - const char* lat_last; - const char* lon_last; - const char* support_legacy; -} grib_accessor_number_of_points_gaussian; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_number_of_points_gaussian = { - &grib_accessor_class_long, /* super */ - "number_of_points_gaussian", /* name */ - sizeof(grib_accessor_number_of_points_gaussian), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_number_of_points_gaussian.h" +grib_accessor_class_number_of_points_gaussian_t _grib_accessor_class_number_of_points_gaussian{ "number_of_points_gaussian" }; grib_accessor_class* grib_accessor_class_number_of_points_gaussian = &_grib_accessor_class_number_of_points_gaussian; -/* END_CLASS_IMP */ #define EFDEBUG 0 -static void init(grib_accessor* a, const long l, grib_arguments* c) +void grib_accessor_class_number_of_points_gaussian_t::init(grib_accessor* a, const long l, grib_arguments* c) { - int n = 0; - grib_handle* h = grib_handle_of_accessor(a); - grib_accessor_number_of_points_gaussian* self = (grib_accessor_number_of_points_gaussian*)a; - self->ni = grib_arguments_get_name(h, c, n++); - self->nj = grib_arguments_get_name(h, c, n++); - self->plpresent = grib_arguments_get_name(h, c, n++); - self->pl = grib_arguments_get_name(h, c, n++); - self->order = grib_arguments_get_name(h, c, n++); - self->lat_first = grib_arguments_get_name(h, c, n++); - self->lon_first = grib_arguments_get_name(h, c, n++); - self->lat_last = grib_arguments_get_name(h, c, n++); - self->lon_last = grib_arguments_get_name(h, c, n++); - self->support_legacy = grib_arguments_get_name(h, c, n++); + grib_accessor_class_long_t::init(a, l, c); + int n = 0; + grib_handle* h = grib_handle_of_accessor(a); + grib_accessor_number_of_points_gaussian_t* self = (grib_accessor_number_of_points_gaussian_t*)a; + + self->ni = grib_arguments_get_name(h, c, n++); + self->nj = grib_arguments_get_name(h, c, n++); + self->plpresent = grib_arguments_get_name(h, c, n++); + self->pl = grib_arguments_get_name(h, c, n++); + self->order = grib_arguments_get_name(h, c, n++); + self->lat_first = grib_arguments_get_name(h, c, n++); + self->lon_first = grib_arguments_get_name(h, c, n++); + self->lat_last = grib_arguments_get_name(h, c, n++); + self->lon_last = grib_arguments_get_name(h, c, n++); + self->support_legacy = grib_arguments_get_name(h, c, n++); a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; a->length = 0; @@ -147,7 +42,6 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) // Old implementation of num_points_reduced_gauss_old // See src/deprecated/grib_accessor_class_number_of_points_gaussian.cc // - static int angleApproximatelyEqual(double A, double B, double angular_precision) { return angular_precision > 0 ? (fabs(A - B) <= angular_precision) : (A == B); @@ -218,15 +112,15 @@ static int get_number_of_data_values(grib_handle* h, size_t* numDataValues) return err; } -static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* len); -static int unpack_long_new(grib_accessor* a, long* val, size_t* len); +int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* len); +int unpack_long_new(grib_accessor* a, long* val, size_t* len); -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_number_of_points_gaussian_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - int err = GRIB_SUCCESS; - long support_legacy = 1; - grib_accessor_number_of_points_gaussian* self = (grib_accessor_number_of_points_gaussian*)a; - grib_handle* h = grib_handle_of_accessor(a); + int err = GRIB_SUCCESS; + long support_legacy = 1; + grib_accessor_number_of_points_gaussian_t* self = (grib_accessor_number_of_points_gaussian_t*)a; + grib_handle* h = grib_handle_of_accessor(a); if ((err = grib_get_long_internal(h, self->support_legacy, &support_legacy)) != GRIB_SUCCESS) return err; @@ -238,7 +132,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) } /* New algorithm */ -static int unpack_long_new(grib_accessor* a, long* val, size_t* len) +int unpack_long_new(grib_accessor* a, long* val, size_t* len) { int err = GRIB_SUCCESS; int is_global = 0; @@ -253,8 +147,8 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) long angleSubdivisions = 0; grib_handle* h = grib_handle_of_accessor(a); - grib_accessor_number_of_points_gaussian* self = (grib_accessor_number_of_points_gaussian*)a; - grib_context* c = a->context; + grib_accessor_number_of_points_gaussian_t* self = (grib_accessor_number_of_points_gaussian_t*)a; + grib_context* c = a->context; if ((err = grib_get_long_internal(h, self->ni, &ni)) != GRIB_SUCCESS) return err; @@ -274,8 +168,8 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) } if (plpresent) { - long max_pl = 0; - int j = 0; + long max_pl = 0; + int j = 0; // double lon_first_row = 0, lon_last_row = 0; /*reduced*/ @@ -324,8 +218,8 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) return GRIB_GEOCALCULUS_PROBLEM; } grib_get_reduced_row_wrapper(h, pl[j], lon_first, lon_last, &row_count, &ilon_first, &ilon_last); - //lon_first_row = ((ilon_first)*360.0) / pl[j]; - //lon_last_row = ((ilon_last)*360.0) / pl[j]; + // lon_first_row = ((ilon_first)*360.0) / pl[j]; + // lon_last_row = ((ilon_last)*360.0) / pl[j]; *val += row_count; } } @@ -347,7 +241,7 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) } /* With Legacy support */ -static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* len) +int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* len) { int err = GRIB_SUCCESS; int is_global = 0; @@ -363,8 +257,8 @@ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* grib_handle* h = grib_handle_of_accessor(a); size_t numDataValues = 0; - grib_accessor_number_of_points_gaussian* self = (grib_accessor_number_of_points_gaussian*)a; - grib_context* c = a->context; + grib_accessor_number_of_points_gaussian_t* self = (grib_accessor_number_of_points_gaussian_t*)a; + grib_context* c = a->context; if ((err = grib_get_long_internal(h, self->ni, &ni)) != GRIB_SUCCESS) return err; @@ -385,7 +279,7 @@ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* if (plpresent) { long max_pl = 0; - int j = 0; + int j = 0; // double lon_first_row = 0, lon_last_row = 0; /*reduced*/ @@ -447,9 +341,9 @@ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* } grib_get_reduced_row_wrapper(h, pl[j], lon_first, lon_last, &row_count, &ilon_first, &ilon_last); -// if ( row_count != pl[j] ) { -// printf("oops...... rc=%ld but pl[%d]=%ld\n", row_count, j,pl[j]); -// } + // if ( row_count != pl[j] ) { + // printf("oops...... rc=%ld but pl[%d]=%ld\n", row_count, j,pl[j]); + // } // lon_first_row = ((ilon_first)*360.0) / pl[j]; // lon_last_row = ((ilon_last)*360.0) / pl[j]; *val += row_count; diff --git a/src/accessor/grib_accessor_class_number_of_points_gaussian.h b/src/accessor/grib_accessor_class_number_of_points_gaussian.h new file mode 100644 index 000000000..d00fb5b6e --- /dev/null +++ b/src/accessor/grib_accessor_class_number_of_points_gaussian.h @@ -0,0 +1,39 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_number_of_points_gaussian_t : public grib_accessor_long_t +{ +public: + /* Members defined in number_of_points_gaussian */ + const char* ni; + const char* nj; + const char* plpresent; + const char* pl; + const char* order; + const char* lat_first; + const char* lon_first; + const char* lat_last; + const char* lon_last; + const char* support_legacy; +}; + +class grib_accessor_class_number_of_points_gaussian_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_number_of_points_gaussian_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_number_of_points_gaussian_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_number_of_values.cc b/src/accessor/grib_accessor_class_number_of_values.cc new file mode 100644 index 000000000..414cf5e05 --- /dev/null +++ b/src/accessor/grib_accessor_class_number_of_values.cc @@ -0,0 +1,67 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_number_of_values.h" + +grib_accessor_class_number_of_values_t _grib_accessor_class_number_of_values{"number_of_values"}; +grib_accessor_class* grib_accessor_class_number_of_values = &_grib_accessor_class_number_of_values; + + +void grib_accessor_class_number_of_values_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + int n = 0; + grib_accessor_number_of_values_t* self = (grib_accessor_number_of_values_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + + self->values = grib_arguments_get_name(hand, c, n++); + self->bitsPerValue = grib_arguments_get_name(hand, c, n++); + self->numberOfPoints = grib_arguments_get_name(hand, c, n++); + self->bitmapPresent = grib_arguments_get_name(hand, c, n++); + self->bitmap = grib_arguments_get_name(hand, c, n++); + self->numberOfCodedValues = grib_arguments_get_name(hand, c, n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + + a->length = 0; +} + +int grib_accessor_class_number_of_values_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_number_of_values_t* self = (grib_accessor_number_of_values_t*)a; + int ret = GRIB_SUCCESS, i; + long npoints = 0, bitmap_present = 0; + size_t size = 0; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, &npoints)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitmapPresent, &bitmap_present)) != GRIB_SUCCESS) + return ret; + + if (bitmap_present) { + double* bitmap; + size = npoints; + bitmap = (double*)grib_context_malloc(a->context, sizeof(double) * size); + if ((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->bitmap, bitmap, &size)) != GRIB_SUCCESS) { + grib_context_free(a->context, bitmap); + return ret; + } + *val = 0; + for (i = 0; i < size; i++) + if (bitmap[i] != 0) + (*val)++; + + grib_context_free(a->context, bitmap); + } + else { + *val = npoints; + } + + return ret; +} diff --git a/src/accessor/grib_accessor_class_number_of_values.h b/src/accessor/grib_accessor_class_number_of_values.h new file mode 100644 index 000000000..895669f34 --- /dev/null +++ b/src/accessor/grib_accessor_class_number_of_values.h @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_number_of_values_t : public grib_accessor_long_t +{ +public: + /* Members defined in number_of_values */ + const char* values; + const char* bitsPerValue; + const char* numberOfPoints; + const char* bitmapPresent; + const char* bitmap; + const char* numberOfCodedValues; +}; + +class grib_accessor_class_number_of_values_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_number_of_values_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_number_of_values_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_number_of_values_data_raw_packing.cc b/src/accessor/grib_accessor_class_number_of_values_data_raw_packing.cc new file mode 100644 index 000000000..b8f1d667b --- /dev/null +++ b/src/accessor/grib_accessor_class_number_of_values_data_raw_packing.cc @@ -0,0 +1,63 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_number_of_values_data_raw_packing.h" + +grib_accessor_class_number_of_values_data_raw_packing_t _grib_accessor_class_number_of_values_data_raw_packing{"number_of_values_data_raw_packing"}; +grib_accessor_class* grib_accessor_class_number_of_values_data_raw_packing = &_grib_accessor_class_number_of_values_data_raw_packing; + + +void grib_accessor_class_number_of_values_data_raw_packing_t::init(grib_accessor* a, const long v, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, v, args); + int n = 0; + grib_accessor_number_of_values_data_raw_packing_t* self = (grib_accessor_number_of_values_data_raw_packing_t*)a; + + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +int grib_accessor_class_number_of_values_data_raw_packing_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + int err = 0; + grib_accessor_number_of_values_data_raw_packing_t* self = (grib_accessor_number_of_values_data_raw_packing_t*)a; + grib_accessor* adata = NULL; + long precision = 0; + int bytes = 0; + long byte_count = 0; + + adata = grib_find_accessor(grib_handle_of_accessor(a), self->values); + Assert(adata != NULL); + byte_count = adata->byte_count(); + if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->precision, &precision)) != GRIB_SUCCESS) + return err; + + switch (precision) { + case 1: + bytes = 4; + break; + + case 2: + bytes = 8; + break; + + default: + return GRIB_NOT_IMPLEMENTED; + } + + *val = byte_count / bytes; + + return err; +} + +int grib_accessor_class_number_of_values_data_raw_packing_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_number_of_values_data_raw_packing.h b/src/accessor/grib_accessor_class_number_of_values_data_raw_packing.h new file mode 100644 index 000000000..798f428f5 --- /dev/null +++ b/src/accessor/grib_accessor_class_number_of_values_data_raw_packing.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_number_of_values_data_raw_packing_t : public grib_accessor_gen_t +{ +public: + /* Members defined in number_of_values_data_raw_packing */ + const char* values; + const char* precision; +}; + +class grib_accessor_class_number_of_values_data_raw_packing_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_number_of_values_data_raw_packing_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_number_of_values_data_raw_packing_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_octahedral_gaussian.cc b/src/accessor/grib_accessor_class_octahedral_gaussian.cc new file mode 100644 index 000000000..8c556e84a --- /dev/null +++ b/src/accessor/grib_accessor_class_octahedral_gaussian.cc @@ -0,0 +1,120 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_octahedral_gaussian.h" + +grib_accessor_class_octahedral_gaussian_t _grib_accessor_class_octahedral_gaussian{"octahedral_gaussian"}; +grib_accessor_class* grib_accessor_class_octahedral_gaussian = &_grib_accessor_class_octahedral_gaussian; + + +void grib_accessor_class_octahedral_gaussian_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_octahedral_gaussian_t* self = (grib_accessor_octahedral_gaussian_t*)a; + int n = 0; + grib_handle* hand = grib_handle_of_accessor(a); + + self->N = grib_arguments_get_name(hand, c, n++); + self->Ni = grib_arguments_get_name(hand, c, n++); + self->plpresent = grib_arguments_get_name(hand, c, n++); + self->pl = grib_arguments_get_name(hand, c, n++); +} + +/* Returns 1 (=true) if input pl array is Octahedral, 0 otherwise. + * Possible cases for the deltas in an octahedral pl array: + * +4 .. +4 Top part, above equator + * +4 .. 0 Top part, above and including equator + * +4.. 0 -4.. Middle part, above, equator and below + * 0 -4.. Equator and below + * -4 ..-4 All below equator + * Anything else is considered not octahedral + */ +static int is_pl_octahedral(const long pl[], size_t size){ + long i; + long prev_diff = -1; + for (i = 1; i < size; ++i) { + const long diff = pl[i] - pl[i - 1]; + if (diff == 0) { + /* prev must be +4 or undef */ + if (!(prev_diff == +4 || i == 1)) { + return 0; + } + } + else { + if (labs(diff) != 4) { + return 0; + } + if (diff == +4) { + /* prev must be +4 or undef */ + if (!(prev_diff == +4 || i == 1)) { + return 0; + } + } + if (diff == -4) { + /* prev must be 0, -4 or undef */ + if (!(prev_diff == -4 || prev_diff == 0 || i == 1)) { + return 0; + } + } + } + prev_diff = diff; + } + return 1; /* it's octahedral */ +} + +int grib_accessor_class_octahedral_gaussian_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_octahedral_gaussian_t* self = (grib_accessor_octahedral_gaussian_t*)a; + int ret = GRIB_SUCCESS; + long Ni; + long plpresent = 0; + long* pl = NULL; /* pl array */ + size_t plsize = 0; + grib_handle* hand = grib_handle_of_accessor(a); + + grib_context* c = a->context; + + if ((ret = grib_get_long_internal(hand, self->Ni, &Ni)) != GRIB_SUCCESS) + return ret; + + /* If Ni is not missing, then this is a plain gaussian grid and not reduced. */ + /* So it cannot be an octahedral grid */ + if (Ni != GRIB_MISSING_LONG) { + *val = 0; + return GRIB_SUCCESS; + } + + if ((ret = grib_get_long_internal(hand, self->plpresent, &plpresent)) != GRIB_SUCCESS) + return ret; + if (!plpresent) { + *val = 0; /* Not octahedral */ + return GRIB_SUCCESS; + } + + if ((ret = grib_get_size(hand, self->pl, &plsize)) != GRIB_SUCCESS) + return ret; + Assert(plsize); /* pl array must have at least one element */ + + pl = (long*)grib_context_malloc_clear(c, sizeof(long) * plsize); + if (!pl) { + return GRIB_OUT_OF_MEMORY; + } + if ((ret = grib_get_long_array_internal(hand, self->pl, pl, &plsize)) != GRIB_SUCCESS) + return ret; + + /* pl[0] is guaranteed to exist. Have already asserted previously */ + *val = is_pl_octahedral(pl, plsize); + grib_context_free(c, pl); + + return ret; +} + +int grib_accessor_class_octahedral_gaussian_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} diff --git a/src/accessor/grib_accessor_class_octahedral_gaussian.h b/src/accessor/grib_accessor_class_octahedral_gaussian.h new file mode 100644 index 000000000..cc7f52a25 --- /dev/null +++ b/src/accessor/grib_accessor_class_octahedral_gaussian.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_octahedral_gaussian_t : public grib_accessor_long_t +{ +public: + /* Members defined in octahedral_gaussian */ + const char* N; + const char* Ni; + const char* plpresent; + const char* pl; +}; + +class grib_accessor_class_octahedral_gaussian_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_octahedral_gaussian_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_octahedral_gaussian_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_octet_number.cc b/src/accessor/grib_accessor_class_octet_number.cc new file mode 100644 index 000000000..4b270f257 --- /dev/null +++ b/src/accessor/grib_accessor_class_octet_number.cc @@ -0,0 +1,47 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_octet_number.h" + +grib_accessor_class_octet_number_t _grib_accessor_class_octet_number{"octet_number"}; +grib_accessor_class* grib_accessor_class_octet_number = &_grib_accessor_class_octet_number; + + +void grib_accessor_class_octet_number_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_octet_number_t* self = (grib_accessor_octet_number_t*)a; + + int n = 0; + self->left = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->right = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); + + a->length = 0; +} + +int grib_accessor_class_octet_number_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_octet_number_t* self = (grib_accessor_octet_number_t*)a; + int ret = GRIB_SUCCESS; + long offset; + + offset = a->offset + self->right; + + if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->left, offset)) != GRIB_SUCCESS) + return ret; + + *val = offset; + *len = 1; + + return ret; +} + +int grib_accessor_class_octet_number_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_octet_number.h b/src/accessor/grib_accessor_class_octet_number.h new file mode 100644 index 000000000..691dcb564 --- /dev/null +++ b/src/accessor/grib_accessor_class_octet_number.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_octet_number_t : public grib_accessor_long_t +{ +public: + /* Members defined in octet_number */ + const char* left; + long right; +}; + +class grib_accessor_class_octet_number_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_octet_number_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_octet_number_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_offset_file.cc b/src/accessor/grib_accessor_class_offset_file.cc new file mode 100644 index 000000000..b52e8eb41 --- /dev/null +++ b/src/accessor/grib_accessor_class_offset_file.cc @@ -0,0 +1,55 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_offset_file.h" + +grib_accessor_class_offset_file_t _grib_accessor_class_offset_file{"offset_file"}; +grib_accessor_class* grib_accessor_class_offset_file = &_grib_accessor_class_offset_file; + + +void grib_accessor_class_offset_file_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +int grib_accessor_class_offset_file_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + *val = (double)grib_handle_of_accessor(a)->offset; + *len = 1; + return GRIB_SUCCESS; +} + +int grib_accessor_class_offset_file_t::unpack_string(grib_accessor* a, char* v, size_t* len){ + double val = 0; + size_t l = 1; + char repres[1024] = {0,}; + int err = 0; + const char* cclass_name = a->cclass->name; + + err = a->unpack_double(&val, &l); if (err) return err; + + snprintf(repres, sizeof(repres), "%.0f", val); + + l = strlen(repres) + 1; + if (l > *len) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, l, *len); + *len = l; + return GRIB_BUFFER_TOO_SMALL; + } + grib_context_log(a->context, GRIB_LOG_DEBUG, "%s: Casting double %s to string", __func__, a->name); + + *len = l; + + strcpy(v, repres); + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_offset_file.h b/src/accessor/grib_accessor_class_offset_file.h new file mode 100644 index 000000000..6cb25b864 --- /dev/null +++ b/src/accessor/grib_accessor_class_offset_file.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_offset_file_t : public grib_accessor_double_t +{ +public: + /* Members defined in offset_file */ +}; + +class grib_accessor_class_offset_file_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_offset_file_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_offset_file_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_offset_values.cc b/src/accessor/grib_accessor_class_offset_values.cc new file mode 100644 index 000000000..26f78b5c3 --- /dev/null +++ b/src/accessor/grib_accessor_class_offset_values.cc @@ -0,0 +1,83 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_offset_values.h" + +grib_accessor_class_offset_values_t _grib_accessor_class_offset_values{"offset_values"}; +grib_accessor_class* grib_accessor_class_offset_values = &_grib_accessor_class_offset_values; + + +void grib_accessor_class_offset_values_t::init(grib_accessor* a, const long l, grib_arguments* args){ + grib_accessor_class_double_t::init(a, l, args); + int n = 0; + grib_accessor_offset_values_t* self = (grib_accessor_offset_values_t*)a; + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->missingValue = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_offset_values_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + int ret = 0; + *val = 0; + *len = 1; + return ret; +} + +int grib_accessor_class_offset_values_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + double* values = NULL; + size_t size = 0; + double missingValue = 0; + long missingValuesPresent = 0; + int ret = 0, i = 0; + grib_accessor_offset_values_t* self = (grib_accessor_offset_values_t*)a; + grib_context* c = a->context; + grib_handle* h = grib_handle_of_accessor(a); + + if (*val == 0) + return GRIB_SUCCESS; + + if ((ret = grib_get_double_internal(h, self->missingValue, &missingValue)) != GRIB_SUCCESS) { + return ret; + } + if ((ret = grib_get_long_internal(h, "missingValuesPresent", &missingValuesPresent)) != GRIB_SUCCESS) { + return ret; + } + + if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) + return ret; + + values = (double*)grib_context_malloc(c, size * sizeof(double)); + if (!values) + return GRIB_OUT_OF_MEMORY; + + if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + for (i = 0; i < size; i++) { + if (missingValuesPresent) { + if (values[i] != missingValue) + values[i] += *val; + } + else { + values[i] += *val; + } + } + + if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) + return ret; + + grib_context_free(c, values); + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_offset_values.h b/src/accessor/grib_accessor_class_offset_values.h new file mode 100644 index 000000000..702e48da7 --- /dev/null +++ b/src/accessor/grib_accessor_class_offset_values.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_offset_values_t : public grib_accessor_double_t +{ +public: + /* Members defined in offset_values */ + const char* values; + const char* missingValue; +}; + +class grib_accessor_class_offset_values_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_offset_values_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_offset_values_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_optimal_step_units.cc b/src/accessor/grib_accessor_class_optimal_step_units.cc similarity index 59% rename from src/grib_accessor_class_optimal_step_units.cc rename to src/accessor/grib_accessor_class_optimal_step_units.cc index d06592e31..adc89e743 100644 --- a/src/grib_accessor_class_optimal_step_units.cc +++ b/src/accessor/grib_accessor_class_optimal_step_units.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,119 +9,17 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" +#include "grib_accessor_class_optimal_step_units.h" #include "step.h" #include "step_utilities.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = pack_long;unpack_long;dump - IMPLEMENTS = pack_string;unpack_string;dump - IMPLEMENTS = string_length;pack_expression;get_native_type;is_missing - IMPLEMENTS = init - MEMBERS = const char* forecast_time_value - MEMBERS = const char* forecast_time_unit - MEMBERS = const char* time_range_value - MEMBERS = const char* time_range_unit - MEMBERS = long overwriteStepUnits - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int is_missing(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int pack_expression(grib_accessor*, grib_expression*); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_optimal_step_units -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in optimal_step_units */ - const char* forecast_time_value; - const char* forecast_time_unit; - const char* time_range_value; - const char* time_range_unit; - long overwriteStepUnits; -} grib_accessor_optimal_step_units; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_optimal_step_units = { - &grib_accessor_class_gen, /* super */ - "optimal_step_units", /* name */ - sizeof(grib_accessor_optimal_step_units), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - &is_missing, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - &pack_expression, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_optimal_step_units_t _grib_accessor_class_optimal_step_units{"optimal_step_units"}; grib_accessor_class* grib_accessor_class_optimal_step_units = &_grib_accessor_class_optimal_step_units; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_optimal_step_units* self = (grib_accessor_optimal_step_units*)a; +void grib_accessor_class_optimal_step_units_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_gen_t::init(a, l, c); + grib_accessor_optimal_step_units_t* self = (grib_accessor_optimal_step_units_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int n = 0; @@ -132,18 +31,15 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->overwriteStepUnits = eccodes::Unit{eccodes::Unit::Value::MISSING}.value(); } -static void dump(grib_accessor* a, grib_dumper* dumper) -{ +void grib_accessor_class_optimal_step_units_t::dump(grib_accessor* a, grib_dumper* dumper){ grib_dump_string(dumper, a, NULL); } -static size_t string_length(grib_accessor* a) -{ +size_t grib_accessor_class_optimal_step_units_t::string_length(grib_accessor* a){ return 255; } -static int pack_expression(grib_accessor* a, grib_expression* e) -{ +int grib_accessor_class_optimal_step_units_t::pack_expression(grib_accessor* a, grib_expression* e){ const char* cval = NULL; int ret = 0; long lval = 0; @@ -153,8 +49,7 @@ static int pack_expression(grib_accessor* a, grib_expression* e) if (strcmp(e->cclass->name, "long") == 0) { grib_expression_evaluate_long(hand, e, &lval); /* TODO: check return value */ - ret = grib_pack_long(a, &lval, &len); - } + ret = a->pack_long(&lval, &len); } else { char tmp[1024]; len = sizeof(tmp); @@ -168,15 +63,13 @@ static int pack_expression(grib_accessor* a, grib_expression* e) len = strlen(cval) + 1; //if (hand->context->debug) // printf("ECCODES DEBUG grib_accessor_class_codetable::pack_expression %s %s\n", a->name, cval); - ret = grib_pack_string(a, cval, &len); - } + ret = a->pack_string(cval, &len); } return ret; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ +int grib_accessor_class_optimal_step_units_t::pack_long(grib_accessor* a, const long* val, size_t* len){ grib_handle* h = grib_handle_of_accessor(a); - grib_accessor_optimal_step_units* self = (grib_accessor_optimal_step_units*)a; + grib_accessor_optimal_step_units_t* self = (grib_accessor_optimal_step_units_t*)a; long start_step = 0; long start_step_unit = 0; @@ -245,18 +138,17 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_optimal_step_units_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_optimal_step_units* self = (grib_accessor_optimal_step_units*)a; + const grib_accessor_optimal_step_units_t* self = (grib_accessor_optimal_step_units_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + try { if (eccodes::Unit{self->overwriteStepUnits} != eccodes::Unit{eccodes::Unit::Value::MISSING}) { *val = self->overwriteStepUnits; return GRIB_SUCCESS; } - const grib_accessor_optimal_step_units* self = (grib_accessor_optimal_step_units*)a; - grib_handle* h = grib_handle_of_accessor(a); - auto forecast_time_opt = get_step(h, self->forecast_time_value, self->forecast_time_unit); auto time_range_opt = get_step(h, self->time_range_value, self->time_range_unit); @@ -283,8 +175,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ +int grib_accessor_class_optimal_step_units_t::pack_string(grib_accessor* a, const char* val, size_t* len){ try { long unit = eccodes::Unit{val}.value(); pack_long(a, &unit, len); @@ -304,8 +195,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ +int grib_accessor_class_optimal_step_units_t::unpack_string(grib_accessor* a, char* val, size_t* len){ int ret = 0; long unit = 0; size_t unit_len = 0; @@ -317,12 +207,10 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) // Step units are never missing // If the user does not specify a step unit, we default to hours -static int is_missing(grib_accessor* a) -{ +int grib_accessor_class_optimal_step_units_t::is_missing(grib_accessor* a){ return 0; } -static int get_native_type(grib_accessor* a) -{ +int grib_accessor_class_optimal_step_units_t::get_native_type(grib_accessor* a){ return GRIB_TYPE_LONG; } diff --git a/src/accessor/grib_accessor_class_optimal_step_units.h b/src/accessor/grib_accessor_class_optimal_step_units.h new file mode 100644 index 000000000..e7aa35247 --- /dev/null +++ b/src/accessor/grib_accessor_class_optimal_step_units.h @@ -0,0 +1,42 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_optimal_step_units_t : public grib_accessor_gen_t +{ +public: + /* Members defined in optimal_step_units */ + const char* forecast_time_value; + const char* forecast_time_unit; + const char* time_range_value; + const char* time_range_unit; + long overwriteStepUnits; +}; + +class grib_accessor_class_optimal_step_units_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_optimal_step_units_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_optimal_step_units_t{}; } + int get_native_type(grib_accessor*) override; + int is_missing(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int pack_expression(grib_accessor*, grib_expression*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_pack_bufr_values.cc b/src/accessor/grib_accessor_class_pack_bufr_values.cc new file mode 100644 index 000000000..08b80d607 --- /dev/null +++ b/src/accessor/grib_accessor_class_pack_bufr_values.cc @@ -0,0 +1,70 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_pack_bufr_values.h" + +grib_accessor_class_pack_bufr_values_t _grib_accessor_class_pack_bufr_values{"pack_bufr_values"}; +grib_accessor_class* grib_accessor_class_pack_bufr_values = &_grib_accessor_class_pack_bufr_values; + + +void grib_accessor_class_pack_bufr_values_t::init(grib_accessor* a, const long len, grib_arguments* params){ + grib_accessor_class_gen_t::init(a, len, params); + char* key; + grib_accessor_pack_bufr_values_t* self = (grib_accessor_pack_bufr_values_t*)a; + key = (char*)grib_arguments_get_name(grib_handle_of_accessor(a), params, 0); + self->data_accessor = grib_find_accessor(grib_handle_of_accessor(a), key); + + a->length = 0; +} + +void grib_accessor_class_pack_bufr_values_t::dump(grib_accessor* a, grib_dumper* dumper){ +} + +int grib_accessor_class_pack_bufr_values_t::unpack_string_array(grib_accessor* a, char** buffer, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_pack_bufr_values_t::unpack_string(grib_accessor* a, char* buffer, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_pack_bufr_values_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_pack_bufr_values_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_pack_bufr_values_t::value_count(grib_accessor* a, long* count){ + *count = 1; + return 0; +} + +void grib_accessor_class_pack_bufr_values_t::destroy(grib_context* context, grib_accessor* a){ + grib_accessor_class_gen_t::destroy(context, a); +} + +int grib_accessor_class_pack_bufr_values_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} + +int grib_accessor_class_pack_bufr_values_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_pack_bufr_values_t* self = (grib_accessor_pack_bufr_values_t*)a; + grib_accessor* data = (grib_accessor*)self->data_accessor; + + return data->pack_double(0, 0);} + +int grib_accessor_class_pack_bufr_values_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_pack_bufr_values_t* self = (grib_accessor_pack_bufr_values_t*)a; + grib_accessor* data = (grib_accessor*)self->data_accessor; + + return data->pack_double(0, 0);} diff --git a/src/accessor/grib_accessor_class_pack_bufr_values.h b/src/accessor/grib_accessor_class_pack_bufr_values.h new file mode 100644 index 000000000..0a59a5141 --- /dev/null +++ b/src/accessor/grib_accessor_class_pack_bufr_values.h @@ -0,0 +1,39 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_pack_bufr_values_t : public grib_accessor_gen_t +{ +public: + /* Members defined in pack_bufr_values */ + grib_accessor* data_accessor; +}; + +class grib_accessor_class_pack_bufr_values_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_pack_bufr_values_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_pack_bufr_values_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int unpack_string_array(grib_accessor*, char**, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_packing_type.cc b/src/accessor/grib_accessor_class_packing_type.cc new file mode 100644 index 000000000..5dd862a07 --- /dev/null +++ b/src/accessor/grib_accessor_class_packing_type.cc @@ -0,0 +1,74 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_packing_type.h" + +grib_accessor_class_packing_type_t _grib_accessor_class_packing_type{"packing_type"}; +grib_accessor_class* grib_accessor_class_packing_type = &_grib_accessor_class_packing_type; + + +void grib_accessor_class_packing_type_t::init(grib_accessor* a, const long l, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, l, args); + int n = 0; + grib_accessor_packing_type_t* self = (grib_accessor_packing_type_t*)a; + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->packing_type = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +size_t grib_accessor_class_packing_type_t::string_length(grib_accessor* a){ + return 1024; +} + +int grib_accessor_class_packing_type_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_STRING; +} + +int grib_accessor_class_packing_type_t::pack_string(grib_accessor*a, const char* sval, size_t* len){ + grib_accessor_packing_type_t* self = (grib_accessor_packing_type_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + double* values = NULL; + grib_context* c = a->context; + size_t size = 0; + int err = 0; + + if ((err = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) + return err; + + values = (double*)grib_context_malloc(c, size * sizeof(double)); + if (!values) return GRIB_OUT_OF_MEMORY; + + if ((err = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return err; + } + + if ((err = grib_set_string_internal(h, self->packing_type, sval, len)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return err; + } + + if ((err = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return err; + } + + grib_context_free(c, values); + return GRIB_SUCCESS; +} + +int grib_accessor_class_packing_type_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_packing_type_t* self = (grib_accessor_packing_type_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + + return grib_get_string(h, self->packing_type, val, len); +} diff --git a/src/accessor/grib_accessor_class_packing_type.h b/src/accessor/grib_accessor_class_packing_type.h new file mode 100644 index 000000000..7deb8f4cf --- /dev/null +++ b/src/accessor/grib_accessor_class_packing_type.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_packing_type_t : public grib_accessor_gen_t +{ +public: + /* Members defined in packing_type */ + const char* values; + const char* packing_type; +}; + +class grib_accessor_class_packing_type_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_packing_type_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_packing_type_t{}; } + int get_native_type(grib_accessor*) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_pad.cc b/src/accessor/grib_accessor_class_pad.cc new file mode 100644 index 000000000..345b510fb --- /dev/null +++ b/src/accessor/grib_accessor_class_pad.cc @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_pad.h" + +grib_accessor_class_pad_t _grib_accessor_class_pad{"pad"}; +grib_accessor_class* grib_accessor_class_pad = &_grib_accessor_class_pad; + + + +size_t grib_accessor_class_pad_t::preferred_size(grib_accessor* a, int from_handle){ + grib_accessor_pad_t* self = (grib_accessor_pad_t*)a; + + long length = 0; + + grib_expression_evaluate_long(grib_handle_of_accessor(a), self->expression, &length); + + return length > 0 ? length : 0; +} + + +void grib_accessor_class_pad_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_padding_t::init(a, len, arg); + grib_accessor_pad_t* self = (grib_accessor_pad_t*)a; + + self->expression = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 0); + a->length = preferred_size(a, 1); +} diff --git a/src/accessor/grib_accessor_class_pad.h b/src/accessor/grib_accessor_class_pad.h new file mode 100644 index 000000000..5234e73a5 --- /dev/null +++ b/src/accessor/grib_accessor_class_pad.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_padding.h" + +class grib_accessor_pad_t : public grib_accessor_padding_t +{ +public: + /* Members defined in padding */ + /* Members defined in pad */ + grib_expression* expression; +}; + +class grib_accessor_class_pad_t : public grib_accessor_class_padding_t +{ +public: + grib_accessor_class_pad_t(const char* name) : grib_accessor_class_padding_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_pad_t{}; } + void init(grib_accessor*, const long, grib_arguments*) override; + size_t preferred_size(grib_accessor*, int) override; +}; diff --git a/src/accessor/grib_accessor_class_padding.cc b/src/accessor/grib_accessor_class_padding.cc new file mode 100644 index 000000000..499c77f2b --- /dev/null +++ b/src/accessor/grib_accessor_class_padding.cc @@ -0,0 +1,58 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_padding.h" + +grib_accessor_class_padding_t _grib_accessor_class_padding{"padding"}; +grib_accessor_class* grib_accessor_class_padding = &_grib_accessor_class_padding; + + +void grib_accessor_class_padding_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_bytes_t::init(a, len, arg); + a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_padding_t::compare(grib_accessor* a, grib_accessor* b){ + if (a->length != b->length) + return GRIB_COUNT_MISMATCH; + return GRIB_SUCCESS; +} + +void grib_accessor_class_padding_t::update_size(grib_accessor* a, size_t new_size){ + a->length = new_size; +} + +void grib_accessor_class_padding_t::resize(grib_accessor* a, size_t new_size){ + void* zero = grib_context_malloc_clear(a->context, new_size); + + grib_buffer_replace(a, (const unsigned char*)zero, new_size, + /*update_lengths=*/1, /*update_paddings=*/0); + grib_context_free(a->context, zero); + + grib_context_log(a->context, GRIB_LOG_DEBUG, + "grib_accessor_class_padding::resize new_size=%zu a->length=%ld %s %s", + new_size, a->length, a->cclass->name, a->name); + Assert(new_size == a->length); +} + +int grib_accessor_class_padding_t::value_count(grib_accessor* a, long* c){ + *c = a->length; + return 0; +} + +long grib_accessor_class_padding_t::byte_count(grib_accessor* a){ + return a->length; +} + +size_t grib_accessor_class_padding_t::string_length(grib_accessor* a){ + return (size_t)a->length; +} diff --git a/src/accessor/grib_accessor_class_padding.h b/src/accessor/grib_accessor_class_padding.h new file mode 100644 index 000000000..6d4175de3 --- /dev/null +++ b/src/accessor/grib_accessor_class_padding.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_bytes.h" + +class grib_accessor_padding_t : public grib_accessor_bytes_t +{ +public: + /* Members defined in padding */ +}; + +class grib_accessor_class_padding_t : public grib_accessor_class_bytes_t +{ +public: + grib_accessor_class_padding_t(const char* name) : grib_accessor_class_bytes_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_padding_t{}; } + size_t string_length(grib_accessor*) override; + long byte_count(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; + void resize(grib_accessor*,size_t) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_padto.cc b/src/accessor/grib_accessor_class_padto.cc new file mode 100644 index 000000000..110d8d858 --- /dev/null +++ b/src/accessor/grib_accessor_class_padto.cc @@ -0,0 +1,45 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_padto.h" + +grib_accessor_class_padto_t _grib_accessor_class_padto{"padto"}; +grib_accessor_class* grib_accessor_class_padto = &_grib_accessor_class_padto; + + + +size_t grib_accessor_class_padto_t::preferred_size(grib_accessor* a, int from_handle){ + grib_accessor_padto_t* self = (grib_accessor_padto_t*)a; + + long length = 0; + long theEnd; + + grib_expression_evaluate_long(grib_handle_of_accessor(a), self->expression, &theEnd); + + length = theEnd - a->offset; + + /* printf("preferred_size: prefered: %ld current:%ld %s %s %ld\n", (long)length,(long)a->length,a->cclass->name,a->name,(long)a->offset); */ + + return length > 0 ? length : 0; +} + + +void grib_accessor_class_padto_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_padding_t::init(a, len, arg); + grib_accessor_padto_t* self = (grib_accessor_padto_t*)a; + + self->expression = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 0); + a->length = preferred_size(a, 1); +} + +void grib_accessor_class_padto_t::dump(grib_accessor* a, grib_dumper* dumper){ + /*grib_dump_string(dumper,a,NULL);*/ +} diff --git a/src/accessor/grib_accessor_class_padto.h b/src/accessor/grib_accessor_class_padto.h new file mode 100644 index 000000000..a1b7b398a --- /dev/null +++ b/src/accessor/grib_accessor_class_padto.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_padding.h" + +class grib_accessor_padto_t : public grib_accessor_padding_t +{ +public: + /* Members defined in padto */ + grib_expression* expression; +}; + +class grib_accessor_class_padto_t : public grib_accessor_class_padding_t +{ +public: + grib_accessor_class_padto_t(const char* name) : grib_accessor_class_padding_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_padto_t{}; } + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + size_t preferred_size(grib_accessor*, int) override; +}; diff --git a/src/accessor/grib_accessor_class_padtoeven.cc b/src/accessor/grib_accessor_class_padtoeven.cc new file mode 100644 index 000000000..adf8b0d84 --- /dev/null +++ b/src/accessor/grib_accessor_class_padtoeven.cc @@ -0,0 +1,48 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_padtoeven.h" + +grib_accessor_class_padtoeven_t _grib_accessor_class_padtoeven{"padtoeven"}; +grib_accessor_class* grib_accessor_class_padtoeven = &_grib_accessor_class_padtoeven; + + +size_t grib_accessor_class_padtoeven_t::preferred_size(grib_accessor* a, int from_handle){ + grib_accessor_padtoeven_t* self = (grib_accessor_padtoeven_t*)a; + long offset = 0; + long length = 0; + long seclen; + + grib_get_long_internal(grib_handle_of_accessor(a), self->section_offset, &offset); + grib_get_long_internal(grib_handle_of_accessor(a), self->section_length, &length); + + if ((length % 2) && from_handle) { + // grib_context_log(a->context, + // GRIB_LOG_ERROR,"GRIB message has an odd length section (%ld, %s)", + // (long)length,a->name); + return 0; + } + + /* printf("EVEN %ld %ld\n",(long) a->offset,(long) offset);*/ + seclen = a->offset - offset; + + return (seclen % 2) ? 1 : 0; +} + +void grib_accessor_class_padtoeven_t::init(grib_accessor* a, const long len, grib_arguments* args){ + grib_accessor_class_padding_t::init(a, len, args); + grib_accessor_padtoeven_t* self = (grib_accessor_padtoeven_t*)a; + + self->section_offset = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0); + self->section_length = grib_arguments_get_name(grib_handle_of_accessor(a), args, 1); + + a->length = preferred_size(a, 1); +} diff --git a/src/accessor/grib_accessor_class_padtoeven.h b/src/accessor/grib_accessor_class_padtoeven.h new file mode 100644 index 000000000..9f42f5880 --- /dev/null +++ b/src/accessor/grib_accessor_class_padtoeven.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_padding.h" + +class grib_accessor_padtoeven_t : public grib_accessor_padding_t +{ +public: + /* Members defined in padtoeven */ + const char* section_offset; + const char* section_length; +}; + +class grib_accessor_class_padtoeven_t : public grib_accessor_class_padding_t +{ +public: + grib_accessor_class_padtoeven_t(const char* name) : grib_accessor_class_padding_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_padtoeven_t{}; } + void init(grib_accessor*, const long, grib_arguments*) override; + size_t preferred_size(grib_accessor*, int) override; +}; diff --git a/src/accessor/grib_accessor_class_padtomultiple.cc b/src/accessor/grib_accessor_class_padtomultiple.cc new file mode 100644 index 000000000..d4e463578 --- /dev/null +++ b/src/accessor/grib_accessor_class_padtomultiple.cc @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_padtomultiple.h" + +grib_accessor_class_padtomultiple_t _grib_accessor_class_padtomultiple{"padtomultiple"}; +grib_accessor_class* grib_accessor_class_padtomultiple = &_grib_accessor_class_padtomultiple; + + +size_t grib_accessor_class_padtomultiple_t::preferred_size(grib_accessor* a, int from_handle){ + grib_accessor_padtomultiple_t* self = (grib_accessor_padtomultiple_t*)a; + long padding = 0; + long begin = 0; + long multiple = 0; + + grib_expression_evaluate_long(grib_handle_of_accessor(a), self->begin, &begin); + grib_expression_evaluate_long(grib_handle_of_accessor(a), self->multiple, &multiple); + + padding = a->offset - begin; + padding = ((padding + multiple - 1) / multiple) * multiple - padding; + + return padding == 0 ? multiple : padding; +} + +void grib_accessor_class_padtomultiple_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_padding_t::init(a, len, arg); + grib_accessor_padtomultiple_t* self = (grib_accessor_padtomultiple_t*)a; + + self->begin = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 0); + self->multiple = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 1); + a->length = preferred_size(a, 1); +} diff --git a/src/accessor/grib_accessor_class_padtomultiple.h b/src/accessor/grib_accessor_class_padtomultiple.h new file mode 100644 index 000000000..1de8e4059 --- /dev/null +++ b/src/accessor/grib_accessor_class_padtomultiple.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_padding.h" + +class grib_accessor_padtomultiple_t : public grib_accessor_padding_t +{ +public: + /* Members defined in padtomultiple */ + grib_expression* begin; + grib_expression* multiple; +}; + +class grib_accessor_class_padtomultiple_t : public grib_accessor_class_padding_t +{ +public: + grib_accessor_class_padtomultiple_t(const char* name) : grib_accessor_class_padding_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_padtomultiple_t{}; } + void init(grib_accessor*, const long, grib_arguments*) override; + size_t preferred_size(grib_accessor*, int) override; +}; diff --git a/src/accessor/grib_accessor_class_position.cc b/src/accessor/grib_accessor_class_position.cc new file mode 100644 index 000000000..a2c3daacd --- /dev/null +++ b/src/accessor/grib_accessor_class_position.cc @@ -0,0 +1,54 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_position.h" + +grib_accessor_class_position_t _grib_accessor_class_position{ "position" }; +grib_accessor_class* grib_accessor_class_position = &_grib_accessor_class_position; + + +void grib_accessor_class_position_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_gen_t::init(a, len, arg); + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; + a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; +} + +int grib_accessor_class_position_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_LONG; +} + +void grib_accessor_class_position_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + grib_dump_long(dumper, a, NULL); +} + +int grib_accessor_class_position_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + if (*len < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %d values ", a->name, 1); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + *val = a->offset; + *len = 1; + return GRIB_SUCCESS; +} + +// static int compare(grib_accessor* a, grib_accessor* b) +// { +// if (a->offset != b->offset) +// return GRIB_OFFSET_MISMATCH; +// return GRIB_SUCCESS; +// } diff --git a/src/accessor/grib_accessor_class_position.h b/src/accessor/grib_accessor_class_position.h new file mode 100644 index 000000000..58e5beb24 --- /dev/null +++ b/src/accessor/grib_accessor_class_position.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_position_t : public grib_accessor_gen_t +{ +public: + /* Members defined in position */ +}; + +class grib_accessor_class_position_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_position_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_position_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_proj_string.cc b/src/accessor/grib_accessor_class_proj_string.cc similarity index 65% rename from src/grib_accessor_class_proj_string.cc rename to src/accessor/grib_accessor_class_proj_string.cc index 7edfbf5be..03866753d 100644 --- a/src/grib_accessor_class_proj_string.cc +++ b/src/accessor/grib_accessor_class_proj_string.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,103 +9,17 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = get_native_type;init - IMPLEMENTS = unpack_string - MEMBERS = const char* grid_type - MEMBERS = int endpoint - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_proj_string -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in proj_string */ - const char* grid_type; - int endpoint; -} grib_accessor_proj_string; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_proj_string = { - &grib_accessor_class_gen, /* super */ - "proj_string", /* name */ - sizeof(grib_accessor_proj_string), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_proj_string.h" +grib_accessor_class_proj_string_t _grib_accessor_class_proj_string{ "proj_string" }; grib_accessor_class* grib_accessor_class_proj_string = &_grib_accessor_class_proj_string; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long len, grib_arguments* arg) +void grib_accessor_class_proj_string_t::init(grib_accessor* a, const long len, grib_arguments* arg) { - grib_accessor_proj_string* self = (grib_accessor_proj_string*)a; - grib_handle* h = grib_handle_of_accessor(a); + grib_accessor_class_gen_t::init(a, len, arg); + grib_accessor_proj_string_t* self = (grib_accessor_proj_string_t*)a; + grib_handle* h = grib_handle_of_accessor(a); self->grid_type = grib_arguments_get_name(h, arg, 0); self->endpoint = grib_arguments_get_long(h, arg, 1); @@ -113,7 +28,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg) a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_proj_string_t::get_native_type(grib_accessor* a) { return GRIB_TYPE_STRING; } @@ -122,8 +37,8 @@ static int get_native_type(grib_accessor* a) typedef int (*proj_func)(grib_handle*, char*); struct proj_mapping { - const char* gridType; // key gridType - proj_func func; // function to compute proj string + const char* gridType; // key gridType + proj_func func; // function to compute proj string }; typedef struct proj_mapping proj_mapping; @@ -151,9 +66,9 @@ static int get_earth_shape(grib_handle* h, char* result) if ((err = get_major_minor_axes(h, &major, &minor)) != GRIB_SUCCESS) return err; if (major == minor) - snprintf(result, 128, "+R=%lf", major); // spherical + snprintf(result, 128, "+R=%lf", major); // spherical else - snprintf(result, 128, "+a=%lf +b=%lf", major, minor); // oblate + snprintf(result, 128, "+a=%lf +b=%lf", major, minor); // oblate return err; } @@ -189,7 +104,7 @@ static int proj_equatorial_azimuthal_equidistant(grib_handle* h, char* result) static int proj_lambert_conformal(grib_handle* h, char* result) { - int err = 0; + int err = 0; char shape[128] = {0,}; double LoVInDegrees = 0, LaDInDegrees = 0, Latin1InDegrees = 0, Latin2InDegrees = 0; @@ -204,13 +119,13 @@ static int proj_lambert_conformal(grib_handle* h, char* result) if ((err = grib_get_double_internal(h, "LaDInDegrees", &LaDInDegrees)) != GRIB_SUCCESS) return err; snprintf(result, 1024, "+proj=lcc +lon_0=%lf +lat_0=%lf +lat_1=%lf +lat_2=%lf %s", - LoVInDegrees, LaDInDegrees, Latin1InDegrees, Latin2InDegrees, shape); + LoVInDegrees, LaDInDegrees, Latin1InDegrees, Latin2InDegrees, shape); return err; } static int proj_lambert_azimuthal_equal_area(grib_handle* h, char* result) { - int err = 0; + int err = 0; char shape[128] = {0,}; double standardParallel = 0, centralLongitude = 0; @@ -221,7 +136,7 @@ static int proj_lambert_azimuthal_equal_area(grib_handle* h, char* result) if ((err = grib_get_double_internal(h, "centralLongitudeInDegrees", ¢ralLongitude)) != GRIB_SUCCESS) return err; snprintf(result, 1024, "+proj=laea +lon_0=%lf +lat_0=%lf %s", - centralLongitude, standardParallel, shape); + centralLongitude, standardParallel, shape); return err; } @@ -243,7 +158,7 @@ static int proj_polar_stereographic(grib_handle* h, char* result) return err; has_northPole = ((projectionCentreFlag & 128) == 0); snprintf(result, 1024, "+proj=stere +lat_ts=%lf +lat_0=%s +lon_0=%lf +k_0=1 +x_0=0 +y_0=0 %s", - centralLatitude, has_northPole ? "90" : "-90", centralLongitude, shape); + centralLatitude, has_northPole ? "90" : "-90", centralLongitude, shape); return err; } @@ -252,9 +167,9 @@ static int proj_polar_stereographic(grib_handle* h, char* result) static int proj_unprojected(grib_handle* h, char* result) { int err = 0; - //char shape[128] = {0,}; - //if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) return err; - //snprintf(result, 1024, "+proj=longlat %s", shape); + // char shape[128] = {0,}; + // if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) return err; + // snprintf(result, 1024, "+proj=longlat %s", shape); snprintf(result, 1024, "+proj=longlat +datum=WGS84 +no_defs +type=crs"); return err; @@ -264,14 +179,14 @@ static int proj_mercator(grib_handle* h, char* result) { int err = 0; double LaDInDegrees = 0; - char shape[128] = {0,}; + char shape[128] = {0,}; if ((err = grib_get_double_internal(h, "LaDInDegrees", &LaDInDegrees)) != GRIB_SUCCESS) return err; if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) return err; snprintf(result, 1024, "+proj=merc +lat_ts=%lf +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 %s", - LaDInDegrees, shape); + LaDInDegrees, shape); return err; } @@ -293,18 +208,18 @@ static proj_mapping proj_mappings[] = { #define ENDPOINT_SOURCE 0 #define ENDPOINT_TARGET 1 -static int unpack_string(grib_accessor* a, char* v, size_t* len) +int grib_accessor_class_proj_string_t::unpack_string(grib_accessor* a, char* v, size_t* len) { - grib_accessor_proj_string* self = (grib_accessor_proj_string*)a; + grib_accessor_proj_string_t* self = (grib_accessor_proj_string_t*)a; int err = 0, found = 0; - size_t i = 0; + size_t i = 0; char grid_type[64] = {0,}; grib_handle* h = grib_handle_of_accessor(a); - size_t size = sizeof(grid_type) / sizeof(*grid_type); + size_t size = sizeof(grid_type) / sizeof(*grid_type); Assert(self->endpoint == ENDPOINT_SOURCE || self->endpoint == ENDPOINT_TARGET); - size_t l = 100; // Safe bet + size_t l = 100; // Safe bet if (*len < l) { const char* cclass_name = a->cclass->name; grib_context_log(a->context, GRIB_LOG_ERROR, diff --git a/src/accessor/grib_accessor_class_proj_string.h b/src/accessor/grib_accessor_class_proj_string.h new file mode 100644 index 000000000..e214c32a9 --- /dev/null +++ b/src/accessor/grib_accessor_class_proj_string.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_proj_string_t : public grib_accessor_gen_t +{ +public: + /* Members defined in proj_string */ + const char* grid_type; + int endpoint; +}; + +class grib_accessor_class_proj_string_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_proj_string_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_proj_string_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_raw.cc b/src/accessor/grib_accessor_class_raw.cc new file mode 100644 index 000000000..cf1f502c7 --- /dev/null +++ b/src/accessor/grib_accessor_class_raw.cc @@ -0,0 +1,126 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_raw.h" + +grib_accessor_class_raw_t _grib_accessor_class_raw{ "raw" }; +grib_accessor_class* grib_accessor_class_raw = &_grib_accessor_class_raw; + + +void grib_accessor_class_raw_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_gen_t::init(a, len, arg); + int n = 0; + int err = 0; + long sectionLength; + grib_accessor_raw_t* self = (grib_accessor_raw_t*)a; + grib_expression* e; + grib_handle* hand = grib_handle_of_accessor(a); + + a->length = 0; + self->totalLength = grib_arguments_get_name(hand, arg, n++); + self->sectionLength = grib_arguments_get_name(hand, arg, n++); + + e = grib_arguments_get_expression(hand, arg, n++); + err = grib_expression_evaluate_long(hand, e, &(self->relativeOffset)); + if (err) + grib_context_log(hand->context, GRIB_LOG_ERROR, "Unable to evaluate relativeOffset"); + + grib_get_long(hand, self->sectionLength, §ionLength); + + a->length = sectionLength - self->relativeOffset; + if (a->length < 0) + a->length = 0; + + /* Assert(a->length>=0); */ +} + +int grib_accessor_class_raw_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_BYTES; +} + + +int grib_accessor_class_raw_t::compare(grib_accessor* a, grib_accessor* b) +{ + int retval = GRIB_SUCCESS; + + size_t alen = (size_t)a->byte_count(); + size_t blen = (size_t)b->byte_count(); + if (alen != blen) + return GRIB_COUNT_MISMATCH; + + return retval; +} + +long grib_accessor_class_raw_t::byte_count(grib_accessor* a) +{ + return a->length; +} + +int grib_accessor_class_raw_t::value_count(grib_accessor* a, long* len) +{ + *len = a->length; + return 0; +} + +int grib_accessor_class_raw_t::unpack_bytes(grib_accessor* a, unsigned char* buffer, size_t* len) +{ + if (*len < a->length) { + *len = a->length; + return GRIB_ARRAY_TOO_SMALL; + } + *len = a->length; + + memcpy(buffer, grib_handle_of_accessor(a)->buffer->data + a->offset, *len); + + return GRIB_SUCCESS; +} + +void grib_accessor_class_raw_t::update_size(grib_accessor* a, size_t s) +{ + grib_context_log(a->context, GRIB_LOG_DEBUG, "updating size of %s old %ld new %ld", a->name, a->length, s); + a->length = s; + Assert(a->length >= 0); +} + +void accessor_raw_set_length(grib_accessor* a, size_t len) +{ + a->length = len; +} + +long accessor_raw_get_offset(grib_accessor* a) +{ + return a->offset; +} + +int grib_accessor_class_raw_t::pack_bytes(grib_accessor* a, const unsigned char* val, size_t* len) +{ + size_t length = *len; + long totalLength; + long sectionLength; + grib_handle* h = grib_handle_of_accessor(a); + grib_accessor_raw_t* self = (grib_accessor_raw_t*)a; + long dlen = length - a->length; + + grib_get_long(h, self->totalLength, &totalLength); + totalLength += dlen; + grib_get_long(h, self->sectionLength, §ionLength); + sectionLength += dlen; + + grib_buffer_replace(a, val, length, 1, 1); + + grib_set_long(h, self->totalLength, totalLength); + grib_set_long(h, self->sectionLength, sectionLength); + a->length = length; + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_raw.h b/src/accessor/grib_accessor_class_raw.h new file mode 100644 index 000000000..8a588ac61 --- /dev/null +++ b/src/accessor/grib_accessor_class_raw.h @@ -0,0 +1,38 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_raw_t : public grib_accessor_gen_t +{ +public: + /* Members defined in raw */ + const char* totalLength; + const char* sectionLength; + long relativeOffset; +}; + +class grib_accessor_class_raw_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_raw_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_raw_t{}; } + int get_native_type(grib_accessor*) override; + int pack_bytes(grib_accessor*, const unsigned char*, size_t* len) override; + int unpack_bytes(grib_accessor*, unsigned char*, size_t* len) override; + long byte_count(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_rdbtime_guess_date.cc b/src/accessor/grib_accessor_class_rdbtime_guess_date.cc new file mode 100644 index 000000000..f4b317daa --- /dev/null +++ b/src/accessor/grib_accessor_class_rdbtime_guess_date.cc @@ -0,0 +1,78 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_rdbtime_guess_date.h" + +grib_accessor_class_rdbtime_guess_date_t _grib_accessor_class_rdbtime_guess_date{"rdbtime_guess_date"}; +grib_accessor_class* grib_accessor_class_rdbtime_guess_date = &_grib_accessor_class_rdbtime_guess_date; + + +void grib_accessor_class_rdbtime_guess_date_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_rdbtime_guess_date_t* self = (grib_accessor_rdbtime_guess_date_t*)a; + int n = 0; + + self->typicalYear = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->typicalMonth = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->typicalDay = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->rdbDay = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->yearOrMonth = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); + + /* a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; */ +} + +int grib_accessor_class_rdbtime_guess_date_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_rdbtime_guess_date_t* self = (grib_accessor_rdbtime_guess_date_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + long typicalYear, typicalMonth, typicalDay, rdbDay; + long rdbYear, rdbMonth; + + int ret = grib_get_long(h, self->typicalYear, &typicalYear); + if (ret) + return ret; + ret = grib_get_long(h, self->typicalMonth, &typicalMonth); + if (ret) + return ret; + ret = grib_get_long(h, self->typicalDay, &typicalDay); + if (ret) + return ret; + ret = grib_get_long(h, self->rdbDay, &rdbDay); + if (ret) + return ret; + + if (rdbDay < typicalDay) { + if (typicalDay == 31 && typicalMonth == 12) { + rdbYear = typicalYear + 1; + rdbMonth = 1; + } + else { + rdbYear = typicalYear; + rdbMonth = typicalMonth + 1; + } + } + else { + rdbYear = typicalYear; + rdbMonth = typicalMonth; + } + + *val = self->yearOrMonth == 1 ? rdbYear : rdbMonth; + *len = 1; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_rdbtime_guess_date_t::pack_long(grib_accessor* a, const long* v, size_t* len) +{ + /* do nothing*/ + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_rdbtime_guess_date.h b/src/accessor/grib_accessor_class_rdbtime_guess_date.h new file mode 100644 index 000000000..739c95e8d --- /dev/null +++ b/src/accessor/grib_accessor_class_rdbtime_guess_date.h @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_rdbtime_guess_date_t : public grib_accessor_long_t +{ +public: + /* Members defined in rdbtime_guess_date */ + const char* typicalYear; + const char* typicalMonth; + const char* typicalDay; + const char* rdbDay; + long yearOrMonth; +}; + +class grib_accessor_class_rdbtime_guess_date_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_rdbtime_guess_date_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_rdbtime_guess_date_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_reference_value_error.cc b/src/accessor/grib_accessor_class_reference_value_error.cc new file mode 100644 index 000000000..fbf1a1c1b --- /dev/null +++ b/src/accessor/grib_accessor_class_reference_value_error.cc @@ -0,0 +1,52 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_reference_value_error.h" + +grib_accessor_class_reference_value_error_t _grib_accessor_class_reference_value_error{ "reference_value_error" }; +grib_accessor_class* grib_accessor_class_reference_value_error = &_grib_accessor_class_reference_value_error; + + +void grib_accessor_class_reference_value_error_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_reference_value_error_t* self = (grib_accessor_reference_value_error_t*)a; + int n = 0; + + self->referenceValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->floatType = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +int grib_accessor_class_reference_value_error_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + grib_accessor_reference_value_error_t* self = (grib_accessor_reference_value_error_t*)a; + int ret = GRIB_SUCCESS; + double referenceValue = 0; + + if ((ret = grib_get_double_internal(grib_handle_of_accessor(a), + self->referenceValue, &referenceValue)) != GRIB_SUCCESS) + return ret; + + if (!strcmp(self->floatType, "ibm")) + *val = grib_ibmfloat_error(referenceValue); + else if (!strcmp(self->floatType, "ieee")) + *val = grib_ieeefloat_error(referenceValue); + else + Assert(1 == 0); + + if (ret == GRIB_SUCCESS) + *len = 1; + + return ret; +} diff --git a/src/accessor/grib_accessor_class_reference_value_error.h b/src/accessor/grib_accessor_class_reference_value_error.h new file mode 100644 index 000000000..2a470562e --- /dev/null +++ b/src/accessor/grib_accessor_class_reference_value_error.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_reference_value_error_t : public grib_accessor_double_t +{ +public: + /* Members defined in reference_value_error */ + const char* referenceValue; + const char* floatType; +}; + +class grib_accessor_class_reference_value_error_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_reference_value_error_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_reference_value_error_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_round.cc b/src/accessor/grib_accessor_class_round.cc new file mode 100644 index 000000000..e1d6aaeda --- /dev/null +++ b/src/accessor/grib_accessor_class_round.cc @@ -0,0 +1,70 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_round.h" + +grib_accessor_class_round_t _grib_accessor_class_round{ "round" }; +grib_accessor_class* grib_accessor_class_round = &_grib_accessor_class_round; + + +int grib_accessor_class_round_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + grib_accessor_round_t* self = (grib_accessor_round_t*)a; + + int ret = GRIB_SUCCESS; + + size_t replen = 0; + double rounding_precision = 0; + double rounded = 0; + double toround = 0; + + const char* oval = NULL; + oval = grib_arguments_get_name(grib_handle_of_accessor(a), self->arg, 0); + + if ((ret = grib_get_double_internal(grib_handle_of_accessor(a), oval, &toround)) != 0) + return ret; + + rounding_precision = grib_arguments_get_long(grib_handle_of_accessor(a), self->arg, 1); + + rounded = floor(rounding_precision * toround + 0.5) / rounding_precision; + + *len = replen; + + *val = rounded; + + return ret; +} + +int grib_accessor_class_round_t::unpack_string(grib_accessor* a, char* val, size_t* len) +{ + char result[1024]; + int ret = GRIB_SUCCESS; + size_t replen = 1; + + double value = 0; + + ret = unpack_double(a, &value, &replen); + + snprintf(result, sizeof(result), "%.3f", value); + + replen = strlen(result) + 1; + + if (*len < replen) { + *len = replen; + return GRIB_ARRAY_TOO_SMALL; + } + + *len = replen; + + snprintf(val, 1024, "%s", result); + + return ret; +} diff --git a/src/accessor/grib_accessor_class_round.h b/src/accessor/grib_accessor_class_round.h new file mode 100644 index 000000000..364e24b34 --- /dev/null +++ b/src/accessor/grib_accessor_class_round.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_evaluate.h" + +class grib_accessor_round_t : public grib_accessor_evaluate_t +{ +public: + /* Members defined in round */ +}; + +class grib_accessor_class_round_t : public grib_accessor_class_evaluate_t +{ +public: + grib_accessor_class_round_t(const char* name) : grib_accessor_class_evaluate_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_round_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; +}; diff --git a/src/accessor/grib_accessor_class_scale.cc b/src/accessor/grib_accessor_class_scale.cc new file mode 100644 index 000000000..59ab7bfb4 --- /dev/null +++ b/src/accessor/grib_accessor_class_scale.cc @@ -0,0 +1,139 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_scale.h" + +grib_accessor_class_scale_t _grib_accessor_class_scale{ "scale" }; +grib_accessor_class* grib_accessor_class_scale = &_grib_accessor_class_scale; + + +void grib_accessor_class_scale_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_scale_t* self = (grib_accessor_scale_t*)a; + int n = 0; + + self->value = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->multiplier = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->divisor = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->truncating = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); +} + +int grib_accessor_class_scale_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + grib_accessor_scale_t* self = (grib_accessor_scale_t*)a; + int ret = 0; + long value = 0; + long multiplier = 0; + long divisor = 0; + + if (*len < 1) { + ret = GRIB_ARRAY_TOO_SMALL; + grib_context_log(a->context, GRIB_LOG_ERROR, + "Accessor %s cannot gather value for %s and/or %s", + a->name, self->multiplier, self->divisor); + return ret; + } + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->divisor, &divisor)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->multiplier, &multiplier)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->value, &value)) != GRIB_SUCCESS) + return ret; + + if (value == GRIB_MISSING_LONG) + *val = GRIB_MISSING_DOUBLE; + else + *val = ((double)(value * multiplier)) / divisor; + + if (ret == GRIB_SUCCESS) + *len = 1; + + return ret; +} + +int grib_accessor_class_scale_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + const double dval = (double)*val; + return pack_double(a, &dval, len); +} + +int grib_accessor_class_scale_t::pack_double(grib_accessor* a, const double* val, size_t* len) +{ + grib_accessor_scale_t* self = (grib_accessor_scale_t*)a; + int ret = 0; + + long value = 0; + long divisor = 0; + long multiplier = 0; + long truncating = 0; + double x; + + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->divisor, &divisor); + if (ret != GRIB_SUCCESS) return ret; + + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->multiplier, &multiplier); + if (ret != GRIB_SUCCESS) return ret; + + if (self->truncating) { + ret = grib_get_long_internal(grib_handle_of_accessor(a), self->truncating, &truncating); + if (ret != GRIB_SUCCESS) return ret; + } + + if (multiplier == 0) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor %s: cannot divide by a zero multiplier %s", + a->name, self->multiplier); + return GRIB_ENCODING_ERROR; + } + + x = *val * (double)divisor / (double)multiplier; + if (*val == GRIB_MISSING_DOUBLE) + value = GRIB_MISSING_LONG; + else if (truncating) { + value = (long)x; + } + else { + value = x > 0 ? (long)(x + 0.5) : (long)(x - 0.5); + } + + ret = grib_set_long_internal(grib_handle_of_accessor(a), self->value, value); + if (ret) + grib_context_log(a->context, GRIB_LOG_ERROR, + "Accessor %s: cannot pack value for %s (%s)\n", + a->name, self->value, grib_get_error_message(ret)); + + if (ret == GRIB_SUCCESS) + *len = 1; + + return ret; +} + +int grib_accessor_class_scale_t::is_missing(grib_accessor* a) +{ + grib_accessor_scale_t* self = (grib_accessor_scale_t*)a; + grib_accessor* av = grib_find_accessor(grib_handle_of_accessor(a), self->value); + + if (!av) + return GRIB_NOT_FOUND; + return av->is_missing_internal(); + // int ret=0; + // long value=0; + // if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->value, &value))!= GRIB_SUCCESS){ + // grib_context_log(a->context, GRIB_LOG_ERROR, + // "Accessor %s cannot gather value for %s error %d \n", a->name, + // self->value, ret); + // return 0; + // } + // return (value == GRIB_MISSING_LONG); +} diff --git a/src/accessor/grib_accessor_class_scale.h b/src/accessor/grib_accessor_class_scale.h new file mode 100644 index 000000000..29b65f34b --- /dev/null +++ b/src/accessor/grib_accessor_class_scale.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_scale_t : public grib_accessor_double_t +{ +public: + /* Members defined in scale */ + const char* value; + const char* multiplier; + const char* divisor; + const char* truncating; +}; + +class grib_accessor_class_scale_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_scale_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_scale_t{}; } + int is_missing(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_scale_values.cc b/src/accessor/grib_accessor_class_scale_values.cc new file mode 100644 index 000000000..03072311d --- /dev/null +++ b/src/accessor/grib_accessor_class_scale_values.cc @@ -0,0 +1,88 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_scale_values.h" + +grib_accessor_class_scale_values_t _grib_accessor_class_scale_values{ "scale_values" }; +grib_accessor_class* grib_accessor_class_scale_values = &_grib_accessor_class_scale_values; + + +void grib_accessor_class_scale_values_t::init(grib_accessor* a, const long l, grib_arguments* args) +{ + grib_accessor_class_double_t::init(a, l, args); + int n = 0; + grib_accessor_scale_values_t* self = (grib_accessor_scale_values_t*)a; + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->missingValue = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_scale_values_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + int ret = GRIB_SUCCESS; + *val = 1; + *len = 1; + return ret; +} + +int grib_accessor_class_scale_values_t::pack_double(grib_accessor* a, const double* val, size_t* len) +{ + double* values = NULL; + double missingValue = 0; + long missingValuesPresent = 0; + size_t size = 0; + int ret = 0, i = 0; + grib_accessor_scale_values_t* self = (grib_accessor_scale_values_t*)a; + const grib_context* c = a->context; + grib_handle* h = grib_handle_of_accessor(a); + + if (*val == 1) + return GRIB_SUCCESS; + + if ((ret = grib_get_double_internal(h, self->missingValue, &missingValue)) != GRIB_SUCCESS) { + return ret; + } + if ((ret = grib_get_long_internal(h, "missingValuesPresent", &missingValuesPresent)) != GRIB_SUCCESS) { + return ret; + } + + if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) + return ret; + + values = (double*)grib_context_malloc(c, size * sizeof(double)); + if (!values) + return GRIB_OUT_OF_MEMORY; + + if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + for (i = 0; i < size; i++) { + if (missingValuesPresent) { + if (values[i] != missingValue) + values[i] *= *val; + } + else { + values[i] *= *val; + } + } + + if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + grib_context_free(c, values); + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_scale_values.h b/src/accessor/grib_accessor_class_scale_values.h new file mode 100644 index 000000000..f004db30e --- /dev/null +++ b/src/accessor/grib_accessor_class_scale_values.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_scale_values_t : public grib_accessor_double_t +{ +public: + /* Members defined in scale_values */ + const char* values; + const char* missingValue; +}; + +class grib_accessor_class_scale_values_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_scale_values_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_scale_values_t{}; } + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_second_order_bits_per_value.cc b/src/accessor/grib_accessor_class_second_order_bits_per_value.cc similarity index 50% rename from src/grib_accessor_class_second_order_bits_per_value.cc rename to src/accessor/grib_accessor_class_second_order_bits_per_value.cc index 74c4b4c05..ea7c4c931 100644 --- a/src/grib_accessor_class_second_order_bits_per_value.cc +++ b/src/accessor/grib_accessor_class_second_order_bits_per_value.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,108 +9,12 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/********************************** - * Enrico Fucile - **********************************/ - +#include "grib_accessor_class_second_order_bits_per_value.h" #include "grib_scaling.h" -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = pack_long - IMPLEMENTS = init - MEMBERS = const char* values - MEMBERS = const char* binaryScaleFactor - MEMBERS = const char* decimalScaleFactor - MEMBERS = long bitsPerValue - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_second_order_bits_per_value -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in second_order_bits_per_value */ - const char* values; - const char* binaryScaleFactor; - const char* decimalScaleFactor; - long bitsPerValue; -} grib_accessor_second_order_bits_per_value; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_second_order_bits_per_value = { - &grib_accessor_class_long, /* super */ - "second_order_bits_per_value", /* name */ - sizeof(grib_accessor_second_order_bits_per_value), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_second_order_bits_per_value_t _grib_accessor_class_second_order_bits_per_value{"second_order_bits_per_value"}; grib_accessor_class* grib_accessor_class_second_order_bits_per_value = &_grib_accessor_class_second_order_bits_per_value; -/* END_CLASS_IMP */ static const size_t nbits[64] = { 0x1, 0x2, 0x4, 0x8, @@ -130,8 +35,7 @@ static const size_t nbits[64] = { 0x1000000000000000, 0x2000000000000000, 0x4000000000000000, 0x8000000000000000 }; -static int number_of_bits(size_t x, long* result) -{ +static int number_of_bits(size_t x, long* result){ const size_t* n = nbits; const int count = sizeof(nbits) / sizeof(nbits[0]); *result = 0; @@ -145,10 +49,10 @@ static int number_of_bits(size_t x, long* result) return GRIB_SUCCESS; } -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ +void grib_accessor_class_second_order_bits_per_value_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); int n = 0; - grib_accessor_second_order_bits_per_value* self = (grib_accessor_second_order_bits_per_value*)a; + grib_accessor_second_order_bits_per_value_t* self = (grib_accessor_second_order_bits_per_value_t*)a; self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); self->binaryScaleFactor = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); self->decimalScaleFactor = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); @@ -157,17 +61,15 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) a->length = 0; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_second_order_bits_per_value* self = (grib_accessor_second_order_bits_per_value*)a; +int grib_accessor_class_second_order_bits_per_value_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_second_order_bits_per_value_t* self = (grib_accessor_second_order_bits_per_value_t*)a; self->bitsPerValue = (long)*val; *len = 1; return 0; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ +int grib_accessor_class_second_order_bits_per_value_t::unpack_long(grib_accessor* a, long* val, size_t* len){ int ret = GRIB_SUCCESS; size_t size = 0; size_t i; @@ -175,7 +77,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) double* values = 0; long binaryScaleFactor, decimalScaleFactor; - grib_accessor_second_order_bits_per_value* self = (grib_accessor_second_order_bits_per_value*)a; + grib_accessor_second_order_bits_per_value_t* self = (grib_accessor_second_order_bits_per_value_t*)a; if (self->bitsPerValue) { *val = self->bitsPerValue; return GRIB_SUCCESS; diff --git a/src/accessor/grib_accessor_class_second_order_bits_per_value.h b/src/accessor/grib_accessor_class_second_order_bits_per_value.h new file mode 100644 index 000000000..c3459db41 --- /dev/null +++ b/src/accessor/grib_accessor_class_second_order_bits_per_value.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_second_order_bits_per_value_t : public grib_accessor_long_t +{ +public: + /* Members defined in second_order_bits_per_value */ + const char* values; + const char* binaryScaleFactor; + const char* decimalScaleFactor; + long bitsPerValue; +}; + +class grib_accessor_class_second_order_bits_per_value_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_second_order_bits_per_value_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_second_order_bits_per_value_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_section.cc b/src/accessor/grib_accessor_class_section.cc new file mode 100644 index 000000000..ec6e14c2b --- /dev/null +++ b/src/accessor/grib_accessor_class_section.cc @@ -0,0 +1,96 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_section.h" + +grib_accessor_class_section_t _grib_accessor_class_section{"section"}; +grib_accessor_class* grib_accessor_class_section = &_grib_accessor_class_section; + + +void grib_accessor_class_section_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + a->sub_section = grib_section_create(grib_handle_of_accessor(a), a); + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +void grib_accessor_class_section_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_section(dumper, a, a->sub_section->block); +} + +long grib_accessor_class_section_t::byte_count(grib_accessor* a){ + if (!a->length || grib_handle_of_accessor(a)->loader) { + if (a->name[1] == '_') + return 0; + + /* printf("adjusting sizes SECTION %s is %ld %ld\n",a->name,(long)a->offset,(long)a->length); */ + grib_section_adjust_sizes(a->sub_section, grib_handle_of_accessor(a)->loader != NULL, 0); + /* printf(" SECTION %s is %ld %ld\n",a->name,(long)a->offset,(long)a->length); */ + } + + /* printf("SECTION %s is %ld %d\n",a->name,a->length,a->sub_section->aclength != NULL); */ + return a->length; +} + +long grib_accessor_class_section_t::next_offset(grib_accessor* a){ + return a->offset + a->byte_count(); +} + +void grib_accessor_class_section_t::destroy(grib_context* ct, grib_accessor* a){ + grib_section_delete(ct, a->sub_section); + grib_accessor_class_gen_t::destroy(ct, a); +} + +int grib_accessor_class_section_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_SECTION; +} + +grib_section* grib_accessor_class_section_t::sub_section(grib_accessor* a) +{ + return a->sub_section; +} + +void grib_accessor_class_section_t::update_size(grib_accessor* a, size_t length){ + size_t size = 1; + long len = length; + Assert(length <= 0x7fffffff); + if (a->sub_section->aclength) { + int e = a->sub_section->aclength->pack_long(&len, &size); Assert(e == GRIB_SUCCESS); + // printf("update_length %s %ld %ld\n", a->sub_section->aclength->name, + // (long)a->sub_section->aclength->offset, + // (long)a->sub_section->aclength->length); + } + + a->sub_section->length = a->length = length; + a->sub_section->padding = 0; + + // printf("update_size %s %ld\n", a->name, a->length); + + Assert(a->length >= 0); +} + +grib_accessor* grib_accessor_class_section_t::next(grib_accessor* a, int explore) +{ + grib_accessor* next = NULL; + if (explore) { + next = a->sub_section->block->first; + if (!next) + next = a->next_; + } + else { + next = a->next_; + } + if (!next) { + if (a->parent->owner) + next = a->parent->owner->cclass->next(a->parent->owner, 0); + } + return next; +} diff --git a/src/accessor/grib_accessor_class_section.h b/src/accessor/grib_accessor_class_section.h new file mode 100644 index 000000000..8dbd831cc --- /dev/null +++ b/src/accessor/grib_accessor_class_section.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_section_t : public grib_accessor_gen_t {}; + +class grib_accessor_class_section_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_section_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_section_t{}; } + int get_native_type(grib_accessor*) override; + long byte_count(grib_accessor*) override; + long next_offset(grib_accessor*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; + grib_section* sub_section(grib_accessor*) override; + grib_accessor* next(grib_accessor*, int) override; +}; diff --git a/src/accessor/grib_accessor_class_section_length.cc b/src/accessor/grib_accessor_class_section_length.cc new file mode 100644 index 000000000..bcc75cc2b --- /dev/null +++ b/src/accessor/grib_accessor_class_section_length.cc @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_section_length.h" + +grib_accessor_class_section_length_t _grib_accessor_class_section_length{"section_length"}; +grib_accessor_class* grib_accessor_class_section_length = &_grib_accessor_class_section_length; + + +void grib_accessor_class_section_length_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_unsigned_t::init(a, len, arg); + a->parent->aclength = a; + a->length = len; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; + Assert(a->length >= 0); +} + +void grib_accessor_class_section_length_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_long(dumper, a, NULL); +} + +int grib_accessor_class_section_length_t::value_count(grib_accessor* a, long* c){ + *c = 1; + return 0; +} diff --git a/src/accessor/grib_accessor_class_section_length.h b/src/accessor/grib_accessor_class_section_length.h new file mode 100644 index 000000000..e7965b9b1 --- /dev/null +++ b/src/accessor/grib_accessor_class_section_length.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_unsigned.h" + +class grib_accessor_section_length_t : public grib_accessor_unsigned_t +{ +public: + /* Members defined in section_length */ +}; + +class grib_accessor_class_section_length_t : public grib_accessor_class_unsigned_t +{ +public: + grib_accessor_class_section_length_t(const char* name) : grib_accessor_class_unsigned_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_section_length_t{}; } + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_section_padding.cc b/src/accessor/grib_accessor_class_section_padding.cc new file mode 100644 index 000000000..c3457898f --- /dev/null +++ b/src/accessor/grib_accessor_class_section_padding.cc @@ -0,0 +1,70 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_section_padding.h" + +grib_accessor_class_section_padding_t _grib_accessor_class_section_padding{"section_padding"}; +grib_accessor_class* grib_accessor_class_section_padding = &_grib_accessor_class_section_padding; + + +size_t grib_accessor_class_section_padding_t::preferred_size(grib_accessor* a, int from_handle){ + grib_accessor_section_padding_t* self = (grib_accessor_section_padding_t*)a; + grib_accessor* b = a; + grib_accessor* section_length = 0; + long length = 0; + size_t size = 1; + + long alength = 0; + + if (!from_handle) { + if (self->preserve) + return a->length; + else + return 0; + } + + /* The section length should be a parameter */ + while (section_length == NULL && b != NULL) { + section_length = b->parent->aclength; + b = b->parent->owner; + } + + if (!section_length) { + /* printf("PADDING is no !section_length\n"); */ + return 0; + } + + if (section_length->unpack_long(&length, &size) == GRIB_SUCCESS) { + if (length) + alength = length - a->offset + section_length->parent->owner->offset; + else + alength = 0; + + /*Assert(a->length>=0);*/ + + if (alength < 0) + alength = 0; + + /* printf("PADDING is %ld\n",a->length); */ + } + else { + /* printf("PADDING unpack fails\n"); */ + } + + return alength; +} + +void grib_accessor_class_section_padding_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_padding_t::init(a, len, arg); + grib_accessor_section_padding_t* self = (grib_accessor_section_padding_t*)a; + self->preserve = 1; /* This should be a parameter */ + a->length = preferred_size(a, 1); +} diff --git a/src/accessor/grib_accessor_class_section_padding.h b/src/accessor/grib_accessor_class_section_padding.h new file mode 100644 index 000000000..f35da4977 --- /dev/null +++ b/src/accessor/grib_accessor_class_section_padding.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_padding.h" + +class grib_accessor_section_padding_t : public grib_accessor_padding_t +{ +public: + /* Members defined in section_padding */ + int preserve; +}; + +class grib_accessor_class_section_padding_t : public grib_accessor_class_padding_t +{ +public: + grib_accessor_class_section_padding_t(const char* name) : grib_accessor_class_padding_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_section_padding_t{}; } + void init(grib_accessor*, const long, grib_arguments*) override; + size_t preferred_size(grib_accessor*, int) override; +}; diff --git a/src/accessor/grib_accessor_class_section_pointer.cc b/src/accessor/grib_accessor_class_section_pointer.cc new file mode 100644 index 000000000..72eb78d6d --- /dev/null +++ b/src/accessor/grib_accessor_class_section_pointer.cc @@ -0,0 +1,97 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_section_pointer.h" + +grib_accessor_class_section_pointer_t _grib_accessor_class_section_pointer{"section_pointer"}; +grib_accessor_class* grib_accessor_class_section_pointer = &_grib_accessor_class_section_pointer; + + +void grib_accessor_class_section_pointer_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + int n = 0; + grib_accessor_section_pointer_t* self = (grib_accessor_section_pointer_t*)a; + + self->sectionOffset = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); + self->sectionLength = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); + self->sectionNumber = grib_arguments_get_long(grib_handle_of_accessor(a), arg, n++); + + Assert(self->sectionNumber < MAX_NUM_SECTIONS); + + grib_handle_of_accessor(a)->section_offset[self->sectionNumber] = (char*)self->sectionOffset; + grib_handle_of_accessor(a)->section_length[self->sectionNumber] = (char*)self->sectionLength; + + /* printf("++++++++++++++ GRIB_API: creating section_pointer%d %s %s\n", */ + /* self->sectionNumber,self->sectionLength,self->sectionLength); */ + + if (grib_handle_of_accessor(a)->sections_count < self->sectionNumber) + grib_handle_of_accessor(a)->sections_count = self->sectionNumber; + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; + a->length = 0; +} + +int grib_accessor_class_section_pointer_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_BYTES; +} + +int grib_accessor_class_section_pointer_t::unpack_string(grib_accessor* a, char* v, size_t* len){ + /* + unsigned char* p=NULL; + char* s=v; + int i; + long length=a->byte_count(); + if (*len < length) return GRIB_ARRAY_TOO_SMALL; + + p = grib_handle_of_accessor(a)->buffer->data + a->byte_offset(); + for (i = 0; i < length; i++) { + snprintf (s,64,"%02x", *(p++)); + s+=2; + } + *len=length; + */ + snprintf(v, 64, "%ld_%ld", a->byte_offset(), a->byte_count()); return GRIB_SUCCESS; +} + +long grib_accessor_class_section_pointer_t::byte_count(grib_accessor* a){ + grib_accessor_section_pointer_t* self = (grib_accessor_section_pointer_t*)a; + long sectionLength = 0; + int ret = 0; + + ret = grib_get_long(grib_handle_of_accessor(a), self->sectionLength, §ionLength); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Unable to get %s %s", + self->sectionLength, grib_get_error_message(ret)); + return -1; + } + + return sectionLength; +} + +long grib_accessor_class_section_pointer_t::byte_offset(grib_accessor* a){ + grib_accessor_section_pointer_t* self = (grib_accessor_section_pointer_t*)a; + long sectionOffset = 0; + int ret = 0; + + ret = grib_get_long(grib_handle_of_accessor(a), self->sectionOffset, §ionOffset); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Unable to get %s %s", + self->sectionOffset, grib_get_error_message(ret)); + return -1; + } + + return sectionOffset; +} diff --git a/src/accessor/grib_accessor_class_section_pointer.h b/src/accessor/grib_accessor_class_section_pointer.h new file mode 100644 index 000000000..569e20201 --- /dev/null +++ b/src/accessor/grib_accessor_class_section_pointer.h @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_section_pointer_t : public grib_accessor_gen_t +{ +public: + /* Members defined in section_pointer */ + const char* sectionOffset; + const char* sectionLength; + long sectionNumber; +}; + +class grib_accessor_class_section_pointer_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_section_pointer_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_section_pointer_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_select_step_template.cc b/src/accessor/grib_accessor_class_select_step_template.cc similarity index 60% rename from src/grib_accessor_class_select_step_template.cc rename to src/accessor/grib_accessor_class_select_step_template.cc index 7a0e76c23..bc72a5220 100644 --- a/src/grib_accessor_class_select_step_template.cc +++ b/src/accessor/grib_accessor_class_select_step_template.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,108 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_unsigned - IMPLEMENTS = unpack_long;pack_long; value_count - IMPLEMENTS = init - MEMBERS=const char* productDefinitionTemplateNumber - MEMBERS=int instant - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_select_step_template -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in select_step_template */ - const char* productDefinitionTemplateNumber; - int instant; -} grib_accessor_select_step_template; - -extern grib_accessor_class* grib_accessor_class_unsigned; - -static grib_accessor_class _grib_accessor_class_select_step_template = { - &grib_accessor_class_unsigned, /* super */ - "select_step_template", /* name */ - sizeof(grib_accessor_select_step_template), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_select_step_template.h" +grib_accessor_class_select_step_template_t _grib_accessor_class_select_step_template{"select_step_template"}; grib_accessor_class* grib_accessor_class_select_step_template = &_grib_accessor_class_select_step_template; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_select_step_template* self = (grib_accessor_select_step_template*)a; +void grib_accessor_class_select_step_template_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_unsigned_t::init(a, l, c); + grib_accessor_select_step_template_t* self = (grib_accessor_select_step_template_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int n = 0; @@ -117,15 +25,13 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->instant = grib_arguments_get_long(hand, c, n++); } -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ +int grib_accessor_class_select_step_template_t::unpack_long(grib_accessor* a, long* val, size_t* len){ *val = 1; return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_select_step_template* self = (grib_accessor_select_step_template*)a; +int grib_accessor_class_select_step_template_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_select_step_template_t* self = (grib_accessor_select_step_template_t*)a; grib_handle* hand = grib_handle_of_accessor(a); long productDefinitionTemplateNumber = 0; long productDefinitionTemplateNumberNew = 0; @@ -266,8 +172,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_SUCCESS; } -static int value_count(grib_accessor* a, long* c) -{ +int grib_accessor_class_select_step_template_t::value_count(grib_accessor* a, long* c){ *c = 1; return 0; } diff --git a/src/accessor/grib_accessor_class_select_step_template.h b/src/accessor/grib_accessor_class_select_step_template.h new file mode 100644 index 000000000..e327a99da --- /dev/null +++ b/src/accessor/grib_accessor_class_select_step_template.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_unsigned.h" + +class grib_accessor_select_step_template_t : public grib_accessor_unsigned_t +{ +public: + /* Members defined in select_step_template */ + const char* productDefinitionTemplateNumber; + int instant; +}; + +class grib_accessor_class_select_step_template_t : public grib_accessor_class_unsigned_t +{ +public: + grib_accessor_class_select_step_template_t(const char* name) : grib_accessor_class_unsigned_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_select_step_template_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_sexagesimal2decimal.cc b/src/accessor/grib_accessor_class_sexagesimal2decimal.cc new file mode 100644 index 000000000..e1920c1b9 --- /dev/null +++ b/src/accessor/grib_accessor_class_sexagesimal2decimal.cc @@ -0,0 +1,146 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_sexagesimal2decimal.h" + +grib_accessor_class_sexagesimal2decimal_t _grib_accessor_class_sexagesimal2decimal{"sexagesimal2decimal"}; +grib_accessor_class* grib_accessor_class_sexagesimal2decimal = &_grib_accessor_class_sexagesimal2decimal; + + +void grib_accessor_class_sexagesimal2decimal_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_to_double_t::init(a, len, arg); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +void grib_accessor_class_sexagesimal2decimal_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_double(dumper, a, NULL); +} + +int grib_accessor_class_sexagesimal2decimal_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_DOUBLE; +} + +int grib_accessor_class_sexagesimal2decimal_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + int err = 0; + grib_accessor_sexagesimal2decimal_t* self = (grib_accessor_sexagesimal2decimal_t*)a; + char buff[512] = {0,}; + size_t length = 0; + size_t size = 512; + char* p; + char* q; + double dd, mm = 0, ss = 0; + int dd_sign = 1; + + err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size); + if (err) + return err; + q = buff + self->start; + if (self->length) + q[length] = 0; + p = q; + + while (*p != '-' && *p != ':' && *p != ' ' && *p != 0) { + p++; + } + + if (*p == 0) { + return GRIB_WRONG_CONVERSION; + } + *p = 0; + + dd = atoi(q); + p++; + q = p; + while (*p != '-' && *p != ':' && *p != ' ' && *p != 'N' && *p != 'S' && *p != 'E' && *p != 'W' && *p != 0) { + p++; + } + switch (*p) { + case ' ': + case '-': + case ':': + *p = 0; + mm = atoi(q) / 60.0; + dd += mm; + p++; + q = p; + break; + case 'N': + case 'E': + *p = 0; + dd_sign = 1; + mm = atoi(q) / 60.0; + dd += mm; + p++; + q = p; + break; + case 'S': + case 'W': + *p = 0; + mm = atoi(q) / 60.0; + dd += mm; + dd_sign = -1; + p++; + q = p; + break; + case 0: + break; + default: + return GRIB_WRONG_CONVERSION; + } + if (*p) { + while (*p != '-' && *p != ':' && *p != ' ' && *p != 'N' && *p != 'S' && *p != 'E' && *p != 'W' && *p != 0) { + p++; + } + switch (*p) { + case ' ': + case '-': + case ':': + *p = 0; + ss = atof(q) / 60.0; + dd += ss; + break; + case 'N': + case 'E': + *p = 0; + ss = atof(q) / 60.0; + dd += ss; + dd_sign = 1; + break; + case 'S': + case 'W': + *p = 0; + ss = atof(q) / 60.0; + dd += ss; + dd_sign = -1; + break; + case 0: + break; + default: + return GRIB_WRONG_CONVERSION; + } + } + dd *= dd_sign; + + snprintf(buff, sizeof(buff), "%.2f", dd); + length = strlen(buff); + + if (len[0] < length + 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values", + len[0], a->name, a->length + 1); + len[0] = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + strcpy(val, buff); + + len[0] = length; + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_sexagesimal2decimal.h b/src/accessor/grib_accessor_class_sexagesimal2decimal.h new file mode 100644 index 000000000..d9051bca9 --- /dev/null +++ b/src/accessor/grib_accessor_class_sexagesimal2decimal.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_to_double.h" + +class grib_accessor_sexagesimal2decimal_t : public grib_accessor_to_double_t +{ +public: + /* Members defined in sexagesimal2decimal */ +}; + +class grib_accessor_class_sexagesimal2decimal_t : public grib_accessor_class_to_double_t +{ +public: + grib_accessor_class_sexagesimal2decimal_t(const char* name) : grib_accessor_class_to_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_sexagesimal2decimal_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_signed.cc b/src/accessor/grib_accessor_class_signed.cc new file mode 100644 index 000000000..36c20bd59 --- /dev/null +++ b/src/accessor/grib_accessor_class_signed.cc @@ -0,0 +1,219 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_signed.h" + +grib_accessor_class_signed_t _grib_accessor_class_signed{ "signed" }; +grib_accessor_class* grib_accessor_class_signed = &_grib_accessor_class_signed; + + +void grib_accessor_class_signed_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_long_t::init(a, len, arg); + grib_accessor_signed_t* self = (grib_accessor_signed_t*)a; + long count = 0; + + self->arg = arg; + a->value_count(&count); + a->length = len * count; + self->nbytes = len; + Assert(a->length >= 0); +} + +void grib_accessor_class_signed_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + long rlen = 0; + a->value_count(&rlen); + if (rlen == 1) + grib_dump_long(dumper, a, NULL); + else + grib_dump_values(dumper, a); +} + +static const long ones[] = { + 0, + -0x7f, + -0x7fff, + -0x7fffff, + -0x7fffffff, +}; + +int grib_accessor_class_signed_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_signed_t* self = (grib_accessor_signed_t*)a; + unsigned long rlen = 0; + int err = 0; + long count = 0; + unsigned long i = 0; + grib_handle* hand = grib_handle_of_accessor(a); + long pos = a->offset; + long missing = 0; + + err = a->value_count(&count); + if (err) + return err; + rlen = count; + + if (*len < rlen) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %lu values", a->name, rlen); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + if (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) { + Assert(self->nbytes <= 4); + missing = ones[self->nbytes]; + } + + for (i = 0; i < rlen; i++) { + val[i] = (long)grib_decode_signed_long(hand->buffer->data, pos, self->nbytes); + if (missing) + if (val[i] == missing) + val[i] = GRIB_MISSING_LONG; + pos += self->nbytes; + } + + *len = rlen; + return GRIB_SUCCESS; +} + +int grib_accessor_class_signed_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + grib_accessor_signed_t* self = (grib_accessor_signed_t*)a; + + int ret = 0; + long off = 0; + unsigned long rlen = 0; + long count = 0; + size_t buflen = 0; + unsigned char* buf = NULL; + unsigned long i = 0; + long missing = 0; + + int err = a->value_count(&count); + if (err) + return err; + rlen = count; + + if (*len < 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %d values", a->name, 1); + len[0] = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + if (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) { + Assert(self->nbytes <= 4); + missing = ones[self->nbytes]; + } + + if (rlen == 1) { + long v = val[0]; + if (missing) { + if (v == GRIB_MISSING_LONG) + v = missing; + } + else { + // ECC-1605: Check overflow/underflow + const int nbits = self->nbytes * 8; + const long minval = -(1L << (nbits - 1)) + 1; + const long maxval = (1L << (nbits - 1)) - 1; + // printf(" key=%s: v=%ld (minval=%ld maxval=%ld)\n", a->name, v, minval, maxval); + if (v > maxval || v < minval) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Key \"%s\": Trying to encode value of %ld but the allowable range is %ld to %ld (number of bits=%d)", + a->name, v, minval, maxval, nbits); + return GRIB_ENCODING_ERROR; + } + } + + off = a->offset; + ret = grib_encode_signed_long(grib_handle_of_accessor(a)->buffer->data, v, off, a->length); + if (ret == GRIB_SUCCESS) + len[0] = 1; + if (*len > 1) + grib_context_log(a->context, GRIB_LOG_WARNING, "grib_accessor_signed_t : Trying to pack %d values in a scalar %s, packing first value", *len, a->name); + len[0] = 1; + return ret; + } + + /* TODO: We assume that there are no missing values if there are more that 1 value */ + + buflen = *len * a->length; + + buf = (unsigned char*)grib_context_malloc(a->context, buflen); + + for (i = 0; i < *len; i++) { + grib_encode_signed_long(buf, val[i], off, a->length); + off += a->length; + } + ret = grib_set_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), *len); + + if (ret == GRIB_SUCCESS) + grib_buffer_replace(a, buf, buflen, 1, 1); + else + *len = 0; + + grib_context_free(a->context, buf); + return ret; +} + +long grib_accessor_class_signed_t::byte_count(grib_accessor* a) +{ + return a->length; +} + +int grib_accessor_class_signed_t::value_count(grib_accessor* a, long* len) +{ + grib_accessor_signed_t* self = (grib_accessor_signed_t*)a; + *len = 0; + if (!self->arg) { + *len = 1; + return 0; + } + return grib_get_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), len); +} + +long grib_accessor_class_signed_t::byte_offset(grib_accessor* a) +{ + return a->offset; +} + +void grib_accessor_class_signed_t::update_size(grib_accessor* a, size_t s) +{ + a->length = s; + Assert(a->length >= 0); +} + +long grib_accessor_class_signed_t::next_offset(grib_accessor* a) +{ + return a->byte_offset() + a->byte_count(); +} + +int grib_accessor_class_signed_t::is_missing(grib_accessor* a) +{ + int i = 0; + unsigned char ff = 0xff; + unsigned long offset = a->offset; + grib_handle* hand = grib_handle_of_accessor(a); + + if (a->length == 0) { + Assert(a->vvalue != NULL); + return a->vvalue->missing; + } + + for (i = 0; i < a->length; i++) { + if (hand->buffer->data[offset] != ff) + return 0; + offset++; + } + + return 1; +} diff --git a/src/accessor/grib_accessor_class_signed.h b/src/accessor/grib_accessor_class_signed.h new file mode 100644 index 000000000..9fbb6f8d2 --- /dev/null +++ b/src/accessor/grib_accessor_class_signed.h @@ -0,0 +1,39 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_signed_t : public grib_accessor_long_t +{ +public: + /* Members defined in signed */ + grib_arguments* arg; + int nbytes; +}; + +class grib_accessor_class_signed_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_signed_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_signed_t{}; } + int is_missing(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; +}; diff --git a/src/accessor/grib_accessor_class_signed_bits.cc b/src/accessor/grib_accessor_class_signed_bits.cc new file mode 100644 index 000000000..3da4d03c2 --- /dev/null +++ b/src/accessor/grib_accessor_class_signed_bits.cc @@ -0,0 +1,152 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_signed_bits.h" + +grib_accessor_class_signed_bits_t _grib_accessor_class_signed_bits{"signed_bits"}; +grib_accessor_class* grib_accessor_class_signed_bits = &_grib_accessor_class_signed_bits; + + +long grib_accessor_class_signed_bits_t::byte_count(grib_accessor* a){ + return a->length; +} + +static long compute_byte_count(grib_accessor* a){ + grib_accessor_signed_bits_t* self = (grib_accessor_signed_bits_t*)a; + long numberOfBits; + long numberOfElements; + int ret = 0; + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s unable to get %s to compute size", a->name, self->numberOfBits); + return 0; + } + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, &numberOfElements); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s unable to get %s to compute size", a->name, self->numberOfElements); + return 0; + } + + return (numberOfBits * numberOfElements + 7) / 8; +} + +void grib_accessor_class_signed_bits_t::init(grib_accessor* a, const long len, grib_arguments* args){ + grib_accessor_class_long_t::init(a, len, args); + grib_accessor_signed_bits_t* self = (grib_accessor_signed_bits_t*)a; + int n = 0; + self->numberOfBits = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->numberOfElements = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + a->length = compute_byte_count(a); +} + +int grib_accessor_class_signed_bits_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +#if 0 + grib_accessor_signed_bits_t* self = (grib_accessor_signed_bits_t*)a; + int i; + int ret = 0; + long pos = a->offset * 8; + long rlen = 0; + long numberOfBits = 0; + + ret = value_count(a, &rlen); + if (ret) + return ret; + + if (*len < rlen) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Wrong size (%ld) for %s it contains %ld values", *len, a->name, rlen); + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); + if (ret) + return ret; + + if (numberOfBits == 0) { + for (i = 0; i < rlen; i++) + val[i] = 0; + return GRIB_SUCCESS; + } + + for (i = 0; i < rlen; i++) + val[i] = grib_decode_signed_longb(grib_handle_of_accessor(a)->buffer->data, &pos, numberOfBits); + + *len = rlen; + + return GRIB_SUCCESS; +#endif +} + +int grib_accessor_class_signed_bits_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +#if 0 + grib_accessor_signed_bits_t* self = (grib_accessor_signed_bits_t*)a; + int ret = 0; + long off = 0; + long numberOfBits = 0; + size_t buflen = 0; + unsigned char* buf = NULL; + unsigned long i = 0; + unsigned long rlen = 0; + long count = 0; + + ret = value_count(a, &count); + if (ret) + return ret; + rlen = count; + if (*len != rlen) { + ret = grib_set_long(grib_handle_of_accessor(a), self->numberOfElements, rlen); + if (ret) + return ret; + } + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); + if (ret) + return ret; + + buflen = compute_byte_count(a); + buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen + sizeof(long)); + + for (i = 0; i < rlen; i++) + grib_encode_signed_longb(buf, val[i], &off, numberOfBits); + + grib_buffer_replace(a, buf, buflen, 1, 1); + + grib_context_free(a->context, buf); + + return ret; +#endif +} + +int grib_accessor_class_signed_bits_t::value_count(grib_accessor* a, long* numberOfElements){ + grib_accessor_signed_bits_t* self = (grib_accessor_signed_bits_t*)a; + *numberOfElements = 0; + + return grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, numberOfElements); +} + +long grib_accessor_class_signed_bits_t::byte_offset(grib_accessor* a){ + return a->offset; +} + +void grib_accessor_class_signed_bits_t::update_size(grib_accessor* a, size_t s){ + a->length = s; +} + +long grib_accessor_class_signed_bits_t::next_offset(grib_accessor* a){ + return a->byte_offset() + a->byte_count(); +} diff --git a/src/accessor/grib_accessor_class_signed_bits.h b/src/accessor/grib_accessor_class_signed_bits.h new file mode 100644 index 000000000..dd49c5c75 --- /dev/null +++ b/src/accessor/grib_accessor_class_signed_bits.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_signed_bits_t : public grib_accessor_long_t +{ +public: + /* Members defined in signed_bits */ + const char* numberOfBits; + const char* numberOfElements; +}; + +class grib_accessor_class_signed_bits_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_signed_bits_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_signed_bits_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; +}; diff --git a/src/accessor/grib_accessor_class_simple_packing_error.cc b/src/accessor/grib_accessor_class_simple_packing_error.cc new file mode 100644 index 000000000..5f713a950 --- /dev/null +++ b/src/accessor/grib_accessor_class_simple_packing_error.cc @@ -0,0 +1,70 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_simple_packing_error.h" +#include "grib_scaling.h" + +grib_accessor_class_simple_packing_error_t _grib_accessor_class_simple_packing_error{"simple_packing_error"}; +grib_accessor_class* grib_accessor_class_simple_packing_error = &_grib_accessor_class_simple_packing_error; + + +void grib_accessor_class_simple_packing_error_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_simple_packing_error_t* self = (grib_accessor_simple_packing_error_t*)a; + int n = 0; + grib_handle* h = grib_handle_of_accessor(a); + + self->bitsPerValue = grib_arguments_get_name(h, c, n++); + self->binaryScaleFactor = grib_arguments_get_name(h, c, n++); + self->decimalScaleFactor = grib_arguments_get_name(h, c, n++); + self->referenceValue = grib_arguments_get_name(h, c, n++); + self->floatType = grib_arguments_get_name(h, c, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +int grib_accessor_class_simple_packing_error_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_simple_packing_error_t* self = (grib_accessor_simple_packing_error_t*)a; + + int ret = 0; + long binaryScaleFactor = 0; + long bitsPerValue = 0; + long decimalScaleFactor = 0; + double referenceValue = 0; + grib_handle* h = grib_handle_of_accessor(a); + + if ((ret = grib_get_long_internal(h, self->binaryScaleFactor, &binaryScaleFactor)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(h, self->bitsPerValue, &bitsPerValue)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(h, self->decimalScaleFactor, &decimalScaleFactor)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_double_internal(h, self->referenceValue, &referenceValue)) != GRIB_SUCCESS) + return ret; + + if (!strcmp(self->floatType, "ibm")) + *val = grib_ibmfloat_error(referenceValue); + else if (!strcmp(self->floatType, "ieee")) + *val = grib_ieeefloat_error(referenceValue); + else + Assert(1 == 0); + + if (bitsPerValue != 0) + *val = (*val + codes_power(binaryScaleFactor, 2)) * codes_power(-decimalScaleFactor, 10) * 0.5; + + if (ret == GRIB_SUCCESS) + *len = 1; + + return ret; +} diff --git a/src/accessor/grib_accessor_class_simple_packing_error.h b/src/accessor/grib_accessor_class_simple_packing_error.h new file mode 100644 index 000000000..f0c005e03 --- /dev/null +++ b/src/accessor/grib_accessor_class_simple_packing_error.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_simple_packing_error_t : public grib_accessor_double_t +{ +public: + /* Members defined in simple_packing_error */ + const char* binaryScaleFactor; + const char* bitsPerValue; + const char* decimalScaleFactor; + const char* referenceValue; + const char* floatType; +}; + +class grib_accessor_class_simple_packing_error_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_simple_packing_error_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_simple_packing_error_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_size.cc b/src/accessor/grib_accessor_class_size.cc new file mode 100644 index 000000000..71c0dd947 --- /dev/null +++ b/src/accessor/grib_accessor_class_size.cc @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_size.h" + +grib_accessor_class_size_t _grib_accessor_class_size{ "size" }; +grib_accessor_class* grib_accessor_class_size = &_grib_accessor_class_size; + + +void grib_accessor_class_size_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_size_t* self = (grib_accessor_size_t*)a; + self->accessor = grib_arguments_get_name(grib_handle_of_accessor(a), c, 0); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_size_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_size_t* self = (grib_accessor_size_t*)a; + + size_t size = 0; + int ret = grib_get_size(grib_handle_of_accessor(a), self->accessor, &size); + *val = (long)size; + *len = 1; + return ret; +} diff --git a/src/accessor/grib_accessor_class_size.h b/src/accessor/grib_accessor_class_size.h new file mode 100644 index 000000000..9901c479e --- /dev/null +++ b/src/accessor/grib_accessor_class_size.h @@ -0,0 +1,30 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_size_t : public grib_accessor_long_t +{ +public: + /* Members defined in size */ + const char* accessor; +}; + +class grib_accessor_class_size_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_size_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_size_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_smart_table.cc b/src/accessor/grib_accessor_class_smart_table.cc similarity index 70% rename from src/grib_accessor_class_smart_table.cc rename to src/accessor/grib_accessor_class_smart_table.cc index a3f257312..1c49f2ab0 100644 --- a/src/grib_accessor_class_smart_table.cc +++ b/src/accessor/grib_accessor_class_smart_table.cc @@ -8,127 +8,12 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" +#include "grib_accessor_class_smart_table.h" #include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_unsigned - IMPLEMENTS = init;dump;unpack_string;unpack_long - IMPLEMENTS = value_count; destroy; get_native_type; - MEMBERS = const char* values - MEMBERS = const char* tablename - MEMBERS = const char* masterDir - MEMBERS = const char* localDir - MEMBERS = const char* extraDir - MEMBERS = const char* extraTable - MEMBERS = int widthOfCode - MEMBERS = long* tableCodes - MEMBERS = size_t tableCodesSize - MEMBERS = grib_smart_table* table - MEMBERS = int dirty - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_smart_table -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in smart_table */ - const char* values; - const char* tablename; - const char* masterDir; - const char* localDir; - const char* extraDir; - const char* extraTable; - int widthOfCode; - long* tableCodes; - size_t tableCodesSize; - grib_smart_table* table; - int dirty; -} grib_accessor_smart_table; - -extern grib_accessor_class* grib_accessor_class_unsigned; - -static grib_accessor_class _grib_accessor_class_smart_table = { - &grib_accessor_class_unsigned, /* super */ - "smart_table", /* name */ - sizeof(grib_accessor_smart_table), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - +grib_accessor_class_smart_table_t _grib_accessor_class_smart_table{"smart_table"}; grib_accessor_class* grib_accessor_class_smart_table = &_grib_accessor_class_smart_table; -/* END_CLASS_IMP */ - #if GRIB_PTHREADS static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; @@ -145,7 +30,7 @@ static void thread_init() static int once = 0; static omp_nest_lock_t mutex; -static void thread_init() +void thread_init() { GRIB_OMP_CRITICAL(lock_grib_accessor_class_smart_table_c) { @@ -159,10 +44,12 @@ static void thread_init() static int grib_load_smart_table(grib_context* c, const char* filename, const char* recomposed_name, size_t size, grib_smart_table* t); -static void init(grib_accessor* a, const long len, grib_arguments* params) +void grib_accessor_class_smart_table_t::init(grib_accessor* a, const long len, grib_arguments* params) { + grib_accessor_class_unsigned_t::init(a, len, params); + int n = 0; - grib_accessor_smart_table* self = (grib_accessor_smart_table*)a; + grib_accessor_smart_table_t* self = (grib_accessor_smart_table_t*)a; grib_handle* hand = grib_handle_of_accessor(a); self->values = grib_arguments_get_name(hand, params, n++); @@ -180,9 +67,9 @@ static void init(grib_accessor* a, const long len, grib_arguments* params) self->tableCodes = 0; } -static grib_smart_table* load_table(grib_accessor* a) +grib_smart_table* load_table(grib_accessor* a) { - grib_accessor_smart_table* self = (grib_accessor_smart_table*)a; + grib_accessor_smart_table_t* self = (grib_accessor_smart_table_t*)a; size_t size = 0; grib_handle* h = ((grib_accessor*)self)->parent->h; grib_context* c = h->context; @@ -393,14 +280,14 @@ void grib_smart_table_delete(grib_context* c) } } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_smart_table_t::dump(grib_accessor* a, grib_dumper* dumper) { grib_dump_long(dumper, a, NULL); } -static int unpack_string(grib_accessor* a, char* buffer, size_t* len) +int grib_accessor_class_smart_table_t::unpack_string(grib_accessor* a, char* buffer, size_t* len) { - grib_accessor_smart_table* self = (grib_accessor_smart_table*)a; + grib_accessor_smart_table_t* self = (grib_accessor_smart_table_t*)a; grib_smart_table* table = NULL; size_t size = 1; @@ -409,7 +296,7 @@ static int unpack_string(grib_accessor* a, char* buffer, size_t* len) char tmp[1024]; size_t l = 0; - if ((err = grib_unpack_long(a, &value, &size)) != GRIB_SUCCESS) + if ((err = a->unpack_long(&value, &size)) != GRIB_SUCCESS) return err; if (!self->table) @@ -439,7 +326,7 @@ static int unpack_string(grib_accessor* a, char* buffer, size_t* len) static int get_table_codes(grib_accessor* a) { - grib_accessor_smart_table* self = (grib_accessor_smart_table*)a; + grib_accessor_smart_table_t* self = (grib_accessor_smart_table_t*)a; size_t size = 0; long* v = 0; int err = 0; @@ -489,10 +376,10 @@ static int get_table_codes(grib_accessor* a) return 0; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_smart_table_t::value_count(grib_accessor* a, long* count) { int err = 0; - grib_accessor_smart_table* self = (grib_accessor_smart_table*)a; + grib_accessor_smart_table_t* self = (grib_accessor_smart_table_t*)a; *count = 0; if (!self->values) @@ -505,18 +392,20 @@ static int value_count(grib_accessor* a, long* count) return GRIB_SUCCESS; } -static void destroy(grib_context* context, grib_accessor* a) +void grib_accessor_class_smart_table_t::destroy(grib_context* context, grib_accessor* a) { - grib_accessor_smart_table* self = (grib_accessor_smart_table*)a; + grib_accessor_smart_table_t* self = (grib_accessor_smart_table_t*)a; if (a->vvalue != NULL) { grib_context_free(context, a->vvalue); a->vvalue = NULL; } if (self->tableCodes) grib_context_free(a->context, self->tableCodes); + + grib_accessor_class_unsigned_t::destroy(context, a); } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_smart_table_t::get_native_type(grib_accessor* a) { int type = GRIB_TYPE_LONG; //printf("---------- %s flags=%ld GRIB_ACCESSOR_FLAG_STRING_TYPE=%d\n", @@ -526,10 +415,10 @@ static int get_native_type(grib_accessor* a) return type; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_smart_table_t::unpack_long(grib_accessor* a, long* val, size_t* len) { int err = 0; - grib_accessor_smart_table* self = (grib_accessor_smart_table*)a; + grib_accessor_smart_table_t* self = (grib_accessor_smart_table_t*)a; size_t i; if (!self->values) diff --git a/src/accessor/grib_accessor_class_smart_table.h b/src/accessor/grib_accessor_class_smart_table.h new file mode 100644 index 000000000..c7aaf0827 --- /dev/null +++ b/src/accessor/grib_accessor_class_smart_table.h @@ -0,0 +1,44 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_unsigned.h" +#include + +class grib_accessor_smart_table_t : public grib_accessor_unsigned_t +{ +public: + const char* values; + const char* tablename; + const char* masterDir; + const char* localDir; + const char* extraDir; + const char* extraTable; + int widthOfCode; + long* tableCodes; + size_t tableCodesSize; + grib_smart_table* table; + int dirty; +}; + +class grib_accessor_class_smart_table_t : public grib_accessor_class_unsigned_t +{ +public: + grib_accessor_class_smart_table_t(const char* name) : grib_accessor_class_unsigned_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_smart_table_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_smart_table_column.cc b/src/accessor/grib_accessor_class_smart_table_column.cc new file mode 100644 index 000000000..7d352471d --- /dev/null +++ b/src/accessor/grib_accessor_class_smart_table_column.cc @@ -0,0 +1,179 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_smart_table_column.h" +#include "grib_accessor_class_smart_table.h" + +grib_accessor_class_smart_table_column_t _grib_accessor_class_smart_table_column{"smart_table_column"}; +grib_accessor_class* grib_accessor_class_smart_table_column = &_grib_accessor_class_smart_table_column; + + + +void grib_accessor_class_smart_table_column_t::init(grib_accessor* a, const long len, grib_arguments* params){ + grib_accessor_class_gen_t::init(a, len, params); + int n = 0; + grib_accessor_smart_table_column_t* self = (grib_accessor_smart_table_column_t*)a; + + self->smartTable = grib_arguments_get_name(grib_handle_of_accessor(a), params, n++); + self->index = grib_arguments_get_long(grib_handle_of_accessor(a), params, n++); + + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +void grib_accessor_class_smart_table_column_t::dump(grib_accessor* a, grib_dumper* dumper){ + int type = get_native_type(a); + + switch (type) { + case GRIB_TYPE_LONG: + grib_dump_long(dumper, a, NULL); + break; + case GRIB_TYPE_STRING: + grib_dump_string_array(dumper, a, NULL); + break; + } +} + +int grib_accessor_class_smart_table_column_t::unpack_string_array(grib_accessor* a, char** buffer, size_t* len){ + grib_accessor_smart_table_column_t* self = (grib_accessor_smart_table_column_t*)a; + grib_accessor_smart_table_t* tableAccessor = NULL; + grib_smart_table* table = NULL; + + size_t size = 1; + long* code; + int err = GRIB_SUCCESS; + char tmp[1024] = {0,}; + int i = 0; + + tableAccessor = (grib_accessor_smart_table_t*)grib_find_accessor(grib_handle_of_accessor(a), self->smartTable); + if (!tableAccessor) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Unable to find accessor %s", self->smartTable); + return GRIB_NOT_FOUND; + } + + err = grib_get_size_acc(grib_handle_of_accessor(a), (grib_accessor*)tableAccessor, &size); + if (err) + return err; + if (*len < size) { + return GRIB_BUFFER_TOO_SMALL; + } + + code = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); + if (!code) { + grib_context_log(a->context, GRIB_LOG_FATAL, "%s: Memory allocation error: %zu bytes", a->name, size); + return GRIB_OUT_OF_MEMORY; + } + + if ((err = ((grib_accessor*)tableAccessor)->unpack_long(code, &size)) != GRIB_SUCCESS) + return err; + + table = tableAccessor->table; + + for (i = 0; i < size; i++) { + if (table && (code[i] >= 0) && + (code[i] < table->numberOfEntries) && + table->entries[code[i]].column[self->index]) { + strcpy(tmp, table->entries[code[i]].column[self->index]); + } + else { + snprintf(tmp, sizeof(tmp), "%d", (int)code[i]); + } + + buffer[i] = grib_context_strdup(a->context, tmp); + } + *len = size; + grib_context_free(a->context, code); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_smart_table_column_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_smart_table_column_t* self = (grib_accessor_smart_table_column_t*)a; + grib_accessor_smart_table_t* tableAccessor = NULL; + grib_smart_table* table = NULL; + + size_t size = 1; + long* code; + int err = GRIB_SUCCESS; + int i = 0; + + for (i = 0; i < *len; i++) + val[i] = GRIB_MISSING_LONG; + + tableAccessor = (grib_accessor_smart_table_t*)grib_find_accessor(grib_handle_of_accessor(a), self->smartTable); + if (!tableAccessor) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Unable to find accessor %s", self->smartTable); + return GRIB_NOT_FOUND; + } + + err = grib_get_size_acc(grib_handle_of_accessor(a), (grib_accessor*)tableAccessor, &size); + if (err) + return err; + if (*len < size) { + return GRIB_BUFFER_TOO_SMALL; + } + + code = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); + if (!code) return GRIB_OUT_OF_MEMORY; + + if ((err = ((grib_accessor*)tableAccessor)->unpack_long(code, &size)) != GRIB_SUCCESS) { + grib_context_free(a->context, code); + return err; + } + + table = tableAccessor->table; + + for (i = 0; i < size; i++) { + if (table && (code[i] >= 0) && + (code[i] < table->numberOfEntries) && + table->entries[code[i]].column[self->index]) { + val[i] = atol(table->entries[code[i]].column[self->index]); + } + } + *len = size; + grib_context_free(a->context, code); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_smart_table_column_t::value_count(grib_accessor* a, long* count){ + grib_accessor_smart_table_column_t* self = (grib_accessor_smart_table_column_t*)a; + size_t size = 0; + int err = 0; + *count = 0; + + if (!self->smartTable) + return 0; + + err = grib_get_size(grib_handle_of_accessor(a), self->smartTable, &size); + *count = size; + return err; +} + +void grib_accessor_class_smart_table_column_t::destroy(grib_context* context, grib_accessor* a){ + if (a->vvalue != NULL) { + grib_context_free(context, a->vvalue); + a->vvalue = NULL; + } + + grib_accessor_class_gen_t::destroy(context, a); +} + +int grib_accessor_class_smart_table_column_t::get_native_type(grib_accessor* a){ + int type = GRIB_TYPE_LONG; + /*printf("---------- %s flags=%ld GRIB_ACCESSOR_FLAG_STRING_TYPE=%d\n", + a->name,a->flags,GRIB_ACCESSOR_FLAG_STRING_TYPE);*/ + if (a->flags & GRIB_ACCESSOR_FLAG_STRING_TYPE) + type = GRIB_TYPE_STRING; + return type; +} diff --git a/src/accessor/grib_accessor_class_smart_table_column.h b/src/accessor/grib_accessor_class_smart_table_column.h new file mode 100644 index 000000000..9e1edcd2a --- /dev/null +++ b/src/accessor/grib_accessor_class_smart_table_column.h @@ -0,0 +1,35 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_smart_table_column_t : public grib_accessor_gen_t +{ +public: + const char* smartTable; + int index; +}; + +class grib_accessor_class_smart_table_column_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_smart_table_column_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_smart_table_column_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string_array(grib_accessor*, char**, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_spd.cc b/src/accessor/grib_accessor_class_spd.cc new file mode 100644 index 000000000..dd717ba3c --- /dev/null +++ b/src/accessor/grib_accessor_class_spd.cc @@ -0,0 +1,155 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_spd.h" + +grib_accessor_class_spd_t _grib_accessor_class_spd{"spd"}; +grib_accessor_class* grib_accessor_class_spd = &_grib_accessor_class_spd; + + +long grib_accessor_class_spd_t::byte_count(grib_accessor* a){ + return a->length; +} + +static long compute_byte_count(grib_accessor* a){ + grib_accessor_spd_t* self = (grib_accessor_spd_t*)a; + long numberOfBits = 0; + long numberOfElements = 0; + + int ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s unable to get %s to compute size", a->name, self->numberOfBits); + return 0; + } + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, &numberOfElements); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s unable to get %s to compute size", a->name, self->numberOfElements); + return 0; + } + numberOfElements++; + + return (numberOfBits * numberOfElements + 7) / 8; +} + +void grib_accessor_class_spd_t::init(grib_accessor* a, const long len, grib_arguments* args){ + grib_accessor_class_long_t::init(a, len, args); + grib_accessor_spd_t* self = (grib_accessor_spd_t*)a; + int n = 0; + self->numberOfBits = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->numberOfElements = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + a->length = compute_byte_count(a); +} + +int grib_accessor_class_spd_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_spd_t* self = (grib_accessor_spd_t*)a; + long pos = a->offset * 8; + long rlen = 0; + long numberOfBits = 0; + + int ret = value_count(a, &rlen); + if (ret) + return ret; + + if (*len < rlen) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Wrong size (%zu) for %s, it contains %ld values", *len, a->name, rlen); + *len = rlen; + return GRIB_ARRAY_TOO_SMALL; + } + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); + if (ret) + return ret; + if (numberOfBits > 64) { + grib_context_log(a->context, GRIB_LOG_ERROR,"Invalid number of bits: %ld",numberOfBits); + return GRIB_DECODING_ERROR; + } + + for (long i = 0; i < rlen - 1; i++) + val[i] = grib_decode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, &pos, numberOfBits); + + val[rlen - 1] = grib_decode_signed_longb(grib_handle_of_accessor(a)->buffer->data, &pos, numberOfBits); + + *len = rlen; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_spd_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_spd_t* self = (grib_accessor_spd_t*)a; + int ret = 0; + long off = 0; + long numberOfBits = 0; + size_t buflen = 0; + unsigned char* buf = NULL; + unsigned long i = 0; + long rlen = 0; + + ret = value_count(a, &rlen); + if (ret) + return ret; + + if (*len != rlen) { + ret = grib_set_long(grib_handle_of_accessor(a), self->numberOfElements, (*len) - 1); + if (ret) return ret; + } + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); + if (ret) + return ret; + + buflen = compute_byte_count(a); + buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen); + + for (i = 0; i < rlen - 1; i++) { + grib_encode_unsigned_longb(buf, val[i], &off, numberOfBits); + } + + grib_encode_signed_longb(buf, val[rlen - 1], &off, numberOfBits); + + grib_buffer_replace(a, buf, buflen, 1, 1); + + grib_context_free(a->context, buf); + + *len = rlen; + return ret; +} + +int grib_accessor_class_spd_t::value_count(grib_accessor* a, long* numberOfElements){ + grib_accessor_spd_t* self = (grib_accessor_spd_t*)a; + int ret; + *numberOfElements = 0; + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, numberOfElements); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s unable to get %s to compute size", a->name, self->numberOfElements); + return ret; + } + (*numberOfElements)++; + + return ret; +} + +long grib_accessor_class_spd_t::byte_offset(grib_accessor* a){ + return a->offset; +} + +void grib_accessor_class_spd_t::update_size(grib_accessor* a, size_t s){ + a->length = s; +} + +long grib_accessor_class_spd_t::next_offset(grib_accessor* a){ + return a->byte_offset() + a->length; +} diff --git a/src/accessor/grib_accessor_class_spd.h b/src/accessor/grib_accessor_class_spd.h new file mode 100644 index 000000000..ee4fa5d12 --- /dev/null +++ b/src/accessor/grib_accessor_class_spd.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_spd_t : public grib_accessor_long_t +{ +public: + /* Members defined in spd */ + const char* numberOfBits; + const char* numberOfElements; +}; + +class grib_accessor_class_spd_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_spd_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_spd_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; +}; diff --git a/src/accessor/grib_accessor_class_spectral_truncation.cc b/src/accessor/grib_accessor_class_spectral_truncation.cc new file mode 100644 index 000000000..2fc45511f --- /dev/null +++ b/src/accessor/grib_accessor_class_spectral_truncation.cc @@ -0,0 +1,81 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_spectral_truncation.h" + +grib_accessor_class_spectral_truncation_t _grib_accessor_class_spectral_truncation{"spectral_truncation"}; +grib_accessor_class* grib_accessor_class_spectral_truncation = &_grib_accessor_class_spectral_truncation; + + +void grib_accessor_class_spectral_truncation_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_spectral_truncation_t* self = (grib_accessor_spectral_truncation_t*)a; + int n = 0; + + self->J = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->K = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->M = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->T = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_spectral_truncation_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_spectral_truncation_t* self = (grib_accessor_spectral_truncation_t*)a; + int ret = 0; + + long J, K, M, T, Tc; + + if (*len < 1) + return GRIB_ARRAY_TOO_SMALL; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->J, &J)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->K, &K)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->M, &M)) != GRIB_SUCCESS) + return ret; + + Tc = -1; + if (J == K && K == M) { + /* Triangular truncation */ + Tc = (M + 1) * (M + 2); + } + if (K == J + M) { + /* Rhomboidal truncation */ + Tc = 2 * J * M; + } + if (J == K && K > M) { + /* Trapezoidal truncation */ + Tc = M * (2 * J - M); + } + *val = Tc; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->T, &T)) != GRIB_SUCCESS) { + if (Tc == -1) + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s. Spectral Truncation Type Unknown: %s=%ld %s=%ld %s=%ld", + a->name, self->J, J, self->K, K, self->M, M); + Tc = 0; + grib_set_long(grib_handle_of_accessor(a), self->T, Tc); + } + else { + if (Tc != -1 && Tc != T) + grib_set_long(grib_handle_of_accessor(a), self->T, Tc); + } + + if (ret == GRIB_SUCCESS) + *len = 1; + + return ret; +} diff --git a/src/accessor/grib_accessor_class_spectral_truncation.h b/src/accessor/grib_accessor_class_spectral_truncation.h new file mode 100644 index 000000000..c9f85b9f8 --- /dev/null +++ b/src/accessor/grib_accessor_class_spectral_truncation.h @@ -0,0 +1,33 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_spectral_truncation_t : public grib_accessor_long_t +{ +public: + /* Members defined in spectral_truncation */ + const char* J; + const char* K; + const char* M; + const char* T; +}; + +class grib_accessor_class_spectral_truncation_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_spectral_truncation_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_spectral_truncation_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_sprintf.cc b/src/accessor/grib_accessor_class_sprintf.cc similarity index 54% rename from src/grib_accessor_class_sprintf.cc rename to src/accessor/grib_accessor_class_sprintf.cc index 106ce1e4d..cc9e37e6a 100644 --- a/src/grib_accessor_class_sprintf.cc +++ b/src/accessor/grib_accessor_class_sprintf.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,109 +9,21 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_ascii - IMPLEMENTS = unpack_string;value_count - IMPLEMENTS = init;string_length - MEMBERS= grib_arguments* args - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_sprintf -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in sprintf */ - grib_arguments* args; -} grib_accessor_sprintf; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_sprintf = { - &grib_accessor_class_ascii, /* super */ - "sprintf", /* name */ - sizeof(grib_accessor_sprintf), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_sprintf.h" +grib_accessor_class_sprintf_t _grib_accessor_class_sprintf{"sprintf"}; grib_accessor_class* grib_accessor_class_sprintf = &_grib_accessor_class_sprintf; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_sprintf* self = (grib_accessor_sprintf*)a; +void grib_accessor_class_sprintf_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_ascii_t::init(a, l, c); + grib_accessor_sprintf_t* self = (grib_accessor_sprintf_t*)a; self->args = c; a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; } -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_sprintf* self = (grib_accessor_sprintf*)a; +int grib_accessor_class_sprintf_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_sprintf_t* self = (grib_accessor_sprintf_t*)a; char result[1024]; char tempBuffer[2048]; char sres[1024]; @@ -148,8 +61,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), tempname, &ires)) != GRIB_SUCCESS) return ret; /* Bug GRIB-56: Check to see if the key is missing */ - is_missing = grib_is_missing(grib_handle_of_accessor(a), tempname, &ret); - if (ret != GRIB_SUCCESS) + is_missing = grib_is_missing(grib_handle_of_accessor(a), tempname, &ret); if (ret != GRIB_SUCCESS) return ret; if (is_missing) { snprintf(tempBuffer, sizeof(tempBuffer), "%sMISSING", result); @@ -205,13 +117,11 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) return GRIB_SUCCESS; } -static int value_count(grib_accessor* a, long* count) -{ +int grib_accessor_class_sprintf_t::value_count(grib_accessor* a, long* count){ *count = 1; return 0; } -static size_t string_length(grib_accessor* a) -{ +size_t grib_accessor_class_sprintf_t::string_length(grib_accessor* a){ return 1024; } diff --git a/src/accessor/grib_accessor_class_sprintf.h b/src/accessor/grib_accessor_class_sprintf.h new file mode 100644 index 000000000..36d5f3e10 --- /dev/null +++ b/src/accessor/grib_accessor_class_sprintf.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_sprintf_t : public grib_accessor_ascii_t +{ +public: + /* Members defined in sprintf */ + grib_arguments* args; +}; + +class grib_accessor_class_sprintf_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_sprintf_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_sprintf_t{}; } + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_statistics.cc b/src/accessor/grib_accessor_class_statistics.cc similarity index 55% rename from src/grib_accessor_class_statistics.cc rename to src/accessor/grib_accessor_class_statistics.cc index 915701a3a..2d5cfd756 100644 --- a/src/grib_accessor_class_statistics.cc +++ b/src/accessor/grib_accessor_class_statistics.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,116 +9,15 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_abstract_vector - IMPLEMENTS = unpack_double; destroy - IMPLEMENTS = unpack_string - IMPLEMENTS = value_count;compare - IMPLEMENTS = init - MEMBERS = const char* values - MEMBERS = const char* missing_value - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_statistics -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in abstract_vector */ - double* v; - int number_of_elements; - /* Members defined in statistics */ - const char* values; - const char* missing_value; -} grib_accessor_statistics; - -extern grib_accessor_class* grib_accessor_class_abstract_vector; - -static grib_accessor_class _grib_accessor_class_statistics = { - &grib_accessor_class_abstract_vector, /* super */ - "statistics", /* name */ - sizeof(grib_accessor_statistics), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +#include "grib_accessor_class_statistics.h" +grib_accessor_class_statistics_t _grib_accessor_class_statistics{"statistics"}; grib_accessor_class* grib_accessor_class_statistics = &_grib_accessor_class_statistics; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_statistics* self = (grib_accessor_statistics*)a; +void grib_accessor_class_statistics_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_abstract_vector_t::init(a, l, c); + grib_accessor_statistics_t* self = (grib_accessor_statistics_t*)a; int n = 0; self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); @@ -134,9 +34,8 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) a->dirty = 1; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_statistics* self = (grib_accessor_statistics*)a; +int grib_accessor_class_statistics_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_statistics_t* self = (grib_accessor_statistics_t*)a; int ret = 0; double* values = NULL; size_t i = 0, size = 0, real_size = 0; @@ -157,7 +56,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; grib_context_log(a->context, GRIB_LOG_DEBUG, - "grib_accessor_statistics: computing statistics for %d values", size); + "grib_accessor_statistics_t: computing statistics for %d values", size); if ((ret = grib_get_double(h, self->missing_value, &missing)) != GRIB_SUCCESS) return ret; @@ -267,21 +166,19 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return ret; } -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_statistics* self = (grib_accessor_statistics*)a; +int grib_accessor_class_statistics_t::value_count(grib_accessor* a, long* count){ + grib_accessor_statistics_t* self = (grib_accessor_statistics_t*)a; *count = self->number_of_elements; return 0; } -static void destroy(grib_context* c, grib_accessor* a) -{ - grib_accessor_statistics* self = (grib_accessor_statistics*)a; +void grib_accessor_class_statistics_t::destroy(grib_context* c, grib_accessor* a){ + grib_accessor_statistics_t* self = (grib_accessor_statistics_t*)a; grib_context_free(c, self->v); + grib_accessor_class_abstract_vector_t::destroy(c, a); } -static int compare(grib_accessor* a, grib_accessor* b) -{ +int grib_accessor_class_statistics_t::compare(grib_accessor* a, grib_accessor* b){ int retval = GRIB_SUCCESS; double* aval = 0; double* bval = 0; @@ -291,13 +188,11 @@ static int compare(grib_accessor* a, grib_accessor* b) int err = 0; long count = 0; - err = grib_value_count(a, &count); - if (err) + err = a->value_count(&count); if (err) return err; alen = count; - err = grib_value_count(b, &count); - if (err) + err = b->value_count(&count); if (err) return err; blen = count; @@ -310,9 +205,7 @@ static int compare(grib_accessor* a, grib_accessor* b) b->dirty = 1; a->dirty = 1; - grib_unpack_double(a, aval, &alen); - grib_unpack_double(b, bval, &blen); - + a->unpack_double(aval, &alen); b->unpack_double(bval, &blen); retval = GRIB_SUCCESS; for (size_t i=0; ivalues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->J = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->K = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->M = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->JS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + + self->number_of_elements = 4; + self->v = (double*)grib_context_malloc(a->context, + sizeof(double) * self->number_of_elements); + + a->length = 0; + a->dirty = 1; +} + +int grib_accessor_class_statistics_spectral_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_statistics_spectral_t* self = (grib_accessor_statistics_spectral_t*)a; + int ret = 0, i = 0; + double* values; + size_t size = 0; + long J, K, M, N; + double avg, enorm, sd; + grib_context* c = a->context; + grib_handle* h = grib_handle_of_accessor(a); + + if (!a->dirty) + return GRIB_SUCCESS; + + if (*len != self->number_of_elements) + return GRIB_ARRAY_TOO_SMALL; + + if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long(grib_handle_of_accessor(a), self->J, &J)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long(grib_handle_of_accessor(a), self->K, &K)) != GRIB_SUCCESS) + return ret; + + if ((ret = grib_get_long(grib_handle_of_accessor(a), self->M, &M)) != GRIB_SUCCESS) + return ret; + + if (J != M || M != K) + return GRIB_NOT_IMPLEMENTED; + + N = (M + 1) * (M + 2) / 2; + + if (2 * N != size) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "wrong number of components for spherical harmonics %ld != %ld", 2 * N, size); + return GRIB_WRONG_ARRAY_SIZE; + } + + values = (double*)grib_context_malloc(c, size * sizeof(double)); + if (!values) + return GRIB_OUT_OF_MEMORY; + + if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { + grib_context_free(c, values); + return ret; + } + + avg = values[0]; + sd = 0; + + for (i = 2; i < 2 * J; i += 2) + sd += values[i] * values[i]; + + for (i = 2 * J; i < size; i += 2) + sd += 2 * values[i] * values[i] + 2 * values[i + 1] * values[i + 1]; + + enorm = sd + avg * avg; + + sd = sqrt(sd); + enorm = sqrt(enorm); + + a->dirty = 0; + + grib_context_free(c, values); + + self->v[0] = avg; + self->v[1] = enorm; + self->v[2] = sd; + self->v[3] = sd == 0 ? 1 : 0; + + for (i = 0; i < self->number_of_elements; i++) + val[i] = self->v[i]; + + return ret; +} + +int grib_accessor_class_statistics_spectral_t::value_count(grib_accessor* a, long* count){ + grib_accessor_statistics_spectral_t* self = (grib_accessor_statistics_spectral_t*)a; + *count = self->number_of_elements; + return 0; +} + +void grib_accessor_class_statistics_spectral_t::destroy(grib_context* c, grib_accessor* a){ + grib_accessor_statistics_spectral_t* self = (grib_accessor_statistics_spectral_t*)a; + grib_context_free(c, self->v); + grib_accessor_class_abstract_vector_t::destroy(c, a); +} + +int grib_accessor_class_statistics_spectral_t::compare(grib_accessor* a, grib_accessor* b){ + int retval = GRIB_SUCCESS; + double* aval = 0; + double* bval = 0; + + size_t alen = 0; + size_t blen = 0; + int err = 0; + long count = 0; + + err = a->value_count(&count); if (err) + return err; + alen = count; + + err = b->value_count(&count); if (err) + return err; + blen = count; + + if (alen != blen) + return GRIB_COUNT_MISMATCH; + + aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); + bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); + + b->dirty = 1; + a->dirty = 1; + + a->unpack_double(aval, &alen); b->unpack_double(bval, &blen); + retval = GRIB_SUCCESS; + for (size_t i=0; icontext, aval); + grib_context_free(b->context, bval); + + return retval; +} diff --git a/src/accessor/grib_accessor_class_statistics_spectral.h b/src/accessor/grib_accessor_class_statistics_spectral.h new file mode 100644 index 000000000..41846c5c7 --- /dev/null +++ b/src/accessor/grib_accessor_class_statistics_spectral.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_abstract_vector.h" + +class grib_accessor_statistics_spectral_t : public grib_accessor_abstract_vector_t +{ +public: + /* Members defined in statistics_spectral */ + const char* values; + const char* J; + const char* K; + const char* M; + const char* JS; +}; + +class grib_accessor_class_statistics_spectral_t : public grib_accessor_class_abstract_vector_t +{ +public: + grib_accessor_class_statistics_spectral_t(const char* name) : grib_accessor_class_abstract_vector_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_statistics_spectral_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessor_class_step_human_readable.cc b/src/accessor/grib_accessor_class_step_human_readable.cc new file mode 100644 index 000000000..18dec9c14 --- /dev/null +++ b/src/accessor/grib_accessor_class_step_human_readable.cc @@ -0,0 +1,87 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_step_human_readable.h" + +grib_accessor_class_step_human_readable_t _grib_accessor_class_step_human_readable{ "step_human_readable" }; +grib_accessor_class* grib_accessor_class_step_human_readable = &_grib_accessor_class_step_human_readable; + + +void grib_accessor_class_step_human_readable_t::init(grib_accessor* a, const long len, grib_arguments* params) +{ + grib_accessor_class_gen_t::init(a, len, params); + grib_accessor_step_human_readable_t* self = (grib_accessor_step_human_readable_t*)a; + int n = 0; + grib_handle* h = grib_handle_of_accessor(a); + + self->stepUnits = grib_arguments_get_name(h, params, n++); + self->step = grib_arguments_get_name(h, params, n++); + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_step_human_readable_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_STRING; +} + +static int get_step_human_readable(grib_handle* h, char* result, size_t* length) +{ + int err = 0; + size_t slen = 2; + long step, hour, minute, second; + + /* Change units to seconds (highest resolution) + * before computing the step value + */ + if ((err = grib_set_string(h, "stepUnits", "s", &slen)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long(h, "step", &step)) != GRIB_SUCCESS) + return err; + + hour = step / 3600; + minute = step / 60 % 60; + second = step % 60; + /* sprintf(result, "%ld:%ld:%ld", hour, minute, second); */ + + if (second) { + snprintf(result, 1024, "%ldh %ldm %lds", hour, minute, second); + } + else { + if (minute) + snprintf(result, 1024, "%ldh %ldm", hour, minute); + else + snprintf(result, 1024, "%ldh", hour); + } + + *length = strlen(result); + return GRIB_SUCCESS; +} + +int grib_accessor_class_step_human_readable_t::unpack_string(grib_accessor* a, char* buffer, size_t* len) +{ + grib_accessor_step_human_readable_t* self = (grib_accessor_step_human_readable_t*)a; + + grib_handle* h = grib_handle_of_accessor(a); + long stepUnits = 0; + int err = 0; + + /* Save the current value of stepUnits */ + err = grib_get_long_internal(h, self->stepUnits, &stepUnits); + if (err) return err; + + /* This will change stepUnits to seconds for its calculation */ + err = get_step_human_readable(h, buffer, len); + + /* Restore stepUnits */ + grib_set_long(h, self->stepUnits, stepUnits); + return err; +} diff --git a/src/accessor/grib_accessor_class_step_human_readable.h b/src/accessor/grib_accessor_class_step_human_readable.h new file mode 100644 index 000000000..cbd61ed31 --- /dev/null +++ b/src/accessor/grib_accessor_class_step_human_readable.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_step_human_readable_t : public grib_accessor_gen_t +{ +public: + /* Members defined in step_human_readable */ + const char* stepUnits; + const char* step; +}; + +class grib_accessor_class_step_human_readable_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_step_human_readable_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_step_human_readable_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_step_in_units.cc b/src/accessor/grib_accessor_class_step_in_units.cc similarity index 63% rename from src/grib_accessor_class_step_in_units.cc rename to src/accessor/grib_accessor_class_step_in_units.cc index a25c85aec..52086d700 100644 --- a/src/grib_accessor_class_step_in_units.cc +++ b/src/accessor/grib_accessor_class_step_in_units.cc @@ -1,3 +1,4 @@ + /* * (C) Copyright 2005- ECMWF. * @@ -8,121 +9,18 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" +#include "grib_accessor_class_step_in_units.h" #include "step.h" #include "step_utilities.h" #include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = init;dump - IMPLEMENTS = get_native_type - MEMBERS = const char* forecast_time_value - MEMBERS = const char* forecast_time_unit - MEMBERS = const char* step_units - MEMBERS = const char* time_range_unit - MEMBERS = const char* time_range_value - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_step_in_units -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in step_in_units */ - const char* forecast_time_value; - const char* forecast_time_unit; - const char* step_units; - const char* time_range_unit; - const char* time_range_value; -} grib_accessor_step_in_units; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_step_in_units = { - &grib_accessor_class_long, /* super */ - "step_in_units", /* name */ - sizeof(grib_accessor_step_in_units), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - +grib_accessor_class_step_in_units_t _grib_accessor_class_step_in_units{"step_in_units"}; grib_accessor_class* grib_accessor_class_step_in_units = &_grib_accessor_class_step_in_units; -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) +void grib_accessor_class_step_in_units_t::init(grib_accessor* a, const long l, grib_arguments* c) { - grib_accessor_step_in_units* self = (grib_accessor_step_in_units*)a; + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_step_in_units_t* self = (grib_accessor_step_in_units_t*)a; grib_handle* hand = grib_handle_of_accessor(a); int n = 0; @@ -133,14 +31,14 @@ static void init(grib_accessor* a, const long l, grib_arguments* c) self->time_range_value = grib_arguments_get_name(hand, c, n++); } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_step_in_units_t::dump(grib_accessor* a, grib_dumper* dumper) { grib_dump_double(dumper, a, NULL); } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_step_in_units_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - const grib_accessor_step_in_units* self = (grib_accessor_step_in_units*)a; + const grib_accessor_step_in_units_t* self = (grib_accessor_step_in_units_t*)a; int err = 0; long forecast_time_value, forecast_time_unit, step_units; grib_handle* h = grib_handle_of_accessor(a); @@ -169,9 +67,9 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_double(grib_accessor* a, double * val, size_t* len) +int grib_accessor_class_step_in_units_t::unpack_double(grib_accessor* a, double * val, size_t* len) { - const grib_accessor_step_in_units* self = (grib_accessor_step_in_units*)a; + const grib_accessor_step_in_units_t* self = (grib_accessor_step_in_units_t*)a; int err = 0; long forecast_time_value, forecast_time_unit, step_units; grib_handle* h = grib_handle_of_accessor(a); @@ -199,9 +97,9 @@ static int unpack_double(grib_accessor* a, double * val, size_t* len) return GRIB_SUCCESS; } -static int pack_long_new_(grib_accessor* a, const long start_step_value, const long start_step_unit, const long force_step_units) +int pack_long_new_(grib_accessor* a, const long start_step_value, const long start_step_unit, const long force_step_units) { - const grib_accessor_step_in_units* self = (grib_accessor_step_in_units*)a; + const grib_accessor_step_in_units_t* self = (grib_accessor_step_in_units_t*)a; grib_handle* h = grib_handle_of_accessor(a); int err = 0; long forecast_time_unit; @@ -211,7 +109,7 @@ static int pack_long_new_(grib_accessor* a, const long start_step_value, const l if ((err = grib_get_long_internal(h, self->forecast_time_unit, &forecast_time_unit)) != GRIB_SUCCESS) return err; - if ((err = unpack_long(a, &start_step_value_old, &len)) != GRIB_SUCCESS) + if ((err = a->unpack_long(&start_step_value_old, &len)) != GRIB_SUCCESS) return err; if ((err = grib_get_long_internal(h, "startStepUnit", &start_step_unit_old)) != GRIB_SUCCESS) return err; @@ -249,7 +147,7 @@ static int pack_long_new_(grib_accessor* a, const long start_step_value, const l return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_step_in_units_t::pack_long(grib_accessor* a, const long* val, size_t* len) { grib_handle* h = grib_handle_of_accessor(a); int ret = GRIB_SUCCESS; @@ -281,7 +179,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return ret; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) +int grib_accessor_class_step_in_units_t::pack_string(grib_accessor* a, const char* val, size_t* len) { grib_handle* h = grib_handle_of_accessor(a); //long force_step_units = eccodes::Unit(eccodes::Unit::Value::MISSING).value(); @@ -303,9 +201,9 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_string(grib_accessor* a, char* val, size_t* len) +int grib_accessor_class_step_in_units_t::unpack_string(grib_accessor* a, char* val, size_t* len) { - const grib_accessor_step_in_units* self = (grib_accessor_step_in_units*)a; + const grib_accessor_step_in_units_t* self = (grib_accessor_step_in_units_t*)a; grib_handle* h = grib_handle_of_accessor(a); int ret = GRIB_SUCCESS; long start_step_value = 0; @@ -347,7 +245,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) return GRIB_SUCCESS; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_step_in_units_t::get_native_type(grib_accessor* a) { grib_handle* h = grib_handle_of_accessor(a); const int show_units_for_hours = a->context->grib_hourly_steps_with_units; diff --git a/src/accessor/grib_accessor_class_step_in_units.h b/src/accessor/grib_accessor_class_step_in_units.h new file mode 100644 index 000000000..66f4b2b44 --- /dev/null +++ b/src/accessor/grib_accessor_class_step_in_units.h @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_step_in_units_t : public grib_accessor_long_t +{ +public: + /* Members defined in step_in_units */ + const char* forecast_time_value; + const char* forecast_time_unit; + const char* step_units; + const char* time_range_unit; + const char* time_range_value; +}; + +class grib_accessor_class_step_in_units_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_step_in_units_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_step_in_units_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_sum.cc b/src/accessor/grib_accessor_class_sum.cc new file mode 100644 index 000000000..39b96854f --- /dev/null +++ b/src/accessor/grib_accessor_class_sum.cc @@ -0,0 +1,107 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_sum.h" + +grib_accessor_class_sum_t _grib_accessor_class_sum{"sum"}; +grib_accessor_class* grib_accessor_class_sum = &_grib_accessor_class_sum; + + +void grib_accessor_class_sum_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_double_t::init(a, l, c); + grib_accessor_sum_t* self = (grib_accessor_sum_t*)a; + int n = 0; + self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_sum_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_sum_t* self = (grib_accessor_sum_t*)a; + int ret = 0; + size_t size = 0; + long* values = 0; + long i; + long count = 0; + + ret = value_count(a, &count); + if (ret) + return ret; + size = count; + + if (size == 0) { + *val = 0; + return GRIB_SUCCESS; + } + values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); + if (!values) + return GRIB_OUT_OF_MEMORY; + + grib_get_long_array(grib_handle_of_accessor(a), self->values, values, &size); + + *val = 0; + for (i = 0; i < size; i++) + *val += values[i]; + + grib_context_free(a->context, values); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_sum_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_sum_t* self = (grib_accessor_sum_t*)a; + int ret = 0; + size_t size = 0; + double* values = 0; + long i; + long count = 0; + + ret = value_count(a, &count); + if (ret) + return ret; + size = count; + + if (size == 0) { + *val = 0; + return GRIB_SUCCESS; + } + values = (double*)grib_context_malloc_clear(a->context, sizeof(double) * size); + if (!values) + return GRIB_OUT_OF_MEMORY; + + ret = grib_get_double_array(grib_handle_of_accessor(a), self->values, values, &size); + if (ret) { + grib_context_free(a->context, values); + return ret; + } + *val = 0; + for (i = 0; i < size; i++) + *val += values[i]; + + grib_context_free(a->context, values); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_sum_t::value_count(grib_accessor* a, long* count){ + grib_accessor_sum_t* self = (grib_accessor_sum_t*)a; + size_t n = 0; + int ret = 0; + + ret = grib_get_size(grib_handle_of_accessor(a), self->values, &n); + *count = n; + + if (ret) + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s is unable to get size of %s", a->name, self->values); + + return ret; +} diff --git a/src/accessor/grib_accessor_class_sum.h b/src/accessor/grib_accessor_class_sum.h new file mode 100644 index 000000000..5667d8da9 --- /dev/null +++ b/src/accessor/grib_accessor_class_sum.h @@ -0,0 +1,32 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_double.h" + +class grib_accessor_sum_t : public grib_accessor_double_t +{ +public: + /* Members defined in sum */ + const char* values; +}; + +class grib_accessor_class_sum_t : public grib_accessor_class_double_t +{ +public: + grib_accessor_class_sum_t(const char* name) : grib_accessor_class_double_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_sum_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_suppressed.cc b/src/accessor/grib_accessor_class_suppressed.cc new file mode 100644 index 000000000..10a99ee64 --- /dev/null +++ b/src/accessor/grib_accessor_class_suppressed.cc @@ -0,0 +1,72 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_suppressed.h" + +grib_accessor_class_suppressed_t _grib_accessor_class_suppressed{ "suppressed" }; +grib_accessor_class* grib_accessor_class_suppressed = &_grib_accessor_class_suppressed; + + +void grib_accessor_class_suppressed_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_suppressed_t* self = (grib_accessor_suppressed_t*)a; + self->args = c; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +static void log_message(grib_accessor* a) +{ + grib_accessor_suppressed_t* self = (grib_accessor_suppressed_t*)a; + int i = 0; + grib_handle* hand = grib_handle_of_accessor(a); + + grib_context_log(a->context, GRIB_LOG_ERROR, + "key '%s' is unavailable in this version.", a->name); + grib_context_log(a->context, GRIB_LOG_ERROR, + "Please use the following key(s):"); + while (grib_arguments_get_name(hand, self->args, i)) { + grib_context_log(a->context, GRIB_LOG_ERROR, "\t- %s", + grib_arguments_get_name(hand, self->args, i)); + i++; + } +} + +int grib_accessor_class_suppressed_t::unpack_string(grib_accessor* a, char* val, size_t* len) +{ + log_message(a); + return GRIB_NOT_FOUND; +} + +int grib_accessor_class_suppressed_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + log_message(a); + return GRIB_NOT_FOUND; +} + +int grib_accessor_class_suppressed_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + log_message(a); + return GRIB_NOT_FOUND; +} + +int grib_accessor_class_suppressed_t::value_count(grib_accessor* a, long* count) +{ + *count = 1; + return 0; +} + +int grib_accessor_class_suppressed_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_STRING; +} diff --git a/src/accessor/grib_accessor_class_suppressed.h b/src/accessor/grib_accessor_class_suppressed.h new file mode 100644 index 000000000..5d764be35 --- /dev/null +++ b/src/accessor/grib_accessor_class_suppressed.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_suppressed_t : public grib_accessor_long_t +{ +public: + /* Members defined in suppressed */ + grib_arguments* args; +}; + +class grib_accessor_class_suppressed_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_suppressed_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_suppressed_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_time.cc b/src/accessor/grib_accessor_class_time.cc new file mode 100644 index 000000000..debb1a2f4 --- /dev/null +++ b/src/accessor/grib_accessor_class_time.cc @@ -0,0 +1,113 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_time.h" + +grib_accessor_class_time_t _grib_accessor_class_time{"time"}; +grib_accessor_class* grib_accessor_class_time = &_grib_accessor_class_time; + + +void grib_accessor_class_time_t::init(grib_accessor* a, const long l, grib_arguments* c){ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_time_t* self = (grib_accessor_time_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int n = 0; + + self->hour = grib_arguments_get_name(hand, c, n++); + self->minute = grib_arguments_get_name(hand, c, n++); + self->second = grib_arguments_get_name(hand, c, n++); +} + +int grib_accessor_class_time_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + const grib_accessor_time_t* self = (grib_accessor_time_t*)a; + + int ret = 0; + long hour = 0, minute = 0, second = 0; + grib_handle* hand = grib_handle_of_accessor(a); + + if ((ret = grib_get_long_internal(hand, self->hour, &hour)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(hand, self->minute, &minute)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(hand, self->second, &second)) != GRIB_SUCCESS) + return ret; + + /* We ignore the 'seconds' in our time calculation! */ + if (second != 0) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Key %s (%s): Truncating time: non-zero seconds(%ld) ignored", a->name, __func__, second); + } + + if (*len < 1) + return GRIB_WRONG_ARRAY_SIZE; + + *val = hour * 100 + minute; + + if (hour == 255) { + *val = 12 * 100; + } + if (hour != 255 && minute == 255) { + *val = hour * 100; + } + return GRIB_SUCCESS; +} + +int grib_accessor_class_time_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + const grib_accessor_time_t* self = (grib_accessor_time_t*)a; + + int ret = 0; + long v = val[0]; + grib_handle* hand = grib_handle_of_accessor(a); + long hour = 0, minute = 0, second = 0; + + if (*len != 1) + return GRIB_WRONG_ARRAY_SIZE; + + if (!is_time_valid(v)) { + // ECC-1777: For now just a warning. Will later change to an error + fprintf(stderr, "ECCODES WARNING : %s:%s: Time is not valid! hour=%ld min=%ld sec=%ld\n", + a->cclass->name, __func__, hour, minute, second); + // return GRIB_ENCODING_ERROR; + } + + hour = v / 100; + minute = v % 100; + second = 0; /* We ignore the 'seconds' in our time calculation! */ + + if ((ret = grib_set_long_internal(hand, self->hour, hour)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_set_long_internal(hand, self->minute, minute)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_set_long_internal(hand, self->second, second)) != GRIB_SUCCESS) + return ret; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_time_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + long v = 0; + size_t lsize = 1, lmin = 5; + + unpack_long(a, &v, &lsize); + + if (*len < lmin) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + a->cclass->name, a->name, lmin, *len); + *len = lmin; + return GRIB_BUFFER_TOO_SMALL; + } + + snprintf(val, 64, "%04ld", v); + + len[0] = lmin; + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_time.h b/src/accessor/grib_accessor_class_time.h new file mode 100644 index 000000000..dee0325a9 --- /dev/null +++ b/src/accessor/grib_accessor_class_time.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_time_t : public grib_accessor_long_t +{ +public: + /* Members defined in time */ + const char* hour; + const char* minute; + const char* second; +}; + +class grib_accessor_class_time_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_time_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_time_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_to_double.cc b/src/accessor/grib_accessor_class_to_double.cc new file mode 100644 index 000000000..854a32ffc --- /dev/null +++ b/src/accessor/grib_accessor_class_to_double.cc @@ -0,0 +1,130 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_to_double.h" + +grib_accessor_class_to_double_t _grib_accessor_class_to_double{"to_double"}; +grib_accessor_class* grib_accessor_class_to_double = &_grib_accessor_class_to_double; + + +void grib_accessor_class_to_double_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + grib_accessor_to_double_t* self = (grib_accessor_to_double_t*)a; + + self->key = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 0); + self->start = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 1); + self->length = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 2); + self->scale = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 3); + if (!self->scale) + self->scale = 1; + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +int grib_accessor_class_to_double_t::value_count(grib_accessor* a, long* count){ + grib_accessor_to_double_t* self = (grib_accessor_to_double_t*)a; + size_t size = 0; + + int err = grib_get_size(grib_handle_of_accessor(a), self->key, &size); + *count = size; + + return err; +} + +size_t grib_accessor_class_to_double_t::string_length(grib_accessor* a){ + grib_accessor_to_double_t* self = (grib_accessor_to_double_t*)a; + size_t size = 0; + + if (self->length) + return self->length; + + grib_get_string_length_acc(a, &size); + return size; +} + +void grib_accessor_class_to_double_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_string(dumper, a, NULL); +} + +int grib_accessor_class_to_double_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} + +int grib_accessor_class_to_double_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_to_double_t* self = (grib_accessor_to_double_t*)a; + + int err = 0; + char buff[512] = {0,}; + size_t size = 512; + size_t length = string_length(a); + + if (*len < length + 1) { + grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values", + *len, a->name, a->length + 1); + *len = length + 1; + return GRIB_ARRAY_TOO_SMALL; + } + + err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size); + if (err) + return err; + if (length > size) { + err = GRIB_STRING_TOO_SMALL; + length = size; + } + + memcpy(val, buff + self->start, length); + + val[length] = 0; + *len = length; + return err; +} + +int grib_accessor_class_to_double_t::unpack_long(grib_accessor* a, long* v, size_t* len){ + grib_accessor_to_double_t* self = (grib_accessor_to_double_t*)a; + char val[1024] = {0,}; + size_t l = sizeof(val); + char* last = NULL; + int err = a->unpack_string(val, &l); + if (err) + return err; + + *v = strtol(val, &last, 10); + if (*last) { + err = GRIB_WRONG_CONVERSION; + } + *v /= self->scale; + + return err; +} + +int grib_accessor_class_to_double_t::unpack_double(grib_accessor* a, double* v, size_t* len){ + grib_accessor_to_double_t* self = (grib_accessor_to_double_t*)a; + char val[1024] = {0,}; + size_t l = sizeof(val); + char* last = NULL; + int err = a->unpack_string(val, &l); + if (err) + return err; + + *v = strtod(val, &last); + if (*last) { + err = GRIB_WRONG_CONVERSION; + } + *v /= self->scale; + + return err; +} + +long grib_accessor_class_to_double_t::next_offset(grib_accessor* a){ + return a->offset + a->length; +} diff --git a/src/accessor/grib_accessor_class_to_double.h b/src/accessor/grib_accessor_class_to_double.h new file mode 100644 index 000000000..c8755c90f --- /dev/null +++ b/src/accessor/grib_accessor_class_to_double.h @@ -0,0 +1,40 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_to_double_t : public grib_accessor_gen_t +{ +public: + /* Members defined in to_double */ + const char* key; + long start; + size_t length; + long scale; +}; + +class grib_accessor_class_to_double_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_to_double_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_to_double_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_to_integer.cc b/src/accessor/grib_accessor_class_to_integer.cc new file mode 100644 index 000000000..bc58f31c6 --- /dev/null +++ b/src/accessor/grib_accessor_class_to_integer.cc @@ -0,0 +1,132 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_to_integer.h" + +grib_accessor_class_to_integer_t _grib_accessor_class_to_integer{"to_integer"}; +grib_accessor_class* grib_accessor_class_to_integer = &_grib_accessor_class_to_integer; + + +void grib_accessor_class_to_integer_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + grib_accessor_to_integer_t* self = (grib_accessor_to_integer_t*)a; + + self->key = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 0); + self->start = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 1); + self->length = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 2); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +int grib_accessor_class_to_integer_t::value_count(grib_accessor* a, long* count){ + grib_accessor_to_integer_t* self = (grib_accessor_to_integer_t*)a; + size_t size = 0; + + int err = grib_get_size(grib_handle_of_accessor(a), self->key, &size); + *count = size; + + return err; +} + +size_t grib_accessor_class_to_integer_t::string_length(grib_accessor* a){ + grib_accessor_to_integer_t* self = (grib_accessor_to_integer_t*)a; + size_t size = 0; + + if (self->length) + return self->length; + + grib_get_string_length(grib_handle_of_accessor(a), self->key, &size); + return size; +} + +void grib_accessor_class_to_integer_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_long(dumper, a, NULL); +} + +int grib_accessor_class_to_integer_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} + +int grib_accessor_class_to_integer_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_to_integer_t* self = (grib_accessor_to_integer_t*)a; + + int err = 0; + char buff[512] = {0,}; + size_t size = 512; + + size_t length = string_length(a); + + if (*len < length + 1) { + const char* cclass_name = a->cclass->name; + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, length+1, *len); + *len = length + 1; + return GRIB_BUFFER_TOO_SMALL; + } + + err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size); + if (err) + return err; + if (length > size) { + /*err=GRIB_STRING_TOO_SMALL;*/ + length = size; + } + + memcpy(val, buff + self->start, length); + + val[length] = 0; + *len = length; + return GRIB_SUCCESS; +} + +int grib_accessor_class_to_integer_t::pack_string(grib_accessor* a, const char* val, size_t* len){ + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_to_integer_t::pack_long(grib_accessor* a, const long* v, size_t* len){ + grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as an integer", a->name); + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_to_integer_t::pack_double(grib_accessor* a, const double* v, size_t* len){ + grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as a double", a->name); + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_to_integer_t::unpack_long(grib_accessor* a, long* v, size_t* len){ + char val[1024] = {0,}; + size_t l = sizeof(val); + char* last = NULL; + int err = unpack_string(a, val, &l); + + if (err) + return err; + + *v = strtol(val, &last, 10); + /* if (*last) {err=GRIB_WRONG_CONVERSION;} */ + + return GRIB_SUCCESS; +} + +int grib_accessor_class_to_integer_t::unpack_double(grib_accessor* a, double* v, size_t* len){ + size_t l = 1; + long val = 0; + int err = unpack_long(a, &val, &l); + + *v = (double)val; + return err; +} + +long grib_accessor_class_to_integer_t::next_offset(grib_accessor* a){ + return a->offset + a->length; +} diff --git a/src/accessor/grib_accessor_class_to_integer.h b/src/accessor/grib_accessor_class_to_integer.h new file mode 100644 index 000000000..da8334e4f --- /dev/null +++ b/src/accessor/grib_accessor_class_to_integer.h @@ -0,0 +1,42 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_to_integer_t : public grib_accessor_gen_t +{ +public: + /* Members defined in to_integer */ + const char* key; + long start; + size_t length; +}; + +class grib_accessor_class_to_integer_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_to_integer_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_to_integer_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_to_string.cc b/src/accessor/grib_accessor_class_to_string.cc new file mode 100644 index 000000000..4f1150ffb --- /dev/null +++ b/src/accessor/grib_accessor_class_to_string.cc @@ -0,0 +1,120 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_to_string.h" + +grib_accessor_class_to_string_t _grib_accessor_class_to_string{"to_string"}; +grib_accessor_class* grib_accessor_class_to_string = &_grib_accessor_class_to_string; + + +void grib_accessor_class_to_string_t::init(grib_accessor* a, const long len, grib_arguments* arg){ + grib_accessor_class_gen_t::init(a, len, arg); + grib_accessor_to_string_t* self = (grib_accessor_to_string_t*)a; + + self->key = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 0); + self->start = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 1); + self->length = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 2); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->length = 0; +} + +int grib_accessor_class_to_string_t::value_count(grib_accessor* a, long* count){ + grib_accessor_to_string_t* self = (grib_accessor_to_string_t*)a; + size_t size = 0; + + int err = grib_get_size(grib_handle_of_accessor(a), self->key, &size); + *count = size; + + return err; +} + +size_t grib_accessor_class_to_string_t::string_length(grib_accessor* a){ + grib_accessor_to_string_t* self = (grib_accessor_to_string_t*)a; + + if (self->length) + return self->length; + + size_t size = 0; + grib_get_string_length(grib_handle_of_accessor(a), self->key, &size); + return size; +} + +void grib_accessor_class_to_string_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_string(dumper, a, NULL); +} + +int grib_accessor_class_to_string_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_STRING; +} + +int grib_accessor_class_to_string_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_to_string_t* self = (grib_accessor_to_string_t*)a; + + int err = 0; + char buff[512] = {0,}; + + size_t length = string_length(a); + + if (*len < length + 1) { + const char* cclass_name = a->cclass->name; + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, length+1, *len); + *len = length + 1; + return GRIB_BUFFER_TOO_SMALL; + } + + size_t size = sizeof(buff); + err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size); + if (err) + return err; + if (length > size) { + /*err=GRIB_STRING_TOO_SMALL;*/ + length = size; + } + + memcpy(val, buff + self->start, length); + + val[length] = 0; + *len = length; + return GRIB_SUCCESS; +} + +int grib_accessor_class_to_string_t::unpack_long(grib_accessor* a, long* v, size_t* len){ + char val[1024] = {0,}; + size_t l = sizeof(val); + char* last = NULL; + int err = unpack_string(a, val, &l); + + if (err) + return err; + + *v = strtol(val, &last, 10); + if (*last) { + err = GRIB_WRONG_CONVERSION; + } + + return err; +} + +int grib_accessor_class_to_string_t::unpack_double(grib_accessor* a, double* v, size_t* len){ + size_t l = 1; + long val = 0; + int err = unpack_long(a, &val, &l); + + *v = (double)val; + return err; +} + +long grib_accessor_class_to_string_t::next_offset(grib_accessor* a){ + return a->offset + a->length; +} diff --git a/src/accessor/grib_accessor_class_to_string.h b/src/accessor/grib_accessor_class_to_string.h new file mode 100644 index 000000000..ea6981276 --- /dev/null +++ b/src/accessor/grib_accessor_class_to_string.h @@ -0,0 +1,39 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_to_string_t : public grib_accessor_gen_t +{ +public: + /* Members defined in to_string */ + const char* key; + long start; + size_t length; +}; + +class grib_accessor_class_to_string_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_to_string_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_to_string_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_transient.cc b/src/accessor/grib_accessor_class_transient.cc new file mode 100644 index 000000000..0cda763d0 --- /dev/null +++ b/src/accessor/grib_accessor_class_transient.cc @@ -0,0 +1,20 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_transient.h" + +grib_accessor_class_transient_t _grib_accessor_class_transient{"transient"}; +grib_accessor_class* grib_accessor_class_transient = &_grib_accessor_class_transient; + + +void grib_accessor_class_transient_t::init(grib_accessor* a, const long l, grib_arguments* args) { + grib_accessor_class_variable_t::init(a, l, args); +} + diff --git a/src/accessor/grib_accessor_class_transient.h b/src/accessor/grib_accessor_class_transient.h new file mode 100644 index 000000000..e330ad686 --- /dev/null +++ b/src/accessor/grib_accessor_class_transient.h @@ -0,0 +1,25 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_variable.h" + +class grib_accessor_transient_t : public grib_accessor_variable_t { +public: +}; + +class grib_accessor_class_transient_t : public grib_accessor_class_variable_t { +public: + void init(grib_accessor* a, const long l, grib_arguments* args) override; + grib_accessor_class_transient_t(const char* name) : grib_accessor_class_variable_t(name) {}; + grib_accessor* create_empty_accessor() override { return new grib_accessor_transient_t{}; } +}; + diff --git a/src/accessor/grib_accessor_class_transient_darray.cc b/src/accessor/grib_accessor_class_transient_darray.cc new file mode 100644 index 000000000..d45ec3478 --- /dev/null +++ b/src/accessor/grib_accessor_class_transient_darray.cc @@ -0,0 +1,112 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_transient_darray.h" + +grib_accessor_class_transient_darray_t _grib_accessor_class_transient_darray{"transient_darray"}; +grib_accessor_class* grib_accessor_class_transient_darray = &_grib_accessor_class_transient_darray; + + +void grib_accessor_class_transient_darray_t::init(grib_accessor* a, const long length, grib_arguments* args){ + grib_accessor_class_gen_t::init(a, length, args); + grib_accessor_transient_darray_t* self = (grib_accessor_transient_darray_t*)a; + self->arr = NULL; + self->type = GRIB_TYPE_DOUBLE; + a->length = 0; +} + +void grib_accessor_class_transient_darray_t::dump(grib_accessor* a, grib_dumper* dumper){ + grib_dump_double(dumper, a, NULL); +} + +int grib_accessor_class_transient_darray_t::pack_double(grib_accessor* a, const double* val, size_t* len){ + grib_accessor_transient_darray_t* self = (grib_accessor_transient_darray_t*)a; + + if (self->arr) + grib_darray_delete(a->context, self->arr); + self->arr = grib_darray_new(a->context, *len, 10); + + for (size_t i = 0; i < *len; i++) + grib_darray_push(a->context, self->arr, val[i]); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_transient_darray_t::pack_long(grib_accessor* a, const long* val, size_t* len){ + grib_accessor_transient_darray_t* self = (grib_accessor_transient_darray_t*)a; + + if (self->arr) + grib_darray_delete(a->context, self->arr); + self->arr = grib_darray_new(a->context, *len, 10); + + for (size_t i = 0; i < *len; i++) + grib_darray_push(a->context, self->arr, (double)val[i]); + + return GRIB_SUCCESS; +} + +int grib_accessor_class_transient_darray_t::unpack_double(grib_accessor* a, double* val, size_t* len){ + grib_accessor_transient_darray_t* self = (grib_accessor_transient_darray_t*)a; + long count = 0; + + value_count(a, &count); + + if (*len < count) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s (setting %ld, required %ld) ", a->name, *len, count); + return GRIB_ARRAY_TOO_SMALL; + } + + *len = count; + for (size_t i = 0; i < *len; i++) + val[i] = self->arr->v[i]; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_transient_darray_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + grib_accessor_transient_darray_t* self = (grib_accessor_transient_darray_t*)a; + long count = 0; + + value_count(a, &count); + + if (*len < count) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s (setting %ld, required %ld) ", a->name, *len, count); + return GRIB_ARRAY_TOO_SMALL; + } + + *len = count; + for (size_t i = 0; i < *len; i++) + val[i] = (long)self->arr->v[i]; + + return GRIB_SUCCESS; +} + +void grib_accessor_class_transient_darray_t::destroy(grib_context* c, grib_accessor* a){ + grib_accessor_transient_darray_t* self = (grib_accessor_transient_darray_t*)a; + if (self->arr) + grib_darray_delete(a->context, self->arr); + grib_accessor_class_gen_t::destroy(c, a); +} + +int grib_accessor_class_transient_darray_t::value_count(grib_accessor* a, long* count){ + grib_accessor_transient_darray_t* self = (grib_accessor_transient_darray_t*)a; + if (self->arr) + *count = grib_darray_used_size(self->arr); + else + *count = 0; + + return 0; +} + +int grib_accessor_class_transient_darray_t::get_native_type(grib_accessor* a){ + const grib_accessor_transient_darray_t* self = (grib_accessor_transient_darray_t*)a; + return self->type; +} diff --git a/src/accessor/grib_accessor_class_transient_darray.h b/src/accessor/grib_accessor_class_transient_darray.h new file mode 100644 index 000000000..230dfa1a1 --- /dev/null +++ b/src/accessor/grib_accessor_class_transient_darray.h @@ -0,0 +1,38 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_transient_darray_t : public grib_accessor_gen_t +{ +public: + /* Members defined in transient_darray */ + grib_darray* arr; + int type; +}; + +class grib_accessor_class_transient_darray_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_transient_darray_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_transient_darray_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_trim.cc b/src/accessor/grib_accessor_class_trim.cc new file mode 100644 index 000000000..a7db4f3ff --- /dev/null +++ b/src/accessor/grib_accessor_class_trim.cc @@ -0,0 +1,76 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_trim.h" + +grib_accessor_class_trim_t _grib_accessor_class_trim{"trim"}; +grib_accessor_class* grib_accessor_class_trim = &_grib_accessor_class_trim; + + +void grib_accessor_class_trim_t::init(grib_accessor* a, const long l, grib_arguments* arg){ + grib_accessor_class_ascii_t::init(a, l, arg); + int n = 0; + grib_accessor_trim_t* self = (grib_accessor_trim_t*)a; + grib_handle* h = grib_handle_of_accessor(a); + + self->input = grib_arguments_get_name(h, arg, n++); + self->trim_left = grib_arguments_get_long(h, arg, n++); + self->trim_right= grib_arguments_get_long(h, arg, n++); + DEBUG_ASSERT(self->trim_left == 0 || self->trim_left == 1); + DEBUG_ASSERT(self->trim_right == 0 || self->trim_right == 1); +} + +int grib_accessor_class_trim_t::unpack_string(grib_accessor* a, char* val, size_t* len){ + grib_accessor_trim_t* self = (grib_accessor_trim_t*)a; + + int err = 0; + grib_handle* h = grib_handle_of_accessor(a); + char input[256] = {0,}; + size_t size = sizeof(input) / sizeof(*input); + char* pInput = input; + + err = grib_get_string(h, self->input, input, &size); + if (err) return err; + + string_lrtrim(&pInput, self->trim_left, self->trim_right); + snprintf(val, 1024, "%s", pInput); + size = strlen(val); + *len = size + 1; + return GRIB_SUCCESS; +} + +int grib_accessor_class_trim_t::pack_string(grib_accessor* a, const char* val, size_t* len){ + char input[256] = {0,}; + + size_t inputLen = 256; + char buf[256] = {0,}; + char* pBuf = NULL; + int err; + grib_handle* h = grib_handle_of_accessor(a); + grib_accessor_trim_t* self = (grib_accessor_trim_t*)a; + grib_accessor* inputAccesstor = grib_find_accessor(h, self->input); + if (!inputAccesstor) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor for %s not found", self->input); + return GRIB_NOT_FOUND; + } + + if ((err = grib_get_string(h, self->input, input, &inputLen)) != GRIB_SUCCESS) + return err; + + snprintf(buf, sizeof(buf), "%s", val); + pBuf = buf; + string_lrtrim(&pBuf, self->trim_left, self->trim_right); + + return inputAccesstor->pack_string(pBuf, len);} + +size_t grib_accessor_class_trim_t::string_length(grib_accessor* a){ + return 1024; +} diff --git a/src/accessor/grib_accessor_class_trim.h b/src/accessor/grib_accessor_class_trim.h new file mode 100644 index 000000000..d5c029a78 --- /dev/null +++ b/src/accessor/grib_accessor_class_trim.h @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_ascii.h" + +class grib_accessor_trim_t : public grib_accessor_ascii_t +{ +public: + /* Members defined in trim */ + const char* input; + int trim_left; + int trim_right; +}; + +class grib_accessor_class_trim_t : public grib_accessor_class_ascii_t +{ +public: + grib_accessor_class_trim_t(const char* name) : grib_accessor_class_ascii_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_trim_t{}; } + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_uint16.cc b/src/accessor/grib_accessor_class_uint16.cc new file mode 100644 index 000000000..1d9158ac0 --- /dev/null +++ b/src/accessor/grib_accessor_class_uint16.cc @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_uint16.h" + +grib_accessor_class_uint16_t _grib_accessor_class_uint16{"uint16"}; +grib_accessor_class* grib_accessor_class_uint16 = &_grib_accessor_class_uint16; + + +int grib_accessor_class_uint16_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + long value = 0; + /*long pos = a->offset;*/ + /*unsigned char* data = grib_handle_of_accessor(a)->buffer->data;*/ + + if (*len < 1) { + return GRIB_ARRAY_TOO_SMALL; + } + + *val = value; + *len = 1; + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_uint16_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_uint16.h b/src/accessor/grib_accessor_class_uint16.h new file mode 100644 index 000000000..05818ebbd --- /dev/null +++ b/src/accessor/grib_accessor_class_uint16.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_uint16_t : public grib_accessor_gen_t +{ +public: + /* Members defined in uint16 */ +}; + +class grib_accessor_class_uint16_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_uint16_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_uint16_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; +}; diff --git a/src/accessor/grib_accessor_class_uint32.cc b/src/accessor/grib_accessor_class_uint32.cc new file mode 100644 index 000000000..7518cb68c --- /dev/null +++ b/src/accessor/grib_accessor_class_uint32.cc @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_uint32.h" + +grib_accessor_class_uint32_t _grib_accessor_class_uint32{"uint32"}; +grib_accessor_class* grib_accessor_class_uint32 = &_grib_accessor_class_uint32; + + +int grib_accessor_class_uint32_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + long value = 0; + /* long pos = a->offset; */ + /* unsigned char* data = grib_handle_of_accessor(a)->buffer->data; */ + + if (*len < 1) { + return GRIB_ARRAY_TOO_SMALL; + } + + *val = value; + *len = 1; + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_uint32_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_uint32.h b/src/accessor/grib_accessor_class_uint32.h new file mode 100644 index 000000000..143dfc809 --- /dev/null +++ b/src/accessor/grib_accessor_class_uint32.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_uint32_t : public grib_accessor_gen_t +{ +public: + /* Members defined in uint32 */ +}; + +class grib_accessor_class_uint32_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_uint32_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_uint32_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; +}; diff --git a/src/accessor/grib_accessor_class_uint32_little_endian.cc b/src/accessor/grib_accessor_class_uint32_little_endian.cc new file mode 100644 index 000000000..b8733bd0a --- /dev/null +++ b/src/accessor/grib_accessor_class_uint32_little_endian.cc @@ -0,0 +1,34 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_uint32_little_endian.h" + +grib_accessor_class_uint32_little_endian_t _grib_accessor_class_uint32_little_endian{"uint32_little_endian"}; +grib_accessor_class* grib_accessor_class_uint32_little_endian = &_grib_accessor_class_uint32_little_endian; + + +int grib_accessor_class_uint32_little_endian_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + long value = 0; + /* long pos = a->offset; */ + /* unsigned char* data = grib_handle_of_accessor(a)->buffer->data; */ + + if (*len < 1) { + return GRIB_ARRAY_TOO_SMALL; + } + + *val = value; + *len = 1; + return GRIB_NOT_IMPLEMENTED; +} + +int grib_accessor_class_uint32_little_endian_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_uint32_little_endian.h b/src/accessor/grib_accessor_class_uint32_little_endian.h new file mode 100644 index 000000000..83e808bc5 --- /dev/null +++ b/src/accessor/grib_accessor_class_uint32_little_endian.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_uint32_little_endian_t : public grib_accessor_gen_t +{ +public: + /* Members defined in uint32_little_endian */ +}; + +class grib_accessor_class_uint32_little_endian_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_uint32_little_endian_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_uint32_little_endian_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; +}; diff --git a/src/accessor/grib_accessor_class_uint64.cc b/src/accessor/grib_accessor_class_uint64.cc new file mode 100644 index 000000000..4c79f7bb4 --- /dev/null +++ b/src/accessor/grib_accessor_class_uint64.cc @@ -0,0 +1,50 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_uint64.h" + +grib_accessor_class_uint64_t _grib_accessor_class_uint64{"uint64"}; +grib_accessor_class* grib_accessor_class_uint64 = &_grib_accessor_class_uint64; + + +int grib_accessor_class_uint64_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + long value = 0; + long pos = a->offset; + unsigned char* data = grib_handle_of_accessor(a)->buffer->data; + unsigned long long result = 0, tmp; + int i; + + if (*len < 1) { + return GRIB_ARRAY_TOO_SMALL; + } + + for (i = 0; i < 8; i++) { + result <<= 8; + result |= data[pos + i]; + } + + value = result; + tmp = value; + + /* Result does not fit in long */ + if (tmp != result) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Value for %s cannot be decoded as a 'long' (%llu)", a->name, result); + return GRIB_DECODING_ERROR; + } + + *val = value; + *len = 1; + return GRIB_SUCCESS; +} + +int grib_accessor_class_uint64_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_uint64.h b/src/accessor/grib_accessor_class_uint64.h new file mode 100644 index 000000000..d442b736d --- /dev/null +++ b/src/accessor/grib_accessor_class_uint64.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_uint64_t : public grib_accessor_gen_t +{ +public: + /* Members defined in uint64 */ +}; + +class grib_accessor_class_uint64_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_uint64_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_uint64_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; +}; diff --git a/src/accessor/grib_accessor_class_uint64_little_endian.cc b/src/accessor/grib_accessor_class_uint64_little_endian.cc new file mode 100644 index 000000000..81d0fed37 --- /dev/null +++ b/src/accessor/grib_accessor_class_uint64_little_endian.cc @@ -0,0 +1,50 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_uint64_little_endian.h" + +grib_accessor_class_uint64_little_endian_t _grib_accessor_class_uint64_little_endian{"uint64_little_endian"}; +grib_accessor_class* grib_accessor_class_uint64_little_endian = &_grib_accessor_class_uint64_little_endian; + + +int grib_accessor_class_uint64_little_endian_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + long value = 0; + long pos = a->offset; + unsigned char* data = grib_handle_of_accessor(a)->buffer->data; + unsigned long long result = 0, tmp; + int i; + + if (*len < 1) { + return GRIB_ARRAY_TOO_SMALL; + } + + for (i = 7; i >= 0; i--) { + result <<= 8; + result |= data[pos + i]; + } + + value = result; + tmp = value; + + /* Result does not fit in long */ + if (tmp != result) { + grib_context_log(a->context, GRIB_LOG_ERROR, "Value for %s cannot be decoded as a 'long' (%llu)", a->name, result); + return GRIB_DECODING_ERROR; + } + + *val = value; + *len = 1; + return GRIB_SUCCESS; +} + +int grib_accessor_class_uint64_little_endian_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_uint64_little_endian.h b/src/accessor/grib_accessor_class_uint64_little_endian.h new file mode 100644 index 000000000..9e8f4327e --- /dev/null +++ b/src/accessor/grib_accessor_class_uint64_little_endian.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_uint64_little_endian_t : public grib_accessor_gen_t +{ +public: + /* Members defined in uint64_little_endian */ +}; + +class grib_accessor_class_uint64_little_endian_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_uint64_little_endian_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_uint64_little_endian_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; +}; diff --git a/src/accessor/grib_accessor_class_uint8.cc b/src/accessor/grib_accessor_class_uint8.cc new file mode 100644 index 000000000..ce5d88f98 --- /dev/null +++ b/src/accessor/grib_accessor_class_uint8.cc @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_uint8.h" + +grib_accessor_class_uint8_t _grib_accessor_class_uint8{"uint8"}; +grib_accessor_class* grib_accessor_class_uint8 = &_grib_accessor_class_uint8; + + +int grib_accessor_class_uint8_t::unpack_long(grib_accessor* a, long* val, size_t* len){ + long value = 0; + long pos = a->offset; + unsigned char* data = grib_handle_of_accessor(a)->buffer->data; + + if (*len < 1) { + return GRIB_ARRAY_TOO_SMALL; + } + + value = data[pos]; + + *val = value; + *len = 1; + return GRIB_SUCCESS; +} + +int grib_accessor_class_uint8_t::get_native_type(grib_accessor* a){ + return GRIB_TYPE_LONG; +} diff --git a/src/accessor/grib_accessor_class_uint8.h b/src/accessor/grib_accessor_class_uint8.h new file mode 100644 index 000000000..8a58b27f3 --- /dev/null +++ b/src/accessor/grib_accessor_class_uint8.h @@ -0,0 +1,29 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_uint8_t : public grib_accessor_gen_t +{ +public: + /* Members defined in uint8 */ +}; + +class grib_accessor_class_uint8_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_uint8_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_uint8_t{}; } + int get_native_type(grib_accessor*) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; +}; diff --git a/src/accessor/grib_accessor_class_unexpanded_descriptors.cc b/src/accessor/grib_accessor_class_unexpanded_descriptors.cc new file mode 100644 index 000000000..5c9402360 --- /dev/null +++ b/src/accessor/grib_accessor_class_unexpanded_descriptors.cc @@ -0,0 +1,142 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_unexpanded_descriptors.h" + +grib_accessor_class_unexpanded_descriptors_t _grib_accessor_class_unexpanded_descriptors{ "unexpanded_descriptors" }; +grib_accessor_class* grib_accessor_class_unexpanded_descriptors = &_grib_accessor_class_unexpanded_descriptors; + + +void grib_accessor_class_unexpanded_descriptors_t::init(grib_accessor* a, const long len, grib_arguments* args) +{ + grib_accessor_class_long_t::init(a, len, args); + grib_accessor_unexpanded_descriptors_t* self = (grib_accessor_unexpanded_descriptors_t*)a; + + int n = 0; + grib_handle* hand = grib_handle_of_accessor(a); + self->unexpandedDescriptorsEncoded = grib_find_accessor(hand, grib_arguments_get_name(hand, args, n++)); + self->createNewData = grib_arguments_get_name(hand, args, n++); + a->length = 0; +} + +int grib_accessor_class_unexpanded_descriptors_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_unexpanded_descriptors_t* self = (grib_accessor_unexpanded_descriptors_t*)a; + int ret = 0; + long pos = 0; + long rlen = 0; + long f, x, y; + long* v = val; + long i; + grib_handle* hand = grib_handle_of_accessor(a); + + pos = accessor_raw_get_offset(self->unexpandedDescriptorsEncoded) * 8; + + ret = value_count(a, &rlen); + if (ret) + return ret; + + if (rlen == 0) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "No descriptors in section 3. Malformed message."); + return GRIB_MESSAGE_MALFORMED; + } + + if (*len < rlen) { + /* grib_context_log(a->context, GRIB_LOG_ERROR, */ + /* " wrong size (%ld) for %s it contains %d values ",*len, a->name , rlen); */ + *len = 0; + return GRIB_ARRAY_TOO_SMALL; + } + + for (i = 0; i < rlen; i++) { + f = grib_decode_unsigned_long(hand->buffer->data, &pos, 2); + x = grib_decode_unsigned_long(hand->buffer->data, &pos, 6); + y = grib_decode_unsigned_long(hand->buffer->data, &pos, 8); + *v++ = f * 100000 + x * 1000 + y; + } + *len = rlen; + return GRIB_SUCCESS; +} + +int grib_accessor_class_unexpanded_descriptors_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + grib_accessor_unexpanded_descriptors_t* self = (grib_accessor_unexpanded_descriptors_t*)a; + int ret = 0; + long pos = 0; + unsigned long f, x, y; + unsigned char* buf = NULL; + grib_accessor* expanded = NULL; + size_t buflen = *len * 2; + size_t i = 0, length = *len; + long createNewData = 1; + grib_handle* hand = grib_handle_of_accessor(a); + + grib_get_long(hand, self->createNewData, &createNewData); + + buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen); + + for (i = 0; i < length; i++) { + const long tmp = val[i] % 100000; + f = val[i] / 100000; + x = tmp / 1000; + y = tmp % 1000; + grib_encode_unsigned_longb(buf, f, &pos, 2); + grib_encode_unsigned_longb(buf, x, &pos, 6); + grib_encode_unsigned_longb(buf, y, &pos, 8); + } + + self->unexpandedDescriptorsEncoded->pack_bytes(buf, &buflen); + grib_context_free(hand->context, buf); + + if (createNewData == 0) + return ret; + + expanded = grib_find_accessor(hand, "expandedCodes"); + Assert(expanded != NULL); + ret = grib_accessor_class_expanded_descriptors_set_do_expand(expanded, 1); + if (ret != GRIB_SUCCESS) + return ret; + + ret = grib_set_long(hand, "unpack", 3); /* BUFR new data */ + if (ret != GRIB_SUCCESS) + return ret; + + ret = grib_set_long(hand, "unpack", 1); /* Unpack structure */ + + return ret; +} + +int grib_accessor_class_unexpanded_descriptors_t::value_count(grib_accessor* a, long* numberOfUnexpandedDescriptors) +{ + grib_accessor_unexpanded_descriptors_t* self = (grib_accessor_unexpanded_descriptors_t*)a; + long n = 0; + + self->unexpandedDescriptorsEncoded->value_count(&n); + *numberOfUnexpandedDescriptors = n / 2; + + return 0; +} + +long grib_accessor_class_unexpanded_descriptors_t::byte_offset(grib_accessor* a) +{ + return a->offset; +} + +void grib_accessor_class_unexpanded_descriptors_t::update_size(grib_accessor* a, size_t s) +{ + a->length = s; +} + +long grib_accessor_class_unexpanded_descriptors_t::next_offset(grib_accessor* a) +{ + return a->byte_offset() + a->length; +} diff --git a/src/accessor/grib_accessor_class_unexpanded_descriptors.h b/src/accessor/grib_accessor_class_unexpanded_descriptors.h new file mode 100644 index 000000000..f9a016c1e --- /dev/null +++ b/src/accessor/grib_accessor_class_unexpanded_descriptors.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_unexpanded_descriptors_t : public grib_accessor_long_t +{ +public: + /* Members defined in unexpanded_descriptors */ + grib_accessor* unexpandedDescriptorsEncoded; + const char* createNewData; +}; + +class grib_accessor_class_unexpanded_descriptors_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_unexpanded_descriptors_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_unexpanded_descriptors_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + long byte_offset(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; +}; diff --git a/src/accessor/grib_accessor_class_unpack_bufr_values.cc b/src/accessor/grib_accessor_class_unpack_bufr_values.cc new file mode 100644 index 000000000..3497bbbe2 --- /dev/null +++ b/src/accessor/grib_accessor_class_unpack_bufr_values.cc @@ -0,0 +1,113 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_unpack_bufr_values.h" +#include "grib_accessor_class_bufr_data_array.h" + +grib_accessor_class_unpack_bufr_values_t _grib_accessor_class_unpack_bufr_values{ "unpack_bufr_values" }; +grib_accessor_class* grib_accessor_class_unpack_bufr_values = &_grib_accessor_class_unpack_bufr_values; + +void grib_accessor_class_unpack_bufr_values_t::init(grib_accessor* a, const long len, grib_arguments* params) +{ + grib_accessor_class_gen_t::init(a, len, params); + char* key; + grib_accessor_unpack_bufr_values_t* self = (grib_accessor_unpack_bufr_values_t*)a; + key = (char*)grib_arguments_get_name(grib_handle_of_accessor(a), params, 0); + self->data_accessor = grib_find_accessor(grib_handle_of_accessor(a), key); + + a->length = 0; +} + +void grib_accessor_class_unpack_bufr_values_t::dump(grib_accessor* a, grib_dumper* dumper) +{ +} + +int grib_accessor_class_unpack_bufr_values_t::unpack_string_array(grib_accessor* a, char** buffer, size_t* len) +{ + grib_accessor_unpack_bufr_values_t* self = (grib_accessor_unpack_bufr_values_t*)a; + grib_accessor* data = (grib_accessor*)self->data_accessor; + + return data->unpack_double(0, 0); +} + +int grib_accessor_class_unpack_bufr_values_t::unpack_string(grib_accessor* a, char* buffer, size_t* len) +{ + grib_accessor_unpack_bufr_values_t* self = (grib_accessor_unpack_bufr_values_t*)a; + grib_accessor* data = (grib_accessor*)self->data_accessor; + strcpy(buffer, "0"); + *len = 1; + + return data->unpack_double(0, 0); +} + +int grib_accessor_class_unpack_bufr_values_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_unpack_bufr_values_t* self = (grib_accessor_unpack_bufr_values_t*)a; + grib_accessor* data = (grib_accessor*)self->data_accessor; + + return data->unpack_double(0, 0); +} + +int grib_accessor_class_unpack_bufr_values_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + grib_accessor_unpack_bufr_values_t* self = (grib_accessor_unpack_bufr_values_t*)a; + grib_accessor* data = (grib_accessor*)self->data_accessor; + + return data->unpack_double(0, 0); +} + +int grib_accessor_class_unpack_bufr_values_t::value_count(grib_accessor* a, long* count) +{ + *count = 1; + return 0; +} + +void grib_accessor_class_unpack_bufr_values_t::destroy(grib_context* context, grib_accessor* a) +{ + grib_accessor_class_gen_t::destroy(context, a); +} + +int grib_accessor_class_unpack_bufr_values_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_LONG; +} + +// static const char* mode_to_str(int p) +// { +// if (p==CODES_BUFR_UNPACK_STRUCTURE) return "CODES_BUFR_UNPACK_STRUCTURE"; +// if (p==CODES_BUFR_UNPACK_FLAT) return "CODES_BUFR_UNPACK_FLAT"; +// if (p==CODES_BUFR_NEW_DATA) return "CODES_BUFR_NEW_DATA"; +// return "unknown proc flag"; +// } + +int grib_accessor_class_unpack_bufr_values_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + int unpackMode = CODES_BUFR_UNPACK_STRUCTURE; + grib_accessor_unpack_bufr_values_t* self = (grib_accessor_unpack_bufr_values_t*)a; + grib_accessor* data = (grib_accessor*)self->data_accessor; + + if (*val == 2) + unpackMode = CODES_BUFR_UNPACK_FLAT; + if (*val == 3) + unpackMode = CODES_BUFR_NEW_DATA; + + accessor_bufr_data_array_set_unpackMode(data, unpackMode); + + return data->unpack_double(0, 0); +} + +int grib_accessor_class_unpack_bufr_values_t::pack_double(grib_accessor* a, const double* val, size_t* len) +{ + grib_accessor_unpack_bufr_values_t* self = (grib_accessor_unpack_bufr_values_t*)a; + grib_accessor* data = (grib_accessor*)self->data_accessor; + + return data->unpack_double(0, 0); +} diff --git a/src/accessor/grib_accessor_class_unpack_bufr_values.h b/src/accessor/grib_accessor_class_unpack_bufr_values.h new file mode 100644 index 000000000..46dd91ec5 --- /dev/null +++ b/src/accessor/grib_accessor_class_unpack_bufr_values.h @@ -0,0 +1,39 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_unpack_bufr_values_t : public grib_accessor_gen_t +{ +public: + /* Members defined in unpack_bufr_values */ + grib_accessor* data_accessor; +}; + +class grib_accessor_class_unpack_bufr_values_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_unpack_bufr_values_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_unpack_bufr_values_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + int unpack_string_array(grib_accessor*, char**, size_t* len) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/grib_accessor_class_unsigned.cc b/src/accessor/grib_accessor_class_unsigned.cc similarity index 50% rename from src/grib_accessor_class_unsigned.cc rename to src/accessor/grib_accessor_class_unsigned.cc index f1202b0d0..8093e3a6a 100644 --- a/src/grib_accessor_class_unsigned.cc +++ b/src/accessor/grib_accessor_class_unsigned.cc @@ -8,119 +8,19 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init;dump;is_missing - IMPLEMENTS = next_offset - IMPLEMENTS = byte_count - IMPLEMENTS = value_count - IMPLEMENTS = byte_offset - IMPLEMENTS = update_size; destroy - MEMBERS = long nbytes - MEMBERS = grib_arguments* arg - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int is_missing(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); - -typedef struct grib_accessor_unsigned -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; -} grib_accessor_unsigned; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_unsigned = { - &grib_accessor_class_long, /* super */ - "unsigned", /* name */ - sizeof(grib_accessor_unsigned), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - &is_missing, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; +#include "grib_accessor_class_unsigned.h" +grib_accessor_class_unsigned_t _grib_accessor_class_unsigned("unsigned"); grib_accessor_class* grib_accessor_class_unsigned = &_grib_accessor_class_unsigned; -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long len, grib_arguments* arg) +void grib_accessor_class_unsigned_t::init(grib_accessor* a, const long len, grib_arguments* arg) { - grib_accessor_unsigned* self = (grib_accessor_unsigned*)a; - self->arg = NULL; - self->arg = arg; - self->nbytes = len; + grib_accessor_class_long_t::init(a, len, arg); + grib_accessor_unsigned_t* self = (grib_accessor_unsigned_t*)a; + self->arg = arg; + self->nbytes = len; if (a->flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { a->length = 0; @@ -131,17 +31,17 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg) } else { long count = 0; - grib_value_count(a, &count); + a->value_count(&count); a->length = len * count; a->vvalue = NULL; } } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_unsigned_t::dump(grib_accessor* a, grib_dumper* dumper) { long rlen = 0; - grib_value_count(a, &rlen); + a->value_count(&rlen); if (rlen == 1) grib_dump_long(dumper, a, NULL); else @@ -158,25 +58,26 @@ static const unsigned long ones[] = { /* See GRIB-490 */ static const unsigned long all_ones = -1; -static int value_is_missing(long val) + +int value_is_missing(long val) { return (val == GRIB_MISSING_LONG || val == all_ones); } int pack_long_unsigned_helper(grib_accessor* a, const long* val, size_t* len, int check) { - grib_accessor_unsigned* self = (grib_accessor_unsigned*)a; - int ret = 0; - long off = 0; - long rlen = 0; - int err = 0; + grib_accessor_unsigned_t* self = (grib_accessor_unsigned_t*)a; + int ret = 0; + long off = 0; + long rlen = 0; + int err = 0; size_t buflen = 0; unsigned char* buf = NULL; unsigned long i = 0; unsigned long missing = 0; - err = grib_value_count(a, &rlen); + err = a->value_count(&rlen); if (err) return err; @@ -213,7 +114,7 @@ int pack_long_unsigned_helper(grib_accessor* a, const long* val, size_t* len, in if (check) { if (val[0] < 0) { grib_context_log(a->context, GRIB_LOG_ERROR, - "Key \"%s\": Trying to encode a negative value of %ld for key of type unsigned", a->name, val[0]); + "Key \"%s\": Trying to encode a negative value of %ld for key of type unsigned", a->name, val[0]); return GRIB_ENCODING_ERROR; } /* See GRIB-23 and GRIB-262 */ @@ -223,8 +124,8 @@ int pack_long_unsigned_helper(grib_accessor* a, const long* val, size_t* len, in unsigned long maxval = (1UL << nbits) - 1; if (maxval > 0 && v > maxval) { /* See ECC-1002 */ grib_context_log(a->context, GRIB_LOG_ERROR, - "Key \"%s\": Trying to encode value of %ld but the maximum allowable value is %lu (number of bits=%ld)", - a->name, v, maxval, nbits); + "Key \"%s\": Trying to encode value of %ld but the maximum allowable value is %lu (number of bits=%ld)", + a->name, v, maxval, nbits); return GRIB_ENCODING_ERROR; } } @@ -260,18 +161,18 @@ int pack_long_unsigned_helper(grib_accessor* a, const long* val, size_t* len, in return ret; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_unsigned_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - grib_accessor_unsigned* self = (grib_accessor_unsigned*)a; - long rlen = 0; - unsigned long i = 0; - unsigned long missing = 0; - long count = 0; - int err = 0; - long pos = a->offset * 8; - grib_handle* hand = grib_handle_of_accessor(a); + grib_accessor_unsigned_t* self = (grib_accessor_unsigned_t*)a; + long rlen = 0; + unsigned long i = 0; + unsigned long missing = 0; + long count = 0; + int err = 0; + long pos = a->offset * 8; + grib_handle* hand = grib_handle_of_accessor(a); - err = grib_value_count(a, &count); + err = a->value_count(&count); if (err) return err; rlen = count; @@ -304,20 +205,20 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_unsigned_t::pack_long(grib_accessor* a, const long* val, size_t* len) { /* See GRIB-262 as example of why we do the checks */ return pack_long_unsigned_helper(a, val, len, /*check=*/1); } -static long byte_count(grib_accessor* a) +long grib_accessor_class_unsigned_t::byte_count(grib_accessor* a) { return a->length; } -static int value_count(grib_accessor* a, long* len) +int grib_accessor_class_unsigned_t::value_count(grib_accessor* a, long* len) { - grib_accessor_unsigned* self = (grib_accessor_unsigned*)a; + grib_accessor_unsigned_t* self = (grib_accessor_unsigned_t*)a; if (!self->arg) { *len = 1; return 0; @@ -325,22 +226,22 @@ static int value_count(grib_accessor* a, long* len) return grib_get_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), len); } -static long byte_offset(grib_accessor* a) +long grib_accessor_class_unsigned_t::byte_offset(grib_accessor* a) { return a->offset; } -static void update_size(grib_accessor* a, size_t s) +void grib_accessor_class_unsigned_t::update_size(grib_accessor* a, size_t s) { a->length = s; } -static long next_offset(grib_accessor* a) +long grib_accessor_class_unsigned_t::next_offset(grib_accessor* a) { - return grib_byte_offset(a) + grib_byte_count(a); + return a->byte_offset() + a->byte_count(); } -static int is_missing(grib_accessor* a) +int grib_accessor_class_unsigned_t::is_missing(grib_accessor* a) { int i = 0; unsigned char ff = 0xff; @@ -361,10 +262,12 @@ static int is_missing(grib_accessor* a) return 1; } -static void destroy(grib_context* context, grib_accessor* a) +void grib_accessor_class_unsigned_t::destroy(grib_context* context, grib_accessor* a) { if (a->vvalue != NULL) grib_context_free(context, a->vvalue); a->vvalue = NULL; + + grib_accessor_class_long_t::destroy(context, a); } diff --git a/src/accessor/grib_accessor_class_unsigned.h b/src/accessor/grib_accessor_class_unsigned.h new file mode 100644 index 000000000..50f3cfb16 --- /dev/null +++ b/src/accessor/grib_accessor_class_unsigned.h @@ -0,0 +1,39 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_unsigned_t : public grib_accessor_long_t +{ +public: + long nbytes; + grib_arguments* arg; +}; + + +class grib_accessor_class_unsigned_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_unsigned_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_unsigned_t{}; } + void init(grib_accessor* a, const long len, grib_arguments* arg) override; + void dump(grib_accessor* a, grib_dumper* dumper) override; + int unpack_long(grib_accessor* a, long* val, size_t* len) override; + int pack_long(grib_accessor* a, const long* val, size_t* len) override; + long byte_count(grib_accessor* a) override; + int value_count(grib_accessor* a, long* len) override; + long byte_offset(grib_accessor* a) override; + void update_size(grib_accessor* a, size_t s) override; + long next_offset(grib_accessor* a) override; + int is_missing(grib_accessor* a) override; + void destroy(grib_context* context, grib_accessor* a) override; +}; diff --git a/src/accessor/grib_accessor_class_unsigned_bits.cc b/src/accessor/grib_accessor_class_unsigned_bits.cc new file mode 100644 index 000000000..44873938a --- /dev/null +++ b/src/accessor/grib_accessor_class_unsigned_bits.cc @@ -0,0 +1,167 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_unsigned_bits.h" + +grib_accessor_class_unsigned_bits_t _grib_accessor_class_unsigned_bits{ "unsigned_bits" }; +grib_accessor_class* grib_accessor_class_unsigned_bits = &_grib_accessor_class_unsigned_bits; + + +static long compute_byte_count(grib_accessor* a) +{ + grib_accessor_unsigned_bits_t* self = (grib_accessor_unsigned_bits_t*)a; + long numberOfBits; + long numberOfElements; + int ret = 0; + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s unable to get %s to compute size", a->name, self->numberOfBits); + return 0; + } + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, &numberOfElements); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s unable to get %s to compute size", a->name, self->numberOfElements); + return 0; + } + + return (numberOfBits * numberOfElements + 7) / 8; +} + + +void grib_accessor_class_unsigned_bits_t::init(grib_accessor* a, const long len, grib_arguments* args) +{ + grib_accessor_class_long_t::init(a, len, args); + grib_accessor_unsigned_bits_t* self = (grib_accessor_unsigned_bits_t*)a; + int n = 0; + self->numberOfBits = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + self->numberOfElements = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); + a->length = compute_byte_count(a); +} + +int grib_accessor_class_unsigned_bits_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_unsigned_bits_t* self = (grib_accessor_unsigned_bits_t*)a; + int ret = 0; + long pos = a->offset * 8; + long rlen = 0; + long numberOfBits = 0; + + ret = value_count(a, &rlen); + if (ret) + return ret; + + if (*len < rlen) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Wrong size (%ld) for %s, it contains %ld values", *len, a->name, rlen); + *len = rlen; + return GRIB_ARRAY_TOO_SMALL; + } + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); + if (ret) + return ret; + if (numberOfBits == 0) { + int i; + for (i = 0; i < rlen; i++) + val[i] = 0; + return GRIB_SUCCESS; + } + + grib_decode_long_array(grib_handle_of_accessor(a)->buffer->data, &pos, numberOfBits, rlen, val); + + *len = rlen; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_unsigned_bits_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + grib_accessor_unsigned_bits_t* self = (grib_accessor_unsigned_bits_t*)a; + int ret = 0; + long off = 0; + long numberOfBits = 0; + size_t buflen = 0; + unsigned char* buf = NULL; + unsigned long i = 0; + long rlen = 0; + ret = value_count(a, &rlen); + if (ret) return ret; + + /* + if(*len < rlen) + { + grib_context_log(a->context, GRIB_LOG_ERROR, + "Wrong size for %s it contains %d values ", a->name , rlen ); + return GRIB_ARRAY_TOO_SMALL; + } + */ + if (*len != rlen) + ret = grib_set_long(grib_handle_of_accessor(a), self->numberOfElements, *len); + if (ret) return ret; + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); + if (ret) return ret; + if (numberOfBits == 0) { + grib_buffer_replace(a, NULL, 0, 1, 1); + return GRIB_SUCCESS; + } + + buflen = compute_byte_count(a); + buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen + sizeof(long)); + + for (i = 0; i < *len; i++) + grib_encode_unsigned_longb(buf, val[i], &off, numberOfBits); + + grib_buffer_replace(a, buf, buflen, 1, 1); + + grib_context_free(a->context, buf); + + return ret; +} + +long grib_accessor_class_unsigned_bits_t::byte_count(grib_accessor* a) +{ + return a->length; +} + +int grib_accessor_class_unsigned_bits_t::value_count(grib_accessor* a, long* numberOfElements) +{ + grib_accessor_unsigned_bits_t* self = (grib_accessor_unsigned_bits_t*)a; + int ret; + *numberOfElements = 0; + + ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, numberOfElements); + if (ret) { + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s unable to get %s to compute size", a->name, self->numberOfElements); + } + + return ret; +} + +long grib_accessor_class_unsigned_bits_t::byte_offset(grib_accessor* a) +{ + return a->offset; +} + +void grib_accessor_class_unsigned_bits_t::update_size(grib_accessor* a, size_t s) +{ + a->length = s; +} + +long grib_accessor_class_unsigned_bits_t::next_offset(grib_accessor* a) +{ + return a->byte_offset() + a->length; +} diff --git a/src/accessor/grib_accessor_class_unsigned_bits.h b/src/accessor/grib_accessor_class_unsigned_bits.h new file mode 100644 index 000000000..52528ab83 --- /dev/null +++ b/src/accessor/grib_accessor_class_unsigned_bits.h @@ -0,0 +1,37 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_unsigned_bits_t : public grib_accessor_long_t +{ +public: + /* Members defined in unsigned_bits */ + const char* numberOfBits; + const char* numberOfElements; +}; + +class grib_accessor_class_unsigned_bits_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_unsigned_bits_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_unsigned_bits_t{}; } + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + long next_offset(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; +}; diff --git a/src/accessor/grib_accessor_class_validity_date.cc b/src/accessor/grib_accessor_class_validity_date.cc new file mode 100644 index 000000000..331c4ec82 --- /dev/null +++ b/src/accessor/grib_accessor_class_validity_date.cc @@ -0,0 +1,98 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_validity_date.h" +#include "shared_functions.h" + +grib_accessor_class_validity_date_t _grib_accessor_class_validity_date{ "validity_date" }; +grib_accessor_class* grib_accessor_class_validity_date = &_grib_accessor_class_validity_date; + +void grib_accessor_class_validity_date_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_validity_date_t* self = (grib_accessor_validity_date_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int n = 0; + + self->date = grib_arguments_get_name(hand, c, n++); + self->time = grib_arguments_get_name(hand, c, n++); + self->step = grib_arguments_get_name(hand, c, n++); + self->stepUnits = grib_arguments_get_name(hand, c, n++); + self->year = grib_arguments_get_name(hand, c, n++); + self->month = grib_arguments_get_name(hand, c, n++); + self->day = grib_arguments_get_name(hand, c, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_validity_date_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_validity_date_t* self = (grib_accessor_validity_date_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int ret = 0; + long date = 0; + long time = 0; + long step = 0; + long stepUnits = 0; + long hours = 0, minutes = 0, step_mins = 0, tmp, tmp_hrs; + + if (self->year) { + long year, month, day; + if ((ret = grib_get_long_internal(hand, self->year, &year)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(hand, self->month, &month)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(hand, self->day, &day)) != GRIB_SUCCESS) + return ret; + *val = year * 10000 + month * 100 + day; + return GRIB_SUCCESS; + } + if ((ret = grib_get_long_internal(hand, self->date, &date)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(hand, self->time, &time)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long(hand, self->step, &step)) != GRIB_SUCCESS) { + if ((ret = grib_get_long_internal(hand, "endStep", &step)) != GRIB_SUCCESS) { + return ret; /* See ECC-817 */ + } + } + + if (self->stepUnits) { + if ((ret = grib_get_long_internal(hand, self->stepUnits, &stepUnits)) != GRIB_SUCCESS) + return ret; + step_mins = convert_to_minutes(step, stepUnits); + } + + minutes = time % 100; + hours = time / 100; + tmp = minutes + step_mins; /* add the step to our minutes */ + tmp_hrs = tmp / 60; /* how many hours and mins is that? */ + hours += tmp_hrs; /* increment hours */ + + date = grib_date_to_julian(date); + /* does the new 'hours' exceed 24? if so increment julian */ + while (hours >= 24) { + date++; + hours -= 24; + } + /* GRIB-29: Negative forecast time */ + while (hours < 0) { + date--; + hours += 24; + } + + if (*len < 1) + return GRIB_ARRAY_TOO_SMALL; + + *val = grib_julian_to_date(date); + + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_validity_date.h b/src/accessor/grib_accessor_class_validity_date.h new file mode 100644 index 000000000..ca87b3282 --- /dev/null +++ b/src/accessor/grib_accessor_class_validity_date.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_validity_date_t : public grib_accessor_long_t +{ +public: + /* Members defined in validity_date */ + const char* date; + const char* time; + const char* step; + const char* stepUnits; + const char* year; + const char* month; + const char* day; +}; + +class grib_accessor_class_validity_date_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_validity_date_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_validity_date_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_validity_time.cc b/src/accessor/grib_accessor_class_validity_time.cc new file mode 100644 index 000000000..350a19e92 --- /dev/null +++ b/src/accessor/grib_accessor_class_validity_time.cc @@ -0,0 +1,119 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_validity_time.h" +#include "shared_functions.h" + +grib_accessor_class_validity_time_t _grib_accessor_class_validity_time{ "validity_time" }; +grib_accessor_class* grib_accessor_class_validity_time = &_grib_accessor_class_validity_time; + + +void grib_accessor_class_validity_time_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_long_t::init(a, l, c); + grib_accessor_validity_time_t* self = (grib_accessor_validity_time_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int n = 0; + + self->date = grib_arguments_get_name(hand, c, n++); + self->time = grib_arguments_get_name(hand, c, n++); + self->step = grib_arguments_get_name(hand, c, n++); + self->stepUnits = grib_arguments_get_name(hand, c, n++); + self->hours = grib_arguments_get_name(hand, c, n++); + self->minutes = grib_arguments_get_name(hand, c, n++); + + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +int grib_accessor_class_validity_time_t::unpack_long(grib_accessor* a, long* val, size_t* len) +{ + grib_accessor_validity_time_t* self = (grib_accessor_validity_time_t*)a; + grib_handle* hand = grib_handle_of_accessor(a); + int ret = 0; + long date = 0; + long time = 0; + long step = 0; + long stepUnits = 0; + long hours = 0, minutes = 0, step_mins = 0, tmp, tmp_hrs, tmp_mins; + + if (self->hours) { + if ((ret = grib_get_long_internal(hand, self->hours, &hours)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(hand, self->minutes, &minutes)) != GRIB_SUCCESS) + return ret; + *val = hours * 100 + minutes; + return GRIB_SUCCESS; + } + if ((ret = grib_get_long_internal(hand, self->date, &date)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long_internal(hand, self->time, &time)) != GRIB_SUCCESS) + return ret; + if ((ret = grib_get_long(hand, self->step, &step)) != GRIB_SUCCESS) { + if ((ret = grib_get_long_internal(hand, "endStep", &step)) != GRIB_SUCCESS) { + return ret; /* See ECC-817 */ + } + } + + /* Seconds will always be zero. So convert to minutes */ + if (self->stepUnits) { + if ((ret = grib_get_long_internal(hand, self->stepUnits, &stepUnits)) != GRIB_SUCCESS) + return ret; + step_mins = convert_to_minutes(step, stepUnits); + } + + minutes = time % 100; + hours = time / 100; + tmp = minutes + step_mins; /* add the step to our minutes */ + tmp_hrs = tmp / 60; /* how many hours and mins is that? */ + tmp_mins = tmp % 60; + hours += tmp_hrs; /* increment hours */ + if (hours > 0) { + hours = hours % 24; /* wrap round if >= 24 */ + } + else { + /* GRIB-29: Negative forecast time */ + while (hours < 0) { + hours += 24; + } + } + time = hours * 100 + tmp_mins; + + if (*len < 1) + return GRIB_ARRAY_TOO_SMALL; + + *val = time; + + return GRIB_SUCCESS; +} + +int grib_accessor_class_validity_time_t::unpack_string(grib_accessor* a, char* val, size_t* len) +{ + int err = 0; + long v = 0; + size_t lsize = 1, lmin = 5; + + err = unpack_long(a, &v, &lsize); + if (err) return err; + + if (*len < lmin) { + const char* cclass_name = a->cclass->name; + grib_context_log(a->context, GRIB_LOG_ERROR, + "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", + cclass_name, a->name, lmin, *len); + *len = lmin; + return GRIB_BUFFER_TOO_SMALL; + } + + snprintf(val, 64, "%04ld", v); + + len[0] = lmin; + return GRIB_SUCCESS; +} diff --git a/src/accessor/grib_accessor_class_validity_time.h b/src/accessor/grib_accessor_class_validity_time.h new file mode 100644 index 000000000..023c3e30a --- /dev/null +++ b/src/accessor/grib_accessor_class_validity_time.h @@ -0,0 +1,36 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_long.h" + +class grib_accessor_validity_time_t : public grib_accessor_long_t +{ +public: + /* Members defined in validity_time */ + const char* date; + const char* time; + const char* step; + const char* stepUnits; + const char* hours; + const char* minutes; +}; + +class grib_accessor_class_validity_time_t : public grib_accessor_class_long_t +{ +public: + grib_accessor_class_validity_time_t(const char* name) : grib_accessor_class_long_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_validity_time_t{}; } + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_values.cc b/src/accessor/grib_accessor_class_values.cc new file mode 100644 index 000000000..cd2107559 --- /dev/null +++ b/src/accessor/grib_accessor_class_values.cc @@ -0,0 +1,149 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_values.h" + +grib_accessor_class_values_t _grib_accessor_class_values{"values"}; +grib_accessor_class* grib_accessor_class_values = &_grib_accessor_class_values; + +long init_length(grib_accessor* a) +{ + grib_accessor_values_t* self = (grib_accessor_values_t*)a; + int ret = 0; + + long seclen = 0; + long offsetsection = 0; + long offsetdata = 0; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->seclen, &seclen))) + return ret; + + if (seclen == 0) { + /* printf("init_length seclen=0\n"); */ + return 0; + } + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetsection, &offsetsection))) + return ret; + + if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetdata, &offsetdata))) + return ret; + + /* When reparsing */ + if (offsetdata < offsetsection) { + /* printf("init_length offsetdata < offsetsection=0\n"); */ + Assert(grib_handle_of_accessor(a)->loader); + return 0; + } + + return seclen - (offsetdata - offsetsection); +} + +void grib_accessor_class_values_t::init(grib_accessor* a, const long v, grib_arguments* params) +{ + grib_accessor_class_gen_t::init(a, v, params); + grib_accessor_values_t* self = (grib_accessor_values_t*)a; + self->carg = 0; + + self->seclen = grib_arguments_get_name(grib_handle_of_accessor(a), params, self->carg++); + self->offsetdata = grib_arguments_get_name(grib_handle_of_accessor(a), params, self->carg++); + self->offsetsection = grib_arguments_get_name(grib_handle_of_accessor(a), params, self->carg++); + self->dirty = 1; + + a->length = init_length(a); + /* Assert(a->length>=0); */ +} + +int grib_accessor_class_values_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_DOUBLE; +} + +void grib_accessor_class_values_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + grib_dump_values(dumper, a); +} + +long grib_accessor_class_values_t::byte_count(grib_accessor* a) +{ + grib_context_log(a->context, GRIB_LOG_DEBUG, "byte_count of %s = %ld", a->name, a->length); + return a->length; +} + +long grib_accessor_class_values_t::byte_offset(grib_accessor* a) +{ + return a->offset; +} + +long grib_accessor_class_values_t::next_offset(grib_accessor* a) +{ + return a->offset + a->length; +} + +void grib_accessor_class_values_t::update_size(grib_accessor* a, size_t s) +{ + grib_context_log(a->context, GRIB_LOG_DEBUG, "updating size of %s old %ld new %ld", a->name, a->length, s); + a->length = s; + Assert(a->length >= 0); +} + +int grib_accessor_class_values_t::compare(grib_accessor* a, grib_accessor* b) +{ + int retval = 0; + double* aval = 0; + double* bval = 0; + + size_t alen = 0; + size_t blen = 0; + int err = 0; + long count = 0; + + err = a->value_count(&count); if (err) + return err; + alen = count; + + err = b->value_count(&count); if (err) + return err; + blen = count; + + if (alen != blen) + return GRIB_COUNT_MISMATCH; + + aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); + bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); + + a->unpack_double(aval, &alen); b->unpack_double(bval, &blen); + retval = GRIB_SUCCESS; + for (size_t i=0; icontext, aval); + grib_context_free(b->context, bval); + + return retval; +} + +int grib_accessor_class_values_t::pack_long(grib_accessor* a, const long* val, size_t* len) +{ + grib_accessor_values_t* self = (grib_accessor_values_t*)a; + double* dval = (double*)grib_context_malloc(a->context, *len * sizeof(double)); + + for (size_t i = 0; i < *len; i++) + dval[i] = (double)val[i]; + + int ret = a->pack_double(dval, len); + grib_context_free(a->context, dval); + + self->dirty = 1; + + return ret; +} diff --git a/src/accessor/grib_accessor_class_values.h b/src/accessor/grib_accessor_class_values.h new file mode 100644 index 000000000..5de50f2bd --- /dev/null +++ b/src/accessor/grib_accessor_class_values.h @@ -0,0 +1,39 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_values_t : public grib_accessor_gen_t +{ +public: + int carg; + const char* seclen; + const char* offsetdata; + const char* offsetsection; + int dirty; +}; + +class grib_accessor_class_values_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_values_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_values_t{}; } + int get_native_type(grib_accessor*) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + long byte_count(grib_accessor*) override; + long byte_offset(grib_accessor*) override; + long next_offset(grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + void update_size(grib_accessor*, size_t) override; + int compare(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/grib_accessor_class_variable.cc b/src/accessor/grib_accessor_class_variable.cc similarity index 52% rename from src/grib_accessor_class_variable.cc rename to src/accessor/grib_accessor_class_variable.cc index 8c5bbe7b0..b87798663 100644 --- a/src/grib_accessor_class_variable.cc +++ b/src/accessor/grib_accessor_class_variable.cc @@ -8,124 +8,13 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api_internal.h" +#include "grib_accessor_class_variable.h" #include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = unpack_float; pack_float - IMPLEMENTS = unpack_string;pack_string;string_length - IMPLEMENTS = unpack_long;pack_long;destroy;byte_count - IMPLEMENTS = init;dump;value_count;get_native_type - IMPLEMENTS = compare; make_clone - MEMBERS=double dval - MEMBERS=float fval - MEMBERS=char* cval - MEMBERS=char* cname - MEMBERS=int type - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_float(grib_accessor*, const float* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static long byte_count(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); -static grib_accessor* make_clone(grib_accessor*, grib_section*, int*); - -typedef struct grib_accessor_variable -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in variable */ - double dval; - float fval; - char* cval; - char* cname; - int type; -} grib_accessor_variable; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_variable = { - &grib_accessor_class_gen, /* super */ - "variable", /* name */ - sizeof(grib_accessor_variable), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - &pack_float, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - &make_clone, /* clone accessor */ -}; +grib_accessor_class_variable_t _grib_accessor_class_variable{"variable"}; grib_accessor_class* grib_accessor_class_variable = &_grib_accessor_class_variable; -/* END_CLASS_IMP */ - // // This accessor is used for: // constant @@ -134,16 +23,18 @@ grib_accessor_class* grib_accessor_class_variable = &_grib_accessor_class_variab #define MAX_VARIABLE_STRING_LENGTH 255 -static void init(grib_accessor* a, const long length, grib_arguments* args) +void grib_accessor_class_variable_t::init(grib_accessor* a, const long length, grib_arguments* args) { - grib_accessor_variable* self = (grib_accessor_variable*)a; + grib_accessor_class_gen_t::init(a, length, args); + + grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; grib_handle* hand = grib_handle_of_accessor(a); grib_expression* expression = grib_arguments_get_expression(hand, args, 0); const char* p = 0; size_t len = 1; - long l; + long l = 0; int ret = 0; - double d; + double d = 0; self->cname = NULL; a->length = 0; @@ -153,12 +44,12 @@ static void init(grib_accessor* a, const long length, grib_arguments* args) switch (self->type) { case GRIB_TYPE_DOUBLE: grib_expression_evaluate_double(hand, expression, &d); - pack_double(a, &d, &len); + a->pack_double(&d, &len); break; case GRIB_TYPE_LONG: grib_expression_evaluate_long(hand, expression, &l); - pack_long(a, &l, &len); + a->pack_long(&l, &len); break; default: { @@ -171,7 +62,7 @@ static void init(grib_accessor* a, const long length, grib_arguments* args) return; } len = strlen(p) + 1; - pack_string(a, p, &len); + a->pack_string(p, &len); break; } } @@ -180,13 +71,13 @@ static void init(grib_accessor* a, const long length, grib_arguments* args) void accessor_variable_set_type(grib_accessor* a, int type) { - grib_accessor_variable* self = (grib_accessor_variable*)a; + grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; self->type = type; } -static void dump(grib_accessor* a, grib_dumper* dumper) +void grib_accessor_class_variable_t::dump(grib_accessor* a, grib_dumper* dumper) { - const grib_accessor_variable* self = (grib_accessor_variable*)a; + const grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; switch (self->type) { case GRIB_TYPE_DOUBLE: grib_dump_double(dumper, a, NULL); @@ -202,9 +93,9 @@ static void dump(grib_accessor* a, grib_dumper* dumper) } } -static int pack_double(grib_accessor* a, const double* val, size_t* len) +int grib_accessor_class_variable_t::pack_double(grib_accessor* a, const double* val, size_t* len) { - grib_accessor_variable* self = (grib_accessor_variable*)a; + grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; const double dval = *val; if (*len != 1) { @@ -227,9 +118,9 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) return GRIB_SUCCESS; } -static int pack_float(grib_accessor* a, const float* val, size_t* len) +int grib_accessor_class_variable_t::pack_float(grib_accessor* a, const float* val, size_t* len) { - grib_accessor_variable* self = (grib_accessor_variable*)a; + grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; const double fval = *val; if (*len != 1) { @@ -247,9 +138,9 @@ static int pack_float(grib_accessor* a, const float* val, size_t* len) return GRIB_SUCCESS; } -static int pack_long(grib_accessor* a, const long* val, size_t* len) +int grib_accessor_class_variable_t::pack_long(grib_accessor* a, const long* val, size_t* len) { - grib_accessor_variable* self = (grib_accessor_variable*)a; + grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; if (*len != 1) { grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains 1 value", a->name); @@ -264,9 +155,9 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_double(grib_accessor* a, double* val, size_t* len) +int grib_accessor_class_variable_t::unpack_double(grib_accessor* a, double* val, size_t* len) { - const grib_accessor_variable* self = (grib_accessor_variable*)a; + const grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; if (*len < 1) { grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %d values", a->name, 1); @@ -278,9 +169,9 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_float(grib_accessor* a, float* val, size_t* len) +int grib_accessor_class_variable_t::unpack_float(grib_accessor* a, float* val, size_t* len) { - const grib_accessor_variable* self = (grib_accessor_variable*)a; + const grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; if (*len < 1) { grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %d values", a->name, 1); @@ -292,9 +183,9 @@ static int unpack_float(grib_accessor* a, float* val, size_t* len) return GRIB_SUCCESS; } -static int unpack_long(grib_accessor* a, long* val, size_t* len) +int grib_accessor_class_variable_t::unpack_long(grib_accessor* a, long* val, size_t* len) { - const grib_accessor_variable* self = (grib_accessor_variable*)a; + const grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; if (*len < 1) { grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); @@ -306,15 +197,15 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) return GRIB_SUCCESS; } -static int get_native_type(grib_accessor* a) +int grib_accessor_class_variable_t::get_native_type(grib_accessor* a) { - const grib_accessor_variable* self = (grib_accessor_variable*)a; + const grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; return self->type; } -static void destroy(grib_context* c, grib_accessor* a) +void grib_accessor_class_variable_t::destroy(grib_context* c, grib_accessor* a) { - grib_accessor_variable* self = (grib_accessor_variable*)a; + grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; int i = 0; grib_context_free(c, self->cval); @@ -323,15 +214,17 @@ static void destroy(grib_context* c, grib_accessor* a) /* Note: BUFR operator descriptors are variables and have attributes so need to free them */ while (i < MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) { - grib_accessor_delete(c, a->attributes[i]); + a->attributes[i]->destroy(c); a->attributes[i] = NULL; ++i; } + + grib_accessor_class_gen_t::destroy(c, a); } -static int unpack_string(grib_accessor* a, char* val, size_t* len) +int grib_accessor_class_variable_t::unpack_string(grib_accessor* a, char* val, size_t* len) { - grib_accessor_variable* self = (grib_accessor_variable*)a; + grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; char buf[80]; char* p = buf; @@ -358,9 +251,9 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) return GRIB_SUCCESS; } -static int pack_string(grib_accessor* a, const char* val, size_t* len) +int grib_accessor_class_variable_t::pack_string(grib_accessor* a, const char* val, size_t* len) { - grib_accessor_variable* self = (grib_accessor_variable*)a; + grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; const grib_context* c = a->context; grib_context_free(c, self->cval); @@ -372,27 +265,27 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) return GRIB_SUCCESS; } -static int value_count(grib_accessor* a, long* count) +int grib_accessor_class_variable_t::value_count(grib_accessor* a, long* count) { *count = 1; return 0; } -static size_t string_length(grib_accessor* a) +size_t grib_accessor_class_variable_t::string_length(grib_accessor* a) { - const grib_accessor_variable* self = (grib_accessor_variable*)a; + const grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; if (self->type == GRIB_TYPE_STRING) return strlen(self->cval); else return MAX_VARIABLE_STRING_LENGTH; } -static long byte_count(grib_accessor* a) +long grib_accessor_class_variable_t::byte_count(grib_accessor* a) { return a->length; } -static int compare(grib_accessor* a, grib_accessor* b) +int grib_accessor_class_variable_t::compare(grib_accessor* a, grib_accessor* b) { int retval = GRIB_SUCCESS; double* aval = 0; @@ -403,12 +296,12 @@ static int compare(grib_accessor* a, grib_accessor* b) int err = 0; long count = 0; - err = grib_value_count(a, &count); + err = a->value_count(&count); if (err) return err; alen = count; - err = grib_value_count(b, &count); + err = b->value_count(&count); if (err) return err; blen = count; @@ -419,8 +312,8 @@ static int compare(grib_accessor* a, grib_accessor* b) aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); - grib_unpack_double(a, aval, &alen); - grib_unpack_double(b, bval, &blen); + a->unpack_double(aval, &alen); + b->unpack_double(bval, &blen); retval = GRIB_SUCCESS; retval = GRIB_SUCCESS; @@ -434,11 +327,11 @@ static int compare(grib_accessor* a, grib_accessor* b) return retval; } -static grib_accessor* make_clone(grib_accessor* a, grib_section* s, int* err) +grib_accessor* grib_accessor_class_variable_t::make_clone(grib_accessor* a, grib_section* s, int* err) { grib_accessor* the_clone = NULL; - const grib_accessor_variable* self = (grib_accessor_variable*)a; - grib_accessor_variable* variableAccessor = NULL; + const grib_accessor_variable_t* self = (grib_accessor_variable_t*)a; + grib_accessor_variable_t* variableAccessor = NULL; grib_action creator = {0,}; creator.op = (char*)"variable"; creator.name_space = (char*)""; @@ -449,7 +342,7 @@ static grib_accessor* make_clone(grib_accessor* a, grib_section* s, int* err) the_clone->parent = NULL; the_clone->h = s->h; the_clone->flags = a->flags; - variableAccessor = (grib_accessor_variable*)the_clone; + variableAccessor = (grib_accessor_variable_t*)the_clone; variableAccessor->cname = creator.name; /* ECC-765: Store for later freeing memory */ *err = 0; diff --git a/src/accessor/grib_accessor_class_variable.h b/src/accessor/grib_accessor_class_variable.h new file mode 100644 index 000000000..90ff71238 --- /dev/null +++ b/src/accessor/grib_accessor_class_variable.h @@ -0,0 +1,49 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor.h" +#include "grib_accessor_class_gen.h" + + +class grib_accessor_variable_t : public grib_accessor_gen_t +{ +public: + double dval; + float fval; + char* cval; + char* cname; + int type; +}; + +class grib_accessor_class_variable_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_variable_t(const char* name) : grib_accessor_class_gen_t(name) {}; + grib_accessor* create_empty_accessor() override { return new grib_accessor_variable_t{}; } + int get_native_type(grib_accessor*) override; + int pack_double(grib_accessor*, const double* val, size_t* len) override; + int pack_float(grib_accessor*, const float* val, size_t* len) override; + int pack_long(grib_accessor*, const long* val, size_t* len) override; + int pack_string(grib_accessor*, const char*, size_t* len) override; + int unpack_double(grib_accessor*, double* val, size_t* len) override; + int unpack_float(grib_accessor*, float* val, size_t* len) override; + int unpack_long(grib_accessor*, long* val, size_t* len) override; + int unpack_string(grib_accessor*, char*, size_t* len) override; + size_t string_length(grib_accessor*) override; + long byte_count(grib_accessor*) override; + int value_count(grib_accessor*, long*) override; + void destroy(grib_context*, grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int compare(grib_accessor*, grib_accessor*) override; + grib_accessor* make_clone(grib_accessor*, grib_section*, int*) override; +}; diff --git a/src/accessor/grib_accessor_class_vector.cc b/src/accessor/grib_accessor_class_vector.cc new file mode 100644 index 000000000..f08809f6f --- /dev/null +++ b/src/accessor/grib_accessor_class_vector.cc @@ -0,0 +1,60 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_vector.h" +#include "grib_accessor_class_abstract_vector.h" + +grib_accessor_class_vector_t _grib_accessor_class_vector{ "vector" }; +grib_accessor_class* grib_accessor_class_vector = &_grib_accessor_class_vector; + + +void grib_accessor_class_vector_t::init(grib_accessor* a, const long l, grib_arguments* c) +{ + grib_accessor_class_abstract_vector_t::init(a, l, c); + grib_accessor_vector_t* self = (grib_accessor_vector_t*)a; + int n = 0; + + self->vector = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); + self->index = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; + a->length = 0; +} + +int grib_accessor_class_vector_t::unpack_double(grib_accessor* a, double* val, size_t* len) +{ + int err = 0; + size_t size = 0; + double* stat; + grib_accessor_vector_t* self = (grib_accessor_vector_t*)a; + grib_accessor* va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); + grib_accessor_abstract_vector_t* v = (grib_accessor_abstract_vector_t*)va; + + Assert(self->index >= 0); + + if (self->index >= v->number_of_elements) { + grib_context_log(a->context, GRIB_LOG_FATAL, "index=%d number_of_elements=%d for %s", self->index, v->number_of_elements, a->name); + Assert(self->index < v->number_of_elements); + } + + if (va->dirty) { + grib_get_size(grib_handle_of_accessor(a), self->vector, &size); + stat = (double*)grib_context_malloc_clear(a->context, sizeof(double) * size); + err = va->unpack_double(stat, &size); + grib_context_free(a->context, stat); + if (err) + return err; + } + + *val = v->v[self->index]; + + return err; +} diff --git a/src/accessor/grib_accessor_class_vector.h b/src/accessor/grib_accessor_class_vector.h new file mode 100644 index 000000000..92dc6a13e --- /dev/null +++ b/src/accessor/grib_accessor_class_vector.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_abstract_vector.h" + +class grib_accessor_vector_t : public grib_accessor_abstract_vector_t +{ +public: + /* Members defined in vector */ + const char* vector; + int index; +}; + +class grib_accessor_class_vector_t : public grib_accessor_class_abstract_vector_t +{ +public: + grib_accessor_class_vector_t(const char* name) : grib_accessor_class_abstract_vector_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_vector_t{}; } + int unpack_double(grib_accessor*, double* val, size_t* len) override; + void init(grib_accessor*, const long, grib_arguments*) override; +}; diff --git a/src/accessor/grib_accessor_class_when.cc b/src/accessor/grib_accessor_class_when.cc new file mode 100644 index 000000000..48db76803 --- /dev/null +++ b/src/accessor/grib_accessor_class_when.cc @@ -0,0 +1,39 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessor_class_when.h" + +grib_accessor_class_when_t _grib_accessor_class_when{ "when" }; +grib_accessor_class* grib_accessor_class_when = &_grib_accessor_class_when; + + +void grib_accessor_class_when_t::init(grib_accessor* a, const long len, grib_arguments* arg) +{ + grib_accessor_class_gen_t::init(a, len, arg); + a->length = 0; + a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; + a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; +} + +void grib_accessor_class_when_t::dump(grib_accessor* a, grib_dumper* dumper) +{ + /* grib_dump_when(dumper,a,NULL); */ +} + +int grib_accessor_class_when_t::notify_change(grib_accessor* a, grib_accessor* changed) +{ + return grib_action_notify_change(a->creator, a, changed); +} + +int grib_accessor_class_when_t::get_native_type(grib_accessor* a) +{ + return GRIB_TYPE_UNDEFINED; +} diff --git a/src/accessor/grib_accessor_class_when.h b/src/accessor/grib_accessor_class_when.h new file mode 100644 index 000000000..515afb4b1 --- /dev/null +++ b/src/accessor/grib_accessor_class_when.h @@ -0,0 +1,31 @@ + +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor_class_gen.h" + +class grib_accessor_when_t : public grib_accessor_gen_t +{ +public: + /* Members defined in when */ +}; + +class grib_accessor_class_when_t : public grib_accessor_class_gen_t +{ +public: + grib_accessor_class_when_t(const char* name) : grib_accessor_class_gen_t(name) {} + grib_accessor* create_empty_accessor() override { return new grib_accessor_when_t{}; } + int get_native_type(grib_accessor*) override; + void dump(grib_accessor*, grib_dumper*) override; + void init(grib_accessor*, const long, grib_arguments*) override; + int notify_change(grib_accessor*, grib_accessor*) override; +}; diff --git a/src/accessor/grib_accessors_list.cc b/src/accessor/grib_accessors_list.cc new file mode 100644 index 000000000..173077e69 --- /dev/null +++ b/src/accessor/grib_accessors_list.cc @@ -0,0 +1,150 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#include "grib_accessors_list.h" + +grib_accessors_list* grib_accessors_list_create(grib_context* c) +{ + return (grib_accessors_list*)grib_context_malloc_clear(c, sizeof(grib_accessors_list)); +} + +void grib_accessors_list_delete(grib_context* c, grib_accessors_list* al) +{ + grib_accessors_list* tmp; + while (al) { + tmp = al->next_; + grib_context_free(c, al); + al = tmp; + } +} + +int grib_accessors_list::value_count(size_t* count) +{ + long lcount = 0; + *count = 0; + grib_accessors_list* al = this; + while (al) { + al->accessor->value_count(&lcount); + *count += lcount; + al = al->next_; + } + return 0; +} + +void grib_accessors_list::push(grib_accessor* a, int rank) +{ + grib_accessors_list* last; + const grib_context* c = a->context; + + last = this->last(); + if (last && last->accessor) { + last->next_ = (grib_accessors_list*)grib_context_malloc_clear(c, sizeof(grib_accessors_list)); + last->next_->accessor = a; + last->next_->prev_ = last; + last->next_->rank_ = rank; + this->last_ = last->next_; + } + else { + this->accessor = a; + this->rank_ = rank; + this->last_ = this; + } +} + +grib_accessors_list* grib_accessors_list::last() +{ + return last_; +} + +grib_accessors_list::~grib_accessors_list() +{ + grib_accessors_list* tmp; + grib_context* c = grib_context_get_default(); + + grib_accessors_list* al = this; + while (al) { + tmp = al->next_; + // grib_accessor_delete(c, al->accessor); + grib_context_free(c, al); + al = tmp; + } +} + +int grib_accessors_list::unpack_long(long* val, size_t* buffer_len) +{ + int err = GRIB_SUCCESS; + size_t unpacked_len = 0; + size_t len = 0; + + grib_accessors_list* al = this; + while (al && err == GRIB_SUCCESS) { + len = *buffer_len - unpacked_len; + err = al->accessor->unpack_long(val + unpacked_len, &len); + unpacked_len += len; + al = al->next_; + } + + *buffer_len = unpacked_len; + return err; +} + +int grib_accessors_list::unpack_double(double* val, size_t* buffer_len) +{ + int err = GRIB_SUCCESS; + size_t unpacked_len = 0; + size_t len = 0; + + grib_accessors_list* al = this; + while (al && err == GRIB_SUCCESS) { + len = *buffer_len - unpacked_len; + err = al->accessor->unpack_double(val + unpacked_len, &len); + unpacked_len += len; + al = al->next_; + } + + *buffer_len = unpacked_len; + return err; +} + +int grib_accessors_list::unpack_float(float* val, size_t* buffer_len) +{ + int err = GRIB_SUCCESS; + size_t unpacked_len = 0; + size_t len = 0; + + grib_accessors_list* al = this; + while (al && err == GRIB_SUCCESS) { + len = *buffer_len - unpacked_len; + err = al->accessor->unpack_float(val + unpacked_len, &len); + unpacked_len += len; + al = al->next_; + } + + *buffer_len = unpacked_len; + return err; +} + +int grib_accessors_list::unpack_string(char** val, size_t* buffer_len) +{ + int err = GRIB_SUCCESS; + size_t unpacked_len = 0; + size_t len = 0; + + grib_accessors_list* al = this; + while (al && err == GRIB_SUCCESS) { + len = *buffer_len - unpacked_len; + err = al->accessor->unpack_string_array(val + unpacked_len, &len); + unpacked_len += len; + al = al->next_; + } + + *buffer_len = unpacked_len; + return err; +} diff --git a/src/accessor/grib_accessors_list.h b/src/accessor/grib_accessors_list.h new file mode 100644 index 000000000..e136d955a --- /dev/null +++ b/src/accessor/grib_accessors_list.h @@ -0,0 +1,40 @@ +/* + * (C) Copyright 2005- ECMWF. + * + * This software is licensed under the terms of the Apache Licence Version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * + * 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. + */ + +#pragma once + +#include "grib_accessor.h" + +class grib_accessors_list +{ +public: + grib_accessors_list(); + ~grib_accessors_list(); + + int value_count(size_t* count); + void push(grib_accessor* a, int rank); + grib_accessors_list* last(); + int unpack_long(long* val, size_t* buffer_len); + int unpack_double(double* val, size_t* buffer_len); + int unpack_float(float* val, size_t* buffer_len); + int unpack_string(char** val, size_t* buffer_len); + + int rank() const { return rank_; } + + grib_accessor* accessor = nullptr; + grib_accessors_list* next_ = nullptr; + grib_accessors_list* prev_ = nullptr; + grib_accessors_list* last_ = nullptr; +private: + int rank_ = 0; +}; + +grib_accessors_list* grib_accessors_list_create(grib_context* c); +void grib_accessors_list_delete(grib_context* c, grib_accessors_list* al); diff --git a/src/action_class_gen.cc b/src/action_class_gen.cc index 641aa3c92..722391c7f 100644 --- a/src/action_class_gen.cc +++ b/src/action_class_gen.cc @@ -152,7 +152,7 @@ static int create_accessor(grib_section* p, grib_action* act, grib_loader* loade static int notify_change(grib_action* act, grib_accessor* notified, grib_accessor* changed) { if (act->default_value) - return grib_pack_expression(notified, grib_arguments_get_expression(grib_handle_of_accessor(notified), act->default_value, 0)); + return notified->pack_expression(grib_arguments_get_expression(grib_handle_of_accessor(notified), act->default_value, 0)); return GRIB_SUCCESS; } diff --git a/src/action_class_remove.cc b/src/action_class_remove.cc index 40f5079a7..eff91cdce 100644 --- a/src/action_class_remove.cc +++ b/src/action_class_remove.cc @@ -94,7 +94,7 @@ static void remove_accessor(grib_accessor* a) grib_section* s = NULL; int id; - if (!a || !a->previous) + if (!a || !a->previous_) return; s = a->parent; @@ -103,14 +103,14 @@ static void remove_accessor(grib_accessor* a) grib_handle_of_accessor(a)->accessors[id] = NULL; } - if (a->next) - a->previous->next = a->next; + if (a->next_) + a->previous_->next_ = a->next_; else return; - a->next->previous = a->previous; + a->next_->previous_ = a->previous_; - grib_accessor_delete(s->h->context, a); + a->destroy(s->h->context); } static int create_accessor(grib_section* p, grib_action* act, grib_loader* h) diff --git a/src/action_class_transient_darray.cc b/src/action_class_transient_darray.cc index 673f83502..276dcf3fa 100644 --- a/src/action_class_transient_darray.cc +++ b/src/action_class_transient_darray.cc @@ -117,7 +117,7 @@ static int execute(grib_action* act, grib_handle* h) if (a->flags & GRIB_ACCESSOR_FLAG_CONSTRAINT) grib_dependency_observe_arguments(a, act->default_value); - return grib_pack_double(a, self->darray->v, &len); + return a->pack_double(self->darray->v, &len); } static void dump(grib_action* act, FILE* f, int lvl) diff --git a/src/bufr_keys_iterator.cc b/src/bufr_keys_iterator.cc index e1ab89697..d22b0349b 100644 --- a/src/bufr_keys_iterator.cc +++ b/src/bufr_keys_iterator.cc @@ -176,7 +176,7 @@ int codes_bufr_keys_iterator_next(bufr_keys_iterator* kiter) return 1; } else { - kiter->current = grib_next_accessor(kiter->current); + kiter->current = kiter->current->next_accessor(); kiter->attributes = 0; if (kiter->prefix) { grib_context_free(kiter->current->context, kiter->prefix); @@ -187,7 +187,7 @@ int codes_bufr_keys_iterator_next(bufr_keys_iterator* kiter) } while (kiter->current && skip(kiter)) - kiter->current = grib_next_accessor(kiter->current); + kiter->current = kiter->current->next_accessor(); return kiter->current != NULL; } diff --git a/src/bufr_util.cc b/src/bufr_util.cc index 95ff8eeb2..56a4977c0 100644 --- a/src/bufr_util.cc +++ b/src/bufr_util.cc @@ -682,9 +682,8 @@ int codes_bufr_extract_headers_malloc(grib_context* c, const char* filename, cod return GRIB_SUCCESS; } -static const char* codes_bufr_header_get_centre_name(long edition, long centre_code) +static const char* codes_bufr_header_get_centre_name(long centre_code) { - (void)edition; switch (centre_code) { case 1: return "ammc"; @@ -758,14 +757,8 @@ static const char* codes_bufr_header_get_centre_name(long edition, long centre_c return "ingv"; case 239: return "crfc"; - case 244: - return "vuwien"; - case 245: + case 99: return "knmi"; - case 246: - return "ifmk"; - case 247: - return "hadc"; case 250: return "cosmo"; case 252: @@ -871,7 +864,7 @@ int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char* v *len = snprintf(val, 32, "%ld", bh->bufrHeaderCentre); else if (strcmp(key, "centre") == 0) { - const char* centre_str = codes_bufr_header_get_centre_name(bh->edition, bh->bufrHeaderCentre); + const char* centre_str = codes_bufr_header_get_centre_name(bh->bufrHeaderCentre); if (centre_str) *len = snprintf(val, 32, "%s", centre_str); else diff --git a/src/eccodes_prototypes.h b/src/eccodes_prototypes.h index e98ae83c2..ab2d4531e 100644 --- a/src/eccodes_prototypes.h +++ b/src/eccodes_prototypes.h @@ -1,13 +1,3 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - #pragma once #ifdef ECCODES_ON_WINDOWS @@ -107,57 +97,7 @@ grib_action* grib_action_create_modify(grib_context* context, const char* name, /* action_class_transient_darray.cc */ grib_action* grib_action_create_transient_darray(grib_context* context, const char* name, grib_darray* darray, int flags); -/* grib_accessor.cc */ -void grib_accessor_dump(grib_accessor* a, grib_dumper* f); -int grib_pack_missing(grib_accessor* a); -int grib_is_missing_internal(grib_accessor* a); -int grib_pack_double(grib_accessor* a, const double* v, size_t* len); -int grib_pack_float(grib_accessor* a, const float* v, size_t* len); -int grib_pack_expression(grib_accessor* a, grib_expression* e); -int grib_pack_string(grib_accessor* a, const char* v, size_t* len); -int grib_pack_string_array(grib_accessor* a, const char** v, size_t* len); -int grib_pack_long(grib_accessor* a, const long* v, size_t* len); -int grib_pack_bytes(grib_accessor* a, const unsigned char* v, size_t* len); -int grib_unpack_bytes(grib_accessor* a, unsigned char* v, size_t* len); -int grib_unpack_double_subarray(grib_accessor* a, double* v, size_t start, size_t len); -int grib_unpack_double(grib_accessor* a, double* v, size_t* len); -int grib_unpack_float(grib_accessor* a, float* v, size_t* len); -int grib_unpack_double_element(grib_accessor* a, size_t i, double* v); -int grib_unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array); -int grib_unpack_float_element(grib_accessor* a, size_t i, float* v); -int grib_unpack_float_element_set(grib_accessor* a, const size_t* index_array, size_t len, float* val_array); -int grib_unpack_string(grib_accessor* a, char* v, size_t* len); -int grib_unpack_string_array(grib_accessor* a, char** v, size_t* len); -int grib_accessors_list_unpack_long(grib_accessors_list* al, long* val, size_t* buffer_len); -int grib_accessors_list_unpack_double(grib_accessors_list* al, double* val, size_t* buffer_len); -int grib_accessors_list_unpack_float(grib_accessors_list* al, float* val, size_t* buffer_len); -int grib_accessors_list_unpack_string(grib_accessors_list* al, char** val, size_t* buffer_len); -int grib_unpack_long(grib_accessor* a, long* v, size_t* len); -long grib_accessor_get_native_type(grib_accessor* a); -long grib_get_next_position_offset(grib_accessor* a); -long grib_string_length(grib_accessor* a); -long grib_byte_offset(grib_accessor* a); -long grib_byte_count(grib_accessor* a); -int grib_value_count(grib_accessor* a, long* count); -int grib_accessors_list_value_count(grib_accessors_list* al, size_t* count); -int grib_accessor_notify_change(grib_accessor* a, grib_accessor* changed); -void grib_init_accessor(grib_accessor* a, const long len, grib_arguments* args); -void grib_accessor_delete(grib_context* ct, grib_accessor* a); -grib_accessor* grib_accessor_clone(grib_accessor* a, grib_section* s, int* err); -void grib_update_size(grib_accessor* a, size_t len); -int grib_nearest_smaller_value(grib_accessor* a, double val, double* nearest); -size_t grib_preferred_size(grib_accessor* a, int from_handle); -grib_accessor* grib_next_accessor(grib_accessor* a); -void grib_resize(grib_accessor* a, size_t new_size); -int grib_compare_accessors(grib_accessor* a1, grib_accessor* a2, int compare_flags); -int grib_accessor_add_attribute(grib_accessor* a, grib_accessor* attr, int nest_if_clash); -grib_accessor* grib_accessor_get_attribute_index(grib_accessor* a, const char* name, int* index); -int grib_accessor_has_attributes(grib_accessor* a); -grib_accessor* grib_accessor_get_attribute(grib_accessor* a, const char* name); -grib_accessors_list* grib_accessors_list_create(grib_context* c); -void grib_accessors_list_push(grib_accessors_list* al, grib_accessor* a, int rank); -grib_accessors_list* grib_accessors_list_last(grib_accessors_list* al); -void grib_accessors_list_delete(grib_context* c, grib_accessors_list* al); +/* grib_accessor.cc*/ /* grib_concept.cc */ grib_concept_value* grib_concept_value_new(grib_context* c, const char* name, grib_concept_condition* conditions); @@ -243,11 +183,17 @@ grib_viarray* grib_viarray_push(grib_context* c, grib_viarray* v, grib_iarray* v void grib_viarray_delete(grib_context* c, grib_viarray* v); void grib_viarray_delete_content(grib_context* c, grib_viarray* v); -/* grib_accessor_class_bufr_data_array.cc */ -grib_vsarray* accessor_bufr_data_array_get_stringValues(grib_accessor* a); -grib_accessors_list* accessor_bufr_data_array_get_dataAccessors(grib_accessor* a); -grib_trie_with_rank* accessor_bufr_data_array_get_dataAccessorsTrie(grib_accessor* a); -void accessor_bufr_data_array_set_unpackMode(grib_accessor* a, int unpackMode); +/* grib_accessor_class_ascii.cc*/ + +/* grib_accessor_class_bit.cc*/ + +/* grib_accessor_class_bitmap.cc*/ + +/* grib_accessor_class_bits.cc*/ + +/* grib_accessor_class_bits_per_value.cc*/ + +/* grib_accessor_class_bufr_data_array.cc*/ /* grib_accessor_class_bufr_data_element.cc */ void accessor_bufr_data_element_set_index(grib_accessor* a, long index); @@ -532,6 +478,7 @@ grib_handle* grib_fieldset_retrieve(grib_fieldset* set, int i, int* err); /* grib_filepool.cc */ void grib_file_pool_clean(void); +grib_file* grib_file_pool_get_files(void); grib_file* grib_file_open(const char* filename, const char* mode, int* err); void grib_file_pool_delete_file(grib_file* file); void grib_file_close(const char* filename, int force, int* err); diff --git a/src/grib_accessor.cc b/src/grib_accessor.cc index a08f5348e..a684b9e1d 100644 --- a/src/grib_accessor.cc +++ b/src/grib_accessor.cc @@ -112,7 +112,9 @@ int grib_pack_float(grib_accessor* a, const float* v, size_t* len) int grib_pack_expression(grib_accessor* a, grib_expression* e) { grib_accessor_class* c = a->cclass; - //grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0); + // grib_context_log(a->context, GRIB_LOG_INFO, "....(%s)%s is packing", + // (a->parent->owner)?(a->parent->owner->name):"root", + // a->name); while (c) { if (c->pack_expression) { return c->pack_expression(a, e); diff --git a/src/grib_accessor_class.cc b/src/grib_accessor_class.cc index 9cdd04b97..4120fb5bd 100644 --- a/src/grib_accessor_class.cc +++ b/src/grib_accessor_class.cc @@ -11,11 +11,12 @@ #include "grib_api_internal.h" #include "grib_accessor_classes_hash.cc" +#include /* grib level */ /* This file is generated by ./make_class.pl */ -#include "grib_accessor_class.h" +#include "accessor/grib_accessor.h" #if GRIB_PTHREADS static pthread_once_t once = PTHREAD_ONCE_INIT; @@ -139,7 +140,7 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator, c = *((grib_accessor_classes_hash(creator->op, strlen(creator->op)))->cclass); #endif - a = (grib_accessor*)grib_context_malloc_clear(p->h->context, c->size); + a = c->create_empty_accessor(); a->name = creator->name; a->name_space = creator->name_space; @@ -150,8 +151,8 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator, a->creator = creator; a->context = p->h->context; a->h = NULL; - a->next = NULL; - a->previous = NULL; + a->next_ = NULL; + a->previous_ = NULL; a->parent = p; a->length = 0; a->offset = 0; @@ -159,7 +160,7 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator, a->set = creator->set; if (p->block->last) { - a->offset = grib_get_next_position_offset(p->block->last); + a->offset = p->block->last->get_next_position_offset(); //printf("offset: p->block->last %s %s %ld %ld\n", // p->block->last->cclass->name, @@ -176,8 +177,8 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator, a->cclass = c; - grib_init_accessor(a, len, params); - size = grib_get_next_position_offset(a); + a->init_accessor(len, params); + size = a->get_next_position_offset(); if (size > p->h->buffer->ulength) { if (!p->h->buffer->growable) { @@ -189,7 +190,7 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator, a->offset + a->length, p->h->buffer->ulength); - grib_accessor_delete(p->h->context, a); + a->destroy(p->h->context); return NULL; } else { @@ -223,10 +224,10 @@ static void link_same_attributes(grib_accessor* a, grib_accessor* b) grib_accessor* bAttribute = NULL; if (a == NULL || b == NULL) return; - if (!grib_accessor_has_attributes(b)) + if (!b->has_attributes()) return; while (i < MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) { - bAttribute = grib_accessor_get_attribute_index(b, a->attributes[i]->name, &idx); + bAttribute = b->get_attribute_index(a->attributes[i]->name, &idx); if (bAttribute) a->attributes[i]->same = bAttribute; i++; @@ -240,8 +241,8 @@ void grib_push_accessor(grib_accessor* a, grib_block_of_accessors* l) if (!l->first) l->first = l->last = a; else { - l->last->next = a; - a->previous = l->last; + l->last->next_ = a; + a->previous_ = l->last; } l->last = a; @@ -270,11 +271,11 @@ void grib_section_post_init(grib_section* s) while (a) { grib_accessor_class* c = a->cclass; - if (c->post_init) - c->post_init(a); + c->post_init(a); + if (a->sub_section) grib_section_post_init(a->sub_section); - a = a->next; + a = a->next_; } } @@ -306,20 +307,20 @@ int grib_section_adjust_sizes(grib_section* s, int update, int depth) } length += l; offset += l; - a = a->next; + a = a->next_; } if (s) { if (s->aclength) { size_t len = 1; long plen = 0; - int lret = grib_unpack_long(s->aclength, &plen, &len); + int lret = s->aclength->unpack_long(&plen, &len); Assert(lret == GRIB_SUCCESS); /* This happens when there is some padding */ if ((plen != length) || force_update) { if (update) { plen = length; - lret = grib_pack_long(s->aclength, &plen, &len); + lret = s->aclength->pack_long(&plen, &len); if (lret != GRIB_SUCCESS) return lret; s->padding = 0; @@ -358,7 +359,7 @@ int grib_get_block_length(grib_section* s, size_t* l) // if(s->aclength) { // size_t len = 1; // long plen = 0; -// int ret = grib_unpack_long(s->aclength, &plen, &len); +// int ret = s->aclength->unpack_long(&plen, &len); // if(ret == GRIB_SUCCESS && plen != 0) // { // *l = plen; @@ -371,13 +372,13 @@ int grib_get_block_length(grib_section* s, size_t* l) // return GRIB_SUCCESS; // } // // no accessor for block length -// if(s->owner) *l = grib_get_next_position_offset(s->block->last) - s->owner->offset; -// else *l = grib_get_next_position_offset(s->block->last); +// if(s->owner) *l = s->block->last->get_next_position_offset() - s->owner->offset; +// else *l = s->block->last->get_next_position_offset(); // if(s->aclength) { // size_t len = 1; // long plen = *l; -// int ret = grib_pack_long(s->aclength, &plen, &len); +// int ret = s->aclength->pack_long(&plen, &len); // if(ret != GRIB_SUCCESS) // ; // if(s->h->context->debug) @@ -397,10 +398,10 @@ grib_accessor* find_paddings(grib_section* s) if (p) return p; - if (grib_preferred_size(a, 0) != a->length) + if (a->preferred_size(0) != a->length) return a; - a = a->next; + a = a->next_; } return NULL; @@ -414,7 +415,7 @@ void grib_update_paddings(grib_section* s) /* while((changed = find_paddings(s)) != NULL) */ while ((changed = find_paddings(s->h->root)) != NULL) { Assert(changed != last); - grib_resize(changed, grib_preferred_size(changed, 0)); + changed->resize(changed->preferred_size(0)); last = changed; } } diff --git a/src/grib_accessor_class.h b/src/grib_accessor_class.h index 0c569decd..cfec4d21d 100644 --- a/src/grib_accessor_class.h +++ b/src/grib_accessor_class.h @@ -1,4 +1,5 @@ -/* This file is automatically generated by ./make_class.pl, do not edit */ +#include "grib_api_internal.h" + extern grib_accessor_class* grib_accessor_class_abstract_long_vector; extern grib_accessor_class* grib_accessor_class_abstract_vector; extern grib_accessor_class* grib_accessor_class_ascii; diff --git a/src/grib_accessor_class_abstract_long_vector.cc b/src/grib_accessor_class_abstract_long_vector.cc deleted file mode 100644 index 523e0a740..000000000 --- a/src/grib_accessor_class_abstract_long_vector.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/****************************************************************** - * Enrico Fucile - ******************************************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - MEMBERS = long* v - MEMBERS = long pack_index - MEMBERS = int number_of_elements - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - - -typedef struct grib_accessor_abstract_long_vector -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in abstract_long_vector */ - long* v; - long pack_index; - int number_of_elements; -} grib_accessor_abstract_long_vector; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_abstract_long_vector = { - &grib_accessor_class_gen, /* super */ - "abstract_long_vector", /* name */ - sizeof(grib_accessor_abstract_long_vector), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_abstract_long_vector = &_grib_accessor_class_abstract_long_vector; - -/* END_CLASS_IMP */ diff --git a/src/grib_accessor_class_abstract_vector.cc b/src/grib_accessor_class_abstract_vector.cc deleted file mode 100644 index 1353aeffc..000000000 --- a/src/grib_accessor_class_abstract_vector.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - MEMBERS = double* v - MEMBERS = int number_of_elements - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - - -typedef struct grib_accessor_abstract_vector -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in abstract_vector */ - double* v; - int number_of_elements; -} grib_accessor_abstract_vector; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_abstract_vector = { - &grib_accessor_class_double, /* super */ - "abstract_vector", /* name */ - sizeof(grib_accessor_abstract_vector), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_abstract_vector = &_grib_accessor_class_abstract_vector; - -/* END_CLASS_IMP */ diff --git a/src/grib_accessor_class_ascii.cc b/src/grib_accessor_class_ascii.cc deleted file mode 100644 index b0c90182e..000000000 --- a/src/grib_accessor_class_ascii.cc +++ /dev/null @@ -1,278 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ -/*********************************************************** - * Enrico Fucile - ***********************************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = init;dump;string_length - IMPLEMENTS = value_count - IMPLEMENTS = get_native_type - IMPLEMENTS = compare - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_ascii -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ -} grib_accessor_ascii; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_ascii = { - &grib_accessor_class_gen, /* super */ - "ascii", /* name */ - sizeof(grib_accessor_ascii), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_ascii = &_grib_accessor_class_ascii; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->length = len; - Assert(a->length >= 0); -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - return a->length; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string(dumper, a, NULL); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - size_t i = 0; - grib_handle* hand = grib_handle_of_accessor(a); - const size_t alen = a->length; - - if (*len < (alen + 1)) { - const char* cclass_name = a->cclass->name; - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, alen+1, *len); - *len = alen + 1; - return GRIB_BUFFER_TOO_SMALL; - } - - for (i = 0; i < alen; i++) - val[i] = hand->buffer->data[a->offset + i]; - val[i] = 0; - *len = i; - return GRIB_SUCCESS; -} - -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - size_t i = 0; - grib_handle* hand = grib_handle_of_accessor(a); - const size_t alen = a->length; - if (len[0] > (alen + 1)) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "pack_string: Wrong size (%zu) for %s, it contains %ld values", len[0], a->name, a->length + 1); - len[0] = 0; - return GRIB_BUFFER_TOO_SMALL; - } - - for (i = 0; i < alen; i++) { - if (i < len[0]) - hand->buffer->data[a->offset + i] = val[i]; - else - hand->buffer->data[a->offset + i] = 0; - } - - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* v, size_t* len) -{ - grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as long (It's a string)", a->name); - return GRIB_NOT_IMPLEMENTED; -} - -static int pack_double(grib_accessor* a, const double* v, size_t* len) -{ - grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as double (It's a string)", a->name); - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_long(grib_accessor* a, long* v, size_t* len) -{ - char val[1024] = {0,}; - size_t l = sizeof(val); - size_t i = 0; - char* last = NULL; - int err = grib_unpack_string(a, val, &l); - - if (err) - return err; - - i = 0; - while (i < l - 1 && val[i] == ' ') - i++; - - if (val[i] == 0) { - *v = 0; - return 0; - } - if (val[i + 1] == ' ' && i < l - 2) - val[i + 1] = 0; - - *v = strtol(val, &last, 10); - - grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name); - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* v, size_t* len) -{ - char val[1024]; - size_t l = sizeof(val); - char* last = NULL; - - int err = grib_unpack_string(a, val, &l); - if (err) return err; - - *v = strtod(val, &last); - - if (*last == 0) { - grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name); - return GRIB_SUCCESS; - } - - grib_context_log(a->context, GRIB_LOG_WARNING, "Cannot unpack %s as double. Hint: Try unpacking as string", a->name); - - return GRIB_NOT_IMPLEMENTED; -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - int retval = 0; - char* aval = 0; - char* bval = 0; - int err = 0; - - size_t alen = a->length+1; - size_t blen = b->length+1; - - if (alen != blen) - return GRIB_COUNT_MISMATCH; - - aval = (char*)grib_context_malloc(a->context, alen * sizeof(char)); - bval = (char*)grib_context_malloc(b->context, blen * sizeof(char)); - - err = grib_unpack_string(a, aval, &alen); - if (err) return err; - err = grib_unpack_string(b, bval, &blen); - if (err) return err; - - retval = GRIB_SUCCESS; - if (!STR_EQUAL(aval, bval)) - retval = GRIB_STRING_VALUE_MISMATCH; - - grib_context_free(a->context, aval); - grib_context_free(b->context, bval); - - return retval; -} diff --git a/src/grib_accessor_class_bit.cc b/src/grib_accessor_class_bit.cc deleted file mode 100644 index ab81eecda..000000000 --- a/src/grib_accessor_class_bit.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init - MEMBERS = const char* owner - MEMBERS = int bit_index - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bit -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in bit */ - const char* owner; - int bit_index; -} grib_accessor_bit; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_bit = { - &grib_accessor_class_long, /* super */ - "bit", /* name */ - sizeof(grib_accessor_bit), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_bit = &_grib_accessor_class_bit; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_bit* self = (grib_accessor_bit*)a; - a->length = 0; - self->owner = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 0); - self->bit_index = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 1); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_bit* self = (grib_accessor_bit*)a; - int ret = 0; - long data = 0; - - if (*len < 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_bit: unpack_long: Wrong size for %s, it contains %d values ", a->name, 1); - *len = 1; - return GRIB_ARRAY_TOO_SMALL; - } - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->owner, &data)) != GRIB_SUCCESS) { - *len = 0; - return ret; - } - - if (data & (1 << self->bit_index)) - *val = 1; - else - *val = 0; - - *len = 1; - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_bit* self = (grib_accessor_bit*)a; - - if (*len < 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_bit: pack_long: At least one value to pack for %s", a->name); - *len = 1; - return GRIB_ARRAY_TOO_SMALL; - } - - grib_accessor* owner = grib_find_accessor(grib_handle_of_accessor(a), self->owner); - if (!owner) { - grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_bit: Cannot get the owner %s for computing the bit value of %s", - self->owner, a->name); - *len = 0; - return GRIB_NOT_FOUND; - } - - unsigned char* mdata = grib_handle_of_accessor(a)->buffer->data; - mdata += grib_byte_offset(owner); - - /* Note: In the definitions, flagbit numbers go from 7 to 0 (the bit_index), while WMO convention is from 1 to 8 */ - if (a->context->debug) { - /* Print bit positions from 1 (MSB) */ - fprintf(stderr, "ECCODES DEBUG Setting bit %d in %s to %d\n", 8 - self->bit_index, owner->name, (*val > 0) ); - } - grib_set_bit(mdata, 7 - self->bit_index, *val > 0); - - *len = 1; - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_bitmap.cc b/src/grib_accessor_class_bitmap.cc deleted file mode 100644 index b86b34332..000000000 --- a/src/grib_accessor_class_bitmap.cc +++ /dev/null @@ -1,297 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -#include - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_bytes - IMPLEMENTS = next_offset - IMPLEMENTS = unpack_double;unpack_double_element;unpack_double_element_set - IMPLEMENTS = unpack_float - IMPLEMENTS = unpack_long - IMPLEMENTS = unpack_string - IMPLEMENTS = string_length - IMPLEMENTS = init;dump;update_size - MEMBERS=const char* tableReference - MEMBERS=const char* missing_value - MEMBERS=const char* offsetbsec - MEMBERS=const char* sLength - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static long next_offset(grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_bitmap -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in bitmap */ - const char* tableReference; - const char* missing_value; - const char* offsetbsec; - const char* sLength; -} grib_accessor_bitmap; - -extern grib_accessor_class* grib_accessor_class_bytes; - -static grib_accessor_class _grib_accessor_class_bitmap = { - &grib_accessor_class_bytes, /* super */ - "bitmap", /* name */ - sizeof(grib_accessor_bitmap), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - &string_length, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_bitmap = &_grib_accessor_class_bitmap; - -/* END_CLASS_IMP */ - - -static void compute_size(grib_accessor* a) -{ - long slen = 0; - long off = 0; - grib_handle* hand = grib_handle_of_accessor(a); - - grib_accessor_bitmap* self = (grib_accessor_bitmap*)a; - grib_get_long_internal(hand, self->offsetbsec, &off); - grib_get_long_internal(hand, self->sLength, &slen); - - if (slen == 0) { - grib_accessor* seclen; - size_t size; - /* Assume reparsing */ - Assert(hand->loader != 0); - if (hand->loader != 0) { - seclen = grib_find_accessor(hand, self->sLength); - Assert(seclen); - grib_get_block_length(seclen->parent, &size); - slen = size; - } - } - - // printf("compute_size off=%ld slen=%ld a->offset=%ld\n", (long)off,(long)slen,(long)a->offset); - - a->length = off + (slen - a->offset); - - if (a->length < 0) { - /* Assume reparsing */ - /*Assert(hand->loader != 0);*/ - a->length = 0; - } - - Assert(a->length >= 0); -} - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_bitmap* self = (grib_accessor_bitmap*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int n = 0; - - self->tableReference = grib_arguments_get_name(hand, arg, n++); - self->missing_value = grib_arguments_get_name(hand, arg, n++); - self->offsetbsec = grib_arguments_get_name(hand, arg, n++); - self->sLength = grib_arguments_get_name(hand, arg, n++); - - compute_size(a); -} - -static long next_offset(grib_accessor* a) -{ - return grib_byte_offset(a) + grib_byte_count(a); -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - long len = 0; - char label[1024]; - - grib_value_count(a, &len); - - snprintf(label, 1024, "Bitmap of %ld values", len); - grib_dump_bytes(dumper, a, label); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - long pos = a->offset * 8; - long tlen = 0; - const grib_handle* hand = grib_handle_of_accessor(a); - - int err = grib_value_count(a, &tlen); - if (err) - return err; - - if (*len < tlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %ld values", a->name, tlen); - *len = tlen; - return GRIB_ARRAY_TOO_SMALL; - } - - for (long i = 0; i < tlen; i++) { - val[i] = (long)grib_decode_unsigned_long(hand->buffer->data, &pos, 1); - } - *len = tlen; - return GRIB_SUCCESS; -} - -template -static int unpack(grib_accessor* a, T* val, size_t* len) -{ - static_assert(std::is_floating_point::value, "Requires floating points numbers"); - long pos = a->offset * 8; - long tlen; - grib_handle* hand = grib_handle_of_accessor(a); - - int err = grib_value_count(a, &tlen); - if (err) - return err; - - if (*len < tlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %ld values", a->name, tlen); - *len = tlen; - return GRIB_ARRAY_TOO_SMALL; - } - - for (long i = 0; i < tlen; i++) { - val[i] = (T)grib_decode_unsigned_long(hand->buffer->data, &pos, 1); - } - *len = tlen; - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - return unpack(a, val, len); -} - -static int unpack_float(grib_accessor* a, float* val, size_t* len) -{ - return unpack(a, val, len); -} - -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) -{ - long pos = a->offset * 8; - - pos += idx; - *val = (double)grib_decode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, &pos, 1); - - return GRIB_SUCCESS; -} -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) -{ - for (size_t i=0; ilength = s; -} - -static size_t string_length(grib_accessor* a) -{ - return a->length; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_handle* hand = grib_handle_of_accessor(a); - const size_t l = a->length; - - if (*len < l) { - const char* cclass_name = a->cclass->name; - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, l, *len); - *len = l; - return GRIB_BUFFER_TOO_SMALL; - } - - for (long i = 0; i < a->length; i++) { - val[i] = hand->buffer->data[a->offset + i]; - } - - *len = a->length; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_bits_per_value.cc b/src/grib_accessor_class_bits_per_value.cc deleted file mode 100644 index 5648a9a69..000000000 --- a/src/grib_accessor_class_bits_per_value.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/********************************** - * Enrico Fucile - *********************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long; pack_long - IMPLEMENTS = init - MEMBERS = const char* values - MEMBERS = const char* bits_per_value - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bits_per_value -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in bits_per_value */ - const char* values; - const char* bits_per_value; -} grib_accessor_bits_per_value; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_bits_per_value = { - &grib_accessor_class_long, /* super */ - "bits_per_value", /* name */ - sizeof(grib_accessor_bits_per_value), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_bits_per_value = &_grib_accessor_class_bits_per_value; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* args) -{ - int n = 0; - grib_accessor_bits_per_value* self = (grib_accessor_bits_per_value*)a; - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->bits_per_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = 0; - grib_accessor_bits_per_value* self = (grib_accessor_bits_per_value*)a; - grib_handle* h = grib_handle_of_accessor(a); - - if ((ret = grib_get_long_internal(h, self->bits_per_value, val)) != GRIB_SUCCESS) - return ret; - - *len = 1; - return ret; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - double* values = NULL; - size_t size = 0; - int ret = 0; - grib_accessor_bits_per_value* self = (grib_accessor_bits_per_value*)a; - grib_context* c = a->context; - grib_handle* h = grib_handle_of_accessor(a); - - if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) - return ret; - - values = (double*)grib_context_malloc(c, size * sizeof(double)); - if (!values) - return GRIB_OUT_OF_MEMORY; - - if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - if ((ret = grib_set_long_internal(h, self->bits_per_value, *val)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - grib_context_free(c, values); - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_blob.cc b/src/grib_accessor_class_blob.cc deleted file mode 100644 index 7e1c1de62..000000000 --- a/src/grib_accessor_class_blob.cc +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = get_native_type;init - IMPLEMENTS = unpack_bytes;dump - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_bytes(grib_accessor*, unsigned char*, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_blob -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in blob */ -} grib_accessor_blob; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_blob = { - &grib_accessor_class_gen, /* super */ - "blob", /* name */ - sizeof(grib_accessor_blob), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - &unpack_bytes, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_blob = &_grib_accessor_class_blob; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_get_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, arg, 0), &a->length); - Assert(a->length >= 0); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_BYTES; -} - -static int unpack_bytes(grib_accessor* a, unsigned char* buffer, size_t* len) -{ - if (*len < (size_t)a->length) { - *len = a->length; - return GRIB_ARRAY_TOO_SMALL; - } - *len = a->length; - - memcpy(buffer, grib_handle_of_accessor(a)->buffer->data + a->offset, *len); - - return GRIB_SUCCESS; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_bytes(dumper, a, NULL); -} diff --git a/src/grib_accessor_class_budgdate.cc b/src/grib_accessor_class_budgdate.cc deleted file mode 100644 index 15fc9b4bd..000000000 --- a/src/grib_accessor_class_budgdate.cc +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init - MEMBERS=const char* year - MEMBERS=const char* month - MEMBERS=const char* day - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_budgdate -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in budgdate */ - const char* year; - const char* month; - const char* day; -} grib_accessor_budgdate; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_budgdate = { - &grib_accessor_class_long, /* super */ - "budgdate", /* name */ - sizeof(grib_accessor_budgdate), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_budgdate = &_grib_accessor_class_budgdate; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_budgdate* self = (grib_accessor_budgdate*)a; - int n = 0; - - self->year = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->month = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->day = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = 0; - grib_accessor_budgdate* self = (grib_accessor_budgdate*)a; - - long year = 0; - long month = 0; - long day = 0; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->day, &day)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->month, &month)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->year, &year)) != GRIB_SUCCESS) - return ret; - - if (*len < 1) - return GRIB_WRONG_ARRAY_SIZE; - - val[0] = (1900 + year) * 10000 + month * 100 + day; - - return ret; -} - -/* TODO: Check for a valid date */ -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - int ret = 0; - long v = val[0]; - grib_accessor_budgdate* self = (grib_accessor_budgdate*)a; - - long year = 0; - long month = 0; - long day = 0; - - if (*len != 1) - return GRIB_WRONG_ARRAY_SIZE; - - year = v / 10000; - v %= 10000; - month = v / 100; - v %= 100; - day = v; - - year -= 1900; - - Assert(year < 255); - - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->day, day)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->month, month)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->year, year)) != GRIB_SUCCESS) - return ret; - - return ret; -} diff --git a/src/grib_accessor_class_bufr_extract_subsets.cc b/src/grib_accessor_class_bufr_extract_subsets.cc deleted file mode 100644 index 567ceb61a..000000000 --- a/src/grib_accessor_class_bufr_extract_subsets.cc +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init; get_native_type - IMPLEMENTS = pack_long; - MEMBERS = const char* numericValues - MEMBERS = const char* pack - MEMBERS = grib_accessor* numericValuesAccessor - MEMBERS = grib_accessor* packAccessor - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bufr_extract_subsets -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bufr_extract_subsets */ - const char* numericValues; - const char* pack; - grib_accessor* numericValuesAccessor; - grib_accessor* packAccessor; -} grib_accessor_bufr_extract_subsets; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_bufr_extract_subsets = { - &grib_accessor_class_gen, /* super */ - "bufr_extract_subsets", /* name */ - sizeof(grib_accessor_bufr_extract_subsets), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_bufr_extract_subsets = &_grib_accessor_class_bufr_extract_subsets; - -/* END_CLASS_IMP */ - -static void get_accessors(grib_accessor* a) -{ - grib_accessor_bufr_extract_subsets* self = (grib_accessor_bufr_extract_subsets*)a; - const grib_handle* h = grib_handle_of_accessor(a); - - if (self->packAccessor) - return; - self->numericValuesAccessor = grib_find_accessor(h, self->numericValues); - self->packAccessor = grib_find_accessor(h, self->pack); -} - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - int n = 0; - grib_accessor_bufr_extract_subsets* self = (grib_accessor_bufr_extract_subsets*)a; - - a->length = 0; - self->numericValues = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); - self->pack = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_bufr_extract_subsets* self = (grib_accessor_bufr_extract_subsets*)a; - size_t l = 1; - long v[1]; - - get_accessors(a); - - v[0] = 1; - int err = grib_pack_long(self->packAccessor, v, &l); - if (err) { - if (err == GRIB_ENCODING_ERROR) - grib_context_log(a->context, GRIB_LOG_ERROR, "Could not extract subset(s).\n\tHint: Did you forget to set unpack=1?"); - return err; - } - - return err; -} diff --git a/src/grib_accessor_class_bufr_group.cc b/src/grib_accessor_class_bufr_group.cc deleted file mode 100644 index 9af0a5633..000000000 --- a/src/grib_accessor_class_bufr_group.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_variable - IMPLEMENTS = dump;next - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static void dump(grib_accessor*, grib_dumper*); -static grib_accessor* next(grib_accessor*, int); - -typedef struct grib_accessor_bufr_group -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in variable */ - double dval; - float fval; - char* cval; - char* cname; - int type; - /* Members defined in bufr_group */ -} grib_accessor_bufr_group; - -extern grib_accessor_class* grib_accessor_class_variable; - -static grib_accessor_class _grib_accessor_class_bufr_group = { - &grib_accessor_class_variable, /* super */ - "bufr_group", /* name */ - sizeof(grib_accessor_bufr_group), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - &next, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_bufr_group = &_grib_accessor_class_bufr_group; - -/* END_CLASS_IMP */ - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_section(dumper, a, a->sub_section->block); -} - -static grib_accessor* next(grib_accessor* a, int explore) -{ - grib_accessor* next = NULL; - if (explore) { - next = a->sub_section->block->first; - if (!next) - next = a->next; - } - else { - next = a->next; - } - if (!next) { - if (a->parent->owner) - next = a->parent->owner->cclass->next(a->parent->owner, 0); - } - return next; -} diff --git a/src/grib_accessor_class_bufr_simple_thinning.cc b/src/grib_accessor_class_bufr_simple_thinning.cc deleted file mode 100644 index cd0181fe4..000000000 --- a/src/grib_accessor_class_bufr_simple_thinning.cc +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init; get_native_type - IMPLEMENTS = pack_long; - MEMBERS = const char* doExtractSubsets - MEMBERS = const char* numberOfSubsets - MEMBERS = const char* extractSubsetList - MEMBERS = const char* simpleThinningStart - MEMBERS = const char* simpleThinningMissingRadius - MEMBERS = const char* simpleThinningSkip - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bufr_simple_thinning -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bufr_simple_thinning */ - const char* doExtractSubsets; - const char* numberOfSubsets; - const char* extractSubsetList; - const char* simpleThinningStart; - const char* simpleThinningMissingRadius; - const char* simpleThinningSkip; -} grib_accessor_bufr_simple_thinning; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_bufr_simple_thinning = { - &grib_accessor_class_gen, /* super */ - "bufr_simple_thinning", /* name */ - sizeof(grib_accessor_bufr_simple_thinning), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_bufr_simple_thinning = &_grib_accessor_class_bufr_simple_thinning; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_bufr_simple_thinning* self = (grib_accessor_bufr_simple_thinning*)a; - grib_handle* h = grib_handle_of_accessor(a); - int n = 0; - - a->length = 0; - self->doExtractSubsets = grib_arguments_get_name(h, arg, n++); - self->numberOfSubsets = grib_arguments_get_name(h, arg, n++); - self->extractSubsetList = grib_arguments_get_name(h, arg, n++); - self->simpleThinningStart = grib_arguments_get_name(h, arg, n++); - self->simpleThinningMissingRadius = grib_arguments_get_name(h, arg, n++); - self->simpleThinningSkip = grib_arguments_get_name(h, arg, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} - -static int apply_thinning(grib_accessor* a) -{ - const grib_accessor_bufr_simple_thinning* self = (grib_accessor_bufr_simple_thinning*)a; - - long skip; - grib_handle* h = grib_handle_of_accessor(a); - grib_context* c = h->context; - long compressed = 0, nsubsets; - grib_iarray* subsets; - long* subsets_ar = 0; - long start = 0, radius = 0; - - int ret = grib_get_long(h, "compressedData", &compressed); - if (ret) - return ret; - if (compressed) { - long numberOfSubsets = 0; - ret = grib_get_long(h, self->numberOfSubsets, &numberOfSubsets); - if (ret) - return ret; - - ret = grib_get_long(h, self->simpleThinningStart, &start); - if (ret) - return ret; - - ret = grib_get_long(h, self->simpleThinningSkip, &skip); - if (ret) - return ret; - if (skip <= 0) - return GRIB_INVALID_KEY_VALUE; - - ret = grib_get_long(h, self->simpleThinningMissingRadius, &radius); - if (ret) - return ret; - - subsets = grib_iarray_new(c, numberOfSubsets / skip + 1, 10); - for (long i = 0; i < numberOfSubsets; i += skip + 1) { - grib_iarray_push(subsets, i + 1); - } - - nsubsets = grib_iarray_used_size(subsets); - - if (nsubsets != 0) { - subsets_ar = grib_iarray_get_array(subsets); - ret = grib_set_long_array(h, self->extractSubsetList, subsets_ar, nsubsets); - grib_context_free(c, subsets_ar); - if (ret) - return ret; - - ret = grib_set_long(h, "unpack", 1); - if (ret) - return ret; - - ret = grib_set_long(h, self->doExtractSubsets, 1); - if (ret) - return ret; - } - grib_iarray_delete(subsets); - } - else { - return GRIB_NOT_IMPLEMENTED; - } - - return ret; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - const grib_accessor_bufr_simple_thinning* self = (grib_accessor_bufr_simple_thinning*)a; - - if (*len == 0) - return GRIB_SUCCESS; - int err = apply_thinning(a); - if (err) - return err; - - return grib_set_long(a->parent->h, self->doExtractSubsets, 1); -} diff --git a/src/grib_accessor_class_bufr_string_values.cc b/src/grib_accessor_class_bufr_string_values.cc deleted file mode 100644 index 02627e763..000000000 --- a/src/grib_accessor_class_bufr_string_values.cc +++ /dev/null @@ -1,189 +0,0 @@ -/* -* (C) Copyright 2005- ECMWF. -* -* This software is licensed under the terms of the Apache Licence Version 2.0 -* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -* -* 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. -*/ - -/* Sequences and replication (not delayed) are resolved in this class. - Number of elements to which a delayed replication applies are recomputed to - take account of the expansion. - Expanded descriptors cannot contain sequences and only delayed replication - can appear -*/ - -#include "grib_api_internal.h" -/* -This is used by make_class.pl - -START_CLASS_DEF -CLASS = accessor -SUPER = grib_accessor_class_ascii -IMPLEMENTS = unpack_string_array -IMPLEMENTS = unpack_string -IMPLEMENTS = init;dump;destroy -IMPLEMENTS = value_count -MEMBERS = const char* dataAccessorName -MEMBERS = grib_accessor* dataAccessor - -END_CLASS_DEF - -*/ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_string(grib_accessor*, char*, size_t* len); -static int unpack_string_array(grib_accessor*, char**, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bufr_string_values -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in bufr_string_values */ - const char* dataAccessorName; - grib_accessor* dataAccessor; -} grib_accessor_bufr_string_values; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_bufr_string_values = { - &grib_accessor_class_ascii, /* super */ - "bufr_string_values", /* name */ - sizeof(grib_accessor_bufr_string_values), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - &unpack_string_array, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_bufr_string_values = &_grib_accessor_class_bufr_string_values; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_bufr_string_values* self = (grib_accessor_bufr_string_values*)a; - int n = 0; - self->dataAccessorName = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->dataAccessor = NULL; - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string_array(dumper, a, NULL); -} - -static grib_accessor* get_accessor(grib_accessor* a) -{ - grib_accessor_bufr_string_values* self = (grib_accessor_bufr_string_values*)a; - if (!self->dataAccessor) { - self->dataAccessor = grib_find_accessor(grib_handle_of_accessor(a), self->dataAccessorName); - } - return self->dataAccessor; -} - -static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) -{ - grib_accessor* data = 0; - grib_context* c = a->context; - grib_vsarray* stringValues = NULL; - size_t l = 0, tl; - size_t i, j, n = 0; - char** b = buffer; - - data = get_accessor(a); - if (!data) - return GRIB_NOT_FOUND; - - stringValues = accessor_bufr_data_array_get_stringValues(data); - - n = grib_vsarray_used_size(stringValues); - - tl = 0; - for (j = 0; j < n; j++) { - l = grib_sarray_used_size(stringValues->v[j]); - tl += l; - - if (tl > *len) - return GRIB_ARRAY_TOO_SMALL; - - for (i = 0; i < l; i++) { - *(b++) = grib_context_strdup(c, stringValues->v[j]->v[i]); - } - } - *len = tl; - - return GRIB_SUCCESS; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int value_count(grib_accessor* a, long* rlen) -{ - grib_accessor* descriptors = get_accessor(a); - return grib_value_count(descriptors, rlen); -} - -static void destroy(grib_context* c, grib_accessor* a) -{ -} diff --git a/src/grib_accessor_class_bufrdc_expanded_descriptors.cc b/src/grib_accessor_class_bufrdc_expanded_descriptors.cc deleted file mode 100644 index 929e21724..000000000 --- a/src/grib_accessor_class_bufrdc_expanded_descriptors.cc +++ /dev/null @@ -1,206 +0,0 @@ -/* -* (C) Copyright 2005- ECMWF. -* -* This software is licensed under the terms of the Apache Licence Version 2.0 -* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. -* -* 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. -*/ - -/* Sequences and replication (not delayed) are resolved in this class. - Number of elements to which a delayed replication applies are recomputed to - take account of the expansion. - Expanded descriptors cannot contain sequences and only delayed replication - can appear -*/ - -#include "grib_api_internal.h" -/* -This is used by make_class.pl - -START_CLASS_DEF -CLASS = accessor -SUPER = grib_accessor_class_long -IMPLEMENTS = unpack_long -IMPLEMENTS = unpack_string_array -IMPLEMENTS = init;destroy -IMPLEMENTS = value_count -MEMBERS = const char* expandedDescriptors -MEMBERS = grib_accessor* expandedDescriptorsAccessor - -END_CLASS_DEF - -*/ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string_array(grib_accessor*, char**, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_bufrdc_expanded_descriptors -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in bufrdc_expanded_descriptors */ - const char* expandedDescriptors; - grib_accessor* expandedDescriptorsAccessor; -} grib_accessor_bufrdc_expanded_descriptors; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_bufrdc_expanded_descriptors = { - &grib_accessor_class_long, /* super */ - "bufrdc_expanded_descriptors", /* name */ - sizeof(grib_accessor_bufrdc_expanded_descriptors), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - &unpack_string_array, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_bufrdc_expanded_descriptors = &_grib_accessor_class_bufrdc_expanded_descriptors; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_bufrdc_expanded_descriptors* self = (grib_accessor_bufrdc_expanded_descriptors*)a; - int n = 0; - self->expandedDescriptors = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->expandedDescriptorsAccessor = 0; - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static grib_accessor* get_accessor(grib_accessor* a) -{ - grib_accessor_bufrdc_expanded_descriptors* self = (grib_accessor_bufrdc_expanded_descriptors*)a; - if (!self->expandedDescriptorsAccessor) { - self->expandedDescriptorsAccessor = grib_find_accessor(grib_handle_of_accessor(a), self->expandedDescriptors); - } - return self->expandedDescriptorsAccessor; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor* descriptors = 0; - size_t rlen = 0, l; - long lenall = 0; - size_t i = 0; - long* v = 0; - grib_context* c = a->context; - - descriptors = get_accessor(a); - if (!descriptors) return GRIB_NOT_FOUND; - - grib_value_count(a, &lenall); - v = (long*)grib_context_malloc_clear(c, sizeof(long) * lenall); - l = lenall; - grib_unpack_long(descriptors, v, &l); - - rlen = 0; - for (i = 0; i < l; i++) { - if ((v[i] < 100000 || v[i] > 221999)) - val[rlen++] = v[i]; - } - *len = rlen; - grib_context_free(c,v); - - return GRIB_SUCCESS; -} - -static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) -{ - int err = 0; - grib_accessor* descriptors = 0; - size_t l = 0; - long lenall = 0; - size_t i = 0; - long* v = 0; - char buf[25] = {0,}; - grib_context* c = a->context; - - descriptors = get_accessor(a); - if (!descriptors) return GRIB_NOT_FOUND; - - err = grib_value_count(a, &lenall); - if (err) return err; - l = lenall; - if (l > *len) return GRIB_ARRAY_TOO_SMALL; - - v = (long*)grib_context_malloc_clear(c, sizeof(long) * l); - err = grib_unpack_long(descriptors, v, &l); - if (err) return err; - - for (i = 0; i < l; i++) { - snprintf(buf, sizeof(buf), "%06ld", v[i]); - buffer[i] = grib_context_strdup(c, buf); - } - *len = l; - grib_context_free(c,v); - - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* rlen) -{ - grib_accessor* descriptors = get_accessor(a); - - return grib_value_count(descriptors, rlen); -} - -static void destroy(grib_context* c, grib_accessor* a) -{ -} diff --git a/src/grib_accessor_class_bytes.cc b/src/grib_accessor_class_bytes.cc deleted file mode 100644 index 71533095e..000000000 --- a/src/grib_accessor_class_bytes.cc +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = get_native_type;init - IMPLEMENTS = compare;unpack_string;pack_string - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_bytes -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ -} grib_accessor_bytes; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_bytes = { - &grib_accessor_class_gen, /* super */ - "bytes", /* name */ - sizeof(grib_accessor_bytes), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_bytes = &_grib_accessor_class_bytes; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - /*grib_accessor_signed* self = (grib_accessor_signed*)a; */ - a->length = len; - Assert(a->length >= 0); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_BYTES; -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - int retval = GRIB_SUCCESS; - - size_t alen = (size_t)grib_byte_count(a); - size_t blen = (size_t)grib_byte_count(b); - - if (alen != blen) - return GRIB_COUNT_MISMATCH; - - return retval; -} - -static int unpack_string(grib_accessor* a, char* v, size_t* len) -{ - unsigned char* p = NULL; - char* s = v; - long i = 0; - const long length = grib_byte_count(a); - const long slength = 2 * length; - - if (*len < (size_t)slength) { - *len = slength; - return GRIB_BUFFER_TOO_SMALL; - } - - p = grib_handle_of_accessor(a)->buffer->data + grib_byte_offset(a); - - for (i = 0; i < length; i++) { - snprintf(s, INT_MAX, "%02x", *(p++)); - s += 2; - } - - *len = slength; - - return GRIB_SUCCESS; -} - -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - /* The string representation (val) of the byte array will have two chars - * per byte e.g. 4C5B means the 2 bytes 0114 and 0133 in octal - * so has to be twice the length of the byte array - */ - int err = 0; - grib_accessor_class* super = *(a->cclass->super); - grib_context* c = a->context; - size_t nbytes = a->length; - const size_t expected_blen = nbytes; - const size_t expected_slen = 2 * expected_blen; - unsigned char* bytearray = NULL; - size_t i = 0, slen = strlen(val); - - if (slen != expected_slen || *len != expected_slen) { - grib_context_log(c, GRIB_LOG_ERROR, - "%s: Key %s is %lu bytes. Expected a string with %lu characters (actual length=%zu)", - __func__, a->name, expected_blen, expected_slen, *len); - return GRIB_WRONG_ARRAY_SIZE; - } - - bytearray = (unsigned char*)grib_context_malloc(c, nbytes * (sizeof(unsigned char))); - if (!bytearray) return GRIB_OUT_OF_MEMORY; - - for (i = 0; i < (slen/2); i++) { - unsigned int byteVal = 0; - if (sscanf(val + 2*i, "%02x", &byteVal) != 1) { - grib_context_log(c, GRIB_LOG_ERROR,"%s: Invalid hex byte specfication '%.2s'", __func__, val + 2*i); - grib_context_free(c, bytearray); - return GRIB_INVALID_KEY_VALUE; - } - Assert(byteVal < 256); - bytearray[i] = (int)byteVal; - } - - /* Forward to base class to pack the byte array */ - err = super->pack_bytes(a, bytearray, &nbytes); - grib_context_free(c, bytearray); - return err; -} diff --git a/src/grib_accessor_class_change_alternative_row_scanning.cc b/src/grib_accessor_class_change_alternative_row_scanning.cc deleted file mode 100644 index d8eef0eb4..000000000 --- a/src/grib_accessor_class_change_alternative_row_scanning.cc +++ /dev/null @@ -1,212 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = pack_long; - IMPLEMENTS = unpack_long - IMPLEMENTS = init;get_native_type - MEMBERS = const char* values - MEMBERS = const char* Ni - MEMBERS = const char* Nj - MEMBERS = const char* alternativeRowScanning - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_change_alternative_row_scanning -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in change_alternative_row_scanning */ - const char* values; - const char* Ni; - const char* Nj; - const char* alternativeRowScanning; -} grib_accessor_change_alternative_row_scanning; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_change_alternative_row_scanning = { - &grib_accessor_class_gen, /* super */ - "change_alternative_row_scanning", /* name */ - sizeof(grib_accessor_change_alternative_row_scanning), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_change_alternative_row_scanning = &_grib_accessor_class_change_alternative_row_scanning; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - int n = 0; - grib_accessor_change_alternative_row_scanning* self = (grib_accessor_change_alternative_row_scanning*)a; - - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->Ni = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->Nj = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->alternativeRowScanning = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - int err = 0; - grib_accessor_change_alternative_row_scanning* self = (grib_accessor_change_alternative_row_scanning*)a; - const grib_context* c = a->context; - grib_handle* h = grib_handle_of_accessor(a); - long i, j, jr, theEnd, Ni, Nj, k, kp, alternativeRowScanning; - size_t size = 0; - double* values = NULL; - double tmp = 0.0; - - if (*val == 0) - return 0; - - /* Make sure Ni / Nj are not missing */ - if (grib_is_missing(h, self->Ni, &err) && !err) { - grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: Key %s cannot be 'missing'!", self->Ni); - return GRIB_WRONG_GRID; - } - if (grib_is_missing(h, self->Nj, &err) && !err) { - grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: Key %s cannot be 'missing'!", self->Nj); - return GRIB_WRONG_GRID; - } - - if ((err = grib_get_long_internal(h, self->Ni, &Ni)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(h, self->Nj, &Nj)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long_internal(h, self->alternativeRowScanning, &alternativeRowScanning)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) - return err; - - if ( size > (size_t)(Ni * Nj) ) { - grib_context_log(c, GRIB_LOG_ERROR, "change_alternative_row_scanning: wrong values size!=Ni*Nj (%zu!=%ld*%ld)", size, Ni, Nj); - return GRIB_WRONG_ARRAY_SIZE; - } - - values = (double*)grib_context_malloc(c, size * sizeof(double)); - if (!values) - return GRIB_OUT_OF_MEMORY; - - if ((err = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return err; - } - - theEnd = Ni / 2; - for (j = 0; j < Nj; j++) { - jr = Ni * j; - for (i = 0; i < theEnd; i++) { - if (j % 2 == 1) { - /* Swap first and last value on every odd row */ - k = jr + i; - kp = jr + Ni - i - 1; - tmp = values[k]; - values[k] = values[kp]; - values[kp] = tmp; - } - } - } - alternativeRowScanning = !alternativeRowScanning; - if ((err = grib_set_long_internal(h, self->alternativeRowScanning, alternativeRowScanning)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return err; - } - - if ((err = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return err; - } - - grib_context_free(c, values); - - return GRIB_SUCCESS; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} - -static int unpack_long(grib_accessor* a, long* v, size_t* len) -{ - /* Decoding this accessor doesn't make sense so we return a dummy value */ - *v = -1; - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_check_internal_version.cc b/src/grib_accessor_class_check_internal_version.cc deleted file mode 100644 index d59f353de..000000000 --- a/src/grib_accessor_class_check_internal_version.cc +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_ascii - IMPLEMENTS = value_count;string_length - IMPLEMENTS = init - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_check_internal_version -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in check_internal_version */ -} grib_accessor_check_internal_version; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_check_internal_version = { - &grib_accessor_class_ascii, /* super */ - "check_internal_version", /* name */ - sizeof(grib_accessor_check_internal_version), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_check_internal_version = &_grib_accessor_class_check_internal_version; - -/* END_CLASS_IMP */ - -/* This is the internal engine version number */ -/* We check this against the version number found in the definitions boot.def file */ -/* See the key "internalVersion" */ -#define LATEST_ENGINE_VERSION 30 - -static void init(grib_accessor* a, const long l, grib_arguments* args) -{ - /* Check version of definition files is compatible with the engine */ - int err = 0; - long defs_file_version = 0; - grib_handle* h = grib_handle_of_accessor(a); - const char* s_defn_version = grib_arguments_get_name(h, args, 0); - Assert(s_defn_version); - - err = grib_get_long_internal(h, s_defn_version, &defs_file_version); - if (!err) { - if (defs_file_version > LATEST_ENGINE_VERSION) { - grib_context_log(h->context, GRIB_LOG_FATAL, - "Definition files version (%d) is greater than engine version (%d)!\n" - " " /* indent for 2nd line */ - "These definition files are for a later version of the ecCodes engine.", - defs_file_version, LATEST_ENGINE_VERSION); - } - } -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - return 255; -} diff --git a/src/grib_accessor_class_codeflag.cc b/src/grib_accessor_class_codeflag.cc deleted file mode 100644 index ab86a64b1..000000000 --- a/src/grib_accessor_class_codeflag.cc +++ /dev/null @@ -1,216 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/**************************************** - * Enrico Fucile - **************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_unsigned - IMPLEMENTS = init;dump - IMPLEMENTS = value_count - MEMBERS = const char* tablename - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_codeflag -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in codeflag */ - const char* tablename; -} grib_accessor_codeflag; - -extern grib_accessor_class* grib_accessor_class_unsigned; - -static grib_accessor_class _grib_accessor_class_codeflag = { - &grib_accessor_class_unsigned, /* super */ - "codeflag", /* name */ - sizeof(grib_accessor_codeflag), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_codeflag = &_grib_accessor_class_codeflag; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* param) -{ - grib_accessor_codeflag* self = (grib_accessor_codeflag*)a; - a->length = len; - self->tablename = grib_arguments_get_string(grib_handle_of_accessor(a), param, 0); - Assert(a->length >= 0); -} - -static int test_bit(long a, long b) -{ - DEBUG_ASSERT(b>=0); - return a & (1 << b); -} - -static int grib_get_codeflag(grib_accessor* a, long code, char* codename) -{ - const grib_accessor_codeflag* self = (grib_accessor_codeflag*)a; - FILE* f = NULL; - char fname[1024]; - char bval[50]; - char num[50]; - char* filename = 0; - char line[1024]; - size_t i = 0; - int j = 0; - int err = 0; - - err = grib_recompose_name(grib_handle_of_accessor(a), NULL, self->tablename, fname, 1); - if (err) { - strncpy(fname, self->tablename, sizeof(fname)-1); - fname[sizeof(fname)-1] = '\0'; - } - - if ((filename = grib_context_full_defs_path(a->context, fname)) == NULL) { - grib_context_log(a->context, GRIB_LOG_WARNING, "Cannot open flag table %s", filename); - strcpy(codename, "Cannot open flag table"); - return GRIB_FILE_NOT_FOUND; - } - - f = codes_fopen(filename, "r"); - if (!f) { - grib_context_log(a->context, (GRIB_LOG_WARNING) | (GRIB_LOG_PERROR), "Cannot open flag table %s", filename); - strcpy(codename, "Cannot open flag table"); - return GRIB_FILE_NOT_FOUND; - } - - // strcpy(codename, self->tablename); - // strcat(codename,": "); - // j = strlen(codename); - - while (fgets(line, sizeof(line) - 1, f)) { - sscanf(line, "%49s %49s", num, bval); - - if (num[0] != '#') { - if ((test_bit(code, a->length * 8 - atol(num)) > 0) == atol(bval)) { - size_t linelen = strlen(line); - codename[j++] = '('; - codename[j++] = num[0]; - codename[j++] = '='; - codename[j++] = bval[0]; - codename[j++] = ')'; - codename[j++] = ' '; - if (j) - codename[j++] = ' '; - - for (i = (strlen(num) + strlen(bval) + 2); i < linelen - 1; i++) - codename[j++] = line[i]; - if (line[i] != '\n') - codename[j++] = line[i]; - codename[j++] = ';'; - } - } - } - - if (j > 1 && codename[j - 1] == ';') - j--; - codename[j] = 0; - - strcat(codename, ":"); - strcat(codename, fname); - - fclose(f); - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - const grib_accessor_codeflag* self = (grib_accessor_codeflag*)a; - long v = 0; - char flagname[1024] = {0,}; - char fname[1024] = {0,}; - - size_t llen = 1; - - grib_recompose_name(grib_handle_of_accessor(a), NULL, self->tablename, fname, 1); - grib_unpack_long(a, &v, &llen); - - grib_get_codeflag(a, v, flagname); - - grib_dump_bits(dumper, a, flagname); -} diff --git a/src/grib_accessor_class_codetable_title.cc b/src/grib_accessor_class_codetable_title.cc deleted file mode 100644 index 2ddd0f3cb..000000000 --- a/src/grib_accessor_class_codetable_title.cc +++ /dev/null @@ -1,171 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;unpack_string; get_native_type - MEMBERS = const char* codetable - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_codetable_title -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in codetable_title */ - const char* codetable; -} grib_accessor_codetable_title; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_codetable_title = { - &grib_accessor_class_gen, /* super */ - "codetable_title", /* name */ - sizeof(grib_accessor_codetable_title), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_codetable_title = &_grib_accessor_class_codetable_title; - -/* END_CLASS_IMP */ - -typedef struct grib_accessor_codetable -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in codetable */ - const char* tablename; - const char* masterDir; - const char* localDir; - grib_codetable* table; -} grib_accessor_codetable; - - -static void init(grib_accessor* a, const long len, grib_arguments* params) -{ - grib_accessor_codetable_title* self = (grib_accessor_codetable_title*)a; - int n = 0; - self->codetable = grib_arguments_get_name(grib_handle_of_accessor(a), params, n++); - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -static int unpack_string(grib_accessor* a, char* buffer, size_t* len) -{ - grib_accessor_codetable_title* self = (grib_accessor_codetable_title*)a; - grib_codetable* table = NULL; - - size_t size = 1; - long value; - int err = GRIB_SUCCESS; - char tmp[1024]; - size_t l = 1024; - grib_accessor_codetable* ca = (grib_accessor_codetable*)grib_find_accessor(grib_handle_of_accessor(a), self->codetable); - - if ((err = grib_unpack_long((grib_accessor*)ca, &value, &size)) != GRIB_SUCCESS) - return err; - - table = ca->table; - - if (table && (value >= 0) && (value < table->size) && table->entries[value].title) { - strcpy(tmp, table->entries[value].title); - } - else { - snprintf(tmp, sizeof(tmp), "%d", (int)value); - } - - l = strlen(tmp) + 1; - - if (*len < l) { - const char* cclass_name = a->cclass->name; - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, l, *len); - *len = l; - return GRIB_BUFFER_TOO_SMALL; - } - - strcpy(buffer, tmp); - *len = l; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_codetable_units.cc b/src/grib_accessor_class_codetable_units.cc deleted file mode 100644 index de9a9655f..000000000 --- a/src/grib_accessor_class_codetable_units.cc +++ /dev/null @@ -1,171 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;unpack_string; get_native_type - MEMBERS = const char* codetable - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_codetable_units -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in codetable_units */ - const char* codetable; -} grib_accessor_codetable_units; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_codetable_units = { - &grib_accessor_class_gen, /* super */ - "codetable_units", /* name */ - sizeof(grib_accessor_codetable_units), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_codetable_units = &_grib_accessor_class_codetable_units; - -/* END_CLASS_IMP */ - -typedef struct grib_accessor_codetable -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in codetable */ - const char* tablename; - const char* masterDir; - const char* localDir; - grib_codetable* table; -} grib_accessor_codetable; - -static void init(grib_accessor* a, const long len, grib_arguments* params) -{ - grib_accessor_codetable_units* self = (grib_accessor_codetable_units*)a; - - int n = 0; - self->codetable = grib_arguments_get_name(grib_handle_of_accessor(a), params, n++); - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -static int unpack_string(grib_accessor* a, char* buffer, size_t* len) -{ - grib_accessor_codetable_units* self = (grib_accessor_codetable_units*)a; - grib_codetable* table = NULL; - - size_t size = 1; - long value; - int err = GRIB_SUCCESS; - char tmp[1024]; - size_t l = sizeof(tmp); - grib_accessor_codetable* ca = (grib_accessor_codetable*)grib_find_accessor(grib_handle_of_accessor(a), self->codetable); - - if ((err = grib_unpack_long((grib_accessor*)ca, &value, &size)) != GRIB_SUCCESS) - return err; - - table = ca->table; - - if (table && (value >= 0) && (value < table->size) && table->entries[value].units) { - strcpy(tmp, table->entries[value].units); - } - else { - snprintf(tmp, sizeof(tmp), "%d", (int)value); - } - - l = strlen(tmp) + 1; - - if (*len < l) { - const char* cclass_name = a->cclass->name; - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, l, *len); - *len = l; - return GRIB_BUFFER_TOO_SMALL; - } - - strcpy(buffer, tmp); - *len = l; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_constant.cc b/src/grib_accessor_class_constant.cc deleted file mode 100644 index b54de5b88..000000000 --- a/src/grib_accessor_class_constant.cc +++ /dev/null @@ -1,111 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - - -/************************************* - * Enrico Fucile - **************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_variable - IMPLEMENTS = init - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_constant -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in variable */ - double dval; - float fval; - char* cval; - char* cname; - int type; - /* Members defined in constant */ -} grib_accessor_constant; - -extern grib_accessor_class* grib_accessor_class_variable; - -static grib_accessor_class _grib_accessor_class_constant = { - &grib_accessor_class_variable, /* super */ - "constant", /* name */ - sizeof(grib_accessor_constant), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_constant = &_grib_accessor_class_constant; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} diff --git a/src/grib_accessor_class_count_file.cc b/src/grib_accessor_class_count_file.cc deleted file mode 100644 index 196a48038..000000000 --- a/src/grib_accessor_class_count_file.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/*********************************************** - * Enrico Fucile - **********************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_count_file -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in count_file */ -} grib_accessor_count_file; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_count_file = { - &grib_accessor_class_long, /* super */ - "count_file", /* name */ - sizeof(grib_accessor_count_file), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_count_file = &_grib_accessor_class_count_file; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - *val = grib_context_get_handle_file_count(a->context); - *len = 1; - return 0; -} diff --git a/src/grib_accessor_class_count_total.cc b/src/grib_accessor_class_count_total.cc deleted file mode 100644 index 022cc4998..000000000 --- a/src/grib_accessor_class_count_total.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - - -/*************************************************** - * Enrico Fucile - **************************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_count_total -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in count_total */ -} grib_accessor_count_total; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_count_total = { - &grib_accessor_class_long, /* super */ - "count_total", /* name */ - sizeof(grib_accessor_count_total), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_count_total = &_grib_accessor_class_count_total; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - *val = grib_context_get_handle_total_count(a->context); - *len = 1; - return 0; -} diff --git a/src/grib_accessor_class_data_dummy_field.cc b/src/grib_accessor_class_data_dummy_field.cc deleted file mode 100644 index 65b6d5a8f..000000000 --- a/src/grib_accessor_class_data_dummy_field.cc +++ /dev/null @@ -1,219 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_g1simple_packing - IMPLEMENTS = init - IMPLEMENTS = unpack_double - IMPLEMENTS = value_count - IMPLEMENTS = pack_double - MEMBERS=const char* missing_value - MEMBERS=const char* numberOfPoints - MEMBERS=const char* bitmap - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_dummy_field -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_g1simple_packing */ - const char* half_byte; - const char* packingType; - const char* ieee_packing; - const char* precision; - /* Members defined in data_dummy_field */ - const char* missing_value; - const char* numberOfPoints; - const char* bitmap; -} grib_accessor_data_dummy_field; - -extern grib_accessor_class* grib_accessor_class_data_g1simple_packing; - -static grib_accessor_class _grib_accessor_class_data_dummy_field = { - &grib_accessor_class_data_g1simple_packing, /* super */ - "data_dummy_field", /* name */ - sizeof(grib_accessor_data_dummy_field), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_dummy_field = &_grib_accessor_class_data_dummy_field; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_dummy_field* self = (grib_accessor_data_dummy_field*)a; - self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->numberOfPoints = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_dummy_field* self = (grib_accessor_data_dummy_field*)a; - size_t i = 0, n_vals = 0; - long numberOfPoints; - double missing_value = 0; - int err = 0; - - if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, &numberOfPoints)) != GRIB_SUCCESS) - return err; - n_vals = numberOfPoints; - - if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &missing_value)) != GRIB_SUCCESS) - return err; - - if (*len < n_vals) { - *len = n_vals; - return GRIB_ARRAY_TOO_SMALL; - } - - for (i = 0; i < n_vals; i++) - val[i] = missing_value; - - if (grib_find_accessor(grib_handle_of_accessor(a), self->bitmap)) { - if ((err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->bitmap, val, n_vals)) != GRIB_SUCCESS) - return err; - } - - *len = (long)n_vals; - return err; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_dummy_field* self = (grib_accessor_data_dummy_field*)a; - - size_t n_vals = *len; - int err = 0; - long bits_per_value = 0; - long half_byte = 0; - size_t buflen = 0; - unsigned char* buf = NULL; - - if (*len == 0) - return GRIB_NO_VALUES; - - if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->bits_per_value, &bits_per_value)) != GRIB_SUCCESS) - return err; - - buflen = (1 + ((bits_per_value * n_vals) / 8)) * sizeof(unsigned char); - - buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen); - if (!buf) - return GRIB_OUT_OF_MEMORY; - - half_byte = (buflen * 8) - ((*len) * bits_per_value); - - if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->half_byte, half_byte)) != GRIB_SUCCESS) { - grib_context_free(a->context, buf); - return err; - } - grib_buffer_replace(a, buf, buflen, 1, 1); - - grib_context_free(a->context, buf); - - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* numberOfPoints) -{ - grib_accessor_data_dummy_field* self = (grib_accessor_data_dummy_field*)a; - int err = 0; - *numberOfPoints = 0; - - if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, numberOfPoints)) != GRIB_SUCCESS) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to get count of %s (%s)", a->name, grib_get_error_message(err)); - } - - return err; -} diff --git a/src/grib_accessor_class_data_g1complex_packing.cc b/src/grib_accessor_class_data_g1complex_packing.cc deleted file mode 100644 index 6c8fa5cd6..000000000 --- a/src/grib_accessor_class_data_g1complex_packing.cc +++ /dev/null @@ -1,235 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_complex_packing - IMPLEMENTS = pack_double - IMPLEMENTS = init - MEMBERS= const char* N - MEMBERS=const char* half_byte - MEMBERS=const char* packingType - MEMBERS=const char* ieee_packing - MEMBERS=const char* precision - END_CLASS_DEF - - */ - - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g1complex_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_complex_packing */ - const char* GRIBEX_sh_bug_present; - const char* ieee_floats; - const char* laplacianOperatorIsSet; - const char* laplacianOperator; - const char* sub_j; - const char* sub_k; - const char* sub_m; - const char* pen_j; - const char* pen_k; - const char* pen_m; - /* Members defined in data_g1complex_packing */ - const char* N; - const char* half_byte; - const char* packingType; - const char* ieee_packing; - const char* precision; -} grib_accessor_data_g1complex_packing; - -extern grib_accessor_class* grib_accessor_class_data_complex_packing; - -static grib_accessor_class _grib_accessor_class_data_g1complex_packing = { - &grib_accessor_class_data_complex_packing, /* super */ - "data_g1complex_packing", /* name */ - sizeof(grib_accessor_data_g1complex_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_g1complex_packing = &_grib_accessor_class_data_g1complex_packing; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g1complex_packing* self = (grib_accessor_data_g1complex_packing*)a; - self->half_byte = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->N = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->packingType = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->ieee_packing = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->edition = 1; - a->flags |= GRIB_ACCESSOR_FLAG_DATA; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_g1complex_packing* self = (grib_accessor_data_g1complex_packing*)a; - int ret = GRIB_SUCCESS; - long seclen = 0; - long sub_j = 0; - long sub_k = 0; - long sub_m = 0; - long n = 0; - long half_byte = 0; - long bits_per_value = 0; - size_t buflen = 0; - grib_accessor_class* super = *(a->cclass->super); - - if (*len == 0) - return GRIB_NO_VALUES; - -// /* TODO: spectral_ieee does not work */ -// if (c->ieee_packing && self->ieee_packing) { -// grib_handle* h = grib_handle_of_accessor(a); -// grib_context* c = a->context; -// char* packingType_s = NULL; -// char* ieee_packing_s = NULL; -// long precision = c->ieee_packing == 32 ? 1 : 2; -// size_t lenstr = strlen(self->ieee_packing); - -// packingType_s = grib_context_strdup(c, self->packingType); -// ieee_packing_s = grib_context_strdup(c, self->ieee_packing); -// precision_s = grib_context_strdup(c, self->precision); - -// grib_set_string(h, packingType_s, ieee_packing_s, &lenstr); -// grib_set_long(h, precision_s, precision); - -// grib_context_free(c, packingType_s); -// grib_context_free(c, ieee_packing_s); -// grib_context_free(c, precision_s); -// return grib_set_double_array(h, "values", val, *len); -// } - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->sub_j, &sub_j)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->sub_k, &sub_k)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->sub_m, &sub_m)) != GRIB_SUCCESS) - return ret; - - self->dirty = 1; - - Assert((sub_j == sub_k) && (sub_m == sub_j)); - - ret = super->pack_double(a, val, len); - - if (ret == GRIB_SUCCESS) { - n = a->offset + 4 * ((sub_k + 1) * (sub_k + 2)); - - /* Octet number starts from beginning of message but shouldn't */ - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->N, n)) != GRIB_SUCCESS) - return ret; - - // ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetsection, &offsetsection); - // if (ret != GRIB_SUCCESS) - // return ret; - // if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->N, n - offsetsection)) != GRIB_SUCCESS) - // return ret; - - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bits_per_value, &bits_per_value); - if (ret != GRIB_SUCCESS) - return ret; - - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->seclen, &seclen); - if (ret != GRIB_SUCCESS) - return ret; - - buflen = 32 * (sub_k + 1) * (sub_k + 2) + (*len - (sub_k + 1) * (sub_k + 2)) * bits_per_value + 18 * 8; - half_byte = seclen * 8 - buflen; - if (a->context->debug == -1) { - fprintf(stderr, "ECCODES DEBUG: half_byte=%ld\n", half_byte); - } - - ret = grib_set_long_internal(grib_handle_of_accessor(a), self->half_byte, half_byte); - if (ret != GRIB_SUCCESS) - return ret; - } - return ret; -} diff --git a/src/grib_accessor_class_data_g1secondary_bitmap.cc b/src/grib_accessor_class_data_g1secondary_bitmap.cc deleted file mode 100644 index 4ae89c576..000000000 --- a/src/grib_accessor_class_data_g1secondary_bitmap.cc +++ /dev/null @@ -1,220 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_secondary_bitmap - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - MEMBERS=const char* number_of_ones - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g1secondary_bitmap -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in data_secondary_bitmap */ - const char* primary_bitmap; - const char* secondary_bitmap; - const char* missing_value; - const char* expand_by; - /* Members defined in data_g1secondary_bitmap */ - const char* number_of_ones; -} grib_accessor_data_g1secondary_bitmap; - -extern grib_accessor_class* grib_accessor_class_data_secondary_bitmap; - -static grib_accessor_class _grib_accessor_class_data_g1secondary_bitmap = { - &grib_accessor_class_data_secondary_bitmap, /* super */ - "data_g1secondary_bitmap", /* name */ - sizeof(grib_accessor_data_g1secondary_bitmap), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_g1secondary_bitmap = &_grib_accessor_class_data_g1secondary_bitmap; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g1secondary_bitmap* self = (grib_accessor_data_g1secondary_bitmap*)a; - self->number_of_ones = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4); -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_data_g1secondary_bitmap* self = (grib_accessor_data_g1secondary_bitmap*)a; - size_t len = 0; - int err = 0; - long expand_by; - *count = 0; - - err = grib_get_long_internal(grib_handle_of_accessor(a), self->expand_by, &expand_by); - if (err) - return err; - - err = grib_get_size(grib_handle_of_accessor(a), self->primary_bitmap, &len); - if (err) - return err; - - *count = expand_by * len; - return GRIB_SUCCESS; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_g1secondary_bitmap* self = (grib_accessor_data_g1secondary_bitmap*)a; - - int err = 0; - - long primary_len = 0; - long secondary_len = 0; - double* primary_bitmap = NULL; - double* secondary_bitmap = NULL; - long i = 0; - long j = 0; - long on = 0; - long k; - long m; - double missing_value = 0; - double present_value = 0; - long expand_by = 0; - - if (*len == 0) - return GRIB_NO_VALUES; - - if ((err = grib_get_long(grib_handle_of_accessor(a), self->expand_by, &expand_by)) != GRIB_SUCCESS) - return err; - if (expand_by <= 0) - return GRIB_ENCODING_ERROR; - - if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &missing_value)) != GRIB_SUCCESS) - return err; - - if (*len % expand_by) { - /*TODO: issue warning */ - return GRIB_ENCODING_ERROR; - } - - primary_len = *len / expand_by; - primary_bitmap = (double*)grib_context_malloc_clear(a->context, primary_len * sizeof(double)); - if (!primary_bitmap) - return GRIB_OUT_OF_MEMORY; - - secondary_len = *len; - secondary_bitmap = (double*)grib_context_malloc_clear(a->context, secondary_len * sizeof(double)); - if (!secondary_bitmap) { - grib_context_free(a->context, primary_bitmap); - return GRIB_OUT_OF_MEMORY; - } - - if (missing_value == 0) - present_value = 1; - else - present_value = 0; - - k = 0; - m = 0; - for (i = 0; i < *len; i += expand_by) { - int cnt = 0; - for (j = 0; j < expand_by; j++) - if (val[i + j] == missing_value) - cnt++; - - if (cnt == expand_by) /* all expand_by values are missing */ - primary_bitmap[k++] = missing_value; - else { - primary_bitmap[k++] = present_value; - for (j = 0; j < expand_by; j++) - secondary_bitmap[m++] = val[i + j]; - on++; - } - } - - *len = k; - - /*printf("QQQQQQQ %ld %ld second=%ld\n",primary_len,on,m);*/ - Assert(k == primary_len); - - err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->primary_bitmap, primary_bitmap, k); - if (err == GRIB_SUCCESS) - err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->secondary_bitmap, secondary_bitmap, m); - - grib_context_free(a->context, primary_bitmap); - grib_context_free(a->context, secondary_bitmap); - - if (err == GRIB_SUCCESS) - err = grib_set_long_internal(grib_handle_of_accessor(a), self->number_of_ones, on); - - return err; -} diff --git a/src/grib_accessor_class_data_g1shsimple_packing.cc b/src/grib_accessor_class_data_g1shsimple_packing.cc deleted file mode 100644 index 332b0af0c..000000000 --- a/src/grib_accessor_class_data_g1shsimple_packing.cc +++ /dev/null @@ -1,150 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_shsimple_packing - IMPLEMENTS = unpack_double - IMPLEMENTS = value_count - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); - -typedef struct grib_accessor_data_g1shsimple_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in data_shsimple_packing */ - const char* coded_values; - const char* real_part; - int dirty; - /* Members defined in data_g1shsimple_packing */ -} grib_accessor_data_g1shsimple_packing; - -extern grib_accessor_class* grib_accessor_class_data_shsimple_packing; - -static grib_accessor_class _grib_accessor_class_data_g1shsimple_packing = { - &grib_accessor_class_data_shsimple_packing, /* super */ - "data_g1shsimple_packing", /* name */ - sizeof(grib_accessor_data_g1shsimple_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_g1shsimple_packing = &_grib_accessor_class_data_g1shsimple_packing; - -/* END_CLASS_IMP */ - - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_data_g1shsimple_packing* self = (grib_accessor_data_g1shsimple_packing*)a; - size_t len = 0; - int err = 0; - - err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &len); - len += 1; - - *count = len; - return err; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_g1shsimple_packing* self = (grib_accessor_data_g1shsimple_packing*)a; - int err = GRIB_SUCCESS; - - size_t coded_n_vals = 0; - size_t n_vals = 0; - - if ((err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &coded_n_vals)) != GRIB_SUCCESS) - return err; - - n_vals = coded_n_vals + 1; - - if (*len < n_vals) { - *len = n_vals; - return GRIB_ARRAY_TOO_SMALL; - } - - if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->real_part, val)) != GRIB_SUCCESS) - return err; - - val++; - - if ((err = grib_get_double_array_internal(grib_handle_of_accessor(a), self->coded_values, val, &coded_n_vals)) != GRIB_SUCCESS) - return err; - - grib_context_log(a->context, GRIB_LOG_DEBUG, - "grib_accessor_data_g1shsimple_packing_bitmap : unpack_double : creating %s, %d values", - a->name, n_vals); - - *len = n_vals; - - return err; -} diff --git a/src/grib_accessor_class_data_g2complex_packing.cc b/src/grib_accessor_class_data_g2complex_packing.cc deleted file mode 100644 index 98bcaf5cc..000000000 --- a/src/grib_accessor_class_data_g2complex_packing.cc +++ /dev/null @@ -1,164 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_complex_packing - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - IMPLEMENTS = init - MEMBERS=const char* numberOfValues - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g2complex_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_complex_packing */ - const char* GRIBEX_sh_bug_present; - const char* ieee_floats; - const char* laplacianOperatorIsSet; - const char* laplacianOperator; - const char* sub_j; - const char* sub_k; - const char* sub_m; - const char* pen_j; - const char* pen_k; - const char* pen_m; - /* Members defined in data_g2complex_packing */ - const char* numberOfValues; -} grib_accessor_data_g2complex_packing; - -extern grib_accessor_class* grib_accessor_class_data_complex_packing; - -static grib_accessor_class _grib_accessor_class_data_g2complex_packing = { - &grib_accessor_class_data_complex_packing, /* super */ - "data_g2complex_packing", /* name */ - sizeof(grib_accessor_data_g2complex_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_g2complex_packing = &_grib_accessor_class_data_g2complex_packing; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g2complex_packing* self = (grib_accessor_data_g2complex_packing*)a; - self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->edition = 2; - - a->flags |= GRIB_ACCESSOR_FLAG_DATA; -} - -static int value_count(grib_accessor* a, long* numberOfValues) -{ - grib_accessor_data_g2complex_packing* self = (grib_accessor_data_g2complex_packing*)a; - *numberOfValues = 0; - - return grib_get_long(grib_handle_of_accessor(a), self->numberOfValues, numberOfValues); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_g2complex_packing* self = (grib_accessor_data_g2complex_packing*)a; - int ret = GRIB_SUCCESS; - grib_accessor_class* super = *(a->cclass->super); - - if (*len == 0) - return GRIB_NO_VALUES; - - ret = super->pack_double(a, val, len); - - if (ret == GRIB_SUCCESS) - ret = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfValues, *len); - - return ret; -} diff --git a/src/grib_accessor_class_data_g2secondary_bitmap.cc b/src/grib_accessor_class_data_g2secondary_bitmap.cc deleted file mode 100644 index cceb3d765..000000000 --- a/src/grib_accessor_class_data_g2secondary_bitmap.cc +++ /dev/null @@ -1,199 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_secondary_bitmap - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - MEMBERS=const char* number_of_values - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g2secondary_bitmap -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in data_secondary_bitmap */ - const char* primary_bitmap; - const char* secondary_bitmap; - const char* missing_value; - const char* expand_by; - /* Members defined in data_g2secondary_bitmap */ - const char* number_of_values; -} grib_accessor_data_g2secondary_bitmap; - -extern grib_accessor_class* grib_accessor_class_data_secondary_bitmap; - -static grib_accessor_class _grib_accessor_class_data_g2secondary_bitmap = { - &grib_accessor_class_data_secondary_bitmap, /* super */ - "data_g2secondary_bitmap", /* name */ - sizeof(grib_accessor_data_g2secondary_bitmap), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_g2secondary_bitmap = &_grib_accessor_class_data_g2secondary_bitmap; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g2secondary_bitmap* self = (grib_accessor_data_g2secondary_bitmap*)a; - self->number_of_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, 4); -} - -static int value_count(grib_accessor* a, long* len) -{ - grib_accessor_data_g2secondary_bitmap* self = (grib_accessor_data_g2secondary_bitmap*)a; - *len = 0; - return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, len); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_g2secondary_bitmap* self = (grib_accessor_data_g2secondary_bitmap*)a; - int err = 0; - - long primary_len = 0, secondary_len = 0; - double* primary_bitmap = NULL; - double* secondary_bitmap = NULL; - long i = 0, j = 0, k = 0, m = 0; - double missing_value = 0, present_value = 0; - long expand_by = 0; - - if (*len == 0) - return GRIB_NO_VALUES; - - if ((err = grib_get_long(grib_handle_of_accessor(a), self->expand_by, &expand_by)) != GRIB_SUCCESS) - return err; - if (expand_by <= 0) - return GRIB_ENCODING_ERROR; - - if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &missing_value)) != GRIB_SUCCESS) - return err; - - if (*len % expand_by) { - /*TODO: issue warning */ - return GRIB_ENCODING_ERROR; - } - - primary_len = *len / expand_by; - primary_bitmap = (double*)grib_context_malloc_clear(a->context, primary_len * sizeof(double)); - if (!primary_bitmap) - return GRIB_OUT_OF_MEMORY; - - secondary_len = *len; - secondary_bitmap = (double*)grib_context_malloc_clear(a->context, secondary_len * sizeof(double)); - if (!secondary_bitmap) { - grib_context_free(a->context, primary_bitmap); - return GRIB_OUT_OF_MEMORY; - } - - if (missing_value == 0) - present_value = 1; - else - present_value = 0; - - k = 0; - m = 0; - for (i = 0; i < *len; i += expand_by) { - int cnt = 0; - for (j = 0; j < expand_by; j++) - if (val[i + j] == missing_value) - cnt++; - - if (cnt == expand_by) /* all expand_by values are missing */ - primary_bitmap[k++] = missing_value; - else { - primary_bitmap[k++] = present_value; - for (j = 0; j < expand_by; j++) - secondary_bitmap[m++] = val[i + j]; - //on++; - } - } - - *len = k; - - Assert(k == primary_len); - - err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->primary_bitmap, primary_bitmap, k); - if (err == GRIB_SUCCESS) - err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->secondary_bitmap, secondary_bitmap, m); - - grib_context_free(a->context, primary_bitmap); - grib_context_free(a->context, secondary_bitmap); - - if (err == GRIB_SUCCESS) - err = grib_set_long_internal(grib_handle_of_accessor(a), self->number_of_values, *len * expand_by); - - return err; -} diff --git a/src/grib_accessor_class_data_g2shsimple_packing.cc b/src/grib_accessor_class_data_g2shsimple_packing.cc deleted file mode 100644 index bdb1157cf..000000000 --- a/src/grib_accessor_class_data_g2shsimple_packing.cc +++ /dev/null @@ -1,188 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_shsimple_packing - IMPLEMENTS = init - IMPLEMENTS = unpack_double - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - MEMBERS=const char* numberOfValues - MEMBERS=const char* numberOfDataPoints - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g2shsimple_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in data_shsimple_packing */ - const char* coded_values; - const char* real_part; - int dirty; - /* Members defined in data_g2shsimple_packing */ - const char* numberOfValues; - const char* numberOfDataPoints; -} grib_accessor_data_g2shsimple_packing; - -extern grib_accessor_class* grib_accessor_class_data_shsimple_packing; - -static grib_accessor_class _grib_accessor_class_data_g2shsimple_packing = { - &grib_accessor_class_data_shsimple_packing, /* super */ - "data_g2shsimple_packing", /* name */ - sizeof(grib_accessor_data_g2shsimple_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_g2shsimple_packing = &_grib_accessor_class_data_g2shsimple_packing; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g2shsimple_packing* self = (grib_accessor_data_g2shsimple_packing*)a; - - self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), args, 2); - self->numberOfDataPoints = grib_arguments_get_name(grib_handle_of_accessor(a), args, 3); - a->flags |= GRIB_ACCESSOR_FLAG_DATA; -} - -static int value_count(grib_accessor* a, long* len) -{ - grib_accessor_data_g2shsimple_packing* self = (grib_accessor_data_g2shsimple_packing*)a; - *len = 0; - return grib_get_long(grib_handle_of_accessor(a), self->numberOfValues, len); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_g2shsimple_packing* self = (grib_accessor_data_g2shsimple_packing*)a; - int err = GRIB_SUCCESS; - - size_t n_vals = 0; - - if ((err = grib_get_size(grib_handle_of_accessor(a), self->coded_values, &n_vals)) != GRIB_SUCCESS) - return err; - - self->dirty = 0; - - /* n_vals = coded_n_vals+1; */ - - if (*len < n_vals) { - *len = n_vals; - return GRIB_ARRAY_TOO_SMALL; - } - - if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->real_part, val)) != GRIB_SUCCESS) - return err; - - val++; - - if ((err = grib_get_double_array_internal(grib_handle_of_accessor(a), self->coded_values, val, &n_vals)) != GRIB_SUCCESS) - return err; - - *len = n_vals; - - return err; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_g2shsimple_packing* self = (grib_accessor_data_g2shsimple_packing*)a; - int err = GRIB_SUCCESS; - - size_t coded_n_vals = *len - 1; - size_t n_vals = *len; - - if (*len == 0) - return GRIB_NO_VALUES; - - self->dirty = 1; - - if ((err = grib_set_double_internal(grib_handle_of_accessor(a), self->real_part, *val)) != GRIB_SUCCESS) - return err; - - val++; - - if ((err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->coded_values, val, coded_n_vals)) != GRIB_SUCCESS) - return err; - - *len = n_vals; - - if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfValues, (long)n_vals)) != GRIB_SUCCESS) - return err; - if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfDataPoints, (long)n_vals)) != GRIB_SUCCESS) - return err; - - return err; -} diff --git a/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc b/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc deleted file mode 100644 index 88a4de2cb..000000000 --- a/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.cc +++ /dev/null @@ -1,287 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -#define DIRECT 0 -#define INVERSE 1 - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_data_g2simple_packing - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = unpack_double - IMPLEMENTS = value_count - MEMBERS=const char* pre_processing - MEMBERS=const char* pre_processing_parameter - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_g2simple_packing_with_preprocessing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_simple_packing */ - int edition; - const char* units_factor; - const char* units_bias; - const char* changing_precision; - const char* number_of_values; - const char* bits_per_value; - const char* reference_value; - const char* binary_scale_factor; - const char* decimal_scale_factor; - const char* optimize_scaling_factor; - /* Members defined in data_g2simple_packing */ - /* Members defined in data_g2simple_packing_with_preprocessing */ - const char* pre_processing; - const char* pre_processing_parameter; -} grib_accessor_data_g2simple_packing_with_preprocessing; - -extern grib_accessor_class* grib_accessor_class_data_g2simple_packing; - -static grib_accessor_class _grib_accessor_class_data_g2simple_packing_with_preprocessing = { - &grib_accessor_class_data_g2simple_packing, /* super */ - "data_g2simple_packing_with_preprocessing", /* name */ - sizeof(grib_accessor_data_g2simple_packing_with_preprocessing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_g2simple_packing_with_preprocessing = &_grib_accessor_class_data_g2simple_packing_with_preprocessing; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_g2simple_packing_with_preprocessing* self = (grib_accessor_data_g2simple_packing_with_preprocessing*)a; - self->pre_processing = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->pre_processing_parameter = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - a->flags |= GRIB_ACCESSOR_FLAG_DATA; -} - -static int value_count(grib_accessor* a, long* n_vals) -{ - grib_accessor_data_g2simple_packing_with_preprocessing* self = (grib_accessor_data_g2simple_packing_with_preprocessing*)a; - *n_vals = 0; - - return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals); -} - -static int pre_processing_func(double* values, long length, long pre_processing, - double* pre_processing_parameter, int mode) -{ - int i = 0, ret = 0; - double min = values[0]; - double next_min = values[0]; - Assert(length > 0); - - switch (pre_processing) { - /* NONE */ - case 0: - break; - /* LOGARITHM */ - case 1: - if (mode == DIRECT) { - for (i = 0; i < length; i++) { - if (values[i] < min) - min = values[i]; - if (values[i] > next_min) - next_min = values[i]; - } - for (i = 0; i < length; i++) { - if (values[i] > min && values[i] < next_min) - next_min = values[i]; - } - if (min > 0) { - *pre_processing_parameter = 0; - for (i = 0; i < length; i++) { - DEBUG_ASSERT(values[i] > 0); - values[i] = log(values[i]); - } - } - else { - double ppp = 0; - *pre_processing_parameter = next_min - 2 * min; - if (next_min == min) - return ret; - ppp = *pre_processing_parameter; - for (i = 0; i < length; i++) { - DEBUG_ASSERT((values[i] + ppp) > 0); - values[i] = log(values[i] + ppp); - } - } - } - else { - Assert(mode == INVERSE); - if (*pre_processing_parameter == 0) { - for (i = 0; i < length; i++) - values[i] = exp(values[i]); - } - else { - for (i = 0; i < length; i++) - values[i] = exp(values[i]) - *pre_processing_parameter; - } - } - break; - default: - ret = GRIB_NOT_IMPLEMENTED; - break; - } - - return ret; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_g2simple_packing_with_preprocessing* self = (grib_accessor_data_g2simple_packing_with_preprocessing*)a; - grib_accessor_class* super = *(a->cclass->super); - grib_accessor_class* super2 = NULL; - - size_t n_vals = 0; - long nn = 0; - int err = 0; - - long pre_processing; - double pre_processing_parameter; - - err = grib_value_count(a, &nn); - n_vals = nn; - if (err) - return err; - - if (n_vals == 0) { - *len = 0; - return GRIB_SUCCESS; - } - - self->dirty = 0; - - if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->pre_processing, &pre_processing)) != GRIB_SUCCESS) { - return err; - } - - if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->pre_processing_parameter, &pre_processing_parameter)) != GRIB_SUCCESS) { - return err; - } - - Assert(super->super); - super2 = *(super->super); - err = super2->unpack_double(a, val, &n_vals); /* GRIB-364 */ - if (err != GRIB_SUCCESS) - return err; - - err = pre_processing_func(val, n_vals, pre_processing, &pre_processing_parameter, INVERSE); - if (err != GRIB_SUCCESS) - return err; - - *len = (long)n_vals; - - return err; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_g2simple_packing_with_preprocessing* self = (grib_accessor_data_g2simple_packing_with_preprocessing*)a; - grib_accessor_class* super = *(a->cclass->super); - - size_t n_vals = *len; - int err = 0; - - long pre_processing = 0; - double pre_processing_parameter = 0; - - self->dirty = 1; - - if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->pre_processing, &pre_processing)) != GRIB_SUCCESS) - return err; - - err = pre_processing_func((double*)val, n_vals, pre_processing, &pre_processing_parameter, DIRECT); - if (err != GRIB_SUCCESS) - return err; - - err = super->pack_double(a, val, len); - if (err != GRIB_SUCCESS) - return err; - - if ((err = grib_set_double_internal(grib_handle_of_accessor(a), self->pre_processing_parameter, pre_processing_parameter)) != GRIB_SUCCESS) - return err; - - if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals)) != GRIB_SUCCESS) - return err; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_data_raw_packing.cc b/src/grib_accessor_class_data_raw_packing.cc deleted file mode 100644 index 27c3d62e3..000000000 --- a/src/grib_accessor_class_data_raw_packing.cc +++ /dev/null @@ -1,306 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ -/***************************** - * Enrico Fucile - ****************************/ - -#include "grib_ieeefloat.h" - -#define PRE_PROCESSING_NONE 0 -#define PRE_PROCESSING_DIFFERENCE 1 -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_values - IMPLEMENTS = init - IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_double_element;unpack_double_element_set - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - MEMBERS=const char* number_of_values - MEMBERS=const char* precision - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); - -typedef struct grib_accessor_data_raw_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; - /* Members defined in data_raw_packing */ - const char* number_of_values; - const char* precision; -} grib_accessor_data_raw_packing; - -extern grib_accessor_class* grib_accessor_class_values; - -static grib_accessor_class _grib_accessor_class_data_raw_packing = { - &grib_accessor_class_values, /* super */ - "data_raw_packing", /* name */ - sizeof(grib_accessor_data_raw_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_raw_packing = &_grib_accessor_class_data_raw_packing; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_raw_packing* self = (grib_accessor_data_raw_packing*)a; - - self->number_of_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - self->precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++); - a->flags |= GRIB_ACCESSOR_FLAG_DATA; -} - -static int value_count(grib_accessor* a, long* n_vals) -{ - grib_accessor_data_raw_packing* self = (grib_accessor_data_raw_packing*)a; - *n_vals = 0; - return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_raw_packing* self = (grib_accessor_data_raw_packing*)a; - unsigned char* buf = NULL; - int bytes = 0; - size_t nvals = 0; - long inlen = grib_byte_count(a); - - long precision = 0; - - int code = GRIB_SUCCESS; - - if ((code = grib_get_long(grib_handle_of_accessor(a), self->precision, &precision)) != GRIB_SUCCESS) - return code; - - self->dirty = 0; - - buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; - buf += grib_byte_offset(a); - - switch (precision) { - case 1: - bytes = 4; - break; - case 2: - bytes = 8; - break; - default: - return GRIB_NOT_IMPLEMENTED; - } - - nvals = inlen / bytes; - - if (*len < nvals) - return GRIB_ARRAY_TOO_SMALL; - - code = grib_ieee_decode_array(a->context, buf, nvals, bytes, val); - - *len = nvals; - - return code; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_raw_packing* self = (grib_accessor_data_raw_packing*)a; - - int bytes = 0; - unsigned char* buffer = NULL; - - long precision = 0; - - double* values = (double*)val; - size_t inlen = *len; - - /*int free_buffer = 0; - *int free_values = 0;*/ - - int code = GRIB_SUCCESS; - - size_t bufsize = 0; - - if (*len == 0) - return GRIB_NO_VALUES; - - if ((code = grib_get_long_internal(grib_handle_of_accessor(a), self->precision, &precision)) != GRIB_SUCCESS) - return code; - - self->dirty = 1; - - switch (precision) { - case 1: - bytes = 4; - break; - - case 2: - bytes = 8; - break; - - default: - code = GRIB_NOT_IMPLEMENTED; - goto clean_up; - } - - bufsize = bytes * inlen; - - buffer = (unsigned char*)grib_context_malloc(a->context, bufsize); - - if (!buffer) { - code = GRIB_OUT_OF_MEMORY; - goto clean_up; - } - - code = grib_ieee_encode_array(a->context, values, inlen, bytes, buffer); - -clean_up: - /*if (free_buffer) - * free(buffer); - * if (free_values) - * free(values); - */ - - grib_buffer_replace(a, buffer, bufsize, 1, 1); - - grib_context_buffer_free(a->context, buffer); - - if (code == GRIB_SUCCESS) { - code = grib_set_long(grib_handle_of_accessor(a), self->number_of_values, inlen); - if (code == GRIB_READ_ONLY) - code = 0; - } - - return code; -} - -static int unpack_double_element(grib_accessor* a, size_t idx, double* val) -{ - int ret = 0; - grib_accessor_data_raw_packing* self = (grib_accessor_data_raw_packing*)a; - unsigned char* buf = NULL; - int bytes = 0; - size_t nvals = 0; - long inlen = grib_byte_count(a); - long pos = 0; - long precision = 0; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->precision, &precision)) != GRIB_SUCCESS) - return ret; - - self->dirty = 0; - - buf = (unsigned char*)grib_handle_of_accessor(a)->buffer->data; - buf += grib_byte_offset(a); - - switch (precision) { - case 1: - bytes = 4; - break; - - case 2: - bytes = 8; - break; - - default: - return GRIB_NOT_IMPLEMENTED; - } - - pos = bytes * idx; - - Assert(pos <= inlen); - - nvals = 1; - buf += pos; - - ret = grib_ieee_decode_array(a->context, buf, nvals, bytes, val); - - return ret; -} - -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) -{ - int err = 0; - size_t i = 0; - for (i=0; iprimary_bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0); - self->secondary_bitmap = grib_arguments_get_name(grib_handle_of_accessor(a), args, 1); - self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, 2); - self->expand_by = grib_arguments_get_name(grib_handle_of_accessor(a), args, 3); - - a->length = 0; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_values(dumper, a); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_data_secondary_bitmap* self = (grib_accessor_data_secondary_bitmap*)a; - - size_t i = 0; - size_t j = 0; - size_t k = 0; - size_t m = 0; - size_t n_vals = 0; - long nn = 0; - long expand_by = 0; - int err = 0; - size_t primary_len; - size_t secondary_len; - double* primary_vals; - double* secondary_vals; - err = grib_value_count(a, &nn); - n_vals = nn; - if (err) - return err; - - if (*len < n_vals) { - *len = n_vals; - return GRIB_ARRAY_TOO_SMALL; - } - - if ((err = grib_get_long(grib_handle_of_accessor(a), self->expand_by, &expand_by)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_size(grib_handle_of_accessor(a), self->primary_bitmap, &primary_len)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_size(grib_handle_of_accessor(a), self->secondary_bitmap, &secondary_len)) != GRIB_SUCCESS) - return err; - - primary_vals = (double*)grib_context_malloc(a->context, primary_len * sizeof(double)); - if (!primary_vals) - return GRIB_OUT_OF_MEMORY; - - secondary_vals = (double*)grib_context_malloc(a->context, secondary_len * sizeof(double)); - if (!secondary_vals) { - grib_context_free(a->context, primary_vals); - return GRIB_OUT_OF_MEMORY; - } - - if ((err = grib_get_double_array_internal(grib_handle_of_accessor(a), self->primary_bitmap, primary_vals, &primary_len)) != GRIB_SUCCESS) { - grib_context_free(a->context, secondary_vals); - grib_context_free(a->context, primary_vals); - return err; - } - - if ((err = grib_get_double_array_internal(grib_handle_of_accessor(a), self->secondary_bitmap, secondary_vals, &secondary_len)) != GRIB_SUCCESS) { - grib_context_free(a->context, secondary_vals); - grib_context_free(a->context, primary_vals); - return err; - } - - k = 0; - m = 0; - for (i = 0; i < primary_len; i++) { - /* if(primary_vals[i]) f++; */ - if (primary_vals[i]) { - for (j = 0; j < expand_by; j++) - val[k++] = secondary_vals[m++]; - } - else { - for (j = 0; j < expand_by; j++) - val[k++] = 0; - } - } - - Assert(k <= *len); - Assert(m <= secondary_len); - - /*printf("FOOBAR %d %d %ld %d\n",f,primary_len,expand_by,n_vals);*/ - - *len = n_vals; - - grib_context_free(a->context, primary_vals); - grib_context_free(a->context, secondary_vals); - return err; -} - -static int get_native_type(grib_accessor* a) -{ - // grib_accessor_data_secondary_bitmap* self = (grib_accessor_data_secondary_bitmap*)a; - //return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values)); - return GRIB_TYPE_DOUBLE; -} diff --git a/src/grib_accessor_class_data_shsimple_packing.cc b/src/grib_accessor_class_data_shsimple_packing.cc deleted file mode 100644 index d06743f8d..000000000 --- a/src/grib_accessor_class_data_shsimple_packing.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init - IMPLEMENTS = pack_double - IMPLEMENTS = dump;get_native_type - MEMBERS=const char* coded_values - MEMBERS=const char* real_part - MEMBERS=int dirty - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_data_shsimple_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in data_shsimple_packing */ - const char* coded_values; - const char* real_part; - int dirty; -} grib_accessor_data_shsimple_packing; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_data_shsimple_packing = { - &grib_accessor_class_gen, /* super */ - "data_shsimple_packing", /* name */ - sizeof(grib_accessor_data_shsimple_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_data_shsimple_packing = &_grib_accessor_class_data_shsimple_packing; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - grib_accessor_data_shsimple_packing* self = (grib_accessor_data_shsimple_packing*)a; - - self->coded_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0); - self->real_part = grib_arguments_get_name(grib_handle_of_accessor(a), args, 1); - a->flags |= GRIB_ACCESSOR_FLAG_DATA; - - a->length = 0; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_values(dumper, a); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_data_shsimple_packing* self = (grib_accessor_data_shsimple_packing*)a; - int err = GRIB_SUCCESS; - - size_t coded_n_vals = *len - 1; - size_t n_vals = *len; - - self->dirty = 1; - - if (*len == 0) - return GRIB_NO_VALUES; - - if ((err = grib_set_double_internal(grib_handle_of_accessor(a), self->real_part, *val)) != GRIB_SUCCESS) - return err; - - val++; - - if ((err = grib_set_double_array_internal(grib_handle_of_accessor(a), self->coded_values, val, coded_n_vals)) != GRIB_SUCCESS) - return err; - - *len = n_vals; - - return err; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_DOUBLE; -} diff --git a/src/grib_accessor_class_decimal_precision.cc b/src/grib_accessor_class_decimal_precision.cc deleted file mode 100644 index e498931b7..000000000 --- a/src/grib_accessor_class_decimal_precision.cc +++ /dev/null @@ -1,199 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/********************************** - * Enrico Fucile - *********************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long; pack_long - IMPLEMENTS = init - MEMBERS = const char* values - MEMBERS = const char* bits_per_value - MEMBERS = const char* changing_precision - MEMBERS = const char* decimal_scale_factor - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_decimal_precision -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in decimal_precision */ - const char* values; - const char* bits_per_value; - const char* changing_precision; - const char* decimal_scale_factor; -} grib_accessor_decimal_precision; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_decimal_precision = { - &grib_accessor_class_long, /* super */ - "decimal_precision", /* name */ - sizeof(grib_accessor_decimal_precision), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_decimal_precision = &_grib_accessor_class_decimal_precision; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* args) -{ - int n = 0; - grib_accessor_decimal_precision* self = (grib_accessor_decimal_precision*)a; - - self->bits_per_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->decimal_scale_factor = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->changing_precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = 0; - grib_accessor_decimal_precision* self = (grib_accessor_decimal_precision*)a; - grib_handle* h = grib_handle_of_accessor(a); - - if ((ret = grib_get_long_internal(h, self->decimal_scale_factor, val)) != GRIB_SUCCESS) - return ret; - - *len = 1; - return ret; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - long bitsPerValue = 0; - double* values = NULL; - size_t size = 0; - int ret = 0; - grib_accessor_decimal_precision* self = (grib_accessor_decimal_precision*)a; - grib_context* c = a->context; - grib_handle* h = grib_handle_of_accessor(a); - - if (!self->values) { - if ((ret = grib_set_long_internal(h, self->bits_per_value, 0)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_set_long_internal(h, self->decimal_scale_factor, *val)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_set_long_internal(h, self->changing_precision, 1)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - return GRIB_SUCCESS; - } - - if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) - return ret; - - values = (double*)grib_context_malloc(c, size * sizeof(double)); - if (!values) - return GRIB_OUT_OF_MEMORY; - - if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { - grib_context_buffer_free(c, values); - return ret; - } - - if ((ret = grib_set_long_internal(h, self->decimal_scale_factor, *val)) != GRIB_SUCCESS) { - grib_context_buffer_free(c, values); - return ret; - } - - if ((ret = grib_set_long_internal(h, self->bits_per_value, bitsPerValue)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - if ((ret = grib_set_long_internal(h, self->changing_precision, 1)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { - grib_context_buffer_free(c, values); - return ret; - } - - grib_context_free(c, values); - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_dirty.cc b/src/grib_accessor_class_dirty.cc deleted file mode 100644 index ec29923e3..000000000 --- a/src/grib_accessor_class_dirty.cc +++ /dev/null @@ -1,138 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************ - * Enrico Fucile - **********************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = pack_long - IMPLEMENTS = init - MEMBERS = const char* accessor - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_dirty -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in dirty */ - const char* accessor; -} grib_accessor_dirty; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_dirty = { - &grib_accessor_class_long, /* super */ - "dirty", /* name */ - sizeof(grib_accessor_dirty), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_dirty = &_grib_accessor_class_dirty; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_dirty* self = (grib_accessor_dirty*)a; - self->accessor = grib_arguments_get_name(grib_handle_of_accessor(a), c, 0); - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; - a->length = 0; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_dirty* self = (grib_accessor_dirty*)a; - grib_accessor* x = grib_find_accessor(grib_handle_of_accessor(a), self->accessor); - - if (x) - x->dirty = *val; - - return GRIB_SUCCESS; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_dirty* self = (grib_accessor_dirty*)a; - grib_accessor* x = grib_find_accessor(grib_handle_of_accessor(a), self->accessor); - - if (x) - x->dirty = 1; - - *val = 1; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_divdouble.cc b/src/grib_accessor_class_divdouble.cc deleted file mode 100644 index 8ab86e22e..000000000 --- a/src/grib_accessor_class_divdouble.cc +++ /dev/null @@ -1,129 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double - IMPLEMENTS = init - MEMBERS = const char* val - MEMBERS = double divisor - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_divdouble -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in divdouble */ - const char* val; - double divisor; -} grib_accessor_divdouble; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_divdouble = { - &grib_accessor_class_double, /* super */ - "divdouble", /* name */ - sizeof(grib_accessor_divdouble), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_divdouble = &_grib_accessor_class_divdouble; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_divdouble* self = (grib_accessor_divdouble*)a; - int n = 0; - - self->val = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->divisor = grib_arguments_get_double(grib_handle_of_accessor(a), c, n++); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - const grib_accessor_divdouble* self = (grib_accessor_divdouble*)a; - int ret = GRIB_SUCCESS; - double value = 0; - - ret = grib_get_double_internal(grib_handle_of_accessor(a), self->val, &value); - if (ret != GRIB_SUCCESS) - return ret; - - if (self->divisor == 0) { - return GRIB_INVALID_ARGUMENT; - } - *val = value / self->divisor; - - *len = 1; - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_double.cc b/src/grib_accessor_class_double.cc deleted file mode 100644 index 3a2933aff..000000000 --- a/src/grib_accessor_class_double.cc +++ /dev/null @@ -1,201 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = get_native_type;unpack_string - IMPLEMENTS = pack_missing; - IMPLEMENTS = dump - IMPLEMENTS = compare - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_missing(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_double -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ -} grib_accessor_double; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_double = { - &grib_accessor_class_gen, /* super */ - "double", /* name */ - sizeof(grib_accessor_double), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - &pack_missing, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_double = &_grib_accessor_class_double; - -/* END_CLASS_IMP */ - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_DOUBLE; -} - -static int unpack_string(grib_accessor* a, char* v, size_t* len) -{ - double val = 0; - size_t l = 1; - char repres[1024]; - char format[32] = "%g"; - grib_handle* h = grib_handle_of_accessor(a); - const char* cclass_name = a->cclass->name; - - grib_unpack_double(a, &val, &l); - - if ((val == GRIB_MISSING_DOUBLE) && ((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0)) { - snprintf(repres, sizeof(repres), "MISSING"); - } else { - size_t size = sizeof(format); - grib_get_string(h, "formatForDoubles", format, &size); - snprintf(repres, sizeof(repres), format, val); - } - - l = strlen(repres) + 1; - - if (l > *len) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, l, *len); - *len = l; - return GRIB_BUFFER_TOO_SMALL; - } - grib_context_log(a->context, GRIB_LOG_DEBUG, "grib_accessor_long: Casting double %s to string ", a->name); - - *len = l; - - strcpy(v, repres); - return GRIB_SUCCESS; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_values(dumper, a); -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - int retval = 0; - double* aval = 0; - double* bval = 0; - - size_t alen = 0; - size_t blen = 0; - long count = 0; - int err = 0; - - err = grib_value_count(a, &count); - if (err) - return err; - alen = count; - - err = grib_value_count(b, &count); - if (err) - return err; - blen = count; - - if (alen != blen) - return GRIB_COUNT_MISMATCH; - - aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); - bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); - - grib_unpack_double(a, aval, &alen); - grib_unpack_double(b, bval, &blen); - - retval = GRIB_SUCCESS; - while (alen != 0) { - if (*bval != *aval) - retval = GRIB_DOUBLE_VALUE_MISMATCH; - alen--; - } - - grib_context_free(a->context, aval); - grib_context_free(b->context, bval); - - return retval; -} - -static int pack_missing(grib_accessor* a) -{ - size_t len = 1; - double value = GRIB_MISSING_DOUBLE; - - if (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) - return grib_pack_double(a, &value, &len); - return GRIB_VALUE_CANNOT_BE_MISSING; -} diff --git a/src/grib_accessor_class_evaluate.cc b/src/grib_accessor_class_evaluate.cc deleted file mode 100644 index 596b95884..000000000 --- a/src/grib_accessor_class_evaluate.cc +++ /dev/null @@ -1,118 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS= grib_arguments* arg - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_evaluate -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in evaluate */ - grib_arguments* arg; -} grib_accessor_evaluate; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_evaluate = { - &grib_accessor_class_long, /* super */ - "evaluate", /* name */ - sizeof(grib_accessor_evaluate), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_evaluate = &_grib_accessor_class_evaluate; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_evaluate* self = (grib_accessor_evaluate*)a; - self->arg = c; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_evaluate* self = (grib_accessor_evaluate*)a; - grib_expression* e = grib_arguments_get_expression(grib_handle_of_accessor(a), self->arg, 0); - - int ret = grib_expression_evaluate_long(grib_handle_of_accessor(a), e, val); - *len = 1; - - return ret; -} diff --git a/src/grib_accessor_class_g1_half_byte_codeflag.cc b/src/grib_accessor_class_g1_half_byte_codeflag.cc deleted file mode 100644 index c7d9828e0..000000000 --- a/src/grib_accessor_class_g1_half_byte_codeflag.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init;dump - IMPLEMENTS = get_native_type - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1_half_byte_codeflag -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in g1_half_byte_codeflag */ -} grib_accessor_g1_half_byte_codeflag; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_g1_half_byte_codeflag = { - &grib_accessor_class_gen, /* super */ - "g1_half_byte_codeflag", /* name */ - sizeof(grib_accessor_g1_half_byte_codeflag), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1_half_byte_codeflag = &_grib_accessor_class_g1_half_byte_codeflag; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_long(dumper, a, NULL); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - if (*len < 1) { - *len = 1; - return GRIB_ARRAY_TOO_SMALL; - } - unsigned char dat = grib_handle_of_accessor(a)->buffer->data[a->offset] & 0x0f; - - *val = dat; - *len = 1; - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - if (*len < 1) { - *len = 1; - return GRIB_ARRAY_TOO_SMALL; - } - - // printf("HALF BYTE pack long %ld %02x\n",*val,grib_handle_of_accessor(a)->buffer->data[a->offset]); - grib_handle_of_accessor(a)->buffer->data[a->offset] = (a->parent->h->buffer->data[a->offset] & 0xf0) | (*val & 0x0f); - // printf("HALF BYTE pack long %ld %02x\n",*val,grib_handle_of_accessor(a)->buffer->data[a->offset]); - - *len = 1; - return GRIB_SUCCESS; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_g1_section4_length.cc b/src/grib_accessor_class_g1_section4_length.cc deleted file mode 100644 index 8e6c2b3f1..000000000 --- a/src/grib_accessor_class_g1_section4_length.cc +++ /dev/null @@ -1,143 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_section_length - IMPLEMENTS = init;unpack_long;pack_long - MEMBERS = const char* total_length - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1_section4_length -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in section_length */ - /* Members defined in g1_section4_length */ - const char* total_length; -} grib_accessor_g1_section4_length; - -extern grib_accessor_class* grib_accessor_class_section_length; - -static grib_accessor_class _grib_accessor_class_g1_section4_length = { - &grib_accessor_class_section_length, /* super */ - "g1_section4_length", /* name */ - sizeof(grib_accessor_g1_section4_length), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1_section4_length = &_grib_accessor_class_g1_section4_length; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_g1_section4_length* self = (grib_accessor_g1_section4_length*)a; - self->total_length = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0); -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - // Old implementation: - // Here we assume that the totalLength will be coded AFTER the section4 length, and - // the section4 length will be overwritten by the totalLength accessor for large GRIBs - // grib_accessor_class* super = *(a->cclass->super); - // return super->pack_long(a,val,len); - - // Note: Do not directly call pack_long on base class - // because in this special case we want to skip the checks. - // So we call the helper function which has an extra argument - return pack_long_unsigned_helper(a, val, len, /*check=*/0); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g1_section4_length* self = (grib_accessor_g1_section4_length*)a; - int ret = 0; - long total_length = 0, sec4_length = 0; - - if ((ret = grib_get_g1_message_size(grib_handle_of_accessor(a), - grib_find_accessor(grib_handle_of_accessor(a), self->total_length), - a, - &total_length, - &sec4_length)) != GRIB_SUCCESS) { - return ret; - } - - *val = sec4_length; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_g1bitmap.cc b/src/grib_accessor_class_g1bitmap.cc deleted file mode 100644 index 519638f6a..000000000 --- a/src/grib_accessor_class_g1bitmap.cc +++ /dev/null @@ -1,206 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_bitmap - IMPLEMENTS = pack_double; unpack_bytes - IMPLEMENTS = value_count - IMPLEMENTS = init; - MEMBERS=const char* unusedBits - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_bytes(grib_accessor*, unsigned char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1bitmap -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in bitmap */ - const char* tableReference; - const char* missing_value; - const char* offsetbsec; - const char* sLength; - /* Members defined in g1bitmap */ - const char* unusedBits; -} grib_accessor_g1bitmap; - -extern grib_accessor_class* grib_accessor_class_bitmap; - -static grib_accessor_class _grib_accessor_class_g1bitmap = { - &grib_accessor_class_bitmap, /* super */ - "g1bitmap", /* name */ - sizeof(grib_accessor_g1bitmap), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - &unpack_bytes, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1bitmap = &_grib_accessor_class_g1bitmap; - -/* END_CLASS_IMP */ - - -static void grib_set_bit_on(unsigned char* p, long* bitp); - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_g1bitmap* self = (grib_accessor_g1bitmap*)a; - self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 4); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_g1bitmap* self = (grib_accessor_g1bitmap*)a; - size_t tlen; - - unsigned char* buf = NULL; - size_t i; - int err = 0; - long pos = 0; - //long bmaplen = 0; - const int bit_padding = 16; - double miss_values = 0; - tlen = ((*len + bit_padding - 1) / bit_padding * bit_padding) / 8; - - if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &miss_values)) != GRIB_SUCCESS) - return err; - - buf = (unsigned char*)grib_context_malloc_clear(a->context, tlen); - if (!buf) - return GRIB_OUT_OF_MEMORY; - pos = 0; - for (i = 0; i < *len; i++) { - if (val[i] == miss_values) - pos++; - else { - //bmaplen++; - grib_set_bit_on(buf, &pos); - } - } - - if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->unusedBits, tlen * 8 - *len)) != GRIB_SUCCESS) - return err; - - err = grib_buffer_replace(a, buf, tlen, 1, 1); - if (err) return err; - - grib_context_free(a->context, buf); - - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_g1bitmap* self = (grib_accessor_g1bitmap*)a; - long tlen; - int err; - - if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &tlen)) != GRIB_SUCCESS) - grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_class_bitmap.value_count : cannot get %s err=%d", self->unusedBits, err); - - *count = (a->length * 8) - tlen; - return err; -} - -static int unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len) -{ - unsigned char* buf = grib_handle_of_accessor(a)->buffer->data; - grib_accessor_g1bitmap* self = (grib_accessor_g1bitmap*)a; - long tlen; - int err; - long length = grib_byte_count(a); - long offset = grib_byte_offset(a); - - if (*len < (size_t)length) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it is %ld bytes long\n", a->name, length); - *len = length; - return GRIB_ARRAY_TOO_SMALL; - } - - if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &tlen)) != GRIB_SUCCESS) - grib_context_log(a->context, GRIB_LOG_ERROR, - "grib_accessor_class_bitmap.unpack_bytes : cannot get %s err=%d", self->unusedBits, err); - - length -= tlen / 8; - memcpy(val, buf + offset, length); - *len = length; - - return GRIB_SUCCESS; -} - -static void grib_set_bit_on(unsigned char* p, long* bitp) -{ - unsigned char o = 1; - p += (*bitp >> 3); - o <<= 7 - ((*bitp) % 8); - *p |= o; - (*bitp) += 1; -} diff --git a/src/grib_accessor_class_g1day_of_the_year_date.cc b/src/grib_accessor_class_g1day_of_the_year_date.cc deleted file mode 100644 index 9028d5076..000000000 --- a/src/grib_accessor_class_g1day_of_the_year_date.cc +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_g1date - IMPLEMENTS = unpack_string - IMPLEMENTS = dump - IMPLEMENTS = init - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_string(grib_accessor*, char*, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1day_of_the_year_date -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g1date */ - const char* century; - const char* year; - const char* month; - const char* day; - /* Members defined in g1day_of_the_year_date */ -} grib_accessor_g1day_of_the_year_date; - -extern grib_accessor_class* grib_accessor_class_g1date; - -static grib_accessor_class _grib_accessor_class_g1day_of_the_year_date = { - &grib_accessor_class_g1date, /* super */ - "g1day_of_the_year_date", /* name */ - sizeof(grib_accessor_g1day_of_the_year_date), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1day_of_the_year_date = &_grib_accessor_class_g1day_of_the_year_date; - -/* END_CLASS_IMP */ - - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string(dumper, a, NULL); -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - /* special clim case where each mont have 30 days.. to comply with mars*/ - grib_accessor_g1day_of_the_year_date* self = (grib_accessor_g1day_of_the_year_date*)a; - grib_handle* hand = grib_handle_of_accessor(a); - char tmp[1024]; - - long year = 0; - long century = 0; - long month = 0; - long day = 0; - long fullyear = 0; - long fake_day_of_year = 0; - - grib_get_long_internal(hand, self->century, ¢ury); - grib_get_long_internal(hand, self->day, &day); - grib_get_long_internal(hand, self->month, &month); - grib_get_long_internal(hand, self->year, &year); - - fullyear = ((century - 1) * 100 + year); - fake_day_of_year = ((month - 1) * 30) + day; - snprintf(tmp, sizeof(tmp), "%04ld-%03ld", fullyear, fake_day_of_year); - - size_t l = strlen(tmp) + 1; - if (*len < l) { - *len = l; - return GRIB_BUFFER_TOO_SMALL; - } - - *len = l; - strcpy(val, tmp); - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_g1end_of_interval_monthly.cc b/src/grib_accessor_class_g1end_of_interval_monthly.cc deleted file mode 100644 index cbf74322c..000000000 --- a/src/grib_accessor_class_g1end_of_interval_monthly.cc +++ /dev/null @@ -1,234 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_abstract_vector - IMPLEMENTS = unpack_double; destroy - IMPLEMENTS = value_count;compare - IMPLEMENTS = init - MEMBERS = const char* verifyingMonth - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_g1end_of_interval_monthly -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in abstract_vector */ - double* v; - int number_of_elements; - /* Members defined in g1end_of_interval_monthly */ - const char* verifyingMonth; -} grib_accessor_g1end_of_interval_monthly; - -extern grib_accessor_class* grib_accessor_class_abstract_vector; - -static grib_accessor_class _grib_accessor_class_g1end_of_interval_monthly = { - &grib_accessor_class_abstract_vector, /* super */ - "g1end_of_interval_monthly", /* name */ - sizeof(grib_accessor_g1end_of_interval_monthly), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1end_of_interval_monthly = &_grib_accessor_class_g1end_of_interval_monthly; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a; - int n = 0; - - self->verifyingMonth = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; - - self->number_of_elements = 6; - self->v = (double*)grib_context_malloc(a->context, sizeof(double) * self->number_of_elements); - - a->length = 0; - a->dirty = 1; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a; - int ret = 0; - char verifyingMonth[7] = {0,}; - size_t slen = 7; - long year = 0, month = 0, date = 0; - const long mdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - long days = 0; - - if (!a->dirty) - return GRIB_SUCCESS; - - if (*len != (size_t)self->number_of_elements) - return GRIB_ARRAY_TOO_SMALL; - - if ((ret = grib_get_string(grib_handle_of_accessor(a), self->verifyingMonth, verifyingMonth, &slen)) != GRIB_SUCCESS) - return ret; - - date = atoi(verifyingMonth); - if (date < 0) { - return GRIB_INVALID_ARGUMENT; - } - year = date / 100; - month = date - year * 100; - if (month == 2) { - days = 28; - if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) - days = 29; - } - else { - if (month < 1 || month > 12) return GRIB_INVALID_ARGUMENT; - days = mdays[month - 1]; - } - self->v[0] = year; - self->v[1] = month; - - self->v[2] = days; - self->v[3] = 24; - self->v[4] = 00; - self->v[5] = 00; - - a->dirty = 0; - - val[0] = self->v[0]; - val[1] = self->v[1]; - val[2] = self->v[2]; - val[3] = self->v[3]; - val[4] = self->v[4]; - val[5] = self->v[5]; - - return ret; -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a; - *count = self->number_of_elements; - return 0; -} - -static void destroy(grib_context* c, grib_accessor* a) -{ - grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a; - grib_context_free(c, self->v); -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - int retval = GRIB_SUCCESS; - double* aval = 0; - double* bval = 0; - - long count = 0; - size_t alen = 0; - size_t blen = 0; - int err = 0; - - err = grib_value_count(a, &count); - if (err) - return err; - alen = count; - - err = grib_value_count(b, &count); - if (err) - return err; - blen = count; - - if (alen != blen) - return GRIB_COUNT_MISMATCH; - - aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); - bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); - - b->dirty = 1; - a->dirty = 1; - - err = grib_unpack_double(a, aval, &alen); if(err) return err; - err = grib_unpack_double(b, bval, &blen); if(err) return err; - - for(size_t i=0; icontext, aval); - grib_context_free(b->context, bval); - - return retval; -} diff --git a/src/grib_accessor_class_g1fcperiod.cc b/src/grib_accessor_class_g1fcperiod.cc deleted file mode 100644 index 03aa6e3f4..000000000 --- a/src/grib_accessor_class_g1fcperiod.cc +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_g1step_range - IMPLEMENTS = unpack_string - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_string(grib_accessor*, char*, size_t* len); - -typedef struct grib_accessor_g1fcperiod -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in abstract_long_vector */ - long* v; - long pack_index; - int number_of_elements; - /* Members defined in g1step_range */ - const char* p1; - const char* p2; - const char* timeRangeIndicator; - const char *unit; - const char *step_unit; - const char *stepType; - const char *patch_fp_precip; - int error_on_units; - /* Members defined in g1fcperiod */ -} grib_accessor_g1fcperiod; - -extern grib_accessor_class* grib_accessor_class_g1step_range; - -static grib_accessor_class _grib_accessor_class_g1fcperiod = { - &grib_accessor_class_g1step_range, /* super */ - "g1fcperiod", /* name */ - sizeof(grib_accessor_g1fcperiod), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1fcperiod = &_grib_accessor_class_g1fcperiod; - -/* END_CLASS_IMP */ - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - long start = 0, theEnd = 0; - char tmp[1024]; - const size_t tmpLen = sizeof(tmp); - int err = grib_g1_step_get_steps(a, &start, &theEnd); - size_t l = 0; - - if (err) - return err; - - snprintf(tmp, tmpLen, "%ld-%ld", start / 24, theEnd / 24); - /*printf("---- FCPERIOD %s [start:%g, end:%g]",tmp,start,end);*/ - - l = strlen(tmp) + 1; - if (*len < l) { - *len = l; - return GRIB_BUFFER_TOO_SMALL; - } - - *len = l; - strcpy(val, tmp); /* NOLINT: CWE-119 clang-analyzer-security.insecureAPI.strcpy */ - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_g1monthlydate.cc b/src/grib_accessor_class_g1monthlydate.cc deleted file mode 100644 index 57c3ea729..000000000 --- a/src/grib_accessor_class_g1monthlydate.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - - -/*********************************************** - * Enrico Fucile - **********************************************/ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS=const char* date - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1monthlydate -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g1monthlydate */ - const char* date; -} grib_accessor_g1monthlydate; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g1monthlydate = { - &grib_accessor_class_long, /* super */ - "g1monthlydate", /* name */ - sizeof(grib_accessor_g1monthlydate), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1monthlydate = &_grib_accessor_class_g1monthlydate; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g1monthlydate* self = (grib_accessor_g1monthlydate*)a; - int n = 0; - - self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g1monthlydate* self = (grib_accessor_g1monthlydate*)a; - - long date = 0; - - grib_get_long_internal(grib_handle_of_accessor(a), self->date, &date); - - date /= 100; - date *= 100; - date += 1; - - *val = date; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_g1number_of_coded_values_sh_complex.cc b/src/grib_accessor_class_g1number_of_coded_values_sh_complex.cc deleted file mode 100644 index 45b983502..000000000 --- a/src/grib_accessor_class_g1number_of_coded_values_sh_complex.cc +++ /dev/null @@ -1,183 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/****************************************************** - * Enrico Fucile - *******************************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS = const char* numberOfValues - MEMBERS = const char* bitsPerValue - MEMBERS = const char* offsetBeforeData - MEMBERS = const char* offsetAfterData - MEMBERS = const char* unusedBits - MEMBERS = const char* JS - MEMBERS = const char* KS - MEMBERS = const char* MS - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1number_of_coded_values_sh_complex -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g1number_of_coded_values_sh_complex */ - const char* numberOfValues; - const char* bitsPerValue; - const char* offsetBeforeData; - const char* offsetAfterData; - const char* unusedBits; - const char* JS; - const char* KS; - const char* MS; -} grib_accessor_g1number_of_coded_values_sh_complex; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g1number_of_coded_values_sh_complex = { - &grib_accessor_class_long, /* super */ - "g1number_of_coded_values_sh_complex", /* name */ - sizeof(grib_accessor_g1number_of_coded_values_sh_complex), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1number_of_coded_values_sh_complex = &_grib_accessor_class_g1number_of_coded_values_sh_complex; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - int n = 0; - grib_accessor_g1number_of_coded_values_sh_complex* self = (grib_accessor_g1number_of_coded_values_sh_complex*)a; - self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->JS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->KS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->MS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = GRIB_SUCCESS; - long bpv = 0; - long offsetBeforeData = 0, offsetAfterData = 0, unusedBits = 0, numberOfValues; - long JS = 0, KS = 0, MS = 0, NS = 0; - - grib_accessor_g1number_of_coded_values_sh_complex* self = (grib_accessor_g1number_of_coded_values_sh_complex*)a; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitsPerValue, &bpv)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetBeforeData, &offsetBeforeData)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetAfterData, &offsetAfterData)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &unusedBits)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->JS, &JS)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->KS, &KS)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->MS, &MS)) != GRIB_SUCCESS) - return ret; - - if (JS != KS || KS != MS) - return GRIB_NOT_IMPLEMENTED; - - NS = (MS + 1) * (MS + 2); - - if (bpv != 0) { - DEBUG_ASSERT(offsetAfterData > offsetBeforeData); - *val = ((offsetAfterData - offsetBeforeData) * 8 - unusedBits + NS * (bpv - 32)) / bpv; - } - else { - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues, &numberOfValues)) != GRIB_SUCCESS) - return ret; - - *val = numberOfValues; - } - - return ret; -} diff --git a/src/grib_accessor_class_g1number_of_coded_values_sh_simple.cc b/src/grib_accessor_class_g1number_of_coded_values_sh_simple.cc deleted file mode 100644 index 532a4c5dd..000000000 --- a/src/grib_accessor_class_g1number_of_coded_values_sh_simple.cc +++ /dev/null @@ -1,158 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/********************************************** - * Enrico Fucile - **********************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS = const char* numberOfValues - MEMBERS = const char* bitsPerValue - MEMBERS = const char* offsetBeforeData - MEMBERS = const char* offsetAfterData - MEMBERS = const char* unusedBits - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1number_of_coded_values_sh_simple -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g1number_of_coded_values_sh_simple */ - const char* numberOfValues; - const char* bitsPerValue; - const char* offsetBeforeData; - const char* offsetAfterData; - const char* unusedBits; -} grib_accessor_g1number_of_coded_values_sh_simple; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g1number_of_coded_values_sh_simple = { - &grib_accessor_class_long, /* super */ - "g1number_of_coded_values_sh_simple", /* name */ - sizeof(grib_accessor_g1number_of_coded_values_sh_simple), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1number_of_coded_values_sh_simple = &_grib_accessor_class_g1number_of_coded_values_sh_simple; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - int n = 0; - grib_accessor_g1number_of_coded_values_sh_simple* self = (grib_accessor_g1number_of_coded_values_sh_simple*)a; - self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = GRIB_SUCCESS; - long bpv = 0; - long offsetBeforeData = 0, offsetAfterData = 0, unusedBits = 0, numberOfValues; - - grib_accessor_g1number_of_coded_values_sh_simple* self = (grib_accessor_g1number_of_coded_values_sh_simple*)a; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitsPerValue, &bpv)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetBeforeData, &offsetBeforeData)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetAfterData, &offsetAfterData)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &unusedBits)) != GRIB_SUCCESS) - return ret; - - if (bpv != 0) { - DEBUG_ASSERT(offsetAfterData > offsetBeforeData); - *val = ((offsetAfterData - offsetBeforeData) * 8 - unusedBits) / bpv; - } - else { - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues, &numberOfValues)) != GRIB_SUCCESS) - return ret; - - *val = numberOfValues; - } - return ret; -} diff --git a/src/grib_accessor_class_g1verificationdate.cc b/src/grib_accessor_class_g1verificationdate.cc deleted file mode 100644 index 03c871617..000000000 --- a/src/grib_accessor_class_g1verificationdate.cc +++ /dev/null @@ -1,154 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS=const char* date - MEMBERS=const char* time - MEMBERS=const char* step - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g1verificationdate -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g1verificationdate */ - const char* date; - const char* time; - const char* step; -} grib_accessor_g1verificationdate; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g1verificationdate = { - &grib_accessor_class_long, /* super */ - "g1verificationdate", /* name */ - sizeof(grib_accessor_g1verificationdate), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g1verificationdate = &_grib_accessor_class_g1verificationdate; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g1verificationdate* self = (grib_accessor_g1verificationdate*)a; - int n = 0; - - self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->time = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->step = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g1verificationdate* self = (grib_accessor_g1verificationdate*)a; - int ret = 0; - long date = 0; - long time = 0; - long cdate = 0; - long step = 0; - long vtime = 0; - long vdate = 0; - long vd = 0; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->date, &date)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->time, &time)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->step, &step)) != GRIB_SUCCESS) - return ret; - - time /= 100; - - cdate = (long)grib_date_to_julian(date); - vtime = cdate * 24 + time + step; - vd = vtime / 24; - vdate = grib_julian_to_date(vd); - - /* printf("\n********\n date %d, time %d, step %d, vdate: %d, cdate %d, vd %d\n********\n", date, time, step, vdate, cdate, vd); */ - - if (*len < 1) - return GRIB_ARRAY_TOO_SMALL; - - *val = vdate; - - /* fprintf(stdout,"\n********\n %d cdate %d vd %d\n********\n", vdate, cdate, step); */ - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_g2_aerosol.cc b/src/grib_accessor_class_g2_aerosol.cc deleted file mode 100644 index 7cd8659df..000000000 --- a/src/grib_accessor_class_g2_aerosol.cc +++ /dev/null @@ -1,210 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_unsigned - IMPLEMENTS = unpack_long;pack_long; value_count - IMPLEMENTS = init - MEMBERS=const char* productDefinitionTemplateNumber - MEMBERS=const char* stepType - MEMBERS=int optical - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2_aerosol -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in g2_aerosol */ - const char* productDefinitionTemplateNumber; - const char* stepType; - int optical; -} grib_accessor_g2_aerosol; - -extern grib_accessor_class* grib_accessor_class_unsigned; - -static grib_accessor_class _grib_accessor_class_g2_aerosol = { - &grib_accessor_class_unsigned, /* super */ - "g2_aerosol", /* name */ - sizeof(grib_accessor_g2_aerosol), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g2_aerosol = &_grib_accessor_class_g2_aerosol; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g2_aerosol* self = (grib_accessor_g2_aerosol*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int n = 0; - - self->productDefinitionTemplateNumber = grib_arguments_get_name(hand, c, n++); - self->stepType = grib_arguments_get_name(hand, c, n++); - self->optical = grib_arguments_get_long(hand, c, n++); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g2_aerosol* self = (grib_accessor_g2_aerosol*)a; - long productDefinitionTemplateNumber = 0; - grib_get_long(grib_handle_of_accessor(a), self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber); - - if (self->optical) - *val = grib2_is_PDTN_AerosolOptical(productDefinitionTemplateNumber); - else - *val = grib2_is_PDTN_Aerosol(productDefinitionTemplateNumber); - - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_g2_aerosol* self = (grib_accessor_g2_aerosol*)a; - grib_handle* hand = grib_handle_of_accessor(a); - long productDefinitionTemplateNumber = -1; - long productDefinitionTemplateNumberNew = -1; - /*long type=-1; - long stream=-1;*/ - long eps = -1; - char stepType[15] = {0,}; - size_t slen = 15; - /*int aerosol = *val;*/ - int isInstant = 0; - /*long derivedForecast=-1;*/ - int ret = 0; - - if (grib_get_long(hand, self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber) != GRIB_SUCCESS) - return GRIB_SUCCESS; - - /* - grib_get_long(hand, self->type,&type); - grib_get_long(hand, self->stream,&stream); - */ - ret = grib_get_string(hand, self->stepType, stepType, &slen); - Assert(ret == GRIB_SUCCESS); - - //eps = grib2_is_PDTN_EPS(productDefinitionTemplateNumber); - eps = grib_is_defined(hand, "perturbationNumber"); - - if (!strcmp(stepType, "instant")) - isInstant = 1; - - if (eps == 1) { - if (isInstant) { - productDefinitionTemplateNumberNew = 45; - } - else { - /*productDefinitionTemplateNumberNew = 47; PDT deprecated*/ - productDefinitionTemplateNumberNew = 85; - } - } - else { - if (isInstant) { - productDefinitionTemplateNumberNew = 48; /*44 is deprecated*/ - } - else { - productDefinitionTemplateNumberNew = 46; - } - } - - if (self->optical) { - /* Note: There is no interval based template for optical properties of aerosol! */ - if (eps) - productDefinitionTemplateNumberNew = 49; - else - productDefinitionTemplateNumberNew = 48; - if (!isInstant) { - grib_context_log(hand->context, GRIB_LOG_ERROR, - "The product definition templates for optical properties of aerosol are for a point-in-time only"); - } - } - - if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) { - grib_set_long(hand, self->productDefinitionTemplateNumber, productDefinitionTemplateNumberNew); - /*if (derivedForecast>=0) grib_set_long(hand, self->derivedForecast,derivedForecast);*/ - } - - return 0; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} diff --git a/src/grib_accessor_class_g2bitmap.cc b/src/grib_accessor_class_g2bitmap.cc deleted file mode 100644 index 441ad70a6..000000000 --- a/src/grib_accessor_class_g2bitmap.cc +++ /dev/null @@ -1,178 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_bitmap - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - IMPLEMENTS = init; - MEMBERS=const char* numberOfValues - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2bitmap -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in bitmap */ - const char* tableReference; - const char* missing_value; - const char* offsetbsec; - const char* sLength; - /* Members defined in g2bitmap */ - const char* numberOfValues; -} grib_accessor_g2bitmap; - -extern grib_accessor_class* grib_accessor_class_bitmap; - -static grib_accessor_class _grib_accessor_class_g2bitmap = { - &grib_accessor_class_bitmap, /* super */ - "g2bitmap", /* name */ - sizeof(grib_accessor_g2bitmap), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g2bitmap = &_grib_accessor_class_g2bitmap; - -/* END_CLASS_IMP */ - - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_g2bitmap* self = (grib_accessor_g2bitmap*)a; - - self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 4); -} - - -static void grib_set_bit_on(unsigned char* p, long* bitp) -{ - unsigned char o = 1; - p += (*bitp >> 3); - o <<= 7 - ((*bitp) % 8); - *p |= o; - (*bitp) += 1; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_g2bitmap* self = (grib_accessor_g2bitmap*)a; - - size_t tlen; - - unsigned char* buf = NULL; - size_t i; - int err = 0; - long pos = 0; - // long bmaplen = 0; - double miss_values = 0; - tlen = (*len + 7) / 8; - - if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->missing_value, &miss_values)) != GRIB_SUCCESS) - return err; - - buf = (unsigned char*)grib_context_malloc_clear(a->context, tlen); - if (!buf) - return GRIB_OUT_OF_MEMORY; - pos = 0; - for (i = 0; i < *len; i++) { - if (val[i] == miss_values) - pos++; - else { - // bmaplen++; - grib_set_bit_on(buf, &pos); - } - } - - if ((err = grib_set_long_internal(grib_handle_of_accessor(a), self->numberOfValues, *len)) != GRIB_SUCCESS) { - grib_context_free(a->context, buf); - return err; - } - - grib_buffer_replace(a, buf, tlen, 1, 1); - - grib_context_free(a->context, buf); - - return GRIB_SUCCESS; -} - - -static int value_count(grib_accessor* a, long* tlen) -{ - grib_accessor_g2bitmap* self = (grib_accessor_g2bitmap*)a; - int err; - *tlen = 0; - - err = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues, tlen); - return err; -} diff --git a/src/grib_accessor_class_g2bitmap_present.cc b/src/grib_accessor_class_g2bitmap_present.cc deleted file mode 100644 index 52378d4eb..000000000 --- a/src/grib_accessor_class_g2bitmap_present.cc +++ /dev/null @@ -1,150 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/**************************************** - * Enrico Fucile - *************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = pack_long - IMPLEMENTS = init - MEMBERS = const char* bitmapIndicator - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2bitmap_present -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g2bitmap_present */ - const char* bitmapIndicator; -} grib_accessor_g2bitmap_present; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g2bitmap_present = { - &grib_accessor_class_long, /* super */ - "g2bitmap_present", /* name */ - sizeof(grib_accessor_g2bitmap_present), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g2bitmap_present = &_grib_accessor_class_g2bitmap_present; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - int n = 0; - grib_accessor_g2bitmap_present* self = (grib_accessor_g2bitmap_present*)a; - self->bitmapIndicator = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = GRIB_SUCCESS; - long bitmapIndicator = 0; - - grib_accessor_g2bitmap_present* self = (grib_accessor_g2bitmap_present*)a; - - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitmapIndicator, &bitmapIndicator); - if (ret) { - if (ret == GRIB_NOT_FOUND) { - *val = 0; - return 0; - } - else - return ret; - } - - *val = 1; - if (bitmapIndicator == 255) - *val = 0; - - *len = 1; - return ret; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_g2bitmap_present* self = (grib_accessor_g2bitmap_present*)a; - long bitmapIndicator = 0; - - if (*val == 0) - bitmapIndicator = 255; - - return grib_set_long(grib_handle_of_accessor(a), self->bitmapIndicator, bitmapIndicator); -} diff --git a/src/grib_accessor_class_g2date.cc b/src/grib_accessor_class_g2date.cc deleted file mode 100644 index 698cd4a26..000000000 --- a/src/grib_accessor_class_g2date.cc +++ /dev/null @@ -1,175 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long;init - MEMBERS=const char* century - MEMBERS=const char* year - MEMBERS=const char* month - MEMBERS=const char* day - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2date -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in g2date */ - const char* century; - const char* year; - const char* month; - const char* day; -} grib_accessor_g2date; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_g2date = { - &grib_accessor_class_long, /* super */ - "g2date", /* name */ - sizeof(grib_accessor_g2date), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g2date = &_grib_accessor_class_g2date; - -/* END_CLASS_IMP */ -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g2date* self = (grib_accessor_g2date*)a; - int n = 0; - - self->year = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->month = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->day = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - const grib_accessor_g2date* self = (grib_accessor_g2date*)a; - - int ret = 0; - long year = 0; - long month = 0; - long day = 0; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->day, &day)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->month, &month)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->year, &year)) != GRIB_SUCCESS) - return ret; - - if (*len < 1) - return GRIB_WRONG_ARRAY_SIZE; - - val[0] = year * 10000 + month * 100 + day; - - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - const grib_accessor_g2date* self = (grib_accessor_g2date*)a; - - int ret = GRIB_SUCCESS; - long v = val[0]; - long year = 0; - long month = 0; - long day = 0; - - if (*len != 1) - return GRIB_WRONG_ARRAY_SIZE; - - year = v / 10000; - v %= 10000; - month = v / 100; - v %= 100; - day = v; - - if (!is_date_valid(year, month, day, 0, 0, 0)) { - // ECC-1777: For now just a warning. Will later change to an error - fprintf(stderr, "ECCODES WARNING : %s:%s: Date is not valid! year=%ld month=%ld day=%ld\n", - a->cclass->name, __func__, year, month, day); - } - - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->day, day)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->month, month)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->year, year)) != GRIB_SUCCESS) - return ret; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_g2latlon.cc b/src/grib_accessor_class_g2latlon.cc deleted file mode 100644 index 5549b79a3..000000000 --- a/src/grib_accessor_class_g2latlon.cc +++ /dev/null @@ -1,215 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/******************************************** - * Enrico Fucile - *********************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = is_missing;pack_missing - IMPLEMENTS = init - MEMBERS=const char* grid - MEMBERS=int index - MEMBERS=const char* given - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_missing(grib_accessor*); -static int is_missing(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2latlon -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in g2latlon */ - const char* grid; - int index; - const char* given; -} grib_accessor_g2latlon; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_g2latlon = { - &grib_accessor_class_double, /* super */ - "g2latlon", /* name */ - sizeof(grib_accessor_g2latlon), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - &pack_missing, /* pack_missing */ - &is_missing, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g2latlon = &_grib_accessor_class_g2latlon; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a; - int n = 0; - - self->grid = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->index = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); - self->given = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a; - int ret = 0; - - long given = 1; - double grid[6]; - size_t size = 6; - - if (*len < 1) { - ret = GRIB_ARRAY_TOO_SMALL; - return ret; - } - - if (self->given) - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->given, &given)) != GRIB_SUCCESS) - return ret; - - if (!given) { - *val = GRIB_MISSING_DOUBLE; - return GRIB_SUCCESS; - } - - if ((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->grid, grid, &size)) != GRIB_SUCCESS) - return ret; - - *val = grid[self->index]; - - return GRIB_SUCCESS; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a; - int ret = 0; - double grid[6]; - size_t size = 6; - double new_val = *val; - grib_handle* hand = grib_handle_of_accessor(a); - - if (*len < 1) { - ret = GRIB_ARRAY_TOO_SMALL; - return ret; - } - - if (self->given) { - long given = *val != GRIB_MISSING_DOUBLE; - if ((ret = grib_set_long_internal(hand, self->given, given)) != GRIB_SUCCESS) - return ret; - } - - if ((ret = grib_get_double_array_internal(hand, self->grid, grid, &size)) != GRIB_SUCCESS) - return ret; - - /* index 1 is longitudeOfFirstGridPointInDegrees - * index 3 is longitudeOfLastGridPointInDegrees - */ - if ((self->index == 1 || self->index == 3)) { - /* WMO regulation for GRIB edition 2: - * The longitude values shall be limited to the range 0 to 360 degrees inclusive */ - new_val = normalise_longitude_in_degrees(*val); - if (hand->context->debug && new_val != *val) { - fprintf(stderr, "ECCODES DEBUG pack_double g2latlon: normalise longitude %g -> %g\n", *val, new_val); - } - } - grid[self->index] = new_val; - - return grib_set_double_array_internal(hand, self->grid, grid, size); -} - -static int pack_missing(grib_accessor* a) -{ - grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a; - double missing = GRIB_MISSING_DOUBLE; - size_t size = 1; - - if (!self->given) - return GRIB_NOT_IMPLEMENTED; - - return pack_double(a, &missing, &size); -} - -static int is_missing(grib_accessor* a) -{ - grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a; - long given = 1; - - if (self->given) - grib_get_long_internal(grib_handle_of_accessor(a), self->given, &given); - - return !given; -} diff --git a/src/grib_accessor_class_g2lon.cc b/src/grib_accessor_class_g2lon.cc deleted file mode 100644 index c84776915..000000000 --- a/src/grib_accessor_class_g2lon.cc +++ /dev/null @@ -1,149 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/******************************************** - * Enrico Fucile - *********************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = init - MEMBERS=const char* longitude - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2lon -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in g2lon */ - const char* longitude; -} grib_accessor_g2lon; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_g2lon = { - &grib_accessor_class_double, /* super */ - "g2lon", /* name */ - sizeof(grib_accessor_g2lon), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g2lon = &_grib_accessor_class_g2lon; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g2lon* self = (grib_accessor_g2lon*)a; - int n = 0; - - self->longitude = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_g2lon* self = (grib_accessor_g2lon*)a; - int ret = 0; - long longitude; - - if ((ret = grib_get_long(grib_handle_of_accessor(a), self->longitude, &longitude)) != GRIB_SUCCESS) - return ret; - - if (longitude == GRIB_MISSING_LONG) { - *val = GRIB_MISSING_DOUBLE; - return GRIB_SUCCESS; - } - - *val = ((double)longitude) / 1000000.0; - - return GRIB_SUCCESS; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_g2lon* self = (grib_accessor_g2lon*)a; - long longitude; - double value = *val; - - if (value == GRIB_MISSING_DOUBLE) { - longitude = GRIB_MISSING_LONG; - } - else { - if (value < 0) - value += 360; - longitude = (long)(value * 1000000); - } - return grib_set_long(grib_handle_of_accessor(a), self->longitude, longitude); -} diff --git a/src/grib_accessor_class_g2step_range.cc b/src/grib_accessor_class_g2step_range.cc deleted file mode 100644 index 3800a4342..000000000 --- a/src/grib_accessor_class_g2step_range.cc +++ /dev/null @@ -1,369 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -#include "step.h" -#include "step_utilities.h" -#include -#include -#include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = pack_string;unpack_string;value_count - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = get_native_type;string_length - IMPLEMENTS = init - MEMBERS = const char* start_step - MEMBERS = const char* end_step - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_g2step_range -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in g2step_range */ - const char* start_step; - const char* end_step; -} grib_accessor_g2step_range; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_g2step_range = { - &grib_accessor_class_gen, /* super */ - "g2step_range", /* name */ - sizeof(grib_accessor_g2step_range), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_g2step_range = &_grib_accessor_class_g2step_range; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_g2step_range* self = (grib_accessor_g2step_range*)a; - - int n = 0; - - self->start_step = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->end_step = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - - a->length = 0; -} - -//static void dump(grib_accessor* a, grib_dumper* dumper) -//{ - //grib_dump_string(dumper, a, NULL); -//} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_g2step_range* self = (grib_accessor_g2step_range*)a; - grib_handle* h = grib_handle_of_accessor(a); - int ret = 0; - size_t size = 0; - double start_step_value = 0; - double end_step_value = 0; - long step_units; - - int show_hours = a->context->grib_hourly_steps_with_units; - - if ((ret = grib_get_double_internal(h, self->start_step, &start_step_value)) != GRIB_SUCCESS) - return ret; - if ((ret= grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) - return ret; - try { - if (eccodes::Unit{step_units} == eccodes::Unit{eccodes::Unit::Value::MISSING}) { - if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) - return ret; - } - - char fp_format[128] = "%g"; - size_t fp_format_len = sizeof(fp_format); - if ((ret = grib_get_string_internal(h, "formatForDoubles", fp_format, &fp_format_len)) != GRIB_SUCCESS) - return ret; - std::stringstream ss; - - eccodes::Step start_step{start_step_value, step_units}; - if (self->end_step == NULL) { - ss << start_step.value(fp_format, show_hours); - } - else { - if ((ret = grib_get_double_internal(h, self->end_step, &end_step_value)) != GRIB_SUCCESS) - return ret; - - eccodes::Step end_step{end_step_value, step_units}; - - if (start_step_value == end_step_value) { - ss << end_step.value(fp_format, show_hours); - } - else { - ss << start_step.value(fp_format, show_hours) << "-" << end_step.value(fp_format, show_hours); - } - } - - size = ss.str().size() + 1; - - if (*len < size) - return GRIB_ARRAY_TOO_SMALL; - - *len = size; - - memcpy(val, ss.str().c_str(), size); - } - catch (std::exception& e) { - grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_g2step_range::unpack_string: %s", e.what()); - return GRIB_DECODING_ERROR; - } - - return GRIB_SUCCESS; -} - - -// Step range format: [-] -// and can be in different units -// stepRange="X" in instantaneous field is equivalent to set step=X -// stepRange="X" in accumulated field is equivalent to startStep=X, endStep=startStep -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - grib_accessor_g2step_range* self = (grib_accessor_g2step_range*)a; - grib_handle* h = grib_handle_of_accessor(a); - int ret = 0; - - long force_step_units; - if ((ret = grib_get_long_internal(h, "forceStepUnits", &force_step_units)) != GRIB_SUCCESS) - return ret; - - if (h->loader) { // h->loader is set only when rebuilding or reparsing - force_step_units = 255; // See ECC-1768 and ECC-1800 - } - - try { - std::vector steps = parse_range(val, eccodes::Unit{force_step_units}); - if (steps.size() == 0) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Could not parse step range: %s", val); - return GRIB_INVALID_ARGUMENT; - } - - eccodes::Step step_0; - eccodes::Step step_1; - if (eccodes::Unit{force_step_units} == eccodes::Unit{eccodes::Unit::Value::MISSING}) { - if (steps.size() > 1) - std::tie(step_0, step_1) = find_common_units(steps[0].optimize_unit(), steps[1].optimize_unit()); - else - step_0 = steps[0].optimize_unit(); - } - else { - step_0 = eccodes::Step{steps[0].value(eccodes::Unit{force_step_units}), eccodes::Unit{force_step_units}}; - if (steps.size() > 1) { - step_1 = eccodes::Step{steps[1].value(eccodes::Unit{force_step_units}), eccodes::Unit{force_step_units}}; - } - } - - if ((ret = grib_set_long_internal(h, "startStepUnit", step_0.unit().value()))) - return ret; - if ((ret = set_step(h, "forecastTime" , "indicatorOfUnitOfTimeRange", step_0)) != GRIB_SUCCESS) - return ret; - - if (self->end_step != NULL) { - if (steps.size() > 1) { - if ((ret = grib_set_long_internal(h, "endStepUnit", step_1.unit().value()))) - return ret; - if ((ret = grib_set_long_internal(h, self->end_step, step_1.value()))) - return ret; - } else { - if ((ret = grib_set_long_internal(h, "endStepUnit", step_0.unit().value()))) - return ret; - if ((ret = grib_set_long_internal(h, self->end_step, step_0.value()))) - return ret; - } - } - } - catch (std::exception& e) { - grib_context_log(a->context, GRIB_LOG_ERROR, "grib_accessor_class_g2step_range::pack_string: %s", e.what()); - return GRIB_INVALID_ARGUMENT; - } - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - return 255; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - char buff[100]; - size_t bufflen = 100; - - snprintf(buff, sizeof(buff), "%ld", *val); - return pack_string(a, buff, &bufflen); -} - - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_g2step_range* self = (grib_accessor_g2step_range*)a; - grib_handle* h = grib_handle_of_accessor(a); - int ret = 0; - long end_start_value = 0; - long end_step_value = 0; - long step_units = 0; - - if ((ret = grib_get_long_internal(h, self->start_step, &end_start_value)) != GRIB_SUCCESS) - return ret; - try { - if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) - throw std::runtime_error("Failed to get stepUnits"); - if (eccodes::Unit{step_units} == eccodes::Unit{eccodes::Unit::Value::MISSING}) { - if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) - return ret; - } - - eccodes::Step start_step{end_start_value, step_units}; - if (self->end_step == NULL) { - *val = start_step.value(); - } - else { - if ((ret = grib_get_long_internal(h, self->end_step, &end_step_value)) != GRIB_SUCCESS) - return ret; - eccodes::Step end_step{end_step_value, step_units}; - *val = end_step.value(); - } - } - catch (std::exception& e) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Failed to unpack step range: %s", e.what()); - return GRIB_DECODING_ERROR; - } - - return GRIB_SUCCESS; -} - - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_g2step_range* self = (grib_accessor_g2step_range*)a; - grib_handle* h = grib_handle_of_accessor(a); - int ret = 0; - double end_start_value = 0; - double end_step_value = 0; - long step_units = 0; - - if ((ret = grib_get_double_internal(h, self->start_step, &end_start_value)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) - throw std::runtime_error("Failed to get stepUnits"); - - try { - if (eccodes::Unit{step_units} == eccodes::Unit{eccodes::Unit::Value::MISSING}) { - if ((ret = grib_get_long_internal(h, "stepUnits", &step_units)) != GRIB_SUCCESS) - return ret; - } - - eccodes::Step start_step{end_start_value, step_units}; - if (self->end_step == NULL) { - *val = start_step.value(); - } - else { - if ((ret = grib_get_double_internal(h, self->end_step, &end_step_value)) != GRIB_SUCCESS) - return ret; - eccodes::Step end_step{end_step_value, step_units}; - *val = end_step.value(); - } - } - catch (std::exception& e) { - grib_context_log(a->context, GRIB_LOG_ERROR, "grid_accessor_g2step_range::unpack_double: %s", e.what()); - return GRIB_DECODING_ERROR; - } - - return GRIB_SUCCESS; -} - - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} diff --git a/src/grib_accessor_class_gaussian_grid_name.cc b/src/grib_accessor_class_gaussian_grid_name.cc deleted file mode 100644 index 21117d4f1..000000000 --- a/src/grib_accessor_class_gaussian_grid_name.cc +++ /dev/null @@ -1,176 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;unpack_string; get_native_type;string_length - MEMBERS = const char* N - MEMBERS = const char* Ni - MEMBERS = const char* isOctahedral - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_gaussian_grid_name -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in gaussian_grid_name */ - const char* N; - const char* Ni; - const char* isOctahedral; -} grib_accessor_gaussian_grid_name; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_gaussian_grid_name = { - &grib_accessor_class_gen, /* super */ - "gaussian_grid_name", /* name */ - sizeof(grib_accessor_gaussian_grid_name), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_gaussian_grid_name = &_grib_accessor_class_gaussian_grid_name; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_gaussian_grid_name* self = (grib_accessor_gaussian_grid_name*)a; - int n = 0; - - self->N = grib_arguments_get_name(a->parent->h, arg, n++); - self->Ni = grib_arguments_get_name(a->parent->h, arg, n++); - self->isOctahedral = grib_arguments_get_name(a->parent->h, arg, n++); - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -#define MAX_GRIDNAME_LEN 16 - -static int unpack_string(grib_accessor* a, char* v, size_t* len) -{ - grib_accessor_gaussian_grid_name* self = (grib_accessor_gaussian_grid_name*)a; - - long N = 0, Ni = 0; - char tmp[MAX_GRIDNAME_LEN] = {0,}; - size_t length = 0; - int ret = GRIB_SUCCESS; - - if ((ret = grib_get_long_internal(a->parent->h, self->N, &N)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(a->parent->h, self->Ni, &Ni)) != GRIB_SUCCESS) - return ret; - - if (Ni == GRIB_MISSING_LONG) { - /* Reduced gaussian grid */ - long isOctahedral = 0; - if ((ret = grib_get_long_internal(a->parent->h, self->isOctahedral, &isOctahedral)) != GRIB_SUCCESS) - return ret; - if (isOctahedral == 1) { - snprintf(tmp, sizeof(tmp), "O%ld", N); - } - else { - snprintf(tmp, sizeof(tmp), "N%ld", N); /* Classic */ - } - } - else { - /* Regular gaussian grid */ - snprintf(tmp, sizeof(tmp), "F%ld", N); - } - length = strlen(tmp) + 1; - - if (*len < length) { - const char* cclass_name = a->cclass->name; - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, length, *len); - *len = length; - return GRIB_BUFFER_TOO_SMALL; - } - - strcpy(v, tmp); - *len = length; - return GRIB_SUCCESS; -} - -static size_t string_length(grib_accessor* a) -{ - return MAX_GRIDNAME_LEN; -} diff --git a/src/grib_accessor_class_gds_is_present.cc b/src/grib_accessor_class_gds_is_present.cc deleted file mode 100644 index 6066231ac..000000000 --- a/src/grib_accessor_class_gds_is_present.cc +++ /dev/null @@ -1,183 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/****************************** - * Enrico Fucile - *****************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = pack_long - IMPLEMENTS = init - MEMBERS = const char* gds_present - MEMBERS = const char* grid_definition - MEMBERS = const char* bitmap_present - MEMBERS = const char* values - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_gds_is_present -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in gds_is_present */ - const char* gds_present; - const char* grid_definition; - const char* bitmap_present; - const char* values; -} grib_accessor_gds_is_present; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_gds_is_present = { - &grib_accessor_class_long, /* super */ - "gds_is_present", /* name */ - sizeof(grib_accessor_gds_is_present), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_gds_is_present = &_grib_accessor_class_gds_is_present; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - int n = 0; - grib_accessor_gds_is_present* self = (grib_accessor_gds_is_present*)a; - grib_handle* h = grib_handle_of_accessor(a); - self->gds_present = grib_arguments_get_name(h, c, n++); - self->grid_definition = grib_arguments_get_name(h, c, n++); - self->bitmap_present = grib_arguments_get_name(h, c, n++); - self->values = grib_arguments_get_name(h, c, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; - a->length = 0; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_gds_is_present* self = (grib_accessor_gds_is_present*)a; - long missing = 255; - int ret = 0; - size_t size = 0; - double* values = NULL; - grib_context* c = a->context; - grib_handle* h = grib_handle_of_accessor(a); - - if (*val != 1) - return GRIB_NOT_IMPLEMENTED; - - if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) - return ret; - - values = (double*)grib_context_malloc(c, size * sizeof(double)); - if (!values) - return GRIB_OUT_OF_MEMORY; - - if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - if ((ret = grib_set_long_internal(h, self->gds_present, *val)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_set_long_internal(h, self->bitmap_present, *val)) != GRIB_SUCCESS) - return ret; - - - if ((ret = grib_set_long_internal(h, self->grid_definition, missing)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) - return ret; - - grib_context_free(c, values); - - return GRIB_SUCCESS; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = 0; - grib_handle* h = grib_handle_of_accessor(a); - grib_accessor_gds_is_present* self = (grib_accessor_gds_is_present*)a; - - if ((ret = grib_get_long_internal(h, self->gds_present, val)) != GRIB_SUCCESS) - return ret; - - *len = 1; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_gds_not_present_bitmap.cc b/src/grib_accessor_class_gds_not_present_bitmap.cc deleted file mode 100644 index d8ec8ecd1..000000000 --- a/src/grib_accessor_class_gds_not_present_bitmap.cc +++ /dev/null @@ -1,216 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/****************************** - * Enrico Fucile - *****************************/ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init - IMPLEMENTS = unpack_double - IMPLEMENTS = pack_double - IMPLEMENTS = value_count - IMPLEMENTS = get_native_type - MEMBERS=const char* missing_value - MEMBERS=const char* number_of_values - MEMBERS=const char* number_of_points - MEMBERS=const char* latitude_of_first_point - MEMBERS=const char* ni - - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_gds_not_present_bitmap -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in gds_not_present_bitmap */ - const char* missing_value; - const char* number_of_values; - const char* number_of_points; - const char* latitude_of_first_point; - const char* ni; -} grib_accessor_gds_not_present_bitmap; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_gds_not_present_bitmap = { - &grib_accessor_class_gen, /* super */ - "gds_not_present_bitmap", /* name */ - sizeof(grib_accessor_gds_not_present_bitmap), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_gds_not_present_bitmap = &_grib_accessor_class_gds_not_present_bitmap; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - int n = 0; - grib_accessor_gds_not_present_bitmap* self = (grib_accessor_gds_not_present_bitmap*)a; - grib_handle* hand = grib_handle_of_accessor(a); - - self->missing_value = grib_arguments_get_name(hand, args, n++); - self->number_of_values = grib_arguments_get_name(hand, args, n++); - self->number_of_points = grib_arguments_get_name(hand, args, n++); - self->latitude_of_first_point = grib_arguments_get_name(hand, args, n++); - self->ni = grib_arguments_get_name(hand, args, n++); - a->length = 0; -} - -static int value_count(grib_accessor* a, long* number_of_points) -{ - grib_accessor_gds_not_present_bitmap* self = (grib_accessor_gds_not_present_bitmap*)a; - *number_of_points = 0; - return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_points, number_of_points); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_gds_not_present_bitmap* self = (grib_accessor_gds_not_present_bitmap*)a; - grib_handle* hand = grib_handle_of_accessor(a); - - long number_of_points = 0, number_of_values = 0, ni = 0; - long latitude_of_first_point = 0; - size_t i = 0; - size_t n_vals = 0; - long nn = 0; - long missing_value; - - int err = 0; - double* coded_vals = NULL; - err = grib_value_count(a, &nn); - n_vals = nn; - if (err) - return err; - - if ((err = grib_get_long(hand, self->number_of_points, &number_of_points)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_long(hand, self->number_of_values, &number_of_values)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_long(hand, self->latitude_of_first_point, &latitude_of_first_point)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_long(hand, self->missing_value, &missing_value)) != GRIB_SUCCESS) - return err; - - if ((err = grib_get_long(hand, self->ni, &ni)) != GRIB_SUCCESS) - return err; - - if (*len < number_of_points) { - *len = n_vals; - return GRIB_ARRAY_TOO_SMALL; - } - - if (number_of_values > 0) { - coded_vals = (double*)grib_context_malloc(a->context, number_of_values * sizeof(double)); - - if (coded_vals == NULL) - return GRIB_OUT_OF_MEMORY; - } - - if (latitude_of_first_point == 0) { - for (i = 0; i < number_of_values; i++) - val[i] = 1; - for (i = number_of_values; i < number_of_points; i++) - val[i] = 0; - } - else { - for (i = 0; i < ni - 1; i++) - val[i] = 0; - for (i = ni - 1; i < number_of_points; i++) - val[i] = 1; - } - - *len = number_of_points; - - grib_context_free(a->context, coded_vals); - return err; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - // See deprecated/grib_accessor_class_gds_not_present_bitmap.cc for - // a possible implementation - return GRIB_NOT_IMPLEMENTED; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_DOUBLE; -} diff --git a/src/grib_accessor_class_gen.cc b/src/grib_accessor_class_gen.cc deleted file mode 100644 index b611f5043..000000000 --- a/src/grib_accessor_class_gen.cc +++ /dev/null @@ -1,675 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/*************************************************************************** - * Jean Baptiste Filippi - 01.11.2005 * - * Enrico Fucile * - * Shahram Najm * - ***************************************************************************/ -#include "grib_api_internal.h" -#include "grib_value.h" -#include -#include - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - IMPLEMENTS = unpack_long;pack_long; clear - IMPLEMENTS = unpack_double;pack_double;unpack_double_element;unpack_double_element_set - IMPLEMENTS = unpack_float - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = unpack_string_array;pack_string_array - IMPLEMENTS = unpack_bytes;pack_bytes - IMPLEMENTS = unpack_double_subarray - IMPLEMENTS = init;dump;destroy;string_length - IMPLEMENTS = get_native_type;sub_section - IMPLEMENTS = next_offset;value_count;byte_offset;byte_count - IMPLEMENTS = notify_change;pack_expression - IMPLEMENTS = update_size; next; preferred_size - IMPLEMENTS = compare;is_missing;make_clone - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static grib_section* sub_section(grib_accessor* a); -static int get_native_type(grib_accessor*); -static int is_missing(grib_accessor*); -static int pack_bytes(grib_accessor*, const unsigned char*, size_t* len); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int pack_string_array(grib_accessor*, const char**, size_t* len); -static int pack_expression(grib_accessor*, grib_expression*); -static int unpack_bytes(grib_accessor*, unsigned char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int unpack_string_array(grib_accessor*, char**, size_t* len); -static size_t string_length(grib_accessor*); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int notify_change(grib_accessor*, grib_accessor*); -static void update_size(grib_accessor*, size_t); -static size_t preferred_size(grib_accessor*, int); -static grib_accessor* next(grib_accessor*, int); -static int compare(grib_accessor*, grib_accessor*); -static int unpack_double_element(grib_accessor*, size_t i, double* val); -static int unpack_double_element_set(grib_accessor*, const size_t* index_array, size_t len, double* val_array); -static int unpack_double_subarray(grib_accessor*, double* val, size_t start, size_t len); -static int clear(grib_accessor*); -static grib_accessor* make_clone(grib_accessor*, grib_section*, int*); - -typedef struct grib_accessor_gen -{ - grib_accessor att; - /* Members defined in gen */ -} grib_accessor_gen; - - -static grib_accessor_class _grib_accessor_class_gen = { - 0, /* super */ - "gen", /* name */ - sizeof(grib_accessor_gen), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - &get_native_type, /* get native type */ - &sub_section, /* get sub_section */ - 0, /* pack_missing */ - &is_missing, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - &pack_string_array, /* pack_string_array */ - &unpack_string_array, /* unpack_string_array */ - &pack_bytes, /* pack_bytes */ - &unpack_bytes, /* unpack_bytes */ - &pack_expression, /* pack_expression */ - ¬ify_change, /* notify_change */ - &update_size, /* update_size */ - &preferred_size, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - &next, /* next accessor */ - &compare, /* compare vs. another accessor */ - &unpack_double_element, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - &unpack_double_element_set, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - &unpack_double_subarray, /* unpack a subarray */ - &clear, /* clear */ - &make_clone, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_gen = &_grib_accessor_class_gen; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* param) -{ - grib_action* act = (grib_action*)(a->creator); - if (a->flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { - a->length = 0; - if (!a->vvalue) - a->vvalue = (grib_virtual_value*)grib_context_malloc_clear(a->context, sizeof(grib_virtual_value)); - a->vvalue->type = grib_accessor_get_native_type(a); - a->vvalue->length = len; - if (act->default_value != NULL) { - const char* p = 0; - size_t s_len = 1; - long l; - int ret = 0; - double d; - char tmp[1024]; - grib_expression* expression = grib_arguments_get_expression(grib_handle_of_accessor(a), act->default_value, 0); - int type = grib_expression_native_type(grib_handle_of_accessor(a), expression); - switch (type) { - case GRIB_TYPE_DOUBLE: - grib_expression_evaluate_double(grib_handle_of_accessor(a), expression, &d); - grib_pack_double(a, &d, &s_len); - break; - - case GRIB_TYPE_LONG: - grib_expression_evaluate_long(grib_handle_of_accessor(a), expression, &l); - grib_pack_long(a, &l, &s_len); - break; - - default: - s_len = sizeof(tmp); - p = grib_expression_evaluate_string(grib_handle_of_accessor(a), expression, tmp, &s_len, &ret); - if (ret != GRIB_SUCCESS) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to evaluate %s as string", a->name); - Assert(0); - } - s_len = strlen(p) + 1; - grib_pack_string(a, p, &s_len); - break; - } - } - } - else { - a->length = len; - } -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - const int type = grib_accessor_get_native_type(a); - switch (type) { - case GRIB_TYPE_STRING: - grib_dump_string(dumper, a, NULL); - break; - case GRIB_TYPE_DOUBLE: - grib_dump_double(dumper, a, NULL); - break; - case GRIB_TYPE_LONG: - grib_dump_long(dumper, a, NULL); - break; - default: - grib_dump_bytes(dumper, a, NULL); - } -} - -static long next_offset(grib_accessor* a) -{ - return a->offset + a->length; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - return 1024; -} - -static long byte_count(grib_accessor* a) -{ - return a->length; -} - -static int get_native_type(grib_accessor* a) -{ - grib_context_log(a->context, GRIB_LOG_ERROR, - "Accessor %s [%s] must implement 'get_native_type'", a->name, a->cclass->name); - return GRIB_TYPE_UNDEFINED; -} - -static long byte_offset(grib_accessor* a) -{ - return a->offset; -} - -static int unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len) -{ - unsigned char* buf = grib_handle_of_accessor(a)->buffer->data; - const long length = grib_byte_count(a); - const long offset = grib_byte_offset(a); - - if (*len < length) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it is %ld bytes long", a->name, length); - *len = length; - return GRIB_ARRAY_TOO_SMALL; - } - - memcpy(val, buf + offset, length); - *len = length; - - return GRIB_SUCCESS; -} - -static int clear(grib_accessor* a) -{ - unsigned char* buf = grib_handle_of_accessor(a)->buffer->data; - const long length = grib_byte_count(a); - const long offset = grib_byte_offset(a); - - memset(buf + offset, 0, length); - - return GRIB_SUCCESS; -} - -static int unpack_long(grib_accessor* a, long* v, size_t* len) -{ - int type = GRIB_TYPE_UNDEFINED; - if (a->cclass->unpack_double && a->cclass->unpack_double != &unpack_double) { - double val = 0.0; - size_t l = 1; - grib_unpack_double(a, &val, &l); - if (val == GRIB_MISSING_DOUBLE) - *v = GRIB_MISSING_LONG; - else - *v = (long)val; - grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting double %s to long", a->name); - return GRIB_SUCCESS; - } - - if (a->cclass->unpack_string && a->cclass->unpack_string != &unpack_string) { - char val[1024]; - size_t l = sizeof(val); - char* last = NULL; - grib_unpack_string(a, val, &l); - - *v = strtol(val, &last, 10); - - if (*last == 0) { - grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting string %s to long", a->name); - return GRIB_SUCCESS; - } - } - - grib_context_log(a->context, GRIB_LOG_ERROR, "Cannot unpack key '%s' as long", a->name); - if (grib_get_native_type(grib_handle_of_accessor(a), a->name, &type) == GRIB_SUCCESS) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Try unpacking as %s", grib_get_type_name(type)); - } - return GRIB_NOT_IMPLEMENTED; -} - -template -static int unpack(grib_accessor* a, T* v, size_t* len) -{ - static_assert(std::is_floating_point::value, "Requires floating point numbers"); - int type = GRIB_TYPE_UNDEFINED; - const char* Tname = type_to_string(*v); - if (a->cclass->unpack_long && a->cclass->unpack_long != &unpack_long) { - long val = 0; - size_t l = 1; - grib_unpack_long(a, &val, &l); - *v = val; - grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to %s", a->name, Tname); - return GRIB_SUCCESS; - } - - if (a->cclass->unpack_string && a->cclass->unpack_string != &unpack_string) { - char val[1024]; - size_t l = sizeof(val); - char* last = NULL; - grib_unpack_string(a, val, &l); - - *v = strtod(val, &last); - if (*last == 0) { /* conversion of string to double worked */ - grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting string %s to %s", a->name, Tname); - return GRIB_SUCCESS; - } - } - - grib_context_log(a->context, GRIB_LOG_ERROR, "Cannot unpack key '%s' as %s", a->name, Tname); - if (grib_get_native_type(grib_handle_of_accessor(a), a->name, &type) == GRIB_SUCCESS) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Try unpacking as %s", grib_get_type_name(type)); - } - - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_double(grib_accessor* a, double* v, size_t* len) -{ - return unpack(a, v, len); -} - -static int unpack_float(grib_accessor* a, float* v, size_t* len) -{ - return unpack(a, v, len); -} - -static int unpack_string(grib_accessor* a, char* v, size_t* len) -{ - int err = 0; - if (a->cclass->unpack_double && a->cclass->unpack_double != &unpack_double) { - double val = 0.0; - size_t l = 1; - err = grib_unpack_double(a, &val, &l); - if (err) return err; - snprintf(v, 64, "%g", val); - *len = strlen(v); - grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting double %s to string", a->name); - return GRIB_SUCCESS; - } - - if (a->cclass->unpack_long && a->cclass->unpack_long != &unpack_long) { - long val = 0; - size_t l = 1; - err = grib_unpack_long(a, &val, &l); - if (err) return err; - snprintf(v, 64, "%ld", val); - *len = strlen(v); - grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to string\n", a->name); - return GRIB_SUCCESS; - } - - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_string_array(grib_accessor* a, char** v, size_t* len) -{ - size_t length = 0; - - int err = grib_get_string_length_acc(a, &length); - if (err) - return err; - v[0] = (char*)grib_context_malloc_clear(a->context, length); - grib_unpack_string(a, v[0], &length); // TODO(masn): check return value - *len = 1; - - return GRIB_SUCCESS; -} - -static int pack_expression(grib_accessor* a, grib_expression* e) -{ - size_t len = 1; - long lval = 0; - double dval = 0; - const char* cval = NULL; - int ret = 0; - grib_handle* hand = grib_handle_of_accessor(a); - - // Use the native type of the expression not the accessor - switch (grib_expression_native_type(hand, e)) { - case GRIB_TYPE_LONG: { - len = 1; - ret = grib_expression_evaluate_long(hand, e, &lval); - if (ret != GRIB_SUCCESS) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as long (from %s)", - a->name, e->cclass->name); - return ret; - } - /*if (hand->context->debug) - printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %ld\n", a->name,lval);*/ - return grib_pack_long(a, &lval, &len); - } - - case GRIB_TYPE_DOUBLE: { - len = 1; - ret = grib_expression_evaluate_double(hand, e, &dval); - if (ret != GRIB_SUCCESS) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as double (from %s)", - a->name, e->cclass->name); - return ret; - } - /*if (hand->context->debug) - printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %g\n", a->name, dval);*/ - return grib_pack_double(a, &dval, &len); - } - - case GRIB_TYPE_STRING: { - char tmp[1024]; - len = sizeof(tmp); - cval = grib_expression_evaluate_string(hand, e, tmp, &len, &ret); - if (ret != GRIB_SUCCESS) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to set %s as string (from %s)", - a->name, e->cclass->name); - return ret; - } - len = strlen(cval); - /*if (hand->context->debug) - printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %s\n", a->name, cval);*/ - return grib_pack_string(a, cval, &len); - } - } - - return GRIB_NOT_IMPLEMENTED; -} - -static int pack_long(grib_accessor* a, const long* v, size_t* len) -{ - grib_context* c = a->context; - if (a->cclass->pack_double && a->cclass->pack_double != &pack_double) { - double* val = (double*)grib_context_malloc(c, *len * (sizeof(double))); - if (!val) { - grib_context_log(c, GRIB_LOG_ERROR, "Unable to allocate %zu bytes", *len * (sizeof(double))); - return GRIB_OUT_OF_MEMORY; - } - for (size_t i = 0; i < *len; i++) - val[i] = v[i]; - int ret = grib_pack_double(a, val, len); - grib_context_free(c, val); - return ret; - } - grib_context_log(c, GRIB_LOG_ERROR, "Should not pack '%s' as an integer", a->name); - if (a->cclass->pack_string && a->cclass->pack_string != &pack_string) { - grib_context_log(c, GRIB_LOG_ERROR, "Try packing as a string"); - } - return GRIB_NOT_IMPLEMENTED; -} - -static int pack_double_array_as_long(grib_accessor* a, const double* v, size_t* len) -{ - grib_context* c = a->context; - int ret = GRIB_SUCCESS; - size_t numBytes = *len * (sizeof(long)); - long* lValues = (long*)grib_context_malloc(c, numBytes); - if (!lValues) { - grib_context_log(c, GRIB_LOG_ERROR, "Unable to allocate %ld bytes", numBytes); - return GRIB_OUT_OF_MEMORY; - } - for (size_t i = 0; i < *len; i++) - lValues[i] = (long)v[i]; /* convert from double to long */ - ret = grib_pack_long(a, lValues, len); - grib_context_free(c, lValues); - return ret; -} - -static int pack_double(grib_accessor* a, const double* v, size_t* len) -{ - int do_pack_as_long = 0; - grib_context* c = a->context; - if (a->cclass->pack_long && a->cclass->pack_long != &pack_long) { - do_pack_as_long = 1; - } - else { - /* ECC-648: Special case of codetable */ - if (strcmp(a->cclass->name, "codetable") == 0) { - do_pack_as_long = 1; - } - } - if (do_pack_as_long) { - return pack_double_array_as_long(a, v, len); - } - grib_context_log(c, GRIB_LOG_ERROR, "Should not pack '%s' as a double", a->name); - if (a->cclass->pack_string && a->cclass->pack_string != &pack_string) { - grib_context_log(c, GRIB_LOG_ERROR, "Try packing as a string"); - } - return GRIB_NOT_IMPLEMENTED; -} - -static int pack_string_array(grib_accessor* a, const char** v, size_t* len) -{ - int err = 0; - size_t length = 0; - grib_accessor* as = 0; - - as = a; - long i = (long)*len - 1; - while (as && i >= 0) { - length = strlen(v[i]); - err = grib_pack_string(as, v[i], &length); - if (err) - return err; - --i; - as = as->same; - } - return GRIB_SUCCESS; -} - -static int pack_string(grib_accessor* a, const char* v, size_t* len) -{ - if (a->cclass->pack_double && a->cclass->pack_double != &pack_double) { - size_t l = 1; - char* endPtr = NULL; /* for error handling */ - double val = strtod(v, &endPtr); - if (*endPtr) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Invalid value (%s) for key '%s'. String cannot be converted to a double", - __func__, v, a->name); - return GRIB_WRONG_TYPE; - } - return grib_pack_double(a, &val, &l); - } - - if (a->cclass->pack_long && a->cclass->pack_long != &pack_long) { - size_t l = 1; - long val = atol(v); - return grib_pack_long(a, &val, &l); - } - - grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack '%s' as string", a->name); - return GRIB_NOT_IMPLEMENTED; -} - -static int pack_bytes(grib_accessor* a, const unsigned char* val, size_t* len) -{ - const size_t length = *len; - if (length != a->length) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "pack_bytes: Wrong size (%zu) for %s. It is %ld bytes long", - length, a->name, a->length); - return GRIB_BUFFER_TOO_SMALL; - } - grib_buffer_replace(a, val, length, 1, 1); - return GRIB_SUCCESS; -} - -static void destroy(grib_context* ct, grib_accessor* a) -{ - grib_dependency_remove_observed(a); - grib_dependency_remove_observer(a); - if (a->vvalue != NULL) { - grib_context_free(ct, a->vvalue); - a->vvalue = NULL; - } - /*grib_context_log(ct,GRIB_LOG_DEBUG,"address=%p",a);*/ -} - -static grib_section* sub_section(grib_accessor* a) -{ - return NULL; -} - -static int notify_change(grib_accessor* self, grib_accessor* observed) -{ - /* Default behaviour is to notify creator */ - return grib_action_notify_change(self->creator, self, observed); -} - -static void update_size(grib_accessor* a, size_t s) -{ - grib_context_log(a->context, GRIB_LOG_FATAL, - "Accessor %s [%s] must implement 'update_size'", a->name, a->cclass->name); -} - -static grib_accessor* next(grib_accessor* a, int mod) -{ - grib_accessor* next = NULL; - if (a->next) { - next = a->next; - } - else { - if (a->parent->owner) - next = a->parent->owner->cclass->next(a->parent->owner, 0); - } - return next; -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - return GRIB_NOT_IMPLEMENTED; -} - -/* Redefined in all padding */ - -static size_t preferred_size(grib_accessor* a, int from_handle) -{ - return a->length; -} - -static int is_missing(grib_accessor* a) -{ - int i = 0; - int is_missing = 1; - unsigned char ones = 0xff; - unsigned char* v = NULL; - - if (a->flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { - if (a->vvalue == NULL) { - grib_context_log(a->context, GRIB_LOG_ERROR, "%s internal error (flags=0x%lX)", a->name, a->flags); - Assert(!"grib_accessor_class_gen::is_missing(): a->vvalue == NULL"); - return 0; - } - return a->vvalue->missing; - } - Assert(a->length >= 0); - - v = grib_handle_of_accessor(a)->buffer->data + a->offset; - - for (i = 0; i < a->length; i++) { - if (*v != ones) { - is_missing = 0; - break; - } - v++; - } - - return is_missing; -} - -static int unpack_double_element(grib_accessor* a, size_t i, double* val) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_double_subarray(grib_accessor* a, double* val, size_t start, size_t len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static grib_accessor* make_clone(grib_accessor* a, grib_section* s, int* err) -{ - *err = GRIB_NOT_IMPLEMENTED; - return NULL; -} diff --git a/src/grib_accessor_class_getenv.cc b/src/grib_accessor_class_getenv.cc deleted file mode 100644 index 6bc0ced3e..000000000 --- a/src/grib_accessor_class_getenv.cc +++ /dev/null @@ -1,157 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_ascii - IMPLEMENTS = pack_string;unpack_string;value_count - IMPLEMENTS = init;string_length - MEMBERS= const char* name - MEMBERS= char* value - MEMBERS= const char* default_value - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_getenv -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in getenv */ - const char* name; - char* value; - const char* default_value; -} grib_accessor_getenv; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_getenv = { - &grib_accessor_class_ascii, /* super */ - "getenv", /* name */ - sizeof(grib_accessor_getenv), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_getenv = &_grib_accessor_class_getenv; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* args) -{ - grib_accessor_getenv* self = (grib_accessor_getenv*)a; - static char undefined[] = "undefined"; - - self->name = grib_arguments_get_string(grib_handle_of_accessor(a), args, 0); - self->default_value = grib_arguments_get_string(grib_handle_of_accessor(a), args, 1); - if (!self->default_value) - self->default_value = undefined; - self->value = 0; -} - -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_getenv* self = (grib_accessor_getenv*)a; - char* v = 0; - size_t l = 0; - - if (!self->value) { - v = getenv(self->name); - if (!v) - v = (char*)self->default_value; - self->value = v; - } - - l = strlen(self->value); - if (*len < l) - return GRIB_BUFFER_TOO_SMALL; - snprintf(val, 1024, "%s", self->value); - *len = strlen(self->value); - - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - return 1024; -} diff --git a/src/grib_accessor_class_group.cc b/src/grib_accessor_class_group.cc deleted file mode 100644 index df2118bff..000000000 --- a/src/grib_accessor_class_group.cc +++ /dev/null @@ -1,272 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_string - IMPLEMENTS = unpack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = init;dump;string_length - IMPLEMENTS = value_count - IMPLEMENTS = next_offset - IMPLEMENTS = get_native_type - IMPLEMENTS = compare - MEMBERS = char endCharacter - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_group -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in group */ - char endCharacter; -} grib_accessor_group; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_group = { - &grib_accessor_class_gen, /* super */ - "group", /* name */ - sizeof(grib_accessor_group), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_group = &_grib_accessor_class_group; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_buffer* buffer = grib_handle_of_accessor(a)->buffer; - grib_accessor_group* self = (grib_accessor_group*)a; - - size_t i = 0; - unsigned char* v; - const char* s = grib_arguments_get_string(grib_handle_of_accessor(a), arg, 0); - - if (s && strlen(s) > 1) { - grib_context_log(a->context, GRIB_LOG_WARNING, - "Using only first character as group end of %s not the string %s", a->name, s); - } - - self->endCharacter = s ? s[0] : 0; - - v = buffer->data + a->offset; - i = 0; - if (s) { - while (*v != self->endCharacter && i <= buffer->ulength) { - if (*v > 126) - *v = 32; - v++; - i++; - } - } - else { - while (*v > 32 && *v != 61 && *v < 127 && i <= buffer->ulength) { - v++; - i++; - } - } - a->length = i; - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - return a->length; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string(dumper, a, NULL); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - long i = 0; - size_t l = a->length + 1; - grib_handle* h = grib_handle_of_accessor(a); - - if (*len < l) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - a->cclass->name, a->name, l, *len); - *len = l; - return GRIB_ARRAY_TOO_SMALL; - } - - for (i = 0; i < a->length; i++) - val[i] = h->buffer->data[a->offset + i]; - val[i] = 0; - *len = i; - return GRIB_SUCCESS; -} - -static int unpack_long(grib_accessor* a, long* v, size_t* len) -{ - char val[1024] = {0,}; - size_t l = sizeof(val); - size_t i = 0; - char* last = NULL; - int err = grib_unpack_string(a, val, &l); - - if (err) - return err; - - i = 0; - while (i < l - 1 && val[i] == ' ') - i++; - - if (val[i] == 0) { - *v = 0; - return 0; - } - if (val[i + 1] == ' ' && i < l - 2) - val[i + 1] = 0; - - *v = strtol(val, &last, 10); - - grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name); - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* v, size_t* len) -{ - char val[1024]; - size_t l = sizeof(val); - char* last = NULL; - grib_unpack_string(a, val, &l); - - *v = strtod(val, &last); - - if (*last == 0) { - grib_context_log(a->context, GRIB_LOG_DEBUG, " Casting string %s to long", a->name); - return GRIB_SUCCESS; - } - - return GRIB_NOT_IMPLEMENTED; -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - grib_context_log(a->context, GRIB_LOG_ERROR, "%s:%s not implemented", __func__, a->name); - return GRIB_NOT_IMPLEMENTED; - - // int retval = 0; - // char* aval = 0; - // char* bval = 0; - // int err = 0; - // size_t alen = 0; - // size_t blen = 0; - // long count = 0; - // err = grib_value_count(a, &count); - // if (err) return err; - // alen = count; - // err = grib_value_count(b, &count); - // if (err) return err; - // blen = count; - // if (alen != blen) return GRIB_COUNT_MISMATCH; - // aval = (char*)grib_context_malloc(a->context, alen * sizeof(char)); - // bval = (char*)grib_context_malloc(b->context, blen * sizeof(char)); - // grib_unpack_string(a, aval, &alen); - // grib_unpack_string(b, bval, &blen); - // retval = GRIB_SUCCESS; - // if (strcmp(aval, bval)) retval = GRIB_STRING_VALUE_MISMATCH; - // grib_context_free(a->context, aval); - // grib_context_free(b->context, bval); - // return retval; -} - -static long next_offset(grib_accessor* a) -{ - return a->offset + a->length; -} diff --git a/src/grib_accessor_class_gts_header.cc b/src/grib_accessor_class_gts_header.cc deleted file mode 100644 index 65b295634..000000000 --- a/src/grib_accessor_class_gts_header.cc +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_ascii - IMPLEMENTS = unpack_string;value_count - IMPLEMENTS = init;string_length - MEMBERS = int gts_offset - MEMBERS = int gts_length - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_gts_header -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in gts_header */ - int gts_offset; - int gts_length; -} grib_accessor_gts_header; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_gts_header = { - &grib_accessor_class_ascii, /* super */ - "gts_header", /* name */ - sizeof(grib_accessor_gts_header), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_gts_header = &_grib_accessor_class_gts_header; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_gts_header* self = (grib_accessor_gts_header*)a; - self->gts_offset = -1; - self->gts_length = -1; - self->gts_offset = grib_arguments_get_long(grib_handle_of_accessor(a), c, 0); - self->gts_length = grib_arguments_get_long(grib_handle_of_accessor(a), c, 1); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_gts_header* self = (grib_accessor_gts_header*)a; - grib_handle* h = grib_handle_of_accessor(a); - int offset = 0; - size_t length = 0; - - if (h->gts_header == NULL || h->gts_header_len < 8) { - if (*len < 8) - return GRIB_BUFFER_TOO_SMALL; - snprintf(val, 1024, "missing"); - return GRIB_SUCCESS; - } - if (*len < h->gts_header_len) - return GRIB_BUFFER_TOO_SMALL; - - offset = self->gts_offset > 0 ? self->gts_offset : 0; - length = self->gts_length > 0 ? self->gts_length : h->gts_header_len; - - memcpy(val, h->gts_header + offset, length); - - *len = length; - - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - grib_handle* h = grib_handle_of_accessor(a); - return h->gts_header_len; -} diff --git a/src/grib_accessor_class_hash_array.cc b/src/grib_accessor_class_hash_array.cc deleted file mode 100644 index d191a5232..000000000 --- a/src/grib_accessor_class_hash_array.cc +++ /dev/null @@ -1,293 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - - -/******************************************************* - * Enrico Fucile - ******************************************************/ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = unpack_string;pack_string;string_length - IMPLEMENTS = unpack_long;pack_long;destroy - IMPLEMENTS = init;dump;value_count;get_native_type - IMPLEMENTS = compare - MEMBERS = char* key - MEMBERS = grib_hash_array_value* ha - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_hash_array -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in hash_array */ - char* key; - grib_hash_array_value* ha; -} grib_accessor_hash_array; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_hash_array = { - &grib_accessor_class_gen, /* super */ - "hash_array", /* name */ - sizeof(grib_accessor_hash_array), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_hash_array = &_grib_accessor_class_hash_array; - -/* END_CLASS_IMP */ - -#define MAX_HASH_ARRAY_STRING_LENGTH 255 - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - a->length = 0; - self->key = 0; - self->ha = NULL; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string(dumper, a, NULL); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - char s[200] = {0,}; - snprintf(s, sizeof(s), "%g", *val); - self->key = grib_context_strdup(a->context, s); - self->ha = 0; - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - char s[200] = {0,}; - snprintf(s, sizeof(s), "%ld", *val); - if (self->key) - grib_context_free(a->context, self->key); - self->key = grib_context_strdup(a->context, s); - self->ha = 0; - return GRIB_SUCCESS; -} - -static int pack_string(grib_accessor* a, const char* v, size_t* len) -{ - grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - self->key = grib_context_strdup(a->context, v); - self->ha = 0; - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static grib_hash_array_value* find_hash_value(grib_accessor* a, int* err) -{ - grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - grib_hash_array_value* ha_ret = 0; - grib_hash_array_value* ha = NULL; - - ha = get_hash_array(grib_handle_of_accessor(a), a->creator); - if (!ha) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "unable to get hash value for %s", a->creator->name); - *err = GRIB_HASH_ARRAY_NO_MATCH; - return NULL; - } - - *err = GRIB_SUCCESS; - - Assert(ha != NULL); - if (!self->key) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "unable to get hash value for %s, set before getting", a->creator->name); - *err = GRIB_HASH_ARRAY_NO_MATCH; - return NULL; - } - - ha_ret = (grib_hash_array_value*)grib_trie_get(ha->index, self->key); - if (!ha_ret) - ha_ret = (grib_hash_array_value*)grib_trie_get(ha->index, "default"); - - if (!ha_ret) { - *err = GRIB_HASH_ARRAY_NO_MATCH; - grib_context_log(a->context, GRIB_LOG_ERROR, - "hash_array: no match for %s=%s", - a->creator->name, self->key); - const char* full_path = get_hash_array_full_path(a->creator); - if (full_path) { - grib_context_log(a->context, GRIB_LOG_ERROR, "hash_array: file path = %s", full_path); - } - grib_context_log(a->context, GRIB_LOG_ERROR, "Hint: Check the key 'masterTablesVersionNumber'"); - return NULL; - } - return ha_ret; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_hash_array_value* ha = 0; - grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - int err = 0; - size_t i = 0; - - if (!self->ha) { - ha = find_hash_value(a, &err); - if (err) - return err; - self->ha = ha; - } - - switch (self->ha->type) { - case GRIB_HASH_ARRAY_TYPE_INTEGER: - if (*len < self->ha->iarray->n) { - return GRIB_ARRAY_TOO_SMALL; - } - *len = self->ha->iarray->n; - for (i = 0; i < *len; i++) - val[i] = self->ha->iarray->v[i]; - break; - - default: - return GRIB_NOT_IMPLEMENTED; - } - - return GRIB_SUCCESS; -} - -static int get_native_type(grib_accessor* a) -{ - int type = GRIB_TYPE_STRING; - if (a->flags & GRIB_ACCESSOR_FLAG_LONG_TYPE) - type = GRIB_TYPE_LONG; - - return type; -} - -static void destroy(grib_context* c, grib_accessor* a) -{ - grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - if (self->key) - grib_context_free(c, self->key); -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static size_t string_length(grib_accessor* a) -{ - return MAX_HASH_ARRAY_STRING_LENGTH; -} - -static int value_count(grib_accessor* a, long* count) -{ - int err = 0; - grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - grib_hash_array_value* ha = 0; - - if (!self->ha) { - ha = find_hash_value(a, &err); - if (err) - return err; - self->ha = ha; - } - - *count = self->ha->iarray->n; - return err; -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - return GRIB_NOT_IMPLEMENTED; -} diff --git a/src/grib_accessor_class_headers_only.cc b/src/grib_accessor_class_headers_only.cc deleted file mode 100644 index d3a98efb0..000000000 --- a/src/grib_accessor_class_headers_only.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long; get_native_type - IMPLEMENTS = init - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_headers_only -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in headers_only */ -} grib_accessor_headers_only; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_headers_only = { - &grib_accessor_class_gen, /* super */ - "headers_only", /* name */ - sizeof(grib_accessor_headers_only), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_headers_only = &_grib_accessor_class_headers_only; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - *val = grib_handle_of_accessor(a)->partial; - *len = 1; - return 0; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_ibmfloat.cc b/src/grib_accessor_class_ibmfloat.cc deleted file mode 100644 index 27e6da1c5..000000000 --- a/src/grib_accessor_class_ibmfloat.cc +++ /dev/null @@ -1,264 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -#include - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = unpack_float - IMPLEMENTS = init - IMPLEMENTS = next_offset - IMPLEMENTS = byte_count - IMPLEMENTS = value_count - IMPLEMENTS = byte_offset - MEMBERS = grib_arguments* arg - IMPLEMENTS = update_size - IMPLEMENTS = nearest_smaller_value - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); -static int nearest_smaller_value (grib_accessor*, double, double*); - -typedef struct grib_accessor_ibmfloat -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in ibmfloat */ - grib_arguments* arg; -} grib_accessor_ibmfloat; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_ibmfloat = { - &grib_accessor_class_double, /* super */ - "ibmfloat", /* name */ - sizeof(grib_accessor_ibmfloat), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - &nearest_smaller_value, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_ibmfloat = &_grib_accessor_class_ibmfloat; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_ibmfloat* self = (grib_accessor_ibmfloat*)a; - long count = 0; - - self->arg = arg; - grib_value_count(a, &count); - a->length = 4 * count; - Assert(a->length >= 0); -} - -template -static int unpack(grib_accessor* a, T* val, size_t* len) -{ - static_assert(std::is_floating_point::value, "Requires floating point numbers"); - unsigned long rlen = 0; - long count = 0; - int err = 0; - unsigned long i = 0; - long bitp = a->offset * 8; - grib_handle* hand = grib_handle_of_accessor(a); - - err = grib_value_count(a, &count); - if (err) - return err; - rlen = count; - - if (*len < rlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %lu values", *len, a->name, rlen); - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - for (i = 0; i < rlen; i++) - val[i] = (T)grib_long_to_ibm(grib_decode_unsigned_long(hand->buffer->data, &bitp, 32)); - - *len = rlen; - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - return unpack(a, val, len); -} - -static int unpack_float(grib_accessor* a, float* val, size_t* len) -{ - return unpack(a, val, len); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_ibmfloat* self = (grib_accessor_ibmfloat*)a; - int ret = 0; - unsigned long i = 0; - unsigned long rlen = *len; - size_t buflen = 0; - unsigned char* buf = NULL; - long off = 0; - - if (*len < 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it packs at least 1 value", a->name); - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - if (rlen == 1) { - - //double x = 0; - //grib_nearest_smaller_ibm_float(val[0],&x); - //double y = grib_long_to_ibm(grib_ibm_to_long(val[0])); - //printf("IBMFLOAT val=%.20f nearest_smaller_ibm_float=%.20f long_to_ibm=%.20f\n",val[0],x ,y); - - off = byte_offset(a) * 8; - ret = grib_encode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, grib_ibm_to_long(val[0]), &off, 32); - if (*len > 1) - grib_context_log(a->context, GRIB_LOG_WARNING, "ibmfloat: Trying to pack %zu values in a scalar %s, packing first value", - *len, a->name); - if (ret == GRIB_SUCCESS) - len[0] = 1; - return ret; - } - - buflen = rlen * 4; - - buf = (unsigned char*)grib_context_malloc(a->context, buflen); - - for (i = 0; i < rlen; i++) { - grib_encode_unsigned_longb(buf, grib_ibm_to_long(val[i]), &off, 32); - } - ret = grib_set_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), rlen); - - if (ret == GRIB_SUCCESS) - grib_buffer_replace(a, buf, buflen, 1, 1); - else - *len = 0; - - grib_context_free(a->context, buf); - - a->length = byte_count(a); - - return ret; -} - -static long byte_count(grib_accessor* a) -{ - return a->length; -} - -static int value_count(grib_accessor* a, long* len) -{ - grib_accessor_ibmfloat* self = (grib_accessor_ibmfloat*)a; - *len = 0; - if (!self->arg) { - *len = 1; - return 0; - } - return grib_get_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), len); -} - -static long byte_offset(grib_accessor* a) -{ - return a->offset; -} - -static void update_size(grib_accessor* a, size_t s) -{ - a->length = (long)s; - Assert(a->length >= 0); -} - -static long next_offset(grib_accessor* a) -{ - return grib_byte_offset(a) + grib_byte_count(a); -} - -static int nearest_smaller_value(grib_accessor* a, double val, double* nearest) -{ - int ret = 0; - if (grib_nearest_smaller_ibm_float(val, nearest) == GRIB_INTERNAL_ERROR) { - grib_context_log(a->context, GRIB_LOG_ERROR, "ibm_float:nearest_smaller_value overflow value=%g", val); - grib_dump_content(grib_handle_of_accessor(a), stderr, "wmo", GRIB_DUMP_FLAG_HEXADECIMAL, 0); - ret = GRIB_INTERNAL_ERROR; - } - return ret; -} diff --git a/src/grib_accessor_class_ieeefloat.cc b/src/grib_accessor_class_ieeefloat.cc deleted file mode 100644 index d6fa411bb..000000000 --- a/src/grib_accessor_class_ieeefloat.cc +++ /dev/null @@ -1,226 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -#include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = unpack_float - IMPLEMENTS = init - IMPLEMENTS = value_count - MEMBERS = grib_arguments* arg - IMPLEMENTS = update_size - IMPLEMENTS = nearest_smaller_value - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_float(grib_accessor*, float* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); -static int nearest_smaller_value (grib_accessor*, double, double*); - -typedef struct grib_accessor_ieeefloat -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in ieeefloat */ - grib_arguments* arg; -} grib_accessor_ieeefloat; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_ieeefloat = { - &grib_accessor_class_double, /* super */ - "ieeefloat", /* name */ - sizeof(grib_accessor_ieeefloat), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - &unpack_float, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - &nearest_smaller_value, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_ieeefloat = &_grib_accessor_class_ieeefloat; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_ieeefloat* self = (grib_accessor_ieeefloat*)a; - long count = 0; - self->arg = arg; - grib_value_count(a, &count); - a->length = 4 * count; - Assert(a->length >= 0); -} - -static int value_count(grib_accessor* a, long* len) -{ - grib_accessor_ieeefloat* self = (grib_accessor_ieeefloat*)a; - *len = 0; - - if (!self->arg) { - *len = 1; - return 0; - } - return grib_get_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), len); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_ieeefloat* self = (grib_accessor_ieeefloat*)a; - int ret = 0; - unsigned long i = 0; - unsigned long rlen = (unsigned long)*len; - size_t buflen = 0; - unsigned char* buf = NULL; - long off = 0; - - if (*len < 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it packs at least 1 value", a->name); - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - if (rlen == 1) { - off = a->offset * 8; - ret = grib_encode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, grib_ieee_to_long(val[0]), &off, 32); - if (*len > 1) - grib_context_log(a->context, GRIB_LOG_WARNING, "ieeefloat: Trying to pack %zu values in a scalar %s, packing first value", - *len, a->name); - if (ret == GRIB_SUCCESS) - len[0] = 1; - return ret; - } - - buflen = rlen * 4; - - buf = (unsigned char*)grib_context_malloc(a->context, buflen); - - for (i = 0; i < rlen; i++) { - grib_encode_unsigned_longb(buf, grib_ieee_to_long(val[i]), &off, 32); - } - ret = grib_set_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), rlen); - - if (ret == GRIB_SUCCESS) - grib_buffer_replace(a, buf, buflen, 1, 1); - else - *len = 0; - - grib_context_free(a->context, buf); - - return ret; -} - -template -static int unpack(grib_accessor* a, T* val, size_t* len) -{ - static_assert(std::is_floating_point::value, "Requires floating point numbers"); - long rlen = 0; - int err = 0; - long i = 0; - long bitp = a->offset * 8; - grib_handle* hand = grib_handle_of_accessor(a); - - err = grib_value_count(a, &rlen); - if (err) - return err; - - if (*len < (size_t)rlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size (%zu) for %s, it contains %ld values", *len, a->name, rlen); - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - for (i = 0; i < rlen; i++) - val[i] = (T)grib_long_to_ieee(grib_decode_unsigned_long(hand->buffer->data, &bitp, 32)); - - *len = rlen; - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - return unpack(a, val, len); -} - -static int unpack_float(grib_accessor* a, float* val, size_t* len) -{ - return unpack(a, val, len); -} - -static void update_size(grib_accessor* a, size_t s) -{ - a->length = (long)s; - Assert(a->length >= 0); -} - -static int nearest_smaller_value(grib_accessor* a, double val, double* nearest) -{ - return grib_nearest_smaller_ieee_float(val, nearest); -} diff --git a/src/grib_accessor_class_ifs_param.cc b/src/grib_accessor_class_ifs_param.cc deleted file mode 100644 index ba7e522c1..000000000 --- a/src/grib_accessor_class_ifs_param.cc +++ /dev/null @@ -1,188 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long; pack_long - IMPLEMENTS = init; get_native_type - MEMBERS=const char* paramId - MEMBERS=const char* type - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_ifs_param -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ifs_param */ - const char* paramId; - const char* type; -} grib_accessor_ifs_param; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_ifs_param = { - &grib_accessor_class_gen, /* super */ - "ifs_param", /* name */ - sizeof(grib_accessor_ifs_param), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_ifs_param = &_grib_accessor_class_ifs_param; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_ifs_param* self = (grib_accessor_ifs_param*)a; - int n = 0; - - self->paramId = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->type = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_ifs_param* self = (grib_accessor_ifs_param*)a; - int ret = 0; - long paramId = 0; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->paramId, ¶mId)) != GRIB_SUCCESS) - return ret; - - if (paramId > 129000 && paramId < 129999) - *val = paramId - 129000; - else if (paramId > 200000 && paramId < 200999) - *val = paramId - 200000; - else if (paramId > 211000 && paramId < 211999) - *val = paramId - 1000; - else - *val = paramId; - - return ret; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_ifs_param* self = (grib_accessor_ifs_param*)a; - long type = 0; - long table = 128; - long paramId = *val; - long param; - - grib_get_long(grib_handle_of_accessor(a), self->type, &type); - - if (type == 33 || type == 35) { - if (paramId > 1000) { - table = paramId / 1000; - param = paramId - table * 1000; - paramId = param; - } - switch (table) { - case 210: - paramId += 211000; - break; - case 128: - paramId += 200000; - break; - default: - break; - } - } - if (type == 50 || type == 52) { - if (paramId > 1000) { - table = paramId / 1000; - param = paramId - table * 1000; - paramId = param; - } - switch (table) { - case 128: - paramId += 129000; - break; - default: - break; - } - } - - return grib_set_long_internal(grib_handle_of_accessor(a), self->paramId, paramId); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_iterator.cc b/src/grib_accessor_class_iterator.cc deleted file mode 100644 index 2a5fc815b..000000000 --- a/src/grib_accessor_class_iterator.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/*************************** - * Enrico Fucile - *************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;dump - MEMBERS=grib_arguments* args - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_iterator -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in iterator */ - grib_arguments* args; -} grib_accessor_iterator; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_iterator = { - &grib_accessor_class_gen, /* super */ - "iterator", /* name */ - sizeof(grib_accessor_iterator), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_iterator = &_grib_accessor_class_iterator; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* args) -{ - grib_accessor_iterator* self = (grib_accessor_iterator*)a; - self->args = args; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - /* TODO: pass args */ - grib_dump_label(dumper, a, NULL); -} - -grib_iterator* grib_iterator_new(const grib_handle* ch, unsigned long flags, int* error) -{ - grib_handle* h = (grib_handle*)ch; - grib_accessor* a = NULL; - grib_accessor_iterator* ita = NULL; - grib_iterator* iter = NULL; - *error = GRIB_NOT_IMPLEMENTED; - a = grib_find_accessor(h, "ITERATOR"); - ita = (grib_accessor_iterator*)a; - - if (!a) - return NULL; - - iter = grib_iterator_factory(h, ita->args, flags, error); - - if (iter) - *error = GRIB_SUCCESS; - - return iter; -} diff --git a/src/grib_accessor_class_julian_day.cc b/src/grib_accessor_class_julian_day.cc deleted file mode 100644 index 7a8e28cfc..000000000 --- a/src/grib_accessor_class_julian_day.cc +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = dump - IMPLEMENTS = init - MEMBERS = const char *date - MEMBERS = const char *hour - MEMBERS = const char *minute - MEMBERS = const char *second - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_julian_day -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in julian_day */ - const char *date; - const char *hour; - const char *minute; - const char *second; -} grib_accessor_julian_day; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_julian_day = { - &grib_accessor_class_double, /* super */ - "julian_day", /* name */ - sizeof(grib_accessor_julian_day), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_julian_day = &_grib_accessor_class_julian_day; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_julian_day* self = (grib_accessor_julian_day*)a; - int n = 0; - - self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->hour = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->minute = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->second = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - - a->length = 0; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string(dumper, a, NULL); -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - const double v = *val; - return pack_double(a, &v, len); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_julian_day* self = (grib_accessor_julian_day*)a; - int ret = 0; - long hour = 0; - long minute = 0; - long second = 0; - long date = 0; - long year, month, day; - - ret = grib_julian_to_datetime(*val, &year, &month, &day, &hour, &minute, &second); - if (ret != 0) - return ret; - - date = year * 10000 + month * 100 + day; - - ret = grib_set_long_internal(grib_handle_of_accessor(a), self->date, date); - if (ret != 0) - return ret; - ret = grib_set_long_internal(grib_handle_of_accessor(a), self->hour, hour); - if (ret != 0) - return ret; - ret = grib_set_long_internal(grib_handle_of_accessor(a), self->minute, minute); - if (ret != 0) - return ret; - ret = grib_set_long_internal(grib_handle_of_accessor(a), self->second, second); - - return ret; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = 0; - double v = 0; - - ret = unpack_double(a, &v, len); - *val = (long)v; - - return ret; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - int ret = 0; - long date, hour, minute, second; - long year, month, day; - grib_accessor_julian_day* self = (grib_accessor_julian_day*)a; - - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->date, &date); - if (ret != GRIB_SUCCESS) - return ret; - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->hour, &hour); - if (ret != GRIB_SUCCESS) - return ret; - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->minute, &minute); - if (ret != GRIB_SUCCESS) - return ret; - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->second, &second); - if (ret != GRIB_SUCCESS) - return ret; - - year = date / 10000; - date %= 10000; - month = date / 100; - date %= 100; - day = date; - - ret = grib_datetime_to_julian(year, month, day, hour, minute, second, val); - - return ret; -} diff --git a/src/grib_accessor_class_ksec1expver.cc b/src/grib_accessor_class_ksec1expver.cc deleted file mode 100644 index 762bf66e2..000000000 --- a/src/grib_accessor_class_ksec1expver.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_ascii - IMPLEMENTS = unpack_long;pack_string; - IMPLEMENTS = pack_long - IMPLEMENTS = init - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_ksec1expver -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in ksec1expver */ -} grib_accessor_ksec1expver; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_ksec1expver = { - &grib_accessor_class_ascii, /* super */ - "ksec1expver", /* name */ - sizeof(grib_accessor_ksec1expver), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_ksec1expver = &_grib_accessor_class_ksec1expver; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->length = len; - Assert(a->length >= 0); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - long value = 0; - long pos = a->offset * 8; - char* intc = NULL; - char* pTemp = NULL; - char expver[5]; - char refexpver[5]; - size_t llen = a->length + 1; - Assert(a->length == 4); - - if (*len < 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - value = grib_decode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, &pos, a->length * 8); - - grib_unpack_string(a, refexpver, &llen); - - /* test for endian */ - intc = (char*)&value; - pTemp = intc; - - expver[0] = *pTemp++; - expver[1] = *pTemp++; - expver[2] = *pTemp++; - expver[3] = *pTemp++; - expver[4] = 0; - -// expver[0] = intc[0]; -// expver[1] = intc[1]; -// expver[2] = intc[2]; -// expver[3] = intc[3]; -// expver[4] = 0; - - /* if there is a difference, have to reverse*/ - if (strcmp(refexpver, expver)) { - intc[0] = expver[3]; - intc[1] = expver[2]; - intc[2] = expver[1]; - intc[3] = expver[0]; - } - - *val = value; - *len = 1; - return GRIB_SUCCESS; -} - -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - int i = 0; - if (len[0] != 4) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong length for %s. It has to be 4", a->name); - return GRIB_INVALID_KEY_VALUE; - } - if (len[0] > (a->length) + 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "pack_string: Wrong size (%lu) for %s, it contains %ld values", - len[0], a->name, a->length + 1); - len[0] = 0; - return GRIB_BUFFER_TOO_SMALL; - } - - for (i = 0; i < a->length; i++) - grib_handle_of_accessor(a)->buffer->data[a->offset + i] = val[i]; - - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - char sval[5] = {0,}; - size_t slen = 4; - snprintf(sval, sizeof(sval), "%04d", (int)(*val)); - return pack_string(a, sval, &slen); -} diff --git a/src/grib_accessor_class_label.cc b/src/grib_accessor_class_label.cc deleted file mode 100644 index 8d7831faf..000000000 --- a/src/grib_accessor_class_label.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;dump;get_native_type;unpack_string - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_label -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in label */ -} grib_accessor_label; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_label = { - &grib_accessor_class_gen, /* super */ - "label", /* name */ - sizeof(grib_accessor_label), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_label = &_grib_accessor_class_label; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; - a->length = 0; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_label(dumper, a, NULL); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LABEL; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - size_t vlen = strlen(a->name); - if (vlen > *len) - return GRIB_BUFFER_TOO_SMALL; - *len = vlen; - strcpy(val, a->name); - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_latitudes.cc b/src/grib_accessor_class_latitudes.cc deleted file mode 100644 index 555fb5b19..000000000 --- a/src/grib_accessor_class_latitudes.cc +++ /dev/null @@ -1,313 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double; - IMPLEMENTS = value_count - IMPLEMENTS = init - MEMBERS =const char* values - MEMBERS =long distinct - MEMBERS =double* lats - MEMBERS =long size - MEMBERS =int save - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_latitudes -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in latitudes */ - const char* values; - long distinct; - double* lats; - long size; - int save; -} grib_accessor_latitudes; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_latitudes = { - &grib_accessor_class_double, /* super */ - "latitudes", /* name */ - sizeof(grib_accessor_latitudes), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_latitudes = &_grib_accessor_class_latitudes; - -/* END_CLASS_IMP */ - - -static int get_distinct(grib_accessor* a, double** val, long* len); - -static int compare_doubles(const void* a, const void* b, int ascending) -{ - /* ascending is a boolean: 0 or 1 */ - double* arg1 = (double*)a; - double* arg2 = (double*)b; - if (ascending) { - if (*arg1 < *arg2) - return -1; /*Smaller values come before larger ones*/ - } - else { - if (*arg1 > *arg2) - return -1; /*Larger values come before smaller ones*/ - } - if (*arg1 == *arg2) - return 0; - else - return 1; -} -static int compare_doubles_ascending(const void* a, const void* b) -{ - return compare_doubles(a, b, 1); -} -static int compare_doubles_descending(const void* a, const void* b) -{ - return compare_doubles(a, b, 0); -} - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_latitudes* self = (grib_accessor_latitudes*)a; - int n = 0; - - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->distinct = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); - self->save = 0; - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_context* c = a->context; - grib_accessor_latitudes* self = (grib_accessor_latitudes*)a; - int ret = 0; - double* v = val; - double dummyLon = 0; - size_t size = 0; - long count = 0; - grib_iterator* iter = NULL; - - self->save = 1; - ret = value_count(a, &count); - if (ret) return ret; - size = count; - if (*len < size) { - /* self->lats are computed in value_count so must free */ - if (self->lats) { - grib_context_free(c, self->lats); - self->lats = NULL; - } - return GRIB_ARRAY_TOO_SMALL; - } - self->save = 0; - - /* self->lats are computed in value_count*/ - if (self->lats) { - int i; - *len = self->size; - for (i = 0; i < size; i++) - val[i] = self->lats[i]; - grib_context_free(c, self->lats); - self->lats = NULL; - self->size = 0; - return GRIB_SUCCESS; - } - - // ECC-1525 Performance: We do not need the values to be decoded - iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret); - if (ret != GRIB_SUCCESS) { - if (iter) - grib_iterator_delete(iter); - grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Unable to create iterator"); - return ret; - } - - while (grib_iterator_next(iter, v++, &dummyLon, NULL)) {} - grib_iterator_delete(iter); - - *len = size; - - return ret; -} - -static int value_count(grib_accessor* a, long* len) -{ - grib_accessor_latitudes* self = (grib_accessor_latitudes*)a; - grib_handle* h = grib_handle_of_accessor(a); - grib_context* c = a->context; - double* val = NULL; - int ret; - size_t size; - - *len = 0; - if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) { - grib_context_log(h->context, GRIB_LOG_ERROR, "latitudes: Unable to get size of %s", self->values); - return ret; - } - *len = size; - - // See ECC-1792 - // Give priority to the Grid Section (rather than the Data Section) - long numberOfDataPoints = 0; - if (grib_get_long(h, "numberOfDataPoints", &numberOfDataPoints) == GRIB_SUCCESS) { - *len = numberOfDataPoints; - } - - if (self->distinct) { - ret = get_distinct(a, &val, len); - if (ret != GRIB_SUCCESS) - return ret; - if (self->save) { - self->lats = val; - self->size = *len; - } - else { - grib_context_free(c, val); - } - } - - return ret; -} - -static int get_distinct(grib_accessor* a, double** val, long* len) -{ - long count = 0; - double prev; - double* v = NULL; - double* v1 = NULL; - double dummyLon = 0; - int ret = 0; - int i; - long jScansPositively = 0; /* default: north to south */ - size_t size = *len; - grib_context* c = a->context; - - // Performance: We do not need the values to be decoded - grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), GRIB_GEOITERATOR_NO_VALUES, &ret); - if (ret != GRIB_SUCCESS) { - if (iter) - grib_iterator_delete(iter); - grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Unable to create iterator"); - return ret; - } - v = (double*)grib_context_malloc_clear(c, size * sizeof(double)); - if (!v) { - grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Error allocating %zu bytes", size * sizeof(double)); - return GRIB_OUT_OF_MEMORY; - } - *val = v; - - while (grib_iterator_next(iter, v++, &dummyLon, NULL)) {} - grib_iterator_delete(iter); - v = *val; - - /* See which direction the latitudes are to be scanned */ - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), "jScansPositively", &jScansPositively))) - return ret; - if (jScansPositively) { - qsort(v, *len, sizeof(double), &compare_doubles_ascending); /*South to North*/ - } - else { - qsort(v, *len, sizeof(double), &compare_doubles_descending); /*North to South*/ - } - - v1 = (double*)grib_context_malloc_clear(c, size * sizeof(double)); - if (!v1) { - grib_context_log(c, GRIB_LOG_ERROR, "latitudes: Error allocating %zu bytes", size * sizeof(double)); - return GRIB_OUT_OF_MEMORY; - } - - /* Construct a unique set of lats by filtering out duplicates */ - prev = v[0]; - v1[0] = prev; - count = 1; - for (i = 1; i < *len; i++) { - if (v[i] != prev) { - prev = v[i]; - v1[count] = prev; /* Value different from previous so store it */ - count++; - } - } - - grib_context_free(c, v); - - *val = v1; - - *len = count; - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_latlonvalues.cc b/src/grib_accessor_class_latlonvalues.cc deleted file mode 100644 index e559eaa3d..000000000 --- a/src/grib_accessor_class_latlonvalues.cc +++ /dev/null @@ -1,164 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double; - IMPLEMENTS = value_count - IMPLEMENTS = init - MEMBERS =const char* values - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_latlonvalues -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in latlonvalues */ - const char* values; -} grib_accessor_latlonvalues; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_latlonvalues = { - &grib_accessor_class_double, /* super */ - "latlonvalues", /* name */ - sizeof(grib_accessor_latlonvalues), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_latlonvalues = &_grib_accessor_class_latlonvalues; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_latlonvalues* self = (grib_accessor_latlonvalues*)a; - int n = 0; - - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_context* c = a->context; - int err = 0; - double* v = val; - double lat, lon, value; - size_t size = 0; - long count = 0; - grib_iterator* iter = grib_iterator_new(grib_handle_of_accessor(a), 0, &err); - if (err) { - if (iter) grib_iterator_delete(iter); - grib_context_log(c, GRIB_LOG_ERROR, "latlonvalues: Unable to create iterator"); - return err; - } - - err = value_count(a, &count); - if (err) return err; - size = count; - - if (*len < size) { - if (iter) grib_iterator_delete(iter); - return GRIB_ARRAY_TOO_SMALL; - } - - while (grib_iterator_next(iter, &lat, &lon, &value)) { - *(v++) = lat; - *(v++) = lon; - *(v++) = value; - } - - grib_iterator_delete(iter); - - *len = size; - - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_latlonvalues* self = (grib_accessor_latlonvalues*)a; - grib_handle* h = grib_handle_of_accessor(a); - int ret = GRIB_SUCCESS; - size_t size; - if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) { - grib_context_log(h->context, GRIB_LOG_ERROR, "latlonvalues: Unable to get size of %s", self->values); - return ret; - } - - *count = 3 * size; - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_library_version.cc b/src/grib_accessor_class_library_version.cc deleted file mode 100644 index 2088b68c4..000000000 --- a/src/grib_accessor_class_library_version.cc +++ /dev/null @@ -1,130 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_ascii - IMPLEMENTS = unpack_string;value_count;string_length - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); - -typedef struct grib_accessor_library_version -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in library_version */ -} grib_accessor_library_version; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_library_version = { - &grib_accessor_class_ascii, /* super */ - "library_version", /* name */ - sizeof(grib_accessor_library_version), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_library_version = &_grib_accessor_class_library_version; - -/* END_CLASS_IMP */ - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - char result[30] = {0,}; - size_t size; - - int major = ECCODES_MAJOR_VERSION; - int minor = ECCODES_MINOR_VERSION; - int revision = ECCODES_REVISION_VERSION; - - snprintf(result, sizeof(result), "%d.%d.%d", major, minor, revision); - size = sizeof(result); - - if (*len < size) - return GRIB_ARRAY_TOO_SMALL; - strcpy(val, result); - - *len = size; - - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - return 255; -} diff --git a/src/grib_accessor_class_long.cc b/src/grib_accessor_class_long.cc deleted file mode 100644 index 5eb10fec5..000000000 --- a/src/grib_accessor_class_long.cc +++ /dev/null @@ -1,269 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = get_native_type;pack_missing; - IMPLEMENTS = unpack_string; pack_string - IMPLEMENTS = unpack_double - IMPLEMENTS = dump - IMPLEMENTS = compare - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_missing(grib_accessor*); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_long -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ -} grib_accessor_long; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_long = { - &grib_accessor_class_gen, /* super */ - "long", /* name */ - sizeof(grib_accessor_long), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - &pack_missing, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_long = &_grib_accessor_class_long; - -/* END_CLASS_IMP */ - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_long(dumper, a, NULL); -} - -static int unpack_string(grib_accessor* a, char* v, size_t* len) -{ - long val = 0; - size_t l = 1; - char repres[1024]; - char format[32] = "%ld"; - grib_handle* h = grib_handle_of_accessor(a); - - grib_unpack_long(a, &val, &l); - /* TODO: We should catch all errors but in this case the test ERA_Gen.sh will fail - * as the output from grib_ls will be different */ - - if ((val == GRIB_MISSING_LONG) && ((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0)) { - snprintf(repres, sizeof(repres), "MISSING"); - } else { - size_t size = sizeof(format); - grib_get_string(h, "formatForLongs", format, &size); - snprintf(repres, sizeof(repres), format, val); - } - - l = strlen(repres) + 1; - - if (*len < l) { - const char* cclass_name = a->cclass->name; - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, l, *len); - *len = l; - return GRIB_BUFFER_TOO_SMALL; - } - /*grib_context_log(a->context,GRIB_LOG_DEBUG, "grib_accessor_long: Casting long %s to string ", a->name);*/ - - *len = l; - - strcpy(v, repres); - return GRIB_SUCCESS; -} - -static int pack_missing(grib_accessor* a) -{ - size_t len = 1; - long value = GRIB_MISSING_LONG; - - if (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) - return grib_pack_long(a, &value, &len); - - return GRIB_VALUE_CANNOT_BE_MISSING; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - size_t rlen = 0; - long count = 0; - unsigned long i = 0; - long* values = NULL; - long oneval = 0; - int ret = GRIB_SUCCESS; - - ret = grib_value_count(a, &count); - if (ret) - return ret; - rlen = count; - - if (*len < rlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %lu values", a->name, rlen); - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - if (rlen == 1) { - ret = grib_unpack_long(a, &oneval, &rlen); - if (ret != GRIB_SUCCESS) - return ret; - *val = oneval; - *len = 1; - return GRIB_SUCCESS; - } - - values = (long*)grib_context_malloc(a->context, rlen * sizeof(long)); - if (!values) - return GRIB_OUT_OF_MEMORY; - - ret = grib_unpack_long(a, values, &rlen); - if (ret != GRIB_SUCCESS) { - grib_context_free(a->context, values); - return ret; - } - for (i = 0; i < rlen; i++) - val[i] = values[i]; - - grib_context_free(a->context, values); - - *len = rlen; - return GRIB_SUCCESS; -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - int retval = 0; - long* aval = 0; - long* bval = 0; - long count = 0; - - size_t alen = 0; - size_t blen = 0; - int err = 0; - - err = grib_value_count(a, &count); - if (err) - return err; - alen = count; - - err = grib_value_count(b, &count); - if (err) - return err; - blen = count; - - if (alen != blen) - return GRIB_COUNT_MISMATCH; - - aval = (long*)grib_context_malloc(a->context, alen * sizeof(long)); - bval = (long*)grib_context_malloc(b->context, blen * sizeof(long)); - - grib_unpack_long(a, aval, &alen); - grib_unpack_long(b, bval, &blen); - - retval = GRIB_SUCCESS; - for (size_t i=0; icontext, aval); - grib_context_free(b->context, bval); - - return retval; -} - -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - long v = 0; /* The converted value */ - - // ECC-1722 - if (STR_EQUAL_NOCASE(val, "missing")) { - return pack_missing(a); - } - - if (string_to_long(val, &v, 1) != GRIB_SUCCESS) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Trying to pack \"%s\" as long. String cannot be converted to an integer", val); - return GRIB_WRONG_TYPE; - } - return grib_pack_long(a, &v, len); -} diff --git a/src/grib_accessor_class_long_vector.cc b/src/grib_accessor_class_long_vector.cc deleted file mode 100644 index 612163a3e..000000000 --- a/src/grib_accessor_class_long_vector.cc +++ /dev/null @@ -1,208 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_abstract_long_vector - IMPLEMENTS = init - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = unpack_double;get_native_type - MEMBERS = const char* vector - MEMBERS = int index - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_long_vector -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in abstract_long_vector */ - long* v; - long pack_index; - int number_of_elements; - /* Members defined in long_vector */ - const char* vector; - int index; -} grib_accessor_long_vector; - -extern grib_accessor_class* grib_accessor_class_abstract_long_vector; - -static grib_accessor_class _grib_accessor_class_long_vector = { - &grib_accessor_class_abstract_long_vector, /* super */ - "long_vector", /* name */ - sizeof(grib_accessor_long_vector), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_long_vector = &_grib_accessor_class_long_vector; - -/* END_CLASS_IMP */ - -typedef struct grib_accessor_abstract_long_vector -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in abstract_long_vector */ - long* v; - long pack_index; - int number_of_elements; -} grib_accessor_abstract_long_vector; - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_long_vector* self = (grib_accessor_long_vector*)a; - grib_accessor* va = NULL; - grib_accessor_abstract_long_vector* v = NULL; - int n = 0; - - self->vector = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); - v = (grib_accessor_abstract_long_vector*)va; - - self->index = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); - - /* check self->index on init and never change it */ - Assert(self->index < v->number_of_elements && self->index >= 0); - - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - size_t size = 0; - int err = 0; - long* vector; - grib_accessor_long_vector* self = (grib_accessor_long_vector*)a; - grib_accessor* va = NULL; - grib_accessor_abstract_long_vector* v = NULL; - - va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); - v = (grib_accessor_abstract_long_vector*)va; - - /*TODO implement the dirty mechanism to avoid to unpack every time */ - err = grib_get_size(grib_handle_of_accessor(a), self->vector, &size); - if (err) return err; - DEBUG_ASSERT(size > 0); - vector = (long*)grib_context_malloc(a->context, sizeof(long) * size); - err = grib_unpack_long(va, vector, &size); - grib_context_free(a->context, vector); - if (err) return err; - - *val = v->v[self->index]; - - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - long lval = 0; - int err = 0; - grib_accessor_long_vector* self = (grib_accessor_long_vector*)a; - grib_accessor* va = NULL; - grib_accessor_abstract_long_vector* v = NULL; - va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); - v = (grib_accessor_abstract_long_vector*)va; - - err = unpack_long(a, &lval, len); - - *val = (double)v->v[self->index]; - - return err; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - int err = 0; - grib_accessor_long_vector* self = (grib_accessor_long_vector*)a; - grib_accessor* va = NULL; - grib_accessor_abstract_long_vector* v = NULL; - - va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); - v = (grib_accessor_abstract_long_vector*)va; - - v->pack_index = self->index; - - err = grib_pack_long(va, val, len); - - return err; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_lookup.cc b/src/grib_accessor_class_lookup.cc deleted file mode 100644 index 5fc2880a8..000000000 --- a/src/grib_accessor_class_lookup.cc +++ /dev/null @@ -1,242 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -#include -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long; unpack_string - IMPLEMENTS = init;post_init;dump - IMPLEMENTS = byte_offset;byte_count - IMPLEMENTS = pack_long - IMPLEMENTS = notify_change - MEMBERS = long llength - MEMBERS = long loffset - MEMBERS = grib_expression* real_name - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static void post_init(grib_accessor*); -static int notify_change(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_lookup -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in lookup */ - long llength; - long loffset; - grib_expression* real_name; -} grib_accessor_lookup; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_lookup = { - &grib_accessor_class_long, /* super */ - "lookup", /* name */ - sizeof(grib_accessor_lookup), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - &post_init, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - ¬ify_change, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_lookup = &_grib_accessor_class_lookup; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_lookup* self = (grib_accessor_lookup*)a; - a->length = 0; - self->llength = len; - self->loffset = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 0); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - self->real_name = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 1); -} - -static void post_init(grib_accessor* a) -{ - grib_accessor_lookup* self = (grib_accessor_lookup*)a; - if (self->real_name) { - grib_dependency_observe_expression(a, self->real_name); - } -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_accessor_lookup* self = (grib_accessor_lookup*)a; - unsigned char bytes[1024] = {0,}; - char msg[1024] = {0,}; - char buf[2048]; - int i; - unsigned long v = 0; - - size_t llen = self->llength; - grib_unpack_bytes(a, bytes, &llen); /* TODO: Unpack byte unpack the wrong offset */ - - bytes[llen] = 0; - for (i = 0; i < llen; i++) { - msg[i] = isprint(bytes[i]) ? bytes[i] : '?'; - v <<= 8; - v |= bytes[i]; - } - - msg[llen] = 0; - - snprintf(buf, sizeof(buf), "%s %lu %ld-%ld", msg, v, (long)a->offset + self->loffset, (long)self->llength); - - grib_dump_long(dumper, a, buf); -} - -static int unpack_string(grib_accessor* a, char* v, size_t* len) -{ - grib_accessor_lookup* self = (grib_accessor_lookup*)a; - unsigned char bytes[1024] = {0,}; - int i; - - size_t llen = self->llength; - grib_unpack_bytes(a, bytes, &llen); /* TODO: Unpack byte unpack the wrong offset */ - - bytes[llen] = 0; - - for (i = 0; i < llen; i++) { - v[i] = isprint(bytes[i]) ? bytes[i] : '?'; - } - - v[llen] = 0; - if (llen == 1 && v[0] == '?') { - /* Try unpack as long */ - size_t length = 10; - long lval = 0; - int err = unpack_long(a, &lval, &length); - if (!err) { - char str[5]; - int conv = snprintf(str, sizeof(str), "%ld", lval); - if (conv == 1) { - v[0] = str[0]; - } - } - } - - return GRIB_SUCCESS; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_lookup* self = (grib_accessor_lookup*)a; - grib_handle* h = grib_handle_of_accessor(a); - - long pos = (a->offset + self->loffset) * 8; - - if (len[0] < 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); - len[0] = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - /* This is used when reparsing or rebuilding */ - if (h->loader) { - Assert(*len == 1); - return h->loader->lookup_long(h->context, h->loader, a->name, val); - } - - val[0] = grib_decode_unsigned_long(h->buffer->data, &pos, self->llength * 8); - len[0] = 1; - - /*printf("###########lookup unpack_long: %s %ld %ld\n",a->name, pos/8, val[0]);*/ - - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static long byte_count(grib_accessor* a) -{ - grib_accessor_lookup* self = (grib_accessor_lookup*)a; - return self->llength; -} - -static long byte_offset(grib_accessor* a) -{ - grib_accessor_lookup* self = (grib_accessor_lookup*)a; - return self->loffset; -} - -static int notify_change(grib_accessor* self, grib_accessor* changed) -{ - /* Forward changes */ - return grib_dependency_notify_change(self); -} diff --git a/src/grib_accessor_class_mars_param.cc b/src/grib_accessor_class_mars_param.cc deleted file mode 100644 index beb7a68c5..000000000 --- a/src/grib_accessor_class_mars_param.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_ascii - IMPLEMENTS = unpack_string - IMPLEMENTS = init; string_length - MEMBERS= const char* paramId - MEMBERS= const char* table - MEMBERS= const char* param - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_mars_param -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in mars_param */ - const char* paramId; - const char* table; - const char* param; -} grib_accessor_mars_param; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_mars_param = { - &grib_accessor_class_ascii, /* super */ - "mars_param", /* name */ - sizeof(grib_accessor_mars_param), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_mars_param = &_grib_accessor_class_mars_param; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - int n = 0; - grib_accessor_mars_param* self = (grib_accessor_mars_param*)a; - self->paramId = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->table = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->param = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); -} - -// For an implementation of pack_string, see -// src/deprecated/grib_accessor_class_mars_param.cc - -// For an alternative implementation of unpack_string, see -// src/deprecated/grib_accessor_class_mars_param.cc -// -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_mars_param* self = (grib_accessor_mars_param*)a; - long param = 0; - long table = 0; - int ret = 0; - - if (self->table != NULL && (ret = grib_get_long_internal(grib_handle_of_accessor(a), self->table, &table)) != GRIB_SUCCESS) - return ret; - if (self->param != NULL && (ret = grib_get_long_internal(grib_handle_of_accessor(a), self->param, ¶m)) != GRIB_SUCCESS) - return ret; - - /*if (table==200) table=128;*/ - snprintf(val, 32, "%ld.%ld", param, table); - *len = strlen(val) + 1; - - return GRIB_SUCCESS; -} - -static size_t string_length(grib_accessor* a) -{ - return 7; -} diff --git a/src/grib_accessor_class_mars_step.cc b/src/grib_accessor_class_mars_step.cc deleted file mode 100644 index 7792995a7..000000000 --- a/src/grib_accessor_class_mars_step.cc +++ /dev/null @@ -1,218 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_ascii - IMPLEMENTS = pack_string;unpack_string;value_count;string_length - IMPLEMENTS = pack_long; unpack_long - IMPLEMENTS = get_native_type - IMPLEMENTS = init - MEMBERS = const char* stepRange - MEMBERS = const char* stepType - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_mars_step -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in mars_step */ - const char* stepRange; - const char* stepType; -} grib_accessor_mars_step; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_mars_step = { - &grib_accessor_class_ascii, /* super */ - "mars_step", /* name */ - sizeof(grib_accessor_mars_step), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_mars_step = &_grib_accessor_class_mars_step; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - int n = 0; - grib_accessor_mars_step* self = (grib_accessor_mars_step*)a; - self->stepRange = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->stepType = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); -} - -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - char stepType[100]; - size_t stepTypeLen = 100; - char buf[100] = {0,}; - int ret; - grib_accessor_mars_step* self = (grib_accessor_mars_step*)a; - grib_accessor* stepRangeAcc = grib_find_accessor(grib_handle_of_accessor(a), self->stepRange); - - if (!stepRangeAcc) { - grib_context_log(a->context, GRIB_LOG_ERROR, "%s not found", self->stepRange); - return GRIB_NOT_FOUND; - } - - if ((ret = grib_get_string(grib_handle_of_accessor(a), self->stepType, stepType, &stepTypeLen)) != GRIB_SUCCESS) - return ret; - - if (!strcmp(stepType, "instant")) - snprintf(buf, sizeof(buf), "%s", val); - else - snprintf(buf, sizeof(buf), "0-%s", val); - - return grib_pack_string(stepRangeAcc, buf, len); -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - int ret = 0; - grib_accessor_mars_step* self = (grib_accessor_mars_step*)a; - char buf[100] = {0,}; - char* p = NULL; - size_t buflen = 100; - long step; - grib_accessor* stepRangeAcc = grib_find_accessor(grib_handle_of_accessor(a), self->stepRange); - const char* cclass_name = a->cclass->name; - - if (!stepRangeAcc) { - grib_context_log(a->context, GRIB_LOG_ERROR, "%s: %s not found", cclass_name, self->stepRange); - return GRIB_NOT_FOUND; - } - - if ((ret = grib_unpack_string(stepRangeAcc, buf, &buflen)) != GRIB_SUCCESS) - return ret; - - if (*len < buflen) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, buflen, *len); - *len = buflen; - return GRIB_BUFFER_TOO_SMALL; - } - - strcpy(val, buf); - step = strtol(buf, &p, 10); - - if (p != NULL && *p == '-' && step == 0) - strcpy(val, ++p); - - *len = strlen(val); - - return ret; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - char buff[100] = {0,}; - size_t bufflen = 100; - - snprintf(buff, sizeof(buff), "%ld", *val); - - return pack_string(a, buff, &bufflen); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_mars_step* self = (grib_accessor_mars_step*)a; - grib_accessor* stepRangeAcc = grib_find_accessor(grib_handle_of_accessor(a), self->stepRange); - - if (!stepRangeAcc) - return GRIB_NOT_FOUND; - - return grib_unpack_long(stepRangeAcc, val, len); -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - return 16; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_message.cc b/src/grib_accessor_class_message.cc deleted file mode 100644 index 6c5587b22..000000000 --- a/src/grib_accessor_class_message.cc +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_bytes - IMPLEMENTS = init;update_size;resize; value_count - IMPLEMENTS = unpack_string; string_length - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); -static void resize(grib_accessor*,size_t); - -typedef struct grib_accessor_message -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in message */ -} grib_accessor_message; - -extern grib_accessor_class* grib_accessor_class_bytes; - -static grib_accessor_class _grib_accessor_class_message = { - &grib_accessor_class_bytes, /* super */ - "message", /* name */ - sizeof(grib_accessor_message), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - &resize, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_message = &_grib_accessor_class_message; - -/* END_CLASS_IMP */ - - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = grib_handle_of_accessor(a)->buffer->ulength - len - a->offset; -} - -// static int compare(grib_accessor* a, grib_accessor* b) -// { -// if (a->length != b->length) -// return GRIB_COUNT_MISMATCH; -// return GRIB_SUCCESS; -// } - -static void update_size(grib_accessor* a, size_t new_size) -{ - a->length = new_size; -} - -static void resize(grib_accessor* a, size_t new_size) -{ - grib_context_log(a->context, GRIB_LOG_FATAL, "%s %s: Not supported", a->cclass->name, __func__); - - // void* zero = grib_context_malloc_clear(a->context, new_size); - // grib_buffer_replace(a, (const unsigned char*)zero, new_size, 1, 0); - // grib_context_free(a->context, zero); - // grib_context_log(a->context, GRIB_LOG_DEBUG, "resize: grib_accessor_class_message %ld %ld %s %s", - // (long)new_size, (long)a->length, a->cclass->name, a->name); - // Assert(new_size == a->length); -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - long i = 0; - size_t l = string_length(a) + 1; - grib_handle* h = grib_handle_of_accessor(a); - - if (*len < l) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - a->cclass->name, a->name, l, *len); - *len = l; - return GRIB_BUFFER_TOO_SMALL; - } - - for (i = 0; i < a->length; i++) - val[i] = h->buffer->data[a->offset + i]; - val[i] = 0; - *len = i; - return GRIB_SUCCESS; -} - -static size_t string_length(grib_accessor* a) -{ - return a->length; -} diff --git a/src/grib_accessor_class_message_copy.cc b/src/grib_accessor_class_message_copy.cc deleted file mode 100644 index 30806b163..000000000 --- a/src/grib_accessor_class_message_copy.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_string;string_length - IMPLEMENTS = byte_count - IMPLEMENTS = init;dump;get_native_type - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static long byte_count(grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_message_copy -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in message_copy */ -} grib_accessor_message_copy; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_message_copy = { - &grib_accessor_class_gen, /* super */ - "message_copy", /* name */ - sizeof(grib_accessor_message_copy), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - 0, /* get number of values */ - &byte_count, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_message_copy = &_grib_accessor_class_message_copy; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long length, grib_arguments* args) -{ - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string(dumper, a, NULL); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - size_t slen = grib_handle_of_accessor(a)->buffer->ulength; - size_t i; - unsigned char* v = 0; - - if (*len < slen) { - return GRIB_ARRAY_TOO_SMALL; - } - v = grib_handle_of_accessor(a)->buffer->data; - /* replace unprintable characters with space */ - for (i = 0; i < slen; i++) - if (v[i] > 126) - v[i] = 32; - memcpy(val, grib_handle_of_accessor(a)->buffer->data, slen); - val[i] = 0; - - *len = slen; - - return GRIB_SUCCESS; -} - -static size_t string_length(grib_accessor* a) -{ - return grib_handle_of_accessor(a)->buffer->ulength; -} - -static long byte_count(grib_accessor* a) -{ - return a->length; -} diff --git a/src/grib_accessor_class_multdouble.cc b/src/grib_accessor_class_multdouble.cc deleted file mode 100644 index ac5771627..000000000 --- a/src/grib_accessor_class_multdouble.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double - IMPLEMENTS = init - MEMBERS = const char* val - MEMBERS = double multiplier - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_multdouble -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in multdouble */ - const char* val; - double multiplier; -} grib_accessor_multdouble; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_multdouble = { - &grib_accessor_class_double, /* super */ - "multdouble", /* name */ - sizeof(grib_accessor_multdouble), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_multdouble = &_grib_accessor_class_multdouble; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_multdouble* self = (grib_accessor_multdouble*)a; - int n = 0; - - self->val = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->multiplier = grib_arguments_get_double(grib_handle_of_accessor(a), c, n++); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - const grib_accessor_multdouble* self = (grib_accessor_multdouble*)a; - int ret = GRIB_SUCCESS; - double value = 0; - - ret = grib_get_double_internal(grib_handle_of_accessor(a), self->val, &value); - if (ret != GRIB_SUCCESS) - return ret; - - *val = value * self->multiplier; - - *len = 1; - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_nearest.cc b/src/grib_accessor_class_nearest.cc deleted file mode 100644 index b1a3138d3..000000000 --- a/src/grib_accessor_class_nearest.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;dump - MEMBERS=grib_arguments* args - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_nearest -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in nearest */ - grib_arguments* args; -} grib_accessor_nearest; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_nearest = { - &grib_accessor_class_gen, /* super */ - "nearest", /* name */ - sizeof(grib_accessor_nearest), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_nearest = &_grib_accessor_class_nearest; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* args) -{ - grib_accessor_nearest* self = (grib_accessor_nearest*)a; - self->args = args; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - /* TODO: pass args */ - grib_dump_label(dumper, a, NULL); -} - -grib_nearest* grib_nearest_new(const grib_handle* ch, int* error) -{ - grib_handle* h = (grib_handle*)ch; - grib_accessor* a = NULL; - grib_accessor_nearest* na = NULL; - grib_nearest* n = NULL; - *error = GRIB_NOT_IMPLEMENTED; - a = grib_find_accessor(h, "NEAREST"); - na = (grib_accessor_nearest*)a; - - if (!a) - return NULL; - - n = grib_nearest_factory(h, na->args, error); - - if (n) - *error = GRIB_SUCCESS; - - return n; -} diff --git a/src/grib_accessor_class_non_alpha.cc b/src/grib_accessor_class_non_alpha.cc deleted file mode 100644 index 821f2311f..000000000 --- a/src/grib_accessor_class_non_alpha.cc +++ /dev/null @@ -1,215 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_string - IMPLEMENTS = unpack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = init;dump;string_length - IMPLEMENTS = value_count - IMPLEMENTS = next_offset - IMPLEMENTS = get_native_type - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_non_alpha -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in non_alpha */ -} grib_accessor_non_alpha; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_non_alpha = { - &grib_accessor_class_gen, /* super */ - "non_alpha", /* name */ - sizeof(grib_accessor_non_alpha), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_non_alpha = &_grib_accessor_class_non_alpha; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_buffer* buffer = grib_handle_of_accessor(a)->buffer; - size_t i = 0; - unsigned char* v; - - v = buffer->data + a->offset; - i = 0; - while ((*v < 33 || *v > 126) && i <= buffer->ulength) { - v++; - i++; - } - a->length = i; - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static size_t string_length(grib_accessor* a) -{ - return a->length; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string(dumper, a, NULL); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_handle* hand = grib_handle_of_accessor(a); - long i = 0; - - if (*len < (a->length + 1)) { - grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values", - *len, a->name, a->length + 1); - *len = a->length + 1; - return GRIB_BUFFER_TOO_SMALL; - } - - for (i = 0; i < a->length; i++) { - val[i] = hand->buffer->data[a->offset + i]; - } - val[i] = 0; - *len = i; - return GRIB_SUCCESS; -} - -static int unpack_long(grib_accessor* a, long* v, size_t* len) -{ - char val[1024] = {0,}; - size_t l = sizeof(val); - size_t i = 0; - char* last = NULL; - int err = grib_unpack_string(a, val, &l); - - if (err) - return err; - - i = 0; - while (i < l - 1 && val[i] == ' ') - i++; - - if (val[i] == 0) { - *v = 0; - return 0; - } - if (val[i + 1] == ' ' && i < l - 2) - val[i + 1] = 0; - - *v = strtol(val, &last, 10); - - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* v, size_t* len) -{ - char val[1024]; - size_t l = sizeof(val); - char* last = NULL; - grib_unpack_string(a, val, &l); - - *v = strtod(val, &last); - - if (*last == 0) { - return GRIB_SUCCESS; - } - - return GRIB_NOT_IMPLEMENTED; -} - -static long next_offset(grib_accessor* a) -{ - return a->offset + a->length; -} diff --git a/src/grib_accessor_class_number_of_coded_values.cc b/src/grib_accessor_class_number_of_coded_values.cc deleted file mode 100644 index 14ef832d7..000000000 --- a/src/grib_accessor_class_number_of_coded_values.cc +++ /dev/null @@ -1,162 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/***************************** - * Enrico Fucile - ****************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS = const char* numberOfValues - MEMBERS = const char* bitsPerValue - MEMBERS = const char* offsetBeforeData - MEMBERS = const char* offsetAfterData - MEMBERS = const char* unusedBits - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_number_of_coded_values -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in number_of_coded_values */ - const char* numberOfValues; - const char* bitsPerValue; - const char* offsetBeforeData; - const char* offsetAfterData; - const char* unusedBits; -} grib_accessor_number_of_coded_values; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_number_of_coded_values = { - &grib_accessor_class_long, /* super */ - "number_of_coded_values", /* name */ - sizeof(grib_accessor_number_of_coded_values), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_number_of_coded_values = &_grib_accessor_class_number_of_coded_values; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - int n = 0; - grib_accessor_number_of_coded_values* self = (grib_accessor_number_of_coded_values*)a; - self->bitsPerValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->offsetBeforeData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->offsetAfterData = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->unusedBits = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = GRIB_SUCCESS; - long bpv = 0; - long offsetBeforeData = 0, offsetAfterData = 0, unusedBits = 0, numberOfValues; - - grib_accessor_number_of_coded_values* self = (grib_accessor_number_of_coded_values*)a; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitsPerValue, &bpv)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetBeforeData, &offsetBeforeData)) != GRIB_SUCCESS) - return ret; - - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetAfterData, &offsetAfterData)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->unusedBits, &unusedBits)) != GRIB_SUCCESS) - return ret; - - if (bpv != 0) { - grib_context_log(a->context, GRIB_LOG_DEBUG, "grib_accessor_number_of_coded_values: offsetAfterData=%ld offsetBeforeData=%ld unusedBits=%ld bpv=%ld\n", - offsetAfterData, offsetBeforeData, unusedBits, bpv); - DEBUG_ASSERT(offsetAfterData > offsetBeforeData); - *val = ((offsetAfterData - offsetBeforeData) * 8 - unusedBits) / bpv; - } - else { - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfValues, &numberOfValues)) != GRIB_SUCCESS) - return ret; - - *val = numberOfValues; - } - - return ret; -} diff --git a/src/grib_accessor_class_number_of_points.cc b/src/grib_accessor_class_number_of_points.cc deleted file mode 100644 index b3d1eade2..000000000 --- a/src/grib_accessor_class_number_of_points.cc +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/**************************************** - * Enrico Fucile - *************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS = const char* ni - MEMBERS = const char* nj - MEMBERS = const char* plpresent - MEMBERS = const char* pl - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_number_of_points -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in number_of_points */ - const char* ni; - const char* nj; - const char* plpresent; - const char* pl; -} grib_accessor_number_of_points; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_number_of_points = { - &grib_accessor_class_long, /* super */ - "number_of_points", /* name */ - sizeof(grib_accessor_number_of_points), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_number_of_points = &_grib_accessor_class_number_of_points; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - int n = 0; - grib_handle* hand = grib_handle_of_accessor(a); - - grib_accessor_number_of_points* self = (grib_accessor_number_of_points*)a; - self->ni = grib_arguments_get_name(hand, c, n++); - self->nj = grib_arguments_get_name(hand, c, n++); - self->plpresent = grib_arguments_get_name(hand, c, n++); - self->pl = grib_arguments_get_name(hand, c, n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_number_of_points* self = (grib_accessor_number_of_points*)a; - - int ret = GRIB_SUCCESS; - long ni = 0, nj = 0, plpresent = 0; - size_t plsize = 0; - long* pl = NULL; - int i = 0; - grib_context* c = a->context; - grib_handle* hand = grib_handle_of_accessor(a); - - if ((ret = grib_get_long_internal(hand, self->ni, &ni)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(hand, self->nj, &nj)) != GRIB_SUCCESS) - return ret; - - if (self->plpresent && - ((ret = grib_get_long_internal(hand, self->plpresent, &plpresent)) != GRIB_SUCCESS)) - return ret; - - if (grib_is_missing(hand, self->nj, &ret) && ret == GRIB_SUCCESS) { - grib_context_log(c, GRIB_LOG_ERROR, "grib_accessor_class_number_of_points: Key %s cannot be 'missing'!", self->nj); - return GRIB_GEOCALCULUS_PROBLEM; - } - - if (nj == 0) { - grib_context_log(c, GRIB_LOG_ERROR, "grib_accessor_class_number_of_points: Key %s cannot be 0!", self->nj); - return GRIB_GEOCALCULUS_PROBLEM; - } - - if (plpresent) { - /*reduced*/ - plsize = nj; - pl = (long*)grib_context_malloc(c, sizeof(long) * plsize); - grib_get_long_array_internal(hand, self->pl, pl, &plsize); - *val = 0; - for (i = 0; i < plsize; i++) - *val += pl[i]; - grib_context_free(c, pl); - } - else { - /*regular*/ - *val = ni * nj; - } - - return ret; -} diff --git a/src/grib_accessor_class_number_of_values.cc b/src/grib_accessor_class_number_of_values.cc deleted file mode 100644 index fb1aff779..000000000 --- a/src/grib_accessor_class_number_of_values.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/********************************** - * Enrico Fucile - **********************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS = const char* values - MEMBERS = const char* bitsPerValue - MEMBERS = const char* numberOfPoints - MEMBERS = const char* bitmapPresent - MEMBERS = const char* bitmap - MEMBERS = const char* numberOfCodedValues - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_number_of_values -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in number_of_values */ - const char* values; - const char* bitsPerValue; - const char* numberOfPoints; - const char* bitmapPresent; - const char* bitmap; - const char* numberOfCodedValues; -} grib_accessor_number_of_values; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_number_of_values = { - &grib_accessor_class_long, /* super */ - "number_of_values", /* name */ - sizeof(grib_accessor_number_of_values), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_number_of_values = &_grib_accessor_class_number_of_values; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - int n = 0; - grib_accessor_number_of_values* self = (grib_accessor_number_of_values*)a; - grib_handle* hand = grib_handle_of_accessor(a); - - self->values = grib_arguments_get_name(hand, c, n++); - self->bitsPerValue = grib_arguments_get_name(hand, c, n++); - self->numberOfPoints = grib_arguments_get_name(hand, c, n++); - self->bitmapPresent = grib_arguments_get_name(hand, c, n++); - self->bitmap = grib_arguments_get_name(hand, c, n++); - self->numberOfCodedValues = grib_arguments_get_name(hand, c, n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_number_of_values* self = (grib_accessor_number_of_values*)a; - int ret = GRIB_SUCCESS, i; - long npoints = 0, bitmap_present = 0; - size_t size = 0; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->numberOfPoints, &npoints)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->bitmapPresent, &bitmap_present)) != GRIB_SUCCESS) - return ret; - - if (bitmap_present) { - double* bitmap; - size = npoints; - bitmap = (double*)grib_context_malloc(a->context, sizeof(double) * size); - if ((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->bitmap, bitmap, &size)) != GRIB_SUCCESS) { - grib_context_free(a->context, bitmap); - return ret; - } - *val = 0; - for (i = 0; i < size; i++) - if (bitmap[i] != 0) - (*val)++; - - grib_context_free(a->context, bitmap); - } - else { - *val = npoints; - } - - return ret; -} diff --git a/src/grib_accessor_class_number_of_values_data_raw_packing.cc b/src/grib_accessor_class_number_of_values_data_raw_packing.cc deleted file mode 100644 index 5652797ac..000000000 --- a/src/grib_accessor_class_number_of_values_data_raw_packing.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ -/***************************** - * Enrico Fucile - ****************************/ - -#include "grib_api_internal.h" -#define PRECISION_32_IEEE 1 -#define PRECISION_64_IEEE 2 -#define PRECISION_128_IEEE 3 - -#define COMPRESSION_NONE 0 -#define COMPRESSION_LZW 1 - -#define PRE_PROCESSING_NONE 0 -#define PRE_PROCESSING_DIFFERENCE 1 -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init - IMPLEMENTS = unpack_long - IMPLEMENTS = get_native_type - MEMBERS=const char* values - MEMBERS=const char* precision - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_number_of_values_data_raw_packing -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in number_of_values_data_raw_packing */ - const char* values; - const char* precision; -} grib_accessor_number_of_values_data_raw_packing; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_number_of_values_data_raw_packing = { - &grib_accessor_class_gen, /* super */ - "number_of_values_data_raw_packing", /* name */ - sizeof(grib_accessor_number_of_values_data_raw_packing), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_number_of_values_data_raw_packing = &_grib_accessor_class_number_of_values_data_raw_packing; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long v, grib_arguments* args) -{ - int n = 0; - grib_accessor_number_of_values_data_raw_packing* self = (grib_accessor_number_of_values_data_raw_packing*)a; - - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->precision = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int err = 0; - grib_accessor_number_of_values_data_raw_packing* self = (grib_accessor_number_of_values_data_raw_packing*)a; - grib_accessor* adata = NULL; - long precision = 0; - int bytes = 0; - long byte_count = 0; - - adata = grib_find_accessor(grib_handle_of_accessor(a), self->values); - Assert(adata != NULL); - byte_count = grib_byte_count(adata); - - if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->precision, &precision)) != GRIB_SUCCESS) - return err; - - switch (precision) { - case 1: - bytes = 4; - break; - - case 2: - bytes = 8; - break; - - default: - return GRIB_NOT_IMPLEMENTED; - } - - *val = byte_count / bytes; - - return err; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_octahedral_gaussian.cc b/src/grib_accessor_class_octahedral_gaussian.cc deleted file mode 100644 index 8035c9ab0..000000000 --- a/src/grib_accessor_class_octahedral_gaussian.cc +++ /dev/null @@ -1,216 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - IMPLEMENTS = pack_long - MEMBERS=const char* N - MEMBERS=const char* Ni - MEMBERS=const char* plpresent - MEMBERS=const char* pl - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_octahedral_gaussian -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in octahedral_gaussian */ - const char* N; - const char* Ni; - const char* plpresent; - const char* pl; -} grib_accessor_octahedral_gaussian; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_octahedral_gaussian = { - &grib_accessor_class_long, /* super */ - "octahedral_gaussian", /* name */ - sizeof(grib_accessor_octahedral_gaussian), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_octahedral_gaussian = &_grib_accessor_class_octahedral_gaussian; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_octahedral_gaussian* self = (grib_accessor_octahedral_gaussian*)a; - int n = 0; - grib_handle* hand = grib_handle_of_accessor(a); - - self->N = grib_arguments_get_name(hand, c, n++); - self->Ni = grib_arguments_get_name(hand, c, n++); - self->plpresent = grib_arguments_get_name(hand, c, n++); - self->pl = grib_arguments_get_name(hand, c, n++); -} - -/* Returns 1 (=true) if input pl array is Octahedral, 0 otherwise. - * Possible cases for the deltas in an octahedral pl array: - * +4 .. +4 Top part, above equator - * +4 .. 0 Top part, above and including equator - * +4.. 0 -4.. Middle part, above, equator and below - * 0 -4.. Equator and below - * -4 ..-4 All below equator - * Anything else is considered not octahedral - */ -static int is_pl_octahedral(const long pl[], size_t size) -{ - long i; - long prev_diff = -1; - for (i = 1; i < size; ++i) { - const long diff = pl[i] - pl[i - 1]; - if (diff == 0) { - /* prev must be +4 or undef */ - if (!(prev_diff == +4 || i == 1)) { - return 0; - } - } - else { - if (labs(diff) != 4) { - return 0; - } - if (diff == +4) { - /* prev must be +4 or undef */ - if (!(prev_diff == +4 || i == 1)) { - return 0; - } - } - if (diff == -4) { - /* prev must be 0, -4 or undef */ - if (!(prev_diff == -4 || prev_diff == 0 || i == 1)) { - return 0; - } - } - } - prev_diff = diff; - } - return 1; /* it's octahedral */ -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_octahedral_gaussian* self = (grib_accessor_octahedral_gaussian*)a; - int ret = GRIB_SUCCESS; - long Ni; - long plpresent = 0; - long* pl = NULL; /* pl array */ - size_t plsize = 0; - grib_handle* hand = grib_handle_of_accessor(a); - - grib_context* c = a->context; - - if ((ret = grib_get_long_internal(hand, self->Ni, &Ni)) != GRIB_SUCCESS) - return ret; - - /* If Ni is not missing, then this is a plain gaussian grid and not reduced. */ - /* So it cannot be an octahedral grid */ - if (Ni != GRIB_MISSING_LONG) { - *val = 0; - return GRIB_SUCCESS; - } - - if ((ret = grib_get_long_internal(hand, self->plpresent, &plpresent)) != GRIB_SUCCESS) - return ret; - if (!plpresent) { - *val = 0; /* Not octahedral */ - return GRIB_SUCCESS; - } - - if ((ret = grib_get_size(hand, self->pl, &plsize)) != GRIB_SUCCESS) - return ret; - Assert(plsize); /* pl array must have at least one element */ - - pl = (long*)grib_context_malloc_clear(c, sizeof(long) * plsize); - if (!pl) { - return GRIB_OUT_OF_MEMORY; - } - if ((ret = grib_get_long_array_internal(hand, self->pl, pl, &plsize)) != GRIB_SUCCESS) - return ret; - - /* pl[0] is guaranteed to exist. Have already asserted previously */ - *val = is_pl_octahedral(pl, plsize); - grib_context_free(c, pl); - - return ret; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} diff --git a/src/grib_accessor_class_octet_number.cc b/src/grib_accessor_class_octet_number.cc deleted file mode 100644 index cce0e742b..000000000 --- a/src/grib_accessor_class_octet_number.cc +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init - MEMBERS=const char* left - MEMBERS=long right - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_octet_number -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in octet_number */ - const char* left; - long right; -} grib_accessor_octet_number; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_octet_number = { - &grib_accessor_class_long, /* super */ - "octet_number", /* name */ - sizeof(grib_accessor_octet_number), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_octet_number = &_grib_accessor_class_octet_number; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_octet_number* self = (grib_accessor_octet_number*)a; - - int n = 0; - self->left = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->right = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); - - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_octet_number* self = (grib_accessor_octet_number*)a; - int ret = GRIB_SUCCESS; - long offset; - - offset = a->offset + self->right; - - if ((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->left, offset)) != GRIB_SUCCESS) - return ret; - - *val = offset; - *len = 1; - - return ret; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_offset_file.cc b/src/grib_accessor_class_offset_file.cc deleted file mode 100644 index 8fd0a0018..000000000 --- a/src/grib_accessor_class_offset_file.cc +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_string - IMPLEMENTS = init - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_offset_file -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in offset_file */ -} grib_accessor_offset_file; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_offset_file = { - &grib_accessor_class_double, /* super */ - "offset_file", /* name */ - sizeof(grib_accessor_offset_file), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_offset_file = &_grib_accessor_class_offset_file; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - *val = (double)grib_handle_of_accessor(a)->offset; - *len = 1; - return GRIB_SUCCESS; -} - -static int unpack_string(grib_accessor* a, char* v, size_t* len) -{ - double val = 0; - size_t l = 1; - char repres[1024] = {0,}; - int err = 0; - const char* cclass_name = a->cclass->name; - - err = grib_unpack_double(a, &val, &l); - if (err) return err; - - snprintf(repres, sizeof(repres), "%.0f", val); - - l = strlen(repres) + 1; - if (l > *len) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, l, *len); - *len = l; - return GRIB_BUFFER_TOO_SMALL; - } - grib_context_log(a->context, GRIB_LOG_DEBUG, "%s: Casting double %s to string", __func__, a->name); - - *len = l; - - strcpy(v, repres); - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_offset_values.cc b/src/grib_accessor_class_offset_values.cc deleted file mode 100644 index 012698f79..000000000 --- a/src/grib_accessor_class_offset_values.cc +++ /dev/null @@ -1,175 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/********************************** - * Enrico Fucile - *********************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double; pack_double - IMPLEMENTS = init - MEMBERS = const char* values - MEMBERS = const char* missingValue - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_offset_values -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in offset_values */ - const char* values; - const char* missingValue; -} grib_accessor_offset_values; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_offset_values = { - &grib_accessor_class_double, /* super */ - "offset_values", /* name */ - sizeof(grib_accessor_offset_values), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_offset_values = &_grib_accessor_class_offset_values; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* args) -{ - int n = 0; - grib_accessor_offset_values* self = (grib_accessor_offset_values*)a; - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->missingValue = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - int ret = 0; - *val = 0; - *len = 1; - return ret; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - double* values = NULL; - size_t size = 0; - double missingValue = 0; - long missingValuesPresent = 0; - int ret = 0, i = 0; - grib_accessor_offset_values* self = (grib_accessor_offset_values*)a; - grib_context* c = a->context; - grib_handle* h = grib_handle_of_accessor(a); - - if (*val == 0) - return GRIB_SUCCESS; - - if ((ret = grib_get_double_internal(h, self->missingValue, &missingValue)) != GRIB_SUCCESS) { - return ret; - } - if ((ret = grib_get_long_internal(h, "missingValuesPresent", &missingValuesPresent)) != GRIB_SUCCESS) { - return ret; - } - - if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) - return ret; - - values = (double*)grib_context_malloc(c, size * sizeof(double)); - if (!values) - return GRIB_OUT_OF_MEMORY; - - if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - for (i = 0; i < size; i++) { - if (missingValuesPresent) { - if (values[i] != missingValue) - values[i] += *val; - } - else { - values[i] += *val; - } - } - - if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) - return ret; - - grib_context_free(c, values); - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_pack_bufr_values.cc b/src/grib_accessor_class_pack_bufr_values.cc deleted file mode 100644 index a076e12ac..000000000 --- a/src/grib_accessor_class_pack_bufr_values.cc +++ /dev/null @@ -1,177 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;dump - IMPLEMENTS = unpack_string;unpack_string_array;unpack_long; unpack_double - IMPLEMENTS = pack_long; pack_double - IMPLEMENTS = value_count; destroy; get_native_type; - MEMBERS = grib_accessor* data_accessor - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int unpack_string_array(grib_accessor*, char**, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_pack_bufr_values -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in pack_bufr_values */ - grib_accessor* data_accessor; -} grib_accessor_pack_bufr_values; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_pack_bufr_values = { - &grib_accessor_class_gen, /* super */ - "pack_bufr_values", /* name */ - sizeof(grib_accessor_pack_bufr_values), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - &unpack_string_array, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_pack_bufr_values = &_grib_accessor_class_pack_bufr_values; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* params) -{ - char* key; - grib_accessor_pack_bufr_values* self = (grib_accessor_pack_bufr_values*)a; - key = (char*)grib_arguments_get_name(grib_handle_of_accessor(a), params, 0); - self->data_accessor = grib_find_accessor(grib_handle_of_accessor(a), key); - - a->length = 0; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ -} - -static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_string(grib_accessor* a, char* buffer, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static void destroy(grib_context* context, grib_accessor* a) -{ -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_pack_bufr_values* self = (grib_accessor_pack_bufr_values*)a; - grib_accessor* data = (grib_accessor*)self->data_accessor; - - return grib_pack_double(data, 0, 0); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_pack_bufr_values* self = (grib_accessor_pack_bufr_values*)a; - grib_accessor* data = (grib_accessor*)self->data_accessor; - - return grib_pack_double(data, 0, 0); -} diff --git a/src/grib_accessor_class_packing_type.cc b/src/grib_accessor_class_packing_type.cc deleted file mode 100644 index a9a4a2deb..000000000 --- a/src/grib_accessor_class_packing_type.cc +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = string_length - IMPLEMENTS = get_native_type - IMPLEMENTS = init - MEMBERS = const char* values - MEMBERS = const char* packing_type - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_packing_type -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in packing_type */ - const char* values; - const char* packing_type; -} grib_accessor_packing_type; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_packing_type = { - &grib_accessor_class_gen, /* super */ - "packing_type", /* name */ - sizeof(grib_accessor_packing_type), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_packing_type = &_grib_accessor_class_packing_type; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* args) -{ - int n = 0; - grib_accessor_packing_type* self = (grib_accessor_packing_type*)a; - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->packing_type = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static size_t string_length(grib_accessor* a) -{ - return 1024; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -static int pack_string(grib_accessor*a, const char* sval, size_t* len) -{ - grib_accessor_packing_type* self = (grib_accessor_packing_type*)a; - grib_handle* h = grib_handle_of_accessor(a); - double* values = NULL; - grib_context* c = a->context; - size_t size = 0; - int err = 0; - - if ((err = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) - return err; - - values = (double*)grib_context_malloc(c, size * sizeof(double)); - if (!values) return GRIB_OUT_OF_MEMORY; - - if ((err = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return err; - } - - if ((err = grib_set_string_internal(h, self->packing_type, sval, len)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return err; - } - - if ((err = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return err; - } - - grib_context_free(c, values); - return GRIB_SUCCESS; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_packing_type* self = (grib_accessor_packing_type*)a; - grib_handle* h = grib_handle_of_accessor(a); - - return grib_get_string(h, self->packing_type, val, len); -} diff --git a/src/grib_accessor_class_pad.cc b/src/grib_accessor_class_pad.cc deleted file mode 100644 index 473a507e1..000000000 --- a/src/grib_accessor_class_pad.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_padding - IMPLEMENTS = init;preferred_size - MEMBERS =grib_expression* expression - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static void init(grib_accessor*, const long, grib_arguments*); -static size_t preferred_size(grib_accessor*, int); - -typedef struct grib_accessor_pad -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in padding */ - /* Members defined in pad */ - grib_expression* expression; -} grib_accessor_pad; - -extern grib_accessor_class* grib_accessor_class_padding; - -static grib_accessor_class _grib_accessor_class_pad = { - &grib_accessor_class_padding, /* super */ - "pad", /* name */ - sizeof(grib_accessor_pad), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - &preferred_size, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_pad = &_grib_accessor_class_pad; - -/* END_CLASS_IMP */ - - -static size_t preferred_size(grib_accessor* a, int from_handle) -{ - grib_accessor_pad* self = (grib_accessor_pad*)a; - - long length = 0; - - grib_expression_evaluate_long(grib_handle_of_accessor(a), self->expression, &length); - - return length > 0 ? length : 0; -} - - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_pad* self = (grib_accessor_pad*)a; - - self->expression = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 0); - a->length = preferred_size(a, 1); -} diff --git a/src/grib_accessor_class_padding.cc b/src/grib_accessor_class_padding.cc deleted file mode 100644 index 790ea9db2..000000000 --- a/src/grib_accessor_class_padding.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_bytes - IMPLEMENTS = init;update_size;resize; value_count - IMPLEMENTS = compare;string_length;byte_count - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static size_t string_length(grib_accessor*); -static long byte_count(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); -static void resize(grib_accessor*,size_t); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_padding -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in padding */ -} grib_accessor_padding; - -extern grib_accessor_class* grib_accessor_class_bytes; - -static grib_accessor_class _grib_accessor_class_padding = { - &grib_accessor_class_bytes, /* super */ - "padding", /* name */ - sizeof(grib_accessor_padding), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - &resize, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_padding = &_grib_accessor_class_padding; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - if (a->length != b->length) - return GRIB_COUNT_MISMATCH; - return GRIB_SUCCESS; -} - -static void update_size(grib_accessor* a, size_t new_size) -{ - a->length = new_size; -} - -static void resize(grib_accessor* a, size_t new_size) -{ - void* zero = grib_context_malloc_clear(a->context, new_size); - - grib_buffer_replace(a, (const unsigned char*)zero, new_size, - /*update_lengths=*/1, /*update_paddings=*/0); - grib_context_free(a->context, zero); - - grib_context_log(a->context, GRIB_LOG_DEBUG, - "grib_accessor_class_padding::resize new_size=%zu a->length=%ld %s %s", - new_size, a->length, a->cclass->name, a->name); - Assert(new_size == a->length); -} - -static int value_count(grib_accessor* a, long* c) -{ - *c = a->length; - return 0; -} - -static long byte_count(grib_accessor* a) -{ - return a->length; -} - -static size_t string_length(grib_accessor* a) -{ - return (size_t)a->length; -} diff --git a/src/grib_accessor_class_padto.cc b/src/grib_accessor_class_padto.cc deleted file mode 100644 index f6f9417b4..000000000 --- a/src/grib_accessor_class_padto.cc +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_padding - IMPLEMENTS = init;preferred_size;dump - MEMBERS=grib_expression* expression - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static size_t preferred_size(grib_accessor*, int); - -typedef struct grib_accessor_padto -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in padding */ - /* Members defined in padto */ - grib_expression* expression; -} grib_accessor_padto; - -extern grib_accessor_class* grib_accessor_class_padding; - -static grib_accessor_class _grib_accessor_class_padto = { - &grib_accessor_class_padding, /* super */ - "padto", /* name */ - sizeof(grib_accessor_padto), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - &preferred_size, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_padto = &_grib_accessor_class_padto; - -/* END_CLASS_IMP */ - - -static size_t preferred_size(grib_accessor* a, int from_handle) -{ - grib_accessor_padto* self = (grib_accessor_padto*)a; - - long length = 0; - long theEnd; - - grib_expression_evaluate_long(grib_handle_of_accessor(a), self->expression, &theEnd); - - length = theEnd - a->offset; - - /* printf("preferred_size: prefered: %ld current:%ld %s %s %ld\n", (long)length,(long)a->length,a->cclass->name,a->name,(long)a->offset); */ - - return length > 0 ? length : 0; -} - - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_padto* self = (grib_accessor_padto*)a; - - self->expression = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 0); - a->length = preferred_size(a, 1); -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - /*grib_dump_string(dumper,a,NULL);*/ -} diff --git a/src/grib_accessor_class_padtoeven.cc b/src/grib_accessor_class_padtoeven.cc deleted file mode 100644 index c75e0e254..000000000 --- a/src/grib_accessor_class_padtoeven.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_padding - IMPLEMENTS = init;preferred_size - MEMBERS=const char* section_offset - MEMBERS=const char* section_length - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static void init(grib_accessor*, const long, grib_arguments*); -static size_t preferred_size(grib_accessor*, int); - -typedef struct grib_accessor_padtoeven -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in padding */ - /* Members defined in padtoeven */ - const char* section_offset; - const char* section_length; -} grib_accessor_padtoeven; - -extern grib_accessor_class* grib_accessor_class_padding; - -static grib_accessor_class _grib_accessor_class_padtoeven = { - &grib_accessor_class_padding, /* super */ - "padtoeven", /* name */ - sizeof(grib_accessor_padtoeven), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - &preferred_size, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_padtoeven = &_grib_accessor_class_padtoeven; - -/* END_CLASS_IMP */ - -static size_t preferred_size(grib_accessor* a, int from_handle) -{ - grib_accessor_padtoeven* self = (grib_accessor_padtoeven*)a; - long offset = 0; - long length = 0; - long seclen; - - grib_get_long_internal(grib_handle_of_accessor(a), self->section_offset, &offset); - grib_get_long_internal(grib_handle_of_accessor(a), self->section_length, &length); - - if ((length % 2) && from_handle) { - // grib_context_log(a->context, - // GRIB_LOG_ERROR,"GRIB message has an odd length section (%ld, %s)", - // (long)length,a->name); - return 0; - } - - /* printf("EVEN %ld %ld\n",(long) a->offset,(long) offset);*/ - seclen = a->offset - offset; - - return (seclen % 2) ? 1 : 0; -} - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_padtoeven* self = (grib_accessor_padtoeven*)a; - - self->section_offset = grib_arguments_get_name(grib_handle_of_accessor(a), args, 0); - self->section_length = grib_arguments_get_name(grib_handle_of_accessor(a), args, 1); - - a->length = preferred_size(a, 1); -} diff --git a/src/grib_accessor_class_padtomultiple.cc b/src/grib_accessor_class_padtomultiple.cc deleted file mode 100644 index 3104cdf2f..000000000 --- a/src/grib_accessor_class_padtomultiple.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_padding - IMPLEMENTS = init;preferred_size - MEMBERS=grib_expression* begin - MEMBERS=grib_expression* multiple - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static void init(grib_accessor*, const long, grib_arguments*); -static size_t preferred_size(grib_accessor*, int); - -typedef struct grib_accessor_padtomultiple -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in padding */ - /* Members defined in padtomultiple */ - grib_expression* begin; - grib_expression* multiple; -} grib_accessor_padtomultiple; - -extern grib_accessor_class* grib_accessor_class_padding; - -static grib_accessor_class _grib_accessor_class_padtomultiple = { - &grib_accessor_class_padding, /* super */ - "padtomultiple", /* name */ - sizeof(grib_accessor_padtomultiple), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - &preferred_size, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_padtomultiple = &_grib_accessor_class_padtomultiple; - -/* END_CLASS_IMP */ - -static size_t preferred_size(grib_accessor* a, int from_handle) -{ - grib_accessor_padtomultiple* self = (grib_accessor_padtomultiple*)a; - long padding = 0; - long begin = 0; - long multiple = 0; - - grib_expression_evaluate_long(grib_handle_of_accessor(a), self->begin, &begin); - grib_expression_evaluate_long(grib_handle_of_accessor(a), self->multiple, &multiple); - - padding = a->offset - begin; - padding = ((padding + multiple - 1) / multiple) * multiple - padding; - - return padding == 0 ? multiple : padding; -} - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_padtomultiple* self = (grib_accessor_padtomultiple*)a; - - self->begin = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 0); - self->multiple = grib_arguments_get_expression(grib_handle_of_accessor(a), arg, 1); - a->length = preferred_size(a, 1); -} diff --git a/src/grib_accessor_class_position.cc b/src/grib_accessor_class_position.cc deleted file mode 100644 index 0f9565c37..000000000 --- a/src/grib_accessor_class_position.cc +++ /dev/null @@ -1,137 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long - IMPLEMENTS = get_native_type - IMPLEMENTS = init;dump - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_position -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in position */ -} grib_accessor_position; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_position = { - &grib_accessor_class_gen, /* super */ - "position", /* name */ - sizeof(grib_accessor_position), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_position = &_grib_accessor_class_position; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; - a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_long(dumper, a, NULL); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - if (*len < 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1); - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - *val = a->offset; - *len = 1; - return GRIB_SUCCESS; -} - -// static int compare(grib_accessor* a, grib_accessor* b) -// { -// if (a->offset != b->offset) -// return GRIB_OFFSET_MISMATCH; -// return GRIB_SUCCESS; -// } diff --git a/src/grib_accessor_class_raw.cc b/src/grib_accessor_class_raw.cc deleted file mode 100644 index cdac6a100..000000000 --- a/src/grib_accessor_class_raw.cc +++ /dev/null @@ -1,219 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = get_native_type;init;update_size; pack_bytes - IMPLEMENTS = compare;unpack_bytes;byte_count;value_count - MEMBERS = const char* totalLength - MEMBERS = const char* sectionLength - MEMBERS = long relativeOffset - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_bytes(grib_accessor*, const unsigned char*, size_t* len); -static int unpack_bytes(grib_accessor*, unsigned char*, size_t* len); -static long byte_count(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_raw -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in raw */ - const char* totalLength; - const char* sectionLength; - long relativeOffset; -} grib_accessor_raw; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_raw = { - &grib_accessor_class_gen, /* super */ - "raw", /* name */ - sizeof(grib_accessor_raw), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - &pack_bytes, /* pack_bytes */ - &unpack_bytes, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_raw = &_grib_accessor_class_raw; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - int n = 0; - int err = 0; - long sectionLength; - grib_accessor_raw* self = (grib_accessor_raw*)a; - grib_expression* e; - grib_handle* hand = grib_handle_of_accessor(a); - - a->length = 0; - self->totalLength = grib_arguments_get_name(hand, arg, n++); - self->sectionLength = grib_arguments_get_name(hand, arg, n++); - - e = grib_arguments_get_expression(hand, arg, n++); - err = grib_expression_evaluate_long(hand, e, &(self->relativeOffset)); - if (err) - grib_context_log(hand->context, GRIB_LOG_ERROR, "Unable to evaluate relativeOffset"); - - grib_get_long(hand, self->sectionLength, §ionLength); - - a->length = sectionLength - self->relativeOffset; - if (a->length < 0) - a->length = 0; - - /* Assert(a->length>=0); */ -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_BYTES; -} - - -static int compare(grib_accessor* a, grib_accessor* b) -{ - int retval = GRIB_SUCCESS; - - size_t alen = (size_t)grib_byte_count(a); - size_t blen = (size_t)grib_byte_count(b); - - if (alen != blen) - return GRIB_COUNT_MISMATCH; - - return retval; -} - -static long byte_count(grib_accessor* a) -{ - return a->length; -} - -static int value_count(grib_accessor* a, long* len) -{ - *len = a->length; - return 0; -} - -static int unpack_bytes(grib_accessor* a, unsigned char* buffer, size_t* len) -{ - if (*len < a->length) { - *len = a->length; - return GRIB_ARRAY_TOO_SMALL; - } - *len = a->length; - - memcpy(buffer, grib_handle_of_accessor(a)->buffer->data + a->offset, *len); - - return GRIB_SUCCESS; -} - -static void update_size(grib_accessor* a, size_t s) -{ - grib_context_log(a->context, GRIB_LOG_DEBUG, "updating size of %s old %ld new %ld", a->name, a->length, s); - a->length = s; - Assert(a->length >= 0); -} - -void accessor_raw_set_length(grib_accessor* a, size_t len) -{ - a->length = len; -} - -long accessor_raw_get_offset(grib_accessor* a) -{ - return a->offset; -} - -static int pack_bytes(grib_accessor* a, const unsigned char* val, size_t* len) -{ - size_t length = *len; - long totalLength; - long sectionLength; - grib_handle* h = grib_handle_of_accessor(a); - grib_accessor_raw* self = (grib_accessor_raw*)a; - long dlen = length - a->length; - - grib_get_long(h, self->totalLength, &totalLength); - totalLength += dlen; - grib_get_long(h, self->sectionLength, §ionLength); - sectionLength += dlen; - - grib_buffer_replace(a, val, length, 1, 1); - - grib_set_long(h, self->totalLength, totalLength); - grib_set_long(h, self->sectionLength, sectionLength); - a->length = length; - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_rdbtime_guess_date.cc b/src/grib_accessor_class_rdbtime_guess_date.cc deleted file mode 100644 index 8a3bfa2a1..000000000 --- a/src/grib_accessor_class_rdbtime_guess_date.cc +++ /dev/null @@ -1,172 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init - MEMBERS=const char* typicalYear - MEMBERS=const char* typicalMonth - MEMBERS=const char* typicalDay - MEMBERS=const char* rdbDay - MEMBERS=long yearOrMonth - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_rdbtime_guess_date -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in rdbtime_guess_date */ - const char* typicalYear; - const char* typicalMonth; - const char* typicalDay; - const char* rdbDay; - long yearOrMonth; -} grib_accessor_rdbtime_guess_date; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_rdbtime_guess_date = { - &grib_accessor_class_long, /* super */ - "rdbtime_guess_date", /* name */ - sizeof(grib_accessor_rdbtime_guess_date), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_rdbtime_guess_date = &_grib_accessor_class_rdbtime_guess_date; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_rdbtime_guess_date* self = (grib_accessor_rdbtime_guess_date*)a; - int n = 0; - - self->typicalYear = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->typicalMonth = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->typicalDay = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->rdbDay = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->yearOrMonth = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); - - /* a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; */ -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_rdbtime_guess_date* self = (grib_accessor_rdbtime_guess_date*)a; - grib_handle* h = grib_handle_of_accessor(a); - int ret = 0; - long typicalYear, typicalMonth, typicalDay, rdbDay; - long rdbYear, rdbMonth; - - ret = grib_get_long(h, self->typicalYear, &typicalYear); - if (ret) - return ret; - ret = grib_get_long(h, self->typicalMonth, &typicalMonth); - if (ret) - return ret; - ret = grib_get_long(h, self->typicalDay, &typicalDay); - if (ret) - return ret; - ret = grib_get_long(h, self->rdbDay, &rdbDay); - if (ret) - return ret; - - if (rdbDay < typicalDay) { - if (typicalDay == 31 && typicalMonth == 12) { - rdbYear = typicalYear + 1; - rdbMonth = 1; - } - else { - rdbYear = typicalYear; - rdbMonth = typicalMonth + 1; - } - } - else { - rdbYear = typicalYear; - rdbMonth = typicalMonth; - } - - *val = self->yearOrMonth == 1 ? rdbYear : rdbMonth; - *len = 1; - - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* v, size_t* len) -{ - /* do nothing*/ - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_reference_value_error.cc b/src/grib_accessor_class_reference_value_error.cc deleted file mode 100644 index 3cc4af20d..000000000 --- a/src/grib_accessor_class_reference_value_error.cc +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double - IMPLEMENTS = init - MEMBERS=const char* referenceValue - MEMBERS=const char* floatType - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_reference_value_error -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in reference_value_error */ - const char* referenceValue; - const char* floatType; -} grib_accessor_reference_value_error; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_reference_value_error = { - &grib_accessor_class_double, /* super */ - "reference_value_error", /* name */ - sizeof(grib_accessor_reference_value_error), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_reference_value_error = &_grib_accessor_class_reference_value_error; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_reference_value_error* self = (grib_accessor_reference_value_error*)a; - int n = 0; - - self->referenceValue = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->floatType = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_reference_value_error* self = (grib_accessor_reference_value_error*)a; - int ret = 0; - double referenceValue = 0; - - if ((ret = grib_get_double_internal(grib_handle_of_accessor(a), - self->referenceValue, &referenceValue)) != GRIB_SUCCESS) - return ret; - - if (!strcmp(self->floatType, "ibm")) - *val = grib_ibmfloat_error(referenceValue); - else if (!strcmp(self->floatType, "ieee")) - *val = grib_ieeefloat_error(referenceValue); - else - Assert(1 == 0); - - if (ret == GRIB_SUCCESS) - *len = 1; - - return ret; -} diff --git a/src/grib_accessor_class_round.cc b/src/grib_accessor_class_round.cc deleted file mode 100644 index 98fe2fda5..000000000 --- a/src/grib_accessor_class_round.cc +++ /dev/null @@ -1,154 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_evaluate - IMPLEMENTS = unpack_double - IMPLEMENTS = unpack_string - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); - -typedef struct grib_accessor_round -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in evaluate */ - grib_arguments* arg; - /* Members defined in round */ -} grib_accessor_round; - -extern grib_accessor_class* grib_accessor_class_evaluate; - -static grib_accessor_class _grib_accessor_class_round = { - &grib_accessor_class_evaluate, /* super */ - "round", /* name */ - sizeof(grib_accessor_round), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_round = &_grib_accessor_class_round; - -/* END_CLASS_IMP */ - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_round* self = (grib_accessor_round*)a; - - int ret = GRIB_SUCCESS; - - size_t replen = 0; - double rounding_precision = 0; - double rounded = 0; - double toround = 0; - - const char* oval = NULL; - oval = grib_arguments_get_name(grib_handle_of_accessor(a), self->arg, 0); - - if ((ret = grib_get_double_internal(grib_handle_of_accessor(a), oval, &toround)) != 0) - return ret; - - rounding_precision = grib_arguments_get_long(grib_handle_of_accessor(a), self->arg, 1); - - rounded = floor(rounding_precision * toround + 0.5) / rounding_precision; - - *len = replen; - - *val = rounded; - - return ret; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - char result[1024]; - int ret = GRIB_SUCCESS; - size_t replen = 1; - - double value = 0; - - ret = unpack_double(a, &value, &replen); - - snprintf(result, sizeof(result), "%.3f", value); - - replen = strlen(result) + 1; - - if (*len < replen) { - *len = replen; - return GRIB_ARRAY_TOO_SMALL; - } - - *len = replen; - - snprintf(val, 1024, "%s", result); - - return ret; -} diff --git a/src/grib_accessor_class_scale.cc b/src/grib_accessor_class_scale.cc deleted file mode 100644 index 6fec75e94..000000000 --- a/src/grib_accessor_class_scale.cc +++ /dev/null @@ -1,237 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double;pack_double;is_missing - IMPLEMENTS = pack_long - IMPLEMENTS = init - MEMBERS=const char* value - MEMBERS=const char* multiplier - MEMBERS=const char* divisor - MEMBERS=const char* truncating - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int is_missing(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_scale -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in scale */ - const char* value; - const char* multiplier; - const char* divisor; - const char* truncating; -} grib_accessor_scale; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_scale = { - &grib_accessor_class_double, /* super */ - "scale", /* name */ - sizeof(grib_accessor_scale), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - &is_missing, /* is_missing */ - &pack_long, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_scale = &_grib_accessor_class_scale; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_scale* self = (grib_accessor_scale*)a; - int n = 0; - - self->value = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->multiplier = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->divisor = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->truncating = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_scale* self = (grib_accessor_scale*)a; - int ret = 0; - long value = 0; - long multiplier = 0; - long divisor = 0; - - if (*len < 1) { - ret = GRIB_ARRAY_TOO_SMALL; - grib_context_log(a->context, GRIB_LOG_ERROR, - "Accessor %s cannot gather value for %s and/or %s", - a->name, self->multiplier, self->divisor); - return ret; - } - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->divisor, &divisor)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->multiplier, &multiplier)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->value, &value)) != GRIB_SUCCESS) - return ret; - - if (value == GRIB_MISSING_LONG) - *val = GRIB_MISSING_DOUBLE; - else - *val = ((double)(value * multiplier)) / divisor; - - if (ret == GRIB_SUCCESS) - *len = 1; - - return ret; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - const double dval = (double)*val; - return pack_double(a, &dval, len); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_scale* self = (grib_accessor_scale*)a; - int ret = 0; - - long value = 0; - long divisor = 0; - long multiplier = 0; - long truncating = 0; - double x; - - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->divisor, &divisor); - if (ret != GRIB_SUCCESS) return ret; - - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->multiplier, &multiplier); - if (ret != GRIB_SUCCESS) return ret; - - if (self->truncating) { - ret = grib_get_long_internal(grib_handle_of_accessor(a), self->truncating, &truncating); - if (ret != GRIB_SUCCESS) return ret; - } - - if (multiplier == 0) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor %s: cannot divide by a zero multiplier %s", - a->name, self->multiplier); - return GRIB_ENCODING_ERROR; - } - - x = *val * (double)divisor / (double)multiplier; - if (*val == GRIB_MISSING_DOUBLE) - value = GRIB_MISSING_LONG; - else if (truncating) { - value = (long)x; - } - else { - value = x > 0 ? (long)(x + 0.5) : (long)(x - 0.5); - } - - ret = grib_set_long_internal(grib_handle_of_accessor(a), self->value, value); - if (ret) - grib_context_log(a->context, GRIB_LOG_ERROR, - "Accessor %s: cannot pack value for %s (%s)\n", - a->name, self->value, grib_get_error_message(ret)); - - if (ret == GRIB_SUCCESS) - *len = 1; - - return ret; -} - -static int is_missing(grib_accessor* a) -{ - grib_accessor_scale* self = (grib_accessor_scale*)a; - grib_accessor* av = grib_find_accessor(grib_handle_of_accessor(a), self->value); - - if (!av) - return GRIB_NOT_FOUND; - return grib_is_missing_internal(av); - // int ret=0; - // long value=0; - // if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->value, &value))!= GRIB_SUCCESS){ - // grib_context_log(a->context, GRIB_LOG_ERROR, - // "Accessor %s cannot gather value for %s error %d \n", a->name, - // self->value, ret); - // return 0; - // } - // return (value == GRIB_MISSING_LONG); -} diff --git a/src/grib_accessor_class_scale_values.cc b/src/grib_accessor_class_scale_values.cc deleted file mode 100644 index 8c4b33fcb..000000000 --- a/src/grib_accessor_class_scale_values.cc +++ /dev/null @@ -1,177 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/********************************** - * Enrico Fucile - *********************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double; pack_double - IMPLEMENTS = init - MEMBERS = const char* values - MEMBERS = const char* missingValue - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_scale_values -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in scale_values */ - const char* values; - const char* missingValue; -} grib_accessor_scale_values; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_scale_values = { - &grib_accessor_class_double, /* super */ - "scale_values", /* name */ - sizeof(grib_accessor_scale_values), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_scale_values = &_grib_accessor_class_scale_values; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* args) -{ - int n = 0; - grib_accessor_scale_values* self = (grib_accessor_scale_values*)a; - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->missingValue = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - int ret = 0; - *val = 1; - *len = 1; - return ret; -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - double* values = NULL; - double missingValue = 0; - long missingValuesPresent = 0; - size_t size = 0; - int ret = 0, i = 0; - grib_accessor_scale_values* self = (grib_accessor_scale_values*)a; - const grib_context* c = a->context; - grib_handle* h = grib_handle_of_accessor(a); - - if (*val == 1) - return GRIB_SUCCESS; - - if ((ret = grib_get_double_internal(h, self->missingValue, &missingValue)) != GRIB_SUCCESS) { - return ret; - } - if ((ret = grib_get_long_internal(h, "missingValuesPresent", &missingValuesPresent)) != GRIB_SUCCESS) { - return ret; - } - - if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) - return ret; - - values = (double*)grib_context_malloc(c, size * sizeof(double)); - if (!values) - return GRIB_OUT_OF_MEMORY; - - if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - for (i = 0; i < size; i++) { - if (missingValuesPresent) { - if (values[i] != missingValue) - values[i] *= *val; - } - else { - values[i] *= *val; - } - } - - if ((ret = grib_set_double_array_internal(h, self->values, values, size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - grib_context_free(c, values); - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_section.cc b/src/grib_accessor_class_section.cc deleted file mode 100644 index f9c8857a7..000000000 --- a/src/grib_accessor_class_section.cc +++ /dev/null @@ -1,194 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = next_offset;byte_count - IMPLEMENTS = destroy;sub_section - IMPLEMENTS = get_native_type - IMPLEMENTS = init;dump;update_size - IMPLEMENTS = next - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static grib_section* sub_section(grib_accessor* a); -static int get_native_type(grib_accessor*); -static long byte_count(grib_accessor*); -static long next_offset(grib_accessor*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); -static grib_accessor* next(grib_accessor*, int); - -typedef struct grib_accessor_section -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in section */ -} grib_accessor_section; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_section = { - &grib_accessor_class_gen, /* super */ - "section", /* name */ - sizeof(grib_accessor_section), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - &byte_count, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - &sub_section, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - &next, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_section = &_grib_accessor_class_section; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->sub_section = grib_section_create(grib_handle_of_accessor(a), a); - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_section(dumper, a, a->sub_section->block); -} - -static long byte_count(grib_accessor* a) -{ - if (!a->length || grib_handle_of_accessor(a)->loader) { - if (a->name[1] == '_') - return 0; - - /* printf("adjusting sizes SECTION %s is %ld %ld\n",a->name,(long)a->offset,(long)a->length); */ - grib_section_adjust_sizes(a->sub_section, grib_handle_of_accessor(a)->loader != NULL, 0); - /* printf(" SECTION %s is %ld %ld\n",a->name,(long)a->offset,(long)a->length); */ - } - - /* printf("SECTION %s is %ld %d\n",a->name,a->length,a->sub_section->aclength != NULL); */ - return a->length; -} - -static long next_offset(grib_accessor* a) -{ - return a->offset + byte_count(a); -} - -static void destroy(grib_context* ct, grib_accessor* a) -{ - grib_section_delete(ct, a->sub_section); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_SECTION; -} - -static grib_section* sub_section(grib_accessor* a) -{ - return a->sub_section; -} - -static void update_size(grib_accessor* a, size_t length) -{ - size_t size = 1; - long len = length; - Assert(length <= 0x7fffffff); - if (a->sub_section->aclength) { - int e = grib_pack_long(a->sub_section->aclength, &len, &size); - Assert(e == GRIB_SUCCESS); - // printf("update_length %s %ld %ld\n", a->sub_section->aclength->name, - // (long)a->sub_section->aclength->offset, - // (long)a->sub_section->aclength->length); - } - - a->sub_section->length = a->length = length; - a->sub_section->padding = 0; - - // printf("update_size %s %ld\n", a->name, a->length); - - Assert(a->length >= 0); -} - -static grib_accessor* next(grib_accessor* a, int explore) -{ - grib_accessor* next = NULL; - if (explore) { - next = a->sub_section->block->first; - if (!next) - next = a->next; - } - else { - next = a->next; - } - if (!next) { - if (a->parent->owner) - next = a->parent->owner->cclass->next(a->parent->owner, 0); - } - return next; -} diff --git a/src/grib_accessor_class_section_length.cc b/src/grib_accessor_class_section_length.cc deleted file mode 100644 index 4e5957e71..000000000 --- a/src/grib_accessor_class_section_length.cc +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_unsigned - IMPLEMENTS = init;dump - IMPLEMENTS = value_count - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_section_length -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in section_length */ -} grib_accessor_section_length; - -extern grib_accessor_class* grib_accessor_class_unsigned; - -static grib_accessor_class _grib_accessor_class_section_length = { - &grib_accessor_class_unsigned, /* super */ - "section_length", /* name */ - sizeof(grib_accessor_section_length), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_section_length = &_grib_accessor_class_section_length; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->parent->aclength = a; - a->length = len; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; - Assert(a->length >= 0); -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_long(dumper, a, NULL); -} - -static int value_count(grib_accessor* a, long* c) -{ - *c = 1; - return 0; -} diff --git a/src/grib_accessor_class_section_padding.cc b/src/grib_accessor_class_section_padding.cc deleted file mode 100644 index 682946df5..000000000 --- a/src/grib_accessor_class_section_padding.cc +++ /dev/null @@ -1,155 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_padding - IMPLEMENTS = init;preferred_size - MEMBERS = int preserve - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static void init(grib_accessor*, const long, grib_arguments*); -static size_t preferred_size(grib_accessor*, int); - -typedef struct grib_accessor_section_padding -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in bytes */ - /* Members defined in padding */ - /* Members defined in section_padding */ - int preserve; -} grib_accessor_section_padding; - -extern grib_accessor_class* grib_accessor_class_padding; - -static grib_accessor_class _grib_accessor_class_section_padding = { - &grib_accessor_class_padding, /* super */ - "section_padding", /* name */ - sizeof(grib_accessor_section_padding), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - &preferred_size, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_section_padding = &_grib_accessor_class_section_padding; - -/* END_CLASS_IMP */ - -static size_t preferred_size(grib_accessor* a, int from_handle) -{ - grib_accessor_section_padding* self = (grib_accessor_section_padding*)a; - grib_accessor* b = a; - grib_accessor* section_length = 0; - long length = 0; - size_t size = 1; - - long alength = 0; - - if (!from_handle) { - if (self->preserve) - return a->length; - else - return 0; - } - - /* The section length should be a parameter */ - while (section_length == NULL && b != NULL) { - section_length = b->parent->aclength; - b = b->parent->owner; - } - - if (!section_length) { - /* printf("PADDING is no !section_length\n"); */ - return 0; - } - - if (grib_unpack_long(section_length, &length, &size) == GRIB_SUCCESS) { - if (length) - alength = length - a->offset + section_length->parent->owner->offset; - else - alength = 0; - - /*Assert(a->length>=0);*/ - - if (alength < 0) - alength = 0; - - /* printf("PADDING is %ld\n",a->length); */ - } - else { - /* printf("PADDING unpack fails\n"); */ - } - - return alength; -} - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_section_padding* self = (grib_accessor_section_padding*)a; - self->preserve = 1; /* This should be a parameter */ - a->length = preferred_size(a, 1); -} diff --git a/src/grib_accessor_class_section_pointer.cc b/src/grib_accessor_class_section_pointer.cc deleted file mode 100644 index 861ab12e7..000000000 --- a/src/grib_accessor_class_section_pointer.cc +++ /dev/null @@ -1,194 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;get_native_type;unpack_string - IMPLEMENTS = byte_count; byte_offset - MEMBERS = const char* sectionOffset - MEMBERS = const char* sectionLength - MEMBERS = long sectionNumber - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_section_pointer -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in section_pointer */ - const char* sectionOffset; - const char* sectionLength; - long sectionNumber; -} grib_accessor_section_pointer; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_section_pointer = { - &grib_accessor_class_gen, /* super */ - "section_pointer", /* name */ - sizeof(grib_accessor_section_pointer), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_section_pointer = &_grib_accessor_class_section_pointer; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - int n = 0; - grib_accessor_section_pointer* self = (grib_accessor_section_pointer*)a; - - self->sectionOffset = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); - self->sectionLength = grib_arguments_get_name(grib_handle_of_accessor(a), arg, n++); - self->sectionNumber = grib_arguments_get_long(grib_handle_of_accessor(a), arg, n++); - - Assert(self->sectionNumber < MAX_NUM_SECTIONS); - - grib_handle_of_accessor(a)->section_offset[self->sectionNumber] = (char*)self->sectionOffset; - grib_handle_of_accessor(a)->section_length[self->sectionNumber] = (char*)self->sectionLength; - - /* printf("++++++++++++++ GRIB_API: creating section_pointer%d %s %s\n", */ - /* self->sectionNumber,self->sectionLength,self->sectionLength); */ - - if (grib_handle_of_accessor(a)->sections_count < self->sectionNumber) - grib_handle_of_accessor(a)->sections_count = self->sectionNumber; - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; - a->length = 0; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_BYTES; -} - -static int unpack_string(grib_accessor* a, char* v, size_t* len) -{ - /* - unsigned char* p=NULL; - char* s=v; - int i; - long length=grib_byte_count(a); - - if (*len < length) return GRIB_ARRAY_TOO_SMALL; - - p = grib_handle_of_accessor(a)->buffer->data + grib_byte_offset(a); - - for (i = 0; i < length; i++) { - snprintf (s,64,"%02x", *(p++)); - s+=2; - } - *len=length; - */ - snprintf(v, 64, "%ld_%ld", grib_byte_offset(a), grib_byte_count(a)); - return GRIB_SUCCESS; -} - -static long byte_count(grib_accessor* a) -{ - grib_accessor_section_pointer* self = (grib_accessor_section_pointer*)a; - long sectionLength = 0; - int ret = 0; - - ret = grib_get_long(grib_handle_of_accessor(a), self->sectionLength, §ionLength); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Unable to get %s %s", - self->sectionLength, grib_get_error_message(ret)); - return -1; - } - - return sectionLength; -} - -static long byte_offset(grib_accessor* a) -{ - grib_accessor_section_pointer* self = (grib_accessor_section_pointer*)a; - long sectionOffset = 0; - int ret = 0; - - ret = grib_get_long(grib_handle_of_accessor(a), self->sectionOffset, §ionOffset); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Unable to get %s %s", - self->sectionOffset, grib_get_error_message(ret)); - return -1; - } - - return sectionOffset; -} diff --git a/src/grib_accessor_class_sexagesimal2decimal.cc b/src/grib_accessor_class_sexagesimal2decimal.cc deleted file mode 100644 index 9e132d9c2..000000000 --- a/src/grib_accessor_class_sexagesimal2decimal.cc +++ /dev/null @@ -1,241 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ -/*********************************************************** - * Enrico Fucile - ***********************************************************/ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_to_double - IMPLEMENTS = init; unpack_string - IMPLEMENTS = dump - IMPLEMENTS = get_native_type - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_sexagesimal2decimal -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in to_double */ - const char* key; - long start; - size_t length; - long scale; - /* Members defined in sexagesimal2decimal */ -} grib_accessor_sexagesimal2decimal; - -extern grib_accessor_class* grib_accessor_class_to_double; - -static grib_accessor_class _grib_accessor_class_sexagesimal2decimal = { - &grib_accessor_class_to_double, /* super */ - "sexagesimal2decimal", /* name */ - sizeof(grib_accessor_sexagesimal2decimal), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_sexagesimal2decimal = &_grib_accessor_class_sexagesimal2decimal; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_double(dumper, a, NULL); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_DOUBLE; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - int err = 0; - grib_accessor_sexagesimal2decimal* self = (grib_accessor_sexagesimal2decimal*)a; - char buff[512] = {0,}; - size_t length = 0; - size_t size = 512; - char* p; - char* q; - double dd, mm = 0, ss = 0; - int dd_sign = 1; - - err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size); - if (err) - return err; - q = buff + self->start; - if (self->length) - q[length] = 0; - p = q; - - while (*p != '-' && *p != ':' && *p != ' ' && *p != 0) { - p++; - } - - if (*p == 0) { - return GRIB_WRONG_CONVERSION; - } - *p = 0; - - dd = atoi(q); - p++; - q = p; - while (*p != '-' && *p != ':' && *p != ' ' && *p != 'N' && *p != 'S' && *p != 'E' && *p != 'W' && *p != 0) { - p++; - } - switch (*p) { - case ' ': - case '-': - case ':': - *p = 0; - mm = atoi(q) / 60.0; - dd += mm; - p++; - q = p; - break; - case 'N': - case 'E': - *p = 0; - dd_sign = 1; - mm = atoi(q) / 60.0; - dd += mm; - p++; - q = p; - break; - case 'S': - case 'W': - *p = 0; - mm = atoi(q) / 60.0; - dd += mm; - dd_sign = -1; - p++; - q = p; - break; - case 0: - break; - default: - return GRIB_WRONG_CONVERSION; - } - if (*p) { - while (*p != '-' && *p != ':' && *p != ' ' && *p != 'N' && *p != 'S' && *p != 'E' && *p != 'W' && *p != 0) { - p++; - } - switch (*p) { - case ' ': - case '-': - case ':': - *p = 0; - ss = atof(q) / 60.0; - dd += ss; - break; - case 'N': - case 'E': - *p = 0; - ss = atof(q) / 60.0; - dd += ss; - dd_sign = 1; - break; - case 'S': - case 'W': - *p = 0; - ss = atof(q) / 60.0; - dd += ss; - dd_sign = -1; - break; - case 0: - break; - default: - return GRIB_WRONG_CONVERSION; - } - } - dd *= dd_sign; - - snprintf(buff, sizeof(buff), "%.2f", dd); - length = strlen(buff); - - if (len[0] < length + 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values", - len[0], a->name, a->length + 1); - len[0] = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - strcpy(val, buff); - - len[0] = length; - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_signed.cc b/src/grib_accessor_class_signed.cc deleted file mode 100644 index 3439934e1..000000000 --- a/src/grib_accessor_class_signed.cc +++ /dev/null @@ -1,317 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init;dump - IMPLEMENTS = next_offset - IMPLEMENTS = byte_count - IMPLEMENTS = value_count - IMPLEMENTS = byte_offset - IMPLEMENTS = update_size; is_missing - MEMBERS = grib_arguments* arg - MEMBERS = int nbytes; - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int is_missing(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); - -typedef struct grib_accessor_signed -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in signed */ - grib_arguments* arg; - int nbytes; -} grib_accessor_signed; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_signed = { - &grib_accessor_class_long, /* super */ - "signed", /* name */ - sizeof(grib_accessor_signed), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - &is_missing, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_signed = &_grib_accessor_class_signed; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_signed* self = (grib_accessor_signed*)a; - long count = 0; - - self->arg = arg; - grib_value_count(a, &count); - a->length = len * count; - self->nbytes = len; - Assert(a->length >= 0); -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - long rlen = 0; - grib_value_count(a, &rlen); - if (rlen == 1) - grib_dump_long(dumper, a, NULL); - else - grib_dump_values(dumper, a); -} - -static const long ones[] = { - 0, - -0x7f, - -0x7fff, - -0x7fffff, - -0x7fffffff, -}; - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_signed* self = (grib_accessor_signed*)a; - unsigned long rlen = 0; - int err = 0; - long count = 0; - unsigned long i = 0; - grib_handle* hand = grib_handle_of_accessor(a); - long pos = a->offset; - long missing = 0; - - err = grib_value_count(a, &count); - if (err) - return err; - rlen = count; - - if (*len < rlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %lu values", a->name, rlen); - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - if (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) { - Assert(self->nbytes <= 4); - missing = ones[self->nbytes]; - } - - for (i = 0; i < rlen; i++) { - val[i] = (long)grib_decode_signed_long(hand->buffer->data, pos, self->nbytes); - if (missing) - if (val[i] == missing) - val[i] = GRIB_MISSING_LONG; - pos += self->nbytes; - } - - *len = rlen; - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_signed* self = (grib_accessor_signed*)a; - int ret = 0; - long off = 0; - unsigned long rlen = 0; - int err = 0; - long count = 0; - size_t buflen = 0; - unsigned char* buf = NULL; - unsigned long i = 0; - long missing = 0; - - err = grib_value_count(a, &count); - if (err) - return err; - rlen = count; - - if (*len < 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %d values", a->name, 1); - len[0] = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - if (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) { - Assert(self->nbytes <= 4); - missing = ones[self->nbytes]; - } - - if (rlen == 1) { - long v = val[0]; - if (missing) { - if (v == GRIB_MISSING_LONG) - v = missing; - } else { - // ECC-1605: Check overflow/underflow - const int nbits = self->nbytes * 8; - const long minval = -(1L << (nbits-1)) + 1; - const long maxval = (1L << (nbits-1)) - 1; - //printf(" key=%s: v=%ld (minval=%ld maxval=%ld)\n", a->name, v, minval, maxval); - if (v > maxval || v < minval) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Key \"%s\": Trying to encode value of %ld but the allowable range is %ld to %ld (number of bits=%d)", - a->name, v, minval, maxval, nbits); - return GRIB_ENCODING_ERROR; - } - } - - off = a->offset; - ret = grib_encode_signed_long(grib_handle_of_accessor(a)->buffer->data, v, off, a->length); - if (ret == GRIB_SUCCESS) - len[0] = 1; - if (*len > 1) - grib_context_log(a->context, GRIB_LOG_WARNING, "grib_accessor_signed : Trying to pack %d values in a scalar %s, packing first value", *len, a->name); - len[0] = 1; - return ret; - } - - /* TODO: We assume that there are no missing values if there are more that 1 value */ - - buflen = *len * a->length; - - buf = (unsigned char*)grib_context_malloc(a->context, buflen); - - for (i = 0; i < *len; i++) { - grib_encode_signed_long(buf, val[i], off, a->length); - off += a->length; - } - ret = grib_set_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), *len); - - if (ret == GRIB_SUCCESS) - grib_buffer_replace(a, buf, buflen, 1, 1); - else - *len = 0; - - grib_context_free(a->context, buf); - return ret; -} - -static long byte_count(grib_accessor* a) -{ - return a->length; -} - -static int value_count(grib_accessor* a, long* len) -{ - grib_accessor_signed* self = (grib_accessor_signed*)a; - *len = 0; - if (!self->arg) { - *len = 1; - return 0; - } - return grib_get_long_internal(grib_handle_of_accessor(a), grib_arguments_get_name(a->parent->h, self->arg, 0), len); -} - -static long byte_offset(grib_accessor* a) -{ - return a->offset; -} - -static void update_size(grib_accessor* a, size_t s) -{ - a->length = s; - Assert(a->length >= 0); -} - -static long next_offset(grib_accessor* a) -{ - return grib_byte_offset(a) + grib_byte_count(a); -} - -static int is_missing(grib_accessor* a) -{ - int i = 0; - unsigned char ff = 0xff; - unsigned long offset = a->offset; - grib_handle* hand = grib_handle_of_accessor(a); - - if (a->length == 0) { - Assert(a->vvalue != NULL); - return a->vvalue->missing; - } - - for (i = 0; i < a->length; i++) { - if (hand->buffer->data[offset] != ff) - return 0; - offset++; - } - - return 1; -} diff --git a/src/grib_accessor_class_signed_bits.cc b/src/grib_accessor_class_signed_bits.cc deleted file mode 100644 index dc8ccf488..000000000 --- a/src/grib_accessor_class_signed_bits.cc +++ /dev/null @@ -1,258 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init - IMPLEMENTS = next_offset - IMPLEMENTS = byte_count - IMPLEMENTS = value_count - IMPLEMENTS = byte_offset - IMPLEMENTS = update_size - MEMBERS = const char* numberOfBits - MEMBERS = const char* numberOfElements - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); - -typedef struct grib_accessor_signed_bits -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in signed_bits */ - const char* numberOfBits; - const char* numberOfElements; -} grib_accessor_signed_bits; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_signed_bits = { - &grib_accessor_class_long, /* super */ - "signed_bits", /* name */ - sizeof(grib_accessor_signed_bits), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_signed_bits = &_grib_accessor_class_signed_bits; - -/* END_CLASS_IMP */ - -static long byte_count(grib_accessor* a) -{ - return a->length; -} - -static long compute_byte_count(grib_accessor* a) -{ - grib_accessor_signed_bits* self = (grib_accessor_signed_bits*)a; - long numberOfBits; - long numberOfElements; - int ret = 0; - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s unable to get %s to compute size", a->name, self->numberOfBits); - return 0; - } - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, &numberOfElements); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s unable to get %s to compute size", a->name, self->numberOfElements); - return 0; - } - - return (numberOfBits * numberOfElements + 7) / 8; -} - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_signed_bits* self = (grib_accessor_signed_bits*)a; - int n = 0; - self->numberOfBits = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->numberOfElements = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - a->length = compute_byte_count(a); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -#if 0 - grib_accessor_signed_bits* self = (grib_accessor_signed_bits*)a; - int i; - int ret = 0; - long pos = a->offset * 8; - long rlen = 0; - long numberOfBits = 0; - - ret = value_count(a, &rlen); - if (ret) - return ret; - - if (*len < rlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Wrong size (%ld) for %s it contains %ld values", *len, a->name, rlen); - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); - if (ret) - return ret; - - if (numberOfBits == 0) { - for (i = 0; i < rlen; i++) - val[i] = 0; - return GRIB_SUCCESS; - } - - for (i = 0; i < rlen; i++) - val[i] = grib_decode_signed_longb(grib_handle_of_accessor(a)->buffer->data, &pos, numberOfBits); - - *len = rlen; - - return GRIB_SUCCESS; -#endif -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -#if 0 - grib_accessor_signed_bits* self = (grib_accessor_signed_bits*)a; - int ret = 0; - long off = 0; - long numberOfBits = 0; - size_t buflen = 0; - unsigned char* buf = NULL; - unsigned long i = 0; - unsigned long rlen = 0; - long count = 0; - - ret = value_count(a, &count); - if (ret) - return ret; - rlen = count; - if (*len != rlen) { - ret = grib_set_long(grib_handle_of_accessor(a), self->numberOfElements, rlen); - if (ret) - return ret; - } - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); - if (ret) - return ret; - - buflen = compute_byte_count(a); - buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen + sizeof(long)); - - for (i = 0; i < rlen; i++) - grib_encode_signed_longb(buf, val[i], &off, numberOfBits); - - grib_buffer_replace(a, buf, buflen, 1, 1); - - grib_context_free(a->context, buf); - - return ret; -#endif -} - -static int value_count(grib_accessor* a, long* numberOfElements) -{ - grib_accessor_signed_bits* self = (grib_accessor_signed_bits*)a; - *numberOfElements = 0; - - return grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, numberOfElements); -} - -static long byte_offset(grib_accessor* a) -{ - return a->offset; -} - -static void update_size(grib_accessor* a, size_t s) -{ - a->length = s; -} - -static long next_offset(grib_accessor* a) -{ - return byte_offset(a) + byte_count(a); -} diff --git a/src/grib_accessor_class_simple_packing_error.cc b/src/grib_accessor_class_simple_packing_error.cc deleted file mode 100644 index 64f96eeea..000000000 --- a/src/grib_accessor_class_simple_packing_error.cc +++ /dev/null @@ -1,163 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_scaling.h" -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_double - IMPLEMENTS = init - MEMBERS=const char* binaryScaleFactor - MEMBERS=const char* bitsPerValue - MEMBERS=const char* decimalScaleFactor - MEMBERS=const char* referenceValue - MEMBERS=const char* floatType - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_simple_packing_error -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in simple_packing_error */ - const char* binaryScaleFactor; - const char* bitsPerValue; - const char* decimalScaleFactor; - const char* referenceValue; - const char* floatType; -} grib_accessor_simple_packing_error; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_simple_packing_error = { - &grib_accessor_class_double, /* super */ - "simple_packing_error", /* name */ - sizeof(grib_accessor_simple_packing_error), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_simple_packing_error = &_grib_accessor_class_simple_packing_error; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_simple_packing_error* self = (grib_accessor_simple_packing_error*)a; - int n = 0; - grib_handle* h = grib_handle_of_accessor(a); - - self->bitsPerValue = grib_arguments_get_name(h, c, n++); - self->binaryScaleFactor = grib_arguments_get_name(h, c, n++); - self->decimalScaleFactor = grib_arguments_get_name(h, c, n++); - self->referenceValue = grib_arguments_get_name(h, c, n++); - self->floatType = grib_arguments_get_name(h, c, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_simple_packing_error* self = (grib_accessor_simple_packing_error*)a; - - int ret = 0; - long binaryScaleFactor = 0; - long bitsPerValue = 0; - long decimalScaleFactor = 0; - double referenceValue = 0; - grib_handle* h = grib_handle_of_accessor(a); - - if ((ret = grib_get_long_internal(h, self->binaryScaleFactor, &binaryScaleFactor)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(h, self->bitsPerValue, &bitsPerValue)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(h, self->decimalScaleFactor, &decimalScaleFactor)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_double_internal(h, self->referenceValue, &referenceValue)) != GRIB_SUCCESS) - return ret; - - if (!strcmp(self->floatType, "ibm")) - *val = grib_ibmfloat_error(referenceValue); - else if (!strcmp(self->floatType, "ieee")) - *val = grib_ieeefloat_error(referenceValue); - else - Assert(1 == 0); - - if (bitsPerValue != 0) - *val = (*val + codes_power(binaryScaleFactor, 2)) * codes_power(-decimalScaleFactor, 10) * 0.5; - - if (ret == GRIB_SUCCESS) - *len = 1; - - return ret; -} diff --git a/src/grib_accessor_class_size.cc b/src/grib_accessor_class_size.cc deleted file mode 100644 index 410cec3c3..000000000 --- a/src/grib_accessor_class_size.cc +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS = const char* accessor - END_CLASS_DEF - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_size -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in size */ - const char* accessor; -} grib_accessor_size; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_size = { - &grib_accessor_class_long, /* super */ - "size", /* name */ - sizeof(grib_accessor_size), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_size = &_grib_accessor_class_size; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_size* self = (grib_accessor_size*)a; - self->accessor = grib_arguments_get_name(grib_handle_of_accessor(a), c, 0); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - int ret = 0; - size_t size = 0; - grib_accessor_size* self = (grib_accessor_size*)a; - ret = grib_get_size(grib_handle_of_accessor(a), self->accessor, &size); - *val = (long)size; - *len = 1; - return ret; -} diff --git a/src/grib_accessor_class_smart_table_column.cc b/src/grib_accessor_class_smart_table_column.cc deleted file mode 100644 index 295f29281..000000000 --- a/src/grib_accessor_class_smart_table_column.cc +++ /dev/null @@ -1,294 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;dump;unpack_string_array;unpack_long - IMPLEMENTS = value_count; destroy; get_native_type; - MEMBERS = const char* smartTable - MEMBERS = int index - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string_array(grib_accessor*, char**, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_smart_table_column -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in smart_table_column */ - const char* smartTable; - int index; -} grib_accessor_smart_table_column; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_smart_table_column = { - &grib_accessor_class_gen, /* super */ - "smart_table_column", /* name */ - sizeof(grib_accessor_smart_table_column), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - &unpack_string_array, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_smart_table_column = &_grib_accessor_class_smart_table_column; - -/* END_CLASS_IMP */ - -typedef struct grib_accessor_smart_table -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned */ - long nbytes; - grib_arguments* arg; - /* Members defined in smart_table */ - const char* values; - const char* tablename; - const char* masterDir; - const char* localDir; - const char* extraDir; - const char* extraTable; - int widthOfCode; - long* tableCodes; - size_t tableCodesSize; - grib_smart_table* table; - int dirty; -} grib_accessor_smart_table; - -static void init(grib_accessor* a, const long len, grib_arguments* params) -{ - int n = 0; - grib_accessor_smart_table_column* self = (grib_accessor_smart_table_column*)a; - - self->smartTable = grib_arguments_get_name(grib_handle_of_accessor(a), params, n++); - self->index = grib_arguments_get_long(grib_handle_of_accessor(a), params, n++); - - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - int type = get_native_type(a); - - switch (type) { - case GRIB_TYPE_LONG: - grib_dump_long(dumper, a, NULL); - break; - case GRIB_TYPE_STRING: - grib_dump_string_array(dumper, a, NULL); - break; - } -} - -static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) -{ - grib_accessor_smart_table_column* self = (grib_accessor_smart_table_column*)a; - grib_accessor_smart_table* tableAccessor = NULL; - grib_smart_table* table = NULL; - - size_t size = 1; - long* code; - int err = GRIB_SUCCESS; - char tmp[1024] = {0,}; - int i = 0; - - tableAccessor = (grib_accessor_smart_table*)grib_find_accessor(grib_handle_of_accessor(a), self->smartTable); - if (!tableAccessor) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Unable to find accessor %s", self->smartTable); - return GRIB_NOT_FOUND; - } - - err = grib_get_size_acc(grib_handle_of_accessor(a), (grib_accessor*)tableAccessor, &size); - if (err) - return err; - if (*len < size) { - return GRIB_BUFFER_TOO_SMALL; - } - - code = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - if (!code) { - grib_context_log(a->context, GRIB_LOG_FATAL, "%s: Memory allocation error: %zu bytes", a->name, size); - return GRIB_OUT_OF_MEMORY; - } - - if ((err = grib_unpack_long((grib_accessor*)tableAccessor, code, &size)) != GRIB_SUCCESS) - return err; - - table = tableAccessor->table; - - for (i = 0; i < size; i++) { - if (table && (code[i] >= 0) && - (code[i] < table->numberOfEntries) && - table->entries[code[i]].column[self->index]) { - strcpy(tmp, table->entries[code[i]].column[self->index]); - } - else { - snprintf(tmp, sizeof(tmp), "%d", (int)code[i]); - } - - buffer[i] = grib_context_strdup(a->context, tmp); - } - *len = size; - grib_context_free(a->context, code); - - return GRIB_SUCCESS; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_smart_table_column* self = (grib_accessor_smart_table_column*)a; - grib_accessor_smart_table* tableAccessor = NULL; - grib_smart_table* table = NULL; - - size_t size = 1; - long* code; - int err = GRIB_SUCCESS; - int i = 0; - - for (i = 0; i < *len; i++) - val[i] = GRIB_MISSING_LONG; - - tableAccessor = (grib_accessor_smart_table*)grib_find_accessor(grib_handle_of_accessor(a), self->smartTable); - if (!tableAccessor) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Unable to find accessor %s", self->smartTable); - return GRIB_NOT_FOUND; - } - - err = grib_get_size_acc(grib_handle_of_accessor(a), (grib_accessor*)tableAccessor, &size); - if (err) - return err; - if (*len < size) { - return GRIB_BUFFER_TOO_SMALL; - } - - code = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - if (!code) return GRIB_OUT_OF_MEMORY; - - if ((err = grib_unpack_long((grib_accessor*)tableAccessor, code, &size)) != GRIB_SUCCESS) { - grib_context_free(a->context, code); - return err; - } - - table = tableAccessor->table; - - for (i = 0; i < size; i++) { - if (table && (code[i] >= 0) && - (code[i] < table->numberOfEntries) && - table->entries[code[i]].column[self->index]) { - val[i] = atol(table->entries[code[i]].column[self->index]); - } - } - *len = size; - grib_context_free(a->context, code); - - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_smart_table_column* self = (grib_accessor_smart_table_column*)a; - size_t size = 0; - int err = 0; - *count = 0; - - if (!self->smartTable) - return 0; - - err = grib_get_size(grib_handle_of_accessor(a), self->smartTable, &size); - *count = size; - return err; -} - -static void destroy(grib_context* context, grib_accessor* a) -{ - if (a->vvalue != NULL) { - grib_context_free(context, a->vvalue); - a->vvalue = NULL; - } -} - -static int get_native_type(grib_accessor* a) -{ - int type = GRIB_TYPE_LONG; - /*printf("---------- %s flags=%ld GRIB_ACCESSOR_FLAG_STRING_TYPE=%d\n", - a->name,a->flags,GRIB_ACCESSOR_FLAG_STRING_TYPE);*/ - if (a->flags & GRIB_ACCESSOR_FLAG_STRING_TYPE) - type = GRIB_TYPE_STRING; - return type; -} diff --git a/src/grib_accessor_class_spd.cc b/src/grib_accessor_class_spd.cc deleted file mode 100644 index e0f4a20a7..000000000 --- a/src/grib_accessor_class_spd.cc +++ /dev/null @@ -1,264 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init - IMPLEMENTS = next_offset - IMPLEMENTS = byte_count - IMPLEMENTS = value_count - IMPLEMENTS = byte_offset - IMPLEMENTS = update_size - MEMBERS = const char* numberOfBits - MEMBERS = const char* numberOfElements - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); - -typedef struct grib_accessor_spd -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in spd */ - const char* numberOfBits; - const char* numberOfElements; -} grib_accessor_spd; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_spd = { - &grib_accessor_class_long, /* super */ - "spd", /* name */ - sizeof(grib_accessor_spd), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_spd = &_grib_accessor_class_spd; - -/* END_CLASS_IMP */ - -static long byte_count(grib_accessor* a) -{ - return a->length; -} - -static long compute_byte_count(grib_accessor* a) -{ - grib_accessor_spd* self = (grib_accessor_spd*)a; - long numberOfBits; - long numberOfElements; - int ret = 0; - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s unable to get %s to compute size", a->name, self->numberOfBits); - return 0; - } - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, &numberOfElements); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s unable to get %s to compute size", a->name, self->numberOfElements); - return 0; - } - numberOfElements++; - - return (numberOfBits * numberOfElements + 7) / 8; -} - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_spd* self = (grib_accessor_spd*)a; - int n = 0; - self->numberOfBits = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->numberOfElements = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - a->length = compute_byte_count(a); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_spd* self = (grib_accessor_spd*)a; - int i; - int ret = 0; - long pos = a->offset * 8; - long rlen = 0; - long numberOfBits = 0; - - ret = value_count(a, &rlen); - if (ret) - return ret; - - if (*len < rlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Wrong size (%zu) for %s, it contains %ld values", *len, a->name, rlen); - *len = rlen; - return GRIB_ARRAY_TOO_SMALL; - } - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); - if (ret) - return ret; - if (numberOfBits > 64) { - grib_context_log(a->context, GRIB_LOG_ERROR,"Invalid number of bits: %ld",numberOfBits); - return GRIB_DECODING_ERROR; - } - - for (i = 0; i < rlen - 1; i++) - val[i] = grib_decode_unsigned_long(grib_handle_of_accessor(a)->buffer->data, &pos, numberOfBits); - - val[rlen - 1] = grib_decode_signed_longb(grib_handle_of_accessor(a)->buffer->data, &pos, numberOfBits); - - *len = rlen; - - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_spd* self = (grib_accessor_spd*)a; - int ret = 0; - long off = 0; - long numberOfBits = 0; - size_t buflen = 0; - unsigned char* buf = NULL; - unsigned long i = 0; - long rlen = 0; - - ret = value_count(a, &rlen); - if (ret) - return ret; - - if (*len != rlen) { - ret = grib_set_long(grib_handle_of_accessor(a), self->numberOfElements, (*len) - 1); - if (ret) return ret; - } - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); - if (ret) - return ret; - - buflen = compute_byte_count(a); - buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen); - - for (i = 0; i < rlen - 1; i++) { - grib_encode_unsigned_longb(buf, val[i], &off, numberOfBits); - } - - grib_encode_signed_longb(buf, val[rlen - 1], &off, numberOfBits); - - grib_buffer_replace(a, buf, buflen, 1, 1); - - grib_context_free(a->context, buf); - - *len = rlen; - return ret; -} - -static int value_count(grib_accessor* a, long* numberOfElements) -{ - grib_accessor_spd* self = (grib_accessor_spd*)a; - int ret; - *numberOfElements = 0; - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, numberOfElements); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s unable to get %s to compute size", a->name, self->numberOfElements); - return ret; - } - (*numberOfElements)++; - - return ret; -} - -static long byte_offset(grib_accessor* a) -{ - return a->offset; -} - -static void update_size(grib_accessor* a, size_t s) -{ - a->length = s; -} - -static long next_offset(grib_accessor* a) -{ - return byte_offset(a) + a->length; -} diff --git a/src/grib_accessor_class_spectral_truncation.cc b/src/grib_accessor_class_spectral_truncation.cc deleted file mode 100644 index 6cc902fa7..000000000 --- a/src/grib_accessor_class_spectral_truncation.cc +++ /dev/null @@ -1,177 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS=const char* J - MEMBERS=const char* K - MEMBERS=const char* M - MEMBERS=const char* T - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_spectral_truncation -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in spectral_truncation */ - const char* J; - const char* K; - const char* M; - const char* T; -} grib_accessor_spectral_truncation; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_spectral_truncation = { - &grib_accessor_class_long, /* super */ - "spectral_truncation", /* name */ - sizeof(grib_accessor_spectral_truncation), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_spectral_truncation = &_grib_accessor_class_spectral_truncation; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_spectral_truncation* self = (grib_accessor_spectral_truncation*)a; - int n = 0; - - self->J = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->K = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->M = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->T = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_spectral_truncation* self = (grib_accessor_spectral_truncation*)a; - int ret = 0; - - long J, K, M, T, Tc; - - if (*len < 1) - return GRIB_ARRAY_TOO_SMALL; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->J, &J)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->K, &K)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->M, &M)) != GRIB_SUCCESS) - return ret; - - Tc = -1; - if (J == K && K == M) { - /* Triangular truncation */ - Tc = (M + 1) * (M + 2); - } - if (K == J + M) { - /* Rhomboidal truncation */ - Tc = 2 * J * M; - } - if (J == K && K > M) { - /* Trapezoidal truncation */ - Tc = M * (2 * J - M); - } - *val = Tc; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->T, &T)) != GRIB_SUCCESS) { - if (Tc == -1) - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s. Spectral Truncation Type Unknown: %s=%ld %s=%ld %s=%ld", - a->name, self->J, J, self->K, K, self->M, M); - Tc = 0; - grib_set_long(grib_handle_of_accessor(a), self->T, Tc); - } - else { - if (Tc != -1 && Tc != T) - grib_set_long(grib_handle_of_accessor(a), self->T, Tc); - } - - if (ret == GRIB_SUCCESS) - *len = 1; - - return ret; -} diff --git a/src/grib_accessor_class_statistics_spectral.cc b/src/grib_accessor_class_statistics_spectral.cc deleted file mode 100644 index 435582bef..000000000 --- a/src/grib_accessor_class_statistics_spectral.cc +++ /dev/null @@ -1,277 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_abstract_vector - IMPLEMENTS = unpack_double; destroy - IMPLEMENTS = value_count;compare - IMPLEMENTS = init - MEMBERS = const char* values - MEMBERS = const char* J - MEMBERS = const char* K - MEMBERS = const char* M - MEMBERS = const char* JS - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_statistics_spectral -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in abstract_vector */ - double* v; - int number_of_elements; - /* Members defined in statistics_spectral */ - const char* values; - const char* J; - const char* K; - const char* M; - const char* JS; -} grib_accessor_statistics_spectral; - -extern grib_accessor_class* grib_accessor_class_abstract_vector; - -static grib_accessor_class _grib_accessor_class_statistics_spectral = { - &grib_accessor_class_abstract_vector, /* super */ - "statistics_spectral", /* name */ - sizeof(grib_accessor_statistics_spectral), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_statistics_spectral = &_grib_accessor_class_statistics_spectral; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_statistics_spectral* self = (grib_accessor_statistics_spectral*)a; - int n = 0; - - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->J = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->K = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->M = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->JS = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - - self->number_of_elements = 4; - self->v = (double*)grib_context_malloc(a->context, - sizeof(double) * self->number_of_elements); - - a->length = 0; - a->dirty = 1; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_statistics_spectral* self = (grib_accessor_statistics_spectral*)a; - int ret = 0, i = 0; - double* values; - size_t size = 0; - long J, K, M, N; - double avg, enorm, sd; - grib_context* c = a->context; - grib_handle* h = grib_handle_of_accessor(a); - - if (!a->dirty) - return GRIB_SUCCESS; - - if (*len != self->number_of_elements) - return GRIB_ARRAY_TOO_SMALL; - - if ((ret = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long(grib_handle_of_accessor(a), self->J, &J)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long(grib_handle_of_accessor(a), self->K, &K)) != GRIB_SUCCESS) - return ret; - - if ((ret = grib_get_long(grib_handle_of_accessor(a), self->M, &M)) != GRIB_SUCCESS) - return ret; - - if (J != M || M != K) - return GRIB_NOT_IMPLEMENTED; - - N = (M + 1) * (M + 2) / 2; - - if (2 * N != size) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "wrong number of components for spherical harmonics %ld != %ld", 2 * N, size); - return GRIB_WRONG_ARRAY_SIZE; - } - - values = (double*)grib_context_malloc(c, size * sizeof(double)); - if (!values) - return GRIB_OUT_OF_MEMORY; - - if ((ret = grib_get_double_array_internal(h, self->values, values, &size)) != GRIB_SUCCESS) { - grib_context_free(c, values); - return ret; - } - - avg = values[0]; - sd = 0; - - for (i = 2; i < 2 * J; i += 2) - sd += values[i] * values[i]; - - for (i = 2 * J; i < size; i += 2) - sd += 2 * values[i] * values[i] + 2 * values[i + 1] * values[i + 1]; - - enorm = sd + avg * avg; - - sd = sqrt(sd); - enorm = sqrt(enorm); - - a->dirty = 0; - - grib_context_free(c, values); - - self->v[0] = avg; - self->v[1] = enorm; - self->v[2] = sd; - self->v[3] = sd == 0 ? 1 : 0; - - for (i = 0; i < self->number_of_elements; i++) - val[i] = self->v[i]; - - return ret; -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_statistics_spectral* self = (grib_accessor_statistics_spectral*)a; - *count = self->number_of_elements; - return 0; -} - -static void destroy(grib_context* c, grib_accessor* a) -{ - grib_accessor_statistics_spectral* self = (grib_accessor_statistics_spectral*)a; - grib_context_free(c, self->v); -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - int retval = GRIB_SUCCESS; - double* aval = 0; - double* bval = 0; - - size_t alen = 0; - size_t blen = 0; - int err = 0; - long count = 0; - - err = grib_value_count(a, &count); - if (err) - return err; - alen = count; - - err = grib_value_count(b, &count); - if (err) - return err; - blen = count; - - if (alen != blen) - return GRIB_COUNT_MISMATCH; - - aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); - bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); - - b->dirty = 1; - a->dirty = 1; - - grib_unpack_double(a, aval, &alen); - grib_unpack_double(b, bval, &blen); - - retval = GRIB_SUCCESS; - for (size_t i=0; icontext, aval); - grib_context_free(b->context, bval); - - return retval; -} diff --git a/src/grib_accessor_class_step_human_readable.cc b/src/grib_accessor_class_step_human_readable.cc deleted file mode 100644 index 557a58185..000000000 --- a/src/grib_accessor_class_step_human_readable.cc +++ /dev/null @@ -1,169 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -#include "step.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;unpack_string; get_native_type - MEMBERS = const char* stepUnits - MEMBERS = const char* step - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_step_human_readable -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in step_human_readable */ - const char* stepUnits; - const char* step; -} grib_accessor_step_human_readable; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_step_human_readable = { - &grib_accessor_class_gen, /* super */ - "step_human_readable", /* name */ - sizeof(grib_accessor_step_human_readable), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_step_human_readable = &_grib_accessor_class_step_human_readable; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* params) -{ - grib_accessor_step_human_readable* self = (grib_accessor_step_human_readable*)a; - int n = 0; - grib_handle* h = grib_handle_of_accessor(a); - - self->stepUnits = grib_arguments_get_name(h, params, n++); - self->step = grib_arguments_get_name(h, params, n++); - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -static int get_step_human_readable(grib_handle* h, char* result, size_t* length) -{ - int err = 0; - size_t slen = 2; - long step, hour, minute, second; - - /* Change units to seconds (highest resolution) - * before computing the step value - */ - if ((err = grib_set_string(h, "stepUnits", "s", &slen)) != GRIB_SUCCESS) - return err; - if ((err = grib_get_long(h, "step", &step)) != GRIB_SUCCESS) - return err; - - hour = step/3600; - minute = step/60 % 60; - second = step % 60; - /* sprintf(result, "%ld:%ld:%ld", hour, minute, second); */ - - if (second) { - snprintf(result, 1024, "%ldh %ldm %lds", hour, minute, second); - } else { - if (minute) snprintf(result, 1024, "%ldh %ldm", hour, minute); - else snprintf(result, 1024, "%ldh", hour); - } - - *length = strlen(result); - return GRIB_SUCCESS; -} - -static int unpack_string(grib_accessor* a, char* buffer, size_t* len) -{ - grib_accessor_step_human_readable* self = (grib_accessor_step_human_readable*)a; - grib_handle* h = grib_handle_of_accessor(a); - long stepUnits; - int err = 0; - - /* Save the current value of stepUnits */ - err = grib_get_long_internal(h, self->stepUnits, &stepUnits); - if (err) return err; - - /* This will change stepUnits to seconds for its calculation */ - err = get_step_human_readable(h, buffer, len); - - /* Restore stepUnits */ - grib_set_long(h, self->stepUnits, stepUnits); - return err; -} diff --git a/src/grib_accessor_class_sum.cc b/src/grib_accessor_class_sum.cc deleted file mode 100644 index 4d964fc0c..000000000 --- a/src/grib_accessor_class_sum.cc +++ /dev/null @@ -1,203 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_double - IMPLEMENTS = unpack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = value_count - IMPLEMENTS = init - MEMBERS=const char* values - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_sum -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in sum */ - const char* values; -} grib_accessor_sum; - -extern grib_accessor_class* grib_accessor_class_double; - -static grib_accessor_class _grib_accessor_class_sum = { - &grib_accessor_class_double, /* super */ - "sum", /* name */ - sizeof(grib_accessor_sum), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_sum = &_grib_accessor_class_sum; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_sum* self = (grib_accessor_sum*)a; - int n = 0; - self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_sum* self = (grib_accessor_sum*)a; - int ret = 0; - size_t size = 0; - long* values = 0; - long i; - long count = 0; - - ret = value_count(a, &count); - if (ret) - return ret; - size = count; - - if (size == 0) { - *val = 0; - return GRIB_SUCCESS; - } - values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - if (!values) - return GRIB_OUT_OF_MEMORY; - - grib_get_long_array(grib_handle_of_accessor(a), self->values, values, &size); - - *val = 0; - for (i = 0; i < size; i++) - *val += values[i]; - - grib_context_free(a->context, values); - - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_sum* self = (grib_accessor_sum*)a; - int ret = 0; - size_t size = 0; - double* values = 0; - long i; - long count = 0; - - ret = value_count(a, &count); - if (ret) - return ret; - size = count; - - if (size == 0) { - *val = 0; - return GRIB_SUCCESS; - } - values = (double*)grib_context_malloc_clear(a->context, sizeof(double) * size); - if (!values) - return GRIB_OUT_OF_MEMORY; - - ret = grib_get_double_array(grib_handle_of_accessor(a), self->values, values, &size); - if (ret) { - grib_context_free(a->context, values); - return ret; - } - *val = 0; - for (i = 0; i < size; i++) - *val += values[i]; - - grib_context_free(a->context, values); - - return GRIB_SUCCESS; -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_sum* self = (grib_accessor_sum*)a; - size_t n = 0; - int ret = 0; - - ret = grib_get_size(grib_handle_of_accessor(a), self->values, &n); - *count = n; - - if (ret) - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s is unable to get size of %s", a->name, self->values); - - return ret; -} diff --git a/src/grib_accessor_class_suppressed.cc b/src/grib_accessor_class_suppressed.cc deleted file mode 100644 index a95269c5d..000000000 --- a/src/grib_accessor_class_suppressed.cc +++ /dev/null @@ -1,162 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = value_count;get_native_type - IMPLEMENTS = unpack_string - IMPLEMENTS = unpack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = init - MEMBERS= grib_arguments* args - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_suppressed -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in suppressed */ - grib_arguments* args; -} grib_accessor_suppressed; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_suppressed = { - &grib_accessor_class_long, /* super */ - "suppressed", /* name */ - sizeof(grib_accessor_suppressed), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_suppressed = &_grib_accessor_class_suppressed; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_suppressed* self = (grib_accessor_suppressed*)a; - self->args = c; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static void log_message(grib_accessor* a) -{ - grib_accessor_suppressed* self = (grib_accessor_suppressed*)a; - int i = 0; - grib_handle* hand = grib_handle_of_accessor(a); - - grib_context_log(a->context, GRIB_LOG_ERROR, - "key '%s' is unavailable in this version.", a->name); - grib_context_log(a->context, GRIB_LOG_ERROR, - "Please use the following key(s):"); - while (grib_arguments_get_name(hand, self->args, i)) { - grib_context_log(a->context, GRIB_LOG_ERROR, "\t- %s", - grib_arguments_get_name(hand, self->args, i)); - i++; - } -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - log_message(a); - return GRIB_NOT_FOUND; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - log_message(a); - return GRIB_NOT_FOUND; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - log_message(a); - return GRIB_NOT_FOUND; -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} diff --git a/src/grib_accessor_class_time.cc b/src/grib_accessor_class_time.cc deleted file mode 100644 index 3251fdd33..000000000 --- a/src/grib_accessor_class_time.cc +++ /dev/null @@ -1,208 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = unpack_string - IMPLEMENTS = init - MEMBERS=const char* hour - MEMBERS=const char* minute - MEMBERS=const char* second - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_time -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in time */ - const char* hour; - const char* minute; - const char* second; -} grib_accessor_time; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_time = { - &grib_accessor_class_long, /* super */ - "time", /* name */ - sizeof(grib_accessor_time), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_time = &_grib_accessor_class_time; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_time* self = (grib_accessor_time*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int n = 0; - - self->hour = grib_arguments_get_name(hand, c, n++); - self->minute = grib_arguments_get_name(hand, c, n++); - self->second = grib_arguments_get_name(hand, c, n++); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - const grib_accessor_time* self = (grib_accessor_time*)a; - - int ret = 0; - long hour = 0, minute = 0, second = 0; - grib_handle* hand = grib_handle_of_accessor(a); - - if ((ret = grib_get_long_internal(hand, self->hour, &hour)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(hand, self->minute, &minute)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(hand, self->second, &second)) != GRIB_SUCCESS) - return ret; - - /* We ignore the 'seconds' in our time calculation! */ - if (second != 0) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Key %s (%s): Truncating time: non-zero seconds(%ld) ignored", a->name, __func__, second); - } - - if (*len < 1) - return GRIB_WRONG_ARRAY_SIZE; - - *val = hour * 100 + minute; - - if (hour == 255) { - *val = 12 * 100; - } - if (hour != 255 && minute == 255) { - *val = hour * 100; - } - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - const grib_accessor_time* self = (grib_accessor_time*)a; - - int ret = 0; - long v = val[0]; - grib_handle* hand = grib_handle_of_accessor(a); - long hour = 0, minute = 0, second = 0; - - if (*len != 1) - return GRIB_WRONG_ARRAY_SIZE; - - if (!is_time_valid(v)) { - // ECC-1777: For now just a warning. Will later change to an error - fprintf(stderr, "ECCODES WARNING : %s:%s: Time is not valid! hour=%ld min=%ld sec=%ld\n", - a->cclass->name, __func__, hour, minute, second); - // return GRIB_ENCODING_ERROR; - } - - hour = v / 100; - minute = v % 100; - second = 0; /* We ignore the 'seconds' in our time calculation! */ - - if ((ret = grib_set_long_internal(hand, self->hour, hour)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_set_long_internal(hand, self->minute, minute)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_set_long_internal(hand, self->second, second)) != GRIB_SUCCESS) - return ret; - - return GRIB_SUCCESS; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - long v = 0; - size_t lsize = 1, lmin = 5; - - unpack_long(a, &v, &lsize); - - if (*len < lmin) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - a->cclass->name, a->name, lmin, *len); - *len = lmin; - return GRIB_BUFFER_TOO_SMALL; - } - - snprintf(val, 64, "%04ld", v); - - len[0] = lmin; - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_to_double.cc b/src/grib_accessor_class_to_double.cc deleted file mode 100644 index 69b06add9..000000000 --- a/src/grib_accessor_class_to_double.cc +++ /dev/null @@ -1,241 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_string - IMPLEMENTS = unpack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = init;dump;string_length - IMPLEMENTS = value_count - IMPLEMENTS = next_offset - IMPLEMENTS = get_native_type - MEMBERS = const char* key - MEMBERS = long start - MEMBERS = size_t length - MEMBERS = long scale - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_to_double -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in to_double */ - const char* key; - long start; - size_t length; - long scale; -} grib_accessor_to_double; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_to_double = { - &grib_accessor_class_gen, /* super */ - "to_double", /* name */ - sizeof(grib_accessor_to_double), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_to_double = &_grib_accessor_class_to_double; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_to_double* self = (grib_accessor_to_double*)a; - - self->key = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 0); - self->start = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 1); - self->length = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 2); - self->scale = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 3); - if (!self->scale) - self->scale = 1; - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_to_double* self = (grib_accessor_to_double*)a; - size_t size = 0; - - int err = grib_get_size(grib_handle_of_accessor(a), self->key, &size); - *count = size; - - return err; -} - -static size_t string_length(grib_accessor* a) -{ - grib_accessor_to_double* self = (grib_accessor_to_double*)a; - size_t size = 0; - - if (self->length) - return self->length; - - grib_get_string_length_acc(a, &size); - return size; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string(dumper, a, NULL); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_to_double* self = (grib_accessor_to_double*)a; - - int err = 0; - char buff[512] = {0,}; - size_t size = 512; - size_t length = string_length(a); - - if (*len < length + 1) { - grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values", - *len, a->name, a->length + 1); - *len = length + 1; - return GRIB_ARRAY_TOO_SMALL; - } - - err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size); - if (err) - return err; - if (length > size) { - err = GRIB_STRING_TOO_SMALL; - length = size; - } - - memcpy(val, buff + self->start, length); - - val[length] = 0; - *len = length; - return err; -} - -static int unpack_long(grib_accessor* a, long* v, size_t* len) -{ - grib_accessor_to_double* self = (grib_accessor_to_double*)a; - char val[1024] = {0,}; - size_t l = sizeof(val); - char* last = NULL; - int err = grib_unpack_string(a, val, &l); - - if (err) - return err; - - *v = strtol(val, &last, 10); - if (*last) { - err = GRIB_WRONG_CONVERSION; - } - *v /= self->scale; - - return err; -} - -static int unpack_double(grib_accessor* a, double* v, size_t* len) -{ - grib_accessor_to_double* self = (grib_accessor_to_double*)a; - char val[1024] = {0,}; - size_t l = sizeof(val); - char* last = NULL; - int err = grib_unpack_string(a, val, &l); - - if (err) - return err; - - *v = strtod(val, &last); - if (*last) { - err = GRIB_WRONG_CONVERSION; - } - *v /= self->scale; - - return err; -} - -static long next_offset(grib_accessor* a) -{ - return a->offset + a->length; -} diff --git a/src/grib_accessor_class_to_integer.cc b/src/grib_accessor_class_to_integer.cc deleted file mode 100644 index 76ce1205d..000000000 --- a/src/grib_accessor_class_to_integer.cc +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = init;dump;string_length - IMPLEMENTS = value_count - IMPLEMENTS = next_offset - IMPLEMENTS = get_native_type - MEMBERS = const char* key - MEMBERS = long start - MEMBERS = size_t length - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_to_integer -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in to_integer */ - const char* key; - long start; - size_t length; -} grib_accessor_to_integer; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_to_integer = { - &grib_accessor_class_gen, /* super */ - "to_integer", /* name */ - sizeof(grib_accessor_to_integer), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_to_integer = &_grib_accessor_class_to_integer; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_to_integer* self = (grib_accessor_to_integer*)a; - - self->key = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 0); - self->start = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 1); - self->length = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 2); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_to_integer* self = (grib_accessor_to_integer*)a; - size_t size = 0; - - int err = grib_get_size(grib_handle_of_accessor(a), self->key, &size); - *count = size; - - return err; -} - -static size_t string_length(grib_accessor* a) -{ - grib_accessor_to_integer* self = (grib_accessor_to_integer*)a; - size_t size = 0; - - if (self->length) - return self->length; - - grib_get_string_length(grib_handle_of_accessor(a), self->key, &size); - return size; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_long(dumper, a, NULL); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_to_integer* self = (grib_accessor_to_integer*)a; - - int err = 0; - char buff[512] = {0,}; - size_t size = 512; - - size_t length = string_length(a); - - if (*len < length + 1) { - const char* cclass_name = a->cclass->name; - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, length+1, *len); - *len = length + 1; - return GRIB_BUFFER_TOO_SMALL; - } - - err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size); - if (err) - return err; - if (length > size) { - /*err=GRIB_STRING_TOO_SMALL;*/ - length = size; - } - - memcpy(val, buff + self->start, length); - - val[length] = 0; - *len = length; - return GRIB_SUCCESS; -} - -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - return GRIB_NOT_IMPLEMENTED; -} - -static int pack_long(grib_accessor* a, const long* v, size_t* len) -{ - grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as an integer", a->name); - return GRIB_NOT_IMPLEMENTED; -} - -static int pack_double(grib_accessor* a, const double* v, size_t* len) -{ - grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as a double", a->name); - return GRIB_NOT_IMPLEMENTED; -} - -static int unpack_long(grib_accessor* a, long* v, size_t* len) -{ - char val[1024] = {0,}; - size_t l = sizeof(val); - char* last = NULL; - int err = unpack_string(a, val, &l); - - if (err) - return err; - - *v = strtol(val, &last, 10); - /* if (*last) {err=GRIB_WRONG_CONVERSION;} */ - - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* v, size_t* len) -{ - size_t l = 1; - long val = 0; - int err = unpack_long(a, &val, &l); - - *v = (double)val; - return err; -} - -static long next_offset(grib_accessor* a) -{ - return a->offset + a->length; -} diff --git a/src/grib_accessor_class_to_string.cc b/src/grib_accessor_class_to_string.cc deleted file mode 100644 index 648edd1aa..000000000 --- a/src/grib_accessor_class_to_string.cc +++ /dev/null @@ -1,227 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_string - IMPLEMENTS = unpack_long - IMPLEMENTS = unpack_double - IMPLEMENTS = init;dump;string_length - IMPLEMENTS = value_count - IMPLEMENTS = next_offset - IMPLEMENTS = get_native_type - MEMBERS = const char* key - MEMBERS = long start - MEMBERS = size_t length - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_to_string -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in to_string */ - const char* key; - long start; - size_t length; -} grib_accessor_to_string; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_to_string = { - &grib_accessor_class_gen, /* super */ - "to_string", /* name */ - sizeof(grib_accessor_to_string), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - &string_length, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_to_string = &_grib_accessor_class_to_string; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - grib_accessor_to_string* self = (grib_accessor_to_string*)a; - - self->key = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 0); - self->start = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 1); - self->length = grib_arguments_get_long(grib_handle_of_accessor(a), arg, 2); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->length = 0; -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_to_string* self = (grib_accessor_to_string*)a; - size_t size = 0; - - int err = grib_get_size(grib_handle_of_accessor(a), self->key, &size); - *count = size; - - return err; -} - -static size_t string_length(grib_accessor* a) -{ - grib_accessor_to_string* self = (grib_accessor_to_string*)a; - - if (self->length) - return self->length; - - size_t size = 0; - grib_get_string_length(grib_handle_of_accessor(a), self->key, &size); - return size; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_string(dumper, a, NULL); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_STRING; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_to_string* self = (grib_accessor_to_string*)a; - - int err = 0; - char buff[512] = {0,}; - - size_t length = string_length(a); - - if (*len < length + 1) { - const char* cclass_name = a->cclass->name; - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, length+1, *len); - *len = length + 1; - return GRIB_BUFFER_TOO_SMALL; - } - - size_t size = sizeof(buff); - err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size); - if (err) - return err; - if (length > size) { - /*err=GRIB_STRING_TOO_SMALL;*/ - length = size; - } - - memcpy(val, buff + self->start, length); - - val[length] = 0; - *len = length; - return GRIB_SUCCESS; -} - -static int unpack_long(grib_accessor* a, long* v, size_t* len) -{ - char val[1024] = {0,}; - size_t l = sizeof(val); - char* last = NULL; - int err = unpack_string(a, val, &l); - - if (err) - return err; - - *v = strtol(val, &last, 10); - if (*last) { - err = GRIB_WRONG_CONVERSION; - } - - return err; -} - -static int unpack_double(grib_accessor* a, double* v, size_t* len) -{ - size_t l = 1; - long val = 0; - int err = unpack_long(a, &val, &l); - - *v = (double)val; - return err; -} - -static long next_offset(grib_accessor* a) -{ - return a->offset + a->length; -} diff --git a/src/grib_accessor_class_transient.cc b/src/grib_accessor_class_transient.cc deleted file mode 100644 index c51886c20..000000000 --- a/src/grib_accessor_class_transient.cc +++ /dev/null @@ -1,100 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_variable - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - - -typedef struct grib_accessor_transient -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in variable */ - double dval; - float fval; - char* cval; - char* cname; - int type; - /* Members defined in transient */ -} grib_accessor_transient; - -extern grib_accessor_class* grib_accessor_class_variable; - -static grib_accessor_class _grib_accessor_class_transient = { - &grib_accessor_class_variable, /* super */ - "transient", /* name */ - sizeof(grib_accessor_transient), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_transient = &_grib_accessor_class_transient; - -/* END_CLASS_IMP */ diff --git a/src/grib_accessor_class_transient_darray.cc b/src/grib_accessor_class_transient_darray.cc deleted file mode 100644 index 51dbc2433..000000000 --- a/src/grib_accessor_class_transient_darray.cc +++ /dev/null @@ -1,216 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_double;pack_double - IMPLEMENTS = unpack_long;pack_long;destroy - IMPLEMENTS = init;dump;value_count - IMPLEMENTS = get_native_type - MEMBERS=grib_darray* arr - MEMBERS=int type; - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_transient_darray -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in transient_darray */ - grib_darray* arr; - int type; -} grib_accessor_transient_darray; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_transient_darray = { - &grib_accessor_class_gen, /* super */ - "transient_darray", /* name */ - sizeof(grib_accessor_transient_darray), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_transient_darray = &_grib_accessor_class_transient_darray; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long length, grib_arguments* args) -{ - grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a; - self->arr = NULL; - self->type = GRIB_TYPE_DOUBLE; - a->length = 0; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_double(dumper, a, NULL); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a; - - if (self->arr) - grib_darray_delete(a->context, self->arr); - self->arr = grib_darray_new(a->context, *len, 10); - - for (size_t i = 0; i < *len; i++) - grib_darray_push(a->context, self->arr, val[i]); - - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a; - - if (self->arr) - grib_darray_delete(a->context, self->arr); - self->arr = grib_darray_new(a->context, *len, 10); - - for (size_t i = 0; i < *len; i++) - grib_darray_push(a->context, self->arr, (double)val[i]); - - return GRIB_SUCCESS; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a; - long count = 0; - - value_count(a, &count); - - if (*len < count) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s (setting %zu, required %ld)", a->name, *len, count); - *len = count; - return GRIB_ARRAY_TOO_SMALL; - } - - *len = count; - for (size_t i = 0; i < *len; i++) - val[i] = self->arr->v[i]; - - return GRIB_SUCCESS; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a; - long count = 0; - - value_count(a, &count); - - if (*len < count) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s (setting %zu, required %ld)", a->name, *len, count); - *len = count; - return GRIB_ARRAY_TOO_SMALL; - } - - *len = count; - for (size_t i = 0; i < *len; i++) - val[i] = (long)self->arr->v[i]; - - return GRIB_SUCCESS; -} - -static void destroy(grib_context* c, grib_accessor* a) -{ - grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a; - if (self->arr) - grib_darray_delete(a->context, self->arr); -} - -static int value_count(grib_accessor* a, long* count) -{ - grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a; - if (self->arr) - *count = grib_darray_used_size(self->arr); - else - *count = 0; - - return 0; -} - -static int get_native_type(grib_accessor* a) -{ - const grib_accessor_transient_darray* self = (grib_accessor_transient_darray*)a; - return self->type; -} diff --git a/src/grib_accessor_class_trim.cc b/src/grib_accessor_class_trim.cc deleted file mode 100644 index 21948ab82..000000000 --- a/src/grib_accessor_class_trim.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_ascii - IMPLEMENTS = unpack_string;pack_string - IMPLEMENTS = init; string_length - MEMBERS= const char* input - MEMBERS= int trim_left - MEMBERS= int trim_right - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_string(grib_accessor*, const char*, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static size_t string_length(grib_accessor*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_trim -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in ascii */ - /* Members defined in trim */ - const char* input; - int trim_left; - int trim_right; -} grib_accessor_trim; - -extern grib_accessor_class* grib_accessor_class_ascii; - -static grib_accessor_class _grib_accessor_class_trim = { - &grib_accessor_class_ascii, /* super */ - "trim", /* name */ - sizeof(grib_accessor_trim), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - &string_length, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - &pack_string, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_trim = &_grib_accessor_class_trim; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long l, grib_arguments* arg) -{ - int n = 0; - grib_accessor_trim* self = (grib_accessor_trim*)a; - grib_handle* h = grib_handle_of_accessor(a); - - self->input = grib_arguments_get_name(h, arg, n++); - self->trim_left = grib_arguments_get_long(h, arg, n++); - self->trim_right= grib_arguments_get_long(h, arg, n++); - DEBUG_ASSERT(self->trim_left == 0 || self->trim_left == 1); - DEBUG_ASSERT(self->trim_right == 0 || self->trim_right == 1); -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - grib_accessor_trim* self = (grib_accessor_trim*)a; - - int err = 0; - grib_handle* h = grib_handle_of_accessor(a); - char input[256] = {0,}; - size_t size = sizeof(input) / sizeof(*input); - char* pInput = input; - - err = grib_get_string(h, self->input, input, &size); - if (err) return err; - - string_lrtrim(&pInput, self->trim_left, self->trim_right); - snprintf(val, 1024, "%s", pInput); - size = strlen(val); - *len = size + 1; - return GRIB_SUCCESS; -} - -static int pack_string(grib_accessor* a, const char* val, size_t* len) -{ - char input[256] = {0,}; - - size_t inputLen = 256; - char buf[256] = {0,}; - char* pBuf = NULL; - int err; - grib_handle* h = grib_handle_of_accessor(a); - grib_accessor_trim* self = (grib_accessor_trim*)a; - grib_accessor* inputAccesstor = grib_find_accessor(h, self->input); - if (!inputAccesstor) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor for %s not found", self->input); - return GRIB_NOT_FOUND; - } - - if ((err = grib_get_string(h, self->input, input, &inputLen)) != GRIB_SUCCESS) - return err; - - snprintf(buf, sizeof(buf), "%s", val); - pBuf = buf; - string_lrtrim(&pBuf, self->trim_left, self->trim_right); - - return grib_pack_string(inputAccesstor, pBuf, len); -} - -static size_t string_length(grib_accessor* a) -{ - return 1024; -} diff --git a/src/grib_accessor_class_uint16.cc b/src/grib_accessor_class_uint16.cc deleted file mode 100644 index 4bac26b59..000000000 --- a/src/grib_accessor_class_uint16.cc +++ /dev/null @@ -1,118 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long - IMPLEMENTS = get_native_type - END_CLASS_DEF - -*/ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); - -typedef struct grib_accessor_uint16 -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in uint16 */ -} grib_accessor_uint16; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_uint16 = { - &grib_accessor_class_gen, /* super */ - "uint16", /* name */ - sizeof(grib_accessor_uint16), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_uint16 = &_grib_accessor_class_uint16; - -/* END_CLASS_IMP */ - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - long value = 0; - /*long pos = a->offset;*/ - /*unsigned char* data = grib_handle_of_accessor(a)->buffer->data;*/ - - if (*len < 1) { - return GRIB_ARRAY_TOO_SMALL; - } - - *val = value; - *len = 1; - return GRIB_NOT_IMPLEMENTED; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_uint32.cc b/src/grib_accessor_class_uint32.cc deleted file mode 100644 index b45b7451f..000000000 --- a/src/grib_accessor_class_uint32.cc +++ /dev/null @@ -1,118 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long - IMPLEMENTS = get_native_type - END_CLASS_DEF - -*/ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); - -typedef struct grib_accessor_uint32 -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in uint32 */ -} grib_accessor_uint32; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_uint32 = { - &grib_accessor_class_gen, /* super */ - "uint32", /* name */ - sizeof(grib_accessor_uint32), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_uint32 = &_grib_accessor_class_uint32; - -/* END_CLASS_IMP */ - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - long value = 0; - /* long pos = a->offset; */ - /* unsigned char* data = grib_handle_of_accessor(a)->buffer->data; */ - - if (*len < 1) { - return GRIB_ARRAY_TOO_SMALL; - } - - *val = value; - *len = 1; - return GRIB_NOT_IMPLEMENTED; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_uint32_little_endian.cc b/src/grib_accessor_class_uint32_little_endian.cc deleted file mode 100644 index 3e39e0586..000000000 --- a/src/grib_accessor_class_uint32_little_endian.cc +++ /dev/null @@ -1,118 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long - IMPLEMENTS = get_native_type - END_CLASS_DEF - -*/ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); - -typedef struct grib_accessor_uint32_little_endian -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in uint32_little_endian */ -} grib_accessor_uint32_little_endian; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_uint32_little_endian = { - &grib_accessor_class_gen, /* super */ - "uint32_little_endian", /* name */ - sizeof(grib_accessor_uint32_little_endian), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_uint32_little_endian = &_grib_accessor_class_uint32_little_endian; - -/* END_CLASS_IMP */ - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - long value = 0; - /* long pos = a->offset; */ - /* unsigned char* data = grib_handle_of_accessor(a)->buffer->data; */ - - if (*len < 1) { - return GRIB_ARRAY_TOO_SMALL; - } - - *val = value; - *len = 1; - return GRIB_NOT_IMPLEMENTED; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_uint64.cc b/src/grib_accessor_class_uint64.cc deleted file mode 100644 index 20bd7e194..000000000 --- a/src/grib_accessor_class_uint64.cc +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long - IMPLEMENTS = get_native_type - END_CLASS_DEF - -*/ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); - -typedef struct grib_accessor_uint64 -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in uint64 */ -} grib_accessor_uint64; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_uint64 = { - &grib_accessor_class_gen, /* super */ - "uint64", /* name */ - sizeof(grib_accessor_uint64), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_uint64 = &_grib_accessor_class_uint64; - -/* END_CLASS_IMP */ - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - long value = 0; - long pos = a->offset; - unsigned char* data = grib_handle_of_accessor(a)->buffer->data; - unsigned long long result = 0, tmp; - int i; - - if (*len < 1) { - return GRIB_ARRAY_TOO_SMALL; - } - - for (i = 0; i < 8; i++) { - result <<= 8; - result |= data[pos + i]; - } - - value = result; - tmp = value; - - /* Result does not fit in long */ - if (tmp != result) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Value for %s cannot be decoded as a 'long' (%llu)", a->name, result); - return GRIB_DECODING_ERROR; - } - - *val = value; - *len = 1; - return GRIB_SUCCESS; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_uint64_little_endian.cc b/src/grib_accessor_class_uint64_little_endian.cc deleted file mode 100644 index 0553aefbf..000000000 --- a/src/grib_accessor_class_uint64_little_endian.cc +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long - IMPLEMENTS = get_native_type - END_CLASS_DEF - -*/ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); - -typedef struct grib_accessor_uint64_little_endian -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in uint64_little_endian */ -} grib_accessor_uint64_little_endian; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_uint64_little_endian = { - &grib_accessor_class_gen, /* super */ - "uint64_little_endian", /* name */ - sizeof(grib_accessor_uint64_little_endian), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_uint64_little_endian = &_grib_accessor_class_uint64_little_endian; - -/* END_CLASS_IMP */ - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - long value = 0; - long pos = a->offset; - unsigned char* data = grib_handle_of_accessor(a)->buffer->data; - unsigned long long result = 0, tmp; - int i; - - if (*len < 1) { - return GRIB_ARRAY_TOO_SMALL; - } - - for (i = 7; i >= 0; i--) { - result <<= 8; - result |= data[pos + i]; - } - - value = result; - tmp = value; - - /* Result does not fit in long */ - if (tmp != result) { - grib_context_log(a->context, GRIB_LOG_ERROR, "Value for %s cannot be decoded as a 'long' (%llu)", a->name, result); - return GRIB_DECODING_ERROR; - } - - *val = value; - *len = 1; - return GRIB_SUCCESS; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_uint8.cc b/src/grib_accessor_class_uint8.cc deleted file mode 100644 index 3f4195eff..000000000 --- a/src/grib_accessor_class_uint8.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = unpack_long - IMPLEMENTS = get_native_type - END_CLASS_DEF - -*/ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int unpack_long(grib_accessor*, long* val, size_t* len); - -typedef struct grib_accessor_uint8 -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in uint8 */ -} grib_accessor_uint8; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_uint8 = { - &grib_accessor_class_gen, /* super */ - "uint8", /* name */ - sizeof(grib_accessor_uint8), /* size */ - 0, /* inited */ - 0, /* init_class */ - 0, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_uint8 = &_grib_accessor_class_uint8; - -/* END_CLASS_IMP */ - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - long value = 0; - long pos = a->offset; - unsigned char* data = grib_handle_of_accessor(a)->buffer->data; - - if (*len < 1) { - return GRIB_ARRAY_TOO_SMALL; - } - - value = data[pos]; - - *val = value; - *len = 1; - return GRIB_SUCCESS; -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} diff --git a/src/grib_accessor_class_unexpanded_descriptors.cc b/src/grib_accessor_class_unexpanded_descriptors.cc deleted file mode 100644 index a026388f2..000000000 --- a/src/grib_accessor_class_unexpanded_descriptors.cc +++ /dev/null @@ -1,236 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init - IMPLEMENTS = next_offset - IMPLEMENTS = value_count - IMPLEMENTS = byte_offset - IMPLEMENTS = update_size - MEMBERS = grib_accessor* unexpandedDescriptorsEncoded - MEMBERS = const char* createNewData - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); - -typedef struct grib_accessor_unexpanded_descriptors -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unexpanded_descriptors */ - grib_accessor* unexpandedDescriptorsEncoded; - const char* createNewData; -} grib_accessor_unexpanded_descriptors; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_unexpanded_descriptors = { - &grib_accessor_class_long, /* super */ - "unexpanded_descriptors", /* name */ - sizeof(grib_accessor_unexpanded_descriptors), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_unexpanded_descriptors = &_grib_accessor_class_unexpanded_descriptors; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_unexpanded_descriptors* self = (grib_accessor_unexpanded_descriptors*)a; - int n = 0; - grib_handle* hand = grib_handle_of_accessor(a); - self->unexpandedDescriptorsEncoded = grib_find_accessor(hand, grib_arguments_get_name(hand, args, n++)); - self->createNewData = grib_arguments_get_name(hand, args, n++); - a->length = 0; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_unexpanded_descriptors* self = (grib_accessor_unexpanded_descriptors*)a; - int ret = 0; - long pos = 0; - long rlen = 0; - long f, x, y; - long* v = val; - long i; - grib_handle* hand = grib_handle_of_accessor(a); - - pos = accessor_raw_get_offset(self->unexpandedDescriptorsEncoded) * 8; - - ret = value_count(a, &rlen); - if (ret) - return ret; - - if (rlen == 0) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "No descriptors in section 3. Malformed message."); - return GRIB_MESSAGE_MALFORMED; - } - - if (*len < rlen) { - /* grib_context_log(a->context, GRIB_LOG_ERROR, */ - /* " wrong size (%ld) for %s it contains %d values ",*len, a->name , rlen); */ - *len = 0; - return GRIB_ARRAY_TOO_SMALL; - } - - for (i = 0; i < rlen; i++) { - f = grib_decode_unsigned_long(hand->buffer->data, &pos, 2); - x = grib_decode_unsigned_long(hand->buffer->data, &pos, 6); - y = grib_decode_unsigned_long(hand->buffer->data, &pos, 8); - *v++ = f * 100000 + x * 1000 + y; - } - *len = rlen; - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_unexpanded_descriptors* self = (grib_accessor_unexpanded_descriptors*)a; - int ret = 0; - long pos = 0; - unsigned long f, x, y; - unsigned char* buf = NULL; - grib_accessor* expanded = NULL; - size_t buflen = *len * 2; - size_t i = 0, length = *len; - long createNewData = 1; - grib_handle* hand = grib_handle_of_accessor(a); - - grib_get_long(hand, self->createNewData, &createNewData); - - buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen); - - for (i = 0; i < length; i++) { - const long tmp = val[i] % 100000; - f = val[i] / 100000; - x = tmp / 1000; - y = tmp % 1000; - grib_encode_unsigned_longb(buf, f, &pos, 2); - grib_encode_unsigned_longb(buf, x, &pos, 6); - grib_encode_unsigned_longb(buf, y, &pos, 8); - } - - grib_pack_bytes(self->unexpandedDescriptorsEncoded, buf, &buflen); - grib_context_free(hand->context, buf); - - if (createNewData == 0) - return ret; - - expanded = grib_find_accessor(hand, "expandedCodes"); - Assert(expanded != NULL); - ret = grib_accessor_class_expanded_descriptors_set_do_expand(expanded, 1); - if (ret != GRIB_SUCCESS) - return ret; - - ret = grib_set_long(hand, "unpack", 3); /* BUFR new data */ - if (ret != GRIB_SUCCESS) - return ret; - - ret = grib_set_long(hand, "unpack", 1); /* Unpack structure */ - - return ret; -} - -static int value_count(grib_accessor* a, long* numberOfUnexpandedDescriptors) -{ - grib_accessor_unexpanded_descriptors* self = (grib_accessor_unexpanded_descriptors*)a; - long n = 0; - - grib_value_count(self->unexpandedDescriptorsEncoded, &n); - *numberOfUnexpandedDescriptors = n / 2; - - return 0; -} - -static long byte_offset(grib_accessor* a) -{ - return a->offset; -} - -static void update_size(grib_accessor* a, size_t s) -{ - a->length = s; -} - -static long next_offset(grib_accessor* a) -{ - return byte_offset(a) + a->length; -} diff --git a/src/grib_accessor_class_unpack_bufr_values.cc b/src/grib_accessor_class_unpack_bufr_values.cc deleted file mode 100644 index cac0cdfd7..000000000 --- a/src/grib_accessor_class_unpack_bufr_values.cc +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;dump - IMPLEMENTS = unpack_string;unpack_string_array;unpack_long; unpack_double - IMPLEMENTS = pack_long; pack_double - IMPLEMENTS = value_count; destroy; get_native_type; - MEMBERS = grib_accessor* data_accessor - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_double(grib_accessor*, const double* val, size_t* len); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_double(grib_accessor*, double* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static int unpack_string_array(grib_accessor*, char**, size_t* len); -static int value_count(grib_accessor*, long*); -static void destroy(grib_context*, grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_unpack_bufr_values -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in unpack_bufr_values */ - grib_accessor* data_accessor; -} grib_accessor_unpack_bufr_values; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_unpack_bufr_values = { - &grib_accessor_class_gen, /* super */ - "unpack_bufr_values", /* name */ - sizeof(grib_accessor_unpack_bufr_values), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - &destroy, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - &pack_double, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - &unpack_string_array, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_unpack_bufr_values = &_grib_accessor_class_unpack_bufr_values; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* params) -{ - char* key; - grib_accessor_unpack_bufr_values* self = (grib_accessor_unpack_bufr_values*)a; - key = (char*)grib_arguments_get_name(grib_handle_of_accessor(a), params, 0); - self->data_accessor = grib_find_accessor(grib_handle_of_accessor(a), key); - - a->length = 0; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ -} - -static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) -{ - grib_accessor_unpack_bufr_values* self = (grib_accessor_unpack_bufr_values*)a; - grib_accessor* data = (grib_accessor*)self->data_accessor; - - return grib_unpack_double(data, 0, 0); -} - -static int unpack_string(grib_accessor* a, char* buffer, size_t* len) -{ - grib_accessor_unpack_bufr_values* self = (grib_accessor_unpack_bufr_values*)a; - grib_accessor* data = (grib_accessor*)self->data_accessor; - strcpy(buffer, "0"); - *len=1; - - return grib_unpack_double(data, 0, 0); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_unpack_bufr_values* self = (grib_accessor_unpack_bufr_values*)a; - grib_accessor* data = (grib_accessor*)self->data_accessor; - - return grib_unpack_double(data, 0, 0); -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - grib_accessor_unpack_bufr_values* self = (grib_accessor_unpack_bufr_values*)a; - grib_accessor* data = (grib_accessor*)self->data_accessor; - - return grib_unpack_double(data, 0, 0); -} - -static int value_count(grib_accessor* a, long* count) -{ - *count = 1; - return 0; -} - -static void destroy(grib_context* context, grib_accessor* a) -{ -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_LONG; -} - -// static const char* mode_to_str(int p) -// { -// if (p==CODES_BUFR_UNPACK_STRUCTURE) return "CODES_BUFR_UNPACK_STRUCTURE"; -// if (p==CODES_BUFR_UNPACK_FLAT) return "CODES_BUFR_UNPACK_FLAT"; -// if (p==CODES_BUFR_NEW_DATA) return "CODES_BUFR_NEW_DATA"; -// return "unknown proc flag"; -// } - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - int unpackMode = CODES_BUFR_UNPACK_STRUCTURE; - grib_accessor_unpack_bufr_values* self = (grib_accessor_unpack_bufr_values*)a; - grib_accessor* data = (grib_accessor*)self->data_accessor; - - if (*val == 2) - unpackMode = CODES_BUFR_UNPACK_FLAT; - if (*val == 3) - unpackMode = CODES_BUFR_NEW_DATA; - - accessor_bufr_data_array_set_unpackMode(data, unpackMode); - - return grib_unpack_double(data, 0, 0); -} - -static int pack_double(grib_accessor* a, const double* val, size_t* len) -{ - grib_accessor_unpack_bufr_values* self = (grib_accessor_unpack_bufr_values*)a; - grib_accessor* data = (grib_accessor*)self->data_accessor; - - return grib_unpack_double(data, 0, 0); -} diff --git a/src/grib_accessor_class_unsigned_bits.cc b/src/grib_accessor_class_unsigned_bits.cc deleted file mode 100644 index 38c3425cf..000000000 --- a/src/grib_accessor_class_unsigned_bits.cc +++ /dev/null @@ -1,265 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long;pack_long - IMPLEMENTS = init - IMPLEMENTS = next_offset - IMPLEMENTS = byte_count - IMPLEMENTS = value_count - IMPLEMENTS = byte_offset - IMPLEMENTS = update_size - MEMBERS = const char* numberOfBits - MEMBERS = const char* numberOfElements - - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int pack_long(grib_accessor*, const long* val, size_t* len); -static int unpack_long(grib_accessor*, long* val, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static int value_count(grib_accessor*, long*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); - -typedef struct grib_accessor_unsigned_bits -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in unsigned_bits */ - const char* numberOfBits; - const char* numberOfElements; -} grib_accessor_unsigned_bits; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_unsigned_bits = { - &grib_accessor_class_long, /* super */ - "unsigned_bits", /* name */ - sizeof(grib_accessor_unsigned_bits), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - &value_count, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_unsigned_bits = &_grib_accessor_class_unsigned_bits; - -/* END_CLASS_IMP */ - - -static long compute_byte_count(grib_accessor* a) -{ - grib_accessor_unsigned_bits* self = (grib_accessor_unsigned_bits*)a; - long numberOfBits; - long numberOfElements; - int ret = 0; - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s unable to get %s to compute size", a->name, self->numberOfBits); - return 0; - } - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, &numberOfElements); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s unable to get %s to compute size", a->name, self->numberOfElements); - return 0; - } - - return (numberOfBits * numberOfElements + 7) / 8; -} - - -static void init(grib_accessor* a, const long len, grib_arguments* args) -{ - grib_accessor_unsigned_bits* self = (grib_accessor_unsigned_bits*)a; - int n = 0; - self->numberOfBits = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - self->numberOfElements = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++); - a->length = compute_byte_count(a); -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_unsigned_bits* self = (grib_accessor_unsigned_bits*)a; - int ret = 0; - long pos = a->offset * 8; - long rlen = 0; - long numberOfBits = 0; - - ret = value_count(a, &rlen); - if (ret) - return ret; - - if (*len < rlen) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Wrong size (%ld) for %s, it contains %ld values", *len, a->name, rlen); - *len = rlen; - return GRIB_ARRAY_TOO_SMALL; - } - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); - if (ret) - return ret; - if (numberOfBits == 0) { - int i; - for (i = 0; i < rlen; i++) - val[i] = 0; - return GRIB_SUCCESS; - } - - grib_decode_long_array(grib_handle_of_accessor(a)->buffer->data, &pos, numberOfBits, rlen, val); - - *len = rlen; - - return GRIB_SUCCESS; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_unsigned_bits* self = (grib_accessor_unsigned_bits*)a; - int ret = 0; - long off = 0; - long numberOfBits = 0; - size_t buflen = 0; - unsigned char* buf = NULL; - unsigned long i = 0; - long rlen = 0; - ret = value_count(a, &rlen); - if (ret) return ret; - - /* - if(*len < rlen) - { - grib_context_log(a->context, GRIB_LOG_ERROR, - "Wrong size for %s it contains %d values ", a->name , rlen ); - return GRIB_ARRAY_TOO_SMALL; - } - */ - if (*len != rlen) - ret = grib_set_long(grib_handle_of_accessor(a), self->numberOfElements, *len); - if (ret) return ret; - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfBits, &numberOfBits); - if (ret) return ret; - if (numberOfBits == 0) { - grib_buffer_replace(a, NULL, 0, 1, 1); - return GRIB_SUCCESS; - } - - buflen = compute_byte_count(a); - buf = (unsigned char*)grib_context_malloc_clear(a->context, buflen + sizeof(long)); - - for (i = 0; i < *len; i++) - grib_encode_unsigned_longb(buf, val[i], &off, numberOfBits); - - grib_buffer_replace(a, buf, buflen, 1, 1); - - grib_context_free(a->context, buf); - - return ret; -} - -static long byte_count(grib_accessor* a) -{ - return a->length; -} - -static int value_count(grib_accessor* a, long* numberOfElements) -{ - grib_accessor_unsigned_bits* self = (grib_accessor_unsigned_bits*)a; - int ret; - *numberOfElements = 0; - - ret = grib_get_long(grib_handle_of_accessor(a), self->numberOfElements, numberOfElements); - if (ret) { - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s unable to get %s to compute size", a->name, self->numberOfElements); - } - - return ret; -} - -static long byte_offset(grib_accessor* a) -{ - return a->offset; -} - -static void update_size(grib_accessor* a, size_t s) -{ - a->length = s; -} - -static long next_offset(grib_accessor* a) -{ - return byte_offset(a) + a->length; -} diff --git a/src/grib_accessor_class_validity_date.cc b/src/grib_accessor_class_validity_date.cc deleted file mode 100644 index 760b7bccd..000000000 --- a/src/grib_accessor_class_validity_date.cc +++ /dev/null @@ -1,229 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = init - MEMBERS=const char* date - MEMBERS=const char* time - MEMBERS=const char* step - MEMBERS=const char* stepUnits - MEMBERS=const char* year - MEMBERS=const char* month - MEMBERS=const char* day - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_validity_date -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in validity_date */ - const char* date; - const char* time; - const char* step; - const char* stepUnits; - const char* year; - const char* month; - const char* day; -} grib_accessor_validity_date; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_validity_date = { - &grib_accessor_class_long, /* super */ - "validity_date", /* name */ - sizeof(grib_accessor_validity_date), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_validity_date = &_grib_accessor_class_validity_date; - -/* END_CLASS_IMP */ - -/* Table of multipliers to convert step units to minutes */ -static const double u2m[] = { - 1, /* index 0: minutes */ - 60, /* index 1: hour */ - 24 * 60, /* index 2: day */ - 24 * 60 * 30, /* index 3: month */ - -1, /* index 4: year */ - -1, /* index 5: decade */ - -1, /* index 6: 30 years */ - -1, /* index 7: century */ - -1, /* index 8: RESERVED */ - -1, /* index 9: RESERVED */ - 3 * 60, /* index 10: 3 hours */ - 6 * 60, /* index 11: 6 hours */ - 12 * 60, /* index 12: 12 hours */ - 1 / 60.0, /* index 13: seconds */ - 15, /* index 14: 15 mins */ - 30 /* index 15: 30 mins */ -}; - -static long convert_to_minutes(long step, long stepUnits) -{ - double result = 0; - if (stepUnits == 0) - return step; /* unit=minutes so no change */ - if (stepUnits == 1) - return step * 60; /* unit=hours */ - if (stepUnits == 13) - return step / 60; /* unit=seconds */ - /* Assert( stepUnits < sizeof(u2m)/sizeof(u2m[0]) ); */ - - result = step * u2m[stepUnits]; - return (long)result; -} - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_validity_date* self = (grib_accessor_validity_date*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int n = 0; - - self->date = grib_arguments_get_name(hand, c, n++); - self->time = grib_arguments_get_name(hand, c, n++); - self->step = grib_arguments_get_name(hand, c, n++); - self->stepUnits = grib_arguments_get_name(hand, c, n++); - self->year = grib_arguments_get_name(hand, c, n++); - self->month = grib_arguments_get_name(hand, c, n++); - self->day = grib_arguments_get_name(hand, c, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_validity_date* self = (grib_accessor_validity_date*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int ret = 0; - long date = 0; - long time = 0; - long step = 0; - long stepUnits = 0; - long hours = 0, minutes = 0, step_mins = 0, tmp, tmp_hrs; - - if (self->year) { - long year, month, day; - if ((ret = grib_get_long_internal(hand, self->year, &year)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(hand, self->month, &month)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(hand, self->day, &day)) != GRIB_SUCCESS) - return ret; - *val = year * 10000 + month * 100 + day; - return GRIB_SUCCESS; - } - if ((ret = grib_get_long_internal(hand, self->date, &date)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(hand, self->time, &time)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long(hand, self->step, &step)) != GRIB_SUCCESS) { - if ((ret = grib_get_long_internal(hand, "endStep", &step)) != GRIB_SUCCESS) { - return ret; /* See ECC-817 */ - } - } - - if (self->stepUnits) { - if ((ret = grib_get_long_internal(hand, self->stepUnits, &stepUnits)) != GRIB_SUCCESS) - return ret; - step_mins = convert_to_minutes(step, stepUnits); - } - - minutes = time % 100; - hours = time / 100; - tmp = minutes + step_mins; /* add the step to our minutes */ - tmp_hrs = tmp / 60; /* how many hours and mins is that? */ - hours += tmp_hrs; /* increment hours */ - - date = grib_date_to_julian(date); - /* does the new 'hours' exceed 24? if so increment julian */ - while (hours >= 24) { - date++; - hours -= 24; - } - /* GRIB-29: Negative forecast time */ - while (hours < 0) { - date--; - hours += 24; - } - - if (*len < 1) - return GRIB_ARRAY_TOO_SMALL; - - *val = grib_julian_to_date(date); - - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_validity_time.cc b/src/grib_accessor_class_validity_time.cc deleted file mode 100644 index 34eb78128..000000000 --- a/src/grib_accessor_class_validity_time.cc +++ /dev/null @@ -1,249 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_long - IMPLEMENTS = unpack_long - IMPLEMENTS = unpack_string - IMPLEMENTS = init - MEMBERS=const char* date - MEMBERS=const char* time - MEMBERS=const char* step - MEMBERS=const char* stepUnits - MEMBERS=const char* hours - MEMBERS=const char* minutes - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_long(grib_accessor*, long* val, size_t* len); -static int unpack_string(grib_accessor*, char*, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_validity_time -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in long */ - /* Members defined in validity_time */ - const char* date; - const char* time; - const char* step; - const char* stepUnits; - const char* hours; - const char* minutes; -} grib_accessor_validity_time; - -extern grib_accessor_class* grib_accessor_class_long; - -static grib_accessor_class _grib_accessor_class_validity_time = { - &grib_accessor_class_long, /* super */ - "validity_time", /* name */ - sizeof(grib_accessor_validity_time), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - &unpack_long, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - &unpack_string, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_validity_time = &_grib_accessor_class_validity_time; - -/* END_CLASS_IMP */ - -/* Table of multipliers to convert step units to minutes */ -static const double u2m[] = { - 1, /* index 0: minutes */ - 60, /* index 1: hour */ - 24 * 60, /* index 2: day */ - 24 * 60 * 30, /* index 3: month */ - -1, /* index 4: year */ - -1, /* index 5: decade */ - -1, /* index 6: 30 years */ - -1, /* index 7: century */ - -1, /* index 8: RESERVED */ - -1, /* index 9: RESERVED */ - 3 * 60, /* index 10: 3 hours */ - 6 * 60, /* index 11: 6 hours */ - 12 * 60, /* index 12: 12 hours */ - 1 / 60.0, /* index 13: seconds */ - 15, /* index 14: 15 mins */ - 30 /* index 15: 30 mins */ -}; - -static long convert_to_minutes(long step, long stepUnits) -{ - double result = 0; - if (stepUnits == 0) - return step; /* unit=minutes so no change */ - if (stepUnits == 1) - return step * 60; /* unit=hours */ - if (stepUnits == 13) - return step / 60; /* unit=seconds*/ - /* Assert( stepUnits < sizeof(u2m)/sizeof(u2m[0]) ); */ - - result = step * u2m[stepUnits]; - return (long)result; -} - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_validity_time* self = (grib_accessor_validity_time*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int n = 0; - - self->date = grib_arguments_get_name(hand, c, n++); - self->time = grib_arguments_get_name(hand, c, n++); - self->step = grib_arguments_get_name(hand, c, n++); - self->stepUnits = grib_arguments_get_name(hand, c, n++); - self->hours = grib_arguments_get_name(hand, c, n++); - self->minutes = grib_arguments_get_name(hand, c, n++); - - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static int unpack_long(grib_accessor* a, long* val, size_t* len) -{ - grib_accessor_validity_time* self = (grib_accessor_validity_time*)a; - grib_handle* hand = grib_handle_of_accessor(a); - int ret = 0; - long date = 0; - long time = 0; - long step = 0; - long stepUnits = 0; - long hours = 0, minutes = 0, step_mins = 0, tmp, tmp_hrs, tmp_mins; - - if (self->hours) { - if ((ret = grib_get_long_internal(hand, self->hours, &hours)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(hand, self->minutes, &minutes)) != GRIB_SUCCESS) - return ret; - *val = hours * 100 + minutes; - return GRIB_SUCCESS; - } - if ((ret = grib_get_long_internal(hand, self->date, &date)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long_internal(hand, self->time, &time)) != GRIB_SUCCESS) - return ret; - if ((ret = grib_get_long(hand, self->step, &step)) != GRIB_SUCCESS) { - if ((ret = grib_get_long_internal(hand, "endStep", &step)) != GRIB_SUCCESS) { - return ret; /* See ECC-817 */ - } - } - - /* Seconds will always be zero. So convert to minutes */ - if (self->stepUnits) { - if ((ret = grib_get_long_internal(hand, self->stepUnits, &stepUnits)) != GRIB_SUCCESS) - return ret; - step_mins = convert_to_minutes(step, stepUnits); - } - - minutes = time % 100; - hours = time / 100; - tmp = minutes + step_mins; /* add the step to our minutes */ - tmp_hrs = tmp / 60; /* how many hours and mins is that? */ - tmp_mins = tmp % 60; - hours += tmp_hrs; /* increment hours */ - if (hours > 0) { - hours = hours % 24; /* wrap round if >= 24 */ - } - else { - /* GRIB-29: Negative forecast time */ - while (hours < 0) { - hours += 24; - } - } - time = hours * 100 + tmp_mins; - - if (*len < 1) - return GRIB_ARRAY_TOO_SMALL; - - *val = time; - - return GRIB_SUCCESS; -} - -static int unpack_string(grib_accessor* a, char* val, size_t* len) -{ - int err = 0; - long v = 0; - size_t lsize = 1, lmin = 5; - - err = unpack_long(a, &v, &lsize); - if (err) return err; - - if (*len < lmin) { - const char* cclass_name = a->cclass->name; - grib_context_log(a->context, GRIB_LOG_ERROR, - "%s: Buffer too small for %s. It is %zu bytes long (len=%zu)", - cclass_name, a->name, lmin, *len); - *len = lmin; - return GRIB_BUFFER_TOO_SMALL; - } - - snprintf(val, 64, "%04ld", v); - - len[0] = lmin; - return GRIB_SUCCESS; -} diff --git a/src/grib_accessor_class_values.cc b/src/grib_accessor_class_values.cc deleted file mode 100644 index 384282317..000000000 --- a/src/grib_accessor_class_values.cc +++ /dev/null @@ -1,259 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" - -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init - IMPLEMENTS = dump - IMPLEMENTS = next_offset - IMPLEMENTS = byte_count - IMPLEMENTS = byte_offset - IMPLEMENTS = get_native_type - IMPLEMENTS = update_size - IMPLEMENTS = compare - IMPLEMENTS = pack_long - MEMBERS= int carg - MEMBERS= const char* seclen - MEMBERS= const char* offsetdata - MEMBERS= const char* offsetsection - MEMBERS= int dirty - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static int pack_long(grib_accessor*, const long* val, size_t* len); -static long byte_count(grib_accessor*); -static long byte_offset(grib_accessor*); -static long next_offset(grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static void update_size(grib_accessor*, size_t); -static int compare(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_values -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in values */ - int carg; - const char* seclen; - const char* offsetdata; - const char* offsetsection; - int dirty; -} grib_accessor_values; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_values = { - &grib_accessor_class_gen, /* super */ - "values", /* name */ - sizeof(grib_accessor_values), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - &next_offset, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - &byte_count, /* get number of bytes */ - &byte_offset, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - &pack_long, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - &update_size, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - &compare, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_values = &_grib_accessor_class_values; - -/* END_CLASS_IMP */ -static long init_length(grib_accessor* a) -{ - grib_accessor_values* self = (grib_accessor_values*)a; - int ret = 0; - - long seclen = 0; - long offsetsection = 0; - long offsetdata = 0; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->seclen, &seclen))) - return ret; - - if (seclen == 0) { - /* printf("init_length seclen=0\n"); */ - return 0; - } - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetsection, &offsetsection))) - return ret; - - if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->offsetdata, &offsetdata))) - return ret; - - /* When reparsing */ - if (offsetdata < offsetsection) { - /* printf("init_length offsetdata < offsetsection=0\n"); */ - Assert(grib_handle_of_accessor(a)->loader); - return 0; - } - - return seclen - (offsetdata - offsetsection); -} - -static void init(grib_accessor* a, const long v, grib_arguments* params) -{ - grib_accessor_values* self = (grib_accessor_values*)a; - self->carg = 0; - - self->seclen = grib_arguments_get_name(grib_handle_of_accessor(a), params, self->carg++); - self->offsetdata = grib_arguments_get_name(grib_handle_of_accessor(a), params, self->carg++); - self->offsetsection = grib_arguments_get_name(grib_handle_of_accessor(a), params, self->carg++); - self->dirty = 1; - - a->length = init_length(a); - /* Assert(a->length>=0); */ -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_DOUBLE; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - grib_dump_values(dumper, a); -} - -static long byte_count(grib_accessor* a) -{ - grib_context_log(a->context, GRIB_LOG_DEBUG, "byte_count of %s = %ld", a->name, a->length); - return a->length; -} - -static long byte_offset(grib_accessor* a) -{ - return a->offset; -} - -static long next_offset(grib_accessor* a) -{ - return a->offset + a->length; -} - -static void update_size(grib_accessor* a, size_t s) -{ - grib_context_log(a->context, GRIB_LOG_DEBUG, "updating size of %s old %ld new %ld", a->name, a->length, s); - a->length = s; - Assert(a->length >= 0); -} - -static int compare(grib_accessor* a, grib_accessor* b) -{ - int retval = 0; - double* aval = 0; - double* bval = 0; - - size_t alen = 0; - size_t blen = 0; - int err = 0; - long count = 0; - - err = grib_value_count(a, &count); - if (err) - return err; - alen = count; - - err = grib_value_count(b, &count); - if (err) - return err; - blen = count; - - if (alen != blen) - return GRIB_COUNT_MISMATCH; - - aval = (double*)grib_context_malloc(a->context, alen * sizeof(double)); - bval = (double*)grib_context_malloc(b->context, blen * sizeof(double)); - - grib_unpack_double(a, aval, &alen); - grib_unpack_double(b, bval, &blen); - - retval = GRIB_SUCCESS; - for (size_t i=0; icontext, aval); - grib_context_free(b->context, bval); - - return retval; -} - -static int pack_long(grib_accessor* a, const long* val, size_t* len) -{ - grib_accessor_values* self = (grib_accessor_values*)a; - double* dval = (double*)grib_context_malloc(a->context, *len * sizeof(double)); - - for (size_t i = 0; i < *len; i++) - dval[i] = (double)val[i]; - - int ret = grib_pack_double(a, dval, len); - - grib_context_free(a->context, dval); - - self->dirty = 1; - - return ret; -} diff --git a/src/grib_accessor_class_vector.cc b/src/grib_accessor_class_vector.cc deleted file mode 100644 index 1cc69a4c7..000000000 --- a/src/grib_accessor_class_vector.cc +++ /dev/null @@ -1,162 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -/************************************** - * Enrico Fucile - **************************************/ - - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_abstract_vector - IMPLEMENTS = init - IMPLEMENTS = unpack_double - MEMBERS = const char* vector - MEMBERS = int index - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int unpack_double(grib_accessor*, double* val, size_t* len); -static void init(grib_accessor*, const long, grib_arguments*); - -typedef struct grib_accessor_vector -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in abstract_vector */ - double* v; - int number_of_elements; - /* Members defined in vector */ - const char* vector; - int index; -} grib_accessor_vector; - -extern grib_accessor_class* grib_accessor_class_abstract_vector; - -static grib_accessor_class _grib_accessor_class_vector = { - &grib_accessor_class_abstract_vector, /* super */ - "vector", /* name */ - sizeof(grib_accessor_vector), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - 0, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - 0, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - &unpack_double, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - 0, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_vector = &_grib_accessor_class_vector; - -/* END_CLASS_IMP */ - -typedef struct grib_accessor_abstract_vector -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in double */ - /* Members defined in abstract_vector */ - double* v; - int number_of_elements; -} grib_accessor_abstract_vector; - -static void init(grib_accessor* a, const long l, grib_arguments* c) -{ - grib_accessor_vector* self = (grib_accessor_vector*)a; - int n = 0; - - self->vector = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++); - self->index = grib_arguments_get_long(grib_handle_of_accessor(a), c, n++); - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; - a->flags |= GRIB_ACCESSOR_FLAG_FUNCTION; - a->length = 0; -} - -static int unpack_double(grib_accessor* a, double* val, size_t* len) -{ - int err = 0; - size_t size = 0; - double* stat; - grib_accessor_vector* self = (grib_accessor_vector*)a; - grib_accessor* va = (grib_accessor*)grib_find_accessor(grib_handle_of_accessor(a), self->vector); - grib_accessor_abstract_vector* v = (grib_accessor_abstract_vector*)va; - - Assert(self->index >= 0); - - if (self->index >= v->number_of_elements) { - grib_context_log(a->context, GRIB_LOG_FATAL, "index=%d number_of_elements=%d for %s", self->index, v->number_of_elements, a->name); - Assert(self->index < v->number_of_elements); - } - - if (va->dirty) { - grib_get_size(grib_handle_of_accessor(a), self->vector, &size); - stat = (double*)grib_context_malloc_clear(a->context, sizeof(double) * size); - err = grib_unpack_double(va, stat, &size); - grib_context_free(a->context, stat); - if (err) - return err; - } - - *val = v->v[self->index]; - - return err; -} diff --git a/src/grib_accessor_class_when.cc b/src/grib_accessor_class_when.cc deleted file mode 100644 index 1bf0d999e..000000000 --- a/src/grib_accessor_class_when.cc +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (C) Copyright 2005- ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * 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. - */ - -#include "grib_api_internal.h" -/* - This is used by make_class.pl - - START_CLASS_DEF - CLASS = accessor - SUPER = grib_accessor_class_gen - IMPLEMENTS = init;dump; - IMPLEMENTS = get_native_type - IMPLEMENTS = notify_change - END_CLASS_DEF - - */ - -/* START_CLASS_IMP */ - -/* - -Don't edit anything between START_CLASS_IMP and END_CLASS_IMP -Instead edit values between START_CLASS_DEF and END_CLASS_DEF -or edit "accessor.class" and rerun ./make_class.pl - -*/ - -static int get_native_type(grib_accessor*); -static void dump(grib_accessor*, grib_dumper*); -static void init(grib_accessor*, const long, grib_arguments*); -static int notify_change(grib_accessor*, grib_accessor*); - -typedef struct grib_accessor_when -{ - grib_accessor att; - /* Members defined in gen */ - /* Members defined in when */ -} grib_accessor_when; - -extern grib_accessor_class* grib_accessor_class_gen; - -static grib_accessor_class _grib_accessor_class_when = { - &grib_accessor_class_gen, /* super */ - "when", /* name */ - sizeof(grib_accessor_when), /* size */ - 0, /* inited */ - 0, /* init_class */ - &init, /* init */ - 0, /* post_init */ - 0, /* destroy */ - &dump, /* dump */ - 0, /* next_offset */ - 0, /* get length of string */ - 0, /* get number of values */ - 0, /* get number of bytes */ - 0, /* get offset to bytes */ - &get_native_type, /* get native type */ - 0, /* get sub_section */ - 0, /* pack_missing */ - 0, /* is_missing */ - 0, /* pack_long */ - 0, /* unpack_long */ - 0, /* pack_double */ - 0, /* pack_float */ - 0, /* unpack_double */ - 0, /* unpack_float */ - 0, /* pack_string */ - 0, /* unpack_string */ - 0, /* pack_string_array */ - 0, /* unpack_string_array */ - 0, /* pack_bytes */ - 0, /* unpack_bytes */ - 0, /* pack_expression */ - ¬ify_change, /* notify_change */ - 0, /* update_size */ - 0, /* preferred_size */ - 0, /* resize */ - 0, /* nearest_smaller_value */ - 0, /* next accessor */ - 0, /* compare vs. another accessor */ - 0, /* unpack only ith value (double) */ - 0, /* unpack only ith value (float) */ - 0, /* unpack a given set of elements (double) */ - 0, /* unpack a given set of elements (float) */ - 0, /* unpack a subarray */ - 0, /* clear */ - 0, /* clone accessor */ -}; - - -grib_accessor_class* grib_accessor_class_when = &_grib_accessor_class_when; - -/* END_CLASS_IMP */ - -static void init(grib_accessor* a, const long len, grib_arguments* arg) -{ - a->length = 0; - a->flags |= GRIB_ACCESSOR_FLAG_HIDDEN; - a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; -} - -static void dump(grib_accessor* a, grib_dumper* dumper) -{ - /* grib_dump_when(dumper,a,NULL); */ -} - -static int notify_change(grib_accessor* a, grib_accessor* changed) -{ - return grib_action_notify_change(a->creator, a, changed); -} - -static int get_native_type(grib_accessor* a) -{ - return GRIB_TYPE_UNDEFINED; -} diff --git a/src/grib_api_internal.h b/src/grib_api_internal.h index d13edbc46..335da5954 100644 --- a/src/grib_api_internal.h +++ b/src/grib_api_internal.h @@ -240,14 +240,14 @@ typedef struct grib_action_file grib_action_file; typedef struct grib_action_file_list grib_action_file_list; typedef struct grib_block_of_accessors grib_block_of_accessors; typedef struct grib_buffer grib_buffer; -typedef struct grib_accessor_class grib_accessor_class; +class grib_accessor_class; typedef struct grib_action grib_action; typedef struct grib_action_class grib_action_class; typedef struct grib_section grib_section; typedef struct grib_codetable grib_codetable; typedef struct grib_smart_table grib_smart_table; -typedef struct grib_accessor grib_accessor; +class grib_accessor; typedef struct grib_iterator_class grib_iterator_class; typedef struct grib_nearest_class grib_nearest_class; typedef struct grib_dumper grib_dumper; @@ -279,53 +279,6 @@ typedef long (*iterator_has_next_proc)(grib_iterator* i); typedef int (*grib_pack_proc)(grib_handle* h, const double* in, size_t inlen, void* out, size_t* outlen); typedef int (*grib_unpack_proc)(grib_handle* h, const void* in, size_t inlen, double* out, size_t* outlen); -typedef void (*accessor_destroy_proc)(grib_context*, grib_accessor*); - -typedef int (*accessor_unpack_long_proc)(grib_accessor*, long*, size_t* len); -typedef int (*accessor_unpack_double_proc)(grib_accessor*, double*, size_t* len); -typedef int (*accessor_unpack_float_proc)(grib_accessor*, float*, size_t* len); - -typedef int (*accessor_unpack_double_element_proc)(grib_accessor*, size_t, double*); -typedef int (*accessor_unpack_float_element_proc)(grib_accessor*, size_t, float*); -typedef int (*accessor_unpack_double_element_set_proc)(grib_accessor*, const size_t*, size_t, double*); -typedef int (*accessor_unpack_float_element_set_proc)(grib_accessor*, const size_t*, size_t, float*); - -typedef int (*accessor_unpack_double_subarray_proc)(grib_accessor*, double*, size_t, size_t); -typedef int (*accessor_unpack_string_proc)(grib_accessor*, char*, size_t* len); -typedef int (*accessor_unpack_string_array_proc)(grib_accessor*, char**, size_t* len); -typedef int (*accessor_unpack_bytes_proc)(grib_accessor*, unsigned char*, size_t* len); -typedef int (*accessor_get_native_type_proc)(grib_accessor*); -typedef int (*accessor_notify_change_proc)(grib_accessor*, grib_accessor*); -typedef void (*accessor_update_size_proc)(grib_accessor*, size_t); -typedef size_t (*accessor_preferred_size_proc)(grib_accessor*, int); -typedef void (*accessor_resize_proc)(grib_accessor*, size_t); - -typedef grib_accessor* (*accessor_next_proc)(grib_accessor*, int); -typedef grib_section* (*accessor_sub_section_proc)(grib_accessor*); - -typedef int (*accessor_pack_missing_proc)(grib_accessor*); -typedef int (*accessor_pack_is_missing_proc)(grib_accessor*); -typedef int (*accessor_pack_long_proc)(grib_accessor*, const long*, size_t* len); -typedef int (*accessor_pack_double_proc)(grib_accessor*, const double*, size_t* len); -typedef int (*accessor_pack_float_proc)(grib_accessor*, const float*, size_t* len); -typedef int (*accessor_pack_string_proc)(grib_accessor*, const char*, size_t* len); -typedef int (*accessor_pack_string_array_proc)(grib_accessor*, const char**, size_t* len); -typedef int (*accessor_pack_bytes_proc)(grib_accessor*, const unsigned char*, size_t* len); -typedef int (*accessor_pack_expression_proc)(grib_accessor*, grib_expression*); -typedef int (*accessor_clear_proc)(grib_accessor*); -typedef grib_accessor* (*accessor_clone_proc)(grib_accessor*, grib_section*, int*); - -typedef void (*accessor_init_class_proc)(grib_accessor_class*); - -typedef int (*accessor_compare_proc)(grib_accessor*, grib_accessor*); -typedef size_t (*accessor_string_proc)(grib_accessor*); -typedef int (*accessor_value_with_ret_proc)(grib_accessor*, long*); -typedef long (*accessor_value_proc)(grib_accessor*); -typedef void (*accessor_dump_proc)(grib_accessor*, grib_dumper*); -typedef void (*accessor_init_proc)(grib_accessor*, const long len, grib_arguments*); -typedef void (*accessor_post_init_proc)(grib_accessor*); - -typedef int (*accessor_nearest_proc)(grib_accessor*, double, double*); typedef long (*grib_binop_long_proc)(long, long); typedef long (*grib_unop_long_proc)(long); @@ -395,16 +348,7 @@ struct grib_action char* debug_info; /** purely for debugging and tracing */ }; -typedef struct grib_accessors_list grib_accessors_list; - -struct grib_accessors_list -{ - grib_accessor* accessor; - int rank; - grib_accessors_list* next; - grib_accessors_list* prev; - grib_accessors_list* last; -}; +class grib_accessors_list; typedef int (*action_create_accessors_handle_proc)(grib_section* p, grib_action* a, grib_loader* h); typedef int (*action_notify_change_proc)(grib_action* a, grib_accessor* observer, grib_accessor* observed); @@ -479,34 +423,6 @@ struct grib_virtual_value int type; }; -struct grib_accessor -{ - const char* name; /** < name of the accessor */ - const char* name_space; /** < namespace to which the accessor belongs */ - grib_context* context; - grib_handle* h; - grib_action* creator; /** < action that created the accessor */ - long length; /** < byte length of the accessor */ - long offset; /** < offset of the data in the buffer */ - grib_section* parent; /** < section to which the accessor is attached */ - grib_accessor* next; /** < next accessor in list */ - grib_accessor* previous; /** < next accessor in list */ - grib_accessor_class* cclass; /** < behaviour of the accessor */ - unsigned long flags; /** < Various flags */ - grib_section* sub_section; - - const char* all_names[MAX_ACCESSOR_NAMES]; /** < name of the accessor */ - const char* all_name_spaces[MAX_ACCESSOR_NAMES]; /** < namespace to which the accessor belongs */ - int dirty; - - grib_accessor* same; /** < accessors with the same name */ - long loop; /** < used in lists */ - grib_virtual_value* vvalue; /** < virtual value used when transient flag on **/ - const char* set; - grib_accessor* attributes[MAX_ACCESSOR_ATTRIBUTES]; /** < attributes are accessors */ - grib_accessor* parent_as_attribute; -}; - #define GRIB_ACCESSOR_FLAG_READ_ONLY (1 << 1) #define GRIB_ACCESSOR_FLAG_DUMP (1 << 2) #define GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC (1 << 3) @@ -833,71 +749,6 @@ struct grib_multi_handle size_t length; }; -struct grib_accessor_class -{ - grib_accessor_class** super; - const char* name; - size_t size; - - int inited; - accessor_init_class_proc init_class; - - accessor_init_proc init; - accessor_post_init_proc post_init; - accessor_destroy_proc destroy; - - accessor_dump_proc dump; - accessor_value_proc next_offset; - - accessor_string_proc string_length; - accessor_value_with_ret_proc value_count; - - accessor_value_proc byte_count; - accessor_value_proc byte_offset; - - accessor_get_native_type_proc get_native_type; - - accessor_sub_section_proc sub_section; - - accessor_pack_missing_proc pack_missing; - accessor_pack_is_missing_proc is_missing; - - accessor_pack_long_proc pack_long; - accessor_unpack_long_proc unpack_long; - - accessor_pack_double_proc pack_double; - accessor_pack_float_proc pack_float; - accessor_unpack_double_proc unpack_double; - accessor_unpack_float_proc unpack_float; - - accessor_pack_string_proc pack_string; - accessor_unpack_string_proc unpack_string; - - accessor_pack_string_array_proc pack_string_array; - accessor_unpack_string_array_proc unpack_string_array; - - accessor_pack_bytes_proc pack_bytes; - accessor_unpack_bytes_proc unpack_bytes; - - accessor_pack_expression_proc pack_expression; - - accessor_notify_change_proc notify_change; - accessor_update_size_proc update_size; - - accessor_preferred_size_proc preferred_size; - accessor_resize_proc resize; - - accessor_nearest_proc nearest_smaller_value; - accessor_next_proc next; - accessor_compare_proc compare; - accessor_unpack_double_element_proc unpack_double_element; - accessor_unpack_float_element_proc unpack_float_element; - accessor_unpack_double_element_set_proc unpack_double_element_set; - accessor_unpack_float_element_set_proc unpack_float_element_set; - accessor_unpack_double_subarray_proc unpack_double_subarray; - accessor_clear_proc clear; - accessor_clone_proc make_clone; -}; typedef struct grib_multi_support grib_multi_support; struct grib_multi_support @@ -1434,6 +1285,8 @@ typedef struct j2k_encode_helper #ifdef __cplusplus } +#include "accessor/grib_accessor.h" +#include "accessor/grib_accessors_list.h" #endif #endif diff --git a/src/grib_buffer.cc b/src/grib_buffer.cc index 525e59f31..cb313141c 100644 --- a/src/grib_buffer.cc +++ b/src/grib_buffer.cc @@ -123,14 +123,14 @@ static void update_offsets(grib_accessor* a, long len) grib_context_log(a->context, GRIB_LOG_DEBUG, "::::: grib_buffer : accessor %s is moving by %d bytes to %ld", a->name, len, a->offset); if (s) update_offsets(s->block->first, len); - a = a->next; + a = a->next_; } } static void update_offsets_after(grib_accessor* a, long len) { while (a) { - update_offsets(a->next, len); + update_offsets(a->next_, len); a = a->parent->owner; } } @@ -152,10 +152,10 @@ static void update_offsets_after(grib_accessor* a, long len) // { // int ret; // if(s->owner) -// plen = grib_get_next_position_offset(s->block->last) - s->owner->offset; +// plen = s->block->last->get_next_position_offset() - s->owner->offset; // else -// plen = grib_get_next_position_offset(s->block->last); -// if((ret = grib_pack_long(s->aclength, &plen, &len)) != GRIB_SUCCESS) +// plen = s->block->last->get_next_position_offset(); +// if((ret = s->aclength->pack_long(&plen, &len)) != GRIB_SUCCESS) // ; // // if(s->h->context->debug) @@ -174,19 +174,19 @@ static void update_offsets_after(grib_accessor* a, long len) // { // int ret; // if(s->owner) -// plen = grib_get_next_position_offset(s->block->last) - s->owner->offset; +// plen = s->block->last->get_next_position_offset() - s->owner->offset; // else -// plen = grib_get_next_position_offset(s->block->last); +// plen = s->block->last->get_next_position_offset(); // /* if(s->owner) */ // /* s->owner->length = plen; */ // /* if(s->aclength) */ -// if((ret = grib_pack_long(s->aclength, &plen, &len)) != GRIB_SUCCESS) +// if((ret = s->aclength->pack_long(&plen, &len)) != GRIB_SUCCESS) // ; // if(s->h->context->debug) // { // printf("SECTION updating length %ld .. %s\n",plen,s->owner->name); // printf("NEXT_POS = %ld, owner offset= %ld %s %s\n", -// grib_get_next_position_offset(s->block->last), +// s->block->last->get_next_position_offset(), // s->owner ? s->owner->offset : 0L, s->owner->name, // s->block->last->name); // } @@ -199,7 +199,7 @@ int grib_buffer_replace(grib_accessor* a, const unsigned char* data, size_t newsize, int update_lengths, int update_paddings) { size_t offset = a->offset; - long oldsize = grib_get_next_position_offset(a) - offset; + long oldsize = a->get_next_position_offset() - offset; long increase = (long)newsize - (long)oldsize; grib_buffer* buffer = grib_handle_of_accessor(a)->buffer; @@ -231,7 +231,7 @@ int grib_buffer_replace(grib_accessor* a, const unsigned char* data, if (increase) { update_offsets_after(a, increase); if (update_lengths) { - grib_update_size(a, newsize); + a->update_size(newsize); int err = grib_section_adjust_sizes(grib_handle_of_accessor(a)->root, 1, 0); if (err) return err; if (update_paddings) diff --git a/src/grib_bufr_descriptor.cc b/src/grib_bufr_descriptor.cc index fcaeeac46..6b7f2b3ce 100644 --- a/src/grib_bufr_descriptor.cc +++ b/src/grib_bufr_descriptor.cc @@ -9,8 +9,9 @@ */ -#include "grib_scaling.h" #include "grib_api_internal.h" +#include "accessor/grib_accessor_class_bufr_data_array.h" +#include "grib_scaling.h" bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int silent, int* err) { diff --git a/src/grib_dependency.cc b/src/grib_dependency.cc index 4c417173e..37c89dbbf 100644 --- a/src/grib_dependency.cc +++ b/src/grib_dependency.cc @@ -124,7 +124,7 @@ int grib_dependency_notify_change(grib_accessor* observed) while (d) { if (d->run) { /*printf("grib_dependency_notify_change %s %s %p\n", observed->name, d->observer ? d->observer->name : "?", (void*)d->observer);*/ - if (d->observer && (ret = grib_accessor_notify_change(d->observer, observed)) != GRIB_SUCCESS) + if (d->observer && (ret = d->observer->notify_change(observed)) != GRIB_SUCCESS) return ret; } d = d->next; @@ -149,7 +149,7 @@ int grib_dependency_notify_change_h(grib_handle* h, grib_accessor* observed) while (d) { if (d->run) { /*printf("grib_dependency_notify_change %s %s %p\n",observed->name,d->observer ? d->observer->name : "?", (void*)d->observer);*/ - if (d->observer && (ret = grib_accessor_notify_change(d->observer, observed)) != GRIB_SUCCESS) + if (d->observer && (ret = d->observer->notify_change(observed)) != GRIB_SUCCESS) return ret; } d = d->next; diff --git a/src/grib_dumper_class.cc b/src/grib_dumper_class.cc index abd1cbf02..4af527151 100644 --- a/src/grib_dumper_class.cc +++ b/src/grib_dumper_class.cc @@ -52,8 +52,8 @@ void grib_dump_accessors_block(grib_dumper* dumper, grib_block_of_accessors* blo { grib_accessor* a = block->first; while (a) { - grib_accessor_dump(a, dumper); - a = a->next; + a->dump(dumper); + a = a->next_; } } @@ -61,8 +61,8 @@ void grib_dump_accessors_list(grib_dumper* dumper, grib_accessors_list* al) { grib_accessors_list* cur = al; while (cur) { - grib_accessor_dump(cur->accessor, dumper); - cur = cur->next; + cur->accessor->dump(dumper); + cur = cur->next_; } } @@ -70,7 +70,7 @@ int grib_print(grib_handle* h, const char* name, grib_dumper* d) { grib_accessor* act = grib_find_accessor(h, name); if (act) { - grib_accessor_dump(act, d); + act->dump(d); return GRIB_SUCCESS; } return GRIB_NOT_FOUND; @@ -106,7 +106,7 @@ void grib_dump_keys(grib_handle* h, FILE* f, const char* mode, unsigned long fla for (i = 0; i < num_keys; ++i) { acc = grib_find_accessor(h, keys[i]); if (acc) - grib_accessor_dump(acc, dumper); + acc->dump(dumper); } grib_dumper_delete(dumper); } diff --git a/src/grib_dumper_class_bufr_decode_C.cc b/src/grib_dumper_class_bufr_decode_C.cc index 49805279b..6811cdf94 100644 --- a/src/grib_dumper_class_bufr_decode_C.cc +++ b/src/grib_dumper_class_bufr_decode_C.cc @@ -150,11 +150,11 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_double(a, &value, &size); + err = a->unpack_double(&value, &size); } self->empty = 0; @@ -220,11 +220,11 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_double(a, &value, &size); + err = a->unpack_double(&value, &size); } self->empty = 0; @@ -279,7 +279,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { @@ -305,7 +305,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) } if (size <= 1) { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); } self->empty = 0; @@ -368,11 +368,11 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); } self->empty = 0; @@ -428,7 +428,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); self->empty = 0; r = compute_bufr_key_rank(h, self->keys, a->name); @@ -477,7 +477,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -497,7 +497,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; } - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); if (self->isLeaf == 0) { if ((r = compute_bufr_key_rank(h, self->keys, a->name)) != 0) @@ -545,7 +545,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; r = compute_bufr_key_rank(h, self->keys, a->name); if (grib_is_missing_string(a, (unsigned char*)value, size)) { @@ -656,7 +656,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix self->isLeaf = a->attributes[i]->attributes[0] == NULL ? 1 : 0; flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long_attribute(d, a->attributes[i], prefix); break; diff --git a/src/grib_dumper_class_bufr_decode_filter.cc b/src/grib_dumper_class_bufr_decode_filter.cc index 0fff0fc14..87cb0e2fe 100644 --- a/src/grib_dumper_class_bufr_decode_filter.cc +++ b/src/grib_dumper_class_bufr_decode_filter.cc @@ -140,11 +140,11 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_double(a, &value, &size); + err = a->unpack_double(&value, &size); } self->begin = 0; @@ -199,11 +199,11 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_double(a, &value, &size); + err = a->unpack_double(&value, &size); } self->empty = 0; @@ -244,7 +244,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { @@ -270,7 +270,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) } if (size <= 1) { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); } self->begin = 0; @@ -353,7 +353,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); self->begin = 0; self->empty = 0; @@ -399,7 +399,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -457,7 +457,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; r = compute_bufr_key_rank(h, self->keys, a->name); if (grib_is_missing_string(a, (unsigned char*)value, size)) { @@ -569,7 +569,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix /* fprintf(out,"\"%s\" : ",a->attributes[i]->name); */ flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long_attribute(d, a->attributes[i], prefix); break; diff --git a/src/grib_dumper_class_bufr_decode_fortran.cc b/src/grib_dumper_class_bufr_decode_fortran.cc index b07f59b49..dbc4ed271 100644 --- a/src/grib_dumper_class_bufr_decode_fortran.cc +++ b/src/grib_dumper_class_bufr_decode_fortran.cc @@ -142,11 +142,11 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_double(a, &value, &size); + err = a->unpack_double(&value, &size); } self->empty = 0; @@ -202,11 +202,11 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_double(a, &value, &size); + err = a->unpack_double(&value, &size); } self->empty = 0; @@ -249,7 +249,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { @@ -275,7 +275,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) } if (size <= 1) { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); } self->empty = 0; @@ -331,11 +331,11 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); } self->empty = 0; @@ -384,7 +384,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); self->empty = 0; r = compute_bufr_key_rank(h, self->keys, a->name); @@ -429,7 +429,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -485,7 +485,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; r = compute_bufr_key_rank(h, self->keys, a->name); if (grib_is_missing_string(a, (unsigned char*)value, size)) { @@ -595,7 +595,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix self->isLeaf = a->attributes[i]->attributes[0] == NULL ? 1 : 0; flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long_attribute(d, a->attributes[i], prefix); break; diff --git a/src/grib_dumper_class_bufr_decode_python.cc b/src/grib_dumper_class_bufr_decode_python.cc index 632cbe98b..3e2edc70a 100644 --- a/src/grib_dumper_class_bufr_decode_python.cc +++ b/src/grib_dumper_class_bufr_decode_python.cc @@ -150,11 +150,11 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_double(a, &value, &size); + err = a->unpack_double(&value, &size); } self->empty = 0; @@ -213,11 +213,11 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_double(a, &value, &size); + err = a->unpack_double(&value, &size); } self->empty = 0; @@ -265,7 +265,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { @@ -291,7 +291,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) } if (size <= 1) { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); } self->empty = 0; @@ -345,11 +345,11 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size <= 1) { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); } self->empty = 0; @@ -397,7 +397,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); self->empty = 0; r = compute_bufr_key_rank(h, self->keys, a->name); @@ -445,7 +445,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -498,7 +498,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; r = compute_bufr_key_rank(h, self->keys, a->name); if (grib_is_missing_string(a, (unsigned char*)value, size)) { @@ -605,7 +605,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix self->isLeaf = a->attributes[i]->attributes[0] == NULL ? 1 : 0; flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long_attribute(d, a->attributes[i], prefix); break; diff --git a/src/grib_dumper_class_bufr_encode_C.cc b/src/grib_dumper_class_bufr_encode_C.cc index 568a035bb..915649814 100644 --- a/src/grib_dumper_class_bufr_encode_C.cc +++ b/src/grib_dumper_class_bufr_encode_C.cc @@ -168,15 +168,15 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -264,15 +264,15 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -357,7 +357,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) } doing_unexpandedDescriptors = (strcmp(a->name, "unexpandedDescriptors") == 0); - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { @@ -385,10 +385,10 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -488,15 +488,15 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -568,7 +568,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); self->empty = 0; r = compute_bufr_key_rank(h, self->keys, a->name); @@ -614,7 +614,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -633,7 +633,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; } - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); for (i = 0; i < size - 1; i++) { fprintf(self->dumper.out, " svalues[%lu]=\"%s\"; \n", (unsigned long)i, values[i]); } @@ -697,7 +697,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; r = compute_bufr_key_rank(h, self->keys, acc_name); if (grib_is_missing_string(a, (unsigned char*)value, size)) { @@ -833,7 +833,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix self->isLeaf = a->attributes[i]->attributes[0] == NULL ? 1 : 0; flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long_attribute(d, a->attributes[i], prefix); break; diff --git a/src/grib_dumper_class_bufr_encode_filter.cc b/src/grib_dumper_class_bufr_encode_filter.cc index 49c4d19ef..a90ab0f56 100644 --- a/src/grib_dumper_class_bufr_encode_filter.cc +++ b/src/grib_dumper_class_bufr_encode_filter.cc @@ -144,15 +144,15 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -234,15 +234,15 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -306,7 +306,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { @@ -333,10 +333,10 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -416,15 +416,15 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -489,7 +489,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); self->begin = 0; self->empty = 0; @@ -538,7 +538,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -563,7 +563,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; } - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); fprintf(self->dumper.out, "{"); depth += 2; @@ -624,7 +624,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->begin = 0; self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; r = compute_bufr_key_rank(h, self->keys, a->name); if (grib_is_missing_string(a, (unsigned char*)value, size)) { @@ -759,7 +759,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix /* fprintf(out,"\"%s\" : ",a->attributes[i]->name); */ flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long_attribute(d, a->attributes[i], prefix); break; diff --git a/src/grib_dumper_class_bufr_encode_fortran.cc b/src/grib_dumper_class_bufr_encode_fortran.cc index e76bd0872..1e6cd3bd7 100644 --- a/src/grib_dumper_class_bufr_encode_fortran.cc +++ b/src/grib_dumper_class_bufr_encode_fortran.cc @@ -217,15 +217,15 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -312,15 +312,15 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -406,7 +406,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) } doing_unexpandedDescriptors = (strcmp(a->name, "unexpandedDescriptors") == 0); - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { @@ -433,10 +433,10 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -535,15 +535,15 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -620,7 +620,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); self->empty = 0; r = compute_bufr_key_rank(h, self->keys, a->name); @@ -665,7 +665,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -685,7 +685,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; } - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); for (i = 0; i < size - 1; i++) { fprintf(self->dumper.out, " \"%s\", &\n", values[i]); @@ -747,7 +747,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; r = compute_bufr_key_rank(h, self->keys, acc_name); if (grib_is_missing_string(a, (unsigned char*)value, size)) { @@ -880,7 +880,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix self->isLeaf = a->attributes[i]->attributes[0] == NULL ? 1 : 0; flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long_attribute(d, a->attributes[i], prefix); break; diff --git a/src/grib_dumper_class_bufr_encode_python.cc b/src/grib_dumper_class_bufr_encode_python.cc index 34367c913..565bc34ac 100644 --- a/src/grib_dumper_class_bufr_encode_python.cc +++ b/src/grib_dumper_class_bufr_encode_python.cc @@ -164,15 +164,15 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -258,15 +258,15 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -351,7 +351,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) } doing_unexpandedDescriptors = (strcmp(a->name, "unexpandedDescriptors") == 0); - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { @@ -378,10 +378,10 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -478,15 +478,15 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -558,7 +558,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); self->empty = 0; r = compute_bufr_key_rank(h, self->keys, a->name); @@ -603,7 +603,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -620,7 +620,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; } - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); for (i = 0; i < size - 1; i++) { fprintf(self->dumper.out, " \"%s\", \n", values[i]); @@ -680,7 +680,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; r = compute_bufr_key_rank(h, self->keys, acc_name); if (grib_is_missing_string(a, (unsigned char*)value, size)) { @@ -814,7 +814,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix self->isLeaf = a->attributes[i]->attributes[0] == NULL ? 1 : 0; flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long_attribute(d, a->attributes[i], prefix); break; diff --git a/src/grib_dumper_class_bufr_simple.cc b/src/grib_dumper_class_bufr_simple.cc index ca4701f38..868b81ba5 100644 --- a/src/grib_dumper_class_bufr_simple.cc +++ b/src/grib_dumper_class_bufr_simple.cc @@ -141,15 +141,15 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -231,15 +231,15 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(c, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); @@ -304,7 +304,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) { @@ -314,7 +314,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) /* Note: the "subsetNumber" key is only there for UNCOMPRESSED BUFR messages */ if (self->numberOfSubsets > 1 && strcmp(a->name, "subsetNumber") == 0) { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); DEBUG_ASSERT(!err); fprintf(self->dumper.out, "%s=%ld\n", a->name, value); DEBUG_ASSERT(!grib_is_missing_long(a, value)); @@ -340,10 +340,10 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -432,15 +432,15 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -504,7 +504,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); self->empty = 0; @@ -554,7 +554,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -576,7 +576,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; } - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); fprintf(self->dumper.out, "{"); for (i = 0; i < size - 1; i++) { @@ -631,7 +631,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); if (err) { fprintf(self->dumper.out, " *** ERR=%d (%s) [dump_string on '%s']", err, grib_get_error_message(err), acc_name); return; @@ -768,7 +768,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a, const char* prefix /* fprintf(out,"\"%s\" : ",a->attributes[i]->name); */ flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long_attribute(d, a->attributes[i], prefix); break; diff --git a/src/grib_dumper_class_debug.cc b/src/grib_dumper_class_debug.cc index 77206c829..ead1c7cf4 100644 --- a/src/grib_dumper_class_debug.cc +++ b/src/grib_dumper_class_debug.cc @@ -188,14 +188,14 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) (d->option_flags & GRIB_DUMP_FLAG_READ_ONLY) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size); + err = a->unpack_long(values, &size); } else { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); } set_begin_end(d, a); @@ -234,14 +234,14 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) } } else { - if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) + if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal()) fprintf(self->dumper.out, "%ld-%ld %s %s = MISSING", self->begin, self->theEnd, a->creator->op, a->name); else fprintf(self->dumper.out, "%ld-%ld %s %s = %ld", self->begin, self->theEnd, a->creator->op, a->name, value); if (comment) fprintf(self->dumper.out, " [%s]", comment); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) - fprintf(self->dumper.out, " (%s)", grib_get_type_name(grib_accessor_get_native_type(a))); + fprintf(self->dumper.out, " (%s)", grib_get_type_name(a->get_native_type())); if ((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) fprintf(self->dumper.out, " %s", "(can be missing)"); if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) @@ -266,7 +266,7 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_debug* self = (grib_dumper_debug*)d; long value = 0; size_t size = 1; - int err = grib_unpack_long(a, &value, &size); + int err = a->unpack_long(&value, &size); int i; if (a->length == 0 && @@ -303,7 +303,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_debug* self = (grib_dumper_debug*)d; double value = 0; size_t size = 1; - int err = grib_unpack_double(a, &value, &size); + int err = a->unpack_double(&value, &size); int i; if (a->length == 0 && @@ -315,14 +315,14 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) for (i = 0; i < d->depth; i++) fprintf(self->dumper.out, " "); - if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) + if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal()) fprintf(self->dumper.out, "%ld-%ld %s %s = MISSING", self->begin, self->theEnd, a->creator->op, a->name); else fprintf(self->dumper.out, "%ld-%ld %s %s = %g", self->begin, self->theEnd, a->creator->op, a->name, value); if (comment) fprintf(self->dumper.out, " [%s]", comment); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) - fprintf(self->dumper.out, " (%s)", grib_get_type_name(grib_accessor_get_native_type(a))); + fprintf(self->dumper.out, " (%s)", grib_get_type_name(a->get_native_type())); if (err) fprintf(self->dumper.out, " *** ERR=%d (%s) [grib_dumper_debug::dump_double]", err, grib_get_error_message(err)); aliases(d, a); @@ -342,7 +342,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) return; grib_get_string_length_acc(a, &size); - if ((size < 2) && grib_is_missing_internal(a)) { + if ((size < 2) && a->is_missing_internal()) { /* GRIB-302: transients and missing keys. Need to re-adjust the size */ size = 10; /* big enough to hold the string "missing" */ } @@ -350,7 +350,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) value = (char*)grib_context_malloc_clear(a->context, size); if (!value) return; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); if (err) strcpy(value, ""); @@ -372,7 +372,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) if (comment) fprintf(self->dumper.out, " [%s]", comment); if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) - fprintf(self->dumper.out, " (%s)", grib_get_type_name(grib_accessor_get_native_type(a))); + fprintf(self->dumper.out, " (%s)", grib_get_type_name(a->get_native_type())); if (err) fprintf(self->dumper.out, " *** ERR=%d (%s) [grib_dumper_debug::dump_string]", err, grib_get_error_message(err)); @@ -412,7 +412,7 @@ static void dump_bytes(grib_dumper* d, grib_accessor* a, const char* comment) fprintf(self->dumper.out, "\n"); - err = grib_unpack_bytes(a, buf, &size); + err = a->unpack_bytes(buf, &size); if (err) { grib_context_free(d->context, buf); fprintf(self->dumper.out, " *** ERR=%d (%s) [grib_dumper_debug::dump_bytes]\n}", err, grib_get_error_message(err)); @@ -463,7 +463,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) (d->option_flags & GRIB_DUMP_FLAG_CODED) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_double(d, a, NULL); @@ -489,7 +489,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) fprintf(self->dumper.out, "\n"); - err = grib_unpack_double(a, buf, &size); + err = a->unpack_double(buf, &size); if (err) { grib_context_free(d->context, buf); fprintf(self->dumper.out, " *** ERR=%d (%s) [grib_dumper_debug::dump_values]\n}", err, grib_get_error_message(err)); @@ -567,10 +567,10 @@ static void set_begin_end(grib_dumper* d, grib_accessor* a) grib_dumper_debug* self = (grib_dumper_debug*)d; if ((d->option_flags & GRIB_DUMP_FLAG_OCTET) != 0) { self->begin = a->offset - self->section_offset + 1; - self->theEnd = grib_get_next_position_offset(a) - self->section_offset; + self->theEnd = a->get_next_position_offset() - self->section_offset; } else { self->begin = a->offset; - self->theEnd = grib_get_next_position_offset(a); + self->theEnd = a->get_next_position_offset(); } } diff --git a/src/grib_dumper_class_default.cc b/src/grib_dumper_class_default.cc index e9bfdc702..819344cbe 100644 --- a/src/grib_dumper_class_default.cc +++ b/src/grib_dumper_class_default.cc @@ -147,7 +147,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; print_offset(self->dumper.out, d, a); @@ -159,10 +159,10 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -195,7 +195,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) grib_context_free(a->context, values); } else { - if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) + if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal()) fprintf(self->dumper.out, "%s = MISSING;", a->name); else fprintf(self->dumper.out, "%s = %ld;", a->name, value); @@ -224,12 +224,12 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) int err = 0; int isDouble = 0; - switch (grib_accessor_get_native_type(a)) { + switch (a->get_native_type()) { case GRIB_TYPE_LONG: - grib_unpack_long(a, &lvalue, &size); + a->unpack_long(&lvalue, &size); break; case GRIB_TYPE_DOUBLE: - grib_unpack_double(a, &dvalue, &size); + a->unpack_double(&dvalue, &size); isDouble = 1; break; default: @@ -269,7 +269,7 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) else fprintf(self->dumper.out, " "); - if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) + if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal()) fprintf(self->dumper.out, "%s = MISSING;", a->name); else { if (isDouble) @@ -292,7 +292,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_default* self = (grib_dumper_default*)d; double value = 0; size_t size = 1; - int err = grib_unpack_double(a, &value, &size); + int err = a->unpack_double(&value, &size); if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; @@ -318,7 +318,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) else fprintf(self->dumper.out, " "); - if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) + if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal()) fprintf(self->dumper.out, "%s = MISSING;", a->name); else fprintf(self->dumper.out, "%s = %g;", a->name, value); @@ -341,7 +341,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm int tab = 0; long count = 0; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -354,7 +354,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; } - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; @@ -420,7 +420,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) return; } - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; while (*p) { @@ -449,7 +449,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) else fprintf(self->dumper.out, " "); - if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) + if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal()) fprintf(self->dumper.out, "%s = MISSING;", a->name); else fprintf(self->dumper.out, "%s = %s;", a->name, value); @@ -499,7 +499,7 @@ static void dump_bytes(grib_dumper* d, grib_accessor* a, const char* comment) // fprintf(self->dumper.out,"\n"); -// err = grib_unpack_bytes(a,buf,&size); +// err = a->unpack_bytes(buf,&size); // if(err){ // grib_context_free(d->context,buf); // fprintf(self->dumper.out," *** ERR=%d (%s) [grib_dumper_default::dump_bytes]\n}",err,grib_get_error_message(err)); @@ -549,7 +549,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_double(d, a, NULL); @@ -562,7 +562,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) { char type_name[32] = ""; - const long native_type = grib_accessor_get_native_type(a); + const long native_type = a->get_native_type(); if (native_type == GRIB_TYPE_LONG) strcpy(type_name, "(int)"); else if (native_type == GRIB_TYPE_DOUBLE) @@ -596,7 +596,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) fprintf(self->dumper.out, "\n"); - err = grib_unpack_double(a, buf, &size); + err = a->unpack_double(buf, &size); if (err) { grib_context_free(d->context, buf); @@ -690,7 +690,7 @@ static void print_offset(FILE* out, grib_dumper* d, grib_accessor* a) grib_handle* h = grib_handle_of_accessor(a); theBegin = a->offset - self->section_offset + 1; - theEnd = grib_get_next_position_offset(a) - self->section_offset; + theEnd = a->get_next_position_offset() - self->section_offset; if ((d->option_flags & GRIB_DUMP_FLAG_HEXADECIMAL) != 0 && a->length != 0) { if (theBegin == theEnd) { diff --git a/src/grib_dumper_class_grib_encode_C.cc b/src/grib_dumper_class_grib_encode_C.cc index 5ecb6953d..5c41e11a0 100644 --- a/src/grib_dumper_class_grib_encode_C.cc +++ b/src/grib_dumper_class_grib_encode_C.cc @@ -130,7 +130,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_grib_encode_C* self = (grib_dumper_grib_encode_C*)d; long value; size_t size = 1; - int err = grib_unpack_long(a, &value, &size); + int err = a->unpack_long(&value, &size); if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY)) return; @@ -161,7 +161,7 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_grib_encode_C* self = (grib_dumper_grib_encode_C*)d; long value; size_t size = 1; - int err = grib_unpack_long(a, &value, &size); + int err = a->unpack_long(&value, &size); int i; char buf[1024]; @@ -201,7 +201,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_grib_encode_C* self = (grib_dumper_grib_encode_C*)d; double value; size_t size = 1; - int err = grib_unpack_double(a, &value, &size); + int err = a->unpack_double(&value, &size); if (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) return; @@ -221,7 +221,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_grib_encode_C* self = (grib_dumper_grib_encode_C*)d; char value[1024]; size_t size = sizeof(value); - int err = grib_unpack_string(a, value, &size); + int err = a->unpack_string(value, &size); if (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) return; @@ -260,7 +260,7 @@ static void dump_bytes(grib_dumper* d, grib_accessor* a, const char* comment) return; } - err = grib_unpack_bytes(a, buf, &size); + err = a->unpack_bytes(buf, &size); if (err) { grib_context_free(d->context, buf); fprintf(self->dumper.out, " *** ERR=%d (%s) [grib_dumper_grib_encode_C::dump_bytes]\n}", err, grib_get_error_message(err)); @@ -305,7 +305,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) || ((a->flags & GRIB_ACCESSOR_FLAG_DATA) && (d->option_flags & GRIB_DUMP_FLAG_NO_DATA))) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { @@ -313,7 +313,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) return; } - type = grib_accessor_get_native_type(a); + type = a->get_native_type(); switch (type) { case GRIB_TYPE_LONG: snprintf(stype, sizeof(stype), "%s", "long"); @@ -331,7 +331,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) return; } - err = grib_unpack_double(a, buf, &size); + err = a->unpack_double(buf, &size); if (err) { grib_context_free(d->context, buf); diff --git a/src/grib_dumper_class_json.cc b/src/grib_dumper_class_json.cc index a3b052844..dd0210521 100644 --- a/src/grib_dumper_class_json.cc +++ b/src/grib_dumper_class_json.cc @@ -129,15 +129,15 @@ static void dump_values(grib_dumper* d, grib_accessor* a) return; h = grib_handle_of_accessor(a); - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (double*)grib_context_malloc_clear(a->context, sizeof(double) * size); - err = grib_unpack_double(a, values, &size2); + err = a->unpack_double(values, &size2); } else { - err = grib_unpack_double(a, &value, &size2); + err = a->unpack_double(&value, &size2); } Assert(size2 == size); (void)err; /* TODO */ @@ -222,15 +222,15 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = size2 = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size2); + err = a->unpack_long(values, &size2); } else { - err = grib_unpack_long(a, &value, &size2); + err = a->unpack_long(&value, &size2); } Assert(size2 == size); @@ -327,7 +327,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_unpack_double(a, &value, &size); + a->unpack_double(&value, &size); if (self->begin == 0 && self->empty == 0 && self->isAttribute == 0) fprintf(self->dumper.out, ",\n"); @@ -374,7 +374,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm if ((a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { dump_string(d, a, comment); @@ -401,7 +401,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; } - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); if (self->isLeaf == 0) { fprintf(self->dumper.out, "%-*s", depth, " "); @@ -470,7 +470,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) self->empty = 0; - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); if (err) { snprintf(value, sizeof(value), " *** ERR=%d (%s) [dump_string on '%s']", err, grib_get_error_message(err), a->name); @@ -582,7 +582,7 @@ static void dump_attributes(grib_dumper* d, grib_accessor* a) fprintf(out, "\"%s\" : ", a->attributes[i]->name); flags = a->attributes[i]->flags; a->attributes[i]->flags |= GRIB_ACCESSOR_FLAG_DUMP; - switch (grib_accessor_get_native_type(a->attributes[i])) { + switch (a->attributes[i]->get_native_type()) { case GRIB_TYPE_LONG: dump_long(d, a->attributes[i], 0); break; diff --git a/src/grib_dumper_class_serialize.cc b/src/grib_dumper_class_serialize.cc index 6dc4d5c87..57f10cee0 100644 --- a/src/grib_dumper_class_serialize.cc +++ b/src/grib_dumper_class_serialize.cc @@ -102,7 +102,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_serialize* self = (grib_dumper_serialize*)d; long value = 0; size_t size = 1; - int err = grib_unpack_long(a, &value, &size); + int err = a->unpack_long(&value, &size); if ((a->flags & GRIB_ACCESSOR_FLAG_HIDDEN) != 0) return; @@ -136,7 +136,7 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_serialize* self = (grib_dumper_serialize*)d; long value; size_t size = 1; - int err = grib_unpack_long(a, &value, &size); + int err = a->unpack_long(&value, &size); if ((a->flags & GRIB_ACCESSOR_FLAG_HIDDEN) != 0) return; @@ -171,7 +171,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_serialize* self = (grib_dumper_serialize*)d; double value; size_t size = 1; - int err = grib_unpack_double(a, &value, &size); + int err = a->unpack_double(&value, &size); if ((a->flags & GRIB_ACCESSOR_FLAG_HIDDEN) != 0) return; @@ -200,7 +200,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) grib_dumper_serialize* self = (grib_dumper_serialize*)d; char value[1024] = {0,}; size_t size = sizeof(value); - int err = grib_unpack_string(a, value, &size); + int err = a->unpack_string(value, &size); int i; char* p = value; @@ -261,7 +261,7 @@ static void dump_bytes(grib_dumper* d, grib_accessor* a, const char* comment) fprintf(self->dumper.out, "\n"); - err = grib_unpack_bytes(a, buf, &size); + err = a->unpack_bytes(buf, &size); if (err) { grib_context_free(d->context, buf); fprintf(self->dumper.out, " *** ERR=%d (%s) [grib_dumper_serialize::dump_bytes]\n}", err, grib_get_error_message(err)); @@ -319,7 +319,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY)) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (self->format) { @@ -376,7 +376,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) fprintf(self->dumper.out, "\n"); - err = grib_unpack_double(a, buf, &size); + err = a->unpack_double(buf, &size); if (err) { grib_context_free(d->context, buf); diff --git a/src/grib_dumper_class_wmo.cc b/src/grib_dumper_class_wmo.cc index 814ed016f..3949e97a2 100644 --- a/src/grib_dumper_class_wmo.cc +++ b/src/grib_dumper_class_wmo.cc @@ -152,15 +152,15 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) (d->option_flags & GRIB_DUMP_FLAG_CODED) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size > 1) { values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * size); - err = grib_unpack_long(a, values, &size); + err = a->unpack_long(values, &size); } else { - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); } if ((a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0 && @@ -192,7 +192,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment) } } else { - if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) + if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal()) fprintf(self->dumper.out, "%s = MISSING", a->name); else fprintf(self->dumper.out, "%s = %ld", a->name, value); @@ -228,7 +228,7 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment) (d->option_flags & GRIB_DUMP_FLAG_CODED) != 0) return; - err = grib_unpack_long(a, &value, &size); + err = a->unpack_long(&value, &size); set_begin_end(d, a); //for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," "); @@ -274,7 +274,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) (d->option_flags & GRIB_DUMP_FLAG_CODED) != 0) return; - err = grib_unpack_double(a, &value, &size); + err = a->unpack_double(&value, &size); set_begin_end(d, a); //for(i = 0; i < d->depth ; i++) fprintf(self->dumper.out," "); @@ -283,7 +283,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) fprintf(self->dumper.out, "%s (double) ", a->creator->op); - if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a)) + if (((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && a->is_missing_internal()) fprintf(self->dumper.out, "%s = MISSING", a->name); else fprintf(self->dumper.out, "%s = %g", a->name, value); @@ -317,7 +317,7 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) grib_context_log(a->context, GRIB_LOG_ERROR, "unable to allocate %zu bytes", size); return; } - err = grib_unpack_string(a, value, &size); + err = a->unpack_string(value, &size); p = value; set_begin_end(d, a); @@ -381,7 +381,7 @@ static void dump_bytes(grib_dumper* d, grib_accessor* a, const char* comment) fprintf(self->dumper.out, "\n"); - err = grib_unpack_bytes(a, buf, &size); + err = a->unpack_bytes(buf, &size); if (err) { grib_context_free(d->context, buf); fprintf(self->dumper.out, " *** ERR=%d (%s) [grib_dumper_wmo::dump_bytes]\n}", err, grib_get_error_message(err)); @@ -433,7 +433,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) (d->option_flags & GRIB_DUMP_FLAG_CODED) != 0) return; - grib_value_count(a, &count); + a->value_count(&count); size = count; if (size == 1) { @@ -452,7 +452,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) print_offset(self->dumper.out, self->begin, self->theEnd, 12); // ECC-1749 if ((d->option_flags & GRIB_DUMP_FLAG_TYPE) != 0) { char type_name[32] = ""; - const long native_type = grib_accessor_get_native_type(a); + const long native_type = a->get_native_type(); if (native_type == GRIB_TYPE_LONG) strcpy(type_name, "(int)"); else if (native_type == GRIB_TYPE_DOUBLE) @@ -476,7 +476,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a) fprintf(self->dumper.out, "\n"); - err = grib_unpack_double(a, buf, &size); + err = a->unpack_double(buf, &size); if (err) { grib_context_free(d->context, buf); @@ -566,11 +566,11 @@ static void set_begin_end(grib_dumper* d, grib_accessor* a) grib_dumper_wmo* self = (grib_dumper_wmo*)d; if ((d->option_flags & GRIB_DUMP_FLAG_OCTET) != 0) { self->begin = a->offset - self->section_offset + 1; - self->theEnd = grib_get_next_position_offset(a) - self->section_offset; + self->theEnd = a->get_next_position_offset() - self->section_offset; } else { self->begin = a->offset; - self->theEnd = grib_get_next_position_offset(a); + self->theEnd = a->get_next_position_offset(); } } @@ -604,7 +604,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; c = a->context; - grib_value_count(a, &count); + a->value_count(&count); if (count == 0) return; size = count; @@ -619,7 +619,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm return; } - err = grib_unpack_string_array(a, values, &size); + err = a->unpack_string_array(values, &size); // print_offset(self->dumper.out,d,a); print_offset(self->dumper.out, self->begin, self->theEnd); diff --git a/src/grib_expression_class_accessor.cc b/src/grib_expression_class_accessor.cc index 39fe4f109..064cc2051 100644 --- a/src/grib_expression_class_accessor.cc +++ b/src/grib_expression_class_accessor.cc @@ -174,10 +174,11 @@ grib_expression* new_accessor_expression(grib_context* c, const char* name, long static int native_type(grib_expression* g, grib_handle* h) { grib_expression_accessor* e = (grib_expression_accessor*)g; - int type = 0; + int type = 0; int err; - if ((err = grib_get_native_type(h, e->name, &type)) != GRIB_SUCCESS) + if ((err = grib_get_native_type(h, e->name, &type)) != GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_ERROR, - "Error in native_type %s : %s", e->name, grib_get_error_message(err)); + "Error in evaluating the type of '%s': %s", e->name, grib_get_error_message(err)); + } return type; } diff --git a/src/grib_expression_class_binop.cc b/src/grib_expression_class_binop.cc index 328bb2ac4..5caefd701 100644 --- a/src/grib_expression_class_binop.cc +++ b/src/grib_expression_class_binop.cc @@ -83,7 +83,6 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) { long v1 = 0; long v2 = 0; - int ret; grib_expression_binop* e = (grib_expression_binop*)g; // #if DEBUGGING @@ -100,7 +99,7 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) // printf("\n"); // } - ret = grib_expression_evaluate_long(h, e->left, &v1); + int ret = grib_expression_evaluate_long(h, e->left, &v1); if (ret != GRIB_SUCCESS) return ret; @@ -116,8 +115,6 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* dres) { double v1 = 0.0; double v2 = 0.0; - int ret; - grib_expression_binop* e = (grib_expression_binop*)g; // #if DEBUGGING @@ -134,7 +131,7 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* dres) // printf("\n"); // } - ret = grib_expression_evaluate_double(h, e->left, &v1); + int ret = grib_expression_evaluate_double(h, e->left, &v1); if (ret != GRIB_SUCCESS) return ret; diff --git a/src/grib_expression_class_functor.cc b/src/grib_expression_class_functor.cc index 4664def10..530654ea2 100644 --- a/src/grib_expression_class_functor.cc +++ b/src/grib_expression_class_functor.cc @@ -92,18 +92,31 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) return ret; } + if (STR_EQUAL(e->name, "size")) { + *lres = 0; + const char* keyName = grib_arguments_get_name(h, e->args, 0); + if (keyName) { + size_t size = 0; + int err = grib_get_size(h, keyName, &size); + if (err) return err; + *lres = (long)size; + return GRIB_SUCCESS; + } + return GRIB_INVALID_ARGUMENT; + } + if (STR_EQUAL(e->name, "missing")) { - const char* p = grib_arguments_get_name(h, e->args, 0); - if (p) { + const char* keyName = grib_arguments_get_name(h, e->args, 0); + if (keyName) { long val = 0; int err = 0; if (h->product_kind == PRODUCT_BUFR) { - int ismiss = grib_is_missing(h, p, &err); + int ismiss = grib_is_missing(h, keyName, &err); if (err) return err; *lres = ismiss; return GRIB_SUCCESS; } - err = grib_get_long_internal(h, p, &val); + err = grib_get_long_internal(h, keyName, &val); if (err) return err; // Note: This does not cope with keys like typeOfSecondFixedSurface // which are codetable entries with values like 255: this value is @@ -120,11 +133,10 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) } if (STR_EQUAL(e->name, "defined")) { - const char* p = grib_arguments_get_name(h, e->args, 0); - - if (p) { - const grib_accessor* a = grib_find_accessor(h, p); - *lres = a != NULL ? 1 : 0; + const char* keyName = grib_arguments_get_name(h, e->args, 0); + if (keyName) { + const grib_accessor* a = grib_find_accessor(h, keyName); + *lres = a != NULL ? 1 : 0; return GRIB_SUCCESS; } *lres = 0; @@ -156,11 +168,51 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) return GRIB_SUCCESS; } + if (STR_EQUAL(e->name, "is_one_of")) { + *lres = 0; + const char* keyName = grib_arguments_get_name(h, e->args, 0); + if (!keyName) return GRIB_INVALID_ARGUMENT; + int type = 0; + int err = grib_get_native_type(h, keyName, &type); + if (err) return err; + int n = grib_arguments_get_count(e->args); + if (type == GRIB_TYPE_STRING) { + char keyValue[254] = {0,}; + size_t len = sizeof(keyValue); + err = grib_get_string(h, keyName, keyValue, &len); + if (err) return err; + for (int i = 1; i < n; ++i) { // skip 1st argument which is the key + const char* sValue = grib_arguments_get_string(h, e->args, i); + if (sValue && STR_EQUAL(keyValue, sValue)) { + *lres = 1; + return GRIB_SUCCESS; + } + } + } + else if (type == GRIB_TYPE_LONG) { + long keyValue = 0; + err = grib_get_long(h, keyName, &keyValue); + if (err) return err; + for (int i = 1; i < n; ++i) { // skip 1st argument which is the key + long lValue = grib_arguments_get_long(h, e->args, i); + if (keyValue == lValue) { + *lres = 1; + return GRIB_SUCCESS; + } + } + } + else if (type == GRIB_TYPE_DOUBLE) { + return GRIB_NOT_IMPLEMENTED; + } + return GRIB_SUCCESS; + } + if (STR_EQUAL(e->name, "gribex_mode_on")) { *lres = h->context->gribex_mode_on ? 1 : 0; return GRIB_SUCCESS; } + grib_context_log(h->context, GRIB_LOG_ERROR, "grib_expression_class_functor::%s failed for '%s'", __func__, e->name); return GRIB_NOT_IMPLEMENTED; } diff --git a/src/grib_expression_class_unop.cc b/src/grib_expression_class_unop.cc index 6188b4586..ae7678043 100644 --- a/src/grib_expression_class_unop.cc +++ b/src/grib_expression_class_unop.cc @@ -17,6 +17,7 @@ CLASS = expression IMPLEMENTS = destroy IMPLEMENTS = native_type + IMPLEMENTS = get_name IMPLEMENTS = evaluate_long IMPLEMENTS = evaluate_double IMPLEMENTS = print @@ -42,6 +43,7 @@ typedef const char* string; /* to keep make_class.pl happy */ static void destroy(grib_context*,grib_expression* e); static void print(grib_context*,grib_expression*,grib_handle*); static void add_dependency(grib_expression* e, grib_accessor* observer); +static string get_name(grib_expression* e); static int native_type(grib_expression*,grib_handle*); static int evaluate_long(grib_expression*,grib_handle*,long*); static int evaluate_double(grib_expression*,grib_handle*,double*); @@ -65,7 +67,7 @@ static grib_expression_class _grib_expression_class_unop = { &print, &add_dependency, &native_type, - 0, + &get_name, &evaluate_long, &evaluate_double, 0, @@ -97,6 +99,12 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* dres) return GRIB_SUCCESS; } +static const char* get_name(grib_expression* g) +{ + grib_expression_unop* e = (grib_expression_unop*)g; + return grib_expression_get_name(e->exp); +} + static void print(grib_context* c, grib_expression* g, grib_handle* f) { grib_expression_unop* e = (grib_expression_unop*)g; @@ -111,7 +119,6 @@ static void destroy(grib_context* c, grib_expression* g) grib_expression_free(c, e->exp); } - static void add_dependency(grib_expression* g, grib_accessor* observer) { grib_expression_unop* e = (grib_expression_unop*)g; diff --git a/src/grib_handle.cc b/src/grib_handle.cc index 732537f12..a1801650a 100644 --- a/src/grib_handle.cc +++ b/src/grib_handle.cc @@ -54,7 +54,7 @@ static void update_sections(grib_section* s, grib_handle* h, long offset) a->offset += offset; /* update_sections ( grib_get_sub_section ( a ),h,offset ); */ update_sections(a->sub_section, h, offset); - a = a->next; + a = a->next_; } } @@ -74,7 +74,7 @@ void grib_swap_sections(grib_section* the_old, grib_section* the_new) a = the_old->block->first; while (a) { a->parent = the_old; - a = a->next; + a = a->next_; } update_sections(the_old, the_old->h, the_old->owner->offset); @@ -94,12 +94,12 @@ void grib_empty_section(grib_context* c, grib_section* b) current = b->block->first; while (current) { - grib_accessor* next = current->next; + grib_accessor* next = current->next_; if (current->sub_section) { grib_section_delete(c, current->sub_section); current->sub_section = 0; } - grib_accessor_delete(c, current); + current->destroy(c); current = next; } b->block->first = b->block->last = 0; @@ -231,7 +231,7 @@ grib_handle* codes_handle_new_from_samples(grib_context* c, const char* name) if (!g) { grib_context_log(c, GRIB_LOG_ERROR, "Unable to load sample file '%s.tmpl'\n" - " from %s\n" + " samples path='%s'\n" " (ecCodes Version=%s)", name, c->grib_samples_path, ECCODES_VERSION_STR); } @@ -637,7 +637,6 @@ static grib_handle* grib_handle_new_multi(grib_context* c, unsigned char** data, while (grib2_get_next_section((unsigned char*)message, olen, &secbegin, &seclen, &secnum, &err)) { // seccount++; /*printf(" - %d - section %d length=%d\n",(int)seccount,(int)secnum,(int)seclen);*/ - gm->sections[secnum] = secbegin; gm->sections_length[secnum] = seclen; @@ -686,6 +685,11 @@ static grib_handle* grib_handle_new_multi(grib_context* c, unsigned char** data, break; } } + // ECC-782 + if (err == GRIB_INVALID_SECTION_NUMBER) { + grib_context_log(c, GRIB_LOG_ERROR, "%s: Failed to get section info (%s)", __func__, grib_get_error_message(err)); + return NULL; + } } else if (edition == 3) { *error = GRIB_UNSUPPORTED_EDITION; @@ -840,6 +844,11 @@ static grib_handle* grib_handle_new_from_file_multi(grib_context* c, FILE* f, in break; } } + // ECC-782 + if (err == GRIB_INVALID_SECTION_NUMBER) { + grib_context_log(c, GRIB_LOG_ERROR, "%s: Failed to get section info (%s)", __func__, grib_get_error_message(err)); + return NULL; + } } else if (edition == 3) { /* GRIB3: Multi-field mode not yet supported */ diff --git a/src/grib_index.cc b/src/grib_index.cc index b6eb0b3a2..211b30cb5 100644 --- a/src/grib_index.cc +++ b/src/grib_index.cc @@ -1290,6 +1290,11 @@ static int codes_index_add_file_internal(grib_index* index, const char* filename grib_context_log(c, GRIB_LOG_ERROR, "File %s contains no messages", filename); return GRIB_END_OF_FILE; } + + if (c->debug) { + fprintf(stderr, "ECCODES DEBUG %s %s\n", __func__, filename); + grib_index_dump(stderr, index, GRIB_DUMP_FLAG_TYPE); + } return GRIB_SUCCESS; } diff --git a/src/grib_iterator_class_healpix.cc b/src/grib_iterator_class_healpix.cc index 7befaf894..6a545b6c5 100644 --- a/src/grib_iterator_class_healpix.cc +++ b/src/grib_iterator_class_healpix.cc @@ -83,9 +83,9 @@ grib_iterator_class* grib_iterator_class_healpix = &_grib_iterator_class_healpix static void init_class(grib_iterator_class* c) { - c->previous = (*(c->super))->previous; - c->reset = (*(c->super))->reset; - c->has_next = (*(c->super))->has_next; + c->previous = (*(c->super))->previous; + c->reset = (*(c->super))->reset; + c->has_next = (*(c->super))->has_next; } /* END_CLASS_IMP */ diff --git a/src/grib_iterator_class_lambert_azimuthal_equal_area.cc b/src/grib_iterator_class_lambert_azimuthal_equal_area.cc index a945ee1d2..24dba1877 100644 --- a/src/grib_iterator_class_lambert_azimuthal_equal_area.cc +++ b/src/grib_iterator_class_lambert_azimuthal_equal_area.cc @@ -209,7 +209,11 @@ static int init_oblate(grib_handle* h, sinphi_ = sin(standardParallelInRadians); /* (P->phi0); */ Q__sinb1 = pj_qsfn(sinphi_, e, one_es) / Q__qp; Q__cosb1 = sqrt(1.0 - Q__sinb1 * Q__sinb1); - Q__dd = cos(standardParallelInRadians) / (sqrt(1. - es * sinphi_ * sinphi_) * Q__rq * Q__cosb1); + if (Q__cosb1 == 0) { + Q__dd = 1.0; + } else { + Q__dd = cos(standardParallelInRadians) / (sqrt(1. - es * sinphi_ * sinphi_) * Q__rq * Q__cosb1); + } Q__ymf = (Q__xmf = Q__rq) / Q__dd; Q__xmf *= Q__dd; @@ -253,7 +257,12 @@ static int init_oblate(grib_handle* h, xy_y *= Q__dd; rho = hypot(xy_x, xy_y); Assert(rho >= EPS10); /* TODO(masn): check */ - sCe = 2. * asin(.5 * rho / Q__rq); + const double asin_arg = (0.5 * rho / Q__rq); + if (asin_arg < -1.0 || asin_arg > 1.0) { + grib_context_log(h->context, GRIB_LOG_ERROR, "Invalid value: arcsin argument=%g", asin_arg); + return GRIB_GEOCALCULUS_PROBLEM; + } + sCe = 2. * asin(asin_arg); cCe = cos(sCe); sCe = sin(sCe); xy_x *= sCe; diff --git a/src/grib_keys_iterator.cc b/src/grib_keys_iterator.cc index 854b4a2c5..06c112c04 100644 --- a/src/grib_keys_iterator.cc +++ b/src/grib_keys_iterator.cc @@ -165,11 +165,11 @@ int grib_keys_iterator_next(grib_keys_iterator* kiter) kiter->at_start = 0; } else { - kiter->current = grib_next_accessor(kiter->current); + kiter->current = kiter->current->next_accessor(); } while (kiter->current && skip(kiter)) - kiter->current = grib_next_accessor(kiter->current); + kiter->current = kiter->current->next_accessor(); return kiter->current != NULL; } @@ -200,29 +200,29 @@ int grib_keys_iterator_delete(grib_keys_iterator* kiter) int grib_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_t* len) { - return grib_unpack_long(kiter->current, v, len); + return kiter->current->unpack_long(v, len); } int grib_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, size_t* len) { - return grib_unpack_double(kiter->current, v, len); + return kiter->current->unpack_double(v, len); } int grib_keys_iterator_get_float(const grib_keys_iterator* kiter, float* v, size_t* len) { - return grib_unpack_float(kiter->current, v, len); + return kiter->current->unpack_float(v, len); } int grib_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len) { - return grib_unpack_string(kiter->current, v, len); + return kiter->current->unpack_string(v, len); } int grib_keys_iterator_get_bytes(const grib_keys_iterator* kiter, unsigned char* v, size_t* len) { - return grib_unpack_bytes(kiter->current, v, len); + return kiter->current->unpack_bytes(v, len); } int grib_keys_iterator_get_native_type(const grib_keys_iterator* kiter) { - return grib_accessor_get_native_type(kiter->current); + return kiter->current->get_native_type(); } diff --git a/src/grib_loader_from_handle.cc b/src/grib_loader_from_handle.cc index 765915bbd..f26c68c21 100644 --- a/src/grib_loader_from_handle.cc +++ b/src/grib_loader_from_handle.cc @@ -27,14 +27,14 @@ static int copy_values(grib_handle* h, grib_accessor* ga) /*printf("SET VALUES %s\n",h->values[j][i].name);*/ switch (h->values[j][i].type) { case GRIB_TYPE_LONG: - return grib_pack_long(ga, &h->values[j][i].long_value, &len); + return ga->pack_long(&h->values[j][i].long_value, &len); case GRIB_TYPE_DOUBLE: - return grib_pack_double(ga, &h->values[j][i].double_value, &len); + return ga->pack_double(&h->values[j][i].double_value, &len); case GRIB_TYPE_STRING: len = strlen(h->values[j][i].string_value); - return grib_pack_string(ga, h->values[j][i].string_value, &len); + return ga->pack_string(h->values[j][i].string_value, &len); } } } @@ -50,7 +50,7 @@ int grib_lookup_long_from_handle(grib_context* gc, grib_loader* loader, const ch grib_accessor* b = grib_find_accessor(h, name); size_t len = 1; if (b) - return grib_unpack_long(b, value, &len); + return b->unpack_long(value, &len); /* TODO: fix me. For now, we don't fail on a lookup. */ *value = -1; @@ -80,7 +80,7 @@ int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_ if (default_value) { grib_context_log(h->context, GRIB_LOG_DEBUG, "Copying: setting %s to default value", ga->name); - grib_pack_expression(ga, grib_arguments_get_expression(h, default_value, 0)); + ga->pack_expression(grib_arguments_get_expression(h, default_value, 0)); } if ((ga->flags & GRIB_ACCESSOR_FLAG_NO_COPY) || @@ -153,11 +153,11 @@ int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_ } if ((ga->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) && grib_is_missing(h, name, &e) && e == GRIB_SUCCESS && len == 1) { - grib_pack_missing(ga); + ga->pack_missing(); pack_missing = 1; } - const long ga_type = grib_accessor_get_native_type(ga); + const long ga_type = ga->get_native_type(); if ((ga->flags & GRIB_ACCESSOR_FLAG_COPY_IF_CHANGING_EDITION) && !loader->changing_edition) { // See ECC-1560 and ECC-1644 @@ -173,7 +173,7 @@ int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_ ret = grib_get_string_internal(h, name, sval, &len); if (ret == GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_DEBUG, "Copying string %s to %s", sval, name); - ret = grib_pack_string(ga, sval, &len); + ret = ga->pack_string(sval, &len); } grib_context_free(h->context, sval); @@ -203,7 +203,7 @@ int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_ *lval = 0; /* Reset to a reasonable value */ } } - ret = grib_pack_long(ga, lval, &len); + ret = ga->pack_long(lval, &len); } } @@ -224,7 +224,7 @@ int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_ ret = GRIB_SUCCESS; } else - ret = grib_pack_double(ga, dval, &len); + ret = ga->pack_double(dval, &len); } grib_context_free(h->context, dval); @@ -233,13 +233,13 @@ int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_ case GRIB_TYPE_BYTES: ao = grib_find_accessor(h, name); - len = grib_byte_count(ao); + len = ao->byte_count(); uval = (unsigned char*)grib_context_malloc(h->context, len * sizeof(char)); - ret = grib_unpack_bytes(ao, uval, &len); + ret = ao->unpack_bytes(uval, &len); /* ret = grib_get_bytes_internal(h,name,uval,&len); */ if (ret == GRIB_SUCCESS) { grib_context_log(h->context, GRIB_LOG_DEBUG, "Copying %d byte(s) to %s", len, name); - ret = grib_pack_bytes(ga, uval, &len); + ret = ga->pack_bytes(uval, &len); } grib_context_free(h->context, uval); @@ -251,7 +251,7 @@ int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_ default: grib_context_log(h->context, GRIB_LOG_ERROR, - "Copying %s, cannot establish type %ld [%s]", name, grib_accessor_get_native_type(ga), ga->creator->cclass->name); + "Copying %s, cannot establish type %ld [%s]", name, ga->get_native_type(), ga->creator->cclass->name); break; } diff --git a/src/grib_parse_utils.cc b/src/grib_parse_utils.cc index 1d014995c..51de29332 100644 --- a/src/grib_parse_utils.cc +++ b/src/grib_parse_utils.cc @@ -117,16 +117,16 @@ int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* una switch (type) { case GRIB_TYPE_STRING: replen = 1024; - ret = grib_unpack_string(a, val, &replen); + ret = a->unpack_string(val, &replen); break; case GRIB_TYPE_DOUBLE: replen = 1; - ret = grib_unpack_double(a, &dval, &replen); + ret = a->unpack_double(&dval, &replen); snprintf(val, sizeof(val), "%.12g", dval); break; case GRIB_TYPE_LONG: replen = 1; - ret = grib_unpack_long(a, &lval, &replen); + ret = a->unpack_long(&lval, &replen); snprintf(val, sizeof(val), "%d", (int)lval); break; default: @@ -194,11 +194,11 @@ int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* una // grib_handle* h = grib_handle_of_accessor(a); // if (type == -1) -// type = grib_accessor_get_native_type(a); +// type = a->get_native_type(); // switch (type) { // case GRIB_TYPE_STRING: // replen = sizeof(sbuf) / sizeof(*sbuf); -// ret = grib_unpack_string(a, sbuf, &replen); +// ret = a->unpack_string(sbuf, &replen); // fprintf(out, "%s", sbuf); // break; // case GRIB_TYPE_DOUBLE: @@ -206,7 +206,7 @@ int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* una // myseparator = separator ? (char*)separator : default_separator; // if (name[0] == '/' || name[0] == '#') { // long count; -// ret = grib_value_count(a, &count); +// ret = a->value_count(&count); // size = count; // } // else { @@ -216,7 +216,7 @@ int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* una // dval = (double*)grib_context_malloc_clear(h->context, sizeof(double) * size); // if (name[0] == '/' || name[0] == '#') { // replen = size; -// ret = grib_unpack_double(a, dval, &replen); +// ret = a->unpack_double(dval, &replen); // } // else { // replen = 0; @@ -247,7 +247,7 @@ int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* una // myseparator = separator ? (char*)separator : default_separator; // if (name[0] == '/' || name[0] == '#') { // long count; -// ret = grib_value_count(a, &count); +// ret = a->value_count(&count); // size = count; // } // else { @@ -257,7 +257,7 @@ int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* una // lval = (long*)grib_context_malloc_clear(h->context, sizeof(long) * size); // if (name[0] == '/' || name[0] == '#') { // replen = size; -// ret = grib_unpack_long(a, lval, &replen); +// ret = a->unpack_long(lval, &replen); // } // else { // replen = 0; @@ -286,7 +286,7 @@ int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* una // case GRIB_TYPE_BYTES: // replen = a->length; // sval = (char*)grib_context_malloc(h->context, replen * sizeof(char)); -// ret = grib_unpack_string(a, sval, &replen); +// ret = a->unpack_string(sval, &replen); // p = sval; // while ((replen--) > 0) // fprintf(out, "%c", *(p++)); @@ -321,15 +321,15 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha maxcols = INT_MAX; if (type == -1) - type = grib_accessor_get_native_type(al->accessor); - grib_accessors_list_value_count(al, &size); + type = al->accessor->get_native_type(); + al->value_count(&size); switch (type) { case GRIB_TYPE_STRING: myseparator = separator ? (char*)separator : default_separator; if (size == 1) { char sbuf[1024] = {0,}; len = sizeof(sbuf); - ret = grib_unpack_string(al->accessor, sbuf, &len); + ret = al->accessor->unpack_string(sbuf, &len); if (grib_is_missing_string(al->accessor, (unsigned char*)sbuf, len)) { fprintf(out, "%s", "MISSING"); } @@ -341,7 +341,7 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha int cols = 0; j = 0; cvals = (char**)grib_context_malloc_clear(h->context, sizeof(char*) * size); - grib_accessors_list_unpack_string(al, cvals, &size); + al->unpack_string(cvals, &size); for (j = 0; j < size; j++) { *newline = 1; fprintf(out, "%s", cvals[j]); @@ -362,7 +362,7 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha myformat = format ? (char*)format : double_format; myseparator = separator ? (char*)separator : default_separator; dval = (double*)grib_context_malloc_clear(h->context, sizeof(double) * size); - ret = grib_accessors_list_unpack_double(al, dval, &size); + ret = al->unpack_double(dval, &size); if (size == 1) fprintf(out, myformat, dval[0]); else { @@ -387,7 +387,7 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha myformat = format ? (char*)format : long_format; myseparator = separator ? (char*)separator : default_separator; lval = (long*)grib_context_malloc_clear(h->context, sizeof(long) * size); - ret = grib_accessors_list_unpack_long(al, lval, &size); + ret = al->unpack_long(lval, &size); if (size == 1) fprintf(out, myformat, lval[0]); else { @@ -411,7 +411,7 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha case GRIB_TYPE_BYTES: replen = a->length; bval = (unsigned char*)grib_context_malloc(h->context, replen * sizeof(unsigned char)); - ret = grib_unpack_bytes(al->accessor, bval, &replen); + ret = al->accessor->unpack_bytes(bval, &replen); for (j = 0; j < replen; j++) { fprintf(out, "%02x", bval[j]); } diff --git a/src/grib_query.cc b/src/grib_query.cc index 253217c0b..a1209efaf 100644 --- a/src/grib_query.cc +++ b/src/grib_query.cc @@ -14,6 +14,7 @@ * * ***************************************************************************/ #include "grib_api_internal.h" +#include "accessor/grib_accessor_class_bufr_data_array.h" /* Note: A fast cut-down version of strcmp which does NOT return -1 */ /* 0 means input strings are equal and 1 means not equal */ @@ -63,7 +64,7 @@ static grib_accessor* search(grib_section* s, const char* name, const char* name if ((b = search(sub, name, name_space)) != NULL) match = b; - a = a->next; + a = a->next_; } return match; @@ -94,7 +95,7 @@ static void rebuild_hash_keys(grib_handle* h, grib_section* s) i++; } rebuild_hash_keys(h, sub); - a = a->next; + a = a->next_; } } @@ -228,7 +229,7 @@ static grib_accessor* _search_by_rank(grib_accessor* a,const char* name,long ran if (r==rank) return al->accessor; r++; } - al=al->next; + al=al->next_; } return NULL; @@ -257,14 +258,14 @@ static int get_single_long_val(grib_accessor* a, long* result) size_t size = 1; if (c->bufr_multi_element_constant_arrays) { long count = 0; - grib_value_count(a, &count); + a->value_count(&count); if (count > 1) { size_t i = 0; long val0 = 0; int is_constant = 1; long* values = (long*)grib_context_malloc_clear(c, sizeof(long) * count); size = count; - err = grib_unpack_long(a, values, &size); + err = a->unpack_long(values, &size); val0 = values[0]; for (i = 0; i < size; i++) { if (val0 != values[i]) { @@ -281,11 +282,11 @@ static int get_single_long_val(grib_accessor* a, long* result) } } else { - err = grib_unpack_long(a, result, &size); + err = a->unpack_long(result, &size); } } else { - err = grib_unpack_long(a, result, &size); + err = a->unpack_long(result, &size); } return err; } @@ -296,14 +297,14 @@ static int get_single_double_val(grib_accessor* a, double* result) size_t size = 1; if (c->bufr_multi_element_constant_arrays) { long count = 0; - grib_value_count(a, &count); + a->value_count(&count); if (count > 1) { size_t i = 0; double val0 = 0; int is_constant = 1; double* values = (double*)grib_context_malloc_clear(c, sizeof(double) * count); size = count; - err = grib_unpack_double(a, values, &size); + err = a->unpack_double(values, &size); val0 = values[0]; for (i = 0; i < size; i++) { if (val0 != values[i]) { @@ -320,11 +321,11 @@ static int get_single_double_val(grib_accessor* a, double* result) } } else { - err = grib_unpack_double(a, result, &size); + err = a->unpack_double(result, &size); } } else { - err = grib_unpack_double(a, result, &size); + err = a->unpack_double(result, &size); } return err; } @@ -377,27 +378,27 @@ static void search_from_accessors_list(grib_accessors_list* al, const grib_acces while (al && al != end && al->accessor) { if (grib_inline_strcmp(al->accessor->name, accessor_name) == 0) { if (attribute_name[0]) { - accessor_result = grib_accessor_get_attribute(al->accessor, attribute_name); + accessor_result = al->accessor->get_attribute(attribute_name); } else { accessor_result = al->accessor; } if (accessor_result) { - grib_accessors_list_push(result, accessor_result, al->rank); + result->push(accessor_result, al->rank()); } } - al = al->next; + al = al->next_; } if (al == end && al->accessor) { if (grib_inline_strcmp(al->accessor->name, accessor_name) == 0) { if (attribute_name[0]) { - accessor_result = grib_accessor_get_attribute(al->accessor, attribute_name); + accessor_result = al->accessor->get_attribute(attribute_name); } else { accessor_result = al->accessor; } if (accessor_result) { - grib_accessors_list_push(result, accessor_result, al->rank); + result->push(accessor_result, al->rank()); } } } @@ -416,7 +417,7 @@ static void search_accessors_list_by_condition(grib_accessors_list* al, const ch if (start && !condition_true(al->accessor, condition)) end = al; } - if (start != NULL && (end != NULL || al->next == NULL)) { + if (start != NULL && (end != NULL || al->next_ == NULL)) { if (end == NULL) end = al; search_from_accessors_list(start, end, name, result); @@ -424,7 +425,7 @@ static void search_accessors_list_by_condition(grib_accessors_list* al, const ch start = NULL; end = NULL; } - al = al->next; + al = al->next_; } } @@ -452,7 +453,7 @@ static void grib_find_same_and_push(grib_accessors_list* al, grib_accessor* a) { if (a) { grib_find_same_and_push(al, a->same); - grib_accessors_list_push(al, a, al->rank); + al->push(a, al->rank()); } } @@ -484,7 +485,7 @@ grib_accessors_list* grib_find_accessors_list(const grib_handle* ch, const char* int r; al = (grib_accessors_list*)grib_context_malloc_clear(h->context, sizeof(grib_accessors_list)); str2 = get_rank(h->context, name, &r); - grib_accessors_list_push(al, a, r); + al->push(a, r); grib_context_free(h->context, str2); } } @@ -585,7 +586,7 @@ grib_accessor* grib_find_accessor(const grib_handle* h, const char* name) aret = a; } else if (a) { - aret = grib_accessor_get_attribute(a, attribute_name); + aret = a->get_attribute(attribute_name); grib_context_free(h->context, accessor_name); } } @@ -600,7 +601,7 @@ grib_accessor* grib_find_accessor(const grib_handle* h, const char* name) // *err = GRIB_NOT_FOUND; // return NULL; // } -// if ((act = grib_accessor_get_attribute(a, attr_name)) == NULL) { +// if ((act = a->get_attribute(attr_name)) == NULL) { // *err = GRIB_ATTRIBUTE_NOT_FOUND; // return NULL; // } diff --git a/src/grib_value.cc b/src/grib_value.cc index 1320bc9b7..1142fa6a6 100644 --- a/src/grib_value.cc +++ b/src/grib_value.cc @@ -13,9 +13,10 @@ #include "grib_api_internal.h" #include "grib_value.h" -#include "grib_accessor.h" +//#include "grib_accessor.h" #include #include +#include /* Note: A fast cut-down version of strcmp which does NOT return -1 */ /* 0 means input strings are equal and 1 means not equal */ @@ -46,7 +47,7 @@ static void print_debug_info__set_array(grib_handle* h, const char* func, const if (length <= N) N = length; - fprintf(stderr, "ECCODES DEBUG %s key=%s, %zu entries (", func, name, length); + fprintf(stderr, "ECCODES DEBUG %s h=%p key=%s, %zu entries (", func, (void*)h, name, length); for (i = 0; i < N; ++i) { if (i != 0) fprintf(stderr,", "); fprintf(stderr, "%.10g", val[i]); @@ -70,7 +71,7 @@ int grib_set_expression(grib_handle* h, const char* name, grib_expression* e) if (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) return GRIB_READ_ONLY; - ret = grib_pack_expression(a, e); + ret = a->pack_expression(e); if (ret == GRIB_SUCCESS) { return grib_dependency_notify_change(a); } @@ -89,10 +90,10 @@ int grib_set_long_internal(grib_handle* h, const char* name, long val) a = grib_find_accessor(h, name); if (h->context->debug) - fprintf(stderr, "ECCODES DEBUG grib_set_long_internal %s=%ld\n", name, val); + fprintf(stderr, "ECCODES DEBUG grib_set_long_internal h=%p %s=%ld\n", (void*)h, name, val); if (a) { - ret = grib_pack_long(a, &val, &l); + ret = a->pack_long(&val, &l); if (ret == GRIB_SUCCESS) { return grib_dependency_notify_change(a); } @@ -117,15 +118,15 @@ int grib_set_long(grib_handle* h, const char* name, long val) if (a) { if (h->context->debug) { if (strcmp(name, a->name)!=0) - fprintf(stderr, "ECCODES DEBUG grib_set_long %s=%ld (a->name=%s)\n", name, val, a->name); + fprintf(stderr, "ECCODES DEBUG grib_set_long h=%p %s=%ld (a->name=%s)\n", (void*)h, name, val, a->name); else - fprintf(stderr, "ECCODES DEBUG grib_set_long %s=%ld\n", name, val); + fprintf(stderr, "ECCODES DEBUG grib_set_long h=%p %s=%ld\n", (void*)h, name, val); } if (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) return GRIB_READ_ONLY; - ret = grib_pack_long(a, &val, &l); + ret = a->pack_long(&val, &l); if (ret == GRIB_SUCCESS) return grib_dependency_notify_change(a); @@ -133,7 +134,7 @@ int grib_set_long(grib_handle* h, const char* name, long val) } if (h->context->debug) { - fprintf(stderr, "ECCODES DEBUG grib_set_long %s=%ld (Key not found)\n", name, val); + fprintf(stderr, "ECCODES DEBUG grib_set_long h=%p %s=%ld (Key not found)\n", (void*)h, name, val); } return GRIB_NOT_FOUND; @@ -148,10 +149,10 @@ int grib_set_double_internal(grib_handle* h, const char* name, double val) a = grib_find_accessor(h, name); if (h->context->debug) - fprintf(stderr, "ECCODES DEBUG grib_set_double_internal %s=%.10g\n", name, val); + fprintf(stderr, "ECCODES DEBUG grib_set_double_internal h=%p %s=%.10g\n", (void*)h, name, val); if (a) { - ret = grib_pack_double(a, &val, &l); + ret = a->pack_double(&val, &l); if (ret == GRIB_SUCCESS) { return grib_dependency_notify_change(a); } @@ -349,15 +350,15 @@ int grib_set_double(grib_handle* h, const char* name, double val) if (a) { if (h->context->debug) { if (strcmp(name, a->name)!=0) - fprintf(stderr, "ECCODES DEBUG grib_set_double %s=%.10g (a->name=%s)\n", name, val, a->name); + fprintf(stderr, "ECCODES DEBUG grib_set_double h=%p %s=%.10g (a->name=%s)\n", (void*)h, name, val, a->name); else - fprintf(stderr, "ECCODES DEBUG grib_set_double %s=%.10g\n", name, val); + fprintf(stderr, "ECCODES DEBUG grib_set_double h=%p %s=%.10g\n", (void*)h, name, val); } if (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) return GRIB_READ_ONLY; - ret = grib_pack_double(a, &val, &l); + ret = a->pack_double(&val, &l); if (ret == GRIB_SUCCESS) return grib_dependency_notify_change(a); @@ -375,10 +376,10 @@ int grib_set_string_internal(grib_handle* h, const char* name, a = grib_find_accessor(h, name); if (h->context->debug) - fprintf(stderr, "ECCODES DEBUG grib_set_string_internal %s=%s\n", name, val); + fprintf(stderr, "ECCODES DEBUG grib_set_string_internal h=%p %s=%s\n", (void*)h, name, val); if (a) { - ret = grib_pack_string(a, val, length); + ret = a->pack_string(val, length); if (ret == GRIB_SUCCESS) { return grib_dependency_notify_change(a); } @@ -467,15 +468,15 @@ int grib_set_string(grib_handle* h, const char* name, const char* val, size_t* l if (a) { if (h->context->debug) { if (strcmp(name, a->name)!=0) - fprintf(stderr, "ECCODES DEBUG grib_set_string %s=|%s| (a->name=%s)\n", name, val, a->name); + fprintf(stderr, "ECCODES DEBUG grib_set_string h=%p %s=|%s| (a->name=%s)\n", (void*)h, name, val, a->name); else - fprintf(stderr, "ECCODES DEBUG grib_set_string %s=|%s|\n", name, val); + fprintf(stderr, "ECCODES DEBUG grib_set_string h=%p %s=|%s|\n", (void*)h, name, val); } if (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) return GRIB_READ_ONLY; - ret = grib_pack_string(a, val, length); + ret = a->pack_string(val, length); if (ret == GRIB_SUCCESS) { return grib_dependency_notify_change(a); } @@ -497,14 +498,14 @@ int grib_set_string_array(grib_handle* h, const char* name, const char** val, si a = grib_find_accessor(h, name); if (h->context->debug) { - fprintf(stderr, "ECCODES DEBUG grib_set_string_array key=%s %zu values\n", name, length); + fprintf(stderr, "ECCODES DEBUG grib_set_string_array h=%p key=%s %zu values\n", (void*)h, name, length); } if (a) { if (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) return GRIB_READ_ONLY; - ret = grib_pack_string_array(a, val, &length); + ret = a->pack_string_array(val, &length); if (ret == GRIB_SUCCESS) { return grib_dependency_notify_change(a); } @@ -519,7 +520,7 @@ int grib_set_string_array(grib_handle* h, const char* name, const char** val, si // grib_accessor* a = NULL; // a = grib_find_accessor(h, name); // if (a) { -// ret = grib_pack_bytes(a, val, length); +// ret = a->pack_bytes(val, length); // if (ret == GRIB_SUCCESS) { // return grib_dependency_notify_change(a); // } @@ -540,7 +541,7 @@ int grib_set_bytes(grib_handle* h, const char* name, const unsigned char* val, s /* if(a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) */ /* return GRIB_READ_ONLY; */ - ret = grib_pack_bytes(a, val, length); + ret = a->pack_bytes(val, length); if (ret == GRIB_SUCCESS) { return grib_dependency_notify_change(a); } @@ -557,7 +558,7 @@ int grib_set_bytes(grib_handle* h, const char* name, const unsigned char* val, s // if (a) { // if (a->length == 0) // return 0; -// if ((ret = grib_pack_zero(a)) != GRIB_SUCCESS) +// if ((ret = a->grib_pack_zero()) != GRIB_SUCCESS) // grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to clear %s (%s)", // name, grib_get_error_message(ret)); // return ret; @@ -579,9 +580,9 @@ int grib_set_missing(grib_handle* h, const char* name) if (grib_accessor_can_be_missing(a, &ret)) { if (h->context->debug) - fprintf(stderr, "ECCODES DEBUG grib_set_missing %s\n", name); + fprintf(stderr, "ECCODES DEBUG grib_set_missing h=%p %s\n", (void*)h, name); - ret = grib_pack_missing(a); + ret = a->pack_missing(); if (ret == GRIB_SUCCESS) return grib_dependency_notify_change(a); } @@ -637,7 +638,7 @@ int grib_accessor_is_missing(grib_accessor* a, int* err) *err = GRIB_SUCCESS; if (a) { if (a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) - return grib_is_missing_internal(a); + return a->is_missing_internal(); else return 0; } @@ -697,7 +698,7 @@ static int _grib_set_double_array_internal(grib_handle* h, grib_accessor* a, if (err == GRIB_SUCCESS) { size_t len = buffer_len - *encoded_length; if (len) { - err = grib_pack_double(a, val + *encoded_length, &len); + err = a->pack_double(val + *encoded_length, &len); *encoded_length += len; if (err == GRIB_SUCCESS) { /* See ECC-778 */ @@ -729,7 +730,7 @@ static int _grib_set_double_array(grib_handle* h, const char* name, if (name[0] == '/' || name[0] == '#') { if (check && (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY)) return GRIB_READ_ONLY; - err = grib_pack_double(a, val, &length); + err = a->pack_double(val, &length); encoded = length; } else @@ -754,7 +755,7 @@ int grib_set_double_array_internal(grib_handle* h, const char* name, const doubl if (length == 0) { grib_accessor* a = grib_find_accessor(h, name); - ret = grib_pack_double(a, val, &length); + ret = a->pack_double(val, &length); } else { ret = _grib_set_double_array(h, name, val, length, 0); @@ -783,7 +784,7 @@ static int __grib_set_double_array(grib_handle* h, const char* name, const doubl if (length == 0) { grib_accessor* a = grib_find_accessor(h, name); - return grib_pack_double(a, val, &length); + return a->pack_double(val, &length); } /*second order doesn't have a proper representation for constant fields @@ -873,7 +874,7 @@ static int _grib_set_long_array_internal(grib_handle* h, grib_accessor* a, const if (err == GRIB_SUCCESS) { size_t len = buffer_len - *encoded_length; if (len) { - err = grib_pack_long(a, val + *encoded_length, &len); + err = a->pack_long(val + *encoded_length, &len); *encoded_length += len; } else { @@ -903,7 +904,7 @@ static int _grib_set_long_array(grib_handle* h, const char* name, const long* va size_t N = 5; if (length <= N) N = length; - fprintf(stderr, "ECCODES DEBUG _grib_set_long_array key=%s %zu values (", name, length); + fprintf(stderr, "ECCODES DEBUG _grib_set_long_array h=%p key=%s %zu values (", (void*)h, name, length); for (i = 0; i < N; ++i) fprintf(stderr, " %ld,", val[i]); if (N >= length) @@ -915,7 +916,7 @@ static int _grib_set_long_array(grib_handle* h, const char* name, const long* va if (name[0] == '/' || name[0] == '#') { if (check && (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY)) return GRIB_READ_ONLY; - err = grib_pack_long(a, val, &length); + err = a->pack_long(val, &length); encoded = length; } else @@ -989,14 +990,14 @@ int grib_get_long(const grib_handle* h, const char* name, long* val) al = grib_find_accessors_list(h, name); if (!al) return GRIB_NOT_FOUND; - ret = grib_unpack_long(al->accessor, val, &length); + ret = al->accessor->unpack_long(val, &length); grib_context_free(h->context, al); } else { a = grib_find_accessor(h, name); if (!a) return GRIB_NOT_FOUND; - ret = grib_unpack_long(a, val, &length); + ret = a->unpack_long(val, &length); } return ret; } @@ -1024,14 +1025,14 @@ int grib_get_double(const grib_handle* h, const char* name, double* val) al = grib_find_accessors_list(h, name); if (!al) return GRIB_NOT_FOUND; - ret = grib_unpack_double(al->accessor, val, &length); + ret = al->accessor->unpack_double(val, &length); grib_context_free(h->context, al); } else { a = grib_find_accessor(h, name); if (!a) return GRIB_NOT_FOUND; - ret = grib_unpack_double(a, val, &length); + ret = a->unpack_double(val, &length); } return ret; } @@ -1047,14 +1048,14 @@ int grib_get_float(const grib_handle* h, const char* name, float* val) al = grib_find_accessors_list(h, name); if (!al) return GRIB_NOT_FOUND; - ret = grib_unpack_float(al->accessor, val, &length); + ret = al->accessor->unpack_float(val, &length); grib_context_free(h->context, al); } else { a = grib_find_accessor(h, name); if (!a) return GRIB_NOT_FOUND; - ret = grib_unpack_float(a, val, &length); + ret = a->unpack_float(val, &length); } return ret; } @@ -1076,7 +1077,7 @@ int grib_get_double_element(const grib_handle* h, const char* name, int i, doubl grib_accessor* act = grib_find_accessor(h, name); if (act) { - return grib_unpack_double_element(act, i, val); + return act->unpack_double_element(i, val); } return GRIB_NOT_FOUND; } @@ -1085,7 +1086,7 @@ int grib_get_float_element(const grib_handle* h, const char* name, int i, float* grib_accessor* act = grib_find_accessor(h, name); if (act) { - return grib_unpack_float_element(act, i, val); + return act->unpack_float_element(i, val); } return GRIB_NOT_FOUND; } @@ -1118,7 +1119,7 @@ int grib_get_double_element_set(const grib_handle* h, const char* name, const si grib_accessor* acc = grib_find_accessor(h, name); if (acc) { - return grib_unpack_double_element_set(acc, index_array, len, val_array); + return acc->unpack_double_element_set(index_array, len, val_array); } return GRIB_NOT_FOUND; } @@ -1127,7 +1128,7 @@ int grib_get_float_element_set(const grib_handle* h, const char* name, const siz grib_accessor* acc = grib_find_accessor(h, name); if (acc) { - return grib_unpack_float_element_set(acc, index_array, len, val_array); + return acc->unpack_float_element_set(index_array, len, val_array); } return GRIB_NOT_FOUND; } @@ -1168,7 +1169,7 @@ int grib_get_double_elements(const grib_handle* h, const char* name, const int* return GRIB_OUT_OF_MEMORY; } - err = grib_unpack_double(act, values, &size); + err = act->unpack_double(values, &size); if (!err) { for (j = 0; j < len; j++) { val_array[j] = values[index_array[j]]; @@ -1206,7 +1207,7 @@ int grib_get_string(const grib_handle* h, const char* name, char* val, size_t* l al = grib_find_accessors_list(h, name); if (!al) return GRIB_NOT_FOUND; - ret = grib_unpack_string(al->accessor, val, length); + ret = al->accessor->unpack_string(val, length); grib_context_free(h->context, al); return ret; } @@ -1214,7 +1215,7 @@ int grib_get_string(const grib_handle* h, const char* name, char* val, size_t* l a = grib_find_accessor(h, name); if (!a) return GRIB_NOT_FOUND; - return grib_unpack_string(a, val, length); + return a->unpack_string(val, length); } } @@ -1232,7 +1233,7 @@ int grib_get_bytes(const grib_handle* h, const char* name, unsigned char* val, s { int err = 0; grib_accessor* act = grib_find_accessor(h, name); - err = act ? grib_unpack_bytes(act, val, length) : GRIB_NOT_FOUND; + err = act ? act->unpack_bytes(val, length) : GRIB_NOT_FOUND; if (err) grib_context_log(h->context, GRIB_LOG_ERROR, "grib_get_bytes %s failed %s", name, grib_get_error_message(err)); @@ -1251,14 +1252,14 @@ int grib_get_native_type(const grib_handle* h, const char* name, int* type) al = grib_find_accessors_list(h, name); if (!al) return GRIB_NOT_FOUND; - *type = grib_accessor_get_native_type(al->accessor); + *type = al->accessor->get_native_type(); grib_context_free(h->context, al); } else { a = grib_find_accessor(h, name); if (!a) return GRIB_NOT_FOUND; - *type = grib_accessor_get_native_type(a); + *type = a->get_native_type(); } return GRIB_SUCCESS; @@ -1279,7 +1280,12 @@ static int _grib_get_array_internal(const grib_handle* h, grib_accessor* a, T* v if (err == GRIB_SUCCESS) { size_t len = buffer_len - *decoded_length; - err = grib_unpack(a, val + *decoded_length, &len); + if constexpr (std::is_same::value) { + err = a->unpack_double(val + *decoded_length, &len); + } + else if constexpr (std::is_same::value) { + err = a->unpack_float(val + *decoded_length, &len); + } *decoded_length += len; } @@ -1311,7 +1317,7 @@ int grib_get_double_array(const grib_handle* h, const char* name, double* val, s al = grib_find_accessors_list(h, name); if (!al) return GRIB_NOT_FOUND; - ret = grib_accessors_list_unpack_double(al, val, length); + ret = al->unpack_double(val, length); grib_accessors_list_delete(h->context, al); return ret; } @@ -1320,7 +1326,7 @@ int grib_get_double_array(const grib_handle* h, const char* name, double* val, s if (!a) return GRIB_NOT_FOUND; if (name[0] == '#') { - return grib_unpack(a, val, length); + return a->unpack_double(val, length); } else { *length = 0; @@ -1364,7 +1370,7 @@ int grib_get_string_length_acc(grib_accessor* a, size_t* size) *size = 0; while (a) { - s = grib_string_length(a); + s = a->string_length(); if (s > *size) *size = s; a = a->same; @@ -1407,7 +1413,7 @@ int grib_get_size_acc(const grib_handle* h, grib_accessor* a, size_t* size) *size = 0; while (a) { if (err == 0) { - err = grib_value_count(a, &count); + err = a->value_count(&count); if (err) return err; *size += count; @@ -1429,7 +1435,7 @@ int grib_get_size(const grib_handle* ch, const char* name, size_t* size) al = grib_find_accessors_list(h, name); if (!al) return GRIB_NOT_FOUND; - ret = grib_accessors_list_value_count(al, size); + ret = al->value_count(size); grib_accessors_list_delete(h->context, al); return ret; } @@ -1439,7 +1445,7 @@ int grib_get_size(const grib_handle* ch, const char* name, size_t* size) return GRIB_NOT_FOUND; if (name[0] == '#') { long count = *size; - ret = grib_value_count(a, &count); + ret = a->value_count(&count); *size = count; return ret; } @@ -1471,7 +1477,7 @@ int grib_get_offset(const grib_handle* ch, const char* key, size_t* val) const grib_handle* h = (grib_handle*)ch; grib_accessor* act = grib_find_accessor(h, key); if (act) { - *val = (size_t)grib_byte_offset(act); + *val = (size_t) act->byte_offset(); return GRIB_SUCCESS; } return GRIB_NOT_FOUND; @@ -1484,7 +1490,7 @@ static int grib_get_string_array_internal_(const grib_handle* h, grib_accessor* if (err == GRIB_SUCCESS) { size_t len = buffer_len - *decoded_length; - err = grib_unpack_string_array(a, val + *decoded_length, &len); + err = a->unpack_string_array(val + *decoded_length, &len); *decoded_length += len; } @@ -1506,7 +1512,7 @@ int grib_get_string_array(const grib_handle* h, const char* name, char** val, si al = grib_find_accessors_list(h, name); if (!al) return GRIB_NOT_FOUND; - ret = grib_accessors_list_unpack_string(al, val, length); + ret = al->unpack_string(val, length); grib_context_free(h->context, al); return ret; } @@ -1515,7 +1521,7 @@ int grib_get_string_array(const grib_handle* h, const char* name, char** val, si if (!a) return GRIB_NOT_FOUND; if (name[0] == '#') { - return grib_unpack_string_array(a, val, length); + return a->unpack_string_array(val, length); } else { *length = 0; @@ -1531,7 +1537,7 @@ static int _grib_get_long_array_internal(const grib_handle* h, grib_accessor* a, if (err == GRIB_SUCCESS) { size_t len = buffer_len - *decoded_length; - err = grib_unpack_long(a, val + *decoded_length, &len); + err = a->unpack_long(val + *decoded_length, &len); *decoded_length += len; } @@ -1565,7 +1571,7 @@ int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_ al = grib_find_accessors_list(h, name); if (!al) return GRIB_NOT_FOUND; - ret = grib_accessors_list_unpack_long(al, val, length); + ret = al->unpack_long(val, length); grib_context_free(h->context, al); } else { @@ -1573,7 +1579,7 @@ int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_ if (!a) return GRIB_NOT_FOUND; if (name[0] == '#') { - return grib_unpack_long(a, val, length); + return a->unpack_long(val, length); } else { *length = 0; @@ -1838,7 +1844,7 @@ int grib_get_nearest_smaller_value(grib_handle* h, const char* name, { grib_accessor* act = grib_find_accessor(h, name); Assert(act); - return grib_nearest_smaller_value(act, val, nearest); + return act->nearest_smaller_value(val, nearest); } void grib_print_values(const char* title, grib_values* values, FILE* out) @@ -2028,5 +2034,5 @@ int codes_compare_key(grib_handle* h1, grib_handle* h2, const char* key, int com return GRIB_NOT_FOUND; } - return grib_compare_accessors(a1, a2, GRIB_COMPARE_TYPES); + return a1->compare_accessors(a2, GRIB_COMPARE_TYPES); } diff --git a/src/shared_functions.cc b/src/shared_functions.cc new file mode 100644 index 000000000..fc6f090fb --- /dev/null +++ b/src/shared_functions.cc @@ -0,0 +1,47 @@ +#include "shared_functions.h" + + +/* Table of multipliers to convert step units to minutes */ +static const double u2m[] = { + 1, /* index 0: minutes */ + 60, /* index 1: hour */ + 24 * 60, /* index 2: day */ + 24 * 60 * 30, /* index 3: month */ + -1, /* index 4: year */ + -1, /* index 5: decade */ + -1, /* index 6: 30 years */ + -1, /* index 7: century */ + -1, /* index 8: RESERVED */ + -1, /* index 9: RESERVED */ + 3 * 60, /* index 10: 3 hours */ + 6 * 60, /* index 11: 6 hours */ + 12 * 60, /* index 12: 12 hours */ + 1 / 60.0, /* index 13: seconds */ + 15, /* index 14: 15 mins */ + 30 /* index 15: 30 mins */ +}; + + +void grib_set_bit_on(unsigned char* p, long* bitp){ + unsigned char o = 1; + p += (*bitp >> 3); + o <<= 7 - ((*bitp) % 8); + *p |= o; + (*bitp) += 1; +} + +long convert_to_minutes(long step, long stepUnits) +{ + double result = 0; + if (stepUnits == 0) + return step; /* unit=minutes so no change */ + if (stepUnits == 1) + return step * 60; /* unit=hours */ + if (stepUnits == 13) + return step / 60; /* unit=seconds */ + /* Assert( stepUnits < sizeof(u2m)/sizeof(u2m[0]) ); */ + + result = step * u2m[stepUnits]; + return (long)result; +} + diff --git a/src/shared_functions.h b/src/shared_functions.h new file mode 100644 index 000000000..04ae2f90f --- /dev/null +++ b/src/shared_functions.h @@ -0,0 +1,9 @@ +#ifndef eccodes_shared_functions_h +#define eccodes_shared_functions_h + +#include "grib_api_internal.h" + +void grib_set_bit_on(unsigned char*, long*); +long convert_to_minutes(long step, long stepUnits); + +#endif // eccodes_shared_functions_h diff --git a/src/step.cc b/src/step.cc index 81bdaeeb3..90c8ea2e1 100644 --- a/src/step.cc +++ b/src/step.cc @@ -32,10 +32,15 @@ Step step_from_string(const std::string& step, const Unit& force_unit) std::string unit_str = match[2]; Unit unit; if (unit_str.size() != 0) { - if (force_unit == Unit{Unit::Value::MISSING}) + if (force_unit == Unit{Unit::Value::MISSING}) { unit = Unit{unit_str}; - else - throw std::runtime_error("Cannot force unit when unit is specified in step string"); + } + else { + if (Unit{unit_str} == force_unit) + unit = Unit{unit_str}; + else + throw std::runtime_error("Cannot force unit when unit is specified in step string"); + } } else { if (force_unit == Unit{Unit::Value::MISSING}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0c915abeb..1c6cad8d9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -104,6 +104,8 @@ if( HAVE_BUILD_TOOLS ) grib_ifsParam grib_packing_order filter_substr + filter_size + filter_is_one_of filter_is_in_list filter_transient_darray grib_uerra @@ -145,6 +147,7 @@ if( HAVE_BUILD_TOOLS ) grib_ecc-1708 grib_ecc-1691 grib_ecc-1766 + grib_ecc-1806 grib_ecc-1829 bufr_ecc-1028 bufr_ecc-1195 @@ -153,6 +156,7 @@ if( HAVE_BUILD_TOOLS ) bufr_ecc-1304 bufr_ecc-1347 bufr_ecc-1395 + bufr_ecc-1840 bufr_json_samples bufr_ecc-359 bufr_ecc-517 @@ -224,6 +228,13 @@ if( HAVE_BUILD_TOOLS ) grib_keys_iter grib_keys_iter_skip grib_geo_iter + grib_to_json + grib_to_ppm + grib_merge + big2gribex + grib_sub_area_check + grib_list_keys + grib_histogram bufr_get_element bufr_wmo_tables bufr_extract_headers @@ -268,6 +279,7 @@ if( HAVE_BUILD_TOOLS ) grib_ecc-1467 grib_ecc-1764 grib_ecc-1792 + grib_ecc-1846 grib_sub_hourly grib_set_bytes grib_set_force diff --git a/tests/big2gribex.sh b/tests/big2gribex.sh new file mode 100755 index 000000000..acc78cdf2 --- /dev/null +++ b/tests/big2gribex.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +label="big2gribex_test" +tempGrib=temp.$label.grib + +if [ ! -x ${tools_dir}/big2gribex ]; then + exit 0 +fi + +set +e +${tools_dir}/big2gribex +status=$? +set -e +[ $status -ne 0 ] + +${tools_dir}/big2gribex $data_dir/test.grib1 $tempGrib + +# Clean up +rm -f $tempGrib diff --git a/tests/bufr_ecc-1840.sh b/tests/bufr_ecc-1840.sh new file mode 100755 index 000000000..34acb5bf6 --- /dev/null +++ b/tests/bufr_ecc-1840.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +REDIRECT=/dev/null + +label="bufr_ecc-1840_test" +tempBufr=temp.$label.bufr +tempFilt=temp.$label.filt +tempLog=temp.$label.log +tempOut=temp.$label.txt +tempRef=temp.$label.ref + +sample_bufr3=$ECCODES_SAMPLES_PATH/BUFR3.tmpl + +# This sample has: +# typicalYearOfCentury = 12 +# typicalMonth = 10 +# typicalDay = 31 +result=$(${tools_dir}/bufr_get -p typicalYear,typicalDate $sample_bufr3) +[ "$result" = "2012 20121031" ] +result=$(${tools_dir}/bufr_get -p typicalYear,typicalDate -s typicalCentury=20 $sample_bufr3) +[ "$result" = "1912 19121031" ] + + +# Clean up +rm -f $tempBufr $tempFilt $tempLog $tempOut $tempRef diff --git a/tests/bufr_extract_headers.sh b/tests/bufr_extract_headers.sh index 481a5cd2f..4b2b92b08 100755 --- a/tests/bufr_extract_headers.sh +++ b/tests/bufr_extract_headers.sh @@ -64,7 +64,7 @@ r=`${test_dir}/bufr_extract_headers centre ${data_dir}/bufr/israel_observations_ # Check all centres with an abbreviation centre_table=${ECCODES_DEFINITION_PATH}/common/c-11.table -centres=`awk 'NR > 1 {print $2}' < $centre_table` +centres=`awk 'NR > 1 && $1 !~ /#/ {print $2}' < $centre_table` for c in $centres; do ${tools_dir}/bufr_set -s centre=$c $ECCODES_SAMPLES_PATH/BUFR4.tmpl $temp1 r=`${test_dir}/bufr_extract_headers centre $temp1` diff --git a/tests/codes_get_string.sh b/tests/codes_get_string.sh index 188c81a3e..98d68f671 100755 --- a/tests/codes_get_string.sh +++ b/tests/codes_get_string.sh @@ -44,4 +44,4 @@ $EXEC ${test_dir}/codes_get_string GTS "$input" theMessage 2> $tempText grep -q "Buffer too small" $tempText # Clean up -rm -f $tempText +rm -f $tempText $tempGrib diff --git a/tests/create_test.sh b/tests/create_test.sh index 3be842e8e..a63abcb5f 100755 --- a/tests/create_test.sh +++ b/tests/create_test.sh @@ -43,6 +43,7 @@ tempGrib=temp.\$label.grib tempBufr=temp.\$label.bufr tempFilt=temp.\$label.filt tempLog=temp.\$label.log +tempOut=temp.\$label.txt tempRef=temp.\$label.ref sample_grib2=\$ECCODES_SAMPLES_PATH/GRIB2.tmpl @@ -61,7 +62,8 @@ sample_bufr4=\$ECCODES_SAMPLES_PATH/BUFR4.tmpl #\${tools_dir}/bufr_set #... -rm -f \$tempGrib \$tempBufr \$tempFilt \$tempLog \$tempRef +# Clean up +rm -f \$tempGrib \$tempBufr \$tempFilt \$tempLog \$tempOut \$tempRef EOF echo >&2 diff --git a/tests/definitions.sh b/tests/definitions.sh index b841e2834..ecd5d5f4a 100755 --- a/tests/definitions.sh +++ b/tests/definitions.sh @@ -16,7 +16,7 @@ tempOut=temp.$label.txt [ -z "$ECCODES_DEFINITION_PATH" ] || ECCODES_DEFINITION_PATH=`${tools_dir}/codes_info -d` -for file in `find ${ECCODES_DEFINITION_PATH}/ -name '*.def' -print | grep -v grib3/` +for file in `find ${ECCODES_DEFINITION_PATH}/ -name '*.def' -print | grep -v grib3/ | grep -v metar/ | grep -v taf/` do ${tools_dir}/codes_parser $file > $REDIRECT done diff --git a/tests/filter_is_one_of.sh b/tests/filter_is_one_of.sh new file mode 100755 index 000000000..96099d60e --- /dev/null +++ b/tests/filter_is_one_of.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +label="filter_is_one_of_test" +tempFilt=temp.$label.filt +tempOut=temp.$label.txt + +input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl +grib_check_key_equals $input "shortName,paramId,typeOfLevel" "t 130 surface" + +cat > $tempFilt < $tempFilt < $tempOut +grep "size of pl is 64" $tempOut + +${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/reduced_gg_pl_64_grib2.tmpl > $tempOut +grep "size of pl is 128" $tempOut + +# Clean up +rm -f $tempFilt $tempOut diff --git a/tests/grib2_version.sh b/tests/grib2_version.sh index 6e6daef42..8b3119767 100755 --- a/tests/grib2_version.sh +++ b/tests/grib2_version.sh @@ -62,7 +62,6 @@ ${tools_dir}/grib_filter $tempFilt $sample2 > $tempText 2>&1 status=$? set -e [ $status -ne 0 ] -cat $tempText grep -q "Definition files version .* is greater than engine version" $tempText rm -f $tempFilt $temp $tempText diff --git a/tests/grib_change_scanning.sh b/tests/grib_change_scanning.sh index 25c5e005b..5f1d46596 100755 --- a/tests/grib_change_scanning.sh +++ b/tests/grib_change_scanning.sh @@ -11,6 +11,12 @@ . ./include.ctest.sh label="grib_change_scanning_test" +tempFilt=temp.$label.filt +tempGribA=temp.$label.A.grib +tempGribB=temp.$label.B.grib +tempText=temp.$label.txt +tempRef=temp.$label.ref + editions="1 2" gridTypes="regular_ll rotated_ll" @@ -77,12 +83,6 @@ done # alternativeRowScanning # ----------------------- -tempFilt=temp.$label.filt -tempGribA=temp.$label.A.grib -tempGribB=temp.$label.B.grib -tempText=temp.$label.txt -tempRef=temp.$label.ref - cat > $tempFilt </dev/null cmp $tempGribA $tempGribB + +# Check constraint keys follow (observe) their expressions +# -------------------------------------------------------- +cat > $tempFilt <$tempText + status=$? + set -e + [ $status -ne 0 ] + grep -q "Value is read only" $tempText + rm $tempText + done +done + # Clean up rm -f $tempFilt $tempGribA $tempGribB $tempRef $tempText rm -f ${data_dir}/scan1.grib ${data_dir}/scan.grib diff --git a/tests/grib_check_gaussian_grids.sh b/tests/grib_check_gaussian_grids.sh index 4f16966e4..3abf03942 100755 --- a/tests/grib_check_gaussian_grids.sh +++ b/tests/grib_check_gaussian_grids.sh @@ -91,7 +91,7 @@ ${tools_dir}/grib_check_gaussian_grid -f -v $tempGrib 2> $tempText status=$? set -e [ $status -eq 1 ] -grep -q "Error: Sum of pl array 50662 does not match numberOfValues 44" $tempText +grep -q "Error: Sum of pl array 50662 does not match size of values array 44" $tempText # Octahedral # set +e @@ -112,7 +112,7 @@ set -e [ $status -eq 1 ] ${tools_dir}/grib_check_gaussian_grid -v $data_dir > $tempText -grep -q "not a regular file" $tempText +grep -q "is a directory" $tempText ${tools_dir}/grib_check_gaussian_grid -v $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempText grep -q "ignoring" $tempText diff --git a/tests/grib_check_param_concepts.cc b/tests/grib_check_param_concepts.cc index 077d61e14..99307fe85 100644 --- a/tests/grib_check_param_concepts.cc +++ b/tests/grib_check_param_concepts.cc @@ -52,6 +52,8 @@ static int scale_factor_missing(const char* value) return 0; } +#define STAT_PROC_MAX_VAL 103 // increase this with new Code Table 4.10 entries + /* * key = paramId or shortName * filename = paramId.def or shortName.def @@ -59,6 +61,7 @@ static int scale_factor_missing(const char* value) static int grib_check_param_concepts(const char* key, const char* filename) { int isLocal = 0; + int count = 0; grib_concept_value* concept_value = grib_parse_concept_file(NULL, filename); if (!concept_value) return GRIB_IO_PROBLEM; @@ -67,6 +70,11 @@ static int grib_check_param_concepts(const char* key, const char* filename) isLocal = 1; } while (concept_value) { + count++; + if (strlen(concept_value->name) == 0) { + fprintf(stderr, "%s %s: Empty concept value (count=%d)\n", key, concept_value->name, count); + Assert(0); + } grib_concept_condition* concept_condition = concept_value->conditions; /* Convention: * -1 key not present @@ -106,6 +114,14 @@ static int grib_check_param_concepts(const char* key, const char* filename) key, concept_value->name, filename); return GRIB_INVALID_KEY_VALUE; } + if (strcmp(condition_name, "typeOfStatisticalProcessing") == 0) { + long lValue = atol(condition_value); + if (lValue > STAT_PROC_MAX_VAL || lValue < 0) { + fprintf(stderr, "Bad value for %s in %s=%s in file %s\n", + condition_name, key, concept_value->name, filename); + return GRIB_INVALID_KEY_VALUE; + } + } if (strcmp(condition_name, "typeOfFirstFixedSurface") == 0) { type1Missing = type_of_surface_missing(condition_name, condition_value); } diff --git a/tests/grib_check_param_concepts.sh b/tests/grib_check_param_concepts.sh index bf67e7ab8..004ca49b8 100755 --- a/tests/grib_check_param_concepts.sh +++ b/tests/grib_check_param_concepts.sh @@ -36,6 +36,12 @@ for a_dataset in $datasets; do $EXEC ${test_dir}/grib_check_param_concepts shortName $ECCODES_DEFINITION_PATH/grib2/localConcepts/$a_dataset/shortName.def done +# Check WMO name.def etc +$EXEC ${test_dir}/grib_check_param_concepts name $ECCODES_DEFINITION_PATH/grib2/name.def +$EXEC ${test_dir}/grib_check_param_concepts units $ECCODES_DEFINITION_PATH/grib2/units.def +$EXEC ${test_dir}/grib_check_param_concepts units $ECCODES_DEFINITION_PATH/grib2/cfVarName.def + + # Check the group: name.def paramId.def shortName.def units.def cfVarName.def # ---------------------------------------------------------------------------- # Check whether the Test::More Perl module is available @@ -56,11 +62,8 @@ defs_dirs=" $ECCODES_DEFINITION_PATH/grib1/localConcepts/ecmf $ECCODES_DEFINITION_PATH/grib2/localConcepts/ecmf - $ECCODES_DEFINITION_PATH/grib1/localConcepts/ammc - $ECCODES_DEFINITION_PATH/grib1/localConcepts/eidb $ECCODES_DEFINITION_PATH/grib1/localConcepts/ekmi $ECCODES_DEFINITION_PATH/grib1/localConcepts/enmi - $ECCODES_DEFINITION_PATH/grib1/localConcepts/eswi $ECCODES_DEFINITION_PATH/grib1/localConcepts/lfpw $ECCODES_DEFINITION_PATH/grib1/localConcepts/lowm $ECCODES_DEFINITION_PATH/grib1/localConcepts/rjtd diff --git a/tests/grib_data_quality_checks.sh b/tests/grib_data_quality_checks.sh index bf2fc77b2..6462a8662 100755 --- a/tests/grib_data_quality_checks.sh +++ b/tests/grib_data_quality_checks.sh @@ -88,15 +88,10 @@ grep -q 'allowable limit' $tempErr echo "Test limits which are doubles..." # ------------------------------------- -pid=151131 # has limits -3.5 and +3.5 -${tools_dir}/grib_set -s paramId=$pid $input1 $tempGrib1 +pid=262140 # has limits -3.5 and +3.5 ${tools_dir}/grib_set -s paramId=$pid $input2 $tempGrib2 -minval1=`${tools_dir}/grib_get -p param_value_min:d $tempGrib1` -maxval1=`${tools_dir}/grib_get -p param_value_max:d $tempGrib1` minval2=`${tools_dir}/grib_get -p param_value_min:d $tempGrib2` maxval2=`${tools_dir}/grib_get -p param_value_max:d $tempGrib2` -[ "$minval1" = "-3.5" ] -[ "$maxval1" = "3.5" ] [ "$minval2" = "-3.5" ] [ "$maxval2" = "3.5" ] @@ -104,16 +99,12 @@ maxval2=`${tools_dir}/grib_get -p param_value_max:d $tempGrib2` grib_check_key_equals $tempGrib2 'param_value_min:s,param_value_max:s' '-3.5 3.5' set +e -${tools_dir}/grib_set -s scaleValuesBy=1.1 $tempGrib1 $tempOut 2>$tempErr -stat1=$? ${tools_dir}/grib_set -s scaleValuesBy=1.1 $tempGrib2 $tempOut 2>$tempErr stat2=$? set -e -[ $stat1 -ne 0 ] [ $stat2 -ne 0 ] # Should succeed. Change paramId first and then scale all values down -${tools_dir}/grib_set -s paramId=$pid,scaleValuesBy=0.01 $input1 $tempOut ${tools_dir}/grib_set -s paramId=$pid,scaleValuesBy=0.01 $input2 $tempOut echo "Test close to the limit..." @@ -126,13 +117,6 @@ ${tools_dir}/grib_set -s scaleValuesBy=3.6 $tempGrib2 $tempOut set -e [ $status -ne 0 ] -${tools_dir}/grib_set -s edition=1 $tempGrib2 $tempGrib1 -${tools_dir}/grib_set -s scaleValuesBy=-3 $tempGrib1 $tempOut # OK -set +e -${tools_dir}/grib_set -s scaleValuesBy=-3.55 $tempGrib1 $tempOut -set -e -[ $status -ne 0 ] - echo "Test limits with steps..." # ----------------------------- diff --git a/tests/grib_ecc-1806.sh b/tests/grib_ecc-1806.sh new file mode 100755 index 000000000..e08f667a6 --- /dev/null +++ b/tests/grib_ecc-1806.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +REDIRECT=/dev/null + +label="grib_ecc-1806_test" +tempGrib1=temp.$label.1.grib +tempGrib2=temp.$label.2.grib +tempLog=temp.$label.log + +sampleGrib1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl +sampleGrib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl + +test_conversion() +{ + param1=$1 # old paramId in GRIB1 + param2=$2 # new paramId in GRIB2 + short=$3 # new shortName + + ${tools_dir}/grib_set -s paramId=$param1 $sampleGrib1 $tempGrib1 + ${tools_dir}/grib_set -s edition=2 $tempGrib1 $tempGrib2 + grib_check_key_equals $tempGrib2 paramId,shortName "$param2 $short" + + # Check the old paramId has been removed from GRIB2 + set +e + ${tools_dir}/grib_set -s paramId=$param1 $sampleGrib2 $tempGrib2 >$tempLog 2>&1 + status=$? + set -e + [ $status -ne 0 ] + grep -q "no match for paramId" $tempLog +} + +test_conversion 174098 262000 sithick +test_conversion 151163 262104 t20d +test_conversion 151145 262124 zos +test_conversion 130232 235135 avg_w +test_conversion 172146 235033 msshf +test_conversion 172147 235034 mslhf +test_conversion 55 228004 mean2t +test_conversion 56 235168 avg_2d +test_conversion 172169 235035 msdwswrf +test_conversion 172175 235036 msdwlwrf +test_conversion 172176 235037 msnswrf +test_conversion 172177 235038 msnlwrf +test_conversion 172178 235039 mtnswrf +test_conversion 172179 235040 mtnlwrf +test_conversion 151175 262118 sc300m + +# Clean up +rm -f $tempGrib1 $tempGrib2 $tempLog diff --git a/tests/grib_ecc-1846.sh b/tests/grib_ecc-1846.sh new file mode 100755 index 000000000..1416cf1e7 --- /dev/null +++ b/tests/grib_ecc-1846.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +label="grib_ecc-1846_test" +tempGrib=temp.$label.grib +tempFilt=temp.$label.filt +tempLog=temp.$label.log +tempOut=temp.$label.txt +tempRef=temp.$label.ref + +sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl + +${tools_dir}/grib_set -s generatingProcessIdentifier=1,backgroundProcess=1 $sample $tempGrib +grib_check_key_equals $tempGrib modelName,modelVersion "AIFS v1" + +${tools_dir}/grib_set -s generatingProcessIdentifier=154 $sample $tempGrib +grib_check_key_equals $tempGrib modelName,modelVersion "IFS cy48r1" + +${tools_dir}/grib_set -s generatingProcessIdentifier=100 $sample $tempGrib +grib_check_key_equals $tempGrib modelName,modelVersion "IFS unknown" + +# Keys are read-only (may change this later) +set +e +${tools_dir}/grib_set -s modelName=AIFS $sample $tempGrib 2>$tempLog +status=$? +set -e +[ $status -ne 0 ] +grep -q "Value is read only" $tempLog + +set +e +${tools_dir}/grib_set -s modelVersion=cy48r1 $sample $tempGrib 2>$tempLog +status=$? +set -e +[ $status -ne 0 ] +grep -q "Value is read only" $tempLog + + +# Clean up +rm -f $tempGrib $tempFilt $tempLog $tempOut $tempRef diff --git a/tests/grib_filter_fail.sh b/tests/grib_filter_fail.sh index cf66e7b6c..8afd89811 100755 --- a/tests/grib_filter_fail.sh +++ b/tests/grib_filter_fail.sh @@ -18,6 +18,9 @@ tempGrib="temp.$label.grib" tempOut="temp.$label.txt" tempRef="temp.$label.ref" +sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl + + echo "Test with nonexistent keys. Note spelling of centre!" # --------------------------------------------------------- cat >${data_dir}/nonexkey.rules <$tempFilt < $tempOut +${tools_dir}/grib_filter $tempFilt $sample_grib2 2> $tempOut status=$? set -e [ $status -ne 0 ] @@ -66,10 +69,8 @@ grep "Assertion failure" $tempOut # Bad write # --------- -input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl - set +e -echo 'write(-10);' | ${tools_dir}/grib_filter -o $tempGrib - $input > $tempOut 2>&1 +echo 'write(-10);' | ${tools_dir}/grib_filter -o $tempGrib - $sample_grib2 > $tempOut 2>&1 status=$? set -e [ $status -ne 0 ] @@ -100,12 +101,25 @@ set -e # Non existent filter # -------------------- set +e -${tools_dir}/grib_filter a_non_existent_filter_file $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempOut 2>&1 +${tools_dir}/grib_filter a_non_existent_filter_file $sample_grib2 > $tempOut 2>&1 status=$? set -e [ $status -ne 0 ] grep -q "Cannot include file" $tempOut +# Functor not implemented +# ------------------------- +cat >$tempFilt < $tempOut 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "ECCODES ERROR.*failed for 'unicorn'" $tempOut +grep -q "Function not yet implemented" $tempOut + # Clean up rm -f $tempGrib $tempFilt $tempOut $tempRef diff --git a/tests/grib_grid_lamb_az_eq_area.sh b/tests/grib_grid_lamb_az_eq_area.sh index f3ed52588..a580d0498 100755 --- a/tests/grib_grid_lamb_az_eq_area.sh +++ b/tests/grib_grid_lamb_az_eq_area.sh @@ -11,21 +11,21 @@ label="grib_grid_lamb_az_eq_area_test" -GRIB_INFILE=${data_dir}/regular_gaussian_pressure_level_constant.grib2 -REF_FILE=grib_lamb_az_eq_area.ref +input=${data_dir}/regular_gaussian_pressure_level_constant.grib2 +tempRef=grib_lamb_az_eq_area.ref # Temporary files created for this test -FILTER_FILE=temp.$label.filter -GRIB_OUTFILE=temp.$label.grib2 -DATA_OUTFILE=temp.$label.txt -rm -f $FILTER_FILE $GRIB_OUTFILE $DATA_OUTFILE +tempFilt=temp.$label.filter +tempGrib=temp.$label.grib2 +tempOut=temp.$label.txt +rm -f $tempFilt $tempGrib $tempOut # -------------------- # Spherical Earth # -------------------- # Create a filter -cat > $FILTER_FILE< $tempFilt< $DATA_OUTFILE +${tools_dir}/grib_get_data $tempGrib > $tempOut # Compare output with reference. If the diff fails, script will immediately exit with status 1 -diff $REF_FILE $DATA_OUTFILE +diff $tempRef $tempOut -grib_check_key_equals $GRIB_OUTFILE standardParallelInDegrees,centralLongitudeInDegrees '48 9' -grib_check_key_equals $GRIB_OUTFILE xDirectionGridLengthInMetres,yDirectionGridLengthInMetres '5000 5000' +grib_check_key_equals $tempGrib standardParallelInDegrees,centralLongitudeInDegrees '48 9' +grib_check_key_equals $tempGrib xDirectionGridLengthInMetres,yDirectionGridLengthInMetres '5000 5000' # Nearest -${tools_dir}/grib_ls -l 67,-33,1 $GRIB_OUTFILE +${tools_dir}/grib_ls -l 67,-33,1 $tempGrib # jPointsAreConsecutive tempOutA=temp.$label.A.txt tempOutB=temp.$label.B.txt -${tools_dir}/grib_get_data -s jPointsAreConsecutive=0 $GRIB_OUTFILE > $tempOutA -${tools_dir}/grib_get_data -s jPointsAreConsecutive=1 $GRIB_OUTFILE > $tempOutB +${tools_dir}/grib_get_data -s jPointsAreConsecutive=0 $tempGrib > $tempOutA +${tools_dir}/grib_get_data -s jPointsAreConsecutive=1 $tempGrib > $tempOutB # Results should be different. set +e diff $tempOutA $tempOutB > /dev/null @@ -80,7 +80,7 @@ rm -f $tempOutA $tempOutB # Oblate spheroid # -------------------- -cat > $FILTER_FILE< $tempFilt< $DATA_OUTFILE +${tools_dir}/grib_get_data $tempGrib > $tempOut + +# ECC-1818 +# --------- +cat > $tempFilt< $tempOut # Clean up -rm -f $FILTER_FILE $DATA_OUTFILE -rm -f $GRIB_OUTFILE +rm -f $tempFilt $tempOut $tempGrib diff --git a/tests/grib_histogram.sh b/tests/grib_histogram.sh new file mode 100755 index 000000000..9653a9500 --- /dev/null +++ b/tests/grib_histogram.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +label="grib_histogram_test" +REDIRECT=/dev/null +tempOut=temp.$label.txt + +${tools_dir}/grib_histogram $ECCODES_SAMPLES_PATH/GRIB1.tmpl > $tempOut +${tools_dir}/grib_histogram $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempOut + +${tools_dir}/grib_histogram -p step,shortName $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempOut + +# Something with a bitmap +input=$data_dir/reduced_latlon_surface.grib2 +grib_check_key_equals $input numberOfMissing 98701 +${tools_dir}/grib_histogram $input > $tempOut + +# Skip +input=$data_dir/tigge_cf_ecmwf.grib2 +${tools_dir}/grib_histogram -w level=925,shortName=gh $input > $tempOut + + +# Clean up +rm -f $tempOut diff --git a/tests/grib_indexing.sh b/tests/grib_indexing.sh index bd4908bf1..1e3001f16 100755 --- a/tests/grib_indexing.sh +++ b/tests/grib_indexing.sh @@ -158,6 +158,9 @@ rm -rf $temp_dir_A ${tools_dir}/grib_index_build -N -o $tempIndex1 $sample1 > /dev/null ${tools_dir}/grib_dump $tempIndex1 >/dev/null +# With DEBUG enabled +# -------------------- +ECCODES_DEBUG=-1 ${tools_dir}/grib_index_build -N -o $tempIndex1 $sample1 > /dev/null # ECC-1773: GRIB2 multi-field messages # ------------------------------------- @@ -205,5 +208,5 @@ grep -q "End of resource reached" $tempOut # Clean up -rm -f $tempOut $tempRef +rm -f $temp $tempOut $tempRef rm -f $tempIndex $tempIndex1 $tempIndex2 $tempGribFile1 $tempGribFile2 diff --git a/tests/grib_list_keys.sh b/tests/grib_list_keys.sh new file mode 100755 index 000000000..c58bddc96 --- /dev/null +++ b/tests/grib_list_keys.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +label="grib_list_keys_test" +tempOut=temp.$label.txt + +if [ -d "$ECCODES_DEFINITION_PATH" ]; then + if [ -x "${tools_dir}/grib_list_keys" ]; then + ${tools_dir}/grib_list_keys $ECCODES_DEFINITION_PATH/boot.def > $tempOut + ${tools_dir}/grib_list_keys $ECCODES_DEFINITION_PATH/grib2/template.4.2000.def > $tempOut + ${tools_dir}/grib_list_keys $ECCODES_DEFINITION_PATH/grib2/template.3.0.def > $tempOut + ${tools_dir}/grib_list_keys $ECCODES_DEFINITION_PATH/grib2/template.3.120.def > $tempOut + fi +fi + +# Clean up +rm -f $tempOut diff --git a/tests/grib_merge.sh b/tests/grib_merge.sh new file mode 100755 index 000000000..acf59e7a6 --- /dev/null +++ b/tests/grib_merge.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +label="grib_merge_test" + +tempGrib=temp.$label.grib + +f1=$ECCODES_SAMPLES_PATH/regular_ll_pl_grib1.tmpl +f2=$ECCODES_SAMPLES_PATH/regular_ll_sfc_grib1.tmpl +${tools_dir}/grib_merge $f1 $f2 $tempGrib + +# Clean up +rm -f $tempGrib diff --git a/tests/grib_sub_area_check.sh b/tests/grib_sub_area_check.sh new file mode 100755 index 000000000..9b602e4cb --- /dev/null +++ b/tests/grib_sub_area_check.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +label="grib_sub_area_check_test" +tempOut=temp.$label.txt + +if [ ! -x "${tools_dir}/gg_sub_area_check" ]; then + exit 0 +fi + +set +e +${tools_dir}/gg_sub_area_check +status=$? +set -e +[ $status -ne 0 ] + +f1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl +f2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl +${tools_dir}/gg_sub_area_check $f1 $f2 > $tempOut + +f1=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib1.tmpl +f2=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl +${tools_dir}/gg_sub_area_check $f1 $f2 > $tempOut + +# Clean up +rm -f $tempOut diff --git a/tests/grib_sub_hourly.sh b/tests/grib_sub_hourly.sh index bb7bac891..dfbf145f5 100755 --- a/tests/grib_sub_hourly.sh +++ b/tests/grib_sub_hourly.sh @@ -62,6 +62,37 @@ fi instantaneous_field=$data_dir/reduced_gaussian_surface.grib2 accumulated_field=$data_dir/reduced_gaussian_sub_area.grib2 +# ECC-1802: Relaxation of the "Step Units Rule": +# The updated rule permits the simultaneous assignment of the same step unit to both 'stepUnits' and 'step*' keys +in="$instantaneous_field" +low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s" +${tools_dir}/grib_set -s stepUnits=s,step=11s $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 s" +${tools_dir}/grib_set -s stepUnits=m,step=11m $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 m" +${tools_dir}/grib_set -s stepUnits=h,step=11h $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 h" +${tools_dir}/grib_set -s step=11s,stepUnits=s $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 s" +${tools_dir}/grib_set -s step=11m,stepUnits=m $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 m" +${tools_dir}/grib_set -s step=11h,stepUnits=h $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 h" + +in="$accumulated_field" +low_level_keys="forecastTime,indicatorOfUnitOfTimeRange:s,lengthOfTimeRange,indicatorOfUnitForTimeRange:s" +${tools_dir}/grib_set -s stepUnits=s,stepRange=11s-181s $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 s 170 s" +${tools_dir}/grib_set -s stepUnits=m,stepRange=11m-181m $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 m 170 m" +${tools_dir}/grib_set -s stepUnits=h,stepRange=11h-181h $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 h 170 h" +${tools_dir}/grib_set -s stepRange=11s-181s,stepUnits=s $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 s 170 s" +${tools_dir}/grib_set -s stepRange=11m-181m,stepUnits=m $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 m 170 m" +${tools_dir}/grib_set -s stepRange=11h-181h,stepUnits=h $in $temp +grib_check_key_equals $temp "-p $low_level_keys" "11 h 170 h" # ECC-1813: Test that we can set the stepUnits without setting the step in="$instantaneous_field" diff --git a/tests/grib_to_json.sh b/tests/grib_to_json.sh new file mode 100755 index 000000000..be05aa00c --- /dev/null +++ b/tests/grib_to_json.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +label="grib_to_json_test" +REDIRECT=/dev/null +tempOut=temp.$label.txt + +if [ ! -x "${tools_dir}/grib_to_json" ]; then + exit 0 +fi + +# Currently only works for GRIB edition 1 !!! +${tools_dir}/grib_to_json $ECCODES_SAMPLES_PATH/GRIB1.tmpl > $tempOut + +# Decide if we have the JSON verifier commandline utility +JSON_VERIF="json_xs" +JSON_CHECK="" +if command -v $JSON_VERIF >/dev/null 2>&1; then + JSON_CHECK=$JSON_VERIF +fi + +# Check the json_xs command actually works! +set +e +echo '[]' | json_xs > $REDIRECT 2>&1 +if [ $? -ne 0 ]; then JSON_CHECK=""; fi +set -e +echo "Using $JSON_CHECK ..." + +if test "x$JSON_CHECK" != "x"; then + json_xs < $tempOut >$REDIRECT 2> $REDIRECT +fi + +# Clean up +rm -f $tempOut diff --git a/tests/grib_to_netcdf.sh b/tests/grib_to_netcdf.sh index f13d8475b..ba3589329 100755 --- a/tests/grib_to_netcdf.sh +++ b/tests/grib_to_netcdf.sh @@ -110,6 +110,14 @@ ${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempGrib ${tools_dir}/grib_set -s productDefinitionTemplateNumber=31 $sample2 $tempGrib ${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempGrib +ECCODES_DEBUG=-1 ${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempGrib + + +# The -u option +input=${data_dir}/sample.grib2 +${tools_dir}/grib_to_netcdf -u time -o $tempNetcdf $input + + echo "Test different resolutions ..." # ------------------------------------ # This should fail as messages have different resolutions @@ -170,6 +178,26 @@ set -e grep -q "Wrong message length" $tempText +# Non-GRIB input +input=$data_dir/bufr/aaen_55.bufr +set +e +${tools_dir}/grib_to_netcdf -o $tempNetcdf $input > $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Input does not contain any field" $tempText + + +# Bad reference date +input=$data_dir/sample.grib2 +set +e +${tools_dir}/grib_to_netcdf -Rxxx -o $tempNetcdf $input > $tempText 2>&1 +status=$? +set -e +[ $status -ne 0 ] +grep -q "Invalid reference date" $tempText + + # Validity time check export GRIB_TO_NETCDF_CHECKVALIDTIME=0 ${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempGrib diff --git a/tests/grib_to_ppm.sh b/tests/grib_to_ppm.sh new file mode 100755 index 000000000..6deea0f8a --- /dev/null +++ b/tests/grib_to_ppm.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# 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. +# + +. ./include.ctest.sh + +label="grib_to_ppm_test" +tempOut=temp.$label.txt + +if [ ! -x "${tools_dir}/grib2ppm" ]; then + exit 0 +fi + +# No options +${tools_dir}/grib2ppm + +${tools_dir}/grib2ppm -l 6 -u 7 -c $data_dir/sample.grib2 > $tempOut +${tools_dir}/grib2ppm $data_dir/sample.grib2 > $tempOut + +# Clean up +rm -f $tempOut diff --git a/tests/grib_unpack_subarray.cc b/tests/grib_unpack_subarray.cc index 3321b4040..1a7bfadab 100644 --- a/tests/grib_unpack_subarray.cc +++ b/tests/grib_unpack_subarray.cc @@ -34,12 +34,12 @@ int main(int argc, char** argv) Assert(sub_values); size_t len = nvalues; - GRIB_CHECK(grib_unpack_double(a, all_values, &len), 0); + GRIB_CHECK(a->unpack_double(all_values, &len), 0); size_t start = nvalues / 10; len = nvalues / 5; printf("nvalues=%zu, start=%zu, len=%zu\n", nvalues, start, len); - GRIB_CHECK(grib_unpack_double_subarray(a, sub_values, start, len), 0); + GRIB_CHECK(a->unpack_double_subarray(sub_values, start, len), 0); for (size_t i = 0; i < len; ++i) { //printf("sub[%zu]=%.10e\n", start + i, sub_values[i]); Assert(all_values[start+i] == sub_values[i]); diff --git a/tests/pseudo_budg.sh b/tests/pseudo_budg.sh index 4c50789d8..9c793a718 100755 --- a/tests/pseudo_budg.sh +++ b/tests/pseudo_budg.sh @@ -17,6 +17,9 @@ tempOut=temp.$label.txt tempRef=temp.$label.ref tempBud=temp.$label.bud +# Abort if any error messages are posted +export ECCODES_FAIL_IF_LOG_MESSAGE=1 + ${tools_dir}/grib_ls -j ${data_dir}/budg > $tempOut cat > $tempRef << EOF { "messages" : [ diff --git a/tests/pseudo_diag.sh b/tests/pseudo_diag.sh index 50208a45e..af45d6aea 100755 --- a/tests/pseudo_diag.sh +++ b/tests/pseudo_diag.sh @@ -20,6 +20,9 @@ REDIRECT=/dev/null sample=$ECCODES_SAMPLES_PATH/diag.tmpl +# Abort if any error messages are posted +export ECCODES_FAIL_IF_LOG_MESSAGE=1 + # Basic grib commands should not fail # ------------------------------------ ${tools_dir}/grib_ls $sample > $REDIRECT diff --git a/tools/big2gribex.cc b/tools/big2gribex.cc index a36b01126..c2797a821 100644 --- a/tools/big2gribex.cc +++ b/tools/big2gribex.cc @@ -8,18 +8,16 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/* - * Implementation: big2gribex - * - * Description: - * - */ - #include #include #include "grib_api.h" -void usage(char*); + +static void usage(const char* progname) +{ + printf("\nUsage: %s grib_in grib_out\n", progname); + exit(1); +} int main(int argc, char* argv[]) { @@ -70,12 +68,5 @@ int main(int argc, char* argv[]) exit(1); } - return 0; } - -void usage(char* progname) -{ - printf("\nUsage: %s grib_in grib_out\n", progname); - exit(1); -} diff --git a/tools/bufr_compare.cc b/tools/bufr_compare.cc index e0447e20b..325c67cd3 100644 --- a/tools/bufr_compare.cc +++ b/tools/bufr_compare.cc @@ -26,7 +26,7 @@ grib_option grib_options[] = { { "A:", 0, 0, 0, 1, 0 }, { "t:", "factor", "Compare data values using factor multiplied by the tolerance specified in options -R -A.\n", 0, 1, 0 }, { "w:", 0, 0, 0, 1, 0 }, - { "f", 0, 0, 0, 1, 0 }, + { "f", 0, "Forcefully compare, do not stop after first difference.\n", 0, 1, 0 }, { "F", 0, 0, 1, 0, 0 }, { "q", 0, 0, 1, 0, 0 }, { "M", 0, 0, 1, 0, 0 }, diff --git a/tools/bufr_dump.cc b/tools/bufr_dump.cc index ae4c485cc..6c31ce76e 100644 --- a/tools/bufr_dump.cc +++ b/tools/bufr_dump.cc @@ -9,6 +9,7 @@ */ #include "grib_tools.h" +#include "accessor/grib_accessor_class_bufr_data_array.h" grib_option grib_options[] = { /* {id, args, help}, on, command_line, value*/ diff --git a/tools/bufr_ls.cc b/tools/bufr_ls.cc index c57114617..b3ebaf531 100644 --- a/tools/bufr_ls.cc +++ b/tools/bufr_ls.cc @@ -17,7 +17,7 @@ grib_option grib_options[] = { { "F:", 0, 0, 1, 1, "%g" }, { "P:", 0, 0, 0, 1, 0 }, { "w:", 0, 0, 0, 1, 0 }, - { "j", 0, "JSON output\n", 0, 1, 0 }, + { "j", 0, "JSON output.\n", 0, 1, 0 }, /* {"B:",0,0,0,1,0}, */ { "s:", 0, 0, 0, 1, 0 }, { "n:", 0, 0, 1, 1, "ls" }, diff --git a/tools/codes_export_resource.cc b/tools/codes_export_resource.cc index 61a8b7db6..98ba7712d 100644 --- a/tools/codes_export_resource.cc +++ b/tools/codes_export_resource.cc @@ -24,6 +24,7 @@ static void usage(const char* prog) printf(" -d Extract a resource from the definitions directory\n"); printf("\n"); printf(" E.g., %s -s GRIB2.tmpl my.grib2\n", prog); + printf(" E.g., %s -d grib2/boot.def grib2_boot.txt\n", prog); exit(1); } @@ -57,7 +58,7 @@ int main(int argc, char* argv[]) resource_name = "definition"; } else { - fprintf(stderr, "Invalid option: Specify either -s or -d\n"); + fprintf(stderr, "Error: Invalid option: Specify either -s or -d\n"); return 1; } @@ -68,42 +69,49 @@ int main(int argc, char* argv[]) full_path = grib_context_full_defs_path(c, resource_path); } if (!full_path) { - fprintf(stderr, "Failed to access %s: '%s'\n", resource_name, resource_path); + fprintf(stderr, "Error: Failed to access %s file: '%s'\n", resource_name, resource_path); return 1; } fout = fopen(out_file, "wb"); if (!fout) { - fprintf(stderr, "Failed to open output file '%s'\n", out_file); + fprintf(stderr, "Error: Failed to open output file '%s'\n", out_file); perror(out_file); return 1; } fin = codes_fopen(full_path, "r"); if (!fin) { - fprintf(stderr, "Failed to open resource '%s'\n", full_path); + fprintf(stderr, "Error: Failed to open resource '%s'\n", full_path); fclose(fout); return 1; } + /* write resource bytes to fout */ + int read_count = 0; while (0 < (bytes = fread(buffer, 1, sizeof(buffer), fin))) { if (fwrite(buffer, 1, bytes, fout) != bytes) { - fprintf(stderr, "Failed to write out bytes\n"); + fprintf(stderr, "Error: Failed to write out bytes\n"); return 1; } + ++read_count; } if (fclose(fin) != 0) { - fprintf(stderr, "Call to fclose failed (input)\n"); + fprintf(stderr, "Error: Call to fclose failed (input)\n"); return 1; } if (fclose(fout) != 0) { - fprintf(stderr, "Call to fclose failed (output)\n"); + fprintf(stderr, "Error: Call to fclose failed (output)\n"); return 1; } grib_context_free(c, full_path); - printf("Resource exported to file '%s'.\n", out_file); + if (read_count == 0) { + fprintf(stderr, "Error: Number of bytes read == 0. Please check the path refers to a file.\n"); + } else { + printf("Resource exported to file '%s'.\n", out_file); + } return 0; } diff --git a/tools/bufr_3to4.cc b/tools/deprecated/bufr_3to4.cc similarity index 100% rename from tools/bufr_3to4.cc rename to tools/deprecated/bufr_3to4.cc diff --git a/tools/mars_request.cc b/tools/deprecated/mars_request.cc similarity index 100% rename from tools/mars_request.cc rename to tools/deprecated/mars_request.cc diff --git a/tools/grib2ppm.cc b/tools/grib2ppm.cc index cac306481..820178789 100644 --- a/tools/grib2ppm.cc +++ b/tools/grib2ppm.cc @@ -122,7 +122,7 @@ int main(int argc, char* argv[]) continue; } - f = fopen(argv[i], "r"); + f = fopen(argv[i], "rb"); if (!f) { perror(argv[i]); exit(1); @@ -226,7 +226,9 @@ int main(int argc, char* argv[]) if (v > ucap) { v = ucap; } - c = (v - min) * 65535 / (max - min); + double denom = 1; + if (max != min) denom = max - min; + c = (v - min) * 65535 / denom; hh = c >> 8; l = c & 0xff; printf("%c", hh); diff --git a/tools/grib_check_gaussian_grid.cc b/tools/grib_check_gaussian_grid.cc index 9c0e8ab2a..666658490 100644 --- a/tools/grib_check_gaussian_grid.cc +++ b/tools/grib_check_gaussian_grid.cc @@ -69,9 +69,9 @@ static int process_file(const char* filename) grib_handle* h = NULL; FILE* in = NULL; - if (!path_is_regular_file(filename)) { + if (path_is_directory(filename)) { if (verbose) - printf(" WARNING: '%s' not a regular file! Ignoring\n", filename); + printf(" WARNING: '%s' is a directory! Ignoring\n", filename); return GRIB_IO_PROBLEM; } @@ -86,7 +86,8 @@ static int process_file(const char* filename) while ((h = grib_handle_new_from_file(0, in, &err)) != NULL) { int is_reduced_gaussian = 0, is_regular_gaussian = 0, grid_ok = 0; - long edition = 0, N = 0, Nj = 0, numberOfDataPoints, numberOfValues, angleSubdivisions; + long edition = 0, N = 0, Nj = 0, numberOfDataPoints, angleSubdivisions; + size_t numberOfValues = 0; size_t len = 0, sizeOfValuesArray = 0; double* lats = NULL; long* pl = NULL; @@ -117,7 +118,7 @@ static int process_file(const char* filename) GRIB_CHECK(grib_get_long(h, "N", &N), 0); GRIB_CHECK(grib_get_long(h, "Nj", &Nj), 0); GRIB_CHECK(grib_get_long(h, "numberOfDataPoints", &numberOfDataPoints), 0); - GRIB_CHECK(grib_get_long(h, "numberOfValues", &numberOfValues), 0); + GRIB_CHECK(grib_get_size(h, "values", &numberOfValues), 0); GRIB_CHECK(grib_get_double(h, "latitudeOfFirstGridPointInDegrees", &lat1), 0); GRIB_CHECK(grib_get_double(h, "longitudeOfFirstGridPointInDegrees", &lon1), 0); GRIB_CHECK(grib_get_double(h, "latitudeOfLastGridPointInDegrees", &lat2), 0); @@ -208,8 +209,8 @@ static int process_file(const char* filename) if (pl_sum != numberOfDataPoints) { error(filename, msg_num, "Sum of pl array %ld does not match numberOfDataPoints %ld\n", pl_sum, numberOfDataPoints); } - if (pl_sum != numberOfValues) { - error(filename, msg_num, "Sum of pl array %ld does not match numberOfValues %ld\n", pl_sum, numberOfValues); + if ( (size_t)pl_sum != numberOfValues ) { + error(filename, msg_num, "Sum of pl array %ld does not match size of values array %zu\n", pl_sum, numberOfValues); } GRIB_CHECK(grib_get_long(h, "isOctahedral", &is_octahedral), 0); if (is_octahedral) { @@ -233,7 +234,7 @@ static int process_file(const char* filename) GRIB_CHECK(grib_get_size(h, "values", &sizeOfValuesArray), 0); if (sizeOfValuesArray != (size_t)numberOfDataPoints) { - error(filename, msg_num, "Number of data points %d different from size of values array %d\n", + error(filename, msg_num, "Number of data points %ld different from size of values array %zu\n", numberOfDataPoints, sizeOfValuesArray); } diff --git a/tools/grib_compare.cc b/tools/grib_compare.cc index 558ff0386..ba86c1a1f 100644 --- a/tools/grib_compare.cc +++ b/tools/grib_compare.cc @@ -27,7 +27,7 @@ grib_option grib_options[] = { { "P", 0, "Compare data values using the packing error as tolerance.\n", 0, 1, 0 }, { "T:", "factor", "Compare data values using factor multiplied by the tolerance specified in options -P -R -A.\n", 0, 1, 0 }, { "w:", 0, 0, 0, 1, 0 }, - { "f", 0, 0, 0, 1, 0 }, + { "f", 0, "Forcefully compare, do not stop after first difference.\n", 0, 1, 0 }, { "F", 0, 0, 1, 0, 0 }, { "q", 0, 0, 1, 0, 0 }, { "M", 0, 0, 1, 0, 0 }, diff --git a/tools/grib_histogram.cc b/tools/grib_histogram.cc index 90a7e8532..6c84da43a 100644 --- a/tools/grib_histogram.cc +++ b/tools/grib_histogram.cc @@ -62,7 +62,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) size_t last_size = 0; long missingValuesPresent; double delta; - int err = 0; double* values = NULL; size_t size; @@ -76,14 +75,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) names[name_count++] = options->requested_print_keys[i].name; } - if (!options->skip) { - if (options->set_values_count != 0) - err = grib_set_values(h, options->set_values, options->set_values_count); - - if (err != GRIB_SUCCESS && options->fail) - exit(err); - } - GRIB_CHECK(grib_get_long(h, "missingValuesPresent", &missingValuesPresent), 0); GRIB_CHECK(grib_get_size(h, "values", &size), 0); diff --git a/tools/grib_ls.cc b/tools/grib_ls.cc index 59f25306b..c5d06df01 100644 --- a/tools/grib_ls.cc +++ b/tools/grib_ls.cc @@ -17,7 +17,7 @@ grib_option grib_options[] = { { "F:", 0, 0, 1, 1, "%g" }, { "P:", 0, 0, 0, 1, 0 }, { "w:", 0, 0, 0, 1, 0 }, - { "j", 0, "JSON output\n", 0, 1, 0 }, + { "j", 0, "JSON output.\n", 0, 1, 0 }, { "B:", 0, 0, 0, 1, 0 }, { "l:", 0, 0, 0, 1, 0 }, { "s:", 0, 0, 0, 1, 0 }, diff --git a/tools/grib_options.cc b/tools/grib_options.cc index c15de1d80..b612db63a 100644 --- a/tools/grib_options.cc +++ b/tools/grib_options.cc @@ -39,7 +39,7 @@ static grib_options_help grib_options_help_list[] = { { "e:", "tolerance", "\n\t\tOnly values whose difference is more than tolerance are considered different.\n" }, { "f", 0, "Force. Force the execution not to fail on error.\n" }, { "F:", "format", "\n\t\tC style format for floating-point values.\n" }, - { "g", 0, "Copy GTS header. \n" }, + { "g", 0, "Copy GTS header.\n" }, { "G", 0, "GRIBEX compatibility mode.\n" }, { "i:", "index", "\n\t\tData value corresponding to the given index is printed.\n" }, @@ -81,7 +81,7 @@ static grib_options_help grib_options_help_list[] = { "\n\t\tIn the value you can also use the forward-slash character '/' to specify an OR condition (i.e. a logical disjunction)" "\n\t\tNote: only one -w clause is allowed.\n" }, { "v", 0, "Verbose.\n" }, - { "7", 0, "Does not fail when the message has wrong length\n" }, + { "7", 0, "Does not fail when the message has wrong length.\n" }, { "A:", "absolute error\n", "\tCompare floating-point values using the absolute error as tolerance.\n\t\tDefault is absolute error=0\n" }, { "C", 0, "C code mode. A C code program generating the message is dumped.\n" }, @@ -98,7 +98,7 @@ static grib_options_help grib_options_help_list[] = { { "S", 0, "Strict. Only messages matching all the constraints are copied to" "\n\t\tthe output file\n" }, - { "T:", "T | B | M | A", "Message type. T->GTS, B->BUFR, M->METAR (Experimental), A->Any (Experimental).\n\t\t\t\tThe input file is interpreted according to the message type.\n" }, + { "T:", "T | B | A", "Message type. T->GTS, B->BUFR, A->Any (Experimental).\n\t\t\tThe input file is interpreted according to the message type.\n" }, { "V", 0, "Version.\n" }, { "W:", "width", "\n\t\tMinimum width of each column in output. Default is 10.\n" }, { "X:", "offset", "\n\t\tInput file offset in bytes. Processing of the input file will start from the given offset.\n" }, diff --git a/tools/gts_compare.cc b/tools/gts_compare.cc index 1dc362059..3a084893d 100644 --- a/tools/gts_compare.cc +++ b/tools/gts_compare.cc @@ -23,7 +23,7 @@ grib_option grib_options[] = { /*{"R:",0,0,0,1,0},*/ /*{"A:",0,0,0,1,0},*/ { "w:", 0, 0, 0, 1, 0 }, - { "f", 0, 0, 0, 1, 0 }, + { "f", 0, "Forcefully compare, do not stop after first difference.\n", 0, 1, 0 }, { "F", 0, 0, 1, 0, 0 }, { "q", 0, 0, 1, 0, 0 }, { "I", 0, 0, 1, 0, 0 }, @@ -559,7 +559,7 @@ static int compare_values(const grib_runtime_options* options, grib_handle* h1, return GRIB_SUCCESS; } -static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_options* options, int* err) +static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_options* options, int* pErr) { int ret = 0; const char* name = NULL; @@ -580,7 +580,7 @@ static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_ if (xa == NULL || (xa->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) continue; if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED)) { - err++; + (*pErr)++; write_messages(h1, h2); ret = 1; } diff --git a/tools/metar_compare.cc b/tools/metar_compare.cc index a86cafd0d..6ffc5db5a 100644 --- a/tools/metar_compare.cc +++ b/tools/metar_compare.cc @@ -20,7 +20,7 @@ grib_option grib_options[] = { { "R:", 0, 0, 0, 1, 0 }, { "A:", 0, 0, 0, 1, 0 }, { "w:", 0, 0, 0, 1, 0 }, - { "f", 0, 0, 0, 1, 0 }, + { "f", 0, "Forcefully compare, do not stop after first difference.\n", 0, 1, 0 }, { "F", 0, 0, 1, 0, 0 }, { "q", 0, 0, 1, 0, 0 }, { "I", 0, 0, 1, 0, 0 }, @@ -713,7 +713,7 @@ static int compare_values(const grib_runtime_options* options, grib_handle* h1, return GRIB_SUCCESS; } -static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_options* options, int* err) +static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_options* options, int* pErr) { int ret = 0; const char* name = NULL; @@ -733,7 +733,7 @@ static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_ if (xa == NULL || (xa->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0) continue; if (compare_values(options, h1, h2, name, GRIB_TYPE_UNDEFINED)) { - err++; + (*pErr)++; write_messages(h1, h2); ret = 1; }