MPTRAC
Functions
met_conv.c File Reference

Convert file format of meteo data files. More...

#include "mptrac.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Convert file format of meteo data files.

Definition in file met_conv.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 27 of file met_conv.c.

29 {
30
31 ctl_t ctl;
32
33 clim_t *clim;
34
35 met_t *met;
36
37 dd_t *dd;
38
39 /* Check arguments... */
40 if (argc < 6)
41 ERRMSG("Give parameters: <ctl> <met_in> <met_in_type>"
42 " <met_out> <met_out_type>");
43
44 /* Allocate... */
45 ALLOC(clim, clim_t, 1);
46 ALLOC(met, met_t, 1);
47 ALLOC(dd, dd_t, 1);
48
49 /* Start timers... */
51
52 /* Read control parameters... */
53 mptrac_read_ctl(argv[1], argc, argv, &ctl);
54
55 /* Read climatological data... */
56 mptrac_read_clim(&ctl, clim);
57
58 /* Read meteo data... */
59 ctl.met_type = atoi(argv[3]);
60 if (!mptrac_read_met(argv[2], &ctl, clim, met, dd))
61 ERRMSG("Cannot open file!");
62
63 /* Write meteo data... */
64 ctl.met_type = atoi(argv[5]);
65 mptrac_write_met(argv[4], &ctl, met);
66
67 /* Report timers... */
70
71 /* Free... */
72 free(clim);
73 free(met);
74
75 return EXIT_SUCCESS;
76}
void mptrac_read_clim(const ctl_t *ctl, clim_t *clim)
Reads various climatological data and populates the given climatology structure.
Definition: mptrac.c:5406
int mptrac_read_met(const char *filename, const ctl_t *ctl, const clim_t *clim, met_t *met, dd_t *dd)
Reads meteorological data from a file, supporting multiple formats and MPI broadcasting.
Definition: mptrac.c:6357
void mptrac_read_ctl(const char *filename, int argc, char *argv[], ctl_t *ctl)
Reads control parameters from a configuration file and populates the given structure.
Definition: mptrac.c:5466
void mptrac_write_met(const char *filename, const ctl_t *ctl, met_t *met)
Writes meteorological data to a file, supporting multiple formats and compression options.
Definition: mptrac.c:6786
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: mptrac.h:2043
#define ALLOC(ptr, type, n)
Allocate memory for a pointer with error handling.
Definition: mptrac.h:416
#define START_TIMERS
Starts a timer for tracking.
Definition: mptrac.h:2142
#define PRINT_TIMERS
Print the current state of all timers.
Definition: mptrac.h:2102
#define STOP_TIMERS
Stop the current timer.
Definition: mptrac.h:2157
Climatological data.
Definition: mptrac.h:3487
Control parameters.
Definition: mptrac.h:2264
int met_type
Type of meteo data files (0=netCDF, 1=binary, 2=pck, 3=ZFP, 4=ZSTD, 5=cms, 6=grib,...
Definition: mptrac.h:2604
Domain decomposition data structure.
Definition: mptrac.h:3720
Meteo data structure.
Definition: mptrac.h:3546
Here is the call graph for this function: