mirror of https://github.com/ecmwf/eccodes.git
Testing: Consistent naming
This commit is contained in:
parent
24bf6f1846
commit
c6bc2dc027
|
@ -11,15 +11,15 @@
|
|||
. ./include.ctest.sh
|
||||
set -u
|
||||
label="bufr_ecc-1028_test"
|
||||
tempFilter=temp.$label.filt
|
||||
tempFilt=temp.$label.filt
|
||||
tempError=temp.$label.err
|
||||
|
||||
sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4.tmpl
|
||||
|
||||
# Incorrect replication. Encoding should fail
|
||||
echo "set unexpandedDescriptors={ 101000, 31002 }; write;" > $tempFilter
|
||||
echo "set unexpandedDescriptors={ 101000, 31002 }; write;" > $tempFilt
|
||||
set +e
|
||||
${tools_dir}/bufr_filter $tempFilter $sample_bufr4 2>$tempError
|
||||
${tools_dir}/bufr_filter $tempFilt $sample_bufr4 2>$tempError
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
|
@ -27,4 +27,4 @@ set -e
|
|||
grep -q "Delayed replication: 101000: expected 1 but only found 0 elements" $tempError
|
||||
|
||||
|
||||
rm -f $tempFilter $tempError
|
||||
rm -f $tempFilt $tempError
|
||||
|
|
|
@ -13,31 +13,6 @@
|
|||
#include <assert.h>
|
||||
|
||||
#define MAX_KEYS 100
|
||||
#if 0
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char *filename;
|
||||
int err = 0;
|
||||
int num_messages = 0, i =0;
|
||||
off_t* offsets = NULL;
|
||||
codes_context* c = codes_context_get_default();
|
||||
const int strict_mode = 1;
|
||||
|
||||
/* Usage: prog file */
|
||||
assert(argc == 2);
|
||||
|
||||
filename = argv[1];
|
||||
err = codes_extract_offsets_malloc(c, filename, PRODUCT_GRIB, &offsets, &num_messages, strict_mode);
|
||||
assert(!err);
|
||||
|
||||
for (i = 0; i < num_messages; ++i) {
|
||||
printf("Message #%d: %lu\n", i, offsets[i]);
|
||||
}
|
||||
free(offsets);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char *filename, *keys;
|
||||
|
@ -85,4 +60,3 @@ int main(int argc, char* argv[])
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
# Define a common label for all the tmp files
|
||||
label="grib_healpix_test"
|
||||
tempFilter="temp.${label}.filt"
|
||||
tempFilt="temp.${label}.filt"
|
||||
tempGrib="temp.${label}.grib"
|
||||
tempLog="temp.${label}.log"
|
||||
|
||||
|
@ -20,7 +20,7 @@ input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
|||
latest=`${tools_dir}/grib_get -p tablesVersionLatest $input`
|
||||
|
||||
# Create a filter
|
||||
cat > $tempFilter <<EOF
|
||||
cat > $tempFilt <<EOF
|
||||
set tablesVersion = $latest;
|
||||
set gridType = "healpix";
|
||||
set longitudeOfFirstGridPointInDegrees = 45;
|
||||
|
@ -28,9 +28,9 @@ cat > $tempFilter <<EOF
|
|||
write;
|
||||
EOF
|
||||
|
||||
cat $tempFilter
|
||||
cat $tempFilt
|
||||
# Use filter on input to create a new HEALPix GRIB
|
||||
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input
|
||||
${tools_dir}/grib_filter -o $tempGrib $tempFilt $input
|
||||
if [ ! -f "$tempGrib" ]; then
|
||||
echo 'Failed to create output GRIB from filter' >&2
|
||||
exit 1
|
||||
|
@ -47,7 +47,7 @@ ${tools_dir}/grib_ls -jn geography $tempGrib
|
|||
# Geoiterator
|
||||
# -------------
|
||||
rm -f $tempGrib
|
||||
cat > $tempFilter <<EOF
|
||||
cat > $tempFilt <<EOF
|
||||
set tablesVersion = $latest;
|
||||
set gridType = "healpix";
|
||||
set longitudeOfFirstGridPointInDegrees = 45;
|
||||
|
@ -55,13 +55,13 @@ cat > $tempFilter <<EOF
|
|||
set values = {1,2,3,4,5,6,7,8,9,10,11,12}; # count=12*N*N
|
||||
write;
|
||||
EOF
|
||||
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input
|
||||
${tools_dir}/grib_filter -o $tempGrib $tempFilt $input
|
||||
${tools_dir}/grib_get_data $tempGrib
|
||||
val=$(${tools_dir}/grib_get -l 0,0,1 $tempGrib | tr -d ' ')
|
||||
[ "$val" = 5 ]
|
||||
|
||||
# Check other iterator-related keys
|
||||
cat > $tempFilter <<EOF
|
||||
cat > $tempFilt <<EOF
|
||||
print "latLonValues=[latLonValues]";
|
||||
print "latitudes=[latitudes]";
|
||||
print "longitudes=[longitudes]";
|
||||
|
@ -69,7 +69,7 @@ cat > $tempFilter <<EOF
|
|||
print "distinctLongitudes=[distinctLongitudes]";
|
||||
EOF
|
||||
|
||||
${tools_dir}/grib_filter $tempFilter $tempGrib
|
||||
${tools_dir}/grib_filter $tempFilt $tempGrib
|
||||
|
||||
# Invalid cases
|
||||
# --------------
|
||||
|
@ -89,4 +89,4 @@ grep -q "Only ring ordering is supported" $tempLog
|
|||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempFilter $tempGrib $tempLog
|
||||
rm -f $tempFilt $tempGrib $tempLog
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
|
||||
# Define a common label for all the tmp files
|
||||
label="grib_lambert_conformal_test"
|
||||
tempFilter="temp.${label}.filt"
|
||||
tempFilt="temp.${label}.filt"
|
||||
tempGrib="temp.${label}.grib"
|
||||
tempOut="temp.${label}.out"
|
||||
|
||||
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
|
||||
# Create a filter
|
||||
cat > $tempFilter <<EOF
|
||||
cat > $tempFilt <<EOF
|
||||
set gridType="lambert";
|
||||
set numberOfDataPoints=294000;
|
||||
set shapeOfTheEarth=6;
|
||||
|
@ -37,7 +37,7 @@ cat > $tempFilter <<EOF
|
|||
EOF
|
||||
|
||||
# Use filter on input to create a new Lambert conformal GRIB
|
||||
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input
|
||||
${tools_dir}/grib_filter -o $tempGrib $tempFilt $input
|
||||
if [ ! -f "$tempGrib" ]; then
|
||||
echo 'Failed to create output GRIB from filter' >&2
|
||||
exit 1
|
||||
|
@ -49,7 +49,7 @@ ${tools_dir}/grib_ls -l 50,0 $tempGrib
|
|||
|
||||
# Oblate earth
|
||||
# --------------
|
||||
cat > $tempFilter <<EOF
|
||||
cat > $tempFilt <<EOF
|
||||
set gridType="lambert";
|
||||
set numberOfDataPoints=294000;
|
||||
set Nx=588;
|
||||
|
@ -68,7 +68,7 @@ cat > $tempFilter <<EOF
|
|||
EOF
|
||||
|
||||
# Use this filter and the input GRIB to create a new GRIB
|
||||
${tools_dir}/grib_filter -o $tempGrib $tempFilter $input
|
||||
${tools_dir}/grib_filter -o $tempGrib $tempFilt $input
|
||||
if [ ! -f "$tempGrib" ]; then
|
||||
echo 'Failed to create output GRIB from filter' >&2
|
||||
exit 1
|
||||
|
@ -83,4 +83,4 @@ ${tools_dir}/grib_ls -l 40.44,353.56 $tempGrib
|
|||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempFilter $tempGrib $tempOut
|
||||
rm -f $tempFilt $tempGrib $tempOut
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# Define a common label for all the tmp files
|
||||
label="grib_mercator_test"
|
||||
tempOut="temp.${label}.out"
|
||||
tempFilter="temp.${label}.filt"
|
||||
tempFilt="temp.${label}.filt"
|
||||
|
||||
input=${data_dir}/mercator.grib2
|
||||
grib_check_key_equals $input "gridType" "mercator"
|
||||
|
@ -22,17 +22,17 @@ numlines=`wc -l $tempOut | awk '{print $1}'`
|
|||
|
||||
|
||||
# Check other iterator-related keys
|
||||
cat > $tempFilter <<EOF
|
||||
cat > $tempFilt <<EOF
|
||||
print "[latLonValues]";
|
||||
print "[distinctLatitudes]";
|
||||
print "[distinctLongitudes]";
|
||||
EOF
|
||||
|
||||
${tools_dir}/grib_filter $tempFilter $input
|
||||
${tools_dir}/grib_filter $tempFilt $input
|
||||
|
||||
# Nearest function
|
||||
${tools_dir}/grib_ls -l 19,-97,1 $input > $tempOut
|
||||
grep -q "Point chosen #1 index=618" $tempOut
|
||||
|
||||
# Clean up
|
||||
rm -f $tempFilter $tempOut
|
||||
rm -f $tempFilt $tempOut
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
# Define a common label for all the tmp files
|
||||
label="grib_polar_stereographic_test"
|
||||
tempFilter="temp.${label}.filt"
|
||||
tempFilt="temp.${label}.filt"
|
||||
tempGrib="temp.${label}.grib"
|
||||
tempOut="temp.${label}.out"
|
||||
|
||||
|
@ -19,7 +19,7 @@ input=$ECCODES_SAMPLES_PATH/polar_stereographic_pl_grib2.tmpl
|
|||
|
||||
# Invoke Geoiterator
|
||||
${tools_dir}/grib_get_data $input > $tempOut
|
||||
|
||||
# Nearest
|
||||
${tools_dir}/grib_ls -l 60,0 $input
|
||||
|
||||
# Scanning mode
|
||||
|
@ -27,4 +27,4 @@ ${tools_dir}/grib_get_data -s iScansNegatively=1 $input > $tempOut
|
|||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempFilter $tempGrib $tempOut
|
||||
rm -f $tempFilt $tempGrib $tempOut
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
# Define a common label for all the tmp files
|
||||
label="grib_space_view_test"
|
||||
tempFilter="temp.${label}.filt"
|
||||
tempFilt="temp.${label}.filt"
|
||||
tempGrib1="temp.${label}.grib1"
|
||||
tempGrib2="temp.${label}.grib2"
|
||||
tempOut="temp.${label}.out"
|
||||
|
@ -20,7 +20,7 @@ tempOut="temp.${label}.out"
|
|||
# GRIB2
|
||||
# -----------
|
||||
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
cat > $tempFilter <<EOF
|
||||
cat > $tempFilt <<EOF
|
||||
set gridType="space_view";
|
||||
set Nx=1900;
|
||||
set Ny=900;
|
||||
|
@ -35,7 +35,7 @@ cat > $tempFilter <<EOF
|
|||
EOF
|
||||
|
||||
# Use filter on input to create a new GRIB
|
||||
${tools_dir}/grib_filter -o $tempGrib2 $tempFilter $input
|
||||
${tools_dir}/grib_filter -o $tempGrib2 $tempFilt $input
|
||||
if [ ! -f "$tempGrib2" ]; then
|
||||
echo 'Failed to create output GRIB from filter' >&2
|
||||
exit 1
|
||||
|
@ -66,7 +66,7 @@ rm -f $tempGrib2 $tempOut
|
|||
# GRIB1
|
||||
# -----------
|
||||
input=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||
cat > $tempFilter <<EOF
|
||||
cat > $tempFilt <<EOF
|
||||
set gridType="space_view";
|
||||
set Nx=550;
|
||||
set Ny=550;
|
||||
|
@ -77,7 +77,7 @@ cat > $tempFilter <<EOF
|
|||
set Nr=6610710;
|
||||
write;
|
||||
EOF
|
||||
${tools_dir}/grib_filter -o $tempGrib1 $tempFilter $input
|
||||
${tools_dir}/grib_filter -o $tempGrib1 $tempFilt $input
|
||||
${tools_dir}/grib_get_data $tempGrib1 > $tempOut
|
||||
|
||||
${tools_dir}/grib_set -s edition=2 $tempGrib1 $tempGrib2
|
||||
|
@ -85,4 +85,4 @@ ${tools_dir}/grib_compare -e -b param $tempGrib1 $tempGrib2
|
|||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempFilter $tempGrib1 $tempGrib2 $tempOut
|
||||
rm -f $tempFilt $tempGrib1 $tempGrib2 $tempOut
|
||||
|
|
|
@ -20,7 +20,7 @@ cd ${data_dir}
|
|||
encoding=1
|
||||
simple_no_bitmap=simple.grib
|
||||
simple_bitmap=simple_bitmap.grib
|
||||
test_filter=temp.$label.filter
|
||||
tempFilt=temp.$label.filter
|
||||
|
||||
files_no_bitmap="gen_ext.grib \
|
||||
gen_ext_boust.grib \
|
||||
|
@ -41,11 +41,11 @@ simple_bitmap.grib"
|
|||
no_packing="gen.grib|row.grib|gen_bitmap.grib|constant_width_bitmap.grib|constant_width_boust_bitmap.grib"
|
||||
|
||||
test_data() {
|
||||
${tools_dir}/grib_filter $test_filter $simple > $simple.data
|
||||
${tools_dir}/grib_filter $tempFilt $simple > $simple.data
|
||||
|
||||
for f in $files
|
||||
do
|
||||
${tools_dir}/grib_filter $test_filter $f > $f.data
|
||||
${tools_dir}/grib_filter $tempFilt $f > $f.data
|
||||
diff $simple.data $f.data > /dev/null
|
||||
${tools_dir}/grib_compare -cvalues $f $simple
|
||||
echo $f decoding test passed > $REDIRECT
|
||||
|
@ -55,7 +55,7 @@ test_data() {
|
|||
then
|
||||
rm -f $f.copied
|
||||
${tools_dir}/grib_copy -r $f $f.copied
|
||||
${tools_dir}/grib_filter $test_filter $f.copied > $f.copied.data
|
||||
${tools_dir}/grib_filter $tempFilt $f.copied > $f.copied.data
|
||||
diff $simple.data $f.copied.data > /dev/null
|
||||
${tools_dir}/grib_compare -cvalues $f.copied $simple
|
||||
echo $f encoding test passed > $REDIRECT
|
||||
|
@ -67,7 +67,7 @@ test_data() {
|
|||
}
|
||||
|
||||
|
||||
cat > $test_filter<<EOF
|
||||
cat > $tempFilt<<EOF
|
||||
print "[values!1]!";
|
||||
EOF
|
||||
|
||||
|
@ -132,21 +132,21 @@ done
|
|||
# Two coded values: Should stay as grid_simple
|
||||
temp2=temp2.$label.grib
|
||||
temp3=temp3.$label.grib
|
||||
cat > $test_filter<<EOF
|
||||
cat > $tempFilt<<EOF
|
||||
set values={ 2.1, 3.4 };
|
||||
write;
|
||||
EOF
|
||||
${tools_dir}/grib_filter -o $temp2 $test_filter $ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
${tools_dir}/grib_filter -o $temp2 $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
ECCODES_DEBUG=1 ${tools_dir}/grib_set -r -s packingType=grid_second_order $temp2 $temp3 2>$tempText
|
||||
grib_check_key_equals $temp3 packingType,accuracy 'grid_simple 24'
|
||||
grep -q "Packing not changed" $tempText
|
||||
|
||||
# Three coded values: Now we can change to 2nd order
|
||||
cat > $test_filter<<EOF
|
||||
cat > $tempFilt<<EOF
|
||||
set values={ 2.1, 3.4, 8.9 };
|
||||
write;
|
||||
EOF
|
||||
${tools_dir}/grib_filter -o $temp2 $test_filter $ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
${tools_dir}/grib_filter -o $temp2 $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
${tools_dir}/grib_set -r -s packingType=grid_second_order $temp2 $temp3
|
||||
grib_check_key_equals $temp3 packingType,accuracy 'grid_second_order 24'
|
||||
|
||||
|
@ -211,4 +211,4 @@ grib_check_key_equals $temp1 packingType grid_second_order
|
|||
# Clean up
|
||||
rm -f $temp_stat1 $temp_stat2
|
||||
rm -f $temp1 $temp2 $temp3 $sec_ord_bmp
|
||||
rm -f $test_filter $tempText
|
||||
rm -f $tempFilt $tempText
|
||||
|
|
Loading…
Reference in New Issue