mirror of https://github.com/ecmwf/eccodes.git
ECC-233: Stray comma character in BUFR json dump
This commit is contained in:
parent
ec7b55b08e
commit
fa07d641c5
|
@ -24,29 +24,36 @@ cd ${data_dir}/bufr
|
||||||
bufr_files=`cat bufr_data_files.txt`
|
bufr_files=`cat bufr_data_files.txt`
|
||||||
for file in ${bufr_files}
|
for file in ${bufr_files}
|
||||||
do
|
do
|
||||||
rm -f ${file}.json | true
|
# JSON dump structure
|
||||||
|
|
||||||
${tools_dir}bufr_dump -js $file 2> $REDIRECT > ${file}.json
|
|
||||||
|
|
||||||
if test "x$JSON_CHECK" != "x"; then
|
|
||||||
json_xs < ${file}.json >$REDIRECT 2> $REDIRECT
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f ${file}.json | true
|
|
||||||
|
|
||||||
${tools_dir}bufr_dump -ja $file 2> $REDIRECT > ${file}.json
|
|
||||||
|
|
||||||
if test "x$JSON_CHECK" != "x"; then
|
|
||||||
json_xs < ${file}.json >$REDIRECT 2> $REDIRECT
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f ${file}.json
|
rm -f ${file}.json
|
||||||
|
${tools_dir}bufr_dump -js $file 2> $REDIRECT > ${file}.json
|
||||||
|
if test "x$JSON_CHECK" != "x"; then
|
||||||
|
json_xs < ${file}.json >$REDIRECT 2> $REDIRECT
|
||||||
|
fi
|
||||||
|
|
||||||
|
# JSON dump all attributes
|
||||||
|
rm -f ${file}.json
|
||||||
|
${tools_dir}bufr_dump -ja $file 2> $REDIRECT > ${file}.json
|
||||||
|
if test "x$JSON_CHECK" != "x"; then
|
||||||
|
json_xs < ${file}.json >$REDIRECT 2> $REDIRECT
|
||||||
|
fi
|
||||||
|
|
||||||
|
# JSON dump flat
|
||||||
|
rm -f ${file}.json
|
||||||
${tools_dir}bufr_dump -jf $file 2> $REDIRECT > ${file}.json
|
${tools_dir}bufr_dump -jf $file 2> $REDIRECT > ${file}.json
|
||||||
|
|
||||||
if test "x$JSON_CHECK" != "x"; then
|
if test "x$JSON_CHECK" != "x"; then
|
||||||
json_xs < ${file}.json >$REDIRECT 2> $REDIRECT
|
json_xs < ${file}.json >$REDIRECT 2> $REDIRECT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${file}.json
|
rm -f ${file}.json
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# ECC-233: Test JSON dump when selecting messages with '-w' switch
|
||||||
|
file=tropical_cyclone.bufr
|
||||||
|
for c in 1 3 1/3; do
|
||||||
|
${tools_dir}bufr_dump -w count=$c $file 2> $REDIRECT > ${file}.json
|
||||||
|
if test "x$JSON_CHECK" != "x"; then
|
||||||
|
json_xs < ${file}.json >$REDIRECT 2> $REDIRECT
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,10 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
||||||
grib_set_flag(h,options->print_keys[i].name,GRIB_ACCESSOR_FLAG_DUMP);
|
grib_set_flag(h,options->print_keys[i].name,GRIB_ACCESSOR_FLAG_DUMP);
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
if (options->handle_count>1) fprintf(stdout,",\n");
|
/* ECC-233: print comma as separator between messages */
|
||||||
|
if (!first_handle && options->handle_count>1) {
|
||||||
|
fprintf(stdout,",\n");
|
||||||
|
}
|
||||||
if (json && first_handle) {
|
if (json && first_handle) {
|
||||||
fprintf(stdout,"{ \"messages\" : [ \n");
|
fprintf(stdout,"{ \"messages\" : [ \n");
|
||||||
first_handle=0;
|
first_handle=0;
|
||||||
|
|
Loading…
Reference in New Issue