mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' into feature/ECC-1620_sub-hourly
This commit is contained in:
commit
29bd34a13f
|
@ -1,4 +1,4 @@
|
|||
0 unknown unknown
|
||||
1 standard Standard resolution model output with longer availability
|
||||
2 highres High resolution model output with limited availability
|
||||
65535 65535 Missing
|
||||
2 high High resolution model output with limited availability
|
||||
65535 65535 Missing
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# (C) Copyright 2005- ECMWF.
|
||||
|
||||
# TEMPLATE 4.20, Radar product
|
||||
# Parameter category
|
||||
codetable[1] parameterCategory ('4.1.[discipline:l].table',masterDir,localDir) : dump;
|
||||
|
||||
# Parameter number
|
||||
|
@ -9,22 +8,21 @@ codetable[1] parameterNumber ('4.2.[discipline:l].[parameterCategory:l].table',m
|
|||
meta parameterUnits codetable_units(parameterNumber) : dump;
|
||||
meta parameterName codetable_title(parameterNumber) : dump;
|
||||
|
||||
# Type of generating process
|
||||
codetable[1] typeOfGeneratingProcess ('4.3.table',masterDir,localDir) : dump;
|
||||
|
||||
# Number of radar sites used
|
||||
unsigned[1] numberOfRadarSitesUsed : dump;
|
||||
|
||||
# Indicator of unit of time range
|
||||
codetable[1] indicatorOfUnitOfTimeRange ('4.4.table',masterDir,localDir) : dump;
|
||||
alias indicatorOfUnitForForecastTime = indicatorOfUnitOfTimeRange;
|
||||
alias defaultStepUnits = one; # 1 means Hour. See code table 4.4
|
||||
template_nofail default_step_units "grib2/localConcepts/[centre:s]/default_step_units.def";
|
||||
codetable[1] stepUnits 'stepUnits.table' = defaultStepUnits : transient,dump,no_copy;
|
||||
|
||||
# Site latitude (in 10-6 degree)
|
||||
# Site latitude (in microdegrees)
|
||||
unsigned[4] siteLatitude : dump;
|
||||
|
||||
# Site longitude (in 10-6 degree)
|
||||
# Site longitude (in microdegrees)
|
||||
unsigned[4] siteLongitude : dump;
|
||||
|
||||
# Site elevation (meters)
|
||||
|
|
|
@ -8,8 +8,10 @@ alias hoursAfterReferenceTimeOfDataCutoff=hoursAfterDataCutoff;
|
|||
unsigned[1] minutesAfterDataCutoff = missing() : edition_specific,can_be_missing;
|
||||
alias minutesAfterReferenceTimeOfDataCutoff=minutesAfterDataCutoff;
|
||||
|
||||
# Indicator of unit of time range
|
||||
# Indicator of unit for forecastTime (ECC-1709)
|
||||
codetable[1] indicatorOfUnitOfTimeRange ('4.4.table',masterDir,localDir) : dump;
|
||||
alias indicatorOfUnitForForecastTime = indicatorOfUnitOfTimeRange;
|
||||
|
||||
#alias defaultStepUnits = one; # 1 means Hour. See code table 4.4
|
||||
#alias forecastTimeUnit = indicatorOfUnitOfTimeRange;
|
||||
#template_nofail default_step_units "grib2/localConcepts/[centre:s]/default_step_units.def";
|
||||
|
|
|
@ -10,8 +10,10 @@ alias hoursAfterReferenceTimeOfDataCutoff=hoursAfterDataCutoff;
|
|||
unsigned[1] minutesAfterDataCutoff = missing() : edition_specific,can_be_missing;
|
||||
alias minutesAfterReferenceTimeOfDataCutoff=minutesAfterDataCutoff;
|
||||
|
||||
# Indicator of unit of time range
|
||||
# Indicator of unit for forecastTime (ECC-1709)
|
||||
codetable[1] indicatorOfUnitOfTimeRange ('4.4.table',masterDir,localDir) : dump;
|
||||
alias indicatorOfUnitForForecastTime = indicatorOfUnitOfTimeRange;
|
||||
|
||||
alias defaultStepUnits = one; # 1 means Hour. See code table 4.4
|
||||
template_nofail default_step_units "grib2/localConcepts/[centre:s]/default_step_units.def";
|
||||
codetable[1] stepUnits 'stepUnits.table' = defaultStepUnits : transient,dump,no_copy;
|
||||
|
|
|
@ -267,11 +267,9 @@ static void add_bitstream(bitstream_context *ctx, grib_accessor* a, int t, int n
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* find min/max of an integer array
|
||||
* return 0: if min max found
|
||||
* return 1: if min max not found, min = max = 0
|
||||
*/
|
||||
// find min/max of an integer array
|
||||
// return 0: if min max found
|
||||
// return 1: if min max not found, min = max = 0
|
||||
static int int_min_max_array(int* data, unsigned int n, int* min, int* max)
|
||||
{
|
||||
unsigned int first;
|
||||
|
@ -1325,8 +1323,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
|
|||
grib_context_log(a->context, GRIB_LOG_ERROR, "%s packing: failed to get min max of data", cclass_name);
|
||||
return GRIB_ENCODING_ERROR;
|
||||
}
|
||||
min_val = static_cast<double>(mn);
|
||||
max_val = static_cast<double>(mx);
|
||||
min_val = mn;
|
||||
max_val = mx;
|
||||
|
||||
binary_scale = bin_scale;
|
||||
|
||||
|
|
|
@ -8,11 +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
|
||||
|
@ -21,6 +16,7 @@
|
|||
CLASS = accessor
|
||||
SUPER = grib_accessor_class_gen
|
||||
IMPLEMENTS = init;dump;
|
||||
IMPLEMENTS = get_native_type
|
||||
IMPLEMENTS = notify_change
|
||||
END_CLASS_DEF
|
||||
|
||||
|
@ -36,6 +32,7 @@ or edit "accessor.class" and rerun ./make_class.pl
|
|||
|
||||
*/
|
||||
|
||||
static int get_native_type(grib_accessor*);
|
||||
static void dump(grib_accessor*, grib_dumper*);
|
||||
static void init(grib_accessor*, const long, grib_arguments*);
|
||||
static int notify_change(grib_accessor*, grib_accessor*);
|
||||
|
@ -64,7 +61,7 @@ static grib_accessor_class _grib_accessor_class_when = {
|
|||
0, /* get number of values */
|
||||
0, /* get number of bytes */
|
||||
0, /* get offset to bytes */
|
||||
0, /* get native type */
|
||||
&get_native_type, /* get native type */
|
||||
0, /* get sub_section */
|
||||
0, /* pack_missing */
|
||||
0, /* is_missing */
|
||||
|
@ -109,7 +106,6 @@ static void init(grib_accessor* a, const long len, grib_arguments* arg)
|
|||
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||
}
|
||||
|
||||
|
||||
static void dump(grib_accessor* a, grib_dumper* dumper)
|
||||
{
|
||||
/* grib_dump_when(dumper,a,NULL); */
|
||||
|
@ -119,3 +115,8 @@ static int notify_change(grib_accessor* a, grib_accessor* changed)
|
|||
{
|
||||
return grib_action_notify_change(a->creator, a, changed);
|
||||
}
|
||||
|
||||
static int get_native_type(grib_accessor* a)
|
||||
{
|
||||
return GRIB_TYPE_UNDEFINED;
|
||||
}
|
||||
|
|
|
@ -86,16 +86,24 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres)
|
|||
{
|
||||
grib_expression_functor* e = (grib_expression_functor*)g;
|
||||
|
||||
if (strcmp(e->name, "lookup") == 0) {
|
||||
if (STR_EQUAL(e->name, "lookup")) {
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
if (strcmp(e->name, "new") == 0) {
|
||||
if (STR_EQUAL(e->name, "new")) {
|
||||
*lres = h->loader != NULL;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
if (strcmp(e->name, "missing") == 0) {
|
||||
if (STR_EQUAL(e->name, "abs")) {
|
||||
grib_expression* exp = grib_arguments_get_expression(h, e->args, 0);
|
||||
long lval = 0;
|
||||
int ret = grib_expression_evaluate_long(h, exp, &lval);
|
||||
*lres = abs(lval);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (STR_EQUAL(e->name, "missing")) {
|
||||
const char* p = grib_arguments_get_name(h, e->args, 0);
|
||||
if (p) {
|
||||
long val = 0;
|
||||
|
@ -122,7 +130,7 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres)
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
if (strcmp(e->name, "defined") == 0) {
|
||||
if (STR_EQUAL(e->name, "defined")) {
|
||||
const char* p = grib_arguments_get_name(h, e->args, 0);
|
||||
|
||||
if (p) {
|
||||
|
@ -134,7 +142,7 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres)
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
if (strcmp(e->name, "environment_variable") == 0) {
|
||||
if (STR_EQUAL(e->name, "environment_variable")) {
|
||||
// ECC-1520: This implementation has some limitations:
|
||||
// 1. Cannot distinguish between environment variable NOT SET
|
||||
// and SET but equal to 0
|
||||
|
@ -154,12 +162,12 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres)
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
if (strcmp(e->name, "changed") == 0) {
|
||||
if (STR_EQUAL(e->name, "changed")) {
|
||||
*lres = 1;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
if (strcmp(e->name, "gribex_mode_on") == 0) {
|
||||
if (STR_EQUAL(e->name, "gribex_mode_on")) {
|
||||
*lres = h->context->gribex_mode_on ? 1 : 0;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ int main(int argc, char* argv[])
|
|||
|
||||
assert (argc == 3);
|
||||
|
||||
printf("%ld\n", codes_get_api_version());
|
||||
|
||||
in = fopen(argv[1], "rb");
|
||||
assert(in);
|
||||
|
||||
|
|
|
@ -398,6 +398,14 @@ grep "unable to get rubbish as string" $tempOut
|
|||
grep "unable to get garbage as string" $tempOut
|
||||
|
||||
|
||||
# Use of "abs"
|
||||
cat >$tempFilt <<EOF
|
||||
meta abs_twice_bsf evaluate( abs(binaryScaleFactor * 2) );
|
||||
assert(abs_twice_bsf == 20);
|
||||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempGrib $tempFilt $tempOut $tempRef
|
||||
rm -f ${data_dir}/formatint.rules ${data_dir}/binop.rules
|
||||
|
|
|
@ -908,7 +908,7 @@ int main(int argc, char* argv[])
|
|||
GRIB_CHECK(grib_set_long(h, "minute", 0), 0);
|
||||
GRIB_CHECK(grib_set_long(h, "second", 0), 0);
|
||||
len = strlen("s");
|
||||
GRIB_CHECK(grib_set_string(h, "indicatorOfUnitOfTimeRange", "s", &len), 0);
|
||||
GRIB_CHECK(grib_set_string(h, "indicatorOfUnitForForecastTime", "s", &len), 0);
|
||||
len = strlen("s");
|
||||
GRIB_CHECK(grib_set_string(h, "stepUnits", "s", &len), 0);
|
||||
GRIB_CHECK(grib_set_long(h, "endStep", 3600), 0);
|
||||
|
|
|
@ -101,7 +101,7 @@ ${tools_dir}/grib_set -s indicatorOfUnitOfTimeRange=m $grib1_sample $temp
|
|||
unit=`${tools_dir}/grib_get -p unitOfTimeRange $temp`
|
||||
[ "$unit" = "0" ]
|
||||
${tools_dir}/grib_set -s indicatorOfUnitOfTimeRange=m $grib2_sample $temp
|
||||
unit=`${tools_dir}/grib_get -p indicatorOfUnitOfTimeRange $temp`
|
||||
unit=`${tools_dir}/grib_get -p indicatorOfUnitForForecastTime $temp`
|
||||
[ "$unit" = "0" ]
|
||||
|
||||
# ECC-457
|
||||
|
|
|
@ -148,6 +148,16 @@ set -e
|
|||
[ $status -ne 0 ]
|
||||
grep -q "Wrong number of fields" $tempText
|
||||
|
||||
# Not regular grid
|
||||
input=${data_dir}/reduced_gaussian_pressure_level.grib2
|
||||
set +e
|
||||
${tools_dir}/grib_to_netcdf -o $tempNetcdf $input > $tempText 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "not on a regular lat/lon grid or on a regular Gaussian grid" $tempText
|
||||
|
||||
|
||||
export GRIB_TO_NETCDF_CHECKVALIDTIME=0
|
||||
${tools_dir}/grib_to_netcdf -o $tempNetcdf $tempGrib
|
||||
[ -f "$tempNetcdf" ]
|
||||
|
|
|
@ -35,4 +35,9 @@ export METAR_MONTH=4
|
|||
${tools_dir}/metar_get -n ls $metar_file >/dev/null
|
||||
${tools_dir}/metar_get -w count=1/2/3 -p CCCC,latitude,longitude,dateTime,elevation,temperature,dewPointTemperature,qnh $metar_file
|
||||
|
||||
# Decode a 'group' key as int and double
|
||||
result=$( ${tools_dir}/metar_get -p visibilityInMetres:i,visibilityInMetres:d -w count=1 $metar_file )
|
||||
[ "$result" = "6000 6000" ]
|
||||
|
||||
# Clean up
|
||||
rm -f $fLog
|
||||
|
|
|
@ -34,7 +34,8 @@ grib_option grib_options[] = {
|
|||
{ "I", 0, 0, 1, 0, 0 },
|
||||
{ "V", 0, 0, 0, 1, 0 },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
{ "v", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
|
|
@ -44,7 +44,8 @@ grib_option grib_options[] = {
|
|||
{ "g", 0, 0, 0, 1, 0 },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "X:", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
{ "v", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
|
|
@ -53,7 +53,8 @@ grib_option grib_options[] = {
|
|||
{ "V", 0, 0, 0, 1, 0 },
|
||||
{ "q", 0, 0, 1, 0, 0 },
|
||||
{ "S:", "subset_number", "\n\t\tDump the given subset\n", 0, 1, 0 },
|
||||
{ "X:", 0, 0, 0, 1, 0 }
|
||||
{ "X:", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
/* {"x",0,0,0,1,0} */
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ grib_option grib_options[] = {
|
|||
/* {"G",0,0,0,1,0}, */
|
||||
{ "T:", 0, 0, 1, 0, "B" },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
{ "v", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each BUFR "
|
||||
|
|
|
@ -27,7 +27,8 @@ grib_option grib_options[] = {
|
|||
/* {"G",0,0,0,1,0}, */
|
||||
{ "T:", 0, 0, 1, 0, "B" },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 1, 0, 0 }
|
||||
{ "v", 0, 0, 1, 0, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
const char* tool_description =
|
||||
|
|
|
@ -34,7 +34,8 @@ grib_option grib_options[] = {
|
|||
{ "N", 0,
|
||||
"Do not compress index."
|
||||
"\n\t\tBy default the index is compressed to remove keys with only one value.\n",
|
||||
0, 1, 0 }
|
||||
0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
static int compress_index;
|
||||
|
|
|
@ -30,7 +30,8 @@ grib_option grib_options[] = {
|
|||
{ "P", 0, 0, 1, 0, 0 },
|
||||
{ "T:", 0, 0, 1, 0, "B" },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 1, 0, 0 }
|
||||
{ "v", 0, 0, 1, 0, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
const char* tool_description =
|
||||
|
|
|
@ -35,7 +35,8 @@ grib_option grib_options[] = {
|
|||
/* {"G",0,0,0,1,0}, */
|
||||
{ "T:", 0, 0, 1, 0, "B" },
|
||||
{ "f", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
{ "v", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
const char* tool_description =
|
||||
|
|
|
@ -34,7 +34,8 @@ grib_option grib_options[] = {
|
|||
{ "I", 0, 0, 1, 0, 0 },
|
||||
{ "V", 0, 0, 0, 1, 0 },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
{ "v", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@ grib_option grib_options[] = {
|
|||
{ "G", 0, 0, 0, 1, 0 },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "X:", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
{ "v", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
|
|
@ -31,7 +31,8 @@ grib_option grib_options[] = {
|
|||
{ "p:", "key1,key2,...",
|
||||
"\n\t\tDeclaration of keys to dump. Only those keys are dumped (not the whole message).\n", 0, 1, 0 },
|
||||
{ "X:", 0, 0, 0, 1, 0 },
|
||||
{ "x", 0, 0, 0, 1, 0 }
|
||||
{ "x", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
const char* tool_description = "Dump the content of a GRIB file in different formats.";
|
||||
|
|
|
@ -24,7 +24,8 @@ grib_option grib_options[] = {
|
|||
{ "G", 0, 0, 0, 1, 0 },
|
||||
{ "T:", 0, 0, 0, 1, 0 },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
{ "v", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each GRIB "
|
||||
|
|
|
@ -32,7 +32,8 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 1, 0, 0 },
|
||||
{ "X:", 0, 0, 0, 1, 0 },
|
||||
{ "i:", 0, 0, 0, 1, 0 }
|
||||
{ "i:", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
const char* tool_description =
|
||||
|
|
|
@ -31,7 +31,8 @@ grib_option grib_options[] = {
|
|||
{ "G", 0, 0, 0, 1, 0 },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "X:", 0, 0, 0, 1, 0 },
|
||||
{ "V", 0, 0, 0, 1, 0 }
|
||||
{ "V", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
const char* tool_description =
|
||||
|
|
|
@ -15,7 +15,8 @@ grib_option grib_options[] = {
|
|||
{ "V", 0, 0, 0, 1, 0 },
|
||||
{ "p:", 0, 0, 0, 1, 0 }, /* print keys */
|
||||
{ "S", 0, 0, 1, 0, 0 }, /* needed for skip */
|
||||
{ "w:", 0, 0, 0, 1, 0 } /* 'where' clause */
|
||||
{ "w:", 0, 0, 0, 1, 0 }, /* 'where' clause */
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ grib_option grib_options[] = {
|
|||
{ "N", 0,
|
||||
"Do not compress index."
|
||||
"\n\t\tBy default the index is compressed to remove keys with only one value.\n",
|
||||
0, 1, 0 }
|
||||
0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
static int compress_index;
|
||||
|
|
|
@ -35,7 +35,8 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 1, 0, 0 },
|
||||
{ "X:", 0, 0, 0, 1, 0 },
|
||||
{ "x", 0, 0, 0, 1, 0 }
|
||||
{ "x", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
const char* tool_description =
|
||||
|
|
|
@ -56,7 +56,8 @@ grib_option grib_options[] = {
|
|||
{ "g", 0, 0, 0, 1, 0 },
|
||||
{ "G", 0, 0, 0, 1, 0 },
|
||||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
{ "v", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
|
|
@ -106,8 +106,8 @@ static grib_options_help grib_options_help_list[] = {
|
|||
{ "k:", "key1,key2,...",
|
||||
"\n\t\tSpecify a list of keys to index on. By default the input files are indexed on the MARS keys."
|
||||
"\n\t\tFor each key a string (key:s) or a double (key:d) or an integer (key:i)"
|
||||
"\n\t\ttype can be requested.\n" }
|
||||
|
||||
"\n\t\ttype can be requested.\n" },
|
||||
{ "h", 0, "Display this help text and exit.\n" }
|
||||
};
|
||||
|
||||
static int grib_options_help_count = sizeof(grib_options_help_list) / sizeof(grib_options_help);
|
||||
|
@ -198,6 +198,10 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
int has_input_extra = 0, nfiles = 0;
|
||||
char *karg = NULL, *warg = NULL, *sarg = NULL, *barg = NULL;
|
||||
|
||||
if (grib_options_on("h")) {
|
||||
usage();
|
||||
}
|
||||
|
||||
if (grib_options_on("V")) {
|
||||
printf("\necCodes Version ");
|
||||
grib_print_api_version(stdout);
|
||||
|
|
|
@ -39,7 +39,8 @@ grib_option grib_options[] = {
|
|||
{ "G", 0, 0, 0, 1, 0 },
|
||||
{ "T:", 0, 0, 0, 1, 0 },
|
||||
{ "f", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
{ "v", 0, 0, 0, 1, 0 },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
const char* tool_description =
|
||||
|
|
|
@ -1317,8 +1317,9 @@ static int axisindex(const char* name)
|
|||
{
|
||||
size_t i = 0;
|
||||
for (i = 0; i < NUMBER(global_axis); i++) {
|
||||
if (strcmp(name, global_axis[i].name) == 0)
|
||||
return i;
|
||||
if (STR_EQUAL(name, global_axis[i].name)){
|
||||
return (int)i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -1335,7 +1336,7 @@ static namecmp comparator(const char* name)
|
|||
}
|
||||
|
||||
if (dontcompare != NULL) {
|
||||
if (strcmp(dontcompare, name) == 0)
|
||||
if (STR_EQUAL(dontcompare, name))
|
||||
return eq_null;
|
||||
}
|
||||
|
||||
|
@ -1434,7 +1435,7 @@ static void unset_value(request* r, const char* parname)
|
|||
|
||||
p = r->params;
|
||||
while (p) {
|
||||
if (strcmp(parname, p->name) == 0) {
|
||||
if (STR_EQUAL(parname, p->name)) {
|
||||
if (q)
|
||||
q->next = p->next;
|
||||
else
|
||||
|
@ -1624,7 +1625,7 @@ static void cube_indexes(
|
|||
int k = 0;
|
||||
int count = count_values(cube, axis);
|
||||
int last = h->index_cache[i];
|
||||
const bool is_time_axis = (strcmp(axis, "time") == 0);
|
||||
const bool is_time_axis = (STR_EQUAL(axis, "time"));
|
||||
if (is_time_axis) {
|
||||
Assert(times_array);
|
||||
Assert(times_array_size == count);
|
||||
|
@ -1956,9 +1957,9 @@ static long monthnumber(const char* m)
|
|||
static int check_stepUnits(const char* step_units_str)
|
||||
{
|
||||
/* Only hours, minutes and seconds supported */
|
||||
if (strcmp(step_units_str, "h") == 0 ||
|
||||
strcmp(step_units_str, "m") == 0 ||
|
||||
strcmp(step_units_str, "s") == 0) {
|
||||
if (STR_EQUAL(step_units_str, "h") ||
|
||||
STR_EQUAL(step_units_str, "m") ||
|
||||
STR_EQUAL(step_units_str, "s")) {
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
return GRIB_WRONG_STEP_UNIT;
|
||||
|
@ -2051,10 +2052,10 @@ static void validation_time(request* r)
|
|||
grib_context_log(ctx, GRIB_LOG_ERROR,
|
||||
"Cannot convert stepUnits of '%s'. Only hours, minutes and seconds supported.", step_units);
|
||||
}
|
||||
if (strcmp("m", step_units) == 0) {
|
||||
if (STR_EQUAL("m", step_units)) {
|
||||
step /= 60;
|
||||
}
|
||||
else if (strcmp("s", step_units) == 0) {
|
||||
else if (STR_EQUAL("s", step_units)) {
|
||||
step /= 3600;
|
||||
}
|
||||
}
|
||||
|
@ -2121,19 +2122,19 @@ static nc_type translate_nctype(const char* name)
|
|||
if (!name)
|
||||
return NC_SHORT;
|
||||
|
||||
if (strcmp(name, "NC_BYTE") == 0)
|
||||
if (STR_EQUAL(name, "NC_BYTE"))
|
||||
return NC_BYTE;
|
||||
|
||||
if (strcmp(name, "NC_SHORT") == 0)
|
||||
if (STR_EQUAL(name, "NC_SHORT"))
|
||||
return NC_SHORT;
|
||||
|
||||
if (strcmp(name, "NC_INT") == 0)
|
||||
if (STR_EQUAL(name, "NC_INT"))
|
||||
return NC_INT;
|
||||
|
||||
if (strcmp(name, "NC_FLOAT") == 0)
|
||||
if (STR_EQUAL(name, "NC_FLOAT"))
|
||||
return NC_FLOAT;
|
||||
|
||||
if (strcmp(name, "NC_DOUBLE") == 0)
|
||||
if (STR_EQUAL(name, "NC_DOUBLE"))
|
||||
return NC_DOUBLE;
|
||||
|
||||
grib_context_log(ctx, GRIB_LOG_ERROR, "Unknown netCDF type '%s'. Using NC_SHORT", name);
|
||||
|
@ -2163,7 +2164,7 @@ static int set_dimension(int ncid, const char* name, int n, int xtype, const cha
|
|||
int dim_id = DIM_ID;
|
||||
int dim_vec[DIM_ID];
|
||||
|
||||
if (setup.unlimited && (strcmp(name, setup.unlimited) == 0))
|
||||
if ( setup.unlimited && (STR_EQUAL(name, setup.unlimited)) )
|
||||
n = NC_UNLIMITED;
|
||||
|
||||
stat = nc_def_dim(ncid, name, n, &dim_id);
|
||||
|
@ -2197,7 +2198,7 @@ static int check_grid(field* f)
|
|||
return e;
|
||||
}
|
||||
|
||||
if (strcmp(grid_type, "regular_ll") != 0 && (strcmp(grid_type, "regular_gg") != 0)) {
|
||||
if ( !STR_EQUAL(grid_type, "regular_ll") && !STR_EQUAL(grid_type, "regular_gg") ) {
|
||||
grib_context_log(ctx, GRIB_LOG_ERROR, "Grid type = %s", grid_type);
|
||||
grib_context_log(ctx, GRIB_LOG_ERROR, "First GRIB is not on a regular lat/lon grid or on a regular Gaussian grid. Exiting.\n");
|
||||
return GRIB_GEOCALCULUS_PROBLEM;
|
||||
|
@ -3935,7 +3936,8 @@ grib_option grib_options[] = {
|
|||
"\n\t\tChunking strategy based on GRIB message.\n",
|
||||
0, 1, "6" },
|
||||
{ "s", 0, "Shuffle data before deflation compression.\n", 0, 1, 0 },
|
||||
{ "u:", "dimension", "\n\t\tSet dimension to be an unlimited dimension.\n", 0, 1, "time" }
|
||||
{ "u:", "dimension", "\n\t\tSet dimension to be an unlimited dimension.\n", 0, 1, "time" },
|
||||
{ "h", 0, 0, 0, 1, 0 },
|
||||
};
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
|
Loading…
Reference in New Issue