diff --git a/src/accessor/grib_accessor_class_iterator.cc b/src/accessor/grib_accessor_class_iterator.cc index a92f3375b..27c2b4242 100644 --- a/src/accessor/grib_accessor_class_iterator.cc +++ b/src/accessor/grib_accessor_class_iterator.cc @@ -52,7 +52,7 @@ grib_iterator* grib_iterator_new(const grib_handle* ch, unsigned long flags, int { *error = GRIB_FUNCTIONALITY_NOT_ENABLED; grib_context_log(ch->context, GRIB_LOG_ERROR, - "Geoiterator support not enabled. Please rebuild with -DENABLE_GEOGRAPHY=ON"); + "Geoiterator functionality not enabled. Please rebuild with -DENABLE_GEOGRAPHY=ON"); return NULL; } diff --git a/src/accessor/grib_accessor_class_nearest.cc b/src/accessor/grib_accessor_class_nearest.cc index 6dbac1722..a958c5092 100644 --- a/src/accessor/grib_accessor_class_nearest.cc +++ b/src/accessor/grib_accessor_class_nearest.cc @@ -27,6 +27,7 @@ void grib_accessor_class_nearest_t::dump(grib_accessor* a, grib_dumper* dumper) grib_dump_label(dumper, a, NULL); } +#if defined(HAVE_GEOGRAPHY) grib_nearest* grib_nearest_new(const grib_handle* ch, int* error) { grib_handle* h = (grib_handle*)ch; @@ -47,3 +48,13 @@ grib_nearest* grib_nearest_new(const grib_handle* ch, int* error) return n; } +#else +grib_nearest* grib_nearest_new(const grib_handle* ch, int* error) +{ + *error = GRIB_FUNCTIONALITY_NOT_ENABLED; + grib_context_log(ch->context, GRIB_LOG_ERROR, + "Nearest neighbour functionality not enabled. Please rebuild with -DENABLE_GEOGRAPHY=ON"); + + return NULL; +} +#endif diff --git a/tests/grib_get_fail.sh b/tests/grib_get_fail.sh index 7f1c967e4..a76f7c39f 100755 --- a/tests/grib_get_fail.sh +++ b/tests/grib_get_fail.sh @@ -35,44 +35,43 @@ grep -q "Nh (Key/value not found)" $tempText # Nearest # --------- -set +e -${tools_dir}/grib_get -l abc $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempText 2>&1 -status=$? -set -e -[ $status -ne 0 ] -grep -q "Wrong latitude value" $tempText +if [ $HAVE_GEOGRAPHY -eq 1 ]; then + set +e + ${tools_dir}/grib_get -l abc $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempText 2>&1 + status=$? + set -e + [ $status -ne 0 ] + grep -q "Wrong latitude value" $tempText -set +e -${tools_dir}/grib_get -s Nj=MISSING -l 0,0,1 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1 -status=$? -set -e -[ $status -ne 0 ] -grep -q "Key Nj cannot be 'missing'" $tempText + set +e + ${tools_dir}/grib_get -s Nj=MISSING -l 0,0,1 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1 + status=$? + set -e + [ $status -ne 0 ] + grep -q "Key Nj cannot be 'missing'" $tempText -set +e -${tools_dir}/grib_get -s Nj=0 -l 0,0,1 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1 -status=$? -set -e -[ $status -ne 0 ] -grep -q "Key Nj cannot be 0" $tempText + set +e + ${tools_dir}/grib_get -s Nj=0 -l 0,0,1 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1 + status=$? + set -e + [ $status -ne 0 ] + grep -q "Key Nj cannot be 0" $tempText + set +e + ${tools_dir}/grib_get -l 0,0,5 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib2.tmpl > $tempText 2>&1 + status=$? + set -e + [ $status -ne 0 ] + grep -q "Wrong mode given" $tempText -set +e -${tools_dir}/grib_get -l 0,0,5 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib2.tmpl > $tempText 2>&1 -status=$? -set -e -[ $status -ne 0 ] -grep -q "Wrong mode given" $tempText - - -set +e -${tools_dir}/grib_get -l 0,0,1,nonexistingmask $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1 -status=$? -set -e -[ $status -ne 0 ] -cat $tempText -grep -q "unable to open mask file" $tempText - + set +e + ${tools_dir}/grib_get -l 0,0,1,nonexistingmask $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1 + status=$? + set -e + [ $status -ne 0 ] + cat $tempText + grep -q "unable to open mask file" $tempText +fi # ------------------------ # Unreadable message diff --git a/tests/grib_global.sh b/tests/grib_global.sh index bc2705fb1..565ffac7c 100755 --- a/tests/grib_global.sh +++ b/tests/grib_global.sh @@ -76,14 +76,15 @@ set -e [ $status -ne 0 ] grep -q "Invalid pl array: entry at index=3 is zero" $tempText -${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample1 -set +e -${tools_dir}/grib_get -l 0,0 $tempGrib > $tempText 2>&1 -status=$? -set -e -[ $status -ne 0 ] -grep -q "Invalid pl array: entry at index=3 is zero" $tempText - +if [ $HAVE_GEOGRAPHY -eq 1 ]; then + ${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample1 + set +e + ${tools_dir}/grib_get -l 0,0 $tempGrib > $tempText 2>&1 + status=$? + set -e + [ $status -ne 0 ] + grep -q "Invalid pl array: entry at index=3 is zero" $tempText +fi # Clean up rm -f $tempGrib $tempText $tempFilt diff --git a/tests/grib_gridType.sh b/tests/grib_gridType.sh index 38ed98723..77413d205 100755 --- a/tests/grib_gridType.sh +++ b/tests/grib_gridType.sh @@ -67,12 +67,15 @@ cat > $tempFilt < $tempText 2>&1 -status=$? -set -e -[ $status -ne 0 ] -grep -q "Nearest neighbour functionality is not supported for grid: Variable resolution latitude/longitude" $tempText + +if [ $HAVE_GEOGRAPHY -eq 1 ]; then + set +e + ${tools_dir}/grib_ls -l 0,0 $tempGrib > $tempText 2>&1 + status=$? + set -e + [ $status -ne 0 ] + grep -q "Nearest neighbour functionality is not supported for grid: Variable resolution latitude/longitude" $tempText +fi # Check the keys isSpectral and isGridded # ----------------------------------------