From 3864a91526f5eae5c2f5f2bf34cf3175e52f1ec9 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 19 Oct 2023 15:57:56 +0100 Subject: [PATCH 01/10] ECC-1707: Modification --- .../grib2/localConcepts/ecmf/unstructuredGridSubtype.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/definitions/grib2/localConcepts/ecmf/unstructuredGridSubtype.def b/definitions/grib2/localConcepts/ecmf/unstructuredGridSubtype.def index 926277b83..0f9911a54 100644 --- a/definitions/grib2/localConcepts/ecmf/unstructuredGridSubtype.def +++ b/definitions/grib2/localConcepts/ecmf/unstructuredGridSubtype.def @@ -4,5 +4,5 @@ 'V' = { numberOfGridInReference = 3; } 'W' = { numberOfGridInReference = 4; } 'F' = { numberOfGridInReference = 5; } -'E' = { numberOfGridInReference = 6; } +'C' = { numberOfGridInReference = 6; } 'N' = { numberOfGridInReference = 7; } From 5a675bcafc9127222b4b039106fa88ff6481cfa4 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 19 Oct 2023 17:50:50 +0100 Subject: [PATCH 02/10] Testing: GRIB1 stepRange --- tests/grib_step.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/grib_step.sh b/tests/grib_step.sh index 308a60170..741da1867 100755 --- a/tests/grib_step.sh +++ b/tests/grib_step.sh @@ -206,6 +206,21 @@ result=$(${tools_dir}/grib_get -w count=1 -p step -s stepUnits=D $input) result=$(${tools_dir}/grib_get -w count=1 -p step -s stepUnits=m $input) [ $result = 5760 ] +# GRIB1 stepRange and timeRangeIndicator=10 +# ----------------------------------------- +input=${data_dir}/reduced_latlon_surface.grib1 +grib_check_key_equals $input timeRangeIndicator,P1,P2 '10 0 0' +ECCODES_GRIBEX_MODE_ON=1 ${tools_dir}/grib_set -s stepRange=11-12 $input $temp +grib_check_key_equals $temp P1,P2 '0 11' + +set +e +${tools_dir}/grib_set -s stepRange=11-12 $input $temp 2>$templog +status=$? +set -e +[ $status -ne 0 ] +grep -q "Unable to set stepRange" $templog + + # Clean up rm -f $temp $templog rm -f $grib2File.p8tmp ${grib2File}.tmp x.grib From 72afc35a0e4df47609533ce70b1df8a8e8a0acc5 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 19 Oct 2023 18:25:17 +0100 Subject: [PATCH 03/10] Cleanup --- src/action_class_if.cc | 2 +- src/action_class_section.cc | 7 ++----- src/eccodes_prototypes.h | 1 - src/grib_buffer.cc | 12 +----------- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/action_class_if.cc b/src/action_class_if.cc index a4da2f4be..4c94549af 100644 --- a/src/action_class_if.cc +++ b/src/action_class_if.cc @@ -272,7 +272,7 @@ static grib_action* reparse(grib_action* a, grib_accessor* acc, int* doit) if ((ret = grib_expression_evaluate_long(grib_handle_of_accessor(acc), self->expression, &lres)) != GRIB_SUCCESS) grib_context_log(acc->context, - GRIB_LOG_ERROR, "if reparse grib_expression_evaluate_long %s", + GRIB_LOG_ERROR, "action_class_if::reparse: grib_expression_evaluate_long failed: %s", grib_get_error_message(ret)); if (lres) diff --git a/src/action_class_section.cc b/src/action_class_section.cc index fc64351df..6f9cd5836 100644 --- a/src/action_class_section.cc +++ b/src/action_class_section.cc @@ -10,7 +10,6 @@ /*************************************************************************** * Jean Baptiste Filippi - 01.11.2005 * - * Enrico Fucile * ***************************************************************************/ #include "grib_api_internal.h" @@ -235,10 +234,8 @@ static int notify_change(grib_action* act, grib_accessor* notified, static grib_action* reparse(grib_action* a, grib_accessor* acc, int* doit) { - /* Should be inherited */ - printf("reparse should be inherited: %s\n", a->name); - - Assert(1 == 0); + fprintf(stderr, "action_class_section::reparse should be inherited: %s\n", a->name); + Assert(0); return 0; } diff --git a/src/eccodes_prototypes.h b/src/eccodes_prototypes.h index 3b405a05a..cf0985e86 100644 --- a/src/eccodes_prototypes.h +++ b/src/eccodes_prototypes.h @@ -792,7 +792,6 @@ void grib_buffer_free(const grib_context* c, void* p); void* grib_buffer_realloc(const grib_context* c, void* p, size_t s); /* grib_buffer.cc*/ -void grib_get_buffer_ownership(const grib_context* c, grib_buffer* b); grib_buffer* grib_create_growable_buffer(const grib_context* c); grib_buffer* grib_new_buffer(const grib_context* c, const unsigned char* data, size_t buflen); void grib_buffer_delete(const grib_context* c, grib_buffer* b); diff --git a/src/grib_buffer.cc b/src/grib_buffer.cc index 370cafc13..548c546cc 100644 --- a/src/grib_buffer.cc +++ b/src/grib_buffer.cc @@ -13,7 +13,7 @@ ***************************************************************************/ #include "grib_api_internal.h" -void grib_get_buffer_ownership(const grib_context* c, grib_buffer* b) +static void grib_get_buffer_ownership(const grib_context* c, grib_buffer* b) { unsigned char* newdata; if (b->property == CODES_MY_BUFFER) @@ -137,23 +137,19 @@ static void update_offsets_after(grib_accessor* a, long len) } } -// /* new GCC compiler v4.5.0 complains function is defined but not used*/ // void grib_recompute_sections_lengths(grib_section* s) // { // if(s) // { // long plen = 0; // size_t len = 1; - // grib_accessor* a = s->block->first; - // while(a) // { // /* grib_recompute_sections_lengths(grib_get_sub_section(a)); */ // grib_recompute_sections_lengths(a->sub_section); // a = a->next; // } - // if(s->aclength) // { // int ret; @@ -161,10 +157,8 @@ static void update_offsets_after(grib_accessor* a, long len) // plen = grib_get_next_position_offset(s->block->last) - s->owner->offset; // else // plen = grib_get_next_position_offset(s->block->last); - // if((ret = grib_pack_long(s->aclength, &plen, &len)) != GRIB_SUCCESS) // ; - // // if(s->h->context->debug) // printf("SECTION updating length %ld .. %s\n",plen,s->owner->name); @@ -177,7 +171,6 @@ static void update_offsets_after(grib_accessor* a, long len) // { // long plen = 0; // size_t len = 1; - // if(!s) return; // if(s->aclength) // { @@ -186,14 +179,11 @@ static void update_offsets_after(grib_accessor* a, long len) // plen = grib_get_next_position_offset(s->block->last) - s->owner->offset; // else // plen = grib_get_next_position_offset(s->block->last); - // /* if(s->owner) */ // /* s->owner->length = plen; */ - // /* if(s->aclength) */ // if((ret = grib_pack_long(s->aclength, &plen, &len)) != GRIB_SUCCESS) // ; - // if(s->h->context->debug) // { // printf("SECTION updating length %ld .. %s\n",plen,s->owner->name); From 5bbde7f2f509753927006b3fd184b467c36b6b97 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 20 Oct 2023 11:29:52 +0000 Subject: [PATCH 04/10] ECC-1702: GRIB2: Add turbulent surface parameters --- .../grib1/localConcepts/ecmf/cfName.def | 14 +-- .../grib1/localConcepts/ecmf/cfVarName.def | 12 +-- definitions/grib1/localConcepts/ecmf/name.def | 24 +++--- .../grib1/localConcepts/ecmf/paramId.def | 12 +-- .../grib1/localConcepts/ecmf/shortName.def | 12 +-- .../grib1/localConcepts/ecmf/units.def | 12 +-- definitions/grib2/cfName.def | 8 +- definitions/grib2/cfVarName.def | 82 ++++++++++++++---- .../grib2/localConcepts/s2s/cfName.def | 16 ++++ .../grib2/localConcepts/s2s/cfVarName.def | 16 ++++ definitions/grib2/localConcepts/s2s/name.def | 16 ++++ .../grib2/localConcepts/s2s/paramId.def | 16 ++++ .../grib2/localConcepts/s2s/shortName.def | 16 ++++ definitions/grib2/localConcepts/s2s/units.def | 16 ++++ .../grib2/localConcepts/uerra/cfVarName.def | 12 +++ .../grib2/localConcepts/uerra/name.def | 12 +++ .../grib2/localConcepts/uerra/paramId.def | 12 +++ .../grib2/localConcepts/uerra/shortName.def | 12 +++ .../grib2/localConcepts/uerra/units.def | 12 +++ definitions/grib2/name.def | 86 +++++++++++++++---- definitions/grib2/paramId.def | 82 ++++++++++++++---- definitions/grib2/shortName.def | 82 ++++++++++++++---- definitions/grib2/units.def | 82 ++++++++++++++---- 23 files changed, 535 insertions(+), 129 deletions(-) diff --git a/definitions/grib1/localConcepts/ecmf/cfName.def b/definitions/grib1/localConcepts/ecmf/cfName.def index 9868daef7..48b023899 100644 --- a/definitions/grib1/localConcepts/ecmf/cfName.def +++ b/definitions/grib1/localConcepts/ecmf/cfName.def @@ -589,32 +589,32 @@ table2Version = 190 ; indicatorOfParameter = 179 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'surface_downward_eastward_stress' = { table2Version = 128 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'surface_downward_eastward_stress' = { table2Version = 170 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'surface_downward_eastward_stress' = { table2Version = 180 ; indicatorOfParameter = 180 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'surface_downward_northward_stress' = { table2Version = 128 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'surface_downward_northward_stress' = { table2Version = 170 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'surface_downward_northward_stress' = { table2Version = 180 ; indicatorOfParameter = 181 ; @@ -959,7 +959,7 @@ table2Version = 174 ; indicatorOfParameter = 98 ; } -#Carbon Dioxide +#Carbon dioxide mass mixing ratio 'mass_fraction_of_carbon_dioxide_in_air' = { table2Version = 210 ; indicatorOfParameter = 61 ; diff --git a/definitions/grib1/localConcepts/ecmf/cfVarName.def b/definitions/grib1/localConcepts/ecmf/cfVarName.def index 36530b6f3..03a5530af 100644 --- a/definitions/grib1/localConcepts/ecmf/cfVarName.def +++ b/definitions/grib1/localConcepts/ecmf/cfVarName.def @@ -1459,32 +1459,32 @@ table2Version = 190 ; indicatorOfParameter = 179 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'ewss' = { table2Version = 128 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'ewss' = { table2Version = 170 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'ewss' = { table2Version = 180 ; indicatorOfParameter = 180 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'nsss' = { table2Version = 128 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'nsss' = { table2Version = 170 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'nsss' = { table2Version = 180 ; indicatorOfParameter = 181 ; diff --git a/definitions/grib1/localConcepts/ecmf/name.def b/definitions/grib1/localConcepts/ecmf/name.def index 78ecaecad..5421b5ca8 100644 --- a/definitions/grib1/localConcepts/ecmf/name.def +++ b/definitions/grib1/localConcepts/ecmf/name.def @@ -1459,33 +1459,33 @@ table2Version = 190 ; indicatorOfParameter = 179 ; } -#Eastward turbulent surface stress -'Eastward turbulent surface stress' = { +#Time-integrated eastward turbulent surface stress +'Time-integrated eastward turbulent surface stress' = { table2Version = 128 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress -'Eastward turbulent surface stress' = { +#Time-integrated eastward turbulent surface stress +'Time-integrated eastward turbulent surface stress' = { table2Version = 170 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress -'Eastward turbulent surface stress' = { +#Time-integrated eastward turbulent surface stress +'Time-integrated eastward turbulent surface stress' = { table2Version = 180 ; indicatorOfParameter = 180 ; } -#Northward turbulent surface stress -'Northward turbulent surface stress' = { +#Time-integrated northward turbulent surface stress +'Time-integrated northward turbulent surface stress' = { table2Version = 128 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress -'Northward turbulent surface stress' = { +#Time-integrated northward turbulent surface stress +'Time-integrated northward turbulent surface stress' = { table2Version = 170 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress -'Northward turbulent surface stress' = { +#Time-integrated northward turbulent surface stress +'Time-integrated northward turbulent surface stress' = { table2Version = 180 ; indicatorOfParameter = 181 ; } diff --git a/definitions/grib1/localConcepts/ecmf/paramId.def b/definitions/grib1/localConcepts/ecmf/paramId.def index 572393e2e..3bd904fb6 100644 --- a/definitions/grib1/localConcepts/ecmf/paramId.def +++ b/definitions/grib1/localConcepts/ecmf/paramId.def @@ -1459,32 +1459,32 @@ table2Version = 190 ; indicatorOfParameter = 179 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress '180' = { table2Version = 128 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress '180' = { table2Version = 170 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress '180' = { table2Version = 180 ; indicatorOfParameter = 180 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress '181' = { table2Version = 128 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress '181' = { table2Version = 170 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress '181' = { table2Version = 180 ; indicatorOfParameter = 181 ; diff --git a/definitions/grib1/localConcepts/ecmf/shortName.def b/definitions/grib1/localConcepts/ecmf/shortName.def index 6fd82758e..02fc2cceb 100644 --- a/definitions/grib1/localConcepts/ecmf/shortName.def +++ b/definitions/grib1/localConcepts/ecmf/shortName.def @@ -1459,32 +1459,32 @@ table2Version = 190 ; indicatorOfParameter = 179 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'ewss' = { table2Version = 128 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'ewss' = { table2Version = 170 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'ewss' = { table2Version = 180 ; indicatorOfParameter = 180 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'nsss' = { table2Version = 128 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'nsss' = { table2Version = 170 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'nsss' = { table2Version = 180 ; indicatorOfParameter = 181 ; diff --git a/definitions/grib1/localConcepts/ecmf/units.def b/definitions/grib1/localConcepts/ecmf/units.def index 027242702..8eadf0ea3 100644 --- a/definitions/grib1/localConcepts/ecmf/units.def +++ b/definitions/grib1/localConcepts/ecmf/units.def @@ -1459,32 +1459,32 @@ table2Version = 190 ; indicatorOfParameter = 179 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'N m**-2 s' = { table2Version = 128 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'N m**-2 s' = { table2Version = 170 ; indicatorOfParameter = 180 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'N m**-2 s' = { table2Version = 180 ; indicatorOfParameter = 180 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'N m**-2 s' = { table2Version = 128 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'N m**-2 s' = { table2Version = 170 ; indicatorOfParameter = 181 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'N m**-2 s' = { table2Version = 180 ; indicatorOfParameter = 181 ; diff --git a/definitions/grib2/cfName.def b/definitions/grib2/cfName.def index c21d5b9ae..7e769ee34 100644 --- a/definitions/grib2/cfName.def +++ b/definitions/grib2/cfName.def @@ -45,19 +45,19 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 1 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'surface_downward_eastward_stress' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 38 ; + parameterNumber = 62 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'surface_downward_northward_stress' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 37 ; + parameterNumber = 63 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } diff --git a/definitions/grib2/cfVarName.def b/definitions/grib2/cfVarName.def index 4234951b7..053b95478 100644 --- a/definitions/grib2/cfVarName.def +++ b/definitions/grib2/cfVarName.def @@ -382,19 +382,19 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 1 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'ewss' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 38 ; + parameterNumber = 62 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'nsss' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 37 ; + parameterNumber = 63 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } @@ -724,6 +724,20 @@ parameterCategory = 0 ; parameterNumber = 89 ; } +#U-component of atmospheric surface momentum flux +'utaua' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 1 ; + } +#V-component of atmospheric surface momentum flux +'vtaua' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 1 ; + } #U-component of surface momentum flux into ocean 'utauo' = { discipline = 10 ; @@ -3745,6 +3759,22 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Mean eastward turbulent surface stress +'metss' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 62 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Mean northward turbulent surface stress +'mntss' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 63 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Mean evaporation rate 'mer' = { discipline = 0 ; @@ -4735,6 +4765,38 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 255 ; } +#Time-integrated eastward turbulent surface stress due to orographic form drag +'etssofd' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 64 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to orographic form drag +'ntssofd' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 65 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated eastward turbulent surface stress due to surface roughness +'etsssr' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to surface roughness +'ntsssr' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 67 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Universal thermal climate index 'utci' = { discipline = 20 ; @@ -8715,18 +8777,6 @@ parameterCategory = 1 ; parameterNumber = 68 ; } -#Momentum flux, u component -'uflx' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 17 ; - } -#Momentum flux, v component -'vflx' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 18 ; - } #Maximum wind speed 'maxgust' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/s2s/cfName.def b/definitions/grib2/localConcepts/s2s/cfName.def index 140e70741..ae98cc52f 100644 --- a/definitions/grib2/localConcepts/s2s/cfName.def +++ b/definitions/grib2/localConcepts/s2s/cfName.def @@ -6,6 +6,22 @@ parameterNumber = 0 ; typeOfFirstFixedSurface = 1 ; } +#Time-integrated eastward turbulent surface stress +'surface_downward_eastward_stress' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress +'surface_downward_northward_stress' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Sea surface practical salinity 'sea_surface_salinity' = { discipline = 10 ; diff --git a/definitions/grib2/localConcepts/s2s/cfVarName.def b/definitions/grib2/localConcepts/s2s/cfVarName.def index d3598d7d0..b9900970b 100644 --- a/definitions/grib2/localConcepts/s2s/cfVarName.def +++ b/definitions/grib2/localConcepts/s2s/cfVarName.def @@ -57,6 +57,22 @@ scaledValueOfFirstFixedSurface = 15 ; scaleFactorOfFirstFixedSurface = 1 ; } +#Time-integrated eastward turbulent surface stress +'ewss' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress +'nsss' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Mean sea water potential temperature in the upper 300 m 'mswpt300m' = { discipline = 10 ; diff --git a/definitions/grib2/localConcepts/s2s/name.def b/definitions/grib2/localConcepts/s2s/name.def index 3821406fa..478e0a7fa 100644 --- a/definitions/grib2/localConcepts/s2s/name.def +++ b/definitions/grib2/localConcepts/s2s/name.def @@ -57,6 +57,22 @@ scaledValueOfFirstFixedSurface = 15 ; scaleFactorOfFirstFixedSurface = 1 ; } +#Time-integrated eastward turbulent surface stress +'Time-integrated eastward turbulent surface stress' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress +'Time-integrated northward turbulent surface stress' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Mean sea water potential temperature in the upper 300 m 'Mean sea water potential temperature in the upper 300 m' = { discipline = 10 ; diff --git a/definitions/grib2/localConcepts/s2s/paramId.def b/definitions/grib2/localConcepts/s2s/paramId.def index ecd296acf..f9800fd85 100644 --- a/definitions/grib2/localConcepts/s2s/paramId.def +++ b/definitions/grib2/localConcepts/s2s/paramId.def @@ -57,6 +57,22 @@ scaledValueOfFirstFixedSurface = 15 ; scaleFactorOfFirstFixedSurface = 1 ; } +#Time-integrated eastward turbulent surface stress +'180' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress +'181' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Mean sea water potential temperature in the upper 300 m '151126' = { discipline = 10 ; diff --git a/definitions/grib2/localConcepts/s2s/shortName.def b/definitions/grib2/localConcepts/s2s/shortName.def index a9f3910a6..e200e018b 100644 --- a/definitions/grib2/localConcepts/s2s/shortName.def +++ b/definitions/grib2/localConcepts/s2s/shortName.def @@ -57,6 +57,22 @@ scaledValueOfFirstFixedSurface = 15 ; scaleFactorOfFirstFixedSurface = 1 ; } +#Time-integrated eastward turbulent surface stress +'ewss' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress +'nsss' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Mean sea water potential temperature in the upper 300 m 'mswpt300m' = { discipline = 10 ; diff --git a/definitions/grib2/localConcepts/s2s/units.def b/definitions/grib2/localConcepts/s2s/units.def index 3dbb1d7e8..c40b4c966 100644 --- a/definitions/grib2/localConcepts/s2s/units.def +++ b/definitions/grib2/localConcepts/s2s/units.def @@ -57,6 +57,22 @@ scaledValueOfFirstFixedSurface = 15 ; scaleFactorOfFirstFixedSurface = 1 ; } +#Time-integrated eastward turbulent surface stress +'N m**-2 s' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 38 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress +'N m**-2 s' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 37 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Mean sea water potential temperature in the upper 300 m 'K' = { discipline = 10 ; diff --git a/definitions/grib2/localConcepts/uerra/cfVarName.def b/definitions/grib2/localConcepts/uerra/cfVarName.def index a77e854d9..2b23e1570 100644 --- a/definitions/grib2/localConcepts/uerra/cfVarName.def +++ b/definitions/grib2/localConcepts/uerra/cfVarName.def @@ -148,6 +148,18 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Momentum flux, u component +'uflx' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Momentum flux, v component +'vflx' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } #Standard deviation of sub-grid scale orography 'sdsgso' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/uerra/name.def b/definitions/grib2/localConcepts/uerra/name.def index 938e1072a..5a5c6865e 100644 --- a/definitions/grib2/localConcepts/uerra/name.def +++ b/definitions/grib2/localConcepts/uerra/name.def @@ -148,6 +148,18 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Momentum flux, u component +'Momentum flux, u component' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Momentum flux, v component +'Momentum flux, v component' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } #Standard deviation of sub-grid scale orography 'Standard deviation of sub-grid scale orography' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/uerra/paramId.def b/definitions/grib2/localConcepts/uerra/paramId.def index 3db8ad4fa..2bd651ace 100644 --- a/definitions/grib2/localConcepts/uerra/paramId.def +++ b/definitions/grib2/localConcepts/uerra/paramId.def @@ -148,6 +148,18 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Momentum flux, u component +'260062' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Momentum flux, v component +'260063' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } #Standard deviation of sub-grid scale orography '260085' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/uerra/shortName.def b/definitions/grib2/localConcepts/uerra/shortName.def index 9cbb74cd7..3c73c0761 100644 --- a/definitions/grib2/localConcepts/uerra/shortName.def +++ b/definitions/grib2/localConcepts/uerra/shortName.def @@ -148,6 +148,18 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Momentum flux, u component +'uflx' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Momentum flux, v component +'vflx' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } #Standard deviation of sub-grid scale orography 'sdsgso' = { discipline = 0 ; diff --git a/definitions/grib2/localConcepts/uerra/units.def b/definitions/grib2/localConcepts/uerra/units.def index aa1f30814..b84fdc016 100644 --- a/definitions/grib2/localConcepts/uerra/units.def +++ b/definitions/grib2/localConcepts/uerra/units.def @@ -148,6 +148,18 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 8 ; } +#Momentum flux, u component +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + } +#Momentum flux, v component +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + } #Standard deviation of sub-grid scale orography 'm' = { discipline = 0 ; diff --git a/definitions/grib2/name.def b/definitions/grib2/name.def index d852effb4..fa7ac3ad4 100644 --- a/definitions/grib2/name.def +++ b/definitions/grib2/name.def @@ -382,19 +382,19 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 1 ; } -#Eastward turbulent surface stress -'Eastward turbulent surface stress' = { +#Time-integrated eastward turbulent surface stress +'Time-integrated eastward turbulent surface stress' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 38 ; + parameterNumber = 62 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } -#Northward turbulent surface stress -'Northward turbulent surface stress' = { +#Time-integrated northward turbulent surface stress +'Time-integrated northward turbulent surface stress' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 37 ; + parameterNumber = 63 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } @@ -724,6 +724,20 @@ parameterCategory = 0 ; parameterNumber = 89 ; } +#U-component of atmospheric surface momentum flux +'U-component of atmospheric surface momentum flux' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 1 ; + } +#V-component of atmospheric surface momentum flux +'V-component of atmospheric surface momentum flux' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 1 ; + } #U-component of surface momentum flux into ocean 'U-component of surface momentum flux into ocean' = { discipline = 10 ; @@ -3745,6 +3759,22 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Mean eastward turbulent surface stress +'Mean eastward turbulent surface stress' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 62 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Mean northward turbulent surface stress +'Mean northward turbulent surface stress' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 63 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Mean evaporation rate 'Mean evaporation rate' = { discipline = 0 ; @@ -4735,6 +4765,38 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 255 ; } +#Time-integrated eastward turbulent surface stress due to orographic form drag +'Time-integrated eastward turbulent surface stress due to orographic form drag' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 64 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to orographic form drag +'Time-integrated northward turbulent surface stress due to orographic form drag' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 65 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated eastward turbulent surface stress due to surface roughness +'Time-integrated eastward turbulent surface stress due to surface roughness' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to surface roughness +'Time-integrated northward turbulent surface stress due to surface roughness' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 67 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Universal thermal climate index 'Universal thermal climate index' = { discipline = 20 ; @@ -8715,18 +8777,6 @@ parameterCategory = 1 ; parameterNumber = 68 ; } -#Momentum flux, u component -'Momentum flux, u component' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 17 ; - } -#Momentum flux, v component -'Momentum flux, v component' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 18 ; - } #Maximum wind speed 'Maximum wind speed' = { discipline = 0 ; diff --git a/definitions/grib2/paramId.def b/definitions/grib2/paramId.def index 1d0daf539..fe6cc8d80 100644 --- a/definitions/grib2/paramId.def +++ b/definitions/grib2/paramId.def @@ -382,19 +382,19 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 1 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress '180' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 38 ; + parameterNumber = 62 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress '181' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 37 ; + parameterNumber = 63 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } @@ -724,6 +724,20 @@ parameterCategory = 0 ; parameterNumber = 89 ; } +#U-component of atmospheric surface momentum flux +'140101' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 1 ; + } +#V-component of atmospheric surface momentum flux +'140102' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 1 ; + } #U-component of surface momentum flux into ocean '140103' = { discipline = 10 ; @@ -3745,6 +3759,22 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Mean eastward turbulent surface stress +'235041' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 62 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Mean northward turbulent surface stress +'235042' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 63 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Mean evaporation rate '235043' = { discipline = 0 ; @@ -4735,6 +4765,38 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 255 ; } +#Time-integrated eastward turbulent surface stress due to orographic form drag +'260652' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 64 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to orographic form drag +'260653' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 65 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated eastward turbulent surface stress due to surface roughness +'260654' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to surface roughness +'260655' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 67 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Universal thermal climate index '261001' = { discipline = 20 ; @@ -8715,18 +8777,6 @@ parameterCategory = 1 ; parameterNumber = 68 ; } -#Momentum flux, u component -'260062' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 17 ; - } -#Momentum flux, v component -'260063' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 18 ; - } #Maximum wind speed '260064' = { discipline = 0 ; diff --git a/definitions/grib2/shortName.def b/definitions/grib2/shortName.def index 5070fb459..fa8bce2b8 100644 --- a/definitions/grib2/shortName.def +++ b/definitions/grib2/shortName.def @@ -382,19 +382,19 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 1 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'ewss' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 38 ; + parameterNumber = 62 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'nsss' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 37 ; + parameterNumber = 63 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } @@ -724,6 +724,20 @@ parameterCategory = 0 ; parameterNumber = 89 ; } +#U-component of atmospheric surface momentum flux +'utaua' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 1 ; + } +#V-component of atmospheric surface momentum flux +'vtaua' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 1 ; + } #U-component of surface momentum flux into ocean 'utauo' = { discipline = 10 ; @@ -3745,6 +3759,22 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Mean eastward turbulent surface stress +'metss' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 62 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Mean northward turbulent surface stress +'mntss' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 63 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Mean evaporation rate 'mer' = { discipline = 0 ; @@ -4735,6 +4765,38 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 255 ; } +#Time-integrated eastward turbulent surface stress due to orographic form drag +'etssofd' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 64 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to orographic form drag +'ntssofd' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 65 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated eastward turbulent surface stress due to surface roughness +'etsssr' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to surface roughness +'ntsssr' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 67 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Universal thermal climate index 'utci' = { discipline = 20 ; @@ -8715,18 +8777,6 @@ parameterCategory = 1 ; parameterNumber = 68 ; } -#Momentum flux, u component -'uflx' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 17 ; - } -#Momentum flux, v component -'vflx' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 18 ; - } #Maximum wind speed 'maxgust' = { discipline = 0 ; diff --git a/definitions/grib2/units.def b/definitions/grib2/units.def index 37540142d..01d3201e0 100644 --- a/definitions/grib2/units.def +++ b/definitions/grib2/units.def @@ -382,19 +382,19 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 1 ; } -#Eastward turbulent surface stress +#Time-integrated eastward turbulent surface stress 'N m**-2 s' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 38 ; + parameterNumber = 62 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } -#Northward turbulent surface stress +#Time-integrated northward turbulent surface stress 'N m**-2 s' = { discipline = 0 ; parameterCategory = 2 ; - parameterNumber = 37 ; + parameterNumber = 63 ; typeOfFirstFixedSurface = 1 ; typeOfStatisticalProcessing = 1 ; } @@ -724,6 +724,20 @@ parameterCategory = 0 ; parameterNumber = 89 ; } +#U-component of atmospheric surface momentum flux +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 17 ; + typeOfFirstFixedSurface = 1 ; + } +#V-component of atmospheric surface momentum flux +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 18 ; + typeOfFirstFixedSurface = 1 ; + } #U-component of surface momentum flux into ocean 'N m**-2' = { discipline = 10 ; @@ -3745,6 +3759,22 @@ typeOfFirstFixedSurface = 8 ; typeOfStatisticalProcessing = 0 ; } +#Mean eastward turbulent surface stress +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 62 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } +#Mean northward turbulent surface stress +'N m**-2' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 63 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 0 ; + } #Mean evaporation rate 'kg m**-2 s**-1' = { discipline = 0 ; @@ -4735,6 +4765,38 @@ typeOfFirstFixedSurface = 1 ; typeOfSecondFixedSurface = 255 ; } +#Time-integrated eastward turbulent surface stress due to orographic form drag +'N m**-2 s' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 64 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to orographic form drag +'N m**-2 s' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 65 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated eastward turbulent surface stress due to surface roughness +'N m**-2 s' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 66 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } +#Time-integrated northward turbulent surface stress due to surface roughness +'N m**-2 s' = { + discipline = 0 ; + parameterCategory = 2 ; + parameterNumber = 67 ; + typeOfFirstFixedSurface = 1 ; + typeOfStatisticalProcessing = 1 ; + } #Universal thermal climate index 'K' = { discipline = 20 ; @@ -8715,18 +8777,6 @@ parameterCategory = 1 ; parameterNumber = 68 ; } -#Momentum flux, u component -'N m**-2' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 17 ; - } -#Momentum flux, v component -'N m**-2' = { - discipline = 0 ; - parameterCategory = 2 ; - parameterNumber = 18 ; - } #Maximum wind speed 'm s**-1' = { discipline = 0 ; From 4d57fc79fd4f761ade2f434e451f4b6737c0badd Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 20 Oct 2023 20:14:32 +0100 Subject: [PATCH 05/10] Dead code removal --- src/action.cc | 43 ++++++++++++++-------------- src/action_class_alias.cc | 22 ++------------ src/action_class_gen.cc | 10 ++----- src/action_class_if.cc | 8 ++---- src/action_class_modify.cc | 8 ++---- src/action_class_noop.cc | 9 ++---- src/action_class_remove.cc | 8 ++---- src/action_class_rename.cc | 9 ++---- src/action_class_section.cc | 19 ++---------- src/action_class_set.cc | 12 ++------ src/action_class_set_darray.cc | 9 ++---- src/action_class_set_sarray.cc | 12 ++------ src/action_class_switch.cc | 12 ++------ src/action_class_transient_darray.cc | 13 ++------- src/action_class_when.cc | 9 ++---- src/eccodes_prototypes.h | 2 -- 16 files changed, 50 insertions(+), 155 deletions(-) diff --git a/src/action.cc b/src/action.cc index 847862edc..026bca74e 100644 --- a/src/action.cc +++ b/src/action.cc @@ -98,22 +98,21 @@ static void grib_dump(grib_action* a, FILE* f, int l) DEBUG_ASSERT(0); } -void grib_xref(grib_action* a, FILE* f, const char* path) -{ - grib_action_class* c = a->cclass; - init(c); - - while (c) { - if (c->xref) { - c->xref(a, f, path); - return; - } - c = c->super ? *(c->super) : NULL; - } - printf("xref not implemented for %s\n", a->cclass->name); - DEBUG_ASSERT(0); -} +// void grib_xref(grib_action* a, FILE* f, const char* path) +// { +// grib_action_class* c = a->cclass; +// init(c); +// while (c) { +// if (c->xref) { +// c->xref(a, f, path); +// return; +// } +// c = c->super ? *(c->super) : NULL; +// } +// printf("xref not implemented for %s\n", a->cclass->name); +// DEBUG_ASSERT(0); +// } void grib_action_delete(grib_context* context, grib_action* a) { @@ -214,10 +213,10 @@ void grib_dump_action_tree(grib_context* ctx, FILE* out) grib_dump_action_branch(out, ctx->grib_reader->first->root, 0); } -void grib_xref_action_branch(FILE* out, grib_action* a, const char* path) -{ - while (a) { - grib_xref(a, out, path); - a = a->next; - } -} +// void grib_xref_action_branch(FILE* out, grib_action* a, const char* path) +// { +// while (a) { +// grib_xref(a, out, path); +// a = a->next; +// } +// } diff --git a/src/action_class_alias.cc b/src/action_class_alias.cc index 945d3aa7a..014a3f47c 100644 --- a/src/action_class_alias.cc +++ b/src/action_class_alias.cc @@ -19,7 +19,7 @@ START_CLASS_DEF CLASS = action IMPLEMENTS = create_accessor - IMPLEMENTS = dump;xref + IMPLEMENTS = dump IMPLEMENTS = destroy MEMBERS = char* target END_CLASS_DEF @@ -38,7 +38,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int create_accessor(grib_section*,grib_action*,grib_loader*); @@ -60,7 +59,7 @@ static grib_action_class _grib_action_class_alias = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ &create_accessor, /* create_accessor*/ @@ -268,23 +267,6 @@ static void dump(grib_action* act, FILE* f, int lvl) grib_context_print(act->context, f, " unalias %s \n", act->name); } -static void xref(grib_action* act, FILE* f, const char* path) -{ - Assert(!"xref is disabled"); - - // grib_action_alias* a = (grib_action_alias*)act; - // if (a->target) { - // fprintf(f, "bless({name=>'%s', target=>'%s', path=>'%s'},'xref::alias'),\n", act->name, a->target, path); - // if (act->name_space) - // fprintf(f, "bless({name=>'%s.%s', target=>'%s', path=>'%s'},'xref::alias'),\n", act->name_space, act->name, a->target, path); - // } - // else { - // fprintf(f, "bless({name=>'%s', path=>'%s'},'xref::unalias'),\n", act->name, path); - // if (act->name_space) - // fprintf(f, "bless({name=>'%s.%s', path=>'%s'},'xref::unalias'),\n", act->name_space, act->name, path); - // } -} - static void destroy(grib_context* context, grib_action* act) { grib_action_alias* a = (grib_action_alias*)act; diff --git a/src/action_class_gen.cc b/src/action_class_gen.cc index 8c5945889..641aa3c92 100644 --- a/src/action_class_gen.cc +++ b/src/action_class_gen.cc @@ -19,7 +19,7 @@ START_CLASS_DEF CLASS = action IMPLEMENTS = create_accessor - IMPLEMENTS = dump;xref + IMPLEMENTS = dump IMPLEMENTS = destroy IMPLEMENTS = notify_change MEMBERS = long len @@ -40,7 +40,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int create_accessor(grib_section*,grib_action*,grib_loader*); static int notify_change(grib_action* a, grib_accessor* observer,grib_accessor* observed); @@ -64,7 +63,7 @@ static grib_action_class _grib_action_class_gen = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ &create_accessor, /* create_accessor*/ @@ -130,11 +129,6 @@ static void dump(grib_action* act, FILE* f, int lvl) // For xref implementation see // src/deprecated/action_class_gen.cc -static void xref(grib_action* act, FILE* f, const char* path) -{ - Assert(!"xref is disabled"); -} - static int create_accessor(grib_section* p, grib_action* act, grib_loader* loader) { grib_action_gen* a = (grib_action_gen*)act; diff --git a/src/action_class_if.cc b/src/action_class_if.cc index 4c94549af..a5d28725a 100644 --- a/src/action_class_if.cc +++ b/src/action_class_if.cc @@ -22,7 +22,6 @@ IMPLEMENTS = create_accessor IMPLEMENTS = dump IMPLEMENTS = destroy - IMPLEMENTS = xref IMPLEMENTS = reparse;execute MEMBERS = grib_expression *expression MEMBERS = grib_action *block_true @@ -44,7 +43,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int create_accessor(grib_section*,grib_action*,grib_loader*); static grib_action* reparse(grib_action* a,grib_accessor* acc,int *doit); @@ -73,7 +71,7 @@ static grib_action_class _grib_action_class_if = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ &create_accessor, /* create_accessor*/ @@ -86,6 +84,7 @@ grib_action_class* grib_action_class_if = &_grib_action_class_if; static void init_class(grib_action_class* c) { + c->xref = (*(c->super))->xref; c->notify_change = (*(c->super))->notify_change; } /* END_CLASS_IMP */ @@ -306,6 +305,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->op); } -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_modify.cc b/src/action_class_modify.cc index c379d7300..ef09a3c96 100644 --- a/src/action_class_modify.cc +++ b/src/action_class_modify.cc @@ -17,7 +17,7 @@ START_CLASS_DEF CLASS = action - IMPLEMENTS = dump;xref + IMPLEMENTS = dump IMPLEMENTS = create_accessor IMPLEMENTS = destroy MEMBERS = long flags @@ -38,7 +38,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int create_accessor(grib_section*,grib_action*,grib_loader*); @@ -61,7 +60,7 @@ static grib_action_class _grib_action_class_modify = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ &create_accessor, /* create_accessor*/ @@ -128,6 +127,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->op); } -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_noop.cc b/src/action_class_noop.cc index c2b3bc2f0..d4d2ff133 100644 --- a/src/action_class_noop.cc +++ b/src/action_class_noop.cc @@ -17,7 +17,7 @@ START_CLASS_DEF CLASS = action - IMPLEMENTS = dump;destroy;xref;execute + IMPLEMENTS = dump;destroy;execute END_CLASS_DEF */ @@ -34,7 +34,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int execute(grib_action* a,grib_handle* h); @@ -55,7 +54,7 @@ static grib_action_class _grib_action_class_noop = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ 0, /* create_accessor*/ @@ -101,10 +100,6 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->op); } -static void xref(grib_action* d, FILE* f, const char* path) -{ -} - static int execute(grib_action* act, grib_handle* h) { return 0; diff --git a/src/action_class_remove.cc b/src/action_class_remove.cc index 853a1a648..26ab6760b 100644 --- a/src/action_class_remove.cc +++ b/src/action_class_remove.cc @@ -19,7 +19,7 @@ CLASS = action IMPLEMENTS = create_accessor IMPLEMENTS = dump - IMPLEMENTS = destroy; xref + IMPLEMENTS = destroy MEMBERS = grib_arguments* args END_CLASS_DEF @@ -37,7 +37,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int create_accessor(grib_section*,grib_action*,grib_loader*); @@ -59,7 +58,7 @@ static grib_action_class _grib_action_class_remove = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ &create_accessor, /* create_accessor*/ @@ -153,6 +152,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->op); } -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_rename.cc b/src/action_class_rename.cc index 2666c4f75..b6533895e 100644 --- a/src/action_class_rename.cc +++ b/src/action_class_rename.cc @@ -19,7 +19,7 @@ CLASS = action IMPLEMENTS = create_accessor IMPLEMENTS = dump - IMPLEMENTS = destroy; xref + IMPLEMENTS = destroy MEMBERS = char* the_old MEMBERS = char* the_new END_CLASS_DEF @@ -38,7 +38,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int create_accessor(grib_section*,grib_action*,grib_loader*); @@ -61,7 +60,7 @@ static grib_action_class _grib_action_class_rename = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ &create_accessor, /* create_accessor*/ @@ -148,7 +147,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); } - -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_section.cc b/src/action_class_section.cc index 6f9cd5836..9dda3dc30 100644 --- a/src/action_class_section.cc +++ b/src/action_class_section.cc @@ -19,8 +19,6 @@ START_CLASS_DEF CLASS = action IMPLEMENTS = notify_change - IMPLEMENTS = reparse - IMPLEMENTS = xref END_CLASS_DEF */ @@ -36,9 +34,7 @@ or edit "action.class" and rerun ./make_class.pl */ static void init_class (grib_action_class*); -static void xref (grib_action* d, FILE* f,const char* path); static int notify_change(grib_action* a, grib_accessor* observer,grib_accessor* observed); -static grib_action* reparse(grib_action* a,grib_accessor* acc,int *doit); typedef struct grib_action_section { @@ -57,12 +53,12 @@ static grib_action_class _grib_action_class_section = { 0, /* destroy */ 0, /* dump */ - &xref, /* xref */ + 0, /* xref */ 0, /* create_accessor*/ ¬ify_change, /* notify_change */ - &reparse, /* reparse */ + 0, /* reparse */ 0, /* execute */ }; @@ -231,14 +227,3 @@ static int notify_change(grib_action* act, grib_accessor* notified, return GRIB_SUCCESS; } - -static grib_action* reparse(grib_action* a, grib_accessor* acc, int* doit) -{ - fprintf(stderr, "action_class_section::reparse should be inherited: %s\n", a->name); - Assert(0); - return 0; -} - -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_set.cc b/src/action_class_set.cc index 8febce99d..1068181d5 100644 --- a/src/action_class_set.cc +++ b/src/action_class_set.cc @@ -8,16 +8,13 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/*************************************************************************** - * Enrico Fucile * - ***************************************************************************/ #include "grib_api_internal.h" /* This is used by make_class.pl START_CLASS_DEF CLASS = action - IMPLEMENTS = dump;xref + IMPLEMENTS = dump IMPLEMENTS = destroy;execute MEMBERS = grib_expression *expression MEMBERS = char *name @@ -38,7 +35,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int execute(grib_action* a,grib_handle* h); @@ -62,7 +58,7 @@ static grib_action_class _grib_action_class_set = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ 0, /* create_accessor*/ @@ -135,7 +131,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); } - -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_set_darray.cc b/src/action_class_set_darray.cc index 43d249594..97211a219 100644 --- a/src/action_class_set_darray.cc +++ b/src/action_class_set_darray.cc @@ -14,7 +14,7 @@ START_CLASS_DEF CLASS = action - IMPLEMENTS = dump;xref + IMPLEMENTS = dump IMPLEMENTS = destroy;execute MEMBERS = grib_darray *darray MEMBERS = char *name @@ -34,7 +34,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int execute(grib_action* a,grib_handle* h); @@ -57,7 +56,7 @@ static grib_action_class _grib_action_class_set_darray = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ 0, /* create_accessor*/ @@ -123,7 +122,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); } - -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_set_sarray.cc b/src/action_class_set_sarray.cc index b12443f23..3b670aa87 100644 --- a/src/action_class_set_sarray.cc +++ b/src/action_class_set_sarray.cc @@ -8,16 +8,13 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/*************************************************************************** - * Enrico Fucile * - ***************************************************************************/ #include "grib_api_internal.h" /* This is used by make_class.pl START_CLASS_DEF CLASS = action - IMPLEMENTS = dump;xref + IMPLEMENTS = dump IMPLEMENTS = destroy;execute MEMBERS = grib_sarray *sarray MEMBERS = char *name @@ -37,7 +34,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int execute(grib_action* a,grib_handle* h); @@ -60,7 +56,7 @@ static grib_action_class _grib_action_class_set_sarray = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ 0, /* create_accessor*/ @@ -127,7 +123,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); } - -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_switch.cc b/src/action_class_switch.cc index 57e47dc89..b116aa846 100644 --- a/src/action_class_switch.cc +++ b/src/action_class_switch.cc @@ -8,9 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/*************************************************************************** - * Enrico Fucile * - ***************************************************************************/ #include "grib_api_internal.h" /* This is used by make_class.pl @@ -19,7 +16,6 @@ CLASS = action SUPER = action_class_section IMPLEMENTS = destroy - IMPLEMENTS = xref IMPLEMENTS = execute MEMBERS = grib_arguments* args MEMBERS = grib_case *Case @@ -39,7 +35,6 @@ or edit "action.class" and rerun ./make_class.pl */ static void init_class (grib_action_class*); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int execute(grib_action* a,grib_handle* h); @@ -65,7 +60,7 @@ static grib_action_class _grib_action_class_switch = { &destroy, /* destroy */ 0, /* dump */ - &xref, /* xref */ + 0, /* xref */ 0, /* create_accessor*/ @@ -79,6 +74,7 @@ grib_action_class* grib_action_class_switch = &_grib_action_class_switch; static void init_class(grib_action_class* c) { c->dump = (*(c->super))->dump; + c->xref = (*(c->super))->xref; c->create_accessor = (*(c->super))->create_accessor; c->notify_change = (*(c->super))->notify_change; c->reparse = (*(c->super))->reparse; @@ -240,7 +236,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); } - -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_transient_darray.cc b/src/action_class_transient_darray.cc index ce4e514f9..9990beb41 100644 --- a/src/action_class_transient_darray.cc +++ b/src/action_class_transient_darray.cc @@ -8,9 +8,6 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -/*************************************************************************** - * Enrico Fucile * - ***************************************************************************/ #include "grib_api_internal.h" /* This is used by make_class.pl @@ -18,7 +15,7 @@ START_CLASS_DEF CLASS = action SUPER = action_class_gen - IMPLEMENTS = dump;xref + IMPLEMENTS = dump IMPLEMENTS = destroy;execute MEMBERS = grib_darray *darray MEMBERS = char *name @@ -38,7 +35,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int execute(grib_action* a,grib_handle* h); @@ -65,7 +61,7 @@ static grib_action_class _grib_action_class_transient_darray = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ 0, /* create_accessor*/ @@ -78,6 +74,7 @@ grib_action_class* grib_action_class_transient_darray = &_grib_action_class_tran static void init_class(grib_action_class* c) { + c->xref = (*(c->super))->xref; c->create_accessor = (*(c->super))->create_accessor; c->notify_change = (*(c->super))->notify_change; c->reparse = (*(c->super))->reparse; @@ -140,7 +137,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, a->name); grib_darray_delete(context, a->darray); } - -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/action_class_when.cc b/src/action_class_when.cc index a274a7c27..49fc325be 100644 --- a/src/action_class_when.cc +++ b/src/action_class_when.cc @@ -18,7 +18,7 @@ START_CLASS_DEF CLASS = action IMPLEMENTS = create_accessor - IMPLEMENTS = dump;xref + IMPLEMENTS = dump IMPLEMENTS = destroy;notify_change MEMBERS = grib_expression *expression MEMBERS = grib_action *block_true @@ -40,7 +40,6 @@ or edit "action.class" and rerun ./make_class.pl static void init_class (grib_action_class*); static void dump (grib_action* d, FILE*,int); -static void xref (grib_action* d, FILE* f,const char* path); static void destroy (grib_context*,grib_action*); static int create_accessor(grib_section*,grib_action*,grib_loader*); static int notify_change(grib_action* a, grib_accessor* observer,grib_accessor* observed); @@ -66,7 +65,7 @@ static grib_action_class _grib_action_class_when = { &destroy, /* destroy */ &dump, /* dump */ - &xref, /* xref */ + 0, /* xref */ &create_accessor, /* create_accessor*/ @@ -232,7 +231,3 @@ static void destroy(grib_context* context, grib_action* act) grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); } - -static void xref(grib_action* d, FILE* f, const char* path) -{ -} diff --git a/src/eccodes_prototypes.h b/src/eccodes_prototypes.h index cf0985e86..ecdd83633 100644 --- a/src/eccodes_prototypes.h +++ b/src/eccodes_prototypes.h @@ -5,7 +5,6 @@ #endif /* action.cc */ -void grib_xref(grib_action* a, FILE* f, const char* path); void grib_action_delete(grib_context* context, grib_action* a); int grib_create_accessor(grib_section* p, grib_action* a, grib_loader* h); int grib_action_notify_change(grib_action* a, grib_accessor* observer, grib_accessor* observed); @@ -13,7 +12,6 @@ grib_action* grib_action_reparse(grib_action* a, grib_accessor* acc, int* doit); int grib_action_execute(grib_action* a, grib_handle* h); void grib_dump_action_branch(FILE* out, grib_action* a, int decay); void grib_dump_action_tree(grib_context* ctx, FILE* out); -void grib_xref_action_branch(FILE* out, grib_action* a, const char* path); /* action_class_alias.cc */ grib_action* grib_action_create_alias(grib_context* context, const char* name, const char* arg1, const char* name_space, int flags); From fbce17e52ba20200123576272a711f4395bca688 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sat, 21 Oct 2023 13:55:27 +0100 Subject: [PATCH 06/10] Testing: Comparing thru indexes --- tests/grib_indexing.sh | 26 +++++++++++++++++++++++++- tools/grib_tools.cc | 20 ++++++++++---------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/tests/grib_indexing.sh b/tests/grib_indexing.sh index 453208f62..ee356393d 100755 --- a/tests/grib_indexing.sh +++ b/tests/grib_indexing.sh @@ -13,6 +13,7 @@ label="grib_indexing_test" temp=temp.$label.index.out infile=${data_dir}/index.grib +sample1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl # Writes to "out.gribidx" $EXEC ${test_dir}/grib_indexing ${infile} > $temp @@ -109,9 +110,32 @@ ${tools_dir}/grib_index_build -N -o $tempIndex2 $tempGribFile2 ${tools_dir}/grib_compare -v $tempIndex1 $tempIndex2 rm -f $tempIndex1 $tempIndex2 $tempGribFile1 $tempGribFile2 +# Indexes containing different keys +${tools_dir}/grib_index_build -k date,time -N -o $tempIndex1 $sample1 +${tools_dir}/grib_index_build -k level -N -o $tempIndex2 $sample1 +set +e +${tools_dir}/grib_compare -v $tempIndex1 $tempIndex2 2>$tempOut +status=$? +set -e +[ $status -ne 0 ] +cat $tempOut +grep -q "Indexes contained in the input files have different keys" $tempOut +rm -f $tempIndex1 $tempIndex2 $tempOut + + +${tools_dir}/grib_index_build -k date,time -N -o $tempIndex1 $sample1 +${tools_dir}/grib_index_build -k date,time,level -N -o $tempIndex2 $sample1 +set +e +${tools_dir}/grib_compare -v $tempIndex2 $tempIndex1 2>$tempOut +status=$? +set -e +[ $status -ne 0 ] +cat $tempOut +grep -q "Indexes contained in the input files have different keys" $tempOut +rm -f $tempIndex1 $tempIndex2 $tempOut + # ECC-1516 # --------- -sample1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl ${tools_dir}/grib_index_build -N -o $tempIndex1 $sample1 > /dev/null ${tools_dir}/grib_dump $tempIndex1 >/dev/null diff --git a/tools/grib_tools.cc b/tools/grib_tools.cc index ce038d07f..72122fbd1 100644 --- a/tools/grib_tools.cc +++ b/tools/grib_tools.cc @@ -511,17 +511,17 @@ static int grib_tool_index(grib_runtime_options* options) k2 = k2->next; } if (!found) { - printf("Indexes contained in the input files have different keys\n"); - printf("keys in file %s:\n", f1); + fprintf(stderr, "Indexes contained in the input files have different keys!\n"); + fprintf(stderr, "keys in file %s:\n", f1); k1 = options->index1->keys; while (k1) { - printf("\t%s\n", k1->name); + fprintf(stderr, "\t%s\n", k1->name); k1 = k1->next; } - printf("keys in file %s:\n", f2); + fprintf(stderr, "keys in file %s:\n", f2); k2 = options->index2->keys; while (k2) { - printf("\t%s\n", k2->name); + fprintf(stderr, "\t%s\n", k2->name); k2 = k2->next; } exit(1); @@ -543,17 +543,17 @@ static int grib_tool_index(grib_runtime_options* options) k1 = k1->next; } if (!found) { - printf("Indexes contained in the input files have different keys\n"); - printf("keys in file %s:\n", f2); + fprintf(stderr,"Indexes contained in the input files have different keys!\n"); + fprintf(stderr, "keys in file %s:\n", f2); k2 = options->index2->keys; while (k2) { - printf("\t%s\n", k2->name); + fprintf(stderr, "\t%s\n", k2->name); k2 = k2->next; } - printf("keys in file %s:\n", f1); + fprintf(stderr, "keys in file %s:\n", f1); k1 = options->index1->keys; while (k1) { - printf("\t%s\n", k1->name); + fprintf(stderr, "\t%s\n", k1->name); k1 = k1->next; } From b2039a90ac48b8c81f44de9081f7dafc38f3d114 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sat, 21 Oct 2023 14:39:17 +0100 Subject: [PATCH 07/10] Testing: Indexing with directory traversal --- tests/grib_indexing.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/grib_indexing.sh b/tests/grib_indexing.sh index ee356393d..5fe1460ff 100755 --- a/tests/grib_indexing.sh +++ b/tests/grib_indexing.sh @@ -134,6 +134,22 @@ cat $tempOut grep -q "Indexes contained in the input files have different keys" $tempOut rm -f $tempIndex1 $tempIndex2 $tempOut +# Indexing with directory traversal +# ---------------------------------- +temp_dir_A=tempdir.$label +temp_dir_B=tempdir.$label/subdir.$label +rm -rf $temp_dir_A +mkdir $temp_dir_A +mkdir $temp_dir_B +cp ${data_dir}/tigge/tigge_rjtd_pl_*grib $temp_dir_A +cp ${data_dir}/tigge/tigge_rjtd_sfc_*grib $temp_dir_B + +${tools_dir}/grib_index_build -o $tempIndex1 $temp_dir_A +${tools_dir}/grib_dump $tempIndex1 + +rm -rf $temp_dir_A + + # ECC-1516 # --------- ${tools_dir}/grib_index_build -N -o $tempIndex1 $sample1 > /dev/null From 5be62bbcd2b5f4b6ccb2ca5240e1e4e37a60ce06 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 23 Oct 2023 16:04:01 +0100 Subject: [PATCH 08/10] Testing: string_compare --- tests/grib_filter.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/grib_filter.sh b/tests/grib_filter.sh index 6a7ebb38f..22a0158ac 100755 --- a/tests/grib_filter.sh +++ b/tests/grib_filter.sh @@ -383,9 +383,20 @@ cat >$tempFilt < $tempOut -cat $tempOut grep "MISSING" $tempOut +# Test string_compare +cat >$tempFilt < $tempOut 2>&1 +cat $tempOut +grep "rubbish must fail" $tempOut +grep "garbage must fail" $tempOut +grep "unable to get rubbish as string" $tempOut +grep "unable to get garbage as string" $tempOut + # Clean up rm -f $tempGrib $tempFilt $tempOut $tempRef From 0fc243aea74bde81f997a4301ec80618610bbf56 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 23 Oct 2023 16:32:56 +0100 Subject: [PATCH 09/10] Error messages --- src/grib_fieldset.cc | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/src/grib_fieldset.cc b/src/grib_fieldset.cc index 88eabeb7b..72cb928c6 100644 --- a/src/grib_fieldset.cc +++ b/src/grib_fieldset.cc @@ -73,8 +73,7 @@ int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type) 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", - sizeof(long) * GRIB_START_ARRAY_SIZE); + "%s: Error allocating %zu bytes", __func__, sizeof(long) * GRIB_START_ARRAY_SIZE); err = GRIB_OUT_OF_MEMORY; return err; } @@ -83,8 +82,7 @@ int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type) 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", - sizeof(double) * GRIB_START_ARRAY_SIZE); + "%s: Error allocating %zu bytes", __func__, sizeof(double) * GRIB_START_ARRAY_SIZE); err = GRIB_OUT_OF_MEMORY; return err; } @@ -93,8 +91,7 @@ int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int type) 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", - sizeof(char*) * GRIB_START_ARRAY_SIZE); + "%s: Error allocating %zu bytes", __func__, sizeof(char*) * GRIB_START_ARRAY_SIZE); err = GRIB_OUT_OF_MEMORY; return err; } @@ -171,8 +168,7 @@ 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); + "%s: Error allocating %zu bytes", __func__, newsize - set->columns[i].values_array_size); return GRIB_OUT_OF_MEMORY; } else @@ -183,8 +179,7 @@ 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); + "%s: Error allocating %zu bytes", __func__, newsize - set->columns[i].values_array_size); return GRIB_OUT_OF_MEMORY; } else @@ -195,8 +190,7 @@ 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); + "%s: Error allocating %zu bytes", __func__, newsize - set->columns[i].values_array_size); return GRIB_OUT_OF_MEMORY; } else @@ -206,8 +200,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", - newsize * sizeof(int)); + "%s: Error allocating %zu bytes", __func__, newsize * sizeof(int)); return GRIB_OUT_OF_MEMORY; } else @@ -332,8 +325,7 @@ static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, const char msize = sizeof(grib_fieldset); set = (grib_fieldset*)grib_context_malloc_clear(c, msize); if (!set) { - grib_context_log(c, GRIB_LOG_ERROR, - "grib_fieldset_create_from_keys: Cannot malloc %lu bytes", msize); + grib_context_log(c, GRIB_LOG_ERROR, "%s: Error allocating %zu bytes", __func__, msize); return NULL; } @@ -357,7 +349,7 @@ static grib_fieldset* grib_fieldset_create_from_keys(grib_context* c, const char set->columns = (grib_column*)grib_context_malloc_clear(c, sizeof(grib_column) * nkeys); if (!set->columns) { - grib_context_log(c, GRIB_LOG_ERROR, "grib_fieldset_create_from_keys: memory allocation error"); + grib_context_log(c, GRIB_LOG_ERROR, "%s: memory allocation error", __func__); *err = GRIB_OUT_OF_MEMORY; return NULL; } @@ -417,7 +409,6 @@ int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string) // grib_math* m = NULL; // 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); @@ -816,8 +807,7 @@ static int grib_fieldset_resize_int_array(grib_int_array* a, size_t newsize) el = (int*)grib_context_realloc(a->context, a->el, newsize); if (!el) { grib_context_log(a->context, GRIB_LOG_ERROR, - "grib_fieldset_resize_int_array: Cannot malloc %lu bytes", - newsize); + "%s: Error allocating %zu bytes", __func__, newsize); return GRIB_OUT_OF_MEMORY; } else @@ -860,8 +850,7 @@ static int grib_fieldset_resize_fields(grib_fieldset* set, size_t newsize) fields = (grib_field**)grib_context_realloc(set->context, set->fields, newsize * sizeof(grib_field*)); if (!fields) { grib_context_log(set->context, GRIB_LOG_ERROR, - "grib_fieldset_resize_fields: Cannot malloc %lu bytes", - newsize * sizeof(grib_field*)); + "%s: Error allocating %zu bytes", __func__, newsize * sizeof(grib_field*)); return GRIB_OUT_OF_MEMORY; } else From 332461b3e66c1d43aed59c81ce08d72e74fdda5f Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 24 Oct 2023 12:23:51 +0100 Subject: [PATCH 10/10] SUP-3879: Potential buffer overflow on projection functions --- src/grib_accessor_class_proj_string.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/grib_accessor_class_proj_string.cc b/src/grib_accessor_class_proj_string.cc index ffd5ed831..00b25c6a3 100644 --- a/src/grib_accessor_class_proj_string.cc +++ b/src/grib_accessor_class_proj_string.cc @@ -161,7 +161,7 @@ static int proj_space_view(grib_handle* h, char* result) { return GRIB_NOT_IMPLEMENTED; // int err = 0; - // char shape[64] = {0,}; + // char shape[128] = {0,}; // double latOfSubSatellitePointInDegrees, lonOfSubSatellitePointInDegrees; // if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) // return err; @@ -190,7 +190,7 @@ static int proj_equatorial_azimuthal_equidistant(grib_handle* h, char* result) static int proj_lambert_conformal(grib_handle* h, char* result) { int err = 0; - char shape[64] = {0,}; + char shape[128] = {0,}; double LoVInDegrees = 0, LaDInDegrees = 0, Latin1InDegrees = 0, Latin2InDegrees = 0; if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) @@ -211,7 +211,7 @@ static int proj_lambert_conformal(grib_handle* h, char* result) static int proj_lambert_azimuthal_equal_area(grib_handle* h, char* result) { int err = 0; - char shape[64] = {0,}; + char shape[128] = {0,}; double standardParallel = 0, centralLongitude = 0; if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) @@ -231,7 +231,7 @@ static int proj_polar_stereographic(grib_handle* h, char* result) double centralLongitude = 0, centralLatitude = 0; int has_northPole = 0; long projectionCentreFlag = 0; - char shape[64] = {0,}; + char shape[128] = {0,}; if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) return err; @@ -252,7 +252,7 @@ static int proj_polar_stereographic(grib_handle* h, char* result) static int proj_unprojected(grib_handle* h, char* result) { int err = 0; - //char shape[64] = {0,}; + //char shape[128] = {0,}; //if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) return err; //snprintf(result, 1024, "+proj=longlat %s", shape); snprintf(result, 1024, "+proj=longlat +datum=WGS84 +no_defs +type=crs"); @@ -264,7 +264,7 @@ static int proj_mercator(grib_handle* h, char* result) { int err = 0; double LaDInDegrees = 0; - char shape[64] = {0,}; + char shape[128] = {0,}; if ((err = grib_get_double_internal(h, "LaDInDegrees", &LaDInDegrees)) != GRIB_SUCCESS) return err;