#!/bin/sh # (C) Copyright 2005- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. # . ./include.ctest.sh label="grib_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 diff ${data_dir}/index.ok $temp # reads from "out.gribidx" $EXEC ${test_dir}/grib_read_index ${infile} > $temp diff ${data_dir}/index.ok $temp rm -f out.gribidx $temp #------------------------------- # Test grib_index_build #------------------------------- tempIndex=temp.$label.$$.idx tempOut=temp.$label.$$.out tempRef=temp.$label.$$.ref ${tools_dir}/grib_index_build -N -o $tempIndex ${infile} >/dev/null # Must remove first two lines (filename specifics) ${tools_dir}/grib_dump ${tempIndex} | sed '1,2d' > $tempOut #cat $tempOut cat > $tempRef < $tempGribFile1 cat ${data_dir}/sample.grib2 ${data_dir}/high_level_api.grib2 > $tempGribFile2 ${tools_dir}/grib_index_build -N -o $tempIndex1 $tempGribFile1 ${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 # 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 ${tools_dir}/grib_dump $tempIndex1 >/dev/null # Clean up rm -f $tempOut $tempRef rm -f $tempIndex $tempIndex1 $tempIndex2 $tempGribFile1 $tempGribFile2