Skip to content

Commit

Permalink
Add example in the description
Browse files Browse the repository at this point in the history
  • Loading branch information
laomangio committed Jan 25, 2024
1 parent 92ef6d2 commit 24fc0d4
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/atm2grid.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
/*!
\file
Convert atmosphric data file to grid data file.
example:
cd data
for atmfile in $(ls atm_20*_00_00.tab); do
../../../atm2grid trac.ctl $atmfile GRID_BASENAME grid
done
*/

#include "libtrac.h"
Expand All @@ -40,8 +45,8 @@ int main(
ALLOC(atm, atm_t, 1);

/* Check arguments... */
if (argc < 4)
ERRMSG("Give parameters: <ctl> <atm_in> <grid_out>");
if (argc < 3)
ERRMSG("Give parameters: <ctl> <atm_in>");

read_ctl(argv[1], argc, argv, &ctl);

Expand All @@ -55,12 +60,9 @@ int main(
sscanf(argv[2], "atm_%d_%d_%d_%d_%d.tab", &year, &mon, &day, &hour, &min);
time2jsec(year, mon, day, hour, min, 0, 0, &t);

if (argv[3][0] == '-')
sprintf(filename, "%s_%04d_%02d_%02d_%02d_%02d.%s",
ctl.grid_basename, year, mon, day, hour, min,
ctl.grid_type == 0 ? "tab" : "nc");
else
sprintf(filename, "%s", argv[3]);
sprintf(filename, "%s_%04d_%02d_%02d_%02d_%02d.%s",
ctl.grid_basename, year, mon, day, hour, min,
ctl.grid_type == 0 ? "tab" : "nc");

write_grid(filename, &ctl, met0, met1, atm, t);

Expand Down

0 comments on commit 24fc0d4

Please sign in to comment.