mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' into feature/grid_complex_encoding
This commit is contained in:
commit
a43903ac52
|
@ -2230,6 +2230,16 @@
|
|||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Accumulated mass emission of methane from Wetlands
|
||||
'acc_e_WLCH4' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 20 ;
|
||||
parameterNumber = 3 ;
|
||||
constituentType = 2 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Convective precipitation
|
||||
'cp' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# UERRA local section
|
||||
|
||||
constant localDefinitionNumber=0;
|
||||
|
||||
ksec1expver[4] experimentVersionNumber = "0002" : dump;
|
||||
alias marsExpver = experimentVersionNumber ;
|
||||
|
|
@ -2230,6 +2230,16 @@
|
|||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Accumulated mass emission of methane from Wetlands
|
||||
'Accumulated mass emission of methane from Wetlands' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 20 ;
|
||||
parameterNumber = 3 ;
|
||||
constituentType = 2 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Convective precipitation
|
||||
'Convective precipitation' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -2230,6 +2230,16 @@
|
|||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Accumulated mass emission of methane from Wetlands
|
||||
'228109' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 20 ;
|
||||
parameterNumber = 3 ;
|
||||
constituentType = 2 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Convective precipitation
|
||||
'228143' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# Uncertainties in ensembles of regional re-analysis project (UERRA)
|
||||
if(localUsePresent == 0){
|
||||
constant marsExpver = 'prod';
|
||||
} else {
|
||||
constant marsExpver = experimentVersionNumber;
|
||||
}
|
||||
include "grib2/products_uerra.def"
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# Uncertainties in ensembles of regional re-analysis project test (UERRA)
|
||||
if(localUsePresent == 0){
|
||||
constant marsExpver = 'test';
|
||||
} else {
|
||||
constant marsExpver = experimentVersionNumber;
|
||||
}
|
||||
include "grib2/products_uerra.def"
|
||||
|
|
|
@ -34,7 +34,14 @@ if(typeOfFirstFixedSurface == 151 && typeOfSecondFixedSurface == 151) {
|
|||
#alias mars.levelist = level;
|
||||
}
|
||||
|
||||
alias mars.expver = marsExpver;
|
||||
# if there is a local section, we take the experimentVersionNumber
|
||||
if(localUsePresent == 1){
|
||||
alias mars.expver = experimentVersionNumber;
|
||||
}
|
||||
if(localUsePresent == 0){
|
||||
alias mars.expver = marsExpver;
|
||||
}
|
||||
|
||||
alias mars.class = marsClass;
|
||||
alias mars.param = paramId;
|
||||
alias mars.origin = centre;
|
||||
|
|
|
@ -16,6 +16,12 @@ if ( addEmptySection2 == 0 ) {
|
|||
if ( grib2LocalSectionPresent==1 or ( section2Length>5 or new() ) ) {
|
||||
alias section2Used=one;
|
||||
|
||||
if(productionStatusOfProcessedData == 8 || productionStatusOfProcessedData == 9) {
|
||||
# This for adding an expver other than prod/test to UERRA
|
||||
codetable[2] uerraLocalVersion 'grib2/uerraLocalVersion.table' = 1 : dump;
|
||||
template uerraSection "grib2/local.uerra.[uerraLocalVersion:l].def";
|
||||
}
|
||||
|
||||
if(productionStatusOfProcessedData == 4 || productionStatusOfProcessedData == 5) {
|
||||
# This is TIGGE-LAM because of the productionStatusOfProcessedData and the non-empty section 2
|
||||
codetable[2] tiggeLocalVersion 'grib2/tiggeLocalVersion.table' = 1 : dump;
|
||||
|
|
|
@ -2230,6 +2230,16 @@
|
|||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Accumulated mass emission of methane from Wetlands
|
||||
'acc_e_WLCH4' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 20 ;
|
||||
parameterNumber = 3 ;
|
||||
constituentType = 2 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Convective precipitation
|
||||
'cp' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# Grid point data - Simple packing with logarithmic preprocessing
|
||||
constant typeOfPreProcessing=1;
|
||||
|
||||
# Note from WMO document:
|
||||
# This template is experimental, was not validated at the time of publication and should be used only for bilateral previously agreed tests
|
||||
constant typeOfPreProcessing = 1;
|
||||
|
||||
include "grib2/template.5.packing.def";
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 7.6, Grid point data - simple packing with preprocessing
|
||||
# TEMPLATE 7.61, Grid point data - simple packing with logarithm pre-processing
|
||||
|
||||
# Note from WMO document:
|
||||
# This template is experimental, was not validated at the time of publication and should be used only for bilateral previously agreed tests
|
||||
|
||||
# Octets 6-nn : Binary data values - binary string, with each (scaled)
|
||||
|
||||
meta codedValues data_g2simple_packing_with_preprocessing(
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1 UERRA UERRA with expver
|
|
@ -2230,6 +2230,16 @@
|
|||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Accumulated mass emission of methane from Wetlands
|
||||
'kg m**-2' = {
|
||||
discipline = 0 ;
|
||||
parameterCategory = 20 ;
|
||||
parameterNumber = 3 ;
|
||||
constituentType = 2 ;
|
||||
typeOfStatisticalProcessing = 1 ;
|
||||
is_chemical_srcsink = 1 ;
|
||||
sourceSinkChemicalPhysicalProcess = 10 ;
|
||||
}
|
||||
#Convective precipitation
|
||||
'kg m**-2' = {
|
||||
discipline = 0 ;
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
# pragma once
|
||||
/*
|
||||
* (C) Copyright 2005- ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
*/
|
||||
|
||||
#include "grib_api_internal_cpp.h"
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
|
||||
/*
|
||||
This is used by make_class.pl
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
|
||||
#include "grib_api_internal_cpp.h"
|
||||
#include <type_traits>
|
||||
|
||||
/*
|
||||
This is used by make_class.pl
|
||||
|
@ -174,18 +173,17 @@ static void init_class(grib_accessor_class* c)
|
|||
static void init(grib_accessor* a, const long v, grib_arguments* args)
|
||||
{
|
||||
grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a;
|
||||
grib_handle* h = grib_handle_of_accessor(a);
|
||||
|
||||
self->number_of_values = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
|
||||
self->reference_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
|
||||
self->binary_scale_factor = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
|
||||
self->decimal_scale_factor = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
|
||||
self->bits_per_value = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
|
||||
|
||||
self->number_of_data_points = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
|
||||
|
||||
self->ccsds_flags = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
|
||||
self->ccsds_block_size = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
|
||||
self->ccsds_rsi = grib_arguments_get_name(grib_handle_of_accessor(a), args, self->carg++);
|
||||
self->number_of_values = grib_arguments_get_name(h, args, self->carg++);
|
||||
self->reference_value = grib_arguments_get_name(h, args, self->carg++);
|
||||
self->binary_scale_factor = grib_arguments_get_name(h, args, self->carg++);
|
||||
self->decimal_scale_factor = grib_arguments_get_name(h, args, self->carg++);
|
||||
self->bits_per_value = grib_arguments_get_name(h, args, self->carg++);
|
||||
self->number_of_data_points = grib_arguments_get_name(h, args, self->carg++);
|
||||
self->ccsds_flags = grib_arguments_get_name(h, args, self->carg++);
|
||||
self->ccsds_block_size = grib_arguments_get_name(h, args, self->carg++);
|
||||
self->ccsds_rsi = grib_arguments_get_name(h, args, self->carg++);
|
||||
|
||||
a->flags |= GRIB_ACCESSOR_FLAG_DATA;
|
||||
}
|
||||
|
@ -685,7 +683,7 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array
|
|||
static void print_error_feature_not_enabled(grib_context* c)
|
||||
{
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_accessor_data_ccsds_packing: CCSDS support not enabled. "
|
||||
"CCSDS support not enabled. "
|
||||
"Please rebuild with -DENABLE_AEC=ON (Adaptive Entropy Coding library)");
|
||||
}
|
||||
static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
|
||||
#include "grib_api_internal_cpp.h"
|
||||
#include <type_traits>
|
||||
#include <math.h>
|
||||
/*
|
||||
This is used by make_class.pl
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
SUPER = grib_accessor_class_data_simple_packing
|
||||
IMPLEMENTS = init
|
||||
IMPLEMENTS = pack_double
|
||||
IMPLEMENTS = unpack_double
|
||||
IMPLEMENTS = unpack_double;unpack_float
|
||||
IMPLEMENTS = unpack_double_element;unpack_double_element_set
|
||||
IMPLEMENTS = value_count
|
||||
MEMBERS=const char* half_byte
|
||||
|
@ -54,6 +54,7 @@ or edit "accessor.class" and rerun ./make_class.pl
|
|||
|
||||
static int pack_double(grib_accessor*, const double* val, size_t* len);
|
||||
static int unpack_double(grib_accessor*, double* val, size_t* len);
|
||||
static int unpack_float(grib_accessor*, float* val, size_t* len);
|
||||
static int value_count(grib_accessor*, long*);
|
||||
static void init(grib_accessor*, const long, grib_arguments*);
|
||||
static void init_class(grib_accessor_class*);
|
||||
|
@ -126,7 +127,7 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_constant_wid
|
|||
&pack_double, /* grib_pack procedures double */
|
||||
0, /* grib_pack procedures float */
|
||||
&unpack_double, /* grib_unpack procedures double */
|
||||
0, /* grib_unpack procedures float */
|
||||
&unpack_float, /* grib_unpack procedures float */
|
||||
0, /* grib_pack procedures string */
|
||||
0, /* grib_unpack procedures string */
|
||||
0, /* grib_pack array procedures string */
|
||||
|
@ -168,7 +169,6 @@ static void init_class(grib_accessor_class* c)
|
|||
c->pack_long = (*(c->super))->pack_long;
|
||||
c->unpack_long = (*(c->super))->unpack_long;
|
||||
c->pack_float = (*(c->super))->pack_float;
|
||||
c->unpack_float = (*(c->super))->unpack_float;
|
||||
c->pack_string = (*(c->super))->pack_string;
|
||||
c->unpack_string = (*(c->super))->unpack_string;
|
||||
c->pack_string_array = (*(c->super))->pack_string_array;
|
||||
|
@ -228,6 +228,11 @@ static int value_count(grib_accessor* a, long* numberOfSecondOrderPackedValues)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int unpack_float(grib_accessor*, float* val, size_t* len)
|
||||
{
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int unpack_double(grib_accessor* a, double* values, size_t* len)
|
||||
{
|
||||
grib_accessor_data_g1second_order_constant_width_packing* self = (grib_accessor_data_g1second_order_constant_width_packing*)a;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
SUPER = grib_accessor_class_data_simple_packing
|
||||
IMPLEMENTS = init
|
||||
IMPLEMENTS = pack_double
|
||||
IMPLEMENTS = unpack_double
|
||||
IMPLEMENTS = unpack_double;unpack_float
|
||||
IMPLEMENTS = unpack_double_element;unpack_double_element_set
|
||||
IMPLEMENTS = value_count
|
||||
IMPLEMENTS = destroy
|
||||
|
@ -65,6 +65,7 @@ or edit "accessor.class" and rerun ./make_class.pl
|
|||
|
||||
static int pack_double(grib_accessor*, const double* val, size_t* len);
|
||||
static int unpack_double(grib_accessor*, double* val, size_t* len);
|
||||
static int unpack_float(grib_accessor*, float* val, size_t* len);
|
||||
static int value_count(grib_accessor*, long*);
|
||||
static void destroy(grib_context*, grib_accessor*);
|
||||
static void init(grib_accessor*, const long, grib_arguments*);
|
||||
|
@ -146,7 +147,7 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_general_exte
|
|||
&pack_double, /* grib_pack procedures double */
|
||||
0, /* grib_pack procedures float */
|
||||
&unpack_double, /* grib_unpack procedures double */
|
||||
0, /* grib_unpack procedures float */
|
||||
&unpack_float, /* grib_unpack procedures float */
|
||||
0, /* grib_pack procedures string */
|
||||
0, /* grib_unpack procedures string */
|
||||
0, /* grib_pack array procedures string */
|
||||
|
@ -188,7 +189,6 @@ static void init_class(grib_accessor_class* c)
|
|||
c->pack_long = (*(c->super))->pack_long;
|
||||
c->unpack_long = (*(c->super))->unpack_long;
|
||||
c->pack_float = (*(c->super))->pack_float;
|
||||
c->unpack_float = (*(c->super))->unpack_float;
|
||||
c->pack_string = (*(c->super))->pack_string;
|
||||
c->unpack_string = (*(c->super))->unpack_string;
|
||||
c->pack_string_array = (*(c->super))->pack_string_array;
|
||||
|
@ -374,6 +374,10 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
static int unpack_float(grib_accessor*, float* val, size_t* len)
|
||||
{
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int unpack_double(grib_accessor* a, double* values, size_t* len)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
SUPER = grib_accessor_class_data_simple_packing
|
||||
IMPLEMENTS = init
|
||||
IMPLEMENTS = pack_double
|
||||
IMPLEMENTS = unpack_double
|
||||
IMPLEMENTS = unpack_double;unpack_float
|
||||
IMPLEMENTS = value_count
|
||||
MEMBERS=const char* half_byte
|
||||
MEMBERS=const char* packingType
|
||||
|
@ -53,6 +53,7 @@ or edit "accessor.class" and rerun ./make_class.pl
|
|||
|
||||
static int pack_double(grib_accessor*, const double* val, size_t* len);
|
||||
static int unpack_double(grib_accessor*, double* val, size_t* len);
|
||||
static int unpack_float(grib_accessor*, float* val, size_t* len);
|
||||
static int value_count(grib_accessor*, long*);
|
||||
static void init(grib_accessor*, const long, grib_arguments*);
|
||||
static void init_class(grib_accessor_class*);
|
||||
|
@ -123,7 +124,7 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_general_pack
|
|||
&pack_double, /* grib_pack procedures double */
|
||||
0, /* grib_pack procedures float */
|
||||
&unpack_double, /* grib_unpack procedures double */
|
||||
0, /* grib_unpack procedures float */
|
||||
&unpack_float, /* grib_unpack procedures float */
|
||||
0, /* grib_pack procedures string */
|
||||
0, /* grib_unpack procedures string */
|
||||
0, /* grib_pack array procedures string */
|
||||
|
@ -165,7 +166,6 @@ static void init_class(grib_accessor_class* c)
|
|||
c->pack_long = (*(c->super))->pack_long;
|
||||
c->unpack_long = (*(c->super))->unpack_long;
|
||||
c->pack_float = (*(c->super))->pack_float;
|
||||
c->unpack_float = (*(c->super))->unpack_float;
|
||||
c->pack_string = (*(c->super))->pack_string;
|
||||
c->unpack_string = (*(c->super))->unpack_string;
|
||||
c->pack_string_array = (*(c->super))->pack_string_array;
|
||||
|
@ -227,6 +227,11 @@ static int value_count(grib_accessor* a, long* numberOfSecondOrderPackedValues)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int unpack_float(grib_accessor*, float* val, size_t* len)
|
||||
{
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int unpack_double(grib_accessor* a, double* values, size_t* len)
|
||||
{
|
||||
grib_accessor_data_g1second_order_general_packing* self = (grib_accessor_data_g1second_order_general_packing*)a;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
SUPER = grib_accessor_class_data_simple_packing
|
||||
IMPLEMENTS = init
|
||||
IMPLEMENTS = pack_double
|
||||
IMPLEMENTS = unpack_double
|
||||
IMPLEMENTS = unpack_double;unpack_float
|
||||
IMPLEMENTS = value_count
|
||||
MEMBERS=const char* half_byte
|
||||
MEMBERS=const char* packingType
|
||||
|
@ -53,6 +53,7 @@ or edit "accessor.class" and rerun ./make_class.pl
|
|||
|
||||
static int pack_double(grib_accessor*, const double* val, size_t* len);
|
||||
static int unpack_double(grib_accessor*, double* val, size_t* len);
|
||||
static int unpack_float(grib_accessor*, float* val, size_t* len);
|
||||
static int value_count(grib_accessor*, long*);
|
||||
static void init(grib_accessor*, const long, grib_arguments*);
|
||||
static void init_class(grib_accessor_class*);
|
||||
|
@ -123,7 +124,7 @@ static grib_accessor_class _grib_accessor_class_data_g1second_order_row_by_row_p
|
|||
&pack_double, /* grib_pack procedures double */
|
||||
0, /* grib_pack procedures float */
|
||||
&unpack_double, /* grib_unpack procedures double */
|
||||
0, /* grib_unpack procedures float */
|
||||
&unpack_float, /* grib_unpack procedures float */
|
||||
0, /* grib_pack procedures string */
|
||||
0, /* grib_unpack procedures string */
|
||||
0, /* grib_pack array procedures string */
|
||||
|
@ -165,7 +166,6 @@ static void init_class(grib_accessor_class* c)
|
|||
c->pack_long = (*(c->super))->pack_long;
|
||||
c->unpack_long = (*(c->super))->unpack_long;
|
||||
c->pack_float = (*(c->super))->pack_float;
|
||||
c->unpack_float = (*(c->super))->unpack_float;
|
||||
c->pack_string = (*(c->super))->pack_string;
|
||||
c->unpack_string = (*(c->super))->unpack_string;
|
||||
c->pack_string_array = (*(c->super))->pack_string_array;
|
||||
|
@ -291,6 +291,11 @@ static int value_count(grib_accessor* a, long* count)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int unpack_float(grib_accessor*, float* val, size_t* len)
|
||||
{
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int unpack_double(grib_accessor* a, double* values, size_t* len)
|
||||
{
|
||||
grib_accessor_data_g1second_order_row_by_row_packing* self = (grib_accessor_data_g1second_order_row_by_row_packing*)a;
|
||||
|
|
|
@ -8,15 +8,10 @@
|
|||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
/***********************************
|
||||
* Enrico Fucile
|
||||
**********************************/
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
#define DIRECT 0
|
||||
#define INVERSE 1
|
||||
|
||||
|
||||
/*
|
||||
This is used by make_class.pl
|
||||
|
||||
|
@ -33,9 +28,6 @@
|
|||
|
||||
*/
|
||||
|
||||
static int pre_processing_func(double* values, long length, long pre_processing,
|
||||
double* pre_processing_parameter, int mode);
|
||||
|
||||
/* START_CLASS_IMP */
|
||||
|
||||
/*
|
||||
|
@ -189,6 +181,70 @@ static int value_count(grib_accessor* a, long* n_vals)
|
|||
return grib_get_long_internal(grib_handle_of_accessor(a), self->number_of_values, n_vals);
|
||||
}
|
||||
|
||||
static int pre_processing_func(double* values, long length, long pre_processing,
|
||||
double* pre_processing_parameter, int mode)
|
||||
{
|
||||
int i = 0, ret = 0;
|
||||
double min = values[0];
|
||||
double next_min = values[0];
|
||||
Assert(length > 0);
|
||||
|
||||
switch (pre_processing) {
|
||||
/* NONE */
|
||||
case 0:
|
||||
break;
|
||||
/* LOGARITHM */
|
||||
case 1:
|
||||
if (mode == DIRECT) {
|
||||
for (i = 0; i < length; i++) {
|
||||
if (values[i] < min)
|
||||
min = values[i];
|
||||
if (values[i] > next_min)
|
||||
next_min = values[i];
|
||||
}
|
||||
for (i = 0; i < length; i++) {
|
||||
if (values[i] > min && values[i] < next_min)
|
||||
next_min = values[i];
|
||||
}
|
||||
if (min > 0) {
|
||||
*pre_processing_parameter = 0;
|
||||
for (i = 0; i < length; i++) {
|
||||
DebugAssert(values[i] > 0);
|
||||
values[i] = log(values[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
double ppp = 0;
|
||||
*pre_processing_parameter = next_min - 2 * min;
|
||||
if (next_min == min)
|
||||
return ret;
|
||||
ppp = *pre_processing_parameter;
|
||||
for (i = 0; i < length; i++) {
|
||||
DebugAssert((values[i] + ppp) > 0);
|
||||
values[i] = log(values[i] + ppp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Assert(mode == INVERSE);
|
||||
if (*pre_processing_parameter == 0) {
|
||||
for (i = 0; i < length; i++)
|
||||
values[i] = exp(values[i]);
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < length; i++)
|
||||
values[i] = exp(values[i]) - *pre_processing_parameter;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = GRIB_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
||||
{
|
||||
grib_accessor_data_g2simple_packing_with_preprocessing* self = (grib_accessor_data_g2simple_packing_with_preprocessing*)a;
|
||||
|
@ -215,12 +271,10 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
|||
self->dirty = 0;
|
||||
|
||||
if ((err = grib_get_long_internal(grib_handle_of_accessor(a), self->pre_processing, &pre_processing)) != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor %s cannont gather value for %s error %d \n", a->name, self->pre_processing, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
if ((err = grib_get_double_internal(grib_handle_of_accessor(a), self->pre_processing_parameter, &pre_processing_parameter)) != GRIB_SUCCESS) {
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor %s cannont gather value for %s error %d \n", a->name, self->pre_processing_parameter, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -271,67 +325,3 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
static int pre_processing_func(double* values, long length, long pre_processing,
|
||||
double* pre_processing_parameter, int mode)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
double min = values[0];
|
||||
double next_min = values[0];
|
||||
Assert(length > 0);
|
||||
|
||||
switch (pre_processing) {
|
||||
/* NONE */
|
||||
case 0:
|
||||
break;
|
||||
/* LOGARITHM */
|
||||
case 1:
|
||||
if (mode == DIRECT) {
|
||||
for (i = 0; i < length; i++) {
|
||||
if (values[i] < min)
|
||||
min = values[i];
|
||||
if (values[i] > next_min)
|
||||
next_min = values[i];
|
||||
}
|
||||
for (i = 0; i < length; i++) {
|
||||
if (values[i] > min && values[i] < next_min)
|
||||
next_min = values[i];
|
||||
}
|
||||
if (min > 0) {
|
||||
*pre_processing_parameter = 0;
|
||||
for (i = 0; i < length; i++) {
|
||||
DebugAssert(values[i] > 0);
|
||||
values[i] = log(values[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
double ppp = 0;
|
||||
*pre_processing_parameter = next_min - 2 * min;
|
||||
if (next_min == min)
|
||||
return ret;
|
||||
ppp = *pre_processing_parameter;
|
||||
for (i = 0; i < length; i++) {
|
||||
DebugAssert((values[i] + ppp) > 0);
|
||||
values[i] = log(values[i] + ppp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (*pre_processing_parameter == 0) {
|
||||
for (i = 0; i < length; i++)
|
||||
values[i] = exp(values[i]);
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < length; i++)
|
||||
values[i] = exp(values[i]) - *pre_processing_parameter;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = GRIB_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -583,20 +583,25 @@ cleanup:
|
|||
}
|
||||
#else
|
||||
|
||||
static void print_error_feature_not_enabled(grib_context* c)
|
||||
{
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"JPEG support not enabled. Please rebuild with -DENABLE_JPG=ON");
|
||||
}
|
||||
static int unpack_float(grib_accessor* a, float* val, size_t* len)
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "JPEG support not enabled.");
|
||||
print_error_feature_not_enabled(a->context);
|
||||
return GRIB_FUNCTIONALITY_NOT_ENABLED;
|
||||
}
|
||||
static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "JPEG support not enabled.");
|
||||
print_error_feature_not_enabled(a->context);
|
||||
return GRIB_FUNCTIONALITY_NOT_ENABLED;
|
||||
}
|
||||
|
||||
static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "JPEG support not enabled.");
|
||||
print_error_feature_not_enabled(a->context);
|
||||
return GRIB_FUNCTIONALITY_NOT_ENABLED;
|
||||
}
|
||||
|
||||
|
|
|
@ -765,8 +765,7 @@ static int unpack_double_element_set(grib_accessor* a, const size_t* index_array
|
|||
static void print_error_feature_not_enabled(grib_context* c)
|
||||
{
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"grib_accessor_data_png_packing: PNG support not enabled. "
|
||||
"Please rebuild with -DENABLE_PNG=ON");
|
||||
"PNG support not enabled. Please rebuild with -DENABLE_PNG=ON");
|
||||
}
|
||||
|
||||
static int unpack_double(grib_accessor* a, double* val, size_t* len)
|
||||
|
|
|
@ -303,8 +303,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
//value_first = value_first + 0.5; //round up
|
||||
|
||||
// TODO(masn): These maxima should come from the respective accessors
|
||||
const int64_t scaled_value_max = (1UL << 32) - 1; // scaledValueOf*FixedSurface is 4 octets
|
||||
const int64_t scale_factor_max = (1UL << 8) - 1; // scaleFactorOf*FixedSurface is 1 octet
|
||||
const int64_t scaled_value_max = (1ULL << 32) - 1; // scaledValueOf*FixedSurface is 4 octets
|
||||
const int64_t scale_factor_max = (1ULL << 8) - 1; // scaleFactorOf*FixedSurface is 1 octet
|
||||
int64_t lscaled_value=0, lscale_factor=0;
|
||||
|
||||
ret = compute_scaled_value_and_scale_factor(value_first, scaled_value_max, scale_factor_max, &lscaled_value, &lscale_factor);
|
||||
|
|
|
@ -184,7 +184,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
else {
|
||||
if (value < 0)
|
||||
value += 360;
|
||||
longitude = value * 1000000;
|
||||
longitude = (long)(value * 1000000);
|
||||
}
|
||||
return grib_set_long(grib_handle_of_accessor(a), self->longitude, longitude);
|
||||
}
|
||||
|
|
|
@ -14,11 +14,9 @@
|
|||
* Shahram Najm *
|
||||
***************************************************************************/
|
||||
#include "grib_api_internal.h"
|
||||
#include <typeinfo>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
#include "grib_api_internal_cpp.h"
|
||||
|
||||
/*
|
||||
This is used by make_class.pl
|
||||
|
@ -326,7 +324,7 @@ static int unpack(grib_accessor* a, T* v, size_t* len)
|
|||
size_t l = 1;
|
||||
grib_unpack_long(a, &val, &l);
|
||||
*v = val;
|
||||
grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to %s", a->name, typeid(T).name());
|
||||
grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting long %s to %s", a->name, type_to_string<T>(*v));
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -373,8 +373,8 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
|||
ddi = (360.0 * dfactor) / dNi;
|
||||
dlonlast = (360.0 * dfactor) - ddi + 0.5;
|
||||
ddi = ddi + 0.5;
|
||||
di = ddi;
|
||||
lonlast = dlonlast;
|
||||
di = (long)ddi;
|
||||
lonlast = (long)dlonlast;
|
||||
|
||||
grib_context_free(c, lats);
|
||||
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/*
|
||||
* (C) Copyright 2005- ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "grib_accessor.h"
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
// ECC-1467
|
||||
/*
|
||||
* (C) Copyright 2005- ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/*
|
||||
* (C) Copyright 2005- ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
/***************************************************************************
|
||||
* Jean Baptiste Filippi - 01.11.2005
|
||||
***************************************************************************/
|
||||
#include "grib_api_internal_cpp.h"
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
#include "grib_value.h"
|
||||
#include "grib_accessor.h"
|
||||
#include <float.h>
|
||||
|
||||
/* Note: A fast cut-down version of strcmp which does NOT return -1 */
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
/*
|
||||
* (C) Copyright 2005- ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
|
||||
template<typename T> const char* type_to_string(T) { return "unknown"; }
|
||||
template<> inline const char* type_to_string<>(double) { return "double"; }
|
||||
template<> inline const char* type_to_string<>(float) { return "float"; }
|
||||
|
||||
template <typename T>
|
||||
int grib_get_array(const grib_handle* h, const char* name, T* val, size_t* length);
|
||||
|
||||
|
@ -13,10 +26,12 @@ int grib_get_array_internal(const grib_handle* h, const char* name, T* val, size
|
|||
static_assert(std::is_floating_point<T>::value, "Requires floating point numbers");
|
||||
int ret = grib_get_array<T>(h, name, val, length);
|
||||
|
||||
if (ret != GRIB_SUCCESS)
|
||||
if (ret != GRIB_SUCCESS) {
|
||||
// Note: typeid(T).name() returns "f" or "d". Not very helpful
|
||||
grib_context_log(h->context, GRIB_LOG_ERROR,
|
||||
"unable to get %s as %s array (%s)",
|
||||
name, typeid(T).name(), grib_get_error_message(ret));
|
||||
"unable to get %s as %s array (each array element being %zu bytes): %s",
|
||||
name, type_to_string<T>(*val), sizeof(T), grib_get_error_message(ret));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ if( HAVE_BUILD_TOOLS )
|
|||
grib_ecc-1319
|
||||
grib_ecc-1406
|
||||
grib_ecc-1560
|
||||
grib_ecc-1571
|
||||
bufr_ecc-1028
|
||||
bufr_ecc-1195
|
||||
bufr_ecc-1259
|
||||
|
|
|
@ -124,8 +124,8 @@ ${tools_dir}/grib_ls -p firstSize,secondSize $temp
|
|||
${tools_dir}/grib_set -s paramId=228104,setLocalDefinition=1,localDefinitionNumber=1 $sample2 $temp
|
||||
grib_check_key_equals $temp paramId,productDefinitionTemplateNumber,is_chemical_srcsink,localUsePresent '228104 76 1 1'
|
||||
|
||||
${tools_dir}/grib_set -s stepType=accum,paramId=228104 $sample2 $temp
|
||||
grib_check_key_equals $temp shortName,productDefinitionTemplateNumber,is_chemical_srcsink 'e_WLCH4 78 1'
|
||||
${tools_dir}/grib_set -s paramId=228104 $sample2 $temp
|
||||
grib_check_key_equals $temp shortName,productDefinitionTemplateNumber,is_chemical_srcsink 'e_WLCH4 76 1'
|
||||
${tools_dir}/grib_set -s setLocalDefinition=1,localDefinitionNumber=1 $temp $temp1
|
||||
${tools_dir}/grib_compare -b totalLength,numberOfSection $temp $temp1
|
||||
grib_check_key_equals $temp1 localUsePresent 1
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
# (C) Copyright 2005- ECMWF.
|
||||
#
|
||||
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
#
|
||||
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
#
|
||||
|
||||
. ./include.ctest.sh
|
||||
|
||||
label="grib_ecc-1571"
|
||||
tempGribA=temp1.$label.grib2
|
||||
tempGribB=temp2.$label.grib2
|
||||
sample_grib2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
|
||||
# 1st we create a sample file for UERRA with centre lfpw
|
||||
${tools_dir}/grib_set -s centre=lfpw,productionStatusOfProcessedData=8 ${sample_grib2} ${tempGribA}
|
||||
# Now we use the UERRA sample and add a local section to it
|
||||
${tools_dir}/grib_set -s setLocalDefinition=1,grib2LocalSectionNumber=0,uerraLocalVersion=1 ${tempGribA} ${tempGribB}
|
||||
|
||||
# We should have a local section with uerraLocalVersion=1,experimentVersionNumber=0002
|
||||
grib_check_key_equals ${tempGribB} uerraLocalVersion,experimentVersionNumber "1 0002"
|
||||
grib_check_key_equals ${tempGribB} 'marsExpver,mars.expver' '0002 0002'
|
||||
|
||||
# set other expver
|
||||
${tools_dir}/grib_set -s setLocalDefinition=1,grib2LocalSectionNumber=0,uerraLocalVersion=1,experimentVersionNumber=1234 ${tempGribA} ${tempGribB}
|
||||
grib_check_key_equals ${tempGribB} uerraLocalVersion,experimentVersionNumber "1 1234"
|
||||
|
||||
rm -f ${tempGribA} ${tempGribB}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue