mirror of https://github.com/ecmwf/eccodes.git
ECC-913: Tools: Add gts_count
This commit is contained in:
parent
8cc1940f4c
commit
27f37da83b
|
@ -102,6 +102,7 @@ list( APPEND tests_data_reqd
|
|||
bufr_ecc-556
|
||||
gts_get
|
||||
gts_ls
|
||||
gts_count
|
||||
gts_compare
|
||||
metar_ls
|
||||
metar_get
|
||||
|
|
|
@ -22,6 +22,10 @@ tempBufr=temp.${label}.bufr
|
|||
# Case 1:
|
||||
# --------------------------------
|
||||
input=${data_dir}/gts/EGRR20150317121020_00493212.DAT
|
||||
|
||||
numBufrs=`${tools_dir}/bufr_count $input`
|
||||
[ $numBufrs -eq 94 ]
|
||||
|
||||
${tools_dir}/bufr_copy -g -w numberOfSubsets=9 $input $tempBufr
|
||||
# Remove the first line and the last three
|
||||
${tools_dir}/gts_ls $tempBufr | sed 1d | sed 9,11d > $tempOut
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
# Copyright 2005-2018 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.sh
|
||||
|
||||
#Enter data dir
|
||||
cd ${data_dir}/gts
|
||||
|
||||
#Define a common label for all the tmp files
|
||||
label="gts_count_test"
|
||||
|
||||
#Create log file
|
||||
fLog=${label}".log"
|
||||
rm -f $fLog
|
||||
|
||||
#Define tmp file
|
||||
fTmp=${label}".tmp.txt"
|
||||
|
||||
gts_file=EGRR20150317121020_00493212.DAT
|
||||
count=`${tools_dir}/gts_count $gts_file`
|
||||
[ $count -eq 300 ]
|
||||
|
||||
rm -f $fLog
|
|
@ -64,13 +64,16 @@ foreach( tool ${grib_tools_bins_EXTRA} )
|
|||
LIBS grib_tools )
|
||||
endforeach()
|
||||
|
||||
# grib_count/bufr_count tools. Same source code, different executable names
|
||||
# grib_count/bufr_count etc. Same source code, different executable names
|
||||
ecbuild_add_executable( TARGET grib_count
|
||||
SOURCES codes_count.c
|
||||
LIBS grib_tools )
|
||||
ecbuild_add_executable( TARGET bufr_count
|
||||
SOURCES codes_count.c
|
||||
LIBS grib_tools )
|
||||
ecbuild_add_executable( TARGET gts_count
|
||||
SOURCES codes_count.c
|
||||
LIBS grib_tools )
|
||||
|
||||
# grib to netcdf is optional
|
||||
ecbuild_add_executable( TARGET grib_to_netcdf
|
||||
|
|
|
@ -31,6 +31,7 @@ static int count_messages(FILE* in, int message_type, unsigned long *count)
|
|||
/* printf("message_type=%d\n", message_type); */
|
||||
if (message_type == CODES_GRIB) wmo_read=wmo_read_grib_from_file_malloc;
|
||||
else if (message_type == CODES_BUFR) wmo_read=wmo_read_bufr_from_file_malloc;
|
||||
else if (message_type == CODES_GTS) wmo_read=wmo_read_gts_from_file_malloc;
|
||||
else wmo_read=wmo_read_any_from_file_malloc;
|
||||
|
||||
if (fail_on_error)
|
||||
|
@ -76,6 +77,7 @@ int main(int argc,char* argv[])
|
|||
|
||||
if (strstr(argv[0], "grib_count")) message_type = CODES_GRIB;
|
||||
if (strstr(argv[0], "bufr_count")) message_type = CODES_BUFR;
|
||||
if (strstr(argv[0], "gts_count")) message_type = CODES_GTS;
|
||||
|
||||
count_total=0;
|
||||
for (i=1;i<argc;i++) {
|
||||
|
|
Loading…
Reference in New Issue