4 ! This file is used to generate the series of 40 meta-data get and
5 ! put calls in the WRF I/O API. It contains an M4 macro and then
6 ! a series of invocations of the macro to generate the subroutine
7 ! definitions, which are then included by the file module_io.F
10 ! $1 = get|put $2=dom|var $3=type $4=[char] $5=td|ti
15 SUBROUTINE wrf_$1_$2_$6_$3$4_$5 ( DataHandle,Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, ifelse($4,char,,`Count, ifelse($1,get,`Outcount,')') Status )
19 ! ifelse($1,get,`Attempt to read',`Write') ifelse($4,char,,ifelse($5,arr,`Count words of '))time ifelse($6,ti,`in')dependent
20 ! ifelse($2,var,`attribute "Element" of variable "Varname"',`domain metadata named "Element"') ifelse($6,td,`valid at time DateStr')
21 ! ifelse($1,get,`from',`to') the open dataset described by DataHandle.
22 ! ifelse($2,var,`Attribute',`Metadata') of type $3$4 ifelse($2,var,`is',`are')
23 ! ifelse($1,put,`copied from',`stored in') ifelse($4,char,`string',ifelse($5,arr,`array',`scalar')) Data.
24 ! ifelse($4,char,,ifelse($5,arr,ifelse($1,get,`Actual number of words read is returned in OutCount.')))
28 USE module_state_description
30 INTEGER , INTENT(IN) :: DataHandle
31 CHARACTER*(*) , INTENT(IN) :: Element
32 ifelse($6,td,`CHARACTER*(*) , INTENT(IN) :: DateStr')
33 ifelse($2,var,`CHARACTER*(*) , INTENT(IN) :: VarName')
35 ifelse($4,char,`CHARACTER*(*) :: Data', `ifelse($3,double,real*8,$3) :: Data ifelse($5,arr,(*),)')
37 ifelse($4,char,,`INTEGER , INTENT(IN) :: Count')
38 ifelse($4,char,,`ifelse($1,get,`INTEGER , INTENT(OUT) :: OutCount')')
39 INTEGER , INTENT(OUT) :: Status
41 #include <wrf_status_codes.h>
44 INTEGER, EXTERNAL :: use_package
45 LOGICAL, EXTERNAL :: wrf_dm_on_monitor, multi_files, use_output_servers_for
50 CALL wrf_debug( DEBUG_LVL, "module_io.F (md_calls.m4) : in wrf_$1_$2_$6_$3$4_$5 " )
52 ifelse($3,integer,`locCount = Count')
53 ifelse($3,real,`locCount = Count')
54 ifelse($3,logical,`locCount = Count')
57 CALL get_handle ( Hndl, io_form , for_out, DataHandle )
58 IF ( Hndl .GT. -1 ) THEN
59 IF ( multi_files( io_form ) .OR. .NOT. (for_out .AND. use_output_servers_for(io_form)) ) THEN
60 SELECT CASE ( use_package( io_form ) )
63 IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN
65 `# if ( RWORDSIZE == DWORDSIZE )
66 CALL ext_ncd_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
67 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
69 CALL ext_ncd_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
70 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
72 ` CALL ext_ncd_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
73 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
75 IF ( .NOT. multi_files(io_form) ) THEN
76 ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
77 ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( Data, IWORDSIZE*locCount )'))
78 ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
79 ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( Data, RWORDSIZE*locCount )'))
80 ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
81 ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( Data, LWORDSIZE*locCount )'))
82 ifelse($1,get,ifelse($4,char, `len_of_str = LEN(Data)'))
83 ifelse($1,get,ifelse($4,char, `CALL wrf_dm_bcast_string( Data, len_of_str )'))
84 CALL wrf_dm_bcast_bytes( Status, IWORDSIZE )
90 `# if ( RWORDSIZE == DWORDSIZE )
91 CALL ext_ncdpar_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
92 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
94 CALL ext_ncdpar_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
95 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
97 ` CALL ext_ncdpar_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
98 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
104 `# if ( RWORDSIZE == DWORDSIZE )
105 CALL ext_pnc_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
106 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
108 CALL ext_pnc_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
109 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
111 ` CALL ext_pnc_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
112 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
117 `# if ( RWORDSIZE == DWORDSIZE )
118 CALL ext_adios2_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
119 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
121 CALL ext_adios2_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
122 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
124 ` CALL ext_adios2_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
125 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
130 `# if ( RWORDSIZE == DWORDSIZE )
131 CALL ext_pio_$1_$2_$6_double$4_$5 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
132 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
134 CALL ext_pio_$1_$2_$6_real$4_$5 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
135 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
137 ` CALL ext_pio_$1_$2_$6_$3$4_$5 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
138 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
143 `# if ( RWORDSIZE == DWORDSIZE )
144 CALL ext_phdf5_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
145 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
147 CALL ext_phdf5_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
148 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
150 ` CALL ext_phdf5_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
151 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
156 `# if ( RWORDSIZE == DWORDSIZE )
157 CALL ext_esmf_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
158 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
160 CALL ext_esmf_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
161 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
163 ` CALL ext_esmf_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
164 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
169 `# if ( RWORDSIZE == DWORDSIZE )
170 CALL ext_xxx_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
171 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
173 CALL ext_xxx_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
174 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
176 ` CALL ext_xxx_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
177 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
182 `# if ( RWORDSIZE == DWORDSIZE )
183 CALL ext_yyy_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
184 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
186 CALL ext_yyy_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
187 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
189 ` CALL ext_yyy_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
190 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
194 IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN
196 `# if ( RWORDSIZE == DWORDSIZE )
197 CALL ext_gr1_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
198 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
200 CALL ext_gr1_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
201 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
203 ` CALL ext_gr1_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
204 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
206 IF ( .NOT. multi_files(io_form) ) THEN
207 ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
208 ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( Data, IWORDSIZE*locCount )'))
209 ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
210 ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( Data, RWORDSIZE*locCount )'))
211 ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
212 ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( Data, LWORDSIZE*locCount )'))
213 ifelse($1,get,ifelse($4,char, `len_of_str = LEN(Data)'))
214 ifelse($1,get,ifelse($4,char, `CALL wrf_dm_bcast_string( Data, len_of_str )'))
215 CALL wrf_dm_bcast_bytes( Status, IWORDSIZE )
220 IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN
222 `# if ( RWORDSIZE == DWORDSIZE )
223 CALL ext_gr2_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
224 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
226 CALL ext_gr2_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
227 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
229 ` CALL ext_gr2_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
230 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
232 IF ( .NOT. multi_files(io_form) ) THEN
233 ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
234 ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( Data, IWORDSIZE*locCount )'))
235 ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
236 ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( Data, RWORDSIZE*locCount )'))
237 ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
238 ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( Data, LWORDSIZE*locCount )'))
239 ifelse($1,get,ifelse($4,char, `len_of_str = LEN(Data)'))
240 ifelse($1,get,ifelse($4,char, `CALL wrf_dm_bcast_string( Data, len_of_str )'))
241 CALL wrf_dm_bcast_bytes( Status, IWORDSIZE )
246 IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN
248 `# if ( RWORDSIZE == DWORDSIZE )
249 CALL ext_int_$1_$2_$6_double$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
250 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
252 CALL ext_int_$1_$2_$6_real$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
253 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
255 ` CALL ext_int_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
256 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )' )
258 IF ( .NOT. multi_files(io_form) ) THEN
259 ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
260 ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( Data, IWORDSIZE*locCount )'))
261 ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
262 ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( Data, RWORDSIZE*locCount )'))
263 ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )'))
264 ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( Data, LWORDSIZE*locCount )'))
265 ifelse($1,get,ifelse($4,char, `len_of_str = LEN(Data)'))
266 ifelse($1,get,ifelse($4,char, `CALL wrf_dm_bcast_string( Data, len_of_str )'))
267 CALL wrf_dm_bcast_bytes( Status, IWORDSIZE )
272 ELSE IF ( for_out .AND. use_output_servers_for(io_form) ) THEN
273 CALL wrf_quilt_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, &
274 ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status )
279 Status = WRF_ERR_FATAL_BAD_FILE_STATUS
282 END SUBROUTINE wrf_$1_$2_$6_$3$4_$5' )
286 `md_call_2($1,$2,$3,$4,arr,$5)'
288 `md_call_2($1,$2,$3,$4,arr,$5)
289 md_call_2($1,$2,$3,$4,sca,$5)'
293 define( md_interface,
295 `INTERFACE wrf_$1_$2_$5_$3$4
296 MODULE PROCEDURE wrf_$1_$2_$5_$3$4_arr
299 `INTERFACE wrf_$1_$2_$5_$3$4
300 MODULE PROCEDURE wrf_$1_$2_$5_$3$4_arr, wrf_$1_$2_$5_$3$4_sca
305 md_interface(get,dom,real,,ti)
306 md_interface(put,dom,real,,ti)
307 md_interface(get,dom,double,,ti)
308 md_interface(put,dom,double,,ti)
309 md_interface(get,dom,integer,,ti)
310 md_interface(put,dom,integer,,ti)
311 md_interface(get,dom,logical,,ti)
312 md_interface(put,dom,logical,,ti)
313 md_interface(get,dom,,char,ti)
314 md_interface(put,dom,,char,ti)
316 md_interface(get,dom,real,,td)
317 md_interface(put,dom,real,,td)
318 md_interface(get,dom,double,,td)
319 md_interface(put,dom,double,,td)
320 md_interface(get,dom,integer,,td)
321 md_interface(put,dom,integer,,td)
322 md_interface(get,dom,logical,,td)
323 md_interface(put,dom,logical,,td)
324 md_interface(get,dom,,char,td)
325 md_interface(put,dom,,char,td)
327 md_interface(get,var,real,,ti)
328 md_interface(put,var,real,,ti)
329 md_interface(get,var,double,,ti)
330 md_interface(put,var,double,,ti)
331 md_interface(get,var,integer,,ti)
332 md_interface(put,var,integer,,ti)
333 md_interface(get,var,logical,,ti)
334 md_interface(put,var,logical,,ti)
335 md_interface(get,var,,char,ti)
336 md_interface(put,var,,char,ti)
338 md_interface(get,var,real,,td)
339 md_interface(put,var,real,,td)
340 md_interface(get,var,double,,td)
341 md_interface(put,var,double,,td)
342 md_interface(get,var,integer,,td)
343 md_interface(put,var,integer,,td)
344 md_interface(get,var,logical,,td)
345 md_interface(put,var,logical,,td)
346 md_interface(get,var,,char,td)
347 md_interface(put,var,,char,td)
351 md_call(get,dom,real,,ti)
352 md_call(put,dom,real,,ti)
353 md_call(get,dom,double,,ti)
354 md_call(put,dom,double,,ti)
355 md_call(get,dom,integer,,ti)
356 md_call(put,dom,integer,,ti)
357 md_call(get,dom,logical,,ti)
358 md_call(put,dom,logical,,ti)
359 md_call(get,dom,,char,ti)
360 md_call(put,dom,,char,ti)
362 md_call(get,dom,real,,td)
363 md_call(put,dom,real,,td)
364 md_call(get,dom,double,,td)
365 md_call(put,dom,double,,td)
366 md_call(get,dom,integer,,td)
367 md_call(put,dom,integer,,td)
368 md_call(get,dom,logical,,td)
369 md_call(put,dom,logical,,td)
370 md_call(get,dom,,char,td)
371 md_call(put,dom,,char,td)
373 md_call(get,var,real,,ti)
374 md_call(put,var,real,,ti)
375 md_call(get,var,double,,ti)
376 md_call(put,var,double,,ti)
377 md_call(get,var,integer,,ti)
378 md_call(put,var,integer,,ti)
379 md_call(get,var,logical,,ti)
380 md_call(put,var,logical,,ti)
381 md_call(get,var,,char,ti)
382 md_call(put,var,,char,ti)
384 md_call(get,var,real,,td)
385 md_call(put,var,real,,td)
386 md_call(get,var,double,,td)
387 md_call(put,var,double,,td)
388 md_call(get,var,integer,,td)
389 md_call(put,var,integer,,td)
390 md_call(get,var,logical,,td)
391 md_call(put,var,logical,,td)
392 md_call(get,var,,char,td)
393 md_call(put,var,,char,td)