35 met_t *met0 = NULL, *met1 = NULL;
42 ERRMSG(
"Give parameters: <ctl> <atm_in>");
49 ERRMSG(
"You need to specify GRID_BASENAME!");
53 ERRMSG(
"Cannot open file!");
56 int year, mon, day, hour, min, sec;
58 jsec2time(t, &year, &mon, &day, &hour, &min, &sec, &r);
61 char filename[3 *
LEN];
62 sprintf(filename,
"%s_%04d_%02d_%02d_%02d_%02d.%s",
67 write_grid(filename, &ctl, met0, met1, atm, t);
int main(int argc, char *argv[])
double time_from_filename(const char *filename, const int offset)
Extracts and converts a timestamp from a filename to Julian seconds.
void read_ctl(const char *filename, int argc, char *argv[], ctl_t *ctl)
Reads control parameters from a configuration file and populates the given structure.
void jsec2time(const double jsec, int *year, int *mon, int *day, int *hour, int *min, int *sec, double *remain)
Converts Julian seconds to calendar date and time components.
int read_atm(const char *filename, const ctl_t *ctl, atm_t *atm)
Reads air parcel data from a specified file into the given atmospheric structure.
void write_grid(const char *filename, const ctl_t *ctl, met_t *met0, met_t *met1, const atm_t *atm, const double t)
Writes grid data to a file in ASCII or netCDF format.
MPTRAC library declarations.
#define LEN
Maximum length of ASCII data lines.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define ALLOC(ptr, type, n)
Allocate memory for a pointer with error handling.
int atm_type
Type of atmospheric data files (0=ASCII, 1=binary, 2=netCDF, 3=CLaMS_traj, 4=CLaMS_pos).
int grid_type
Type of grid data files (0=ASCII, 1=netCDF).
char grid_basename[LEN]
Basename of grid data files.