Merge branch 'develop' into disable-ieee64-test-on-32bit

This commit is contained in:
shahramn 2022-01-31 21:56:06 +00:00 committed by GitHub
commit 6d08544684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
90 changed files with 11039 additions and 9945 deletions

View File

@ -306,6 +306,11 @@ if( IEEE_LE )
set( IEEE_BE 0 )
endif()
set( ECCODES_ON_LINUX_32BIT 0 )
if( EC_OS_NAME MATCHES "linux" AND EC_OS_BITS EQUAL "32" )
set( ECCODES_ON_LINUX_32BIT 1 )
endif()
set( ECCODES_ON_WINDOWS 0 )
if( EC_OS_NAME MATCHES "windows" )
# Symbols need to be explicitly exported on Windows so we can link to dlls.

View File

@ -11,18 +11,17 @@ position startOfHeaders;
ascii[4] identifier;
alias ls.identifier=identifier;
transient missingValue = 9999;
transient missingValue = 9999;
constant ieeeFloats = 0: edition_specific;
constant zero=0:hidden;
template section1 "budg/section.1.def";
template mars_labeling "budg/mars_labeling.def";
template section4 "budg/section.4.def";
ascii[4] endMark;
position totalLength;
template section1 "budg/section.1.def";
template mars_labeling "budg/mars_labeling.def";
template section4 "budg/section.4.def";
ascii[4] endMark;
position totalLength;
# This needs to be there for the MARS server, so the totalLength is processed correctly
position endOfHeadersMarker;
position endOfHeadersMarker;
meta lengthOfHeaders evaluate( endOfHeadersMarker-startOfHeaders);
meta md5Headers md5(startOfHeaders,lengthOfHeaders);

View File

@ -20,8 +20,6 @@ codetable[1] indicatorOfTypeOfLevel 'grib1/3.table';
codetable[2] heightPressureEtcOfLevels 'grib1/3.table';
alias ls.levelType=indicatorOfTypeOfLevel;
# Year of century
# NOTE 6 NOT FOUND
unsigned[1] yearOfCentury ;
unsigned[1] month ;
@ -39,14 +37,12 @@ meta julianDay julian_day(dataDate,hour,minute,second) : edition_specific;
# Indicator of unit of time range
codetable[1] indicatorOfUnitOfTimeRange 'grib1/4.table';
# P1 - Period of time
# (number of time units)
# P1 - Period of time (number of time units)
unsigned[1] periodOfTime ;
alias P1 = periodOfTime ;
# P2 - Period of time
# (number of time units)
# P2 - Period of time (number of time units)
unsigned[1] periodOfTimeIntervals ;
alias P2 = periodOfTimeIntervals ;

View File

@ -44,7 +44,7 @@ if (numberOfChars >= 12) {
alias expver=experimentVersionNumber;
alias marsExpver=experimentVersionNumber;
constant numberOfRemaininChars = numberOfChars - 12;
charValues list(numberOfRemaininChars) {

View File

@ -62,5 +62,3 @@
"Siral" = { unexpandedDescriptors = 312071 ; }
"IasiL1c" = { unexpandedDescriptors = 340007 ; }
"SaralAltika" = { unexpandedDescriptors = 340011 ; }

View File

@ -1,6 +1,27 @@
:
set -eu
# Usage:
# create_legacy_def.sh $paramId
#
# This script will insert the local ECMWF GRIB2 representation
# for that paramId into the files:
# definitions/grib2/localConcepts/ecmf/paramId.legacy.def
# definitions/grib2/localConcepts/ecmf/shortName.legacy.def
# etc
# This is normally run for those GRIB2 parameters which had
# a local ECMWF representation which later acquired a standard
# WMO one. We want to be able to match the old encoding to the
# paramId but when we write out a field, we want to use the new
# standard WMO encoding.
#
# Assumptions:
# The ecCodes tools grib_set and grib_get are available
# The legacy encoding has discipline = 192
# The parameterCategory = $paramId / 1000
# The parameterNumber = $paramId - parameterCategory*1000
#
pid=$1
sample2=samples/GRIB2.tmpl
@ -46,5 +67,5 @@ output_def "$name" "$units" $dis $cat $num >> $defs/units.legacy.def
output_def "$name" "$cfVarName" $dis $cat $num >> $defs/cfVarName.legacy.def
output_def "$name" "$cfName" $dis $cat $num >> $defs/cfName.legacy.def
echo "Files updated"
echo "Files updated. Check directory $defs"
rm -f $temp

View File

@ -40,9 +40,10 @@ include "grib1/scanning_mode.def";
unsigned[3] orientationOfTheGrid : edition_specific ;
meta geography.orientationOfTheGridInDegrees scale(orientationOfTheGrid,oneConstant,grib1divider,truncateDegrees) : dump;
unsigned[3] NrInRadiusOfEarth : edition_specific,can_be_missing,no_copy;
alias altitudeOfTheCameraFromTheEarthsCentreMeasuredInUnitsOfTheEarthsRadius = NrInRadiusOfEarth;
meta NrInRadiusOfEarthScaled scale(NrInRadiusOfEarth,oneConstant,oneMillionConstant,truncateDegrees) : dump;
unsigned[3] Nr : edition_specific,can_be_missing,no_copy;
alias altitudeOfTheCameraFromTheEarthsCentreMeasuredInUnitsOfTheEarthsRadius = Nr;
meta geography.NrInRadiusOfEarth scale(Nr,oneConstant,oneMillionConstant,truncateDegrees) : dump;
alias NrInRadiusOfEarthScaled=NrInRadiusOfEarth;
unsigned[2] Xo : dump;
alias xCoordinateOfOriginOfSectorImage=Xo;

View File

@ -66,9 +66,6 @@ if(missing(Ni)){
latitudeOfLastGridPointInDegrees,longitudeOfLastGridPointInDegrees,
N,pl,Nj);
nearest reduced(values,radius,Nj,pl);
box reduced_gaussian(latitudeOfFirstGridPointInDegrees,longitudeOfFirstGridPointInDegrees,
latitudeOfLastGridPointInDegrees,longitudeOfLastGridPointInDegrees,
N,pl);
#meta sumPlArray sum(pl);
#meta dataGlobal evaluate( sumPlArray == (numberOfValues+numberOfMissing) );
@ -78,9 +75,6 @@ if(missing(Ni)){
latitudeFirstInDegrees, latitudeLastInDegrees,
N,jScansPositively);
nearest regular(values,radius,Ni,Nj);
# box regular_gaussian(latitudeOfFirstGridPointInDegrees,longitudeOfFirstGridPointInDegrees,
# latitudeOfLastGridPointInDegrees,longitudeOfLastGridPointInDegrees,
# DiInDegrees,Ni,N,iScansNegatively,jScansPositively);
}
meta latLonValues latlonvalues(values);

View File

@ -164,12 +164,12 @@
table2Version = 170 ;
indicatorOfParameter = 135 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'lwe_thickness_of_atmosphere_mass_content_of_water_vapor' = {
table2Version = 128 ;
indicatorOfParameter = 137 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'lwe_thickness_of_atmosphere_mass_content_of_water_vapor' = {
table2Version = 180 ;
indicatorOfParameter = 137 ;

View File

@ -869,12 +869,12 @@
table2Version = 160 ;
indicatorOfParameter = 136 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'tcwv' = {
table2Version = 128 ;
indicatorOfParameter = 137 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'tcwv' = {
table2Version = 180 ;
indicatorOfParameter = 137 ;

View File

@ -869,13 +869,13 @@
table2Version = 160 ;
indicatorOfParameter = 136 ;
}
#Total column water vapour
'Total column water vapour' = {
#Total column vertically-integrated water vapour
'Total column vertically-integrated water vapour' = {
table2Version = 128 ;
indicatorOfParameter = 137 ;
}
#Total column water vapour
'Total column water vapour' = {
#Total column vertically-integrated water vapour
'Total column vertically-integrated water vapour' = {
table2Version = 180 ;
indicatorOfParameter = 137 ;
}

View File

@ -869,12 +869,12 @@
table2Version = 160 ;
indicatorOfParameter = 136 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'137' = {
table2Version = 128 ;
indicatorOfParameter = 137 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'137' = {
table2Version = 180 ;
indicatorOfParameter = 137 ;

View File

@ -869,12 +869,12 @@
table2Version = 160 ;
indicatorOfParameter = 136 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'tcwv' = {
table2Version = 128 ;
indicatorOfParameter = 137 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'tcwv' = {
table2Version = 180 ;
indicatorOfParameter = 137 ;

View File

@ -26,3 +26,6 @@
# sund
"accum" = {indicatorOfParameter=189;gribTablesVersionNo=128;centre=98;}
# runoff
"accum" = {indicatorOfParameter=205;gribTablesVersionNo=128;centre=98;}

View File

@ -869,12 +869,12 @@
table2Version = 160 ;
indicatorOfParameter = 136 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'kg m**-2' = {
table2Version = 128 ;
indicatorOfParameter = 137 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'kg m**-2' = {
table2Version = 180 ;
indicatorOfParameter = 137 ;

View File

@ -85,7 +85,7 @@
table2Version = 200 ;
indicatorOfParameter = 39 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'tcwv' = {
table2Version = 200 ;
indicatorOfParameter = 54 ;

View File

@ -85,8 +85,8 @@
table2Version = 200 ;
indicatorOfParameter = 39 ;
}
#Total column water vapour
'Total column water vapour' = {
#Total column vertically-integrated water vapour
'Total column vertically-integrated water vapour' = {
table2Version = 200 ;
indicatorOfParameter = 54 ;
}

View File

@ -85,7 +85,7 @@
table2Version = 200 ;
indicatorOfParameter = 39 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'137' = {
table2Version = 200 ;
indicatorOfParameter = 54 ;

View File

@ -85,7 +85,7 @@
table2Version = 200 ;
indicatorOfParameter = 39 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'tcwv' = {
table2Version = 200 ;
indicatorOfParameter = 54 ;

View File

@ -85,7 +85,7 @@
table2Version = 200 ;
indicatorOfParameter = 39 ;
}
#Total column water vapour
#Total column vertically-integrated water vapour
'kg m**-2' = {
table2Version = 200 ;
indicatorOfParameter = 54 ;

View File

@ -5,6 +5,12 @@
parameterCategory = 2 ;
parameterNumber = 0 ;
}
#Total column vertically-integrated water vapour
'lwe_thickness_of_atmosphere_mass_content_of_water_vapor' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Surface solar radiation downwards
'surface_downwelling_shortwave_flux_in_air' = {
discipline = 0 ;

View File

@ -199,6 +199,12 @@
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
}
#Total column vertically-integrated water vapour
'tcwv' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Surface solar radiation downwards
'ssrd' = {
discipline = 0 ;
@ -4152,12 +4158,6 @@
parameterCategory = 1 ;
parameterNumber = 13 ;
}
#Total column integrated water vapour
'tciwv' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Rain precipitation rate
'rprate' = {
discipline = 0 ;

View File

@ -1,10 +1,4 @@
# Automatically generated by ./create_def.pl, do not edit
#Total column water vapour
'lwe_thickness_of_atmosphere_mass_content_of_water_vapor' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}
#Soil temperature level 1
'surface_temperature' = {
discipline = 192 ;

View File

@ -106,3 +106,9 @@
parameterCategory = 210 ;
parameterNumber = 74 ;
}
#Total column vertically-integrated water vapour
'lwe_thickness_of_atmosphere_mass_content_of_water_vapor' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}

View File

@ -671,12 +671,6 @@
parameterCategory = 128 ;
parameterNumber = 128 ;
}
#Total column water vapour
'tcwv' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}
#Soil temperature level 1
'stl1' = {
discipline = 192 ;
@ -922,9 +916,11 @@
}
#Runoff
'ro' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 201 ;
typeOfStatisticalProcessing = 1 ;
}
#Total column ozone
'tco3' = {
@ -1042,12 +1038,13 @@
}
#Total precipitation
'tp' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 52 ;
parameterNumber = 193 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 255 ;
typeOfStatisticalProcessing = 1 ;
unitsFactor = 1000 ;
}
#Instantaneous eastward turbulent surface stress
'iews' = {

View File

@ -322,3 +322,15 @@
parameterCategory = 210 ;
parameterNumber = 74 ;
}
#Runoff
'ro' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
}
#Total column vertically-integrated water vapour
'tcwv' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}

View File

@ -671,12 +671,6 @@
parameterCategory = 128 ;
parameterNumber = 128 ;
}
#Total column water vapour
'Total column water vapour' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}
#Soil temperature level 1
'Soil temperature level 1' = {
discipline = 192 ;
@ -922,9 +916,11 @@
}
#Runoff
'Runoff' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 201 ;
typeOfStatisticalProcessing = 1 ;
}
#Total column ozone
'Total column ozone' = {
@ -1042,12 +1038,13 @@
}
#Total precipitation
'Total precipitation' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 52 ;
parameterNumber = 193 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 255 ;
typeOfStatisticalProcessing = 1 ;
unitsFactor = 1000 ;
}
#Instantaneous eastward turbulent surface stress
'Instantaneous eastward turbulent surface stress' = {

View File

@ -322,3 +322,15 @@
parameterCategory = 210 ;
parameterNumber = 74 ;
}
#Runoff
'Runoff' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
}
#Total column vertically-integrated water vapour
'Total column vertically-integrated water vapour' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}

View File

@ -671,12 +671,6 @@
parameterCategory = 128 ;
parameterNumber = 128 ;
}
#Total column water vapour
'137' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}
#Soil temperature level 1
'139' = {
discipline = 192 ;
@ -922,9 +916,11 @@
}
#Runoff
'205' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 201 ;
typeOfStatisticalProcessing = 1 ;
}
#Total column ozone
'206' = {
@ -1042,12 +1038,13 @@
}
#Total precipitation
'228' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 52 ;
parameterNumber = 193 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 255 ;
typeOfStatisticalProcessing = 1 ;
unitsFactor = 1000 ;
}
#Instantaneous eastward turbulent surface stress
'229' = {

View File

@ -322,3 +322,15 @@
parameterCategory = 210 ;
parameterNumber = 74 ;
}
#Runoff
'205' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
}
#Total column vertically-integrated water vapour
'137' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}

