Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Jan 29, 2024
1 parent f3da045 commit bf82a71
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/g2cfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,8 +1116,8 @@ read_metadata(int g2cid)
LOG((6, "file_pos %ld", file_pos));
}

/* If we run out of messages, that's success. */
if (ret == G2C_ENOMSG)
/* If we read some messages, then run out, that's success. */
if (ret == G2C_ENOMSG && msg_num)
ret = G2C_NOERROR;

#ifdef LOGGING
Expand Down
5 changes: 4 additions & 1 deletion tests/run_index_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ set -e
echo ""
echo "*** Running g2c_index test"

# Read GRIB1 index.
# Create an index for a GRIB2 file.
../utils/g2c_index -v data/gdaswave.t00z.wcoast.0p16.f000.grib2 gdaswave.t00z.wcoast.0p16.f000.grib2.idx

# Summarize the index data.
../utils/g2c_degrib2 -v gdaswave.t00z.wcoast.0p16.f000.grib2.idx gdaswave.t00z.wcoast.0p16.f000.grib2.idx.degrib2

# Check against expected output.
#diff -w g2c_degrib2_gdaswave.t00z.wcoast.0p16.f000.grib2.degrib2 data/ref_gdaswave.degrib2.txt

Expand Down
7 changes: 7 additions & 0 deletions utils/g2c_degrib2.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ main(int argc, char **argv)
break;
}

/* If we didn't get 2 files, error. */
if (p != 2)
{
printf("Two filenames must be provided, for input and output.\n");
return G2C_ERROR;
}

/* Yammer on and on. */
if (verbose)
printf("g2c_degrib2 %s summarizing %s into %s.\n", G2C_VERSION, path[0], path[1]);
Expand Down

0 comments on commit bf82a71

Please sign in to comment.