mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' into feature/FireInMars
This commit is contained in:
commit
7c73868638
|
@ -2,7 +2,7 @@
|
|||
# general configuration #
|
||||
#---------------------------------#
|
||||
|
||||
version: 2.25.0-{build}-{branch}
|
||||
version: latest-{build}-{branch}
|
||||
|
||||
branches:
|
||||
only:
|
||||
|
|
|
@ -21,7 +21,7 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR )
|
|||
find_package( ecbuild 3.4 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild)
|
||||
|
||||
# Initialise project
|
||||
project( eccodes VERSION 2.25.0 LANGUAGES C )
|
||||
project( eccodes VERSION 2.26.0 LANGUAGES C )
|
||||
|
||||
###############################################################################
|
||||
# system checks needed for eccodes_config.h and some options like MEMFS
|
||||
|
@ -116,7 +116,10 @@ ecbuild_add_option( FEATURE NETCDF
|
|||
|
||||
find_package( AEC )
|
||||
if(NOT DEFINED ENABLE_AEC AND NOT AEC_FOUND)
|
||||
ecbuild_critical("AEC (Adaptive Entropy Coding) support is highly recommended from ecCodes >= 2.25.0\nTo force the build without it, use -DENABLE_AEC=OFF")
|
||||
ecbuild_critical("AEC library was not found.\n"
|
||||
"AEC (Adaptive Entropy Coding) provides the WMO GRIB CCSDS compression and decompression of data. "
|
||||
"This is highly recommended from ecCodes >= 2.25.0"
|
||||
"\nTo force the build without it, use -DENABLE_AEC=OFF")
|
||||
endif()
|
||||
ecbuild_add_option( FEATURE AEC
|
||||
DESCRIPTION "Support for Adaptive Entropy Coding"
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
# LIBAEC_PATH
|
||||
# libaec_PATH
|
||||
|
||||
find_path( AEC_INCLUDE_DIR szlib.h
|
||||
find_path( AEC_INCLUDE_DIR libaec.h
|
||||
PATHS ${AEC_DIR} ${AEC_PATH} ${LIBAEC_DIR} ${libaec_DIR} ${LIBAEC_PATH} ${libaec_PATH} ENV AEC_DIR ENV AEC_PATH ENV LIBAEC_DIR ENV libaec_DIR ENV LIBAEC_PATH ENV libaec_PATH
|
||||
PATH_SUFFIXES include include/aec NO_DEFAULT_PATH )
|
||||
find_path( AEC_INCLUDE_DIR szlib.h PATH_SUFFIXES include include/aec )
|
||||
find_path( AEC_INCLUDE_DIR libaec.h PATH_SUFFIXES include include/aec )
|
||||
|
||||
find_library( AEC_LIBRARY NAMES aec
|
||||
PATHS ${AEC_DIR} ${AEC_PATH} ${LIBAEC_DIR} ${libaec_DIR} ${LIBAEC_PATH} ${libaec_PATH} ENV AEC_DIR ENV AEC_PATH ENV LIBAEC_DIR ENV libaec_DIR ENV LIBAEC_PATH ENV libaec_PATH
|
||||
|
|
|
@ -10,9 +10,10 @@ add_subdirectory(gts)
|
|||
file(READ "grib_data_files.txt" files_to_download)
|
||||
string(REGEX REPLACE "\n" ";" files_to_download "${files_to_download}")
|
||||
|
||||
# Download the CCSDS file even if HAVE_AEC feature is disabled.
|
||||
# Download the CCSDS files even if HAVE_AEC feature is disabled.
|
||||
# This is for testing (See ECC-1352)
|
||||
list(APPEND files_to_download ccsds.grib2)
|
||||
list(APPEND files_to_download ccsds_szip.grib2) # See ECC-1362
|
||||
|
||||
|
||||
if( ENABLE_EXTRA_TESTS )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
##
|
||||
## author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
## author: Sebastien Villaume
|
||||
## created: 6 Oct 2011
|
||||
## modified: 13 May 2013
|
||||
##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
##
|
||||
## author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
## author: Sebastien Villaume
|
||||
## created: 6 Oct 2011
|
||||
## modified: 13 May 2013
|
||||
##
|
||||
|
|
|
@ -49,7 +49,7 @@ if(bitmapPresent) {
|
|||
|
||||
): read_only;
|
||||
alias data.packedValues = codedValues;
|
||||
|
||||
|
||||
if (boustrophedonicOrdering)
|
||||
{
|
||||
if (GRIBEX_boustrophedonic)
|
||||
|
|
|
@ -49,7 +49,7 @@ if(bitmapPresent) {
|
|||
|
||||
): read_only;
|
||||
alias data.packedValues = codedValues;
|
||||
|
||||
|
||||
if (boustrophedonicOrdering)
|
||||
{
|
||||
if (GRIBEX_boustrophedonic)
|
||||
|
|
|
@ -61,7 +61,7 @@ if(matrixOfValues == 0)
|
|||
# For grib1 -> grib2
|
||||
constant bitMapIndicator = 0;
|
||||
|
||||
meta codedValues data_g1simple_packing (
|
||||
meta codedValues data_g1simple_packing(
|
||||
section4Length,
|
||||
offsetBeforeData,
|
||||
offsetSection4,
|
||||
|
|
|
@ -93,7 +93,7 @@ constant PUnset = -32767;
|
|||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
|
||||
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM
|
||||
|
@ -122,7 +122,7 @@ constant PUnset = -32767;
|
|||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
|
||||
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM
|
||||
|
|
|
@ -89,7 +89,7 @@ constant PUnset = -32767;
|
|||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
|
||||
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM
|
||||
|
@ -118,7 +118,7 @@ constant PUnset = -32767;
|
|||
subSetJ,
|
||||
subSetK,
|
||||
subSetM,
|
||||
|
||||
|
||||
pentagonalResolutionParameterJ,
|
||||
pentagonalResolutionParameterK,
|
||||
pentagonalResolutionParameterM
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#model 52 I1 44 -
|
||||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 13 May 2013
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 20 Feb 2014
|
||||
#
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#PartDef 74 PAD n/a 7
|
||||
################################################################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 20 Feb 2014
|
||||
#
|
||||
|
|
|
@ -112,7 +112,7 @@ if(localFlag == 3)
|
|||
alias system = systemNumber;
|
||||
alias method = methodNumber;
|
||||
alias refdate = referenceDate;
|
||||
|
||||
|
||||
alias mars._leg_number = legNumber;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ if(localFlag == 4)
|
|||
alias baseTimeOfThisLeg = legBaseTime;
|
||||
unsigned[1] legNumber : dump;
|
||||
unsigned[1] oceanAtmosphereCoupling : dump;
|
||||
|
||||
|
||||
# Hours
|
||||
unsigned[2] offsetToEndOf4DvarWindow : dump;
|
||||
alias anoffset=offsetToEndOf4DvarWindow;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 13 May 2013
|
||||
#
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 13 May 2013
|
||||
# modified:
|
||||
#
|
||||
#########################
|
||||
"none"={matchAerosolBinNumber=0;}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
##
|
||||
## author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
## author: Sebastien Villaume
|
||||
## created: 6 Oct 2011
|
||||
## modified: 13 May 2013
|
||||
##
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 13 May 2013
|
||||
# modified:
|
||||
#
|
||||
#########################
|
||||
"all"={matchLandType=0;}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
##
|
||||
## author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
## author: Sebastien Villaume
|
||||
## created: 6 Oct 2011
|
||||
## modified: 13 May 2013
|
||||
##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
##
|
||||
## author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
## author: Sebastien Villaume
|
||||
## created: 6 Oct 2011
|
||||
## modified: 13 May 2013
|
||||
##
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 13 May 2013
|
||||
# modified:
|
||||
#
|
||||
#########################
|
||||
"none"={matchSort=0;}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 13 May 2013
|
||||
# modified:
|
||||
#
|
||||
#########################
|
||||
"none"={matchTimeRepres=0;}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
##
|
||||
## author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
## author: Sebastien Villaume
|
||||
## created: 6 Oct 2011
|
||||
## modified: 13 May 2013
|
||||
##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 13 May 2013
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 13 May 2013
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 13 Sep 2013
|
||||
#
|
||||
|
|
|
@ -1,50 +1,33 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume (SMHI)
|
||||
# created: 6 Oct 2011
|
||||
# modified: 13 Sep 2013
|
||||
#
|
||||
#########################
|
||||
|
||||
constant conceptsMasterMarsDir="mars" : hidden;
|
||||
constant conceptsLocalMarsDirAll="mars/[centre:s]" : hidden;
|
||||
|
||||
# Base MARS keywors
|
||||
##########################
|
||||
# #
|
||||
# Base MARS keywors #
|
||||
# #
|
||||
##########################
|
||||
|
||||
alias mars.class = marsClass;
|
||||
alias mars.type = marsType;
|
||||
alias mars.stream = marsStream;
|
||||
alias mars.model = marsModel;
|
||||
alias mars.expver = experimentVersionNumber;
|
||||
alias mars.domain = globalDomain;
|
||||
alias mars.class = marsClass;
|
||||
alias mars.type = marsType;
|
||||
alias mars.stream = marsStream;
|
||||
alias mars.model = marsModel;
|
||||
alias mars.expver = experimentVersionNumber;
|
||||
alias mars.domain = globalDomain;
|
||||
|
||||
# local section 82
|
||||
#########################
|
||||
# #
|
||||
# local section 82 #
|
||||
# #
|
||||
#########################
|
||||
|
||||
### nothing needed here...
|
||||
|
||||
# Local section 83
|
||||
#########################
|
||||
# #
|
||||
# local section 83 #
|
||||
# #
|
||||
#########################
|
||||
|
||||
if ( localDefinitionNumber == 83 ) {
|
||||
|
||||
alias mars.sort = matchSort;
|
||||
alias mars.timerepres = matchTimeRepres;
|
||||
alias mars.landtype = matchLandType;
|
||||
alias mars.aerosolbinnumber = matchAerosolBinNumber;
|
||||
alias mars.sort = matchSort;
|
||||
alias mars.timerepres = matchTimeRepres;
|
||||
alias mars.landtype = matchLandType;
|
||||
alias mars.aerosolbinnumber = matchAerosolBinNumber;
|
||||
|
||||
concept_nofail matchAerosolPacking (unknown,"aerosolPackingConcept.def",conceptsLocalMarsDirAll,conceptsMasterMarsDir);
|
||||
alias mars.aerosolpacking = matchAerosolPacking;
|
||||
|
||||
alias mars.aerosolpacking = matchAerosolPacking;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ alias levelType=indicatorOfTypeOfLevel;
|
|||
|
||||
transient pressureUnits="hPa";
|
||||
|
||||
concept_nofail typeOfLevelECMF (unknown, "typeOfLevel.def",conceptsMasterDir,conceptsLocalDirECMF);
|
||||
concept_nofail typeOfLevelECMF (unknown, "typeOfLevel.def",conceptsMasterDir,conceptsLocalDirECMF);
|
||||
concept_nofail vertical.typeOfLevel (typeOfLevelECMF, "typeOfLevel.def",conceptsDir2,conceptsDir1);
|
||||
|
||||
when ( typeOfLevel is "isobaricInPa" ) { set pressureUnits="Pa"; }
|
||||
|
@ -129,7 +129,7 @@ unsigned[1] P1 : edition_specific;
|
|||
unsigned[1] P2 : edition_specific;
|
||||
|
||||
# Local comes before Master to give precedence to the local, centre-specific table
|
||||
codetable[1] timeRangeIndicator ('5.table',tablesLocalDir,tablesMasterDir) = 1 : dump,edition_specific;
|
||||
codetable[1] timeRangeIndicator ('5.table',tablesLocalDir,tablesMasterDir) = 1 : dump,edition_specific;
|
||||
|
||||
unsigned[2] numberIncludedInAverage;
|
||||
|
||||
|
@ -255,7 +255,7 @@ if(((section1Length > 40) or new() or setLocalDefinition> 0) and deleteLocalDefi
|
|||
{
|
||||
constant localUsePresent = 1 : edition_specific;
|
||||
alias grib2LocalSectionPresent=present;
|
||||
|
||||
|
||||
if( (centre == ECMWF) or
|
||||
(centre != ECMWF and
|
||||
subCentre == ECMWF))
|
||||
|
@ -279,7 +279,7 @@ if(((section1Length > 40) or new() or setLocalDefinition> 0) and deleteLocalDefi
|
|||
# Other centres
|
||||
pad reservedNeedNotBePresent(12);
|
||||
template_nofail localDefinition "grib1/local.[centre:l].def";
|
||||
|
||||
|
||||
section_padding localExtensionPadding : read_only;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#################################
|
||||
### LOCAL SECTION DESCRIPTION ###
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#################################
|
||||
### LOCAL SECTION DESCRIPTION ###
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#################################################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#################################
|
||||
### LOCAL SECTION DESCRIPTION ###
|
||||
|
|
|
@ -50,3 +50,22 @@ unsigned[1] minuteOfModelVersion = 0 : dump;
|
|||
constant secondOfModelVersion = 0;
|
||||
meta dateOfModelVersion g2date(yearOfModelVersion, monthOfModelVersion, dayOfModelVersion) : dump;
|
||||
meta timeOfModelVersion time (hourOfModelVersion, minuteOfModelVersion, secondOfModelVersion) : dump;
|
||||
|
||||
# Note: the key inputOriginatingCentre is in the PDTNs 70, 71, 72 and 73
|
||||
#concept efas_forecast {
|
||||
# "griddedobs" = { inputOriginatingCentre=98; marsType = "an"; }
|
||||
# # "reanalysis" = { inputOriginatingCentre=98; marsType = "an"; }
|
||||
#
|
||||
# "hres" = { inputOriginatingCentre=98; marsType = "fc"; } # deterministic
|
||||
# "ens" = { inputOriginatingCentre=98; marsType = "pf"; } # ensemble
|
||||
# "ens" = { inputOriginatingCentre=98; marsType = "cf"; } # ensemble
|
||||
#
|
||||
# DWD rules
|
||||
# "global" = { inputOriginatingCentre=78; inputProcessIdentifier = 1; }
|
||||
# "lam" = { inputOriginatingCentre=78; inputProcessIdentifier = 2; }
|
||||
#
|
||||
# TODO: For now anything coming from cnmc (COSMO) is local area
|
||||
# "lam" = { inputOriginatingCentre=80; }
|
||||
#
|
||||
# "unknown" = { dummy = 1; }
|
||||
#} : hidden;
|
||||
|
|
|
@ -20,7 +20,7 @@ if(type != perturbedType)
|
|||
# Ritz numbers:
|
||||
signed[4] NINT_LOG10_RITZ : dump ;
|
||||
signed[4] NINT_RITZ_EXP : dump ;
|
||||
|
||||
|
||||
alias local.numberOfIterations= numberOfIterations;
|
||||
alias local.numberOfSingularVectorsComputed= numberOfSingularVectorsComputed ;
|
||||
alias local.normAtInitialTime= normAtInitialTime ;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,63 +1,63 @@
|
|||
'S' = {
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 119;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 119;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
}
|
||||
'H' = {
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 103;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 103;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
}
|
||||
'P' = {
|
||||
ZLMULT = 1.0000000e-02;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 100;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
ZLMULT = 1.0000000e-02;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 100;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
}
|
||||
'V' = {
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 109;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 109;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
}
|
||||
'T' = {
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 20;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 20;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
}
|
||||
'KT' = {
|
||||
ZLBASE = 1.5000000e-01;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 20;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
ZLBASE = 1.5000000e-01;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 20;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
}
|
||||
'KB' = {
|
||||
ZLBASE = 1.5000000e-01;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 20;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
ZLBASE = 1.5000000e-01;
|
||||
parameterCategory = 255;
|
||||
parameterNumber = 255;
|
||||
scaleFactorOfFirstFixedSurface = 0;
|
||||
scaledValueOfFirstFixedSurface = 0;
|
||||
typeOfFirstFixedSurface = 20;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
}
|
||||
'default' = {
|
||||
typeOfFirstFixedSurface = 255;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
typeOfFirstFixedSurface = 255;
|
||||
typeOfSecondFixedSurface = 255;
|
||||
}
|
||||
|
|
|
@ -8,4 +8,6 @@
|
|||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 0 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
|
|
|
@ -158,4 +158,6 @@
|
|||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 0 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
|
|
|
@ -158,4 +158,6 @@
|
|||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 0 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
|
|
|
@ -158,4 +158,6 @@
|
|||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 0 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
|
|
|
@ -158,4 +158,6 @@
|
|||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 0 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
|
|
|
@ -158,4 +158,6 @@
|
|||
typeOfSecondFixedSurface = 255 ;
|
||||
scaledValueOfFirstFixedSurface = 0 ;
|
||||
scaleFactorOfFirstFixedSurface = 0 ;
|
||||
scaledValueOfSecondFixedSurface = missing() ;
|
||||
scaleFactorOfSecondFixedSurface = missing() ;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#########################
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#########################
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"unknown" = { typeOfPostProcessing = 0; }
|
||||
# For template.4.postproc.def
|
||||
"lisflood" = { typeOfPostProcessing = 1; }
|
||||
"lisflood_eric" = { typeOfPostProcessing = 2; }
|
||||
"lisflood_season" = { typeOfPostProcessing = 3; }
|
||||
|
@ -15,4 +15,3 @@
|
|||
"mhm_mrm" = { typeOfPostProcessing = 203; }
|
||||
"pcrg_mrm" = { typeOfPostProcessing = 204; }
|
||||
"meteogrid" = { typeOfPostProcessing = 205; }
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# CODE TABLE 4.15, Confidence level units
|
||||
# CODE TABLE 4.15, Confidence level units
|
||||
|
||||
0 0 bad
|
||||
1 1 suspect
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
29 29 Total snowfall (m)
|
||||
30 30 Precipitable water category (Code table 4.202)
|
||||
31 31 Hail (m)
|
||||
32 32 Graupel (snow pellets) (kg kg-1)
|
||||
32 32 Graupel (snow pellets) (kg kg-1)
|
||||
33 33 Categorical rain (Code table 4.222)
|
||||
34 34 Categorical freezing rain (Code table 4.222)
|
||||
35 35 Categorical ice pellets (Code table 4.222)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# CODE TABLE 4.15, Confidence level units
|
||||
# CODE TABLE 4.15, Confidence level units
|
||||
|
||||
0 0 bad
|
||||
1 1 suspect
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 3.1, Rotated Latitude/longitude (or equidistant cylindrical, or Plate Carree)
|
||||
|
||||
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
include "grib2/template.3.latlon.def";
|
||||
include "grib2/template.3.rotation.def";
|
||||
|
|
|
@ -50,7 +50,7 @@ include "grib2/template.3.scanning_mode.def";
|
|||
unsigned[4] orientationOfTheGrid : dump ;
|
||||
meta geography.orientationOfTheGridInDegrees
|
||||
scale(orientationOfTheGrid,oneConstant,grib2divider,truncateDegrees) : dump;
|
||||
|
||||
|
||||
# Di - longitudinal direction grid length
|
||||
# NOTE 2: Grid lengths are in units of 10**-3 m, at the latitude specified by LaD
|
||||
unsigned[4] Di : edition_specific,no_copy;
|
||||
|
|
|
@ -48,7 +48,7 @@ include "grib2/template.3.scanning_mode.def";
|
|||
unsigned[4] Di : edition_specific,no_copy;
|
||||
alias iDirectionIncrementGridLength = Di;
|
||||
meta geography.DiInMetres scale(Di,oneConstant,hundred,truncateDegrees) : dump;
|
||||
|
||||
|
||||
# Dj - j-direction increment length in units of 10-2 m
|
||||
unsigned[4] Dj : edition_specific,no_copy;
|
||||
alias jDirectionIncrementGridLength = Dj;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 3.2, Stretched Latitude/longitude (or equidistant cylindrical, or Plate Carree)
|
||||
|
||||
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
include "grib2/template.3.latlon.def";
|
||||
include "grib2/template.3.stretching.def";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 3.4, Variable resolution latitude/longitude
|
||||
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
include "grib2/template.3.latlon_vares.def";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 3.41, Rotated Gaussian latitude/longitude
|
||||
|
||||
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
include "grib2/template.3.gaussian.def";
|
||||
include "grib2/template.3.rotation.def";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 3.5, Variable resolution rotated latitude/longitude
|
||||
|
||||
|
||||
include "grib2/template.3.shape_of_the_earth.def";
|
||||
include "grib2/template.3.latlon_vares.def";
|
||||
include "grib2/template.3.rotation.def";
|
||||
|
|
|
@ -26,11 +26,11 @@ meta g2grid g2grid(
|
|||
subdivisionsOfBasicAngle
|
||||
);
|
||||
|
||||
meta geography.latitudeOfFirstGridPointInDegrees g2latlon(g2grid,0) : dump;
|
||||
meta geography.longitudeOfFirstGridPointInDegrees g2latlon(g2grid,1) : dump;
|
||||
meta geography.latitudeOfLastGridPointInDegrees g2latlon(g2grid,2) : dump;
|
||||
meta geography.longitudeOfLastGridPointInDegrees g2latlon(g2grid,3) : dump;
|
||||
meta geography.iDirectionIncrementInDegrees g2latlon(g2grid,4,iDirectionIncrementGiven) : can_be_missing,dump;
|
||||
meta geography.latitudeOfFirstGridPointInDegrees g2latlon(g2grid,0) : dump;
|
||||
meta geography.longitudeOfFirstGridPointInDegrees g2latlon(g2grid,1) : dump;
|
||||
meta geography.latitudeOfLastGridPointInDegrees g2latlon(g2grid,2) : dump;
|
||||
meta geography.longitudeOfLastGridPointInDegrees g2latlon(g2grid,3) : dump;
|
||||
meta geography.iDirectionIncrementInDegrees g2latlon(g2grid,4,iDirectionIncrementGiven) : can_be_missing,dump;
|
||||
|
||||
meta global global_gaussian(N,Ni,iDirectionIncrement,
|
||||
latitudeOfFirstGridPoint,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# Atmospheric chemical or physical constituent type
|
||||
# Aerosol type
|
||||
codetable[2] aerosolType ('4.233.table',masterDir,localDir) : dump;
|
||||
meta aerosolTypeName codetable_title(aerosolType);
|
||||
|
|
|
@ -47,7 +47,7 @@ if (typeOfSecondFixedSurface == 255) {
|
|||
scaledValueOfSecondFixedSurface,
|
||||
pressureUnits) :dump;
|
||||
alias level=topLevel; # (see GRIB-725)
|
||||
|
||||
|
||||
}
|
||||
alias ls.level=level;
|
||||
alias vertical.level=level;
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
|
||||
# The input process identifier shall have the value of the 'analysis or forecast process identifier' of the
|
||||
# original GRIB message used as input of the post-processing
|
||||
unsigned[2] inputProcessIdentifier : dump,edition_specific;
|
||||
unsigned[2] inputProcessIdentifier : dump,edition_specific;
|
||||
|
||||
# The input originating centre shall have the value of the 'originating centre' of the original GRIB message
|
||||
# used as input of the post-processing
|
||||
codetable[2] inputOriginatingCentre 'common/c-11.table' : dump,edition_specific,string_type;
|
||||
|
||||
# This identifies which post-processing technique was used. This is defined by the originating centre
|
||||
unsigned[1] typeOfPostProcessing : dump,edition_specific;
|
||||
unsigned[1] typeOfPostProcessing : dump,edition_specific;
|
||||
|
||||
concept postProcessing (unknown,"postProcessingConcept.def",conceptsDir2,conceptsDir1):no_copy;
|
||||
|
||||
if (datasetForLocal is "fire") {
|
||||
template_nofail fireTemplate "grib2/fireTemplate.def";
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ if (numberOfTimeRange == 1 || numberOfTimeRange == 2) {
|
|||
meta endStep g2end_step(
|
||||
startStep,
|
||||
stepUnits,
|
||||
|
||||
|
||||
year,
|
||||
month,
|
||||
day,
|
||||
|
@ -94,7 +94,7 @@ if (numberOfTimeRange == 1 || numberOfTimeRange == 2) {
|
|||
typeOfTimeIncrement,
|
||||
numberOfTimeRange
|
||||
) : dump,no_copy;
|
||||
|
||||
|
||||
meta stepRange g2step_range(startStep,endStep): dump;
|
||||
} else {
|
||||
constant stepType = "multiple steps";
|
||||
|
|
|
@ -16,7 +16,7 @@ unsigned[4] numberOfCodedValues;
|
|||
# NR - first dimension (rows)
|
||||
unsigned[2] firstDimension;
|
||||
|
||||
alias NR = firstDimension;
|
||||
alias NR = firstDimension;
|
||||
# NC - second dimension (columns)
|
||||
unsigned[2] secondDimension;
|
||||
|
||||
|
@ -47,12 +47,12 @@ ieeefloat coefsSecond[NC2]; # TODO: find proper names
|
|||
alias data.coefsFirst = coefsFirst;
|
||||
alias data.coefsSecond=coefsSecond;
|
||||
|
||||
if(matrixBitmapsPresent == 1) {
|
||||
if (matrixBitmapsPresent == 1) {
|
||||
constant datumSize = NC*NR;
|
||||
constant secondaryBitmapsCount = numberOfValues + 0;
|
||||
constant secondaryBitmapsSize = secondaryBitmapsCount/8;
|
||||
|
||||
transient numberOfDataMatrices = numberOfDataPoints/datumSize;
|
||||
transient numberOfDataMatrices = numberOfDataPoints/datumSize;
|
||||
|
||||
position offsetBBitmap;
|
||||
meta secondaryBitmaps g2bitmap(
|
||||
|
@ -63,7 +63,7 @@ if(matrixBitmapsPresent == 1) {
|
|||
numberOfCodedValues ,
|
||||
dummy) : read_only;
|
||||
|
||||
meta bitmap data_g2secondary_bitmap(primaryBitmap,
|
||||
meta bitmap data_g2secondary_bitmap(primaryBitmap,
|
||||
secondaryBitmaps,
|
||||
missingValue,datumSize,numberOfDataPoints) : read_only;
|
||||
}
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
# TEMPLATE 5.50, Spectral data - simple packing
|
||||
include "grib2/template.5.packing.def";
|
||||
|
||||
# Real part of (0,0)
|
||||
# Real part of (0,0)
|
||||
ieeefloat realPartOf00 ;
|
||||
|
|
|
@ -31,7 +31,6 @@ transient numberOfPackedValues = numberOfValues - 1 : no_copy;
|
|||
numberOfValues
|
||||
) ;
|
||||
|
||||
|
||||
meta packingError simple_packing_error(bitsPerValue,binaryScaleFactor,decimalScaleFactor,referenceValue,ieee) : no_copy;
|
||||
meta unpackedError simple_packing_error(zero,binaryScaleFactor,decimalScaleFactor,referenceValue,ieee) : no_copy;
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#################################
|
||||
### LOCAL SECTION DESCRIPTION ###
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#################################
|
||||
### LOCAL SECTION DESCRIPTION ###
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#################################################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#################################
|
||||
### LOCAL SECTION DESCRIPTION ###
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#########################
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 14 Feb 2014
|
||||
# modified:
|
||||
#
|
||||
#########################
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 13 May 2013
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
##
|
||||
## author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
## author: Sebastien Villaume
|
||||
## created: 6 Oct 2011
|
||||
## modified: 20 Feb 2014
|
||||
##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 20 Feb 2014
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#########################
|
||||
#
|
||||
# author: Sebastien Villaume <Sebastien.Villaume@smhi.se>
|
||||
# author: Sebastien Villaume
|
||||
# created: 6 Oct 2011
|
||||
# modified: 13 May 2013
|
||||
#
|
||||
|
|
|
@ -82,6 +82,7 @@ if( HAVE_BUILD_TOOLS )
|
|||
grib_set_bitmap
|
||||
grib_list
|
||||
grib_get_data
|
||||
grib_nearest
|
||||
grib_nearest_multiple
|
||||
grib_multi
|
||||
grib_set_missing
|
||||
|
|
|
@ -35,14 +35,14 @@ int main(int argc, char** argv)
|
|||
int i = 0;
|
||||
codes_fieldset* set = NULL;
|
||||
codes_handle* h = NULL;
|
||||
char param[20] = {0,};
|
||||
char shortName[20] = {0,};
|
||||
size_t len = 20;
|
||||
double lats[4] = {0,};
|
||||
double lons[4] = {0,};
|
||||
double values[4] = {0,};
|
||||
double distances[4] = {0,};
|
||||
int indexes[4] = {0,};
|
||||
char* order_by = "param,step";
|
||||
char* order_by = "shortName,step:i";
|
||||
|
||||
size_t size = 4;
|
||||
double lat = -40, lon = 15;
|
||||
|
@ -63,7 +63,6 @@ int main(int argc, char** argv)
|
|||
|
||||
printf("\nordering by %s\n", order_by);
|
||||
printf("\n%d fields in the fieldset\n", codes_fieldset_count(set));
|
||||
printf("n,step,param\n");
|
||||
|
||||
mode = CODES_NEAREST_SAME_GRID | CODES_NEAREST_SAME_POINT;
|
||||
count = 1;
|
||||
|
@ -71,9 +70,9 @@ int main(int argc, char** argv)
|
|||
while ((h = codes_fieldset_next_handle(set, &err)) != NULL) {
|
||||
CODES_CHECK(codes_get_long(h, "step", &step), 0);
|
||||
len = 20;
|
||||
CODES_CHECK(codes_get_string(h, "shortName", param, &len), 0);
|
||||
CODES_CHECK(codes_get_string(h, "shortName", shortName, &len), 0);
|
||||
|
||||
printf("%d %ld %s ", count, step, param);
|
||||
printf("Msg #%d, step=%ld, shortName=%s", count, step, shortName);
|
||||
if (!nearest) nearest = codes_grib_nearest_new(h, &err);
|
||||
CODES_CHECK(err, 0);
|
||||
CODES_CHECK(codes_grib_nearest_find(nearest, h, lat, lon, mode, lats, lons, values, distances, indexes, &size), 0);
|
||||
|
@ -91,5 +90,9 @@ int main(int argc, char** argv)
|
|||
|
||||
if (set) codes_fieldset_delete(set);
|
||||
|
||||
for (i = 0; i < nfiles; i++)
|
||||
free(filenames[i]);
|
||||
free(filenames);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
#!/bin/sh
|
||||
# (C) Copyright 2005- ECMWF.
|
||||
#
|
||||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
. ./include.sh
|
||||
set -u
|
||||
|
||||
label="grib_nearest_c"
|
||||
tempTxt=temp.$label.txt
|
||||
tempRef=temp.$label.ref
|
||||
|
||||
input=${data_dir}/high_level_api.grib2
|
||||
${examples_dir}/c_grib_nearest $input > $tempTxt
|
||||
|
||||
cat > $tempRef <<EOF
|
||||
|
||||
ordering by shortName,step:i
|
||||
|
||||
5 fields in the fieldset
|
||||
Msg #1, step=0, shortName=msl
|
||||
Idx lat lon dist val
|
||||
58017 -40.85 15.30 97.627 101524
|
||||
58016 -40.85 14.40 107.078 101570
|
||||
57617 -39.95 15.30 26.1625 101655
|
||||
57616 -39.95 14.40 51.4303 101669
|
||||
|
||||
Msg #2, step=6, shortName=msl
|
||||
Idx lat lon dist val
|
||||
58017 -40.85 15.30 97.627 101547
|
||||
58016 -40.85 14.40 107.078 101605
|
||||
57617 -39.95 15.30 26.1625 101589
|
||||
57616 -39.95 14.40 51.4303 101641
|
||||
|
||||
Msg #3, step=12, shortName=msl
|
||||
Idx lat lon dist val
|
||||
58017 -40.85 15.30 97.627 101606
|
||||
58016 -40.85 14.40 107.078 101623
|
||||
57617 -39.95 15.30 26.1625 101652
|
||||
57616 -39.95 14.40 51.4303 101678
|
||||
|
||||
Msg #4, step=18, shortName=msl
|
||||
Idx lat lon dist val
|
||||
58017 -40.85 15.30 97.627 101507
|
||||
58016 -40.85 14.40 107.078 101486
|
||||
57617 -39.95 15.30 26.1625 101573
|
||||
57616 -39.95 14.40 51.4303 101571
|
||||
|
||||
Msg #5, step=24, shortName=msl
|
||||
Idx lat lon dist val
|
||||
58017 -40.85 15.30 97.627 101379
|
||||
58016 -40.85 14.40 107.078 101372
|
||||
57617 -39.95 15.30 26.1625 101494
|
||||
57616 -39.95 14.40 51.4303 101471
|
||||
|
||||
EOF
|
||||
|
||||
diff $tempRef $tempTxt
|
||||
|
||||
|
||||
rm -f $tempTxt $tempRef
|
|
@ -89,7 +89,7 @@ grib_handle* codes_fieldset_next_handle(grib_fieldset* set, int* err)
|
|||
{
|
||||
return grib_fieldset_next_handle(set, err);
|
||||
}
|
||||
int codes_fieldset_count(grib_fieldset* set)
|
||||
int codes_fieldset_count(const grib_fieldset* set)
|
||||
{
|
||||
return grib_fieldset_count(set);
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ void codes_fieldset_delete(codes_fieldset* set);
|
|||
void codes_fieldset_rewind(codes_fieldset* set);
|
||||
int codes_fieldset_apply_order_by(codes_fieldset* set, const char* order_by_string);
|
||||
codes_handle* codes_fieldset_next_handle(codes_fieldset* set, int* err);
|
||||
int codes_fieldset_count(codes_fieldset* set);
|
||||
int codes_fieldset_count(const codes_fieldset* set);
|
||||
int codes_values_check(codes_handle* h, codes_values* values, int count);
|
||||
|
||||
/*! \defgroup codes_index The indexing feature
|
||||
|
|
|
@ -2467,7 +2467,8 @@ static int create_keys(const grib_accessor* a, long onlySubset, long startSubset
|
|||
self->dataAccessors = grib_accessors_list_create(c);
|
||||
|
||||
if (self->dataAccessorsTrie) {
|
||||
grib_trie_with_rank_delete(self->dataAccessorsTrie);
|
||||
/* ECC-989: do not call grib_trie_with_rank_delete */
|
||||
grib_trie_with_rank_delete_container(self->dataAccessorsTrie);
|
||||
}
|
||||
self->dataAccessorsTrie = grib_trie_with_rank_new(c);
|
||||
|
||||
|
@ -3466,8 +3467,10 @@ static void destroy(grib_context* c, grib_accessor* a)
|
|||
self_clear(c, self);
|
||||
if (self->dataAccessors)
|
||||
grib_accessors_list_delete(c, self->dataAccessors);
|
||||
if (self->dataAccessorsTrie)
|
||||
if (self->dataAccessorsTrie) {
|
||||
grib_trie_with_rank_delete_container(self->dataAccessorsTrie);
|
||||
self->dataAccessorsTrie = NULL;
|
||||
}
|
||||
if (self->tempStrings) {
|
||||
grib_sarray_delete_content(c, self->tempStrings);
|
||||
grib_sarray_delete(c, self->tempStrings);
|
||||
|
|
|
@ -535,9 +535,10 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
|
|||
|
||||
*val = atol(p);
|
||||
*len = 1;
|
||||
#if 0
|
||||
#ifdef DEBUG
|
||||
/* ECC-980: Changes reverted because of side-effects!
|
||||
* e.g. marsType being a codetable and concept! see ifsParam
|
||||
* e.g. marsType being a codetable and concept! see ifsParam.
|
||||
* Keep this check in DEBUG mode only
|
||||
*/
|
||||
{
|
||||
char *endptr;
|
||||
|
|
|
@ -214,7 +214,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
grib_handle* hand = grib_handle_of_accessor(a);
|
||||
|
||||
int err = GRIB_SUCCESS, i = 0;
|
||||
size_t buflen = grib_byte_count(a);
|
||||
size_t buflen = 0;
|
||||
struct aec_stream strm;
|
||||
double bscale = 0;
|
||||
double dscale = 0;
|
||||
|
@ -260,9 +260,6 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
if ((err = grib_get_long_internal(hand, self->ccsds_rsi, &ccsds_rsi)) != GRIB_SUCCESS)
|
||||
return err;
|
||||
|
||||
bscale = grib_power(binary_scale_factor, 2);
|
||||
dscale = grib_power(-decimal_scale_factor, 10);
|
||||
|
||||
/* TODO: This should be called upstream */
|
||||
if (*len < n_vals)
|
||||
return GRIB_ARRAY_TOO_SMALL;
|
||||
|
@ -275,6 +272,10 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
bscale = grib_power(binary_scale_factor, 2);
|
||||
dscale = grib_power(-decimal_scale_factor, 10);
|
||||
|
||||
buflen = grib_byte_count(a);
|
||||
buf = (unsigned char*)hand->buffer->data;
|
||||
buf += grib_byte_offset(a);
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len)
|
|||
{
|
||||
grib_accessor_gaussian_grid_name* self = (grib_accessor_gaussian_grid_name*)a;
|
||||
|
||||
long N = 0, Ni = 0, isOctahedral = 0;
|
||||
long N = 0, Ni = 0;
|
||||
char tmp[MAX_GRIDNAME_LEN] = {0,};
|
||||
size_t length = 0;
|
||||
int ret = GRIB_SUCCESS;
|
||||
|
@ -167,20 +167,21 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len)
|
|||
return ret;
|
||||
if ((ret = grib_get_long_internal(a->parent->h, self->Ni, &Ni)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
if ((ret = grib_get_long_internal(a->parent->h, self->isOctahedral, &isOctahedral)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
|
||||
if (Ni == GRIB_MISSING_LONG) {
|
||||
/* reduced gaussian grid */
|
||||
/* Reduced gaussian grid */
|
||||
long isOctahedral = 0;
|
||||
if ((ret = grib_get_long_internal(a->parent->h, self->isOctahedral, &isOctahedral)) != GRIB_SUCCESS)
|
||||
return ret;
|
||||
if (isOctahedral == 1) {
|
||||
sprintf(tmp, "O%ld", N);
|
||||
}
|
||||
else {
|
||||
sprintf(tmp, "N%ld", N);
|
||||
sprintf(tmp, "N%ld", N); /* Classic */
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* regular gaussian grid */
|
||||
/* Regular gaussian grid */
|
||||
sprintf(tmp, "F%ld", N);
|
||||
}
|
||||
length = strlen(tmp) + 1;
|
||||
|
|
|
@ -321,8 +321,7 @@ static int unpack_double(grib_accessor* a, double* v, size_t* len)
|
|||
grib_unpack_string(a, val, &l);
|
||||
|
||||
*v = strtod(val, &last);
|
||||
|
||||
if (*last == 0) {
|
||||
if (*last == 0) { /* conversion of string to double worked */
|
||||
grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting string %s to long", a->name);
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
@ -515,7 +514,14 @@ static int pack_string(grib_accessor* a, const char* v, size_t* len)
|
|||
{
|
||||
if (a->cclass->pack_double && a->cclass->pack_double != &pack_double) {
|
||||
size_t l = 1;
|
||||
double val = atof(v);
|
||||
char* endPtr = NULL; /* for error handling */
|
||||
double val = strtod(v, &endPtr);
|
||||
if (*endPtr) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"pack_string: Invalid value (%s) for %s. String cannot be converted to a double",
|
||||
v, a->name);
|
||||
return GRIB_WRONG_TYPE;
|
||||
}
|
||||
return grib_pack_double(a, &val, &l);
|
||||
}
|
||||
|
||||
|
@ -525,8 +531,7 @@ static int pack_string(grib_accessor* a, const char* v, size_t* len)
|
|||
return grib_pack_long(a, &val, &l);
|
||||
}
|
||||
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"Should not grib_pack %s as string", a->name);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack '%s' as string", a->name);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -294,8 +294,7 @@ static int compare(grib_accessor* a, grib_accessor* b)
|
|||
|
||||
static int pack_string(grib_accessor* a, const char* val, size_t* len)
|
||||
{
|
||||
char* theEnd = NULL;
|
||||
long v = 0;
|
||||
long v = 0; /* The converted value */
|
||||
|
||||
#if 0
|
||||
/* Requires more work e.g. filter */
|
||||
|
@ -304,9 +303,9 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
|
|||
}
|
||||
#endif
|
||||
|
||||
v = strtol(val, &theEnd, 10);
|
||||
if (theEnd) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "trying to pack \"%s\" as long", val);
|
||||
if (string_to_long(val, &v) != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||
"Trying to pack \"%s\" as long. String cannot be converted to an integer", val);
|
||||
return GRIB_WRONG_TYPE;
|
||||
}
|
||||
return grib_pack_long(a, &v, len);
|
||||
|
|
|
@ -240,7 +240,7 @@ void grib_fieldset_delete(grib_fieldset* set);
|
|||
void grib_fieldset_rewind(grib_fieldset* set);
|
||||
int grib_fieldset_apply_order_by(grib_fieldset* set, const char* order_by_string);
|
||||
grib_handle* grib_fieldset_next_handle(grib_fieldset* set, int* err);
|
||||
int grib_fieldset_count(grib_fieldset* set);
|
||||
int grib_fieldset_count(const grib_fieldset* set);
|
||||
int grib_values_check(grib_handle* h, grib_values* values, int count);
|
||||
|
||||
/*! \defgroup grib_index The grib_index
|
||||
|
|
|
@ -219,7 +219,6 @@ size_t grib_sarray_used_size(grib_sarray* v);
|
|||
grib_oarray* grib_oarray_new(grib_context* c, size_t size, size_t incsize);
|
||||
grib_oarray* grib_oarray_push(grib_context* c, grib_oarray* v, void* val);
|
||||
void grib_oarray_delete(grib_context* c, grib_oarray* v);
|
||||
void grib_oarray_delete_content(grib_context* c, grib_oarray* v);
|
||||
void** grib_oarray_get_array(grib_context* c, grib_oarray* v);
|
||||
void* grib_oarray_get(grib_oarray* v, int i);
|
||||
size_t grib_oarray_used_size(grib_oarray* v);
|
||||
|
@ -675,14 +674,12 @@ bufr_descriptors_array* grib_accessor_class_expanded_descriptors_get_expanded(gr
|
|||
/* grib_accessor_class_md5.c */
|
||||
|
||||
/* grib_jasper_encoding.c */
|
||||
int grib_jasper_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* values, size_t* no_values);
|
||||
int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper);
|
||||
int grib_jasper_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* val, size_t* n_vals);
|
||||
int grib_jasper_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* values, const size_t* n_vals);
|
||||
int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper);
|
||||
|
||||
/* grib_openjpeg_encoding.c */
|
||||
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* values, const size_t* n_vals);
|
||||
int grib_openjpeg_encode(grib_context* c, j2k_encode_helper* helper);
|
||||
int grib_openjpeg_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* val, const size_t* n_vals);
|
||||
|
||||
/* action_class_set_missing.c */
|
||||
grib_action* grib_action_create_set_missing(grib_context* context, const char* name);
|
||||
|
@ -714,7 +711,6 @@ 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);
|
||||
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, 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);
|
||||
|
@ -815,14 +811,6 @@ void grib_timer_print(grib_timer* t);
|
|||
void grib_timer_partial_rate(grib_timer* t, double start, long total);
|
||||
void grib_print_all_timers(void);
|
||||
void grib_reset_all_timers(void);
|
||||
grib_timer* grib_get_timer(grib_context* c, const char* name, const char* statname, int elapsed);
|
||||
int grib_timer_start(grib_timer* t);
|
||||
int grib_timer_stop(grib_timer* t, long total);
|
||||
double grib_timer_value(grib_timer* t);
|
||||
void grib_timer_print(grib_timer* t);
|
||||
void grib_timer_partial_rate(grib_timer* t, double start, long total);
|
||||
void grib_print_all_timers(void);
|
||||
void grib_reset_all_timers(void);
|
||||
|
||||
/* grib_ibmfloat.c */
|
||||
unsigned long grib_ibm_to_long(double x);
|
||||
|
@ -841,15 +829,10 @@ double grib_ieeefloat_error(double x);
|
|||
double grib_long_to_ieee(unsigned long x);
|
||||
unsigned long grib_ieee_nearest_smaller_to_long(double x);
|
||||
int grib_nearest_smaller_ieee_float(double a, double* ret);
|
||||
double grib_ieeefloat_error(double x);
|
||||
double grib_long_to_ieee(unsigned long x);
|
||||
int grib_nearest_smaller_ieee_float(double a, double* x);
|
||||
unsigned long grib_ieee_to_long(double x);
|
||||
|
||||
unsigned long grib_ieee64_to_long(double x);
|
||||
double grib_long_to_ieee64(unsigned long x);
|
||||
int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, double* val);
|
||||
int grib_ieee_decode_array(grib_context* c, unsigned char* buf, size_t nvals, int bytes, double* val);
|
||||
int grib_ieee_encode_array(grib_context* c, double* val, size_t nvals, int bytes, unsigned char* buf);
|
||||
int grib_ieee_encode_array(grib_context* c, double* val, size_t nvals, int bytes, unsigned char* buf);
|
||||
|
||||
/* grib_accessor_class_reference_value_error.c */
|
||||
|
@ -1008,10 +991,10 @@ int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string);
|
|||
int grib_fieldset_apply_order_by(grib_fieldset* set, const char* order_by_string);
|
||||
void grib_fieldset_delete_order_by(grib_context* c, grib_order_by* order_by);
|
||||
void grib_fieldset_delete(grib_fieldset* set);
|
||||
int grib_fieldset_add(grib_fieldset* set, char* filename);
|
||||
int grib_fieldset_add(grib_fieldset* set, const char* filename);
|
||||
void grib_fieldset_rewind(grib_fieldset* set);
|
||||
grib_handle* grib_fieldset_next_handle(grib_fieldset* set, int* err);
|
||||
int grib_fieldset_count(grib_fieldset* set);
|
||||
int grib_fieldset_count(const grib_fieldset* set);
|
||||
grib_handle* grib_fieldset_retrieve(grib_fieldset* set, int i, int* err);
|
||||
|
||||
/* grib_filepool.c */
|
||||
|
@ -1138,8 +1121,6 @@ void* grib_trie_get(grib_trie* t, const char* key);
|
|||
/* grib_trie_with_rank.c */
|
||||
grib_trie_with_rank* grib_trie_with_rank_new(grib_context* c);
|
||||
void grib_trie_with_rank_delete_container(grib_trie_with_rank* t);
|
||||
void grib_trie_with_rank_delete(grib_trie_with_rank* t);
|
||||
void grib_trie_with_rank_clear(grib_trie_with_rank* t);
|
||||
int grib_trie_with_rank_insert(grib_trie_with_rank* t, const char* key, void* data);
|
||||
void* grib_trie_with_rank_get(grib_trie_with_rank* t, const char* key, int rank);
|
||||
|
||||
|
|
|
@ -44,13 +44,10 @@ static grib_fieldset* grib_fieldset_create_from_order_by(grib_context* c, grib_o
|
|||
static int grib_fieldset_resize(grib_fieldset* set, size_t newsize);
|
||||
static void grib_trim(char** x);
|
||||
static grib_order_by* grib_fieldset_new_order_by(grib_context* c, const char* z);
|
||||
static int grib_fieldset_compare(grib_fieldset* set, int* i, int* j);
|
||||
static void grib_fieldset_sort(grib_fieldset* set, int beg, int theEnd);
|
||||
static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize);
|
||||
static void grib_fieldset_sort(grib_fieldset* set, int theStart, int theEnd);
|
||||
static grib_int_array* grib_fieldset_create_int_array(grib_context* c, size_t size);
|
||||
static int grib_fieldset_resize_int_array(grib_int_array* a, size_t newsize);
|
||||
static void grib_fieldset_delete_int_array(grib_int_array* f);
|
||||
static void grib_fieldset_delete_columns(grib_fieldset* set);
|
||||
static grib_field** grib_fieldset_create_fields(grib_context* c, size_t size);
|
||||
static void grib_fieldset_delete_fields(grib_fieldset* set);
|
||||
static int grib_fieldset_resize_fields(grib_fieldset* set, size_t newsize);
|
||||
|
@ -60,7 +57,7 @@ static int grib_fieldset_set_order_by(grib_fieldset* set, grib_order_by* ob);
|
|||
/* --------------- grib_column functions ------------------*/
|
||||
int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type)
|
||||
{
|
||||
grib_column* column = 0;
|
||||
grib_column* column = NULL;
|
||||
grib_context* c;
|
||||
int err = 0;
|
||||
|
||||
|
@ -69,38 +66,34 @@ int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type)
|
|||
|
||||
c = set->context;
|
||||
|
||||
set->columns[id].errors = (int*)grib_context_malloc_clear(c,
|
||||
sizeof(int) * GRIB_START_ARRAY_SIZE);
|
||||
set->columns[id].errors = (int*)grib_context_malloc_clear(c, sizeof(int) * GRIB_START_ARRAY_SIZE);
|
||||
|
||||
switch (type) {
|
||||
case GRIB_TYPE_LONG:
|
||||
set->columns[id].long_values = (long*)grib_context_malloc_clear(c,
|
||||
sizeof(long) * GRIB_START_ARRAY_SIZE);
|
||||
set->columns[id].long_values = (long*)grib_context_malloc_clear(c, sizeof(long) * GRIB_START_ARRAY_SIZE);
|
||||
if (!set->columns[id].long_values) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_new_column : Cannot malloc %ld bytes",
|
||||
"grib_fieldset_new_column: Cannot malloc %ld bytes",
|
||||
sizeof(long) * GRIB_START_ARRAY_SIZE);
|
||||
err = GRIB_OUT_OF_MEMORY;
|
||||
return err;
|
||||
}
|
||||
break;
|
||||
case GRIB_TYPE_DOUBLE:
|
||||
set->columns[id].double_values = (double*)grib_context_malloc_clear(c,
|
||||
sizeof(double) * GRIB_START_ARRAY_SIZE);
|
||||
set->columns[id].double_values = (double*)grib_context_malloc_clear(c, sizeof(double) * GRIB_START_ARRAY_SIZE);
|
||||
if (!set->columns[id].double_values) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_new_column : Cannot malloc %ld bytes",
|
||||
"grib_fieldset_new_column: Cannot malloc %ld bytes",
|
||||
sizeof(double) * GRIB_START_ARRAY_SIZE);
|
||||
err = GRIB_OUT_OF_MEMORY;
|
||||
return err;
|
||||
}
|
||||
break;
|
||||
case GRIB_TYPE_STRING:
|
||||
set->columns[id].string_values = (char**)grib_context_malloc_clear(c,
|
||||
sizeof(char*) * GRIB_START_ARRAY_SIZE);
|
||||
set->columns[id].string_values = (char**)grib_context_malloc_clear(c, sizeof(char*) * GRIB_START_ARRAY_SIZE);
|
||||
if (!set->columns[id].string_values) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_new_column : Cannot malloc %ld bytes",
|
||||
"grib_fieldset_new_column: Cannot malloc %ld bytes",
|
||||
sizeof(char*) * GRIB_START_ARRAY_SIZE);
|
||||
err = GRIB_OUT_OF_MEMORY;
|
||||
return err;
|
||||
|
@ -108,7 +101,7 @@ int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type)
|
|||
break;
|
||||
default:
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_new_column : unknown column type %d", type);
|
||||
"grib_fieldset_new_column: Unknown column type %d", type);
|
||||
grib_context_free(c, column);
|
||||
return err;
|
||||
}
|
||||
|
@ -146,7 +139,7 @@ static void grib_fieldset_delete_columns(grib_fieldset* set)
|
|||
break;
|
||||
default:
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_new_column : unknown column type %d", set->columns[i].type);
|
||||
"grib_fieldset_new_column: Unknown column type %d", set->columns[i].type);
|
||||
}
|
||||
grib_context_free(c, set->columns[i].errors);
|
||||
grib_context_free(c, set->columns[i].name);
|
||||
|
@ -178,7 +171,8 @@ static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize)
|
|||
newsize * sizeof(long));
|
||||
if (!newlongs) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_columns_resize : Cannot malloc %ld bytes", newsize - set->columns[i].values_array_size);
|
||||
"grib_fieldset_columns_resize: Cannot malloc %ld bytes",
|
||||
newsize - set->columns[i].values_array_size);
|
||||
return GRIB_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
|
@ -189,7 +183,8 @@ static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize)
|
|||
newsize * sizeof(double));
|
||||
if (!newdoubles) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_columns_resize : Cannot malloc %ld bytes", newsize - set->columns[i].values_array_size);
|
||||
"grib_fieldset_columns_resize: Cannot malloc %ld bytes",
|
||||
newsize - set->columns[i].values_array_size);
|
||||
return GRIB_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
|
@ -200,7 +195,8 @@ static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize)
|
|||
newsize * sizeof(char*));
|
||||
if (!newstrings) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_columns_resize : Cannot malloc %ld bytes", newsize - set->columns[i].values_array_size);
|
||||
"grib_fieldset_columns_resize: Cannot malloc %ld bytes",
|
||||
newsize - set->columns[i].values_array_size);
|
||||
return GRIB_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
|
@ -210,7 +206,7 @@ static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize)
|
|||
newerrors = (int*)grib_context_realloc(c, set->columns[i].errors, newsize * sizeof(int));
|
||||
if (!newerrors) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_columns_resize : Cannot malloc %ld bytes",
|
||||
"grib_fieldset_columns_resize: Cannot malloc %ld bytes",
|
||||
newsize * sizeof(int));
|
||||
return GRIB_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -266,7 +262,7 @@ grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[],
|
|||
int ret = GRIB_SUCCESS;
|
||||
grib_order_by* ob = NULL;
|
||||
|
||||
grib_fieldset* set = 0;
|
||||
grib_fieldset* set = NULL;
|
||||
|
||||
if (!c)
|
||||
c = grib_context_get_default();
|
||||
|
@ -300,8 +296,13 @@ grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[],
|
|||
}
|
||||
}
|
||||
|
||||
if (where_string)
|
||||
grib_fieldset_apply_where(set, where_string);
|
||||
if (where_string) {
|
||||
ret = grib_fieldset_apply_where(set, where_string);
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
*err = ret;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (order_by_string) {
|
||||
if (!set->order_by && ob)
|
||||
|
@ -315,10 +316,9 @@ grib_fieldset* grib_fieldset_new_from_files(grib_context* c, char* filenames[],
|
|||
return set;
|
||||
}
|
||||
|
||||
static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, char** keys, int nkeys,
|
||||
int* err)
|
||||
static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, char** keys, int nkeys, int* err)
|
||||
{
|
||||
grib_fieldset* set = 0;
|
||||
grib_fieldset* set = NULL;
|
||||
size_t msize = 0, size = 0;
|
||||
int i = 0;
|
||||
int type = 0;
|
||||
|
@ -382,8 +382,7 @@ static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, char** key
|
|||
return set;
|
||||
}
|
||||
|
||||
static grib_fieldset* grib_fieldset_create_from_order_by(grib_context* c, grib_order_by* ob,
|
||||
int* err)
|
||||
static grib_fieldset* grib_fieldset_create_from_order_by(grib_context* c, grib_order_by* ob, int* err)
|
||||
{
|
||||
char** keys = NULL;
|
||||
size_t nkeys = 0;
|
||||
|
@ -411,20 +410,22 @@ static grib_fieldset* grib_fieldset_create_from_order_by(grib_context* c, grib_o
|
|||
return set;
|
||||
}
|
||||
|
||||
/* Experimental: Needs more work */
|
||||
int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string)
|
||||
{
|
||||
int err = GRIB_NOT_IMPLEMENTED;
|
||||
grib_math* m = 0;
|
||||
grib_math* m = NULL;
|
||||
|
||||
if (!set)
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
|
||||
m = grib_math_new(set->context, where_string, &err);
|
||||
if (err || !m) return err;
|
||||
|
||||
print_math(m);
|
||||
printf("\n");
|
||||
grib_math_delete(set->context, m);
|
||||
return err;
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int grib_fieldset_apply_order_by(grib_fieldset* set, const char* order_by_string)
|
||||
|
@ -457,9 +458,9 @@ static int grib_fieldset_compare(grib_fieldset* set, int* i, int* j)
|
|||
int ret = 0;
|
||||
double d = 0;
|
||||
int idkey = 0;
|
||||
grib_order_by* ob = 0;
|
||||
grib_order_by* ob = NULL;
|
||||
int ii = 0, jj = 0;
|
||||
int* order = 0;
|
||||
int* order = NULL;
|
||||
|
||||
if (!set || !set->order_by)
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
|
@ -505,18 +506,18 @@ static int grib_fieldset_compare(grib_fieldset* set, int* i, int* j)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void grib_fieldset_sort(grib_fieldset* set, int beg, int theEnd)
|
||||
static void grib_fieldset_sort(grib_fieldset* set, int theStart, int theEnd)
|
||||
{
|
||||
double temp;
|
||||
int l = 0, r = 0;
|
||||
if (theEnd > beg) {
|
||||
l = beg + 1;
|
||||
if (theEnd > theStart) {
|
||||
l = theStart + 1;
|
||||
r = theEnd;
|
||||
while (l < r) {
|
||||
if (grib_fieldset_compare(set, &l, &beg) <= 0) {
|
||||
if (grib_fieldset_compare(set, &l, &theStart) <= 0) {
|
||||
l++;
|
||||
}
|
||||
else if (grib_fieldset_compare(set, &r, &beg) >= 0) {
|
||||
else if (grib_fieldset_compare(set, &r, &theStart) >= 0) {
|
||||
r--;
|
||||
}
|
||||
else {
|
||||
|
@ -524,16 +525,16 @@ static void grib_fieldset_sort(grib_fieldset* set, int beg, int theEnd)
|
|||
}
|
||||
}
|
||||
|
||||
if (grib_fieldset_compare(set, &l, &beg) < 0) {
|
||||
SWAP(set->order->el[l], set->order->el[beg])
|
||||
if (grib_fieldset_compare(set, &l, &theStart) < 0) {
|
||||
SWAP(set->order->el[l], set->order->el[theStart])
|
||||
l--;
|
||||
}
|
||||
else {
|
||||
l--;
|
||||
SWAP(set->order->el[l], set->order->el[beg])
|
||||
SWAP(set->order->el[l], set->order->el[theStart])
|
||||
}
|
||||
|
||||
grib_fieldset_sort(set, beg, l);
|
||||
grib_fieldset_sort(set, theStart, l);
|
||||
grib_fieldset_sort(set, r, theEnd);
|
||||
}
|
||||
}
|
||||
|
@ -560,7 +561,7 @@ static grib_order_by* grib_fieldset_new_order_by(grib_context* c, const char* ob
|
|||
{
|
||||
char *t1 = 0, *t2 = 0, *p = 0;
|
||||
int id = 0;
|
||||
char* z = 0;
|
||||
char* z = NULL;
|
||||
int mode, mode_default = GRIB_ORDER_BY_ASC;
|
||||
grib_order_by *ob, *sob;
|
||||
|
||||
|
@ -628,7 +629,7 @@ static grib_order_by* grib_fieldset_new_order_by(grib_context* c, const char* ob
|
|||
|
||||
void grib_fieldset_delete(grib_fieldset* set)
|
||||
{
|
||||
grib_context* c = 0;
|
||||
grib_context* c = NULL;
|
||||
if (!set)
|
||||
return;
|
||||
|
||||
|
@ -644,17 +645,17 @@ void grib_fieldset_delete(grib_fieldset* set)
|
|||
grib_context_free(c, set);
|
||||
}
|
||||
|
||||
int grib_fieldset_add(grib_fieldset* set, char* filename)
|
||||
int grib_fieldset_add(grib_fieldset* set, const char* filename)
|
||||
{
|
||||
int ret = GRIB_SUCCESS;
|
||||
int err = 0;
|
||||
int i = 0;
|
||||
grib_handle* h = 0;
|
||||
grib_handle* h = NULL;
|
||||
/* int nkeys; */
|
||||
grib_file* file;
|
||||
double offset = 0;
|
||||
long length = 0;
|
||||
grib_context* c = 0;
|
||||
grib_context* c = NULL;
|
||||
|
||||
if (!set || !filename)
|
||||
return GRIB_INVALID_ARGUMENT;
|
||||
|
@ -742,15 +743,15 @@ grib_handle* grib_fieldset_next_handle(grib_fieldset* set, int* err)
|
|||
return h;
|
||||
}
|
||||
|
||||
int grib_fieldset_count(grib_fieldset* set)
|
||||
int grib_fieldset_count(const grib_fieldset* set)
|
||||
{
|
||||
return set->size;
|
||||
}
|
||||
|
||||
grib_handle* grib_fieldset_retrieve(grib_fieldset* set, int i, int* err)
|
||||
{
|
||||
grib_handle* h = 0;
|
||||
grib_field* field = 0;
|
||||
grib_handle* h = NULL;
|
||||
grib_field* field = NULL;
|
||||
*err = GRIB_SUCCESS;
|
||||
if (!set) {
|
||||
*err = GRIB_INVALID_ARGUMENT;
|
||||
|
@ -783,10 +784,9 @@ static grib_int_array* grib_fieldset_create_int_array(grib_context* c, size_t si
|
|||
c = grib_context_get_default();
|
||||
|
||||
a = (grib_int_array*)grib_context_malloc_clear(c, sizeof(grib_int_array));
|
||||
|
||||
if (!a) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_create_int_array : Cannot malloc %ld bytes",
|
||||
"grib_fieldset_create_int_array: Cannot malloc %ld bytes",
|
||||
sizeof(grib_int_array));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ static grib_int_array* grib_fieldset_create_int_array(grib_context* c, size_t si
|
|||
a->el = (int*)grib_context_malloc_clear(c, sizeof(int) * size);
|
||||
if (!a->el) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_fieldset_create_int_array : Cannot malloc %ld bytes",
|
||||
"grib_fieldset_create_int_array: Cannot malloc %ld bytes",
|
||||
sizeof(int) * size);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -896,7 +896,7 @@ static void grib_fieldset_delete_fields(grib_fieldset* set)
|
|||
|
||||
static void grib_trim(char** x)
|
||||
{
|
||||
char* p = 0;
|
||||
char* p = NULL;
|
||||
while (**x == ' ')
|
||||
(*x)++;
|
||||
if (**x == '\0')
|
||||
|
|
12409
src/grib_hash_keys.c
12409
src/grib_hash_keys.c
File diff suppressed because it is too large
Load Diff
|
@ -445,9 +445,9 @@ void grib_math_delete(grib_context* c, grib_math* m)
|
|||
|
||||
grib_math* grib_math_new(grib_context* c, const char* formula, int* err)
|
||||
{
|
||||
grib_math* x;
|
||||
char* f = 0;
|
||||
char* fsave = 0;
|
||||
grib_math* x = NULL;
|
||||
char* f = NULL;
|
||||
char* fsave = NULL;
|
||||
|
||||
*err = 0;
|
||||
|
||||
|
@ -467,6 +467,7 @@ grib_math* grib_math_new(grib_context* c, const char* formula, int* err)
|
|||
if (*f) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_math_new : Part of the formula was not processed: '%s'", f);
|
||||
*err = GRIB_INVALID_ARGUMENT;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,8 +170,7 @@ static int init_sphere(grib_handle* h,
|
|||
double Dx, double Dy, double radius,
|
||||
double latFirstInRadians, double lonFirstInRadians,
|
||||
double LoVInRadians, double Latin1InRadians, double Latin2InRadians,
|
||||
double LaDInRadians,
|
||||
long iScansNegatively, long jScansPositively, long jPointsAreConsecutive)
|
||||
double LaDInRadians)
|
||||
{
|
||||
int i, j;
|
||||
double f, n, rho, rho0, angle, x0, y0, x, y, tmp, tmp2;
|
||||
|
@ -474,8 +473,7 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
|
|||
LoVInDegrees,
|
||||
Dx, Dy, radius,
|
||||
latFirstInRadians, lonFirstInRadians,
|
||||
LoVInRadians, Latin1InRadians, Latin2InRadians, LaDInRadians,
|
||||
iScansNegatively, jScansPositively, jPointsAreConsecutive);
|
||||
LoVInRadians, Latin1InRadians, Latin2InRadians, LaDInRadians);
|
||||
}
|
||||
if (err) return err;
|
||||
|
||||
|
|
|
@ -18,18 +18,67 @@
|
|||
#undef PACKAGE_TARNAME
|
||||
#undef PACKAGE_VERSION
|
||||
#include "jasper/jasper.h"
|
||||
|
||||
#define MAXOPTSSIZE 1024
|
||||
|
||||
int grib_jasper_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* values, size_t* no_values)
|
||||
static int ecc_jasper_initialise()
|
||||
{
|
||||
/*jas_setdbglevel(99999);*/
|
||||
#if JASPER_VERSION_MAJOR == 3
|
||||
int jaserr = 0;
|
||||
jas_conf_clear();
|
||||
jas_conf_set_max_mem_usage(jas_get_total_mem_size());
|
||||
jaserr = jas_init_library();
|
||||
if (jaserr) return jaserr;
|
||||
jaserr = jas_init_thread();
|
||||
if (jaserr) return jaserr;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static jas_image_t* ecc_jasper_decode(jas_stream_t *in)
|
||||
{
|
||||
#if JASPER_VERSION_MAJOR == 3
|
||||
/* Second argument (=fmt) < 0 means "If possible, try to determine the format of the input data" */
|
||||
return jas_image_decode(in, -1, 0);
|
||||
#else
|
||||
return jpc_decode(in, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int ecc_jasper_encode(jas_image_t *image, jas_stream_t *jpcstream, char *optstr)
|
||||
{
|
||||
#if JASPER_VERSION_MAJOR == 3
|
||||
const int fmt = jas_image_strtofmt("jpc");
|
||||
return jas_image_encode(image, jpcstream, fmt, optstr);
|
||||
#else
|
||||
return jpc_encode(image, jpcstream, optstr);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ecc_jasper_cleanup()
|
||||
{
|
||||
#if JASPER_VERSION_MAJOR == 3
|
||||
jas_cleanup_thread();
|
||||
jas_cleanup_library();
|
||||
#endif
|
||||
}
|
||||
|
||||
int grib_jasper_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* values, const size_t* n_vals)
|
||||
{
|
||||
/* jas_setdbglevel(99999); */
|
||||
jas_image_t* image = NULL;
|
||||
jas_stream_t* jpeg = NULL;
|
||||
int code = GRIB_SUCCESS;
|
||||
jas_matrix_t* matrix = NULL;
|
||||
jas_image_cmpt_t* p;
|
||||
int i, j, k;
|
||||
int jaserr = 0; /* 0 means success */
|
||||
|
||||
jaserr = ecc_jasper_initialise();
|
||||
if (jaserr) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "grib_jasper_decode: Failed to initialize JasPer library. JasPer error %d", jaserr);
|
||||
code = GRIB_DECODING_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
jpeg = jas_stream_memopen((char*)buf, *buflen);
|
||||
if (!jpeg) {
|
||||
|
@ -37,9 +86,9 @@ int grib_jasper_decode(grib_context* c, unsigned char* buf, size_t* buflen, doub
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
grib_context_log(c, GRIB_LOG_DEBUG, "grib_jasper_decode: Jasper version %s", jas_getversion());
|
||||
grib_context_log(c, GRIB_LOG_DEBUG, "grib_jasper_decode: JasPer version %s", jas_getversion());
|
||||
|
||||
image = jpc_decode(jpeg, NULL);
|
||||
image = ecc_jasper_decode(jpeg);
|
||||
if (!image) {
|
||||
code = GRIB_DECODING_ERROR;
|
||||
goto cleanup;
|
||||
|
@ -54,15 +103,19 @@ int grib_jasper_decode(grib_context* c, unsigned char* buf, size_t* buflen, doub
|
|||
}
|
||||
|
||||
matrix = jas_matrix_create(jas_image_height(image), jas_image_width(image));
|
||||
|
||||
if (!matrix) {
|
||||
code = GRIB_DECODING_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
jas_image_readcmpt(image, 0, 0, 0, jas_image_width(image), jas_image_height(image), matrix);
|
||||
jaserr = jas_image_readcmpt(image, 0, 0, 0, jas_image_width(image), jas_image_height(image), matrix);
|
||||
if (jaserr) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "grib_jasper_decode: Failed to read JasPer component data. JasPer error %d", jaserr);
|
||||
code = GRIB_DECODING_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Assert(p->height_ * p->width_ == *no_values);
|
||||
Assert(p->height_ * p->width_ == *n_vals);
|
||||
|
||||
k = 0;
|
||||
for (i = 0; i < p->height_; i++)
|
||||
|
@ -77,6 +130,7 @@ cleanup:
|
|||
jas_image_destroy(image);
|
||||
if (jpeg)
|
||||
jas_stream_close(jpeg);
|
||||
ecc_jasper_cleanup();
|
||||
|
||||
return code;
|
||||
}
|
||||
|
@ -84,7 +138,7 @@ cleanup:
|
|||
int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
|
||||
{
|
||||
int code = GRIB_SUCCESS;
|
||||
int jaserr;
|
||||
int jaserr = 0;
|
||||
|
||||
char opts[MAXOPTSSIZE];
|
||||
double reference_value = helper->reference_value;
|
||||
|
@ -156,7 +210,7 @@ int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
|
|||
}
|
||||
}
|
||||
|
||||
/*jas_init();*/
|
||||
ecc_jasper_initialise();
|
||||
|
||||
opts[0] = 0;
|
||||
|
||||
|
@ -166,7 +220,7 @@ int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
|
|||
}
|
||||
|
||||
Assert(cmpt.width_ * cmpt.height_ * cmpt.cps_ == buflen);
|
||||
grib_context_log(c, GRIB_LOG_DEBUG, "grib_jasper_encode: Jasper version %s", jas_getversion());
|
||||
grib_context_log(c, GRIB_LOG_DEBUG, "grib_jasper_encode: JasPer version %s", jas_getversion());
|
||||
|
||||
pcmpt = &cmpt;
|
||||
image.cmpts_ = &pcmpt;
|
||||
|
@ -175,12 +229,12 @@ int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
|
|||
cmpt.stream_ = istream;
|
||||
|
||||
jpcstream = jas_stream_memopen((char*)helper->jpeg_buffer, helper->buffer_size);
|
||||
jaserr = jpc_encode(&image, jpcstream, opts);
|
||||
|
||||
if (jaserr != 0) {
|
||||
/* increase the number of guard bits */
|
||||
jaserr = ecc_jasper_encode(&image, jpcstream, opts);
|
||||
if (jaserr) {
|
||||
/* Failed to encode. Increase the number of guard bits */
|
||||
strcat(opts, "\nnumgbits=4");
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "JASPER: error %d, increasing the number of guard bits", jaserr);
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "grib_jasper_encode: JasPer error %d, increasing the number of guard bits", jaserr);
|
||||
jas_stream_close(istream);
|
||||
istream = 0;
|
||||
jas_stream_close(jpcstream);
|
||||
|
@ -189,11 +243,11 @@ int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
|
|||
istream = jas_stream_memopen((char*)encoded, buflen);
|
||||
cmpt.stream_ = istream;
|
||||
jpcstream = jas_stream_memopen((char*)helper->jpeg_buffer, helper->buffer_size);
|
||||
jaserr = jpc_encode(&image, jpcstream, opts);
|
||||
jaserr = ecc_jasper_encode(&image, jpcstream, opts);
|
||||
}
|
||||
|
||||
if (jaserr != 0) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "JASPER: error %d", jaserr);
|
||||
if (jaserr) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "grib_jasper_encode: Failed to encode. JasPer error %d", jaserr);
|
||||
code = GRIB_ENCODING_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -210,23 +264,23 @@ cleanup:
|
|||
jas_stream_close(istream);
|
||||
if (jpcstream)
|
||||
jas_stream_close(jpcstream);
|
||||
|
||||
ecc_jasper_cleanup();
|
||||
return code;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int grib_jasper_decode(grib_context* c, unsigned char* buf, size_t* buflen, double* val, size_t* n_vals)
|
||||
int grib_jasper_decode(grib_context* c, unsigned char* buf, const size_t* buflen, double* val, const size_t* n_vals)
|
||||
{
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_accessor_data_jpeg2000_packing: Jasper JPEG support not enabled.");
|
||||
"grib_accessor_data_jpeg2000_packing: JasPer JPEG support not enabled.");
|
||||
return GRIB_FUNCTIONALITY_NOT_ENABLED;
|
||||
}
|
||||
|
||||
int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
|
||||
{
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_accessor_data_jpeg2000_packing: Jasper JPEG support not enabled.");
|
||||
"grib_accessor_data_jpeg2000_packing: JasPer JPEG support not enabled.");
|
||||
return GRIB_FUNCTIONALITY_NOT_ENABLED;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ void grib_oarray_delete(grib_context* c, grib_oarray* v)
|
|||
grib_context_free(c, v);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void grib_oarray_delete_content(grib_context* c, grib_oarray* v)
|
||||
{
|
||||
int i;
|
||||
|
@ -90,12 +91,14 @@ void grib_oarray_delete_content(grib_context* c, grib_oarray* v)
|
|||
if (!c)
|
||||
c = grib_context_get_default();
|
||||
for (i = 0; i < v->n; i++) {
|
||||
if (v->v[i])
|
||||
if (v->v[i]) {
|
||||
grib_context_free(c, v->v[i]);
|
||||
v->v[i] = 0;
|
||||
v->v[i] = 0;
|
||||
}
|
||||
}
|
||||
v->n = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void** grib_oarray_get_array(grib_context* c, grib_oarray* v)
|
||||
{
|
||||
|
|
|
@ -382,8 +382,9 @@ void grib_trie_with_rank_delete_container(grib_trie_with_rank* t)
|
|||
GRIB_MUTEX_UNLOCK(&mutex);
|
||||
}
|
||||
|
||||
/*
|
||||
static void grib_trie_with_rank_delete_list(grib_context* c,grib_trie_with_rank_list *list) {
|
||||
#if 0
|
||||
static void grib_trie_with_rank_delete_list(grib_context* c,grib_trie_with_rank_list *list)
|
||||
{
|
||||
grib_trie_with_rank_list* next=list;
|
||||
grib_trie_with_rank_list* p;
|
||||
while (next) {
|
||||
|
@ -393,7 +394,6 @@ static void grib_trie_with_rank_delete_list(grib_context* c,grib_trie_with_rank_
|
|||
grib_context_free( c, p );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void grib_trie_with_rank_delete(grib_trie_with_rank* t)
|
||||
{
|
||||
|
@ -434,7 +434,6 @@ void grib_trie_with_rank_clear(grib_trie_with_rank* t)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
static void grib_trie_with_rank_insert_in_list(grib_trie_with_rank* t,void* data) {
|
||||
if (t->list==NULL) {
|
||||
t->list=grib_context_malloc_clear(t->context,sizeof(grib_trie_with_rank_list));
|
||||
|
@ -448,7 +447,7 @@ static void grib_trie_with_rank_insert_in_list(grib_trie_with_rank* t,void* data
|
|||
t->last_list->rank++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
int grib_trie_with_rank_insert(grib_trie_with_rank* t, const char* key, void* data)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ list(APPEND test_bins
|
|||
read_any
|
||||
julian
|
||||
grib_indexing
|
||||
grib_fieldset
|
||||
grib_multi_from_message
|
||||
grib_read_index
|
||||
unit_tests
|
||||
|
@ -215,6 +216,7 @@ if( HAVE_BUILD_TOOLS )
|
|||
grib_nearest_test
|
||||
pseudo_budg
|
||||
grib_gridType
|
||||
grib_fieldset
|
||||
grib_octahedral
|
||||
grib_grid_mercator
|
||||
grib_global
|
||||
|
|
|
@ -57,5 +57,14 @@ for f in $files; do
|
|||
rm -f $temp
|
||||
done
|
||||
|
||||
# ECC-989: Valgrind error: setting 'unpack=1' before setting unexpandedDescriptors
|
||||
# ---------------------------------------------------------------------------------
|
||||
f="$ECCODES_SAMPLES_PATH/BUFR4.tmpl"
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
set unexpandedDescriptors={4025};
|
||||
EOF
|
||||
${tools_dir}/codes_bufr_filter $fRules $f
|
||||
|
||||
|
||||
rm -f $fRules $fLog $temp
|
||||
|
|
|
@ -173,9 +173,16 @@ ${tools_dir}/bufr_set -s ident=' AB CD ' $f $fBufrTmp
|
|||
result=`${tools_dir}/bufr_get -p ident $fBufrTmp`
|
||||
[ "$result" = "AB CD" ]
|
||||
|
||||
|
||||
# ${tools_dir}/bufr_compare $f $fBufrTmp
|
||||
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# ECC-1359: string that can be converted to an integer
|
||||
# ----------------------------------------------------------
|
||||
${tools_dir}/bufr_set -s messageLength:s=333 $ECCODES_SAMPLES_PATH/BUFR4_local.tmpl $fBufrTmp
|
||||
result=`${tools_dir}/bufr_get -p messageLength $fBufrTmp`
|
||||
[ "$result" = "333" ]
|
||||
|
||||
# Clean up
|
||||
rm -f $fLog
|
||||
rm -f $fBufrTmp
|
||||
|
|
|
@ -113,6 +113,24 @@ ${tools_dir}/grib_set -s setLocalDefinition=1,localDefinitionNumber=1 $temp $tem
|
|||
${tools_dir}/grib_compare -b totalLength,numberOfSection $temp $temp1
|
||||
grib_check_key_equals $temp1 localUsePresent 1
|
||||
|
||||
# Check local ECMWF chemicals/aerosols
|
||||
# ------------------------------------
|
||||
${tools_dir}/grib_set -s paramId=217232 $sample2 $temp
|
||||
${tools_dir}/grib_dump -O -p constituentType $temp > $temp1
|
||||
grep -q "Biomass burning volatile organic compounds .*grib2/tables/local/ecmf/1/4.230.table" $temp1
|
||||
|
||||
${tools_dir}/grib_set -s paramId=219231 $sample2 $temp
|
||||
${tools_dir}/grib_dump -O -p constituentType $temp > $temp1
|
||||
grep -q "Anthropogenic volatile organic compounds .*grib2/tables/local/ecmf/1/4.230.table" $temp1
|
||||
|
||||
${tools_dir}/grib_set -s paramId=211248 $sample2 $temp
|
||||
${tools_dir}/grib_dump -O -p aerosolType $temp > $temp1
|
||||
grep -q "Nitrate Coarse Mode .*grib2/tables/local/ecmf/1/4.233.table" $temp1
|
||||
|
||||
${tools_dir}/grib_set -s paramId=215189 $sample2 $temp
|
||||
${tools_dir}/grib_dump -O -p aerosolType $temp > $temp1
|
||||
grep -q "Nitrate Fine Mode .*grib2/tables/local/ecmf/1/4.233.table" $temp1
|
||||
grib_check_key_equals $temp aerosolTypeName "Nitrate Fine Mode"
|
||||
|
||||
# Clean up
|
||||
rm -f $tempSample
|
||||
rm -f $temp $temp1
|
||||
rm -f $tempSample $temp $temp1
|
||||
|
|
|
@ -21,16 +21,6 @@ outfile2=temp.$label.2
|
|||
|
||||
rm -f $outfile1 $outfile2
|
||||
|
||||
# Use the sample file with CCSDS packing
|
||||
# ---------------------------------------
|
||||
sample_ccsds=$ECCODES_SAMPLES_PATH/ccsds_grib2.tmpl
|
||||
${tools_dir}/grib_filter -o $outfile1 - $sample_ccsds << EOF
|
||||
set values = { 55.0161, 99.7008 };
|
||||
write;
|
||||
EOF
|
||||
grib_check_key_equals $outfile1 packingType grid_ccsds
|
||||
stats=`${tools_dir}/grib_get -M -F%.4f -p min,max $outfile1`
|
||||
[ "$stats" = "55.0161 99.7008" ]
|
||||
|
||||
# ECC-1263
|
||||
# ---------
|
||||
|
@ -111,5 +101,12 @@ ${tools_dir}/grib_compare -b $BLACKLIST $infile $outfile1
|
|||
${tools_dir}/grib_compare -c data:n $outfile1 $outfile2
|
||||
|
||||
|
||||
# ECC-1362
|
||||
# ---------
|
||||
infile=${data_dir}/ccsds_szip.grib2
|
||||
res=`${tools_dir}/grib_get '-F%.3f' -p min,max,avg $infile`
|
||||
[ "$res" = "-180.000 180.000 -0.044" ]
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $outfile1 $outfile2
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
label="grib_dump_samples_test"
|
||||
temp=${label}".temp"
|
||||
|
||||
sample_ccsds="$ECCODES_SAMPLES_PATH/ccsds_grib2.tmpl"
|
||||
|
||||
# Test selected sample GRIB files
|
||||
samples="
|
||||
GRIB1.tmpl
|
||||
|
@ -25,9 +27,10 @@ samples="
|
|||
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
|
||||
|
||||
for sfile in $samples; do
|
||||
sample="$ECCODES_SAMPLES_PATH/$sfile"
|
||||
${tools_dir}/grib_dump -O $sample >/dev/null
|
||||
done
|
||||
|
||||
# Test grib_dump with -t option
|
||||
|
@ -37,5 +40,16 @@ grep -q "codetable (int) typeOfSecondFixedSurface" $temp
|
|||
grep -q "ieeefloat (double) referenceValue" $temp
|
||||
grep -q "unsigned (int) numberOfSection" $temp
|
||||
|
||||
# Extra tests for CCSDS
|
||||
if [ $HAVE_AEC -eq 1 ]; then
|
||||
${tools_dir}/grib_dump -O $sample_ccsds >/dev/null
|
||||
rm -f $temp
|
||||
echo 'set values = { 55.0161, 66.666, 99.7008 };write;' |\
|
||||
${tools_dir}/grib_filter -o $temp - $sample_ccsds
|
||||
grib_check_key_equals $temp packingType,numberOfValues 'grid_ccsds 3'
|
||||
stats=`${tools_dir}/grib_get -M -F%.4f -p min,max $temp`
|
||||
[ "$stats" = "55.0161 99.7008" ]
|
||||
${tools_dir}/grib_dump -O $temp
|
||||
fi
|
||||
|
||||
rm -f $temp
|
||||
|
|
|
@ -54,7 +54,6 @@ static int encode_file(char* input_file, char* output_file)
|
|||
grib_handle* source_handle = NULL;
|
||||
const void* buffer = NULL;
|
||||
int err = 0;
|
||||
size_t str_len = 0;
|
||||
|
||||
FILE* in = fopen(input_file, "rb");
|
||||
FILE* out = fopen(output_file, "wb");
|
||||
|
@ -89,7 +88,7 @@ static int encode_file(char* input_file, char* output_file)
|
|||
GRIB_CHECK(grib_set_long(clone_handle, "bitsPerValue", 16), 0);
|
||||
|
||||
/*GRIB_CHECK(grib_set_string(clone_handle, "packingType", "grid_ccsds", &str_len), 0);*/
|
||||
GRIB_CHECK(grib_set_string(clone_handle, "packingType", "grid_simple", &str_len), 0);
|
||||
/*GRIB_CHECK(grib_set_string(clone_handle, "packingType", "grid_simple", &str_len), 0);*/
|
||||
|
||||
GRIB_CHECK(grib_set_double_array(clone_handle, "values", values, values_len), 0);
|
||||
|
||||
|
@ -118,7 +117,7 @@ void do_stuff(void* arg)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < FILES_PER_ITERATION; i++) {
|
||||
sprintf(output_file, "temp.grib_encode_pthreads.out_%d-%d.grib", (int)number, i);
|
||||
sprintf(output_file, "temp.grib_encode_pthreads_test.out_%d-%d.grib", (int)number, i);
|
||||
encode_file(INPUT_FILE, output_file);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue