mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'feature/typeOfLevelConcept' into feature/multilayers
This commit is contained in:
commit
88c96a682d
|
@ -246,3 +246,11 @@
|
|||
scaledValueOfFirstFixedSurface = 0 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'toa_net_upward_shortwave_flux' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 1 ;
|
||||
typeOfFirstFixedSurface = 8 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
|
|
|
@ -205,6 +205,22 @@
|
|||
parameterCategory = 2 ;
|
||||
parameterNumber = 32 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'tclw' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 69 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'tciw' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 70 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Surface solar radiation downwards
|
||||
'ssrd' = {
|
||||
discipline = 0 ;
|
||||
|
@ -221,6 +237,14 @@
|
|||
typeOfStatisticalProcessing = 1 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'tsr' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 1 ;
|
||||
typeOfFirstFixedSurface = 8 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Eastward turbulent surface stress
|
||||
'ewss' = {
|
||||
discipline = 0 ;
|
||||
|
@ -475,6 +499,16 @@
|
|||
typeOfFirstFixedSurface = 169 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'sh2' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 2 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
}
|
||||
#Ammonium aerosol mass mixing ratio
|
||||
'aermr18' = {
|
||||
discipline = 0 ;
|
||||
|
@ -943,6 +977,33 @@
|
|||
parameterNumber = 20 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time integral of rain flux
|
||||
'tirf' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 65 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface eastward momentum flux
|
||||
'tisemf' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 17 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface northward momentum flux
|
||||
'tisnmf' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 18 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Cross sectional area of flow in channel
|
||||
'chcross' = {
|
||||
discipline = 1 ;
|
||||
|
@ -1047,6 +1108,14 @@
|
|||
parameterCategory = 0 ;
|
||||
parameterNumber = 9 ;
|
||||
}
|
||||
#Total column graupel
|
||||
'tcolg' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 74 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#2 metre relative humidity
|
||||
'r2' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -109,12 +109,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 174 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'toa_net_upward_shortwave_flux' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
#Evaporation
|
||||
'lwe_thickness_of_water_evaporation_amount' = {
|
||||
discipline = 192 ;
|
||||
|
|
|
@ -40,3 +40,9 @@
|
|||
parameterCategory = 151 ;
|
||||
parameterNumber = 163 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'toa_net_upward_shortwave_flux' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
|
|
|
@ -395,18 +395,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 74 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'tclw' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'tciw' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Experimental product
|
||||
'p80.128' = {
|
||||
discipline = 192 ;
|
||||
|
@ -830,12 +818,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 174 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'tsr' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
#Evaporation
|
||||
'e' = {
|
||||
discipline = 192 ;
|
||||
|
|
|
@ -118,3 +118,21 @@
|
|||
parameterCategory = 131 ;
|
||||
parameterNumber = 88 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'tclw' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'tciw' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'tsr' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
|
|
|
@ -395,18 +395,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 74 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'Total column cloud liquid water' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'Total column cloud ice water' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Experimental product
|
||||
'Experimental product' = {
|
||||
discipline = 192 ;
|
||||
|
@ -830,12 +818,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 174 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'Top net solar radiation' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
#Evaporation
|
||||
'Evaporation' = {
|
||||
discipline = 192 ;
|
||||
|
|
|
@ -118,3 +118,21 @@
|
|||
parameterCategory = 131 ;
|
||||
parameterNumber = 88 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'Total column cloud liquid water' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'Total column cloud ice water' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'Top net solar radiation' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
|
|
|
@ -395,18 +395,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 74 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'78' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'79' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Experimental product
|
||||
'80' = {
|
||||
discipline = 192 ;
|
||||
|
@ -830,12 +818,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 174 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'178' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
#Evaporation
|
||||
'182' = {
|
||||
discipline = 192 ;
|
||||
|
|
|
@ -118,3 +118,21 @@
|
|||
parameterCategory = 131 ;
|
||||
parameterNumber = 88 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'78' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'79' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'178' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
|
|
|
@ -395,18 +395,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 74 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'tclw' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'tciw' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Experimental product
|
||||
'~' = {
|
||||
discipline = 192 ;
|
||||
|
@ -830,12 +818,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 174 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'tsr' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
#Evaporation
|
||||
'e' = {
|
||||
discipline = 192 ;
|
||||
|
|
|
@ -118,3 +118,21 @@
|
|||
parameterCategory = 131 ;
|
||||
parameterNumber = 88 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'tclw' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'tciw' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'tsr' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
|
|
|
@ -395,18 +395,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 74 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'kg m**-2' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'kg m**-2' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Experimental product
|
||||
'~' = {
|
||||
discipline = 192 ;
|
||||
|
@ -830,12 +818,6 @@
|
|||
parameterCategory = 128 ;
|
||||
parameterNumber = 174 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'J m**-2' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
#Evaporation
|
||||
'm of water equivalent' = {
|
||||
discipline = 192 ;
|
||||
|
|
|
@ -118,3 +118,21 @@
|
|||
parameterCategory = 131 ;
|
||||
parameterNumber = 88 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'kg m**-2' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 78 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'kg m**-2' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 79 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'J m**-2' = {
|
||||
discipline = 192 ;
|
||||
parameterCategory = 128 ;
|
||||
parameterNumber = 178 ;
|
||||
}
|
||||
|
|
|
@ -72,3 +72,13 @@
|
|||
scaledValueOfFirstFixedSurface = 15 ;
|
||||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'sh2' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 15 ;
|
||||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
|
|
|
@ -72,3 +72,13 @@
|
|||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'2 metre specific humidity' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 15 ;
|
||||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
|
|
|
@ -72,3 +72,13 @@
|
|||
scaledValueOfFirstFixedSurface = 15 ;
|
||||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'174096' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 15 ;
|
||||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
|
|
|
@ -72,3 +72,13 @@
|
|||
scaledValueOfFirstFixedSurface = 15 ;
|
||||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'2sh' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 15 ;
|
||||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
|
|
|
@ -72,3 +72,13 @@
|
|||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'kg kg**-1' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 15 ;
|
||||
scaleFactorOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
|
|
|
@ -205,6 +205,22 @@
|
|||
parameterCategory = 2 ;
|
||||
parameterNumber = 32 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'Total column cloud liquid water' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 69 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'Total column cloud ice water' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 70 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Surface solar radiation downwards
|
||||
'Surface solar radiation downwards' = {
|
||||
discipline = 0 ;
|
||||
|
@ -221,6 +237,14 @@
|
|||
typeOfStatisticalProcessing = 1 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'Top net solar radiation' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 1 ;
|
||||
typeOfFirstFixedSurface = 8 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Eastward turbulent surface stress
|
||||
'Eastward turbulent surface stress' = {
|
||||
discipline = 0 ;
|
||||
|
@ -475,6 +499,16 @@
|
|||
typeOfSecondFixedSurface = 255 ;
|
||||
scaleFactorOfFirstFixedSurface = 2 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'2 metre specific humidity' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 2 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
}
|
||||
#Ammonium aerosol mass mixing ratio
|
||||
'Ammonium aerosol mass mixing ratio' = {
|
||||
discipline = 0 ;
|
||||
|
@ -943,6 +977,33 @@
|
|||
parameterNumber = 20 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time integral of rain flux
|
||||
'Time integral of rain flux' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 65 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface eastward momentum flux
|
||||
'Time integral of surface eastward momentum flux' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 17 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface northward momentum flux
|
||||
'Time integral of surface northward momentum flux' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 18 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Cross sectional area of flow in channel
|
||||
'Cross sectional area of flow in channel' = {
|
||||
discipline = 1 ;
|
||||
|
@ -1047,6 +1108,14 @@
|
|||
parameterCategory = 0 ;
|
||||
parameterNumber = 9 ;
|
||||
}
|
||||
#Total column graupel
|
||||
'Total column graupel' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 74 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#2 metre relative humidity
|
||||
'2 metre relative humidity' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -205,6 +205,22 @@
|
|||
parameterCategory = 2 ;
|
||||
parameterNumber = 32 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'78' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 69 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'79' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 70 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Surface solar radiation downwards
|
||||
'169' = {
|
||||
discipline = 0 ;
|
||||
|
@ -221,6 +237,14 @@
|
|||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'178' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 1 ;
|
||||
typeOfFirstFixedSurface = 8 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Eastward turbulent surface stress
|
||||
'180' = {
|
||||
discipline = 0 ;
|
||||
|
@ -475,6 +499,16 @@
|
|||
typeOfFirstFixedSurface = 169 ;
|
||||
scaledValueOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'174096' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 2 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
}
|
||||
#Ammonium aerosol mass mixing ratio
|
||||
'210249' = {
|
||||
discipline = 0 ;
|
||||
|
@ -943,6 +977,33 @@
|
|||
parameterNumber = 20 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time integral of rain flux
|
||||
'235015' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 65 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface eastward momentum flux
|
||||
'235017' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 17 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface northward momentum flux
|
||||
'235018' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 18 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Cross sectional area of flow in channel
|
||||
'240011' = {
|
||||
discipline = 1 ;
|
||||
|
@ -1047,6 +1108,14 @@
|
|||
parameterCategory = 0 ;
|
||||
parameterNumber = 9 ;
|
||||
}
|
||||
#Total column graupel
|
||||
'260001' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 74 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#2 metre relative humidity
|
||||
'260242' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
transient dummyc=0: hidden;
|
||||
constant conceptsMasterDir="grib2" : hidden;
|
||||
constant conceptsLocalDirAll="grib2/localConcepts/[centre:s]" : hidden;
|
||||
constant conceptsLocalDirECMF="grib2/localConcepts/ecmf" : hidden;
|
||||
|
||||
|
||||
concept paramIdLegacyECMF(defaultParameter,"paramId.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy,hidden;
|
||||
concept paramIdECMF (paramIdLegacyECMF,"paramId.def",conceptsMasterDir,conceptsLocalDirECMF): long_type,no_copy;
|
||||
|
|
|
@ -132,3 +132,7 @@ concept is_uerra(zero) {
|
|||
'1' = {productionStatusOfProcessedData=8;}
|
||||
'0' = {dummy=1;}
|
||||
}
|
||||
|
||||
constant conceptsMasterDir="grib2" : hidden;
|
||||
constant conceptsLocalDirAll="grib2/localConcepts/[centre:s]" : hidden;
|
||||
constant conceptsLocalDirECMF="grib2/localConcepts/ecmf" : hidden;
|
||||
|
|
|
@ -205,6 +205,22 @@
|
|||
parameterCategory = 2 ;
|
||||
parameterNumber = 32 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'tclw' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 69 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'tciw' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 70 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Surface solar radiation downwards
|
||||
'ssrd' = {
|
||||
discipline = 0 ;
|
||||
|
@ -221,6 +237,14 @@
|
|||
typeOfStatisticalProcessing = 1 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'tsr' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 1 ;
|
||||
typeOfFirstFixedSurface = 8 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Eastward turbulent surface stress
|
||||
'ewss' = {
|
||||
discipline = 0 ;
|
||||
|
@ -475,6 +499,16 @@
|
|||
scaleFactorOfFirstFixedSurface = 2 ;
|
||||
typeOfFirstFixedSurface = 169 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'2sh' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 2 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
}
|
||||
#Ammonium aerosol mass mixing ratio
|
||||
'aermr18' = {
|
||||
discipline = 0 ;
|
||||
|
@ -943,6 +977,33 @@
|
|||
parameterNumber = 20 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time integral of rain flux
|
||||
'tirf' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 65 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface eastward momentum flux
|
||||
'tisemf' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 17 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface northward momentum flux
|
||||
'tisnmf' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 18 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Cross sectional area of flow in channel
|
||||
'chcross' = {
|
||||
discipline = 1 ;
|
||||
|
@ -1047,6 +1108,14 @@
|
|||
parameterCategory = 0 ;
|
||||
parameterNumber = 9 ;
|
||||
}
|
||||
#Total column graupel
|
||||
'tcolg' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 74 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#2 metre relative humidity
|
||||
'2r' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -24,7 +24,7 @@ unsigned[4] scaledValueOfSecondFixedSurface = missing() : can_be_missing,dump,no
|
|||
|
||||
transient pressureUnits="hPa";
|
||||
|
||||
concept_nofail vertical.typeOfLevel (unknown,"typeOfLevelConcept.def",conceptsMasterDir,conceptsLocalDirAll);
|
||||
concept_nofail vertical.typeOfLevel (unknown,"typeOfLevelConcept.def",conceptsLocalDirAll,conceptsMasterDir);
|
||||
|
||||
alias levelType=typeOfFirstFixedSurface;
|
||||
|
||||
|
|
|
@ -205,6 +205,22 @@
|
|||
parameterCategory = 2 ;
|
||||
parameterNumber = 32 ;
|
||||
}
|
||||
#Total column cloud liquid water
|
||||
'kg m**-2' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 69 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Total column cloud ice water
|
||||
'kg m**-2' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 70 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#Surface solar radiation downwards
|
||||
'J m**-2' = {
|
||||
discipline = 0 ;
|
||||
|
@ -221,6 +237,14 @@
|
|||
typeOfStatisticalProcessing = 1 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
}
|
||||
#Top net solar radiation
|
||||
'J m**-2' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 4 ;
|
||||
parameterNumber = 1 ;
|
||||
typeOfFirstFixedSurface = 8 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Eastward turbulent surface stress
|
||||
'N m**-2 s' = {
|
||||
discipline = 0 ;
|
||||
|
@ -475,6 +499,16 @@
|
|||
typeOfSecondFixedSurface = 255 ;
|
||||
scaleFactorOfFirstFixedSurface = 2 ;
|
||||
}
|
||||
#2 metre specific humidity
|
||||
'kg kg**-1' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 0 ;
|
||||
typeOfFirstFixedSurface = 103 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 2 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
}
|
||||
#Ammonium aerosol mass mixing ratio
|
||||
'kg kg**-1' = {
|
||||
discipline = 0 ;
|
||||
|
@ -943,6 +977,33 @@
|
|||
parameterNumber = 20 ;
|
||||
typeOfStatisticalProcessing = 0 ;
|
||||
}
|
||||
#Time integral of rain flux
|
||||
'kg m**-2' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 65 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface eastward momentum flux
|
||||
'N m**-2 s' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 17 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Time integral of surface northward momentum flux
|
||||
'N m**-2 s' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 2 ;
|
||||
parameterNumber = 18 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 255 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
}
|
||||
#Cross sectional area of flow in channel
|
||||
'm**2' = {
|
||||
discipline = 1 ;
|
||||
|
@ -1047,6 +1108,14 @@
|
|||
parameterCategory = 0 ;
|
||||
parameterNumber = 9 ;
|
||||
}
|
||||
#Total column graupel
|
||||
'kg m**-2' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 1 ;
|
||||
parameterNumber = 74 ;
|
||||
typeOfFirstFixedSurface = 1 ;
|
||||
typeOfSecondFixedSurface = 8 ;
|
||||
}
|
||||
#2 metre relative humidity
|
||||
'%' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -12,7 +12,7 @@ set of tools for decoding and encoding messages in the following formats:
|
|||
A useful set of <a href="https://software.ecmwf.int/wiki/display/ECC/Command+line+tools">command line tools</a>
|
||||
provide quick access to the messages. C, Fortran 90 and Python interfaces provide access to the main %ecCodes functionality.
|
||||
|
||||
%ecCodes is an evolution of <a href="https://software.ecmwf.int/wiki/display/GRIB/Home">GRIB-API</a>. It is designed to provide the user with a simple set of
|
||||
%ecCodes is an evolution of GRIB-API. It is designed to provide the user with a simple set of
|
||||
functions to access data from several formats with a key/value approach.
|
||||
|
||||
For GRIB encoding and decoding, the GRIB-API functionality is provided fully in %ecCodes with the same user interface and behaviour.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# examples/C include file for CMake
|
||||
|
||||
set -eax
|
||||
echo "Script: $0"
|
||||
|
||||
proj_dir=@PROJECT_SOURCE_DIR@
|
||||
data_dir=@PROJECT_BINARY_DIR@/data
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# examples/F90 include file for CMake
|
||||
|
||||
set -eax
|
||||
echo "Script: $0"
|
||||
|
||||
proj_dir=@PROJECT_SOURCE_DIR@
|
||||
data_dir=@PROJECT_BINARY_DIR@/data
|
||||
|
|
|
@ -87,7 +87,7 @@ Overview</h1>
|
|||
<li>WMO GTS <a href="http://www.wmo.int/pages/prog/www/WIS/Publications/WMO_386/WMO_386_Vol_I_en.pdf">abbreviated header</a> (only decoding in this release).</li>
|
||||
</ul>
|
||||
<p>A useful set of <a href="https://software.ecmwf.int/wiki/display/ECC/Command+line+tools">command line tools</a> provide quick access to the messages. C, Fortran 90 and Python interfaces provide access to the main ecCodes functionality.</p>
|
||||
<p>ecCodes is an evolution of <a href="https://software.ecmwf.int/wiki/display/GRIB/Home">GRIB-API</a>. It is designed to provide the user with a simple set of functions to access data from several formats with a key/value approach.</p>
|
||||
<p>ecCodes is an evolution of GRIB-API. It is designed to provide the user with a simple set of functions to access data from several formats with a key/value approach.</p>
|
||||
<p>For GRIB encoding and decoding, the GRIB-API functionality is provided fully in ecCodes with the same user interface and behaviour. Interfaces for C, Fortran 90 and Python are all maintained as in GRIB-API. However, the GRIB-API Fortran 77 interface is no longer available.</p>
|
||||
<p>In addition, a new set of functions with the prefix "codes_" is provided to operate on all the supported message formats. These functions have the same interface and behaviour as the "grib_" functions.</p>
|
||||
<p>A selection of GRIB-API tools has been included in ecCodes (<a href="https://software.ecmwf.int/wiki/display/ECC/GRIB+tools">ecCodes GRIB tools</a>), while new tools are available for the BUFR (<a href="https://software.ecmwf.int/wiki/display/ECC/BUFR+tools">ecCodes BUFR tools</a>) and GTS formats. The new tools have been developed to be as similar as possible to the existing GRIB-API tools maintaining, where possible, the same options and behaviour. A significant difference compared with GRIB-API tools is that bufr_dump produces output in <a href="https://en.wikipedia.org/wiki/JSON">JSON</a> format which can be used in many web based applications.</p>
|
||||
|
|
|
@ -96,7 +96,7 @@ int codes_fieldset_count(grib_fieldset* set)
|
|||
|
||||
/* Indexing */
|
||||
/******************************************************************************/
|
||||
grib_index* codes_index_new_from_file(grib_context* c, char* filename, const char* keys, int* err)
|
||||
grib_index* codes_index_new_from_file(grib_context* c, const char* filename, const char* keys, int* err)
|
||||
{
|
||||
return grib_index_new_from_file(c, filename, keys, err);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ int codes_index_select_double(grib_index* index, const char* key, double value)
|
|||
{
|
||||
return grib_index_select_double(index, key, value);
|
||||
}
|
||||
int codes_index_select_string(grib_index* index, const char* key, char* value)
|
||||
int codes_index_select_string(grib_index* index, const char* key, const char* value)
|
||||
{
|
||||
return grib_index_select_string(index, key, value);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ typedef struct grib_index codes_index;
|
|||
* @param err : 0 if OK, integer value on error
|
||||
* @return the newly created index
|
||||
*/
|
||||
codes_index* codes_index_new_from_file(codes_context* c, char* filename, const char* keys, int* err);
|
||||
codes_index* codes_index_new_from_file(codes_context* c, const char* filename, const char* keys, int* err);
|
||||
|
||||
/**
|
||||
* Create a new index based on a set of keys.
|
||||
|
@ -320,7 +320,7 @@ int codes_index_select_double(codes_index* index, const char* key, double value)
|
|||
* @param value : value of the key to select
|
||||
* @return 0 if OK, integer value on error
|
||||
*/
|
||||
int codes_index_select_string(codes_index* index, const char* key, char* value);
|
||||
int codes_index_select_string(codes_index* index, const char* key, const char* value);
|
||||
|
||||
/**
|
||||
* Create a new handle from an index after having selected the key values.
|
||||
|
@ -1253,6 +1253,7 @@ int codes_points_get_values(codes_handle* h, codes_points* points, double* val);
|
|||
#define CODES_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX
|
||||
#define CODES_UTIL_PACKING_TYPE_GRID_SECOND_ORDER GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER
|
||||
#define CODES_UTIL_PACKING_TYPE_CCSDS GRIB_UTIL_PACKING_TYPE_CCSDS
|
||||
#define CODES_UTIL_PACKING_TYPE_IEEE GRIB_UTIL_PACKING_TYPE_IEEE
|
||||
#define CODES_UTIL_PACKING_SAME_AS_INPUT GRIB_UTIL_PACKING_SAME_AS_INPUT
|
||||
#define CODES_UTIL_PACKING_USE_PROVIDED GRIB_UTIL_PACKING_USE_PROVIDED
|
||||
|
||||
|
|
|
@ -313,6 +313,7 @@ static int select_area(grib_accessor* a)
|
|||
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;
|
||||
|
||||
|
|
|
@ -443,6 +443,7 @@ static int select_datetime(grib_accessor* a)
|
|||
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;
|
||||
|
||||
|
|
|
@ -207,6 +207,7 @@ static int apply_thinning(grib_accessor* a)
|
|||
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;
|
||||
|
||||
|
@ -218,6 +219,7 @@ static int apply_thinning(grib_accessor* a)
|
|||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
grib_iarray_delete(subsets);
|
||||
}
|
||||
else {
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -265,11 +265,11 @@ static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_
|
|||
*err = grib_get_size(hand, self->sequence, &size);
|
||||
grib_bufr_descriptor_delete(u);
|
||||
if (*err)
|
||||
return;
|
||||
goto cleanup;
|
||||
v = (long*)grib_context_malloc_clear(c, sizeof(long) * size);
|
||||
*err = grib_get_long_array(hand, self->sequence, v, &size);
|
||||
if (*err)
|
||||
return;
|
||||
goto cleanup;
|
||||
|
||||
inner_unexpanded = grib_bufr_descriptors_array_new(c, DESC_SIZE_INIT, DESC_SIZE_INCR);
|
||||
for (i = 0; i < size; i++) {
|
||||
|
@ -518,8 +518,8 @@ static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_
|
|||
printf("\t");
|
||||
printf("expanding <== %d-%.2d-%.3d (size=%ld)\n\n", us->F, us->X, us->Y, size);
|
||||
#endif
|
||||
if (us)
|
||||
grib_bufr_descriptor_delete(us);
|
||||
cleanup:
|
||||
if (us) grib_bufr_descriptor_delete(us);
|
||||
}
|
||||
|
||||
static bufr_descriptors_array* do_expand(grib_accessor* a, bufr_descriptors_array* unexpanded, change_coding_params* ccp, int* err)
|
||||
|
@ -552,8 +552,10 @@ static bufr_descriptors_array* do_expand(grib_accessor* a, bufr_descriptors_arra
|
|||
#endif
|
||||
while (unexpanded->n) {
|
||||
__expand(a, unexpanded, expanded, ccp, err);
|
||||
if (*err)
|
||||
if (*err) {
|
||||
grib_bufr_descriptors_array_delete(expanded);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#if MYDEBUG
|
||||
{
|
||||
|
@ -689,8 +691,11 @@ static int expand(grib_accessor* a)
|
|||
ccp.associatedFieldWidth = 0;
|
||||
ccp.newStringWidth = 0;
|
||||
self->expanded = do_expand(a, unexpanded, &ccp, &err);
|
||||
if (err)
|
||||
if (err) {
|
||||
grib_bufr_descriptors_array_delete(unexpanded);
|
||||
grib_bufr_descriptors_array_delete(unexpanded_copy);
|
||||
return err;
|
||||
}
|
||||
grib_context_expanded_descriptors_list_push(c, key, self->expanded, unexpanded_copy);
|
||||
grib_bufr_descriptors_array_delete(unexpanded);
|
||||
|
||||
|
@ -809,6 +814,7 @@ static int value_count(grib_accessor* a, long* rlen)
|
|||
err = expand(a);
|
||||
if (err) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "%s unable to compute size", a->name);
|
||||
grib_bufr_descriptors_array_delete(self->expanded);
|
||||
return err;
|
||||
}
|
||||
*rlen = BUFR_DESCRIPTORS_ARRAY_USED_SIZE(self->expanded);
|
||||
|
|
|
@ -266,21 +266,25 @@ typedef struct grib_index grib_index;
|
|||
* @return the newly created index
|
||||
*/
|
||||
grib_index* grib_index_new_from_file(grib_context* c,
|
||||
char* filename, const char* keys, int* err);
|
||||
const char* filename, const char* keys, int* err);
|
||||
/**
|
||||
* Create a new index based on a set of keys.
|
||||
*
|
||||
* @param c : context (NULL for default context)
|
||||
* @param keys : comma separated list of keys for the index.
|
||||
* The type of the key can be explicitly declared appending :l for long,
|
||||
* (or alternatively :i)
|
||||
* :d for double, :s for string to the key name. If the type is not
|
||||
* The type of the key can be explicitly declared appending ":l" for long,
|
||||
* (or alternatively ":i"), ":d" for double, ":s" for string to the key name. If the type is not
|
||||
* declared explicitly, the native type is assumed.
|
||||
* @param err : 0 if OK, integer value on error
|
||||
* @return the newly created index
|
||||
*/
|
||||
grib_index* grib_index_new(grib_context* c, const char* keys, int* err);
|
||||
|
||||
/* EXPERIMENTAL */
|
||||
int codes_index_set_product_kind(grib_index* index, ProductKind product_kind);
|
||||
int codes_index_set_unpack_bufr(grib_index* index, int unpack);
|
||||
|
||||
|
||||
/**
|
||||
* Indexes the file given in argument in the index given in argument.
|
||||
*
|
||||
|
@ -374,7 +378,7 @@ int grib_index_select_double(grib_index* index, const char* key, double value);
|
|||
* @param value : value of the key to select
|
||||
* @return 0 if OK, integer value on error
|
||||
*/
|
||||
int grib_index_select_string(grib_index* index, const char* key, char* value);
|
||||
int grib_index_select_string(grib_index* index, const char* key, const char* value);
|
||||
|
||||
/**
|
||||
* Create a new handle from an index after having selected the key values.
|
||||
|
@ -1522,6 +1526,7 @@ typedef struct grib_util_grid_spec2
|
|||
#define GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE_MATRIX 6
|
||||
#define GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER 7
|
||||
#define GRIB_UTIL_PACKING_TYPE_CCSDS 8
|
||||
#define GRIB_UTIL_PACKING_TYPE_IEEE 9
|
||||
|
||||
#define GRIB_UTIL_PACKING_SAME_AS_INPUT 0
|
||||
#define GRIB_UTIL_PACKING_USE_PROVIDED 1
|
||||
|
|
|
@ -1393,6 +1393,8 @@ struct grib_index
|
|||
grib_field_list* current;
|
||||
grib_file* files;
|
||||
int count;
|
||||
ProductKind product_kind;
|
||||
int unpack_bufr; /* Only meaningful for product_kind of BUFR */
|
||||
};
|
||||
|
||||
/* header compute */
|
||||
|
|
|
@ -717,7 +717,7 @@ int grib_write_short(FILE* fh, short val);
|
|||
int grib_write_long(FILE* fh, long val);
|
||||
int grib_write_unsigned_long(FILE* fh, unsigned long val);
|
||||
int grib_write_string(FILE* fh, const char* s);
|
||||
int grib_write_identifier(FILE* fh);
|
||||
int grib_write_identifier(FILE* fh, const char* id);
|
||||
int grib_write_null_marker(FILE* fh);
|
||||
int grib_write_not_null_marker(FILE* fh);
|
||||
char* grib_read_string(grib_context* c, FILE* fh, int* err);
|
||||
|
@ -728,18 +728,16 @@ int grib_index_write(grib_index* index, const char* filename);
|
|||
grib_index* grib_index_read(grib_context* c, const char* filename, int* err);
|
||||
int grib_index_search_same(grib_index* index, grib_handle* h);
|
||||
int grib_index_add_file(grib_index* index, const char* filename);
|
||||
grib_handle* new_message_from_file(int message_type, grib_context* c, FILE* f, int* error);
|
||||
int _codes_index_add_file(grib_index* index, const char* filename, int message_type);
|
||||
int grib_index_add_file(grib_index* index, const char* filename);
|
||||
grib_index* grib_index_new_from_file(grib_context* c, char* filename, const char* keys, int* err);
|
||||
grib_index* grib_index_new_from_file(grib_context* c, const char* filename, const char* keys, int* err);
|
||||
int grib_index_get_size(const grib_index* index, const char* key, size_t* size);
|
||||
int grib_index_get_string(const grib_index* index, const char* key, char** values, size_t* size);
|
||||
int grib_index_get_long(const grib_index* index, const char* key, long* values, size_t* size);
|
||||
int grib_index_get_double(const grib_index* index, const char* key, double* values, size_t* size);
|
||||
int grib_index_select_long(grib_index* index, const char* skey, long value);
|
||||
int grib_index_select_double(grib_index* index, const char* skey, double value);
|
||||
int grib_index_select_string(grib_index* index, const char* skey, char* value);
|
||||
grib_handle* grib_index_get_handle(grib_field* field, int* err);
|
||||
int grib_index_select_string(grib_index* index, const char* skey, const char* value);
|
||||
grib_handle* codes_index_get_handle(grib_field* field, int message_type, int* err);
|
||||
int grib_index_dump_file(FILE* fout, const char* filename);
|
||||
void grib_index_dump(FILE* fout, grib_index* index);
|
||||
|
@ -748,6 +746,9 @@ grib_handle* grib_handle_new_from_index(grib_index* index, int* err);
|
|||
grib_handle* codes_new_from_index(grib_index* index, int message_type, int* err);
|
||||
void grib_index_rewind(grib_index* index);
|
||||
int grib_index_search(grib_index* index, grib_index_key* keys);
|
||||
int codes_index_set_product_kind(grib_index* index, ProductKind product_kind);
|
||||
int codes_index_set_unpack_bufr(grib_index* index, int unpack);
|
||||
int is_index_file(const char* filename);
|
||||
|
||||
/* grib_accessor_class_number_of_points_gaussian.c */
|
||||
|
||||
|
@ -1478,7 +1479,6 @@ int grib2_is_PDTN_ChemicalDistFunc(long productDefinitionTemplateNumber);
|
|||
int grib2_is_PDTN_Aerosol(long productDefinitionTemplateNumber);
|
||||
int grib2_is_PDTN_AerosolOptical(long productDefinitionTemplateNumber);
|
||||
int grib2_select_PDTN(int is_eps, int is_instant, int is_chemical, int is_chemical_distfn, int is_aerosol, int is_aerosol_optical);
|
||||
int is_grib_index_file(const char* filename);
|
||||
size_t sum_of_pl_array(const long* pl, size_t plsize);
|
||||
int grib_is_earth_oblate(grib_handle* h);
|
||||
int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max_val);
|
||||
|
|
|
@ -30,6 +30,12 @@ long GRIB_MASK = -1; /* Mask of sword bits */
|
|||
((b) == max_nbits ? GRIB_MASK : (~(GRIB_MASK << (b)) << (max_nbits - ((q) + (b)))))
|
||||
|
||||
|
||||
#define VALUE_SIZE_T(p, q, b) \
|
||||
(((b) == max_nbits_size_t ? GRIB_MASK : ~(GRIB_MASK << (b))) & ((p) >> (max_nbits_size_t - ((q) + (b)))))
|
||||
|
||||
#define MASKVALUE_SIZE_T(q, b) \
|
||||
((b) == max_nbits_size_t ? GRIB_MASK : (~(GRIB_MASK << (b)) << (max_nbits_size_t - ((q) + (b)))))
|
||||
|
||||
static const unsigned long dmasks[] = {
|
||||
0xFF,
|
||||
0xFE,
|
||||
|
|
|
@ -114,7 +114,6 @@ char* grib_decode_string(const unsigned char* bitStream, long* bitOffset, size_t
|
|||
return string;
|
||||
}
|
||||
|
||||
|
||||
unsigned long grib_decode_unsigned_long(const unsigned char* p, long* bitp, long nbits)
|
||||
{
|
||||
long countOfLeftmostBits = 0, leftmostBits = 0;
|
||||
|
@ -146,6 +145,37 @@ unsigned long grib_decode_unsigned_long(const unsigned char* p, long* bitp, long
|
|||
return val;
|
||||
}
|
||||
|
||||
size_t grib_decode_size_t(const unsigned char* p, long* bitp, long nbits)
|
||||
{
|
||||
long countOfLeftmostBits = 0, leftmostBits = 0;
|
||||
long startBit = *bitp;
|
||||
long remainingBits = nbits;
|
||||
long* pp = (long*)p;
|
||||
size_t val = 0;
|
||||
|
||||
if (startBit >= max_nbits_size_t) {
|
||||
pp += startBit / max_nbits_size_t;
|
||||
startBit %= max_nbits_size_t;
|
||||
}
|
||||
|
||||
countOfLeftmostBits = startBit + remainingBits;
|
||||
if (countOfLeftmostBits > max_nbits_size_t) {
|
||||
countOfLeftmostBits = max_nbits_size_t - startBit;
|
||||
remainingBits -= countOfLeftmostBits;
|
||||
leftmostBits = (VALUE_SIZE_T(*pp, startBit, countOfLeftmostBits)) << remainingBits;
|
||||
startBit = 0;
|
||||
pp++;
|
||||
}
|
||||
else
|
||||
leftmostBits = 0;
|
||||
|
||||
val = leftmostBits + (VALUE_SIZE_T(*pp, startBit, remainingBits));
|
||||
|
||||
*bitp += nbits;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
int grib_encode_unsigned_long(unsigned char* p, unsigned long val, long* bitp, long nbits)
|
||||
{
|
||||
long* destination = (long*)p;
|
||||
|
@ -185,6 +215,46 @@ int grib_encode_unsigned_longb(unsigned char* p, unsigned long val, long* bitp,
|
|||
return grib_encode_unsigned_long(p, val, bitp, nbits);
|
||||
}
|
||||
|
||||
int grib_encode_size_t(unsigned char* p, size_t val, long* bitp, long nbits)
|
||||
{
|
||||
long* destination = (long*)p;
|
||||
long countOfLeftmostBits = 0, nextWord = 0, startBit = 0, remainingBits = 0, rightmostBits = 0;
|
||||
|
||||
startBit = *bitp;
|
||||
remainingBits = nbits;
|
||||
|
||||
if (startBit >= max_nbits_size_t) {
|
||||
nextWord = startBit / max_nbits_size_t;
|
||||
startBit %= max_nbits_size_t;
|
||||
}
|
||||
else
|
||||
nextWord = 0;
|
||||
|
||||
countOfLeftmostBits = startBit + remainingBits;
|
||||
if (countOfLeftmostBits > max_nbits_size_t) {
|
||||
countOfLeftmostBits = max_nbits_size_t - startBit;
|
||||
startBit = max_nbits_size_t - remainingBits;
|
||||
remainingBits -= countOfLeftmostBits;
|
||||
destination[nextWord] =
|
||||
((destination[nextWord] >> countOfLeftmostBits) << countOfLeftmostBits) + (VALUE_SIZE_T(val, startBit, countOfLeftmostBits));
|
||||
startBit = 0;
|
||||
nextWord++;
|
||||
}
|
||||
|
||||
rightmostBits = VALUE_SIZE_T(val, max_nbits_size_t - remainingBits, remainingBits);
|
||||
destination[nextWord] =
|
||||
(destination[nextWord] & ~MASKVALUE_SIZE_T(startBit, remainingBits)) + (rightmostBits << max_nbits_size_t - (remainingBits + startBit));
|
||||
|
||||
*bitp += nbits;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
int grib_encode_size_tb(unsigned char* p, size_t val, long* bitp, long nbits)
|
||||
{
|
||||
return grib_encode_size_t(p, val, bitp, nbits);
|
||||
}
|
||||
|
||||
|
||||
#if VECTOR
|
||||
#include "grib_bits_fast_big_endian_vector.c" /* Experimental */
|
||||
#elif OMP
|
||||
|
|
|
@ -116,14 +116,17 @@ grib_expression* new_sub_string_expression(grib_context* c, const char* value, s
|
|||
|
||||
if (length == 0) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Invalid substring: length must be > 0");
|
||||
grib_context_free_persistent(c, e);
|
||||
return NULL;
|
||||
}
|
||||
if (start > slen) { /* to catch a -ve number passed to start */
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Invalid substring: start=%lu", start);
|
||||
grib_context_free_persistent(c, e);
|
||||
return NULL;
|
||||
}
|
||||
if (start + length > slen) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Invalid substring: start(=%lu)+length(=%lu) > length('%s'))", start, length, value);
|
||||
grib_context_free_persistent(c, e);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1440,7 +1440,14 @@ grib_action* grib_action_from_filter(const char* filter)
|
|||
grib_action* a = NULL;
|
||||
grib_context* context = grib_context_get_default();
|
||||
a = grib_parse_file(context, filter);
|
||||
context->grib_reader = NULL;
|
||||
|
||||
if (context->grib_reader && context->grib_reader->first) {
|
||||
grib_context_free_persistent(context, context->grib_reader->first->filename);
|
||||
grib_context_free_persistent(context, context->grib_reader->first);
|
||||
grib_context_free_persistent(context, context->grib_reader);
|
||||
}
|
||||
|
||||
context->grib_reader = NULL;
|
||||
return a;
|
||||
}
|
||||
|
||||
|
|
124
src/grib_index.c
124
src/grib_index.c
|
@ -366,9 +366,9 @@ int grib_write_string(FILE* fh, const char* s)
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
int grib_write_identifier(FILE* fh)
|
||||
int grib_write_identifier(FILE* fh, const char* ID)
|
||||
{
|
||||
return grib_write_string(fh, "GRBIDX1");
|
||||
return grib_write_string(fh, ID);
|
||||
}
|
||||
|
||||
int grib_write_null_marker(FILE* fh)
|
||||
|
@ -557,6 +557,8 @@ grib_index* grib_index_new(grib_context* c, const char* key, int* err)
|
|||
return NULL;
|
||||
}
|
||||
index->context = c;
|
||||
index->product_kind = PRODUCT_GRIB;
|
||||
index->unpack_bufr = 0;
|
||||
|
||||
while ((key = get_key(&p, &type)) != NULL) {
|
||||
keys = grib_index_new_key(c, keys, key, type, err);
|
||||
|
@ -835,6 +837,7 @@ int grib_index_write(grib_index* index, const char* filename)
|
|||
int err = 0;
|
||||
FILE* fh;
|
||||
grib_file* files;
|
||||
char* identifier = NULL;
|
||||
|
||||
fh = fopen(filename, "w");
|
||||
if (!fh) {
|
||||
|
@ -844,7 +847,10 @@ int grib_index_write(grib_index* index, const char* filename)
|
|||
return GRIB_IO_PROBLEM;
|
||||
}
|
||||
|
||||
err = grib_write_identifier(fh);
|
||||
if (index->product_kind == PRODUCT_GRIB) identifier = "GRBIDX1";
|
||||
if (index->product_kind == PRODUCT_BUFR) identifier = "BFRIDX1";
|
||||
Assert(identifier);
|
||||
err = grib_write_identifier(fh, identifier);
|
||||
if (err) {
|
||||
grib_context_log(index->context, (GRIB_LOG_ERROR) | (GRIB_LOG_PERROR),
|
||||
"Unable to write in file %s", filename);
|
||||
|
@ -905,6 +911,7 @@ grib_index* grib_index_read(grib_context* c, const char* filename, int* err)
|
|||
char* identifier = NULL;
|
||||
int max = 0;
|
||||
FILE* fh = NULL;
|
||||
ProductKind product_kind = PRODUCT_GRIB;
|
||||
|
||||
if (!c)
|
||||
c = grib_context_get_default();
|
||||
|
@ -923,6 +930,8 @@ grib_index* grib_index_read(grib_context* c, const char* filename, int* err)
|
|||
fclose(fh);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strcmp(identifier, "BFRIDX1")==0) product_kind = PRODUCT_BUFR;
|
||||
grib_context_free(c, identifier);
|
||||
|
||||
*err = grib_read_uchar(fh, &marker);
|
||||
|
@ -967,6 +976,7 @@ grib_index* grib_index_read(grib_context* c, const char* filename, int* err)
|
|||
|
||||
index = (grib_index*)grib_context_malloc_clear(c, sizeof(grib_index));
|
||||
index->context = c;
|
||||
index->product_kind = product_kind;
|
||||
|
||||
index->keys = grib_read_index_keys(c, fh, err);
|
||||
if (*err)
|
||||
|
@ -1046,16 +1056,21 @@ int grib_index_search_same(grib_index* index, grib_handle* h)
|
|||
|
||||
int grib_index_add_file(grib_index* index, const char* filename)
|
||||
{
|
||||
return _codes_index_add_file(index, filename, CODES_GRIB);
|
||||
int message_type = 0;
|
||||
if (index->product_kind == PRODUCT_GRIB) message_type = CODES_GRIB;
|
||||
else if (index->product_kind == PRODUCT_BUFR) message_type = CODES_BUFR;
|
||||
else return GRIB_INVALID_ARGUMENT;
|
||||
|
||||
return _codes_index_add_file(index, filename, message_type);
|
||||
}
|
||||
|
||||
grib_handle* new_message_from_file(int message_type, grib_context* c, FILE* f, int* error)
|
||||
static grib_handle* new_message_from_file(int message_type, grib_context* c, FILE* f, int* error)
|
||||
{
|
||||
if (message_type == CODES_GRIB)
|
||||
return grib_new_from_file(c, f, 0, error); /* headers_only=0 */
|
||||
if (message_type == CODES_BUFR)
|
||||
return bufr_new_from_file(c, f, error);
|
||||
Assert(0);
|
||||
Assert(!"new_message_from_file: invalid message type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1120,6 +1135,15 @@ int _codes_index_add_file(grib_index* index, const char* filename, int message_t
|
|||
field_tree = index->fields;
|
||||
index_key->value[0] = 0;
|
||||
message_count++;
|
||||
|
||||
if (index->product_kind == PRODUCT_BUFR && index->unpack_bufr) {
|
||||
err = grib_set_long(h, "unpack", 1);
|
||||
if (err) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "unable to unpack BUFR to create index. \"%s\": %s",
|
||||
index_key->name, grib_get_error_message(err));
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
while (index_key) {
|
||||
if (index_key->type == GRIB_TYPE_UNDEFINED) {
|
||||
|
@ -1222,7 +1246,7 @@ int _codes_index_add_file(grib_index* index, const char* filename, int message_t
|
|||
field_tree->field = field;
|
||||
|
||||
grib_handle_delete(h);
|
||||
}
|
||||
}/*foreach message*/
|
||||
|
||||
grib_file_close(file->name, 0, &err);
|
||||
|
||||
|
@ -1400,7 +1424,7 @@ int grib_index_add_file(grib_index* index, const char* filename)
|
|||
}
|
||||
#endif
|
||||
|
||||
grib_index* grib_index_new_from_file(grib_context* c, char* filename, const char* keys, int* err)
|
||||
grib_index* grib_index_new_from_file(grib_context* c, const char* filename, const char* keys, int* err)
|
||||
{
|
||||
grib_index* index = NULL;
|
||||
|
||||
|
@ -1576,7 +1600,7 @@ int grib_index_select_double(grib_index* index, const char* skey, double value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int grib_index_select_string(grib_index* index, const char* skey, char* value)
|
||||
int grib_index_select_string(grib_index* index, const char* skey, const char* value)
|
||||
{
|
||||
grib_index_key* key = NULL;
|
||||
int err = GRIB_NOT_FOUND;
|
||||
|
@ -1608,15 +1632,10 @@ int grib_index_select_string(grib_index* index, const char* skey, char* value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
grib_handle* grib_index_get_handle(grib_field* field, int* err)
|
||||
{
|
||||
return codes_index_get_handle(field, CODES_GRIB, err);
|
||||
}
|
||||
|
||||
grib_handle* codes_index_get_handle(grib_field* field, int message_type, int* err)
|
||||
{
|
||||
grib_handle* h = NULL;
|
||||
typedef grib_handle* (*message_new_proc)(grib_context*, FILE*, int, int*);
|
||||
typedef grib_handle* (*message_new_proc)(grib_context*, FILE*, int*);
|
||||
message_new_proc message_new = NULL;
|
||||
|
||||
if (!field->file) {
|
||||
|
@ -1631,18 +1650,19 @@ grib_handle* codes_index_get_handle(grib_field* field, int message_type, int* er
|
|||
return NULL;
|
||||
switch (message_type) {
|
||||
case CODES_GRIB:
|
||||
message_new = grib_new_from_file;
|
||||
message_new = codes_grib_handle_new_from_file;
|
||||
break;
|
||||
case CODES_BUFR:
|
||||
Assert(!"_codes_index_add_file for BUFR: not yet implemented");
|
||||
/* message_new=bufr_new_from_file; */
|
||||
message_new = codes_bufr_handle_new_from_file;
|
||||
break;
|
||||
default:
|
||||
Assert(0);
|
||||
grib_context_log(grib_context_get_default(), GRIB_LOG_ERROR, "codes_index_get_handle: invalid message type");
|
||||
*err = GRIB_INTERNAL_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fseeko(field->file->handle, field->offset, SEEK_SET);
|
||||
h = message_new(0, field->file->handle, 0, err);
|
||||
h = message_new(0, field->file->handle, err);
|
||||
if (*err != GRIB_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
|
@ -1830,7 +1850,12 @@ char* grib_get_field_file(grib_index* index, off_t* offset)
|
|||
|
||||
grib_handle* grib_handle_new_from_index(grib_index* index, int* err)
|
||||
{
|
||||
return codes_new_from_index(index, CODES_GRIB, err);
|
||||
ProductKind pkind = index->product_kind;
|
||||
if (pkind == PRODUCT_GRIB)
|
||||
return codes_new_from_index(index, CODES_GRIB, err);
|
||||
if (pkind == PRODUCT_BUFR)
|
||||
return codes_new_from_index(index, CODES_BUFR, err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
grib_handle* codes_new_from_index(grib_index* index, int message_type, int* err)
|
||||
|
@ -1932,3 +1957,60 @@ int grib_index_search(grib_index* index, grib_index_key* keys)
|
|||
grib_index_rewind(index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int codes_index_set_product_kind(grib_index* index, ProductKind product_kind)
|
||||
{
|
||||
if (!index)
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
|
||||
if (product_kind == PRODUCT_GRIB || product_kind == PRODUCT_BUFR) {
|
||||
index->product_kind = product_kind;
|
||||
} else {
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
}
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
int codes_index_set_unpack_bufr(grib_index* index, int unpack)
|
||||
{
|
||||
if (!index)
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
if (index->product_kind != PRODUCT_BUFR)
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
index->unpack_bufr = unpack;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
/* Return 1 if the file is an index file. 0 otherwise */
|
||||
int is_index_file(const char* filename)
|
||||
{
|
||||
FILE* fh;
|
||||
char buf[8] = {0,};
|
||||
/* Only read the first 6 characters of identifier. Exclude version */
|
||||
const size_t numChars = 6;
|
||||
const char* id_grib = "GRBIDX";
|
||||
const char* id_bufr = "BFRIDX";
|
||||
int ret = 0;
|
||||
size_t size = 0;
|
||||
|
||||
fh = fopen(filename, "r");
|
||||
if (!fh)
|
||||
return 0;
|
||||
|
||||
size = fread(buf, 1, 1, fh);
|
||||
if (size != 1) {
|
||||
fclose(fh);
|
||||
return 0;
|
||||
}
|
||||
size = fread(buf, numChars, 1, fh);
|
||||
if (size != 1) {
|
||||
fclose(fh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = (strcmp(buf, id_grib)==0 || strcmp(buf, id_bufr)==0);
|
||||
|
||||
fclose(fh);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -351,6 +351,7 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha
|
|||
*newline = 1;
|
||||
cols = 0;
|
||||
}
|
||||
grib_context_free(h->context, cvals[i]);
|
||||
}
|
||||
}
|
||||
grib_context_free(h->context, cvals);
|
||||
|
@ -485,6 +486,7 @@ int grib_recompose_print(grib_handle* h, grib_accessor* observer, const char* un
|
|||
case ']':
|
||||
loc[mode] = 0;
|
||||
mode = -1;
|
||||
if (al) grib_accessors_list_delete(h->context, al);
|
||||
al = grib_find_accessors_list(h, loc); /* This allocates memory */
|
||||
if (!al) {
|
||||
if (!fail) {
|
||||
|
@ -731,7 +733,8 @@ static int parse(grib_context* gc, const char* filename)
|
|||
parse_file = 0;
|
||||
|
||||
if (err)
|
||||
grib_context_log(gc, GRIB_LOG_ERROR, "Parsing error %d > %s\n", err, filename);
|
||||
grib_context_log(gc, GRIB_LOG_ERROR, "Parsing error: %s, file: %s\n",
|
||||
grib_get_error_message(err), filename);
|
||||
|
||||
GRIB_MUTEX_UNLOCK(&mutex_parse);
|
||||
return err;
|
||||
|
|
111
src/grib_util.c
111
src/grib_util.c
|
@ -974,9 +974,13 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
|
|||
if (strcmp(input_packing_type, "grid_ccsds") && !strcmp(input_packing_type, "grid_simple"))
|
||||
SET_STRING_VALUE("packingType", "grid_ccsds");
|
||||
break;
|
||||
case GRIB_UTIL_PACKING_TYPE_IEEE:
|
||||
if (strcmp(input_packing_type, "grid_ieee") && !strcmp(input_packing_type, "grid_simple"))
|
||||
SET_STRING_VALUE("packingType", "grid_ieee");
|
||||
break;
|
||||
case GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER:
|
||||
/* we delay the set of grid_second_order because we don't want
|
||||
to do it on a field with bitsPerValue=0 */
|
||||
to do it on a field with bitsPerValue=0 */
|
||||
setSecondOrder = 1;
|
||||
break;
|
||||
default:
|
||||
|
@ -1255,18 +1259,17 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
|
|||
COPY_SPEC_LONG(Ni); /* same as Nx */
|
||||
COPY_SPEC_LONG(Nj); /* same as Ny */
|
||||
/* TODO
|
||||
* pass in extra keys e.g. Dx, Dy, standardParallel and centralLongitude
|
||||
*/
|
||||
* pass in extra keys e.g. Dx, Dy, standardParallel and centralLongitude
|
||||
*/
|
||||
|
||||
/*
|
||||
COPY_SPEC_LONG(DxInMetres);
|
||||
COPY_SPEC_LONG(DyInMetres);
|
||||
|
||||
COPY_SPEC_LONG(xDirectionGridLengthInMillimetres);
|
||||
COPY_SPEC_LONG(yDirectionGridLengthInMillimetres);
|
||||
COPY_SPEC_LONG(standardParallelInMicrodegrees);
|
||||
COPY_SPEC_LONG(centralLongitudeInMicrodegrees);
|
||||
*/
|
||||
COPY_SPEC_LONG(DxInMetres);
|
||||
COPY_SPEC_LONG(DyInMetres);
|
||||
COPY_SPEC_LONG(xDirectionGridLengthInMillimetres);
|
||||
COPY_SPEC_LONG(yDirectionGridLengthInMillimetres);
|
||||
COPY_SPEC_LONG(standardParallelInMicrodegrees);
|
||||
COPY_SPEC_LONG(centralLongitudeInMicrodegrees);
|
||||
*/
|
||||
|
||||
break;
|
||||
case GRIB_UTIL_GRID_SPEC_UNSTRUCTURED:
|
||||
|
@ -1274,8 +1277,8 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
|
|||
if (spec->missingValue)
|
||||
COPY_SPEC_DOUBLE(missingValue);
|
||||
/*
|
||||
* TODO: Other keys
|
||||
*/
|
||||
* TODO: Other keys
|
||||
*/
|
||||
break;
|
||||
case GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL:
|
||||
COPY_SPEC_LONG(bitmapPresent);
|
||||
|
@ -1287,14 +1290,14 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
|
|||
COPY_SPEC_LONG(Nj); /* same as Ny */
|
||||
|
||||
/*
|
||||
* Note: DxInMetres and DyInMetres
|
||||
* should be 'double' and not integer. WMO GRIB2 uses millimetres!
|
||||
* TODO:
|
||||
* Add other keys like Latin1, LoV etc
|
||||
* Note: DxInMetres and DyInMetres
|
||||
* should be 'double' and not integer. WMO GRIB2 uses millimetres!
|
||||
* TODO:
|
||||
* Add other keys like Latin1, LoV etc
|
||||
|
||||
*err = GRIB_NOT_IMPLEMENTED;
|
||||
goto cleanup;
|
||||
*/
|
||||
*err = GRIB_NOT_IMPLEMENTED;
|
||||
goto cleanup;
|
||||
*/
|
||||
break;
|
||||
|
||||
case GRIB_UTIL_GRID_SPEC_REDUCED_GG:
|
||||
|
@ -1388,23 +1391,27 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
|
|||
break;
|
||||
case GRIB_UTIL_PACKING_TYPE_JPEG:
|
||||
/* Have to delay JPEG packing:
|
||||
* Reason 1: It is not available in GRIB1 and so we have to wait until we change edition
|
||||
* Reason 2: It has to be done AFTER we set the data values
|
||||
*/
|
||||
* Reason 1: It is not available in GRIB1 and so we have to wait until we change edition
|
||||
* Reason 2: It has to be done AFTER we set the data values
|
||||
*/
|
||||
if (strcmp(input_packing_type, "grid_jpeg") && !strcmp(input_packing_type, "grid_simple"))
|
||||
setJpegPacking = 1;
|
||||
break;
|
||||
case GRIB_UTIL_PACKING_TYPE_CCSDS:
|
||||
/* Have to delay CCSDS packing:
|
||||
* Reason 1: It is not available in GRIB1 and so we have to wait until we change edition
|
||||
* Reason 2: It has to be done AFTER we set the data values
|
||||
*/
|
||||
* Reason 1: It is not available in GRIB1 and so we have to wait until we change edition
|
||||
* Reason 2: It has to be done AFTER we set the data values
|
||||
*/
|
||||
if (strcmp(input_packing_type, "grid_ccsds") && !strcmp(input_packing_type, "grid_simple"))
|
||||
setCcsdsPacking = 1;
|
||||
break;
|
||||
case GRIB_UTIL_PACKING_TYPE_IEEE:
|
||||
if (strcmp(input_packing_type, "grid_ieee") && !strcmp(input_packing_type, "grid_simple"))
|
||||
SET_STRING_VALUE("packingType", "grid_ieee");
|
||||
break;
|
||||
case GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER:
|
||||
/* we delay the set of grid_second_order because we don't want
|
||||
to do it on a field with bitsPerValue=0 */
|
||||
to do it on a field with bitsPerValue=0 */
|
||||
setSecondOrder = 1;
|
||||
break;
|
||||
default:
|
||||
|
@ -1588,14 +1595,14 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
|
|||
|
||||
/* grib_write_message(outh,"h.grib","w"); */
|
||||
/* if the field is empty GRIBEX is packing as simple*/
|
||||
/* if (!strcmp(input_packing_type,"grid_simple_matrix")) {
|
||||
long numberOfValues;
|
||||
grib_get_long(outh,"numberOfValues",&numberOfValues);
|
||||
if (numberOfValues==0) {
|
||||
slen=11;
|
||||
grib_set_string(outh,"packingType","grid_simple",&slen);
|
||||
}
|
||||
} */
|
||||
/* if (!strcmp(input_packing_type,"grid_simple_matrix")) {
|
||||
long numberOfValues;
|
||||
grib_get_long(outh,"numberOfValues",&numberOfValues);
|
||||
if (numberOfValues==0) {
|
||||
slen=11;
|
||||
grib_set_string(outh,"packingType","grid_simple",&slen);
|
||||
}
|
||||
} */
|
||||
|
||||
if (grib1_high_resolution_fix) {
|
||||
/* GRIB-863: must set increments to MISSING */
|
||||
|
@ -1917,7 +1924,7 @@ int parse_keyval_string(const char* grib_tool,
|
|||
grib_values values[], int* count)
|
||||
{
|
||||
char* p = NULL;
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
if (arg == NULL) {
|
||||
*count = 0;
|
||||
return GRIB_SUCCESS;
|
||||
|
@ -2133,36 +2140,6 @@ int grib2_select_PDTN(int is_eps, int is_instant,
|
|||
}
|
||||
}
|
||||
|
||||
int is_grib_index_file(const char* filename)
|
||||
{
|
||||
FILE* fh;
|
||||
char buf[8] = {0,};
|
||||
const char* str = "GRBIDX";
|
||||
int ret = 0;
|
||||
size_t size = 0;
|
||||
|
||||
fh = fopen(filename, "r");
|
||||
if (!fh)
|
||||
return 0;
|
||||
|
||||
size = fread(buf, 1, 1, fh);
|
||||
if (size != 1) {
|
||||
fclose(fh);
|
||||
return 0;
|
||||
}
|
||||
size = fread(buf, 6, 1, fh);
|
||||
if (size != 1) {
|
||||
fclose(fh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = !strcmp(buf, str);
|
||||
|
||||
fclose(fh);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t sum_of_pl_array(const long* pl, size_t plsize)
|
||||
{
|
||||
long i, count = 0;
|
||||
|
@ -2191,7 +2168,7 @@ int grib_util_grib_data_quality_check(grib_handle* h, double min_val, double max
|
|||
int is_error = 1;
|
||||
char description[1024] = {0,};
|
||||
char step[32] = "unknown";
|
||||
size_t len = 32;
|
||||
size_t len = 32;
|
||||
/*
|
||||
* If grib_data_quality_checks == 1, limits failure results in an error
|
||||
* If grib_data_quality_checks == 2, limits failure results in a warning
|
||||
|
|
|
@ -48,9 +48,12 @@ endforeach()
|
|||
#################################################
|
||||
# These tests do not require any data downloads
|
||||
list(APPEND tests_no_data_reqd
|
||||
unit_tests
|
||||
julian
|
||||
grib_dump_samples
|
||||
bufr_dump_samples
|
||||
definitions
|
||||
grib_calendar
|
||||
unit_tests
|
||||
grib_md5
|
||||
filter_substr
|
||||
grib_uerra
|
||||
|
@ -59,8 +62,6 @@ list(APPEND tests_no_data_reqd
|
|||
grib_ecc-967
|
||||
grib_ecc-1065
|
||||
grib_ecc-1053
|
||||
julian
|
||||
bufr_dump_samples
|
||||
bufr_json_samples
|
||||
bufr_ecc-359
|
||||
bufr_ecc-517
|
||||
|
|
|
@ -61,7 +61,7 @@ bufr_files=`cat ${data_dir}/bufr/bufr_data_files.txt`
|
|||
for file in ${bufr_files}
|
||||
do
|
||||
# Every file has at least one subset
|
||||
${tools_dir}/bufr_dump -S1 ${data_dir}/bufr/$file >/dev/null
|
||||
${tools_dir}/bufr_dump -wcount=1 -S1 ${data_dir}/bufr/$file >/dev/null
|
||||
done
|
||||
|
||||
# Check strict option with 'where' clause
|
||||
|
|
|
@ -36,4 +36,13 @@ export ECCODES_FAIL_IF_LOG_MESSAGE=1
|
|||
${tools_dir}/grib_set -r -s decimalScaleFactor=0 $infile $temp
|
||||
${tools_dir}/grib_set -r -s decimalScaleFactor=1 $infile $temp
|
||||
|
||||
# Constant field with bitsPerValue=0 and decimalScaleFactor!=0
|
||||
sample1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
${tools_dir}/grib_set -s decimalScaleFactor=3 $sample1 $temp
|
||||
grib_check_key_equals $temp min,max,const,decimalScaleFactor,referenceValue '47485.4 47485.4 1 3 47485.4'
|
||||
${tools_dir}/grib_set -s decimalScaleFactor=3 $sample2 $temp
|
||||
grib_check_key_equals $temp min,max,const,decimalScaleFactor,referenceValue '1 1 1 3 1'
|
||||
|
||||
|
||||
rm -f $temp
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
|
||||
REDIRECT=/dev/null
|
||||
|
||||
label="grib_dump_test"
|
||||
temp=temp.$label.txt
|
||||
|
||||
if [ $HAVE_MEMFS -eq 1 ]; then
|
||||
unset ECCODES_DEFINITION_PATH
|
||||
unset ECCODES_SAMPLES_PATH
|
||||
|
@ -76,3 +79,23 @@ for file in $files; do
|
|||
${tools_dir}/grib_dump -O ${data_dir}/$file 2> $REDIRECT > $REDIRECT
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Test for dumping a section
|
||||
if [ $HAVE_JPEG -eq 0 ]; then
|
||||
# No JPEG decoding enabled so dumping section 7 will issue errors
|
||||
# but dumping non-data sections should work
|
||||
file=${data_dir}/jpeg.grib2
|
||||
${tools_dir}/grib_dump -O -p section_3,section_4 $file > $temp 2>&1
|
||||
set +e
|
||||
# Look for the word ERROR in output. We should not find any
|
||||
grep -q 'ERROR ' $temp
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "grib_dump on $file: found string ERROR in grib_dump output!"
|
||||
cat $temp
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
fi
|
||||
|
||||
rm -f $temp
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#!/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_dump_samples_test"
|
||||
temp=${label}".temp"
|
||||
|
||||
# Test selected sample GRIB files
|
||||
samples="
|
||||
GRIB1.tmpl
|
||||
GRIB2.tmpl
|
||||
sh_ml_grib1.tmpl
|
||||
sh_ml_grib2.tmpl
|
||||
reduced_gg_pl_48_grib1.tmpl
|
||||
reduced_gg_pl_48_grib2.tmpl
|
||||
regular_ll_sfc_grib1.tmpl
|
||||
regular_ll_sfc_grib2.tmpl
|
||||
"
|
||||
for file in $samples; do
|
||||
sf="$ECCODES_SAMPLES_PATH/$file"
|
||||
${tools_dir}/grib_dump -O $sf >/dev/null
|
||||
done
|
||||
|
||||
|
||||
rm -f $temp
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
REDIRECT=/dev/null
|
||||
|
||||
dir="${data_dir}/tigge/"
|
||||
dir="${data_dir}/tigge"
|
||||
temp1="temp.grib1_"
|
||||
temp2="temp.grib2_"
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ static int get_packing_type_code(const char* packingType)
|
|||
result = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE;
|
||||
else if (STR_EQUAL(packingType, "grid_second_order"))
|
||||
result = GRIB_UTIL_PACKING_TYPE_GRID_SECOND_ORDER;
|
||||
else if (STR_EQUAL(packingType, "grid_ieee"))
|
||||
result = GRIB_UTIL_PACKING_TYPE_IEEE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ set -ea
|
|||
# For CMake
|
||||
|
||||
set -x
|
||||
echo "Script: $0"
|
||||
|
||||
proj_dir=@PROJECT_SOURCE_DIR@
|
||||
build_dir=@PROJECT_BINARY_DIR@
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
leak:tools/grib_filter.c
|
||||
leak:tools/bufr_filter.c
|
||||
leak:tools/bufr_dump.c
|
||||
leak:tools/bufr_compare.c
|
||||
leak:tools/gts_filter.c
|
||||
leak:src/action_class_rename.c
|
||||
leak:tools/grib_to_netcdf.c
|
||||
leak:process_elements
|
||||
leak:tests/bufr_ecc-517.c
|
||||
leak:src/action_class_rename.c
|
||||
|
|
|
@ -236,14 +236,14 @@ static int counter = 0;
|
|||
static int start = -1;
|
||||
static int end = -1;
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Compare BUFR messages contained in two files."
|
||||
"\n\tIf some differences are found it fails returning an error code."
|
||||
"\n\tFloating-point values are compared exactly by default, different tolerance can be defined see -P -A -R."
|
||||
"\n\tDefault behaviour: absolute error=0, bit-by-bit compare, same order in files.";
|
||||
|
||||
const char* grib_tool_name = "bufr_compare";
|
||||
const char* grib_tool_usage = "[options] bufr_file1 bufr_file2";
|
||||
const char* tool_name = "bufr_compare";
|
||||
const char* tool_usage = "[options] bufr_file1 bufr_file2";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -326,7 +326,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
}
|
||||
|
||||
/* Check 1st file is not a directory */
|
||||
exit_if_input_is_directory(grib_tool_name, options->infile_extra->name);
|
||||
exit_if_input_is_directory(tool_name, options->infile_extra->name);
|
||||
|
||||
if (grib_options_on("r")) {
|
||||
char* filename[1];
|
||||
|
@ -388,7 +388,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
if (grib_options_on("R:")) {
|
||||
char* sarg = grib_options_get_option("R:");
|
||||
options->tolerance_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||
ret = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT) {
|
||||
usage();
|
||||
exit(1);
|
||||
|
@ -426,7 +426,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Copies the content of BUFR files printing"
|
||||
" values of some keys."
|
||||
"\n\tIf the name of the output_bufr_file contains a key enclosed in square brackets, its value will be used.";
|
||||
const char* grib_tool_name = "bufr_copy";
|
||||
const char* grib_tool_usage = "[options] bufr_file bufr_file ... output_bufr_file";
|
||||
const char* tool_name = "bufr_copy";
|
||||
const char* tool_usage = "[options] bufr_file bufr_file ... output_bufr_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
@ -90,7 +90,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,9 @@ grib_option grib_options[] = {
|
|||
/* {"x",0,0,0,1,0} */
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a BUFR file in different formats.";
|
||||
const char* grib_tool_name = "bufr_dump";
|
||||
const char* grib_tool_usage = "[options] bufr_file bufr_file ...";
|
||||
const char* tool_description = "Dump the content of a BUFR file in different formats.";
|
||||
const char* tool_name = "bufr_dump";
|
||||
const char* tool_usage = "[options] bufr_file bufr_file ...";
|
||||
static int json = 0;
|
||||
static int dump_descriptors = 0;
|
||||
static char* json_option = 0;
|
||||
|
@ -108,7 +108,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->strict = 1; /* Must set here as bufr_dump has its own -S option */
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous j/C/O options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous j/C/O options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->dump_mode = "json";
|
||||
json_option = grib_options_get_option("j:");
|
||||
if (strlen(json_option) > 1 || (json_option[0] != 's' && json_option[0] != 'f' && json_option[0] != 'a')) {
|
||||
printf("%s: Invalid JSON option %s\n", grib_tool_name, json_option);
|
||||
printf("%s: Invalid JSON option %s\n", tool_name, json_option);
|
||||
exit(1);
|
||||
}
|
||||
json = 1;
|
||||
|
@ -186,6 +186,32 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
|
|||
{
|
||||
if (!options->current_infile->name)
|
||||
return 0;
|
||||
|
||||
Assert(file);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
|
||||
/*
|
||||
* Dumping of index files
|
||||
*/
|
||||
if (is_index_file(options->current_infile->name)) {
|
||||
int err = 0;
|
||||
grib_context* c = grib_context_get_default();
|
||||
const char* filename = options->current_infile->name;
|
||||
|
||||
err = grib_index_dump_file(stdout, filename);
|
||||
if (err) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "%s: Could not dump index file \"%s\".\n%s\n",
|
||||
tool_name,
|
||||
filename,
|
||||
grib_get_error_message(err));
|
||||
exit(1);
|
||||
}
|
||||
/* Since there are no BUFR messages, we have to stop tool exiting in case there
|
||||
* are more index files */
|
||||
options->fail = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (json)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each BUFR "
|
||||
"message\n\tin the BUFR files provided as arguments.\n\t"
|
||||
"If you specify '-' (a single dash) for the rules_file, the rules will be read from standard input.";
|
||||
const char* grib_tool_name = "bufr_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "bufr_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"bufr_file bufr_file ...";
|
||||
|
||||
|
@ -55,7 +55,9 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
{
|
||||
options->action = grib_action_from_filter(options->infile_extra->name);
|
||||
if (!options->action) {
|
||||
fprintf(stderr, "%s: error unable to create action\n", options->infile_extra->name);
|
||||
const char* filt = options->infile_extra->name;
|
||||
if (strcmp(filt, "-")==0) filt = "stdin";
|
||||
fprintf(stderr, "Error: %s: unable to create action\n", filt);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -75,7 +77,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -112,7 +114,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,12 +35,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some header keys from a BUFR file."
|
||||
"\n\tIt is similar to bufr_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "bufr_get";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "bufr_get";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -71,7 +71,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Build an index file for a set of input BUFR files.\n"
|
||||
"\tWarning: THIS TOOL IS NOT YET IMPLEMENTED";
|
||||
const char* grib_tool_name = "bufr_index_build";
|
||||
const char* grib_tool_usage = "[options] file file ... ";
|
||||
const char* tool_name = "bufr_index_build";
|
||||
const char* tool_usage = "[options] file file ... ";
|
||||
grib_index* idx = NULL;
|
||||
char* keys;
|
||||
char* default_keys = "mars";
|
||||
|
@ -41,7 +41,7 @@ grib_option grib_options[] = {
|
|||
0, 1, 0 }
|
||||
};
|
||||
|
||||
int compress_index;
|
||||
static int compress_index;
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -73,6 +73,8 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->onlyfiles = 1;
|
||||
|
||||
idx = grib_index_new(c, keys, &ret);
|
||||
codes_index_set_product_kind(idx, PRODUCT_BUFR);
|
||||
codes_index_set_unpack_bufr(idx, 1);
|
||||
|
||||
if (!idx || ret)
|
||||
grib_context_log(c, GRIB_LOG_FATAL,
|
||||
|
@ -84,8 +86,8 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
int grib_tool_new_filename_action(grib_runtime_options* options, const char* file)
|
||||
{
|
||||
int ret = 0;
|
||||
printf("--- %s: processing %s\n", grib_tool_name, file);
|
||||
ret = _codes_index_add_file(idx, file, CODES_BUFR);
|
||||
printf("--- %s: processing %s\n", tool_name, file);
|
||||
ret = grib_index_add_file(idx, file);
|
||||
if (ret) {
|
||||
printf("error: %s\n", grib_get_error_message(ret));
|
||||
exit(ret);
|
||||
|
@ -122,7 +124,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
grib_index_compress(idx);
|
||||
}
|
||||
printf("--- %s: keys included in the index file %s:\n",
|
||||
grib_tool_name, options->outfile->name);
|
||||
tool_name, options->outfile->name);
|
||||
printf("--- ");
|
||||
first = 1;
|
||||
the_keys = idx->keys;
|
||||
|
|
|
@ -37,12 +37,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of BUFR files printing values of "
|
||||
"some header keys.\n\tOnly scalar keys can be printed."
|
||||
"\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "bufr_ls";
|
||||
const char* grib_tool_usage = "[options] bufr_file bufr_file ...";
|
||||
const char* tool_name = "bufr_ls";
|
||||
const char* tool_usage = "[options] bufr_file bufr_file ...";
|
||||
static int first_handle = 1;
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
@ -84,7 +84,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Sets key/value pairs in the input BUFR file and writes"
|
||||
"\n\teach message to the output_file."
|
||||
"\n\tIt fails when an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "bufr_set";
|
||||
const char* grib_tool_usage = "[options] file file ... output_file";
|
||||
const char* tool_name = "bufr_set";
|
||||
const char* tool_usage = "[options] file file ... output_file";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -166,7 +166,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "grib_api_internal.h"
|
||||
|
||||
static int fail_on_error = 1;
|
||||
static const char* tool_name = NULL;
|
||||
static const char* toolname = NULL;
|
||||
|
||||
static void usage(const char* prog)
|
||||
{
|
||||
|
@ -81,15 +81,15 @@ int main(int argc, char* argv[])
|
|||
unsigned long count_total = 0, count_curr = 0;
|
||||
int message_type = 0; /* GRIB, BUFR etc */
|
||||
|
||||
tool_name = argv[0];
|
||||
toolname = argv[0];
|
||||
if (argc < 2)
|
||||
usage(tool_name);
|
||||
usage(toolname);
|
||||
|
||||
if (strstr(tool_name, "grib_count"))
|
||||
if (strstr(toolname, "grib_count"))
|
||||
message_type = CODES_GRIB;
|
||||
if (strstr(tool_name, "bufr_count"))
|
||||
if (strstr(toolname, "bufr_count"))
|
||||
message_type = CODES_BUFR;
|
||||
if (strstr(tool_name, "gts_count"))
|
||||
if (strstr(toolname, "gts_count"))
|
||||
message_type = CODES_GTS;
|
||||
|
||||
count_total = 0;
|
||||
|
@ -104,7 +104,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
filename = argv[i];
|
||||
if (path_is_directory(filename)) {
|
||||
fprintf(stderr, "%s: ERROR: \"%s\": Is a directory\n", tool_name, filename);
|
||||
fprintf(stderr, "%s: ERROR: \"%s\": Is a directory\n", toolname, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ int main(int argc, char* argv[])
|
|||
if ((path = getenv("ECCODES_DEFINITION_PATH")) != NULL) {
|
||||
printf("Definition files path from environment variable");
|
||||
printf(" ECCODES_DEFINITION_PATH=%s\n", path);
|
||||
printf("Full definition files path=%s\n", context->grib_definition_files_path);
|
||||
}
|
||||
else if ((path = getenv("GRIB_DEFINITION_PATH")) != NULL) {
|
||||
printf("Definition files path from environment variable");
|
||||
|
@ -94,6 +95,7 @@ int main(int argc, char* argv[])
|
|||
printf(
|
||||
"(This is for backward compatibility. "
|
||||
"It is recommended you use ECCODES_DEFINITION_PATH instead!)\n");
|
||||
printf("Full definition files path=%s\n", context->grib_definition_files_path);
|
||||
}
|
||||
else {
|
||||
printf("Default definition files path is used: %s\n", context->grib_definition_files_path);
|
||||
|
|
|
@ -32,14 +32,14 @@ grib_option grib_options[]={
|
|||
{"v",0,0,0,1,0}
|
||||
};
|
||||
|
||||
char* grib_tool_description=
|
||||
char* tool_description=
|
||||
"It converts grib messages applying the rules from a conversion_rules file."
|
||||
"\n\tThe rules are of the type \"keyname = value;\" and if blocks are allowed as"
|
||||
"\n\tif ( keyname1 == value1 || keyname2 != value2 && keyname3 == value3 ) {"
|
||||
"\n\t keyname4 = value4;"
|
||||
"\n\t}";
|
||||
char* grib_tool_name="grib_convert";
|
||||
char* grib_tool_usage="[options] conversion_rules "
|
||||
char* tool_name="grib_convert";
|
||||
char* tool_usage="[options] conversion_rules "
|
||||
"grib_file grib_file ... output_grib_file";
|
||||
|
||||
int grib_options_count=sizeof(grib_options)/sizeof(grib_option);
|
||||
|
|
|
@ -29,9 +29,9 @@ grib_option grib_options[]={
|
|||
{"q",0,0,1,0,0}
|
||||
};
|
||||
|
||||
char* grib_tool_description="Dump the content of a grib file in debug mode.";
|
||||
char* grib_tool_name="grib_debug";
|
||||
char* grib_tool_usage="[options] grib_file grib_file ...";
|
||||
char* tool_description="Dump the content of a grib file in debug mode.";
|
||||
char* tool_name="grib_debug";
|
||||
char* tool_usage="[options] grib_file grib_file ...";
|
||||
|
||||
int grib_options_count=sizeof(grib_options)/sizeof(grib_option);
|
||||
|
||||
|
|
|
@ -29,10 +29,10 @@ grib_option grib_options[]={
|
|||
{"a",0,0,0,1,0}
|
||||
};
|
||||
|
||||
char* grib_tool_description="Lists the keys available for a type of grib (-T option) or \n"
|
||||
char* tool_description="Lists the keys available for a type of grib (-T option) or \n"
|
||||
"\tin a grib message from a file (-F option).";
|
||||
char* grib_tool_name="grib_keys";
|
||||
char* grib_tool_usage="[options]";
|
||||
char* tool_name="grib_keys";
|
||||
char* tool_usage="[options]";
|
||||
char name[1024];
|
||||
|
||||
int grib_options_count=sizeof(grib_options)/sizeof(grib_option);
|
||||
|
|
|
@ -34,9 +34,9 @@ grib_option grib_options[]={
|
|||
{"v",0,0,1,0,0}
|
||||
};
|
||||
|
||||
char* grib_tool_description="Lat lon values list for given points list. ";
|
||||
char* grib_tool_name="grib_points";
|
||||
char* grib_tool_usage="file_list_of_points grib_file grib_file ...";
|
||||
char* tool_description="Lat lon values list for given points list. ";
|
||||
char* tool_name="grib_points";
|
||||
char* tool_usage="file_list_of_points grib_file grib_file ...";
|
||||
|
||||
int grib_options_count=sizeof(grib_options)/sizeof(grib_option);
|
||||
double lat=0;
|
||||
|
@ -79,7 +79,7 @@ int grib_tool_init(grib_runtime_options* options) {
|
|||
} else if (*end1 == '1') {
|
||||
options->latlon_mode=1;
|
||||
} else {
|
||||
printf("ERROR %s: wrong mode given in option -l\n",grib_tool_name);
|
||||
printf("ERROR %s: wrong mode given in option -l\n",tool_name);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,14 +165,14 @@ static int global_counter = 0;
|
|||
static int theStart = -1;
|
||||
static int theEnd = -1;
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Compare GRIB messages contained in two files."
|
||||
"\n\tIf some differences are found it fails returning an error code."
|
||||
"\n\tFloating-point values are compared exactly by default, different tolerance can be defined see -P -A -R."
|
||||
"\n\tDefault behaviour: absolute error=0, bit-by-bit compare, same order in files.";
|
||||
|
||||
const char* grib_tool_name = "grib_compare";
|
||||
const char* grib_tool_usage = "[options] grib_file1 grib_file2";
|
||||
const char* tool_name = "grib_compare";
|
||||
const char* tool_usage = "[options] grib_file1 grib_file2";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -319,7 +319,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
if (grib_options_on("R:")) {
|
||||
char* sarg = grib_options_get_option("R:");
|
||||
options->tolerance_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||
ret = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT) {
|
||||
usage();
|
||||
exit(1);
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Copies the content of GRIB files printing"
|
||||
" values of some keys."
|
||||
"\n\tIf the name of the output_grib_file contains a key enclosed in square brackets, its value will be used.";
|
||||
const char* grib_tool_name = "grib_copy";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ... output_grib_file";
|
||||
const char* tool_name = "grib_copy";
|
||||
const char* tool_usage = "[options] grib_file grib_file ... output_grib_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
@ -94,7 +94,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
/* if (options->outfile->file)
|
||||
|
|
|
@ -39,9 +39,9 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a GRIB file in different formats.";
|
||||
const char* grib_tool_name = "grib_dump";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_description = "Dump the content of a GRIB file in different formats.";
|
||||
const char* tool_name = "grib_dump";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
static int json = 0;
|
||||
static int first_handle = 1;
|
||||
static int dump_keys = 0;
|
||||
|
@ -69,7 +69,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->dump_mode = "default";
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous j/O/D options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous j/O/D options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -129,35 +129,34 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
|
|||
if (json)
|
||||
return 0;
|
||||
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
Assert(file);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
|
||||
sprintf(tmp, "FILE: %s ", options->current_infile->name);
|
||||
if (!grib_options_on("C"))
|
||||
fprintf(stdout, "***** %s\n", tmp);
|
||||
|
||||
/*
|
||||
* In debug dump mode, allow dumping of GRIB index files
|
||||
* Dumping of index files
|
||||
*/
|
||||
if (strcmp(options->dump_mode, "debug") == 0) {
|
||||
if (is_grib_index_file(options->current_infile->name)) {
|
||||
int err = 0;
|
||||
grib_context* c = grib_context_get_default();
|
||||
const char* filename = options->current_infile->name;
|
||||
if (is_index_file(options->current_infile->name)) {
|
||||
int err = 0;
|
||||
grib_context* c = grib_context_get_default();
|
||||
const char* filename = options->current_infile->name;
|
||||
|
||||
err = grib_index_dump_file(stdout, filename);
|
||||
if (err) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "%s: Could not dump index file \"%s\".\n%s\n",
|
||||
grib_tool_name,
|
||||
filename,
|
||||
grib_get_error_message(err));
|
||||
exit(1);
|
||||
}
|
||||
/* Since there are no GRIB messages, we have to stop tool exiting in case there
|
||||
* are more index files
|
||||
*/
|
||||
options->fail = 0;
|
||||
err = grib_index_dump_file(stdout, filename);
|
||||
if (err) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "%s: Could not dump index file \"%s\".\n%s\n",
|
||||
tool_name,
|
||||
filename,
|
||||
grib_get_error_message(err));
|
||||
exit(1);
|
||||
}
|
||||
/* Since there are no GRIB messages, we have to stop tool exiting in case there
|
||||
* are more index files */
|
||||
options->fail = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each GRIB "
|
||||
"message\n\tin the GRIB files provided as arguments.\n\t"
|
||||
"If you specify '-' (a single dash) for the rules_file, the rules will be read from standard input.";
|
||||
const char* grib_tool_name = "grib_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "grib_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"grib_file grib_file ...";
|
||||
|
||||
|
@ -51,7 +51,9 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
{
|
||||
options->action = grib_action_from_filter(options->infile_extra->name);
|
||||
if (!options->action) {
|
||||
fprintf(stderr, "%s: error unable to create action\n", options->infile_extra->name);
|
||||
const char* filt = options->infile_extra->name;
|
||||
if (strcmp(filt, "-")==0) filt = "stdin";
|
||||
fprintf(stderr, "Error: %s: unable to create action\n", filt);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -68,7 +70,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -105,7 +107,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,12 +35,12 @@ grib_option grib_options[] = {
|
|||
{ "i:", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some keys from a GRIB file."
|
||||
"\n\tIt is similar to grib_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "grib_get";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_name = "grib_get";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
static double lat = 0;
|
||||
|
@ -75,7 +75,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
if (options->latlon) {
|
||||
lat = strtod(options->latlon, &theEnd);
|
||||
if (*theEnd != ',') {
|
||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n",grib_tool_name);
|
||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n",tool_name);
|
||||
exit(1);
|
||||
}
|
||||
lon = strtod(++theEnd, &end1);
|
||||
|
@ -95,7 +95,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->latlon_mode = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", grib_tool_name);
|
||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
if (nearest)
|
||||
grib_nearest_delete(nearest);
|
||||
nearest = NULL;
|
||||
|
|
|
@ -39,11 +39,11 @@ grib_option grib_options[] = {
|
|||
{ "V", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Print a latitude, longitude, data values list.\n"
|
||||
"\tNote: Rotated grids are first unrotated";
|
||||
const char* grib_tool_name = "grib_get_data";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_name = "grib_get_data";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
|
||||
extern FILE* dump_file;
|
||||
|
||||
|
@ -71,7 +71,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ grib_option grib_options[] = {
|
|||
};
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
const char* grib_tool_description = "Histogram of GRIB files";
|
||||
const char* grib_tool_name = "grib_histogram";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_description = "Histogram of GRIB files";
|
||||
const char* tool_name = "grib_histogram";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description = "Build an index file for a set of input GRIB files.";
|
||||
const char* grib_tool_name = "grib_index_build";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ... ";
|
||||
const char* tool_description = "Build an index file for a set of input GRIB files.";
|
||||
const char* tool_name = "grib_index_build";
|
||||
const char* tool_usage = "[options] grib_file grib_file ... ";
|
||||
static grib_index* idx = NULL;
|
||||
static char* keys;
|
||||
static char* default_keys = "mars";
|
||||
|
@ -83,7 +83,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
int grib_tool_new_filename_action(grib_runtime_options* options, const char* file)
|
||||
{
|
||||
int ret = 0;
|
||||
printf("--- %s: processing %s\n", grib_tool_name, file);
|
||||
printf("--- %s: processing %s\n", tool_name, file);
|
||||
ret = grib_index_add_file(idx, file);
|
||||
if (ret) {
|
||||
printf("error: %s\n", grib_get_error_message(ret));
|
||||
|
@ -121,7 +121,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
grib_index_compress(idx);
|
||||
}
|
||||
printf("--- %s: keys included in the index file %s:\n",
|
||||
grib_tool_name, options->outfile->name);
|
||||
tool_name, options->outfile->name);
|
||||
printf("--- ");
|
||||
first = 1;
|
||||
the_keys = idx->keys;
|
||||
|
|
|
@ -42,11 +42,11 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of GRIB files printing values of "
|
||||
"some keys.\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "grib_ls";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_name = "grib_ls";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
static char* new_handle = "";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
@ -100,7 +100,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
if (options->latlon) {
|
||||
lat = strtod(options->latlon, &theEnd);
|
||||
if (*theEnd != ',') {
|
||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n",grib_tool_name);
|
||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n",tool_name);
|
||||
exit(1);
|
||||
}
|
||||
lon = strtod(++theEnd, &end1);
|
||||
|
@ -120,7 +120,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->latlon_mode = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", grib_tool_name);
|
||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
if (nearest)
|
||||
grib_nearest_delete(nearest);
|
||||
nearest = NULL;
|
||||
|
|
|
@ -34,9 +34,9 @@ int key_values_size = MAX_KEY_VALUES;
|
|||
* tool to identify the fields to be merged */
|
||||
static const char* md5Key = "md5Product";
|
||||
|
||||
const char* grib_tool_description = "Merge two fields with identical parameters and different geographical area";
|
||||
const char* grib_tool_name = "grib_merge";
|
||||
const char* grib_tool_usage = "[options] file file ... output_file";
|
||||
const char* tool_description = "Merge two fields with identical parameters and different geographical area";
|
||||
const char* tool_name = "grib_merge";
|
||||
const char* tool_usage = "[options] file file ... output_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
@ -318,6 +318,16 @@ static grib_handle* merge(grib_handle* h1, grib_handle* h2)
|
|||
|
||||
grib_set_double_array(h, "values", v, n);
|
||||
|
||||
grib_context_free(h->context, v);
|
||||
grib_context_free(h->context, v1);
|
||||
grib_context_free(h->context, v2);
|
||||
grib_context_free(h->context, lat);
|
||||
grib_context_free(h->context, lat1);
|
||||
grib_context_free(h->context, lat2);
|
||||
grib_context_free(h->context, lon);
|
||||
grib_context_free(h->context, lon1);
|
||||
grib_context_free(h->context, lon2);
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,9 +118,9 @@ static int grib_options_help_count = sizeof(grib_options_help_list) / sizeof(gri
|
|||
void usage(void)
|
||||
{
|
||||
int i = 0;
|
||||
printf("\nNAME \t%s\n\n", grib_tool_name);
|
||||
printf("DESCRIPTION\n\t%s\n\n", grib_tool_description);
|
||||
printf("USAGE \n\t%s %s\n\n", grib_tool_name, grib_tool_usage);
|
||||
printf("\nNAME \t%s\n\n", tool_name);
|
||||
printf("DESCRIPTION\n\t%s\n\n", tool_description);
|
||||
printf("USAGE \n\t%s %s\n\n", tool_name, tool_usage);
|
||||
printf("OPTIONS\n");
|
||||
for (i = 0; i < grib_options_count; i++) {
|
||||
if (grib_options[i].command_line)
|
||||
|
@ -333,7 +333,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
}
|
||||
|
||||
options->requested_print_keys_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, karg, 0, GRIB_TYPE_UNDEFINED,
|
||||
ret = parse_keyval_string(tool_name, karg, 0, GRIB_TYPE_UNDEFINED,
|
||||
options->requested_print_keys, &(options->requested_print_keys_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
|
@ -360,7 +360,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
if (grib_options_on("s:")) {
|
||||
sarg = grib_options_get_option("s:");
|
||||
options->set_values_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, sarg, 1, GRIB_TYPE_UNDEFINED, options->set_values, &(options->set_values_count));
|
||||
ret = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_UNDEFINED, options->set_values, &(options->set_values_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
if (grib_options_on("b:")) {
|
||||
barg = grib_options_get_option("b:");
|
||||
options->set_values_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, barg, 0, GRIB_TYPE_STRING, options->set_values, &(options->set_values_count));
|
||||
ret = parse_keyval_string(tool_name, barg, 0, GRIB_TYPE_STRING, options->set_values, &(options->set_values_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
if (grib_options_on("c:")) {
|
||||
sarg = grib_options_get_option("c:");
|
||||
options->compare_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, sarg, 0, GRIB_TYPE_UNDEFINED, options->compare,
|
||||
ret = parse_keyval_string(tool_name, sarg, 0, GRIB_TYPE_UNDEFINED, options->compare,
|
||||
&(options->compare_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
|
@ -392,7 +392,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
warg = grib_options_get_option("w:");
|
||||
|
||||
options->constraints_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, warg, 1, GRIB_TYPE_UNDEFINED,
|
||||
ret = parse_keyval_string(tool_name, warg, 1, GRIB_TYPE_UNDEFINED,
|
||||
options->constraints, &(options->constraints_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
|
@ -458,9 +458,9 @@ char* grib_options_get_args(char* id)
|
|||
void usage_doxygen(void)
|
||||
{
|
||||
int i = 0;
|
||||
printf("/*! \\page %s %s\n", grib_tool_name, grib_tool_name);
|
||||
printf("\\section DESCRIPTION \n %s\n\n", grib_tool_description);
|
||||
printf("\\section USAGE \n %s \n %s\n\n", grib_tool_name, grib_tool_usage);
|
||||
printf("/*! \\page %s %s\n", tool_name, tool_name);
|
||||
printf("\\section DESCRIPTION \n %s\n\n", tool_description);
|
||||
printf("\\section USAGE \n %s \n %s\n\n", tool_name, tool_usage);
|
||||
printf("\\section OPTIONS \n");
|
||||
for (i = 0; i < grib_options_count; i++) {
|
||||
if (grib_options[i].command_line) {
|
||||
|
@ -477,9 +477,9 @@ void usage_doxygen(void)
|
|||
#if 0
|
||||
void usage_doxygen(void) {
|
||||
int i=0;
|
||||
printf("/*! \\page %s %s\n",grib_tool_name,grib_tool_name);
|
||||
printf("\\section DESCRIPTION \n%s\n\n",grib_tool_description);
|
||||
printf("\\section USAGE \n%s \n%s\n\n",grib_tool_name,grib_tool_usage);
|
||||
printf("/*! \\page %s %s\n",tool_name,tool_name);
|
||||
printf("\\section DESCRIPTION \n%s\n\n",tool_description);
|
||||
printf("\\section USAGE \n%s \n%s\n\n",tool_name,tool_usage);
|
||||
printf("\\section OPTIONS\n");
|
||||
printf("<table frame=void border=0>\n");
|
||||
for (i=0;i<grib_options_count;i++) {
|
||||
|
|
|
@ -46,12 +46,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Sets key/value pairs in the input GRIB file and writes"
|
||||
"\n\teach message to the output_grib_file."
|
||||
"\n\tIt fails when an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "grib_set";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ... output_grib_file";
|
||||
const char* tool_name = "grib_set";
|
||||
const char* tool_usage = "[options] grib_file grib_file ... output_grib_file";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -169,7 +169,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Convert a GRIB file to netCDF format."
|
||||
"\n\tNote: The GRIB geometry should be a regular lat/lon grid or a regular Gaussian grid"
|
||||
"\n\t(the key \"typeOfGrid\" should be \"regular_ll\" or \"regular_gg\")";
|
||||
const char* grib_tool_name = "grib_to_netcdf";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ... ";
|
||||
const char* tool_name = "grib_to_netcdf";
|
||||
const char* tool_usage = "[options] grib_file grib_file ... ";
|
||||
static char argvString[2048] = {0,};
|
||||
|
||||
/*=====================================================================*/
|
||||
|
@ -2143,9 +2143,9 @@ static nc_type translate_nctype(const char* name)
|
|||
static void check_err(const char* function, const int stat, const int line)
|
||||
{
|
||||
if (stat != NC_NOERR) {
|
||||
/* (void) fprintf(stderr, "line %d of %s: %s\n", line, grib_tool_name, nc_strerror(stat)); */
|
||||
/* (void) fprintf(stderr, "line %d of %s: %s\n", line, tool_name, nc_strerror(stat)); */
|
||||
(void)fprintf(stderr, "\n%s ERROR: line %d, %s: %s\n",
|
||||
grib_tool_name, line, function, nc_strerror(stat));
|
||||
tool_name, line, function, nc_strerror(stat));
|
||||
if (stat == NC_EVARSIZE) {
|
||||
(void)fprintf(stderr,
|
||||
"\nCannot create netCDF classic format, dataset is too large!\n"
|
||||
|
@ -3062,7 +3062,7 @@ static int define_netcdf_dimensions(hypercube* h, fieldset* fs, int ncid, datase
|
|||
dims[i] = n - i - 1;
|
||||
|
||||
for (i = 0; i < subsetcnt; ++i) {
|
||||
printf("%s: Defining variable '%s'.\n", grib_tool_name, subsets[i].att.name);
|
||||
printf("%s: Defining variable '%s'.\n", tool_name, subsets[i].att.name);
|
||||
|
||||
stat = nc_def_var(ncid, subsets[i].att.name, subsets[i].att.nctype, n, dims, &var_id);
|
||||
check_err("nc_def_var", stat, __LINE__);
|
||||
|
@ -3351,7 +3351,7 @@ static void print_ignored_keys(FILE* f, request* data)
|
|||
int i = 0;
|
||||
while ((ignore = get_value(data, "ignore", i)) != NULL) {
|
||||
if (i == 0) {
|
||||
fprintf(f, "%s: Ignoring key(s): %s", grib_tool_name, ignore);
|
||||
fprintf(f, "%s: Ignoring key(s): %s", tool_name, ignore);
|
||||
}
|
||||
else {
|
||||
fprintf(f, ", %s", ignore);
|
||||
|
@ -3861,25 +3861,25 @@ static int get_creation_mode(int option_kind)
|
|||
int creation_mode = NC_CLOBBER;
|
||||
switch (option_kind) {
|
||||
case NC_FORMAT_CLASSIC:
|
||||
printf("%s: Creating classic file format.\n", grib_tool_name);
|
||||
printf("%s: Creating classic file format.\n", tool_name);
|
||||
break;
|
||||
case NC_FORMAT_64BIT:
|
||||
creation_mode |= NC_64BIT_OFFSET;
|
||||
printf("%s: Creating large (64 bit) file format.\n", grib_tool_name);
|
||||
printf("%s: Creating large (64 bit) file format.\n", tool_name);
|
||||
break;
|
||||
#ifdef NC_NETCDF4
|
||||
case NC_FORMAT_NETCDF4:
|
||||
creation_mode |= NC_NETCDF4;
|
||||
printf("%s: Creating netCDF-4/HDF5 format.\n", grib_tool_name);
|
||||
printf("%s: Creating netCDF-4/HDF5 format.\n", tool_name);
|
||||
break;
|
||||
case NC_FORMAT_NETCDF4_CLASSIC:
|
||||
creation_mode |= NC_NETCDF4 | NC_CLASSIC_MODEL;
|
||||
printf("%s: Creating netCDF-4 classic model file format.\n", grib_tool_name);
|
||||
printf("%s: Creating netCDF-4 classic model file format.\n", tool_name);
|
||||
break;
|
||||
#else
|
||||
case NC_FORMAT_NETCDF4:
|
||||
case NC_FORMAT_NETCDF4_CLASSIC:
|
||||
grib_context_log(ctx, GRIB_LOG_ERROR, "%s not built with netcdf4, cannot create netCDF-4 files.", grib_tool_name);
|
||||
grib_context_log(ctx, GRIB_LOG_ERROR, "%s not built with netcdf4, cannot create netCDF-4 files.", tool_name);
|
||||
exit(1);
|
||||
break;
|
||||
#endif
|
||||
|
@ -3993,7 +3993,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
data_r = empty_request(0);
|
||||
user_r = empty_request(0);
|
||||
|
||||
printf("%s: Version ", grib_tool_name);
|
||||
printf("%s: Version ", tool_name);
|
||||
grib_print_api_version(stdout);
|
||||
printf("\n");
|
||||
|
||||
|
@ -4128,7 +4128,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
grib_handle* h = NULL;
|
||||
grib_file* file = NULL;
|
||||
|
||||
printf("%s: Processing input file '%s'.\n", grib_tool_name, filename);
|
||||
printf("%s: Processing input file '%s'.\n", tool_name, filename);
|
||||
|
||||
file = grib_file_open(filename, "r", &e);
|
||||
if (!file || !file->handle)
|
||||
|
@ -4280,7 +4280,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
return -1;
|
||||
}
|
||||
|
||||
printf("%s: Found %d GRIB field%s in %d file%s.\n", grib_tool_name, fs->count, fs->count > 1 ? "s" : "", files, files > 1 ? "s" : "");
|
||||
printf("%s: Found %d GRIB field%s in %d file%s.\n", tool_name, fs->count, fs->count > 1 ? "s" : "", files, files > 1 ? "s" : "");
|
||||
|
||||
if (ctx->debug) {
|
||||
grib_context_log(ctx, GRIB_LOG_INFO, "Request representing %d fields ", fs->count);
|
||||
|
@ -4304,8 +4304,8 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
|
||||
/* Create netcdf file */
|
||||
|
||||
printf("%s: Creating netCDF file '%s'\n", grib_tool_name, options->outfile->name);
|
||||
printf("%s: NetCDF library version: %s\n", grib_tool_name, nc_inq_libvers());
|
||||
printf("%s: Creating netCDF file '%s'\n", tool_name, options->outfile->name);
|
||||
printf("%s: NetCDF library version: %s\n", tool_name, nc_inq_libvers());
|
||||
|
||||
creation_mode = get_creation_mode(option_kind);
|
||||
stat = nc_create(options->outfile->name, creation_mode, &ncid);
|
||||
|
@ -4354,7 +4354,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
free_subsets(subsets, count);
|
||||
|
||||
free_nc_options();
|
||||
printf("%s: Done.\n", grib_tool_name);
|
||||
printf("%s: Done.\n", tool_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -180,8 +180,8 @@ int grib_tool(int argc, char** argv)
|
|||
|
||||
/* ECC-926: Currently only GRIB indexing works. Disable the through_index if BUFR, GTS etc */
|
||||
if (global_options.mode == MODE_GRIB &&
|
||||
is_grib_index_file(global_options.infile->name) &&
|
||||
(global_options.infile_extra && is_grib_index_file(global_options.infile_extra->name))) {
|
||||
is_index_file(global_options.infile->name) &&
|
||||
(global_options.infile_extra && is_index_file(global_options.infile_extra->name))) {
|
||||
global_options.through_index = 1;
|
||||
return grib_tool_index(&global_options);
|
||||
}
|
||||
|
@ -1352,10 +1352,10 @@ void grib_tools_write_message(grib_runtime_options* options, grib_handle* h)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
int exit_if_input_is_directory(const char* tool_name, const char* filename)
|
||||
int exit_if_input_is_directory(const char* toolname, const char* filename)
|
||||
{
|
||||
if (path_is_directory(filename)) {
|
||||
fprintf(stderr, "%s: ERROR: \"%s\": Is a directory\n", tool_name, filename);
|
||||
fprintf(stderr, "%s: ERROR: \"%s\": Is a directory\n", toolname, filename);
|
||||
exit(1);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -174,9 +174,9 @@ typedef struct grib_runtime_options
|
|||
|
||||
extern grib_option grib_options[];
|
||||
extern int grib_options_count;
|
||||
extern const char* grib_tool_name;
|
||||
extern const char* grib_tool_description;
|
||||
extern const char* grib_tool_usage;
|
||||
extern const char* tool_name;
|
||||
extern const char* tool_description;
|
||||
extern const char* tool_usage;
|
||||
|
||||
extern FILE* dump_file;
|
||||
|
||||
|
@ -206,6 +206,6 @@ int grib_process_runtime_options(grib_context* c, int argc, char** argv, grib_ru
|
|||
void grib_tools_write_message(grib_runtime_options* options, grib_handle* h);
|
||||
int grib_tool_new_filename_action(grib_runtime_options* options, const char* file);
|
||||
int grib_no_handle_action(grib_runtime_options* options, int err);
|
||||
int exit_if_input_is_directory(const char* tool_name, const char* filename);
|
||||
int exit_if_input_is_directory(const char* toolname, const char* filename);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -131,13 +131,13 @@ int counter = 0;
|
|||
int start = -1;
|
||||
int end = -1;
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Compare GTS messages contained in two files."
|
||||
"\n\tIf some differences are found it fails returning an error code."
|
||||
"\n\tDefault behaviour: bit-by-bit compare, same order in files.";
|
||||
|
||||
const char* grib_tool_name = "gts_compare";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "gts_compare";
|
||||
const char* tool_usage =
|
||||
"[options] "
|
||||
"file file";
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Copies the content of GTS files printing"
|
||||
" values of some keys.";
|
||||
const char* grib_tool_name = "gts_copy";
|
||||
const char* grib_tool_usage = "[options] file file ... output_file";
|
||||
const char* tool_name = "gts_copy";
|
||||
const char* tool_usage = "[options] file file ... output_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
|
|
@ -33,9 +33,9 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a GTS file in different formats.";
|
||||
const char* grib_tool_name = "gts_dump";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_description = "Dump the content of a GTS file in different formats.";
|
||||
const char* tool_name = "gts_dump";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -62,7 +62,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous O/D options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous O/D options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each GTS "
|
||||
"message\n\tin the GTS files provided as arguments.\n\t"
|
||||
"If you specify '-' (a single dash) for the rules_file, the rules will be read from standard input.";
|
||||
const char* grib_tool_name = "gts_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "gts_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"file file ...";
|
||||
int fail = 0;
|
||||
|
|
|
@ -28,12 +28,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some keys from a GTS file."
|
||||
"\n\tIt is similar to gts_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "gts_get";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "gts_get";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
int mode = 0;
|
||||
|
|
|
@ -32,11 +32,11 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of GTS files printing values of "
|
||||
"some keys.\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "gts_ls";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "gts_ls";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
int mode = 0;
|
||||
|
|
|
@ -194,14 +194,14 @@ int global_counter = 0;
|
|||
int start = -1;
|
||||
int end = -1;
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Compare METAR messages contained in two files."
|
||||
"\n\tIf some differences are found it fails returning an error code."
|
||||
"\n\tFloating-point values are compared exactly by default, different tolerance can be defined see -P -A -R."
|
||||
"\n\tDefault behaviour: absolute error=0, bit-by-bit compare, same order in files.";
|
||||
|
||||
const char* grib_tool_name = "metar_compare";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "metar_compare";
|
||||
const char* tool_usage =
|
||||
"[options] "
|
||||
"file file";
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Copies the content of METAR files printing"
|
||||
" values of some keys.";
|
||||
const char* grib_tool_name = "metar_copy";
|
||||
const char* grib_tool_usage = "[options] file file ... output_file";
|
||||
const char* tool_name = "metar_copy";
|
||||
const char* tool_usage = "[options] file file ... output_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
|
|
@ -36,9 +36,9 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a METAR file in different formats.";
|
||||
const char* grib_tool_name = "metar_dump";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_description = "Dump the content of a METAR file in different formats.";
|
||||
const char* tool_name = "metar_dump";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -59,7 +59,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->dump_mode = "default";
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous O/D options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous O/D options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each METAR "
|
||||
"message\n\tin the files provided as arguments.";
|
||||
const char* grib_tool_name = "metar_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "metar_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"file file ...";
|
||||
int fail = 0;
|
||||
|
|
|
@ -29,12 +29,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some keys from a METAR file."
|
||||
"\n\tIt is similar to metar_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "metar_get";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "metar_get";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
double lat = 0;
|
||||
|
|
|
@ -44,11 +44,11 @@ grib_option grib_options[] = {
|
|||
/*{"x",0,0,0,1,0}*/
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of METAR files printing values of "
|
||||
"some keys.\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "metar_ls";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "metar_ls";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
double lat = 0;
|
||||
|
|
|
@ -29,9 +29,9 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a TAF file in different formats.";
|
||||
const char* grib_tool_name = "taf_dump";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_description = "Dump the content of a TAF file in different formats.";
|
||||
const char* tool_name = "taf_dump";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -53,7 +53,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous C/O/D options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous C/O/D options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each TAF "
|
||||
"message\n\tin the files provided as arguments.";
|
||||
const char* grib_tool_name = "taf_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "taf_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"file file ...";
|
||||
int fail = 0;
|
||||
|
|
|
@ -33,12 +33,12 @@ grib_option grib_options[] = {
|
|||
{ "i:", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some keys from a TAF file."
|
||||
"\n\tIt is similar to taf_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "taf_get";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "taf_get";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
int mode = 0;
|
||||
|
|
|
@ -37,11 +37,11 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of TAF files printing values of "
|
||||
"some keys.\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "taf_ls";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "taf_ls";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
double lat = 0;
|
||||
|
|
Loading…
Reference in New Issue