View File

@ -671,12 +671,6 @@
parameterCategory = 128 ;
parameterNumber = 128 ;
}
#Total column water vapour
'tcwv' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}
#Soil temperature level 1
'stl1' = {
discipline = 192 ;
@ -922,9 +916,11 @@
}
#Runoff
'ro' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 201 ;
typeOfStatisticalProcessing = 1 ;
}
#Total column ozone
'tco3' = {
@ -1042,12 +1038,13 @@
}
#Total precipitation
'tp' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 52 ;
parameterNumber = 193 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 255 ;
typeOfStatisticalProcessing = 1 ;
unitsFactor = 1000 ;
}
#Instantaneous eastward turbulent surface stress
'iews' = {

View File

@ -322,3 +322,15 @@
parameterCategory = 210 ;
parameterNumber = 74 ;
}
#Runoff
'ro' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
}
#Total column vertically-integrated water vapour
'tcwv' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}

View File

@ -671,12 +671,6 @@
parameterCategory = 128 ;
parameterNumber = 128 ;
}
#Total column water vapour
'kg m**-2' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}
#Soil temperature level 1
'K' = {
discipline = 192 ;
@ -922,9 +916,11 @@
}
#Runoff
'm' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
localTablesVersion = 1 ;
discipline = 2 ;
parameterCategory = 0 ;
parameterNumber = 201 ;
typeOfStatisticalProcessing = 1 ;
}
#Total column ozone
'kg m**-2' = {
@ -1042,12 +1038,13 @@
}
#Total precipitation
'm' = {
localTablesVersion = 1 ;
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 52 ;
parameterNumber = 193 ;
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 255 ;
typeOfStatisticalProcessing = 1 ;
unitsFactor = 1000 ;
}
#Instantaneous eastward turbulent surface stress
'N m**-2' = {

View File

@ -322,3 +322,15 @@
parameterCategory = 210 ;
parameterNumber = 74 ;
}
#Runoff
'm' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 205 ;
}
#Total column vertically-integrated water vapour
'kg m**-2' = {
discipline = 192 ;
parameterCategory = 128 ;
parameterNumber = 137 ;
}

View File

@ -90,6 +90,12 @@
scaleFactorOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 3 ;
}
#Total column integrated water vapour
'tciwv' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#2 metre relative humidity
'r2' = {
discipline = 0 ;

View File

@ -90,6 +90,12 @@
scaleFactorOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 3 ;
}
#Total column integrated water vapour
'Total column integrated water vapour' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#2 metre relative humidity
'2 metre relative humidity' = {
discipline = 0 ;

View File

@ -90,6 +90,12 @@
scaleFactorOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 3 ;
}
#Total column integrated water vapour
'260057' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#2 metre relative humidity
'260242' = {
discipline = 0 ;

View File

@ -90,6 +90,12 @@
scaleFactorOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 3 ;
}
#Total column integrated water vapour
'tciwv' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#2 metre relative humidity
'2r' = {
discipline = 0 ;

View File

@ -90,6 +90,12 @@
scaleFactorOfFirstFixedSurface = 1 ;
typeOfStatisticalProcessing = 3 ;
}
#Total column integrated water vapour
'kg m**-2' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#2 metre relative humidity
'%' = {
discipline = 0 ;

View File

@ -2,11 +2,13 @@
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=8;}
'o2d' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=9;}
'sfc' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=162;}
'sfc' = {typeOfFirstFixedSurface=7; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=8; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=17; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=18; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=20; scaleFactorOfFirstFixedSurface=-2; scaledValueOfFirstFixedSurface=29315; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=20; scaleFactorOfFirstFixedSurface=-2;
scaledValueOfFirstFixedSurface=29315; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=20; typeOfSecondFixedSurface=255;}
'pl' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=255;}
'pl' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=100;}
@ -30,7 +32,8 @@
'sol' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=255;}
'sol' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=152;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0; scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0;
scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=160;}
'o2d' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=9;}
'sfc' = {typeOfFirstFixedSurface=162; typeOfSecondFixedSurface=255;}
@ -41,8 +44,10 @@
'o2d' = {typeOfFirstFixedSurface=170; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=171; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=255;}
'sfc' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=255; discipline=1;}
'o2d' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=176; typeOfSecondFixedSurface=255;}
'o2d' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=176;}
'sfc' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=176; discipline=1;}
'o2d' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=176;}
'sfc' = {typeOfFirstFixedSurface=177; typeOfSecondFixedSurface=255;}

View File

@ -199,6 +199,12 @@
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
}
#Total column vertically-integrated water vapour
'Total column vertically-integrated water vapour' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Surface solar radiation downwards
'Surface solar radiation downwards' = {
discipline = 0 ;
@ -4152,12 +4158,6 @@
parameterCategory = 1 ;
parameterNumber = 13 ;
}
#Total column integrated water vapour
'Total column integrated water vapour' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Rain precipitation rate
'Rain precipitation rate' = {
discipline = 0 ;

View File

@ -199,6 +199,12 @@
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
}
#Total column vertically-integrated water vapour
'137' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Surface solar radiation downwards
'169' = {
discipline = 0 ;
@ -4152,12 +4158,6 @@
parameterCategory = 1 ;
parameterNumber = 13 ;
}
#Total column integrated water vapour
'260057' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Rain precipitation rate
'260058' = {
discipline = 0 ;

View File

@ -199,6 +199,12 @@
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
}
#Total column vertically-integrated water vapour
'tcwv' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Surface solar radiation downwards
'ssrd' = {
discipline = 0 ;
@ -4152,12 +4158,6 @@
parameterCategory = 1 ;
parameterNumber = 13 ;
}
#Total column integrated water vapour
'tciwv' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Rain precipitation rate
'rprate' = {
discipline = 0 ;

View File

@ -1,3 +1,3 @@
# Code table 4.2 - discipline=0 category=1 for ECMWF
192 192 Snow evaporation rate (kg m-2 s-1)
193 193 Total precipitation (m)

View File

@ -8,4 +8,5 @@
198 198 GPP coefficient from Biogenic Flux Adjustment System
199 199 Rec coefficient from Biogenic Flux Adjustment System
200 200 Surface roughness length for heat (m)
201 201 Water runoff (m)
255 255 Missing

View File

@ -1,51 +1,68 @@
# Concept typeOfLevel
'surface' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=255;}
'cloudBase' = {typeOfFirstFixedSurface=2; typeOfSecondFixedSurface=255;}
'cloudTop' = {typeOfFirstFixedSurface=3; typeOfSecondFixedSurface=255;}
'isothermZero' = {typeOfFirstFixedSurface=4; typeOfSecondFixedSurface=255;}
'adiabaticCondensation' = {typeOfFirstFixedSurface=5; typeOfSecondFixedSurface=255;}
'maxWind' = {typeOfFirstFixedSurface=6; typeOfSecondFixedSurface=255;}
'tropopause' = {typeOfFirstFixedSurface=7; typeOfSecondFixedSurface=255;}
'nominalTop' = {typeOfFirstFixedSurface=8; typeOfSecondFixedSurface=255;}
'seaBottom' = {typeOfFirstFixedSurface=9; typeOfSecondFixedSurface=255;}
'surface' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=255;}
'entireAtmosphere' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=8;}
'entireOcean' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=9;}
'entireLake' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=162;}
'cloudBase' = {typeOfFirstFixedSurface=2; typeOfSecondFixedSurface=255;}
'cloudTop' = {typeOfFirstFixedSurface=3; typeOfSecondFixedSurface=255;}
'isothermZero' = {typeOfFirstFixedSurface=4; typeOfSecondFixedSurface=255;}
'adiabaticCondensation' = {typeOfFirstFixedSurface=5; typeOfSecondFixedSurface=255;}
'maxWind' = {typeOfFirstFixedSurface=6; typeOfSecondFixedSurface=255;}
'tropopause' = {typeOfFirstFixedSurface=7; typeOfSecondFixedSurface=255;}
'nominalTop' = {typeOfFirstFixedSurface=8; typeOfSecondFixedSurface=255;}
'seaBottom' = {typeOfFirstFixedSurface=9; typeOfSecondFixedSurface=255;}
# Note: We already had 'entireAtmosphere' mapped before adding this one so had to choose another name
'atmosphere' = {typeOfFirstFixedSurface=10; typeOfSecondFixedSurface=255;}
'mostUnstableParcel' = {typeOfFirstFixedSurface=17; typeOfSecondFixedSurface=255;}
'mixedLayerParcel' = {typeOfFirstFixedSurface=18; typeOfSecondFixedSurface=255;}
'isothermal' = {typeOfFirstFixedSurface=20; typeOfSecondFixedSurface=255;}
'isobaricInPa' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=255; pressureUnits='Pa';}
'isobaricInhPa' = {typeOfFirstFixedSurface=100; pressureUnits='hPa'; typeOfSecondFixedSurface=255;}
'isobaricLayer' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=100;}
'meanSea' = {typeOfFirstFixedSurface=101; typeOfSecondFixedSurface=255;}
'heightAboveSea' = {typeOfFirstFixedSurface=102; typeOfSecondFixedSurface=255;}
'heightAboveSeaLayer' = {typeOfFirstFixedSurface=102; typeOfSecondFixedSurface=102;}
'heightAboveGround' = {typeOfFirstFixedSurface=103; typeOfSecondFixedSurface=255;}
'heightAboveGroundLayer' = {typeOfFirstFixedSurface=103; typeOfSecondFixedSurface=103;}
'sigma' = {typeOfFirstFixedSurface=104; typeOfSecondFixedSurface=255;}
'sigmaLayer' = {typeOfFirstFixedSurface=104; typeOfSecondFixedSurface=104;}
'hybrid' = {typeOfFirstFixedSurface=105; typeOfSecondFixedSurface=255;}
'hybridHeight' = {typeOfFirstFixedSurface=118; typeOfSecondFixedSurface=255;}
'hybridLayer' = {typeOfFirstFixedSurface=105; typeOfSecondFixedSurface=105;}
'depthBelowLand' = {typeOfFirstFixedSurface=106; typeOfSecondFixedSurface=255;}
'depthBelowLandLayer' = {typeOfFirstFixedSurface=106; typeOfSecondFixedSurface=106;}
'theta' = {typeOfFirstFixedSurface=107; typeOfSecondFixedSurface=255;}
'thetaLayer' = {typeOfFirstFixedSurface=107; typeOfSecondFixedSurface=107;}
'pressureFromGround' = {typeOfFirstFixedSurface=108; typeOfSecondFixedSurface=255;}
'pressureFromGroundLayer' = {typeOfFirstFixedSurface=108; typeOfSecondFixedSurface=108;}
'potentialVorticity' = {typeOfFirstFixedSurface=109; typeOfSecondFixedSurface=255;}
'eta' = {typeOfFirstFixedSurface=111; typeOfSecondFixedSurface=255;}
'soil' = {typeOfFirstFixedSurface=151; typeOfSecondFixedSurface=255;}
'soilLayer' = {typeOfFirstFixedSurface=151; typeOfSecondFixedSurface=151;}
'atmosphere' = {typeOfFirstFixedSurface=10; typeOfSecondFixedSurface=255;}
'mostUnstableParcel' = {typeOfFirstFixedSurface=17; typeOfSecondFixedSurface=255;}
'mixedLayerParcel' = {typeOfFirstFixedSurface=18; typeOfSecondFixedSurface=255;}
'isothermal' = {typeOfFirstFixedSurface=20; typeOfSecondFixedSurface=255;}
'isobaricInPa' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=255; pressureUnits='Pa';}
'isobaricInhPa' = {typeOfFirstFixedSurface=100; pressureUnits='hPa'; typeOfSecondFixedSurface=255;}
'isobaricLayer' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=100;}
'meanSea' = {typeOfFirstFixedSurface=101; typeOfSecondFixedSurface=255;}
'heightAboveSea' = {typeOfFirstFixedSurface=102; typeOfSecondFixedSurface=255;}
'heightAboveSeaLayer' = {typeOfFirstFixedSurface=102; typeOfSecondFixedSurface=102;}
'heightAboveGround' = {typeOfFirstFixedSurface=103; typeOfSecondFixedSurface=255;}
'heightAboveGroundLayer' = {typeOfFirstFixedSurface=103; typeOfSecondFixedSurface=103;}
'sigma' = {typeOfFirstFixedSurface=104; typeOfSecondFixedSurface=255;}
'sigmaLayer' = {typeOfFirstFixedSurface=104; typeOfSecondFixedSurface=104;}
'hybrid' = {typeOfFirstFixedSurface=105; typeOfSecondFixedSurface=255;}
'hybridLayer' = {typeOfFirstFixedSurface=105; typeOfSecondFixedSurface=105;}
'depthBelowLand' = {typeOfFirstFixedSurface=106; typeOfSecondFixedSurface=255;}
'depthBelowLandLayer' = {typeOfFirstFixedSurface=106; typeOfSecondFixedSurface=106;}
'theta' = {typeOfFirstFixedSurface=107; typeOfSecondFixedSurface=255;}
'thetaLayer' = {typeOfFirstFixedSurface=107; typeOfSecondFixedSurface=107;}
'pressureFromGround' = {typeOfFirstFixedSurface=108; typeOfSecondFixedSurface=255;}
'pressureFromGroundLayer' = {typeOfFirstFixedSurface=108; typeOfSecondFixedSurface=108;}
'potentialVorticity' = {typeOfFirstFixedSurface=109; typeOfSecondFixedSurface=255;}
'eta' = {typeOfFirstFixedSurface=111; typeOfSecondFixedSurface=255;}
'snow' = {typeOfFirstFixedSurface=114; typeOfSecondFixedSurface=255;}
'snowLayer' = {typeOfFirstFixedSurface=114; typeOfSecondFixedSurface=114;}
'mixedLayerDepthGeneric' = {typeOfFirstFixedSurface=117; typeOfSecondFixedSurface=255;}
'hybridHeight' = {typeOfFirstFixedSurface=118; typeOfSecondFixedSurface=255;}
'hybridPressure' = {typeOfFirstFixedSurface=119; typeOfSecondFixedSurface=255;}
# In the case of Generalized vertical height coordinates, NV must be 6
'generalVertical' = {genVertHeightCoords=1; typeOfFirstFixedSurface=150; NV=6;}
'generalVerticalLayer' = {genVertHeightCoords=1; typeOfFirstFixedSurface=150; typeOfSecondFixedSurface=150; NV=6;}
'depthBelowSea' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=255;}
'oceanSurface' = {typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0; scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=255;}
'oceanLayer' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=160;}
'entireAtmosphere' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=8;}
'entireOcean' = {typeOfFirstFixedSurface=1; typeOfSecondFixedSurface=9;}
'snow' = {typeOfFirstFixedSurface=114; typeOfSecondFixedSurface=255;}
'snowLayer' = {typeOfFirstFixedSurface=114; typeOfSecondFixedSurface=114;}
'seaIce' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=255;}
'seaIceLayer' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=152;}
'mixedLayerDepth' = {typeOfFirstFixedSurface=169; typeOfSecondFixedSurface=255;}
'generalVertical' = {genVertHeightCoords=1; typeOfFirstFixedSurface=150; NV=6;}
'generalVerticalLayer' = {genVertHeightCoords=1; typeOfFirstFixedSurface=150; typeOfSecondFixedSurface=150; NV=6;}
'soil' = {typeOfFirstFixedSurface=151; typeOfSecondFixedSurface=255;}
'soilLayer' = {typeOfFirstFixedSurface=151; typeOfSecondFixedSurface=151;}
'seaIce' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=255;}
'seaIceLayer' = {typeOfFirstFixedSurface=152; typeOfSecondFixedSurface=152;}
'depthBelowSea' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=255;}
'oceanSurface' = {typeOfFirstFixedSurface=160; scaleFactorOfFirstFixedSurface=0;
scaledValueOfFirstFixedSurface=0; typeOfSecondFixedSurface=255;}
'depthBelowSeaLayer' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=160;}
'oceanSurfaceToBottom' = {typeOfFirstFixedSurface=160; typeOfSecondFixedSurface=9;}
'lakeBottom' = {typeOfFirstFixedSurface=162; typeOfSecondFixedSurface=255;}
'mixingLayer' = {typeOfFirstFixedSurface=166; typeOfSecondFixedSurface=255;}
'oceanModel' = {typeOfFirstFixedSurface=168; typeOfSecondFixedSurface=255;}
'oceanModelLayer' = {typeOfFirstFixedSurface=168; typeOfSecondFixedSurface=168;}
'mixedLayerDepthByDensity' = {typeOfFirstFixedSurface=169; typeOfSecondFixedSurface=255;}
'mixedLayerDepthByTemperature' = {typeOfFirstFixedSurface=170; typeOfSecondFixedSurface=255;}
'mixedLayerDepthByDiffusivity' = {typeOfFirstFixedSurface=171; typeOfSecondFixedSurface=255;}
'iceTopOnWater' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=255;}
'iceLayerOnWater' = {typeOfFirstFixedSurface=174; typeOfSecondFixedSurface=176;}
'iceTopUnderSnowOnWater' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=255;}
'iceLayerUnderSnowOnWater' = {typeOfFirstFixedSurface=175; typeOfSecondFixedSurface=176;}
'iceBottomOnWater' = {typeOfFirstFixedSurface=176; typeOfSecondFixedSurface=255;}
'indefiniteSoilDepth' = {typeOfFirstFixedSurface=177; typeOfSecondFixedSurface=255;}

View File

@ -199,6 +199,12 @@
typeOfFirstFixedSurface = 1 ;
typeOfSecondFixedSurface = 8 ;
}
#Total column vertically-integrated water vapour
'kg m**-2' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Surface solar radiation downwards
'J m**-2' = {
discipline = 0 ;
@ -4152,12 +4158,6 @@
parameterCategory = 1 ;
parameterNumber = 13 ;
}
#Total column integrated water vapour
'kg m**-2' = {
discipline = 0 ;
parameterCategory = 1 ;
parameterNumber = 64 ;
}
#Rain precipitation rate
'kg m**-2 s**-1' = {
discipline = 0 ;

View File

@ -1,11 +1,4 @@
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
section_length[3] section1Length ;
unsigned[1] gribTablesVersionNo ;
@ -24,33 +17,18 @@ codetable[1] indicatorOfTypeOfLevel 'grib1/3.table' : string_type,edition_specif
alias ls.levelType = indicatorOfTypeOfLevel;
codetable[2] heightPressureEtcOfLevels 'grib1/3.table';
# Year of century
# NOTE 6 NOT FOUND
unsigned[1] yearOfCentury ;
# Month
unsigned[1] month ;
# Day
unsigned[1] yearOfCentury;
unsigned[1] month;
unsigned[1] day;
unsigned[1] hour;
unsigned[1] minute;
# Hour
unsigned[1] hour ;
# Minute
unsigned[1] minute ;
# Indicator of unit of time range
codetable[1] indicatorOfUnitOfTimeRange 'grib1/4.table';
# P1 - Period of time
# (number of time units)
# P1 - Period of time (number of time units)
unsigned[1] periodOfTime ;
alias P1 = periodOfTime ;
alias P1 = periodOfTime ;
# P2 - Period of time
# (number of time units)
# P2 - Period of time (number of time units)
unsigned[1] periodOfTimeIntervals ;

View File

@ -42,11 +42,11 @@ list( APPEND test_bins
bufr_read_scatterometer
bufr_read_synop
bufr_read_temp
bufr_read_tempf
bufr_set_keys
bufr_subset
mars_param
values_check
box
grib_values_check
multi2
large_grib1
get_product_kind)
@ -85,6 +85,7 @@ if( HAVE_BUILD_TOOLS )
grib_nearest_multiple
grib_multi
grib_set_missing
grib_values_check
bufr_attributes
bufr_copy_data
bufr_clone
@ -97,6 +98,7 @@ if( HAVE_BUILD_TOOLS )
bufr_read_scatterometer
bufr_read_synop
bufr_read_temp
bufr_read_tempf
bufr_set_keys
bufr_subset
get_product_kind)
@ -129,6 +131,7 @@ else()
bufr_read_scatterometer
bufr_read_synop
bufr_read_temp
bufr_read_tempf
bufr_set_keys
bufr_subset
get_product_kind)

View File

@ -43,8 +43,7 @@ noinst_PROGRAMS = c_grib_nearest \
c_grib_set_data \
c_grib_index \
c_mars_param \
c_values_check \
c_box \
c_grib_values_check \
c_grib_multi \
c_multi2 \
c_grib_multi_write \
@ -77,10 +76,9 @@ noinst_PROGRAMS = c_grib_nearest \
#bin_PROGRAMS = grib_nearest_multiple
c_box_SOURCES = box.c
c_grib_set_data_SOURCES = grib_set_data.c
c_mars_param_SOURCES = mars_param.c
c_values_check_SOURCES = values_check.c
c_grib_values_check_SOURCES = grib_values_check.c
c_grib_nearest_SOURCES = grib_nearest.c
c_grib_multi_write_SOURCES = grib_multi_write.c
c_grib_get_keys_SOURCES = grib_get_keys.c

View File

