1 | #include <stdio.h> |
---|
2 | #include <stdlib.h> |
---|
3 | #include "dprints.h" |
---|
4 | #include "gribfuncs.h" /* prototypes */ |
---|
5 | #include "grib_lookup.h" /* macros */ |
---|
6 | |
---|
7 | /* |
---|
8 | **************************************************************************** |
---|
9 | * A. FUNCTION: make_default_grbfn |
---|
10 | * build and return default filename for current message to be encoded |
---|
11 | * using the information from structures DATA_INPUT and USER_INPUT. |
---|
12 | * |
---|
13 | * INTERFACE: |
---|
14 | * void make_default_grbfn (DATA_INPUT di, USER_INPUT ui, char *default_fn) |
---|
15 | * |
---|
16 | * ARGUMENTS (I=input, O=output, I&O=input and output): |
---|
17 | * (I) DATA_INPUT di; contains info of msg to be encoded |
---|
18 | * (I) USER_INPUT ui; contains the required chCase_id |
---|
19 | * (O) char *default_fn; empty string atleast 42 characters long |
---|
20 | * |
---|
21 | * RETURN CODE: none; default_fn string contains name with format |
---|
22 | * 'Mid_Gid_yyyymmddhhtau_PIndx_Lid.lvl1.c.grb'; |
---|
23 | **************************************************************************** |
---|
24 | */ |
---|
25 | #if PROTOTYPE_NEEDED |
---|
26 | void make_default_grbfn (DATA_INPUT di, USER_INPUT ui, char *default_fn) |
---|
27 | #else |
---|
28 | void make_default_grbfn (di,ui,default_fn) |
---|
29 | DATA_INPUT di; |
---|
30 | USER_INPUT ui; |
---|
31 | char *default_fn; |
---|
32 | #endif |
---|
33 | { |
---|
34 | /* |
---|
35 | * A.1 Build the default filename: MMM_GGG_yyyymmddhhtau_PIndx.lvl1.c.grb |
---|
36 | * where |
---|
37 | * MMM : 3-dibit model id from DATA_INPUT |
---|
38 | * GGG : 3-digit geom id from DATA_INPUT |
---|
39 | * yyyy : 4-digit year of reference date/time from DATA_INPUT |
---|
40 | * mm : 2-digit month of reference date/time from DATA_INPUT |
---|
41 | * dd : 2-digit day of reference date/time from DATA_INPUT |
---|
42 | * hh : 2-digit hour of reference date/time from DATA_INPUT |
---|
43 | * tau : 3-digit forecast period from DATA_INPUT |
---|
44 | * PIndx : 4-digit Parameter Index computed from DATA_INPUT's |
---|
45 | * Parmid & ParmSubid |
---|
46 | * Lid : 3-digit Level id from DATA_INPUT |
---|
47 | * lvl1 : 5-digit Level 1 from DATA_INPUT |
---|
48 | * c : 1-digit Case id from USER_INPUT |
---|
49 | * .grb : 4-char string, as is |
---|
50 | */ |
---|
51 | sprintf (default_fn, |
---|
52 | "%03d_%03d_%04d%02d%02d%02d%03d_%04d_%03d.%05d.%c.grb", |
---|
53 | di.usProc_id, di.usGrid_id, di.nYear, di.nMonth, di.nDay, |
---|
54 | di.nHour, di.usFcst_per1, |
---|
55 | (int)PARMTBL_INDX (di.usParm_id, di.usParm_sub_id), |
---|
56 | di.usLevel_id, di.nLvl_1, |
---|
57 | ui.chCase_id); |
---|
58 | |
---|
59 | DPRINT1("make_default_grb_fn built '%s'\n", default_fn); |
---|
60 | } |
---|
61 | |
---|