@ -0,0 +1,221 @@
/*
* (C) Copyright 2005- ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
/*
* C Implementation: bufr_read_tempf
*
* Description: read and print radiosonde data from TEMP BUFR messages.
* If available this version also lists the position information from the WMO list
* (now OSCAR/Surface) appended to the reports by ECMWF
*
* Author: Bruce Ingleby
*/
/*
* Please note that TEMP reports can be encoded in various ways in BUFR. Therefore the code
* below might not work directly for other types of TEMP messages than the one used in the
* example. It is advised to use bufr_dump to understand the structure of the messages.
*/
#include "eccodes.h"
/* Returns 1 if the bit at 'pos' in 'var' is set. The counting starts at 0 */
#define BTEST(var, pos) ((var) & (1 << (pos)))
/* Helper function to fill a double array with values of 'key'. Client must free memory */
static int get_double_array(codes_handle* h, const char* key, double** arr, size_t* size)
{
CODES_CHECK(codes_get_size(h, key, size), 0);
*arr = (double*)malloc(*size * sizeof(double));
return codes_get_double_array(h, key, *arr, size);
}
/* Helper function to fill an integer (=long) array with values of 'key'. Client must free memory */
static int get_long_array(codes_handle* h, const char* key, long** arr, size_t* size)
{
CODES_CHECK(codes_get_size(h, key, size), 0);
*arr = (long*)malloc(*size * sizeof(long));
return codes_get_long_array(h, key, *arr, size);
}
/* Reset dimension of input array to 'newsize' and fill with 'fillValue' */
static void realloc_and_fill(double** arr, size_t newsize, double fillValue)
{
size_t i;
free(*arr);
*arr = (double*)malloc(newsize * sizeof(double));
for(i=0; i<newsize; ++i) *arr[i] = fillValue;
}
int main(int argc, char* argv[])
{
FILE* in = NULL;
/* Message handle. Required in all the ecCodes calls acting on a message.*/
codes_handle* h = NULL;
double *lat = NULL, *lon = NULL, *presVal = NULL, *zVal = NULL;
double *dlatVal = NULL, *dlonVal = NULL;
double *tVal = NULL, *tdVal = NULL, *wspVal = NULL, *wdirVal = NULL;
double htg, htp, htec = 0, balloonwt;
int err = 0;
int status_rsno = 0, status_ht = 0, status_airt = 0, status_dewt = 0, status_p = 0;
int count = 0;
int llskip = 0;
int llstdonly = 1; /* Set True to list standard levels only */
size_t i = 0, size = 0, sizews = 0, sizelats = 0;
long blockNumber, stationNumber;
long year, month, day, hour, minute, second, ymd, hms, sondeType;
long *timeVal = NULL, *vssVal = NULL;
const char* infile = "../../data/bufr/PraticaTemp.bufr";
char statid[128] = {0,};
char dropid[128] = {0,};
char rsnumber[16] = {0,};
char rssoftware[16] = {0,};
in = fopen(infile, "rb");
if (!in) {
fprintf(stderr, "Error: unable to open file %s\n", infile);
return 1;
}
/* Loop over the messages in the BUFR file */
while ((h = codes_handle_new_from_file(NULL, in, PRODUCT_BUFR, &err)) != NULL || err != CODES_SUCCESS) {
count++;
if (h == NULL) {
fprintf(stderr, "Error: unable to create handle for message %d\n", count);
continue;
}
/* We need to instruct ecCodes to expand the descriptors i.e., unpack the data values */
CODES_CHECK(codes_set_long(h, "unpack", 1), 0);
/* In our BUFR message verticalSoundingSignificance is always followed by
* geopotential, airTemperature, dewpointTemperature,
* windDirection, windSpeed and pressure */
llskip = 0;
size = 1024;
err = codes_get_string(h, "aircraftRegistrationNumberOrOtherIdentification", dropid, &size);
if (err) strcpy(dropid, "UNKNOWN");
size = 1024;
err = codes_get_string(h, "shipOrMobileLandStationIdentifier", statid, &size);
if (err) strcpy(statid, dropid);
CODES_CHECK(codes_get_long(h, "blockNumber", &blockNumber), 0);
CODES_CHECK(codes_get_long(h, "stationNumber", &stationNumber), 0);
if (blockNumber < 99 && stationNumber < 1000)
sprintf(statid, "%ld%ld", blockNumber, stationNumber);
CODES_CHECK(codes_get_long(h, "year", &year), 0);
CODES_CHECK(codes_get_long(h, "month", &month), 0);
CODES_CHECK(codes_get_long(h, "day", &day), 0);
CODES_CHECK(codes_get_long(h, "hour", &hour), 0);
CODES_CHECK(codes_get_long(h, "minute", &minute), 0);
err = codes_get_long(h, "second", &second);
if (err) second = 0;
err = get_double_array(h, "latitude", &lat, &sizelats);
err = get_double_array(h, "longitude", &lon, &size);
status_ht = codes_get_double(h, "heightOfStationGroundAboveMeanSeaLevel", &htg);
if (status_ht) htg = -999.0;
status_ht = codes_get_double(h, "heightOfBarometerAboveMeanSeaLevel", &htp);
if (status_ht) htp = -999.0;
CODES_CHECK(codes_get_long(h, "radiosondeType", &sondeType), 0);
err = codes_get_double(h, "heightOfStation", &htec); /* Height from WMO list (BUFR) */
if (!err && htg == -999.0) htg = htec;
ymd = year * 10000 + month * 100 + day;
hms = hour * 10000 + minute * 100 + second;
size = 16;
status_rsno = codes_get_string(h, "radiosondeSerialNumber", rsnumber, &size);
size = 16;
codes_get_string(h, "softwareVersionNumber", rssoftware, &size);
err = codes_get_double(h, "weightOfBalloon", &balloonwt);
if (err) balloonwt = 0;
/* Ascent (skip reports without dtime array for now) */
err = get_long_array(h, "timePeriod", &timeVal, &size);
if (err) {
printf("Ob: %d %s %ld %ld %g %g %g %g %ld\n",
count, statid, ymd, hms, lat[0], lon[0], htg, htp, sondeType);
printf("Missing times - skip\n");
llskip = 1;
}
status_p = get_double_array(h, "pressure", &presVal, &size);
status_ht = get_double_array(h, "nonCoordinateGeopotentialHeight", &zVal, &size);
if (!llskip) {
err = get_double_array(h, "latitudeDisplacement", &dlatVal, &size);
err = get_double_array(h, "longitudeDisplacement", &dlonVal, &size);
err = get_long_array(h, "extendedVerticalSoundingSignificance", &vssVal, &size);
status_airt = get_double_array(h, "airTemperature", &tVal, &size);
status_dewt = get_double_array(h, "dewpointTemperature", &tdVal, &size);
err = get_double_array(h, "windDirection", &wdirVal, &size);
err = get_double_array(h, "windSpeed", &wspVal, &sizews);
if (status_p != CODES_SUCCESS) {
realloc_and_fill(&presVal, sizews, -999999999.0);
}
if (status_ht != CODES_SUCCESS) {
realloc_and_fill(&zVal, sizews, -999999999.0);
}
if (status_airt != CODES_SUCCESS) {
realloc_and_fill(&tVal, sizews, -999999999.0);
}
if (status_dewt != CODES_SUCCESS) {
realloc_and_fill(&tdVal, sizews, -999999999.0);
}
/* Print the values */
printf("Ob: %7d %s %ld %ld %7.3f %7.3f %7.1f %7.1f %4ld %5lu\n",
count, statid, ymd, hms, lat[0], lon[0], htg, htp, sondeType, sizews);
if (status_rsno == CODES_SUCCESS) {
printf("RS number/software/balloonwt: %s %s %7.3f\n", rsnumber, rssoftware, balloonwt);
}
if (status_ht == CODES_SUCCESS && sizelats > 1) {
printf("WMO list lat, lon, ht: %s %g %g %g\n", statid, lat[1], lon[1], htec);
}
printf("level dtime dlat dlon pressure geopotH airTemp dewPtT windDir windSp signif\n");
for (i = 0; i < sizews; ++i) {
long iflag = vssVal[i];
if (!llstdonly || BTEST(iflag, 16)) {
printf("%5lu %6ld %7.3f %7.3f %9.1f %8.1f %8.2f %8.2f %8.2f %8.2f %8ld\n",
i + 1, timeVal[i],
dlatVal[i], dlonVal[i],
presVal[i], zVal[i], tVal[i], tdVal[i],
wdirVal[i], wspVal[i], vssVal[i]);
}
}
}
/* Release memory */
free(lat);
free(lon);
free(timeVal);
free(dlatVal);
free(dlonVal);
free(presVal);
free(zVal);
free(tVal);
free(tdVal);
free(wdirVal);
free(wspVal);
free(vssVal);
codes_handle_delete(h);
}
fclose(in);
printf("Finishing normally. Number of BUFR records read: %d\n", count);
return 0;
}

55
examples/C/bufr_read_tempf.sh Executable file
View File

@ -0,0 +1,55 @@
#!/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.sh
#Define a common label for all the tmp files
label="bufr_read_tempf_c"
tempOut=temp.${label}.txt
tempRef=temp.${label}.ref
rm -f $tempRef $tempOut
# The path to the BUFR file is hard coded in the example
${examples_dir}/c_bufr_read_tempf > $tempOut
NUMDIFF_CMD="numdiff"
CHECKER=""
if command -v $NUMDIFF_CMD >/dev/null 2>&1; then
CHECKER=$NUMDIFF_CMD
fi
# Check the results
if test "x$CHECKER" != "x"; then
cat > $tempRef<<EOF
Ob: 1 16245 20151202 110419 41.670 12.450 35.0 36.0 114 64
RS number/software/balloonwt: J2063451 MW41 2.3.0 0.000
level dtime dlat dlon pressure geopotH airTemp dewPtT windDir windSp signif
2 44 -0.000 0.001 100000.0 243.0 286.16 280.56 147.00 0.20 65536
3 169 -0.001 0.000 92500.0 892.0 280.94 278.07 68.00 3.00 65536
7 316 -0.000 -0.002 85000.0 1593.0 283.60 269.23 60.00 4.00 65536
14 630 -0.003 0.003 70000.0 3187.0 274.99 244.50 296.00 5.40 65536
24 1117 -0.005 0.018 50000.0 5828.0 258.61 246.93 310.00 3.30 65536
29 1411 -0.011 0.030 40000.0 7482.0 247.70 219.91 273.00 2.20 65536
32 1761 -0.004 0.033 30000.0 9493.0 230.33 216.70 157.00 3.30 65536
37 1967 0.003 0.028 25000.0 10696.0 220.52 204.05 157.00 5.20 65536
42 2234 0.016 0.017 20000.0 12098.0 208.45 199.44 119.00 8.40 65536
53 2578 0.015 0.018 15000.0 13835.0 207.93 190.61 316.00 8.70 65536
64 3087 -0.021 0.036 10000.0 16310.0 208.29 183.83 340.00 9.60 79872
Finishing normally. Number of BUFR records read: 1
EOF
$CHECKER $tempRef $tempOut
fi
# Clean up
rm -f $tempRef $tempOut

View File

@ -9,5 +9,15 @@
. ./include.sh
tempGrib="out_surface_level.grib2"
# Input and output GRIB files are hard coded in the example
${examples_dir}/c_grib_set_missing
rm -f out_surface_level.grib2
# Check the keys have been set to MISSING
sf=`${tools_dir}/grib_get -p scaleFactorOfFirstFixedSurface $tempGrib`
[ "$sf" = "MISSING" ]
sf=`${tools_dir}/grib_get -p scaledValueOfFirstFixedSurface $tempGrib`
[ "$sf" = "MISSING" ]
rm -f $tempGrib

View File

@ -24,13 +24,13 @@ int main(int argc, char* argv[])
f = fopen(infile, "rb");
if (!f) {
perror(infile);
exit(1);
return 1;
}
h = codes_handle_new_from_file(c, f, PRODUCT_GRIB, &err);
if (!h) {
fprintf(stderr, "unable to create handle from file %s\n", infile);
exit(err);
return 1;
}
fclose(f);
@ -48,7 +48,7 @@ int main(int argc, char* argv[])
for (i = 0; i < nvalues; i++) {
if (values[i].error == err) name = (char*)values[i].name;
}
fprintf(stderr, "Error: \"%s\" %s\n", name, codes_get_error_message(err));
printf("Error: \"%s\" %s\n", name, codes_get_error_message(err));
}
values[1].name = "levelll";
@ -57,8 +57,10 @@ int main(int argc, char* argv[])
for (i = 0; i < nvalues; i++) {
if (values[i].error == err) name = (char*)values[i].name;
}
fprintf(stderr, "Error: \"%s\" %s\n", name, codes_get_error_message(err));
printf("Error: \"%s\" %s\n", name, codes_get_error_message(err));
}
codes_handle_delete(h);
return 0;
}

32
examples/C/grib_values_check.sh Executable file
View File

@ -0,0 +1,32 @@
#!/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.sh
#Define a common label for all the tmp files
label="grib_values_check_c"
tempOut=${label}.tmp.out
tempErr=${label}.tmp.err
tempRef=${label}.tmp.ref
cat > $tempRef <<EOF
Error: "level" Value is different
Error: "levelll" Key/value not found
EOF
# Input GRIB file path is hard coded in the example
${examples_dir}/c_grib_values_check > $tempOut
# Compare output with the reference
cat $tempOut
diff $tempRef $tempOut
# Clean up
rm -f $tempRef $tempErr $tempOut

View File

@ -26,7 +26,8 @@ program bufr_read_tempf
integer :: i, count = 0
integer :: iflag
integer :: status_id, status_ht, status_time = 0, status_p
integer :: status_rsno, status_rssoft, status_balloonwt, statid_missing
integer :: status_airt, status_dewt
integer :: status_rsno, status_rssoft, status_balloonwt
integer(kind=4) :: sizews
integer(kind=4) :: blockNumber, stationNumber
integer(kind=4) :: ymd, hms
@ -38,7 +39,7 @@ program bufr_read_tempf
real(kind=8), dimension(:), allocatable :: lat, lon
real(kind=8), dimension(:), allocatable :: timeVal, dlatVal, dlonVal, vssVal
real(kind=8), dimension(:), allocatable :: presVal, zVal, tVal, tdVal, wdirVal, wspVal
character(len=128) :: statid
character(len=128) :: statid, dropid
character(len=16) :: rsnumber
character(len=16) :: rssoftware
@ -49,7 +50,7 @@ program bufr_read_tempf
call codes_bufr_new_from_file(ifile, ibufr, iret)
! loop through all messages in the file
do while (iret /= CODES_END_OF_FILE .AND. status_time == CODES_SUCCESS)
do while (iret /= CODES_END_OF_FILE)
! Can check the template used
! call codes_get(ibufr,'unexpandedDescriptors',descriptors)
@ -67,10 +68,12 @@ program bufr_read_tempf
llskip = .False.
! Metadata:
call codes_get(ibufr, 'aircraftRegistrationNumberOrOtherIdentification', dropid, status_id)
IF (status_id /= CODES_SUCCESS) dropid = "UNKNOWN "
call codes_get(ibufr, 'shipOrMobileLandStationIdentifier', statid, status_id)
IF (status_id /= CODES_SUCCESS) statid = "UNKNOWN"
call codes_is_missing(ibufr, 'shipOrMobileLandStationIdentifier', statid_missing)
IF (statid_missing == 1) statid = "MISSING"
IF (status_id /= CODES_SUCCESS) statid = dropid
! call codes_is_missing(ibufr, 'shipOrMobileLandStationIdentifier', statid_missing)
! IF (statid_missing == 1) statid = "MISSING"
call codes_get(ibufr, 'blockNumber', blockNumber)
call codes_get(ibufr, 'stationNumber', stationNumber)
IF (blockNumber <= 99.0 .AND. stationNumber <= 1000) write (statid, '(I2.2,I3.3,3X)') blockNumber, stationNumber
@ -98,7 +101,7 @@ program bufr_read_tempf
call codes_get(ibufr, 'weightOfBalloon', balloonwt, status_balloonwt)
IF (status_balloonwt /= CODES_SUCCESS) balloonwt = 0.0
! Ascent (skip incomplete reports for now)
! Ascent (skip reports without dtime array for now)
call codes_get(ibufr, 'timePeriod', timeVal, status_time)
IF (status_time /= CODES_SUCCESS) THEN
write (*, '(A,I7,A,A8,I9,I7.6,F9.3,F10.3,2F7.1,I4)') 'Ob: ', count, &
@ -107,41 +110,44 @@ program bufr_read_tempf
llskip = .True.
END IF
call codes_get(ibufr, 'pressure', presVal, status_p)
IF (status_p /= CODES_SUCCESS) THEN
write (*, '(A,I7,A,A8,I9,I7.6,F9.3,F10.3,2F7.1,I4)') 'Ob: ', count, &
' ', statid, ymd, hms, lat(1), lon(1), htg, htp, INT(sondeType)
write (*, '(A)') 'Missing pressures - skip'
llskip = .True.
END IF
call codes_get(ibufr, 'nonCoordinateGeopotentialHeight', zVal, status_ht)
IF (status_ht /= CODES_SUCCESS) THEN
write (*, '(A,I7,A,A8,I9,I7.6,F9.3,F10.3,2F7.1,I4)') 'Ob: ', count, &
' ', statid, ymd, hms, lat(1), lon(1), htg, htp, INT(sondeType)
write (*, '(A)') 'Missing heights - skip'
llskip = .True.
END IF
! IF (blockNumber /= 17 .OR. stationNumber /= 196) llskip=.True. ! FIX
! IF (blockNumber /= 17.0) llskip=.True. ! FIX
IF (.NOT. llskip) THEN
call codes_get(ibufr, 'latitudeDisplacement', dlatVal)
call codes_get(ibufr, 'longitudeDisplacement', dlonVal)
call codes_get(ibufr, 'extendedVerticalSoundingSignificance', vssVal)
call codes_get(ibufr, 'airTemperature', tVal)
call codes_get(ibufr, 'dewpointTemperature', tdVal)
call codes_get(ibufr, 'airTemperature', tVal, status_airt)
call codes_get(ibufr, 'dewpointTemperature', tdVal, status_dewt)
call codes_get(ibufr, 'windDirection', wdirVal)
call codes_get(ibufr, 'windSpeed', wspVal)
! ---- Array sizes (pressure size can be larger - wind shear levels)
sizews = size(wspVal)
IF (status_p /= CODES_SUCCESS) THEN
allocate(presVal(sizews))
presVal(:) = -999999999.0
END IF
IF (status_ht /= CODES_SUCCESS) THEN
allocate(zVal(sizews))
zVal(:) = -999999999.0
END IF
IF (status_airt /= CODES_SUCCESS) THEN
allocate(tVal(sizews))
tVal(:) = -999999999.0
END IF
IF (status_dewt /= CODES_SUCCESS) THEN
allocate(tdVal(sizews))
tdVal(:) = -999999999.0
END IF
! ---- Print the values --------------------------------
write (*, '(A,I7,A,A8,I9,I7.6,F9.3,F10.3,2F7.1,I4,I5)') 'Ob: ', count, &
' ', statid, ymd, hms, lat(1), lon(1), htg, htp, INT(sondeType), sizews
IF (status_rsno == CODES_SUCCESS) write (*, '(A,A,A,F7.3)') &
'RS number/software/balloonwt: ', rsnumber, rssoftware, balloonwt
IF (status_ht == CODES_SUCCESS .AND. SIZE(lat) > 1) write (*, '(A,F9.3,F10.3,F7.1)') &
'WMO list lat, lon, ht: ', lat(2), lon(2), htec
IF (status_ht == CODES_SUCCESS .AND. SIZE(lat) > 1) write (*, '(A,A,F9.3,F10.3,F7.1)') &
'WMO list lat, lon, ht: ', statid, lat(2), lon(2), htec
write (*, '(A)') 'level dtime dlat dlon pressure geopotH airTemp dewPtT windDir windSp signif'
do i = 1, sizews
iflag = vssVal(i)
@ -166,7 +172,6 @@ program bufr_read_tempf
IF (ALLOCATED(lat)) deallocate (lat)
IF (ALLOCATED(lon)) deallocate (lon)
! 999 CONTINUE
! release the BUFR message
call codes_release(ibufr)
@ -176,5 +181,6 @@ program bufr_read_tempf
end do
call codes_close_file(ifile)
print*, 'Finishing normally. Number of BUFR records read: ', count
end program bufr_read_tempf

View File

@ -10,7 +10,7 @@
. ./include.sh
#Define a common label for all the tmp files
# Define a common label for all the tmp files
label="bufr_read_tempf_f"
tempOut=temp.${label}.txt
tempRef=temp.${label}.ref
@ -19,28 +19,37 @@ rm -f $tempRef $tempOut
# The path to the BUFR file is hard coded in the example
${examples_dir}/eccodes_f_bufr_read_tempf > $tempOut
NUMDIFF_CMD="numdiff"
CHECKER=""
if command -v $NUMDIFF_CMD >/dev/null 2>&1; then
CHECKER=$NUMDIFF_CMD
fi
# Check the results
if test "x$CHECKER" != "x"; then
cat > $tempRef<<EOF
Statid: MISSING
Ob: 1 16 245 20151202 110419 41.670 12.450 35.0 36.0 114 64
WMO list lat, lon, ht: 41.670 12.450 0.0
Radiosonde number/software: J2063451 MW41 2.3.0
Ob: 1 16245 20151202 110419 41.670 12.450 35.0 36.0 114 64
RS number/software/balloonwt: J2063451 MW41 2.3.0 0.000
level dtime dlat dlon pressure geopotH airTemp dewPtT windDir windSp signif
2 44.0 -0.000 0.001 100000.0 243.0 286.16 5.60 147.00 0.20 65536
3 169.0 -0.001 0.000 92500.0 892.0 280.94 2.87 68.00 3.00 65536 tjump
7 316.0 -0.000 -0.002 85000.0 1593.0 283.60 14.37 60.00 4.00 65536
14 630.0 -0.003 0.003 70000.0 3187.0 274.99 30.49 296.00 5.40 65536
24 1117.0 -0.005 0.018 50000.0 5828.0 258.61 11.68 310.00 3.30 65536 tjump
29 1411.0 -0.011 0.030 40000.0 7482.0 247.70 27.79 273.00 2.20 65536
32 1761.0 -0.004 0.033 30000.0 9493.0 230.33 13.63 157.00 3.30 65536
37 1967.0 0.003 0.028 25000.0 10696.0 220.52 16.47 157.00 5.20 65536
42 2234.0 0.016 0.017 20000.0 12098.0 208.45 9.01 119.00 8.40 65536
53 2578.0 0.015 0.018 15000.0 13835.0 207.93 17.32 316.00 8.70 65536
64 3087.0 -0.021 0.036 10000.0 16310.0 208.29 24.46 340.00 9.60 79872
2 44.0 -0.000 0.001 100000.0 243.0 286.16 280.56 147.00 0.20 65536
3 169.0 -0.001 0.000 92500.0 892.0 280.94 278.07 68.00 3.00 65536
7 316.0 -0.000 -0.002 85000.0 1593.0 283.60 269.23 60.00 4.00 65536
14 630.0 -0.003 0.003 70000.0 3187.0 274.99 244.50 296.00 5.40 65536
24 1117.0 -0.005 0.018 50000.0 5828.0 258.61 246.93 310.00 3.30 65536
29 1411.0 -0.011 0.030 40000.0 7482.0 247.70 219.91 273.00 2.20 65536
32 1761.0 -0.004 0.033 30000.0 9493.0 230.33 216.70 157.00 3.30 65536
37 1967.0 0.003 0.028 25000.0 10696.0 220.52 204.05 157.00 5.20 65536
42 2234.0 0.016 0.017 20000.0 12098.0 208.45 199.44 119.00 8.40 65536
53 2578.0 0.015 0.018 15000.0 13835.0 207.93 190.61 316.00 8.70 65536
64 3087.0 -0.021 0.036 10000.0 16310.0 208.29 183.83 340.00 9.60 79872
Finishing normally. Number of BUFR records read: 1
EOF
#diff -w $tempRef $tempOut
$CHECKER $tempRef $tempOut
fi
# Clean up
rm -f $tempRef $tempOut

View File

@ -59,6 +59,7 @@ if( HAVE_BUILD_TOOLS )
bufr_read_tropical_cyclone
bufr_read_synop
bufr_read_temp
bufr_read_tempf
bufr_set_keys
bufr_subset
get_product_kind
@ -93,6 +94,7 @@ else()
bufr_read_tropical_cyclone
bufr_read_synop
bufr_read_temp
bufr_read_tempf
bufr_set_keys
bufr_subset
get_product_kind

View File

@ -1,5 +1,5 @@
#
# Copyright 2005- ECMWF.
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@ -28,6 +28,7 @@ import sys
import traceback
import numpy as np
from eccodes import *
INPUT = "../../data/bufr/PraticaTemp.bufr"
@ -37,7 +38,7 @@ VERBOSE = 1 # verbose error reporting
def example():
# open BUFR file
f = open(INPUT, "rb")
llstdonly = 1
llstdonly = 1 # If 1 then list standard levels only, 0 list all levels
cnt = 0
# loop over the messages in the file
while 1:
@ -57,9 +58,13 @@ def example():
codes_set(bufr, "unpack", 1)
# get header information from the message
try:
sid = codes_get(bufr, "aircraftRegistrationNumberOrOtherIdentification")
dropid = codes_get(bufr, "aircraftRegistrationNumberOrOtherIdentification")
except Exception:
sid = "UNKNOWN"
dropid = "UNKNOWN "
try:
shipid = codes_get(bufr, "shipOrMobileLandStationIdentifier")
except Exception:
shipid = "UNKNOWN "
statid = "00000 "
try:
@ -70,20 +75,30 @@ def example():
except Exception:
statid = "00000 "
if statid == "00000 ":
statid = sid[0:8]
statid = shipid[0:8]
if statid == "UNKNOWN ":
statid = dropid[0:8]
# subtype = codes_get(bufr,'rdbSubtype')
sondetype = codes_get(bufr, "radiosondeType")
if sondetype == CODES_MISSING_LONG:
sondetype = 0
slat = codes_get_array(bufr, "latitude")
slon = codes_get_array(bufr, "longitude")
slat = np.where(slat != CODES_MISSING_DOUBLE, slat, np.nan)
slon = np.where(slon != CODES_MISSING_DOUBLE, slon, np.nan)
try:
htg = codes_get(bufr, "heightOfStationGroundAboveMeanSeaLevel")
if htg == CODES_MISSING_DOUBLE:
htg = np.nan
except Exception:
htg = -999.0
htg = np.nan
try:
htp = codes_get(bufr, "heightOfBarometerAboveMeanSeaLevel")
if htp == CODES_MISSING_DOUBLE:
htp = np.nan
except Exception:
htp = -999.0
htp = np.nan
year = codes_get(bufr, "year")
month = codes_get(bufr, "month")
day = codes_get(bufr, "day")
@ -91,8 +106,10 @@ def example():
minute = codes_get(bufr, "minute")
try:
second = codes_get(bufr, "second")
if second == CODES_MISSING_LONG:
second = 0
except Exception:
second = 0.0
second = 0
date = str.format("%i%.2i%.2i" % (year, month, day))
time = str.format("%.2i%.2i%.2i" % (hour, minute, second))
try:
@ -101,7 +118,7 @@ def example():
codes_release(bufr)
continue
print(
"Ob: %7i %s %s %s %7.3f %8.3f %6.1f %6.1f %3i %4i"
"Ob: %7i %8s %s %s %7.3f %8.3f %6.1f %6.1f %3i %4i"
% (
cnt,
statid,
@ -127,9 +144,14 @@ def example():
htec = codes_get(
bufr, "heightOfStation"
) # Height from WMO list (appended by ECMWF)
print("WMO list lat, lon, ht: %7.3f %8.3f %6.1f" % (slat[1], slon[1], htec))
if htec == CODES_MISSING_LONG:
htec = np.nan
print(
"WMO list lat, lon, ht: %s %7.3f %8.3f %6.1f"
% (statid, slat[1], slon[1], htec)
)
except Exception:
htec = 0
htec = np.nan
# get all the timePeriods
dtime = codes_get_array(bufr, "timePeriod")
@ -156,14 +178,14 @@ def example():
dewt = np.where(dewt != CODES_MISSING_DOUBLE, dewt, np.nan)
windd = np.where(windd != CODES_MISSING_LONG, windd, np.nan)
windsp = np.where(windsp != CODES_MISSING_DOUBLE, windsp, np.nan)
geopoth = np.where(geopoth != CODES_MISSING_DOUBLE, geopoth, np.nan)
geopoth = np.where(geopoth != CODES_MISSING_LONG, geopoth, np.nan)
pressure = np.where(pressure != CODES_MISSING_DOUBLE, pressure, np.nan)
# pressure = np.where(pressure > -1e10, pressure, np.nan)
print(
"level dtime dlat dlon pressure geopotH airTemp dewPtT windDir windSp signif"
)
for i in range(0, len(windsp)):
if (not llstdonly) or vsSignif[i] != 65536:
if llstdonly and vsSignif[i] != 65536:
continue
print(
"%5i %6.1f %6.3f %6.3f %8.1f %7.1f %7.2f %7.2f %7.2f %7.2f %7i"
@ -185,6 +207,7 @@ def example():
codes_release(bufr)
# close the file
f.close()
print("Finishing normally. Number of BUFR records read: ", cnt)
def main():

View File

@ -0,0 +1,46 @@
#!/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.sh
# Define a common label for all the tmp files
label="bufr_read_tempf_p"
tempOut=temp.${label}.txt
tempRef=temp.${label}.ref
rm -f $tempRef $tempOut
REDIRECT=/dev/null
# The path to the BUFR file is hardcoded in the example
$PYTHON $examples_src/bufr_read_tempf.py > $tempOut
#TODO: check the results
# Check the results
cat > $tempRef<<EOF
Ob: 1 16245 20151202 110419 41.670 12.450 35.0 36.0 114 64
level dtime dlat dlon pressure geopotH airTemp dewPtT windDir windSp signif
2 44.0 -0.000 0.001 100000.0 243.0 286.16 280.56 147.00 0.20 65536
3 169.0 -0.001 0.000 92500.0 892.0 280.94 278.07 68.00 3.00 65536
7 316.0 -0.000 -0.002 85000.0 1593.0 283.60 269.23 60.00 4.00 65536
14 630.0 -0.003 0.003 70000.0 3187.0 274.99 244.50 296.00 5.40 65536
24 1117.0 -0.005 0.018 50000.0 5828.0 258.61 246.93 310.00 3.30 65536
29 1411.0 -0.011 0.030 40000.0 7482.0 247.70 219.91 273.00 2.20 65536
32 1761.0 -0.004 0.033 30000.0 9493.0 230.33 216.70 157.00 3.30 65536
37 1967.0 0.003 0.028 25000.0 10696.0 220.52 204.05 157.00 5.20 65536
42 2234.0 0.016 0.017 20000.0 12098.0 208.45 199.44 119.00 8.40 65536
53 2578.0 0.015 0.018 15000.0 13835.0 207.93 190.61 316.00 8.70 65536
Finishing normally. Number of BUFR records read: 1
EOF
#diff -w $tempRef $tempOut
# Clean up
rm -f $tempRef $tempOut

View File

@ -63,9 +63,10 @@ def generate_tables(INPUT, what):
codes_release(bufr)
continue
if codes_get(bufr, "numberOfSubsets") == 0:
# print('BUFR message number of subsets == 0. Ignoring')
# When we reach a message whose number of subsets == 0, we're done.
# All messages after this one encode observations (not tables)
codes_release(bufr)
continue
break
if DEBUG:
print(f"Processing message {cnt+1}")

View File

@ -1,4 +1,15 @@
#!/usr/bin/env python
#
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
#
from __future__ import print_function
import argparse
@ -51,7 +62,7 @@ args = parser.parse_args()
start = time.time()
print("MEMFS: starting")
print("MEMFS: Starting")
# Exclude experimental features e.g. GRIB3 and TAF
# The BUFR codetables is not used in the engine
@ -67,8 +78,8 @@ EXCLUDED.extend(EXCLUDE[args.exclude])
dirs = [os.path.realpath(x) for x in args.dirs]
print("Directories: ", dirs)
print("Excluding: ", EXCLUDED)
print("MEMFS: Directories: ", dirs)
print("MEMFS: Excluding: ", EXCLUDED)
FILES = {}
SIZES = {}
@ -201,6 +212,5 @@ for line in f.readlines():
print(line, file=g)
print("Finished")
print("MEMFS: done", time.time() - start)
elapsed = time.time() - start
print("MEMFS: Done in %.2f seconds" % elapsed)

View File

@ -522,16 +522,20 @@ void codes_get_reduced_row_p(long pl, double lon_first, double lon_last, long* n
grib_box* codes_box_new(grib_handle* h, int* error)
{
/* This function is deprecated and will later be removed */
return grib_box_new(h, error);
}
grib_points* codes_box_get_points(grib_box* box, double north, double west, double south, double east, int* err)
{
/* This function is deprecated and will later be removed */
return grib_box_get_points(box, north, west, south, east, err);
}
int codes_points_get_values(grib_handle* h, grib_points* points, double* val)
{
/* This function is deprecated and will later be removed */
return grib_points_get_values(h, points, val);
}
void codes_context_delete(grib_context* c)
{
grib_context_delete(c);

View File

@ -1231,9 +1231,9 @@ int codes_get_product_kind(const codes_handle* h, ProductKind* product_kind);
int codes_check_message_header(const void* bytes, size_t length, ProductKind product);
int codes_check_message_footer(const void* bytes, size_t length, ProductKind product);
codes_box* codes_box_new(codes_handle* h, int* error);
codes_points* codes_box_get_points(codes_box* box, double north, double west, double south, double east, int* err);
int codes_points_get_values(codes_handle* h, codes_points* points, double* val);
codes_box* codes_box_new(codes_handle* h, int* error) ECCODES_DEPRECATED;
codes_points* codes_box_get_points(codes_box* box, double north, double west, double south, double east, int* err) ECCODES_DEPRECATED;
int codes_points_get_values(codes_handle* h, codes_points* points, double* val) ECCODES_DEPRECATED;
/* --------------------------------------- */

View File

@ -151,6 +151,8 @@ grib_box* grib_box_new(grib_handle* h, int* error)
a = grib_find_accessor(h, "BOX");
na = (grib_accessor_box*)a;
fprintf(stderr, "Warning: The grib_box_new function is deprecated and will be removed later.");
if (!a)
return NULL;

View File

@ -140,6 +140,9 @@ static void init_class(grib_accessor_class* c)
#define MAX_CONCEPT_STRING_LENGTH 255
#define FALSE 0
#define TRUE 1
/* 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)
@ -163,11 +166,12 @@ static void dump(grib_accessor* a, grib_dumper* dumper)
grib_dump_string(dumper, a, NULL);
}
/* Return 1 (=True) or 0 (=False) */
static int concept_condition_expression_true(grib_handle* h, grib_concept_condition* c)
{
long lval;
long lres = 0;
int ok = 0;
int ok = FALSE; /* Boolean */
int err = 0;
const int type = grib_expression_native_type(h, c->expression);
@ -207,34 +211,38 @@ static int concept_condition_expression_true(grib_handle* h, grib_concept_condit
return ok;
}
/* Return 1 (=True) or 0 (=False) */
static int concept_condition_iarray_true(grib_handle* h, grib_concept_condition* c)
{
long* val;
long* val = NULL;
size_t size = 0, i;
int ret;
int ret; /* Boolean */
int err = 0;
err = grib_get_size(h, c->name, &size);
if (err == 0 || size != grib_iarray_used_size(c->iarray))
return 0;
if (err || size != grib_iarray_used_size(c->iarray))
return FALSE;
val = (long*)grib_context_malloc_clear(h->context, sizeof(long) * size);
err = grib_get_long_array(h, c->name, val, &size);
if (err == 0)
return 0;
ret = 1;
if (err) {
grib_context_free(h->context, val);
return FALSE;
}
ret = TRUE;
for (i = 0; i < size; i++) {
if (val[i] != c->iarray->v[i]) {
ret = 0;
ret = FALSE;
break;
}
}
grib_context_free(h->context, val);
return ret;
}
/* Return 1 (=True) or 0 (=False) */
static int concept_condition_true(grib_handle* h, grib_concept_condition* c)
{
if (c->expression == NULL)

View File

@ -1248,7 +1248,12 @@ static int get_bits_per_value(grib_handle* h, const char* bits_per_value_str, lo
* because it has already been changed to second order!
* We have to take precision=1 for IEEE which is 32bits
*/
*bits_per_value = 32;
/* But on 32bit, the most significant bit is for signnedness, so we have to drop one bit */
if (sizeof(long) == 4) {
*bits_per_value = 31;
} else {
*bits_per_value = 32;
}
}
return err;
}

View File

@ -295,7 +295,16 @@ static int compare(grib_accessor* a, grib_accessor* b)
static int pack_string(grib_accessor* a, const char* val, size_t* len)
{
char* theEnd = NULL;
long v = strtol(val, &theEnd, 10);
long v = 0;
#if 0
/* Requires more work e.g. filter */
if (strcmp_nocase(val, "missing")==0) {
return pack_missing(a);
}
#endif
v = strtol(val, &theEnd, 10);
if (theEnd) {
grib_context_log(a->context, GRIB_LOG_ERROR, "trying to pack \"%s\" as long", val);
return GRIB_WRONG_TYPE;

View File

@ -1399,6 +1399,7 @@ struct grib_points
size_t size;
};
/* These box functions are deprecated and will later be removed */
grib_box* grib_box_new(grib_handle* h, int* error);
grib_points* grib_box_get_points(grib_box* box, double north, double west, double south, double east, int* err);
int grib_points_get_values(grib_handle* h, grib_points* points, double* val);

View File

@ -20,6 +20,7 @@
grib_points* grib_box_get_points(grib_box* box, double north, double west, double south, double east, int* err)
{
grib_box_class* c = box->cclass;
fprintf(stderr, "Warning: The grib_box_get_points function is deprecated and will be removed later.");
while (c) {
grib_box_class* s = c->super ? *(c->super) : NULL;
if (c->get_points) {

File diff suppressed because it is too large Load Diff

View File

@ -134,58 +134,58 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
grib_iterator_polar_stereographic* self = (grib_iterator_polar_stereographic*)iter;
const char* sradius = grib_arguments_get_name(h, args, self->carg++);
const char* snx = grib_arguments_get_name(h, args, self->carg++);
const char* sny = grib_arguments_get_name(h, args, self->carg++);
const char* slatFirstInDegrees = grib_arguments_get_name(h, args, self->carg++);
const char* slonFirstInDegrees = grib_arguments_get_name(h, args, self->carg++);
const char* ssouthPoleOnPlane = grib_arguments_get_name(h, args, self->carg++);
const char* scentralLongitude = grib_arguments_get_name(h, args, self->carg++);
const char* scentralLatitude = grib_arguments_get_name(h, args, self->carg++);
const char* sDx = grib_arguments_get_name(h, args, self->carg++);
const char* sDy = grib_arguments_get_name(h, args, self->carg++);
const char* siScansNegatively = grib_arguments_get_name(h, args, self->carg++);
const char* sjScansPositively = grib_arguments_get_name(h, args, self->carg++);
const char* sjPointsAreConsecutive = grib_arguments_get_name(h, args, self->carg++);
const char* salternativeRowScanning = grib_arguments_get_name(h, args, self->carg++);
const char* s_radius = grib_arguments_get_name(h, args, self->carg++);
const char* s_nx = grib_arguments_get_name(h, args, self->carg++);
const char* s_ny = grib_arguments_get_name(h, args, self->carg++);
const char* s_latFirstInDegrees = grib_arguments_get_name(h, args, self->carg++);
const char* s_lonFirstInDegrees = grib_arguments_get_name(h, args, self->carg++);
const char* s_southPoleOnPlane = grib_arguments_get_name(h, args, self->carg++);
const char* s_centralLongitude = grib_arguments_get_name(h, args, self->carg++);
const char* s_centralLatitude = grib_arguments_get_name(h, args, self->carg++);
const char* s_Dx = grib_arguments_get_name(h, args, self->carg++);
const char* s_Dy = grib_arguments_get_name(h, args, self->carg++);
const char* s_iScansNegatively = grib_arguments_get_name(h, args, self->carg++);
const char* s_jScansPositively = grib_arguments_get_name(h, args, self->carg++);
const char* s_jPointsAreConsecutive = grib_arguments_get_name(h, args, self->carg++);
const char* s_alternativeRowScanning = grib_arguments_get_name(h, args, self->carg++);
if (grib_is_earth_oblate(h)) {
grib_context_log(h->context, GRIB_LOG_ERROR, "Polar stereographic only supported for spherical earth.");
return GRIB_GEOCALCULUS_PROBLEM;
}
if ((ret = grib_get_double_internal(h, sradius, &radius)) != GRIB_SUCCESS)
if ((ret = grib_get_double_internal(h, s_radius, &radius)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(h, snx, &nx)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(h, s_nx, &nx)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(h, sny, &ny)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(h, s_ny, &ny)) != GRIB_SUCCESS)
return ret;
if (iter->nv != nx * ny) {
grib_context_log(h->context, GRIB_LOG_ERROR, "Wrong number of points (%ld!=%ldx%ld)", iter->nv, nx, ny);
return GRIB_WRONG_GRID;
}
if ((ret = grib_get_double_internal(h, slatFirstInDegrees, &latFirstInDegrees)) != GRIB_SUCCESS)
if ((ret = grib_get_double_internal(h, s_latFirstInDegrees, &latFirstInDegrees)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_double_internal(h, slonFirstInDegrees, &lonFirstInDegrees)) != GRIB_SUCCESS)
if ((ret = grib_get_double_internal(h, s_lonFirstInDegrees, &lonFirstInDegrees)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(h, ssouthPoleOnPlane, &southPoleOnPlane)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(h, s_southPoleOnPlane, &southPoleOnPlane)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(h, scentralLongitude, &centralLongitudeInDegrees)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(h, s_centralLongitude, &centralLongitudeInDegrees)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(h, scentralLatitude, &centralLatitudeInDegrees)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(h, s_centralLatitude, &centralLatitudeInDegrees)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_double_internal(h, sDx, &Dx)) != GRIB_SUCCESS)
if ((ret = grib_get_double_internal(h, s_Dx, &Dx)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_double_internal(h, sDy, &Dy)) != GRIB_SUCCESS)
if ((ret = grib_get_double_internal(h, s_Dy, &Dy)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(h, sjPointsAreConsecutive, &jPointsAreConsecutive)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(h, s_jPointsAreConsecutive, &jPointsAreConsecutive)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(h, sjScansPositively, &jScansPositively)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(h, s_jScansPositively, &jScansPositively)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(h, siScansNegatively, &iScansNegatively)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(h, s_iScansNegatively, &iScansNegatively)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_get_long_internal(h, salternativeRowScanning, &alternativeRowScanning)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(h, s_alternativeRowScanning, &alternativeRowScanning)) != GRIB_SUCCESS)
return ret;
centralLongitude = centralLongitudeInDegrees * DEG2RAD;
@ -252,8 +252,9 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
}
lats = self->lats;
lons = self->lons;
Dx = iScansNegatively == 0 ? Dx : -Dx;
Dy = jScansPositively == 1 ? Dy : -Dy;
/* These will be processed later in transform_iterator_data() */
/* Dx = iScansNegatively == 0 ? Dx : -Dx; */
/* Dy = jScansPositively == 1 ? Dy : -Dy; */
y = 0;
for (j = 0; j < ny; j++) {
@ -353,6 +354,11 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
#endif
iter->e = -1;
/* Apply the scanning mode flags which may require data array to be transformed */
ret = transform_iterator_data(h, iter->data,
iScansNegatively, jScansPositively, jPointsAreConsecutive, alternativeRowScanning,
iter->nv, nx, ny);
return ret;
}

View File

@ -55,7 +55,7 @@ int grib_lookup_long_from_array(grib_context* gc, grib_loader* loader, const cha
return GRIB_SUCCESS;
}
#if 0
int grib_init_accessor_from_array(grib_loader* loader, grib_accessor* ga, grib_arguments* default_value)
{
grib_handle* h = grib_handle_of_accessor(ga);
@ -227,3 +227,4 @@ int grib_init_accessor_from_array(grib_loader* loader, grib_accessor* ga, grib_a
return retval;
}
#endif

View File

@ -1024,6 +1024,7 @@ int grib_points_get_values(grib_handle* h, grib_points* points, double* val)
{
int i, ret;
grib_accessor* a = NULL;
fprintf(stderr, "Warning: The grib_points_get_values function is deprecated and will be removed later.");
a = grib_find_accessor(h, "values");

View File

@ -110,6 +110,7 @@ if( HAVE_BUILD_TOOLS )
pseudo_diag
wrap
grib_levtype
grib_typeOfLevel
grib_grid_unstructured
grib_grid_lambert_conformal
grib_grid_polar_stereographic
@ -141,6 +142,7 @@ if( HAVE_BUILD_TOOLS )
bufr_filter_extract_datetime
bufr_filter_extract_area
bufr_filter_unpack_pack
bufr_filter_skipExtraKeyAttributes
bufr_indexing
bufr_json_data
bufr_ls

View File

@ -648,9 +648,11 @@ cat >$fRules <<EOF
EOF
${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
res=`${tools_dir}/bufr_get -p bufrTemplate $fOut`
[ "$res" = "synopLand" ]
${tools_dir}/bufr_compare $fOut $fRef #2>> $fLog 1>> $fLog
rm -f $fOut
rm -f $fOut
fOut="airep.bufr.out"
fRef="airep.bufr.out.ref"
@ -661,6 +663,8 @@ cat >$fRules <<EOF
EOF
${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
res=`${tools_dir}/bufr_get -p bufrTemplate $fOut`
[ "$res" = "aircraftReportWithSecondsAndPressure" ]
${tools_dir}/bufr_compare $fOut $fRef #2>> $fLog 1>> $fLog
rm -f $fOut

View File

@ -0,0 +1,60 @@
#!/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.sh
set -u
cd ${data_dir}/bufr
# Define a common label for all the tmp files
label="bufr_filter_skip_test"
tempFilt=temp.${label}.filter
tempRef=temp.${label}.ref
tempOut=temp.${label}.txt
input="ship_13.bufr"
# Decode fully including extra attributes
# ---------------------------------------
cat > $tempFilt <<EOF
set unpack = 1;
print " windDirectionAt10M=[windDirectionAt10M]";
print " windDirectionAt10M->units=[windDirectionAt10M->units]";
EOF
cat $tempFilt
${tools_dir}/codes_bufr_filter -f $tempFilt $input > $tempOut
cat > $tempRef <<EOF
windDirectionAt10M=30
windDirectionAt10M->units=deg
EOF
diff $tempRef $tempOut
# Decode excluding extra attributes
# ---------------------------------------
cat > $tempFilt <<EOF
set skipExtraKeyAttributes = 1;
set unpack = 1;
print " windDirectionAt10M=[windDirectionAt10M]";
print " windDirectionAt10M->units=[windDirectionAt10M->units]";
EOF
cat $tempFilt
${tools_dir}/codes_bufr_filter -f $tempFilt $input > $tempOut
cat > $tempRef <<EOF
windDirectionAt10M=30
windDirectionAt10M->units=undef
EOF
diff $tempRef $tempOut
# Clean up
rm -f $tempFilt $tempRef $tempOut

View File

@ -17,9 +17,17 @@ temp=${label}.bufr
sample=$ECCODES_SAMPLES_PATH/BUFR4.tmpl
templates_file="${ECCODES_DEFINITION_PATH}/bufr/templates/BufrTemplate.def"
templates=`cat $templates_file | awk -F= '{print $1}' | tr -d '"'`
# TODO: There is a matching issue with OmpsNadirProfile: mixed up with OmpsTotalColumn.
# So exclude that one
templates=`cat $templates_file | awk -F= '{print $1}' | tr -d '"' | grep -v OmpsNadirProfile`
# Note: bufrTemplate and BufrTemplate are the same key
for t in $templates; do
${tools_dir}/bufr_set -s bufrTemplate=$t $sample $temp
res=`${tools_dir}/bufr_get -p BufrTemplate $temp`
[ "$res" = "$t" ]
${tools_dir}/bufr_dump -p $temp > /dev/null
done

View File

@ -50,13 +50,15 @@ do
done
echo "ECC-457 ECMWF total precipitation..."
# -----------------------------------------
echo "ECC-457,ECC-1298 ECMWF total precipitation..."
# ---------------------------------------------------
input=${data_dir}/tp_ecmwf.grib
output=temp.grib1to2.grib
${tools_dir}/grib_set -s edition=2 $input $output
res=`${tools_dir}/grib_get -w count=1 -p edition,paramId,units $output`
[ "$res" = "2 228228 kg m**-2" ]
[ "$res" = "2 228 m" ]
res=`${tools_dir}/grib_get -w count=1 -p stepType $output`
[ "$res" = "accum" ]
rm -f $output
@ -89,6 +91,18 @@ grib_check_key_equals $sample_g1 shapeOfTheEarth 0
grib_check_key_equals $output shapeOfTheEarth 0
echo "ECC-1329: GRIB: Cannot convert runoff (paramId=205)"
# --------------------------------------------------------
temp1="temp1.grib1to2.grib1"
temp2="temp2.grib1to2.grib2"
${tools_dir}/grib_set -s paramId=205,P1=240,marsType=fc $sample_g1 $temp1
${tools_dir}/grib_set -s edition=2 $temp1 $temp2
grib_check_key_equals $temp2 discipline,stepType,shortName,paramId '2 accum ro 205'
# Fix the stepRange too - TODO
${tools_dir}/grib_set -s edition=2,startStep=0 $temp1 $temp2
grib_check_key_equals $temp2 stepType,stepRange 'accum 0-240'
rm -f $temp1 $temp2
rm -f $output
#sed "s:toolsdir:${tools_dir}/:" ${tools_dir}/grib1to2.txt > ${tools_dir}/grib1to2.test

View File

@ -93,17 +93,17 @@ for file in $files; do
done
files="regular_latlon_surface.grib2 \
regular_latlon_surface.grib1"
for file in `echo $files`; do
files="regular_latlon_surface.grib2
regular_latlon_surface.grib1
lfpw.grib1"
for file in $files; do
infile=${data_dir}/$file
outfile1=${infile}_bitsPerValue_1
outfile2=${infile}_bitsPerValue_2
# Setting with setBitsPerValue key should be identical to using the repack option
${tools_dir}/grib_set -r -s bitsPerValue=10 $infile $outfile1
${tools_dir}/grib_set -s setBitsPerValue=10 $infile $outfile2
${tools_dir}/grib_compare $outfile1 $outfile2

View File

@ -16,7 +16,7 @@ temp=temp.$label.grib
sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
lev_types="
typeOfLevels="
surface
tropopause
nominalTop
@ -48,20 +48,37 @@ seaIceLayer"
ok_levtypes="hhl ml o2d pl pt pv sfc sol"
check_levtype()
{
_arg=$1
result=1
for n in $ok_levtypes; do
if [ "$_arg" = "$n" ]; then result=0; break; fi
done
return $result
_arg=$1
result=1
for n in $ok_levtypes; do
if [ "$_arg" = "$n" ]; then result=0; break; fi
done
return $result
}
for lt in $lev_types; do
${tools_dir}/grib_set -s tablesVersion=27,typeOfLevel=$lt $sample_grib2 $temp
ltype=`${tools_dir}/grib_get -p mars.levtype $temp`
check_levtype $ltype
for a_typeOfLevel in $typeOfLevels; do
${tools_dir}/grib_set -s tablesVersion=27,typeOfLevel=$a_typeOfLevel $sample_grib2 $temp
levtype=`${tools_dir}/grib_get -p mars.levtype $temp`
check_levtype $levtype
done
# Also check specific cases
# --------------------------
# Sea ice surface temperature
${tools_dir}/grib_set -s paramId=260649 $sample_grib2 $temp
grib_check_key_equals $temp levtype o2d
# Snow on ice total depth
${tools_dir}/grib_set -s paramId=260650 $sample_grib2 $temp
grib_check_key_equals $temp levtype o2d
# Lake ice surface temperature
${tools_dir}/grib_set -s paramId=228013 $sample_grib2 $temp
grib_check_key_equals $temp levtype sfc
# Lake ice total depth
${tools_dir}/grib_set -s paramId=228014 $sample_grib2 $temp
grib_check_key_equals $temp levtype sfc
rm -f $temp

View File

@ -11,10 +11,13 @@
. ./include.sh
REDIRECT=/dev/null
label="grib_filter_test"
tempFilt="temp.$label.filt"
tempGrib="temp.$label.grib"
if [ -f ${data_dir}/geavg.t12z.pgrbaf108 ]; then
tmpdata=grib_api.$$.grib
rm -f $tmpdata
# rm -f $tmpdata
${tools_dir}/grib_filter ${data_dir}/filter_rules ${data_dir}/geavg.t12z.pgrbaf108 > $REDIRECT
rm -f $tmpdata
fi
@ -76,15 +79,15 @@ numlines=`${tools_dir}/grib_filter ${data_dir}/formatint.rules $ECCODES_SAMPLE
echo "Test conversion from grib1 to grib2 'Generalized vertical height coordinates'"
# --------------------------------------------------------------------------------
cat >temp.filt <<EOF
cat >$tempFilt <<EOF
set edition=2;
set typeOfLevel="generalVertical";
set nlev=41.0;
write;
EOF
${tools_dir}/grib_filter -o temp_filt.grib2 temp.filt $ECCODES_SAMPLES_PATH/sh_ml_grib1.tmpl
result=`${tools_dir}/grib_get -p typeOfFirstFixedSurface,NV,nlev temp_filt.grib2`
${tools_dir}/grib_filter -o $tempGrib $tempFilt $ECCODES_SAMPLES_PATH/sh_ml_grib1.tmpl
result=`${tools_dir}/grib_get -p typeOfFirstFixedSurface,NV,nlev $tempGrib`
[ "$result" = "150 6 41" ]
echo "Test GRIB-394: grib_filter arithmetic operators not correct for floating point values"
@ -120,7 +123,7 @@ ${tools_dir}/grib_filter ${data_dir}/binop.rules $ECCODES_SAMPLES_PATH/gg_sfc_g
echo "Test GRIB-526: grib_filter very picky about format of floats"
# ----------------------------------------------------------------
cat >temp.filt <<EOF
cat >$tempFilt <<EOF
set values = {
-1000.0,
3.1e5,
@ -129,13 +132,13 @@ cat >temp.filt <<EOF
.4,
45. };
EOF
${tools_dir}/grib_filter temp.filt $ECCODES_SAMPLES_PATH/GRIB1.tmpl
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB1.tmpl
echo "Test reading from stdin"
# ----------------------------
echo 'set centre="kwbc";write;' | ${tools_dir}/grib_filter -o temp_filt.grib2 - $ECCODES_SAMPLES_PATH/GRIB2.tmpl
result=`${tools_dir}/grib_get -p centre temp_filt.grib2`
echo 'set centre="kwbc";write;' | ${tools_dir}/grib_filter -o $tempGrib - $ECCODES_SAMPLES_PATH/GRIB2.tmpl
result=`${tools_dir}/grib_get -p centre $tempGrib`
[ "$result" = "kwbc" ]
@ -159,30 +162,29 @@ rm -f temp.out.gfilter.*.grib
echo "Test ECC-648: Set codetable key to array"
# ---------------------------------------------
cat >temp.filt <<EOF
cat >$tempFilt <<EOF
set productDefinitionTemplateNumber = 11;
set numberOfTimeRange = 3;
set typeOfStatisticalProcessing = {3, 1, 2};
write;
EOF
${tools_dir}/grib_filter -o temp_filt.grib2 temp.filt $ECCODES_SAMPLES_PATH/GRIB2.tmpl
stats=`echo 'print "[typeOfStatisticalProcessing]";' | ${tools_dir}/grib_filter - temp_filt.grib2`
${tools_dir}/grib_filter -o $tempGrib $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl
stats=`echo 'print "[typeOfStatisticalProcessing]";' | ${tools_dir}/grib_filter - $tempGrib`
[ "$stats" = "3 1 2" ]
echo "Test 'append'"
# -------------------
cp ${data_dir}/tigge_pf_ecmwf.grib2 temp_filt.grib2 # now has 38 msgs
${tools_dir}/grib_count temp_filt.grib2
cat > temp.filt <<EOF
append "temp_filt.grib2";
cp ${data_dir}/tigge_pf_ecmwf.grib2 $tempGrib # now has 38 msgs
${tools_dir}/grib_count $tempGrib
cat > $tempFilt <<EOF
append "$tempGrib";
EOF
${tools_dir}/grib_filter temp.filt ${data_dir}/tigge_pf_ecmwf.grib2 # should end up with 38*2 msgs
${tools_dir}/grib_count temp_filt.grib2
count=`${tools_dir}/grib_count temp_filt.grib2`
${tools_dir}/grib_filter $tempFilt ${data_dir}/tigge_pf_ecmwf.grib2 # should end up with 38*2 msgs
${tools_dir}/grib_count $tempGrib
count=`${tools_dir}/grib_count $tempGrib`
[ $count -eq 76 ]
echo "Test ECC-1233"
# ------------------
sample1=$ECCODES_SAMPLES_PATH/sh_ml_grib1.tmpl
@ -191,16 +193,28 @@ padding=`echo 'print "[padding_grid50_1]";' | ${tools_dir}/grib_filter - $sample
echo "Test switch statement"
# --------------------------
cat >temp.filt <<EOF
cat >$tempFilt <<EOF
switch (edition) {
case 1: print "1";
case 2: print "2";
default: print "what is this?";assert(0);
}
EOF
${tools_dir}/grib_filter temp.filt $ECCODES_SAMPLES_PATH/GRIB1.tmpl $ECCODES_SAMPLES_PATH/GRIB2.tmpl
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB1.tmpl $ECCODES_SAMPLES_PATH/GRIB2.tmpl
echo "Test MISSING"
# -----------------
input="${data_dir}/reduced_gaussian_pressure_level.grib2"
grib_check_key_equals $input scaleFactorOfFirstFixedSurface 0
cat >$tempFilt <<EOF
set scaleFactorOfFirstFixedSurface = MISSING; # has to be uppercase
write;
EOF
${tools_dir}/grib_filter -o $tempGrib $tempFilt $input
grib_check_key_equals $tempGrib scaleFactorOfFirstFixedSurface MISSING
# Clean up
rm -f temp_filt.grib2 temp.filt
rm -f $tempGrib $tempFilt
rm -f ${data_dir}/formatint.rules ${data_dir}/binop.rules

View File

@ -12,7 +12,8 @@
# Define a common label for all the tmp files
label="grib_space_view_test"
tempFilter="temp.${label}.filt"
tempGrib="temp.${label}.grib"
tempGrib1="temp.${label}.grib1"
tempGrib2="temp.${label}.grib2"
tempOut="temp.${label}.out"
# -----------
@ -34,15 +35,16 @@ cat > $tempFilter <<EOF
EOF
# Use filter on input to create a new GRIB
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input
if [ ! -f "$tempGrib" ]; then
${tools_dir}/grib_filter -o $tempGrib2 $tempFilter $input
if [ ! -f "$tempGrib2" ]; then
echo 'Failed to create output GRIB from filter' >&2
exit 1
fi
# Invoke Geoiterator on the newly created GRIB file
${tools_dir}/grib_get_data $tempGrib > $tempOut
# Invoke Geoiterator on the newly created GRIB2 file
${tools_dir}/grib_get_data $tempGrib2 > $tempOut
${tools_dir}/grib_ls -l 50,0 $tempGrib
${tools_dir}/grib_ls -l 50,0 $tempGrib2
rm -f $tempGrib2
# -----------
# GRIB1
@ -56,12 +58,15 @@ cat > $tempFilter <<EOF
set dy=54;
set XpInGridLengths=2750;
set YpInGridLengths=2750;
set NrInRadiusOfEarth=6610710;
set Nr=6610710;
write;
EOF
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input
${tools_dir}/grib_get_data $tempGrib > $tempOut
${tools_dir}/grib_filter -o $tempGrib1 $tempFilter $input
${tools_dir}/grib_get_data $tempGrib1 > $tempOut
${tools_dir}/grib_set -s edition=2 $tempGrib1 $tempGrib2
${tools_dir}/grib_compare -e -b param $tempGrib1 $tempGrib2
# Clean up
rm -f $tempFilter $tempGrib $tempOut
rm -f $tempFilter $tempGrib1 $tempGrib2 $tempOut

View File

@ -51,4 +51,12 @@ for lt in $levtypes; do
fi
done
# ECC-1328
params='228007 228011'
for p in $params; do
${tools_dir}/grib_set -s paramId=$p $sample2 $tempGrib
grib_check_key_equals $tempGrib 'mars.levtype,typeOfLevel' 'sfc entireLake'
done
rm -f $tempGrib

View File

@ -143,11 +143,16 @@ grib_check_key_equals $temp3 packingType grid_second_order
# ECC-1219: packingType conversion from grid_ieee to grid_second_order
# ---------------------------------------------------------------------
if [ $ECCODES_ON_LINUX_32BIT -eq 1 ] ; then
ALLOWED_ERROR=7e-06
else
ALLOWED_ERROR=3e-06
fi
if [ $ECCODES_ON_WINDOWS -eq 0 ]; then
infile=grid_ieee.grib
${tools_dir}/grib_set -r -s packingType=grid_second_order $infile $temp1
grib_check_key_equals $temp1 packingType grid_second_order
${tools_dir}/grib_compare -cdata:n -R all=3e-06 $infile $temp1
${tools_dir}/grib_compare -cdata:n -R all=$ALLOWED_ERROR $infile $temp1
fi
# Second order doesn't have a proper representation for constant fields

36
tests/grib_typeOfLevel.sh Executable file
View File

@ -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.sh
set -u
label="grib_typeOfLevel_test"
temp=temp.$label.txt
if [ ! -d "$ECCODES_DEFINITION_PATH" ]; then
echo "Test $0 disabled. No definitions directory"
exit 0
fi
# Make sure all typeOfLevel values are unique
def_file="$ECCODES_DEFINITION_PATH/grib2/typeOfLevelConcept.def"
rm -f $temp
grep "^'" $def_file | awk -F= '{print $1}' | tr -d "' " | sort | uniq -d > $temp
if [ -s "$temp" ]; then
# File exists and has a size greater than zero
echo "ERROR: Duplicates found in $def_file" >&2
cat $temp
exit 1
else
echo "No duplicates in $def_file"
fi
rm -f $temp

View File

@ -43,6 +43,7 @@ HAVE_PNG=@HAVE_PNG@
HAVE_AEC=@HAVE_AEC@
HAVE_EXTRA_TESTS=@HAVE_EXTRA_TESTS@
HAVE_MEMFS=@HAVE_MEMFS@
ECCODES_ON_LINUX_32BIT=@ECCODES_ON_LINUX_32BIT@
ECCODES_ON_WINDOWS=@ECCODES_ON_WINDOWS@
echo "Current directory: `pwd`"

View File

@ -20,8 +20,9 @@ else
echo
echo "TEST: $0"
# Only Unix supported
# Only Unix 64bit supported
ECCODES_ON_WINDOWS=0
ECCODES_ON_LINUX_32BIT=0
data_dir=""
# save current working dir

4810
tests/keys

File diff suppressed because it is too large Load Diff