1 !WRF:MEDIATION_LAYER:IO
4 MODULE module_io_domain
14 SUBROUTINE open_r_dataset ( id , fname , grid , config_flags , sysdepinfo, ierr )
16 CHARACTER*(*) :: fname
17 CHARACTER*(*) :: sysdepinfo
18 INTEGER , INTENT(INOUT) :: id , ierr
19 LOGICAL , EXTERNAL :: wrf_dm_on_monitor
20 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
21 CHARACTER*128 :: DataSet
23 CALL wrf_open_for_read ( fname , &
25 grid%iocommunicator , &
30 END SUBROUTINE open_r_dataset
32 SUBROUTINE open_w_dataset ( id , fname , grid , config_flags , outsub , sysdepinfo, ierr )
34 CHARACTER*(*) :: fname
35 CHARACTER*(*) :: sysdepinfo
36 INTEGER , INTENT(INOUT) :: id , ierr
37 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
38 LOGICAL , EXTERNAL :: wrf_dm_on_monitor
40 CHARACTER*128 :: DataSet
42 CALL wrf_debug ( 100 , 'calling wrf_open_for_write_begin in open_w_dataset' )
43 CALL wrf_open_for_write_begin ( fname , &
45 grid%iocommunicator , &
49 IF ( ierr .LE. 0 ) THEN
50 CALL wrf_debug ( 100 , 'calling outsub in open_w_dataset' )
51 CALL outsub( id , grid , config_flags , ierr )
52 CALL wrf_debug ( 100 , 'back from outsub in open_w_dataset' )
54 IF ( ierr .LE. 0 ) THEN
55 CALL wrf_debug ( 100 , 'calling wrf_open_for_write_commit in open_w_dataset' )
56 CALL wrf_open_for_write_commit ( id , &
58 CALL wrf_debug ( 100 , 'back from wrf_open_for_write_commit in open_w_dataset' )
60 END SUBROUTINE open_w_dataset
62 SUBROUTINE open_u_dataset ( id , fname , grid , config_flags , insub , sysdepinfo, ierr )
64 CHARACTER*(*) :: fname
65 CHARACTER*(*) :: sysdepinfo
66 INTEGER , INTENT(INOUT) :: id , ierr
67 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
68 LOGICAL , EXTERNAL :: wrf_dm_on_monitor
70 CHARACTER*128 :: DataSet
72 CALL wrf_debug ( 100 , 'calling wrf_open_for_read_begin in open_u_dataset' )
73 CALL wrf_open_for_read_begin ( fname , &
75 grid%iocommunicator , &
79 IF ( ierr .LE. 0 ) THEN
80 CALL wrf_debug ( 100 , 'calling insub in open_u_dataset' )
81 CALL insub( id , grid , config_flags , ierr )
83 IF ( ierr .LE. 0 ) THEN
84 CALL wrf_debug ( 100 , 'calling wrf_open_for_read_commit in open_u_dataset' )
85 CALL wrf_open_for_read_commit ( id , &
87 CALL wrf_debug ( 100 , 'back from wrf_open_for_read_commit in open_u_dataset' )
89 END SUBROUTINE open_u_dataset
91 SUBROUTINE close_dataset( id , config_flags, sysdepinfo )
94 LOGICAL , EXTERNAL :: wrf_dm_on_monitor
95 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
96 CHARACTER*(*) :: sysdepinfo
97 CHARACTER*128 :: DataSet
99 CALL wrf_ioclose( id , ierr )
100 END SUBROUTINE close_dataset
103 ! ------------ Output model input data sets
105 SUBROUTINE output_model_input ( fid , grid , config_flags , ierr )
108 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
109 INTEGER, INTENT(IN) :: fid
110 INTEGER, INTENT(INOUT) :: ierr
111 IF ( config_flags%io_form_input .GT. 0 ) THEN
112 CALL output_wrf ( fid , grid , config_flags , model_input_only , ierr )
115 END SUBROUTINE output_model_input
117 SUBROUTINE output_aux_model_input1 ( fid , grid , config_flags , ierr )
120 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
121 INTEGER, INTENT(IN) :: fid
122 INTEGER, INTENT(INOUT) :: ierr
123 IF ( config_flags%io_form_auxinput1 .GT. 0 ) THEN
124 CALL output_wrf ( fid , grid , config_flags , aux_model_input1_only , ierr )
127 END SUBROUTINE output_aux_model_input1
129 SUBROUTINE output_aux_model_input2 ( fid , grid , config_flags , ierr )
132 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
133 INTEGER, INTENT(IN) :: fid
134 INTEGER, INTENT(INOUT) :: ierr
135 IF ( config_flags%io_form_auxinput2 .GT. 0 ) THEN
136 CALL output_wrf ( fid , grid , config_flags , aux_model_input2_only , ierr )
139 END SUBROUTINE output_aux_model_input2
141 SUBROUTINE output_aux_model_input3 ( fid , grid , config_flags , ierr )
144 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
145 INTEGER, INTENT(IN) :: fid
146 INTEGER, INTENT(INOUT) :: ierr
147 IF ( config_flags%io_form_auxinput3 .GT. 0 ) THEN
148 CALL output_wrf ( fid , grid , config_flags , aux_model_input3_only , ierr )
151 END SUBROUTINE output_aux_model_input3
153 SUBROUTINE output_aux_model_input4 ( fid , grid , config_flags , ierr )
156 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
157 INTEGER, INTENT(IN) :: fid
158 INTEGER, INTENT(INOUT) :: ierr
159 IF ( config_flags%io_form_auxinput4 .GT. 0 ) THEN
160 CALL output_wrf ( fid , grid , config_flags , aux_model_input4_only , ierr )
163 END SUBROUTINE output_aux_model_input4
165 SUBROUTINE output_aux_model_input5 ( fid , grid , config_flags , ierr )
168 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
169 INTEGER, INTENT(IN) :: fid
170 INTEGER, INTENT(INOUT) :: ierr
171 IF ( config_flags%io_form_auxinput5 .GT. 0 ) THEN
172 CALL output_wrf ( fid , grid , config_flags , aux_model_input5_only , ierr )
175 END SUBROUTINE output_aux_model_input5
177 SUBROUTINE output_aux_model_input6 ( fid , grid , config_flags , ierr )
180 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
181 INTEGER, INTENT(IN) :: fid
182 INTEGER, INTENT(INOUT) :: ierr
183 IF ( config_flags%io_form_auxinput6 .GT. 0 ) THEN
184 CALL output_wrf ( fid , grid , config_flags , aux_model_input6_only , ierr )
187 END SUBROUTINE output_aux_model_input6
189 SUBROUTINE output_aux_model_input7 ( fid , grid , config_flags , ierr )
192 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
193 INTEGER, INTENT(IN) :: fid
194 INTEGER, INTENT(INOUT) :: ierr
195 IF ( config_flags%io_form_auxinput7 .GT. 0 ) THEN
196 CALL output_wrf ( fid , grid , config_flags , aux_model_input7_only , ierr )
199 END SUBROUTINE output_aux_model_input7
201 SUBROUTINE output_aux_model_input8 ( fid , grid , config_flags , ierr )
204 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
205 INTEGER, INTENT(IN) :: fid
206 INTEGER, INTENT(INOUT) :: ierr
207 IF ( config_flags%io_form_auxinput8 .GT. 0 ) THEN
208 CALL output_wrf ( fid , grid , config_flags , aux_model_input8_only , ierr )
211 END SUBROUTINE output_aux_model_input8
213 SUBROUTINE output_aux_model_input9 ( fid , grid , config_flags , ierr )
216 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
217 INTEGER, INTENT(IN) :: fid
218 INTEGER, INTENT(INOUT) :: ierr
219 IF ( config_flags%io_form_auxinput9 .GT. 0 ) THEN
220 CALL output_wrf ( fid , grid , config_flags , aux_model_input9_only , ierr )
223 END SUBROUTINE output_aux_model_input9
225 SUBROUTINE output_aux_model_input10 ( fid , grid , config_flags , ierr )
228 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
229 INTEGER, INTENT(IN) :: fid
230 INTEGER, INTENT(INOUT) :: ierr
231 IF ( config_flags%io_form_gfdda .GT. 0 ) THEN
232 CALL output_wrf ( fid , grid , config_flags , aux_model_input10_only , ierr )
235 END SUBROUTINE output_aux_model_input10
237 SUBROUTINE output_aux_model_input11 ( fid , grid , config_flags , ierr )
240 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
241 INTEGER, INTENT(IN) :: fid
242 INTEGER, INTENT(INOUT) :: ierr
243 IF ( config_flags%io_form_auxinput11 .GT. 0 ) THEN
244 CALL output_wrf ( fid , grid , config_flags , aux_model_input11_only , ierr )
247 END SUBROUTINE output_aux_model_input11
249 ! ------------ Output model history data sets
251 SUBROUTINE output_history ( fid , grid , config_flags , ierr )
254 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
255 INTEGER, INTENT(IN) :: fid
256 INTEGER, INTENT(INOUT) :: ierr
257 IF ( config_flags%io_form_history .GT. 0 ) THEN
258 CALL output_wrf ( fid , grid , config_flags , history_only , ierr )
261 END SUBROUTINE output_history
263 SUBROUTINE output_aux_hist1 ( fid , grid , config_flags , ierr )
266 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
267 INTEGER, INTENT(IN) :: fid
268 INTEGER, INTENT(INOUT) :: ierr
269 IF ( config_flags%io_form_auxhist1 .GT. 0 ) THEN
270 CALL output_wrf ( fid , grid , config_flags , aux_hist1_only , ierr )
273 END SUBROUTINE output_aux_hist1
275 SUBROUTINE output_aux_hist2 ( fid , grid , config_flags , ierr )
278 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
279 INTEGER, INTENT(IN) :: fid
280 INTEGER, INTENT(INOUT) :: ierr
281 IF ( config_flags%io_form_auxhist2 .GT. 0 ) THEN
282 CALL output_wrf ( fid , grid , config_flags , aux_hist2_only , ierr )
285 END SUBROUTINE output_aux_hist2
287 SUBROUTINE output_aux_hist3 ( fid , grid , config_flags , ierr )
290 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
291 INTEGER, INTENT(IN) :: fid
292 INTEGER, INTENT(INOUT) :: ierr
293 IF ( config_flags%io_form_auxhist3 .GT. 0 ) THEN
294 CALL output_wrf ( fid , grid , config_flags , aux_hist3_only , ierr )
297 END SUBROUTINE output_aux_hist3
299 SUBROUTINE output_aux_hist4 ( fid , grid , config_flags , ierr )
302 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
303 INTEGER, INTENT(IN) :: fid
304 INTEGER, INTENT(INOUT) :: ierr
305 IF ( config_flags%io_form_auxhist4 .GT. 0 ) THEN
306 CALL output_wrf ( fid , grid , config_flags , aux_hist4_only , ierr )
309 END SUBROUTINE output_aux_hist4
311 SUBROUTINE output_aux_hist5 ( fid , grid , config_flags , ierr )
314 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
315 INTEGER, INTENT(IN) :: fid
316 INTEGER, INTENT(INOUT) :: ierr
317 IF ( config_flags%io_form_auxhist5 .GT. 0 ) THEN
318 CALL output_wrf ( fid , grid , config_flags , aux_hist5_only , ierr )
321 END SUBROUTINE output_aux_hist5
323 SUBROUTINE output_aux_hist6 ( fid , grid , config_flags , ierr )
326 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
327 INTEGER, INTENT(IN) :: fid
328 INTEGER, INTENT(INOUT) :: ierr
329 IF ( config_flags%io_form_auxhist6 .GT. 0 ) THEN
330 CALL output_wrf ( fid , grid , config_flags , aux_hist6_only , ierr )
333 END SUBROUTINE output_aux_hist6
335 SUBROUTINE output_aux_hist7 ( fid , grid , config_flags , ierr )
338 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
339 INTEGER, INTENT(IN) :: fid
340 INTEGER, INTENT(INOUT) :: ierr
341 IF ( config_flags%io_form_auxhist7 .GT. 0 ) THEN
342 CALL output_wrf ( fid , grid , config_flags , aux_hist7_only , ierr )
345 END SUBROUTINE output_aux_hist7
347 SUBROUTINE output_aux_hist8 ( fid , grid , config_flags , ierr )
350 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
351 INTEGER, INTENT(IN) :: fid
352 INTEGER, INTENT(INOUT) :: ierr
353 IF ( config_flags%io_form_auxhist8 .GT. 0 ) THEN
354 CALL output_wrf ( fid , grid , config_flags , aux_hist8_only , ierr )
357 END SUBROUTINE output_aux_hist8
359 SUBROUTINE output_aux_hist9 ( fid , grid , config_flags , ierr )
362 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
363 INTEGER, INTENT(IN) :: fid
364 INTEGER, INTENT(INOUT) :: ierr
365 IF ( config_flags%io_form_auxhist9 .GT. 0 ) THEN
366 CALL output_wrf ( fid , grid , config_flags , aux_hist9_only , ierr )
369 END SUBROUTINE output_aux_hist9
371 SUBROUTINE output_aux_hist10 ( fid , grid , config_flags , ierr )
374 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
375 INTEGER, INTENT(IN) :: fid
376 INTEGER, INTENT(INOUT) :: ierr
377 IF ( config_flags%io_form_auxhist10 .GT. 0 ) THEN
378 CALL output_wrf ( fid , grid , config_flags , aux_hist10_only , ierr )
381 END SUBROUTINE output_aux_hist10
383 SUBROUTINE output_aux_hist11 ( fid , grid , config_flags , ierr )
386 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
387 INTEGER, INTENT(IN) :: fid
388 INTEGER, INTENT(INOUT) :: ierr
389 IF ( config_flags%io_form_auxhist11 .GT. 0 ) THEN
390 CALL output_wrf ( fid , grid , config_flags , aux_hist11_only , ierr )
393 END SUBROUTINE output_aux_hist11
395 ! ------------ Output model restart data sets
397 SUBROUTINE output_restart ( fid , grid , config_flags , ierr )
400 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
401 INTEGER, INTENT(IN) :: fid
402 INTEGER, INTENT(INOUT) :: ierr
403 IF ( config_flags%io_form_restart .GT. 0 ) THEN
404 CALL output_wrf ( fid , grid , config_flags , restart_only , ierr )
407 END SUBROUTINE output_restart
409 ! ------------ Output model boundary data sets
411 SUBROUTINE output_boundary ( fid , grid , config_flags , ierr )
414 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
415 INTEGER, INTENT(IN) :: fid
416 INTEGER, INTENT(INOUT) :: ierr
417 IF ( config_flags%io_form_boundary .GT. 0 ) THEN
418 CALL output_wrf ( fid , grid , config_flags , boundary_only , ierr )
421 END SUBROUTINE output_boundary
423 ! ------------ Input model input data sets
425 SUBROUTINE input_model_input ( fid , grid , config_flags , ierr )
428 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
429 INTEGER, INTENT(IN) :: fid
430 INTEGER, INTENT(INOUT) :: ierr
431 IF ( config_flags%io_form_input .GT. 0 ) THEN
432 CALL input_wrf ( fid , grid , config_flags , model_input_only , ierr )
435 END SUBROUTINE input_model_input
437 SUBROUTINE input_aux_model_input1 ( fid , grid , config_flags , ierr )
440 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
441 INTEGER, INTENT(IN) :: fid
442 INTEGER, INTENT(INOUT) :: ierr
443 IF ( config_flags%io_form_auxinput1 .GT. 0 ) THEN
444 CALL input_wrf ( fid , grid , config_flags , aux_model_input1_only , ierr )
447 END SUBROUTINE input_aux_model_input1
449 SUBROUTINE input_aux_model_input2 ( fid , grid , config_flags , ierr )
452 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
453 INTEGER, INTENT(IN) :: fid
454 INTEGER, INTENT(INOUT) :: ierr
455 IF ( config_flags%io_form_auxinput2 .GT. 0 ) THEN
456 CALL input_wrf ( fid , grid , config_flags , aux_model_input2_only , ierr )
459 END SUBROUTINE input_aux_model_input2
461 SUBROUTINE input_aux_model_input3 ( fid , grid , config_flags , ierr )
464 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
465 INTEGER, INTENT(IN) :: fid
466 INTEGER, INTENT(INOUT) :: ierr
467 IF ( config_flags%io_form_auxinput3 .GT. 0 ) THEN
468 CALL input_wrf ( fid , grid , config_flags , aux_model_input3_only , ierr )
471 END SUBROUTINE input_aux_model_input3
473 SUBROUTINE input_aux_model_input4 ( fid , grid , config_flags , ierr )
476 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
477 INTEGER, INTENT(IN) :: fid
478 INTEGER, INTENT(INOUT) :: ierr
479 IF ( config_flags%io_form_auxinput4 .GT. 0 ) THEN
480 CALL input_wrf ( fid , grid , config_flags , aux_model_input4_only , ierr )
483 END SUBROUTINE input_aux_model_input4
485 SUBROUTINE input_aux_model_input5 ( fid , grid , config_flags , ierr )
488 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
489 INTEGER, INTENT(IN) :: fid
490 INTEGER, INTENT(INOUT) :: ierr
491 IF ( config_flags%io_form_auxinput5 .GT. 0 ) THEN
492 CALL input_wrf ( fid , grid , config_flags , aux_model_input5_only , ierr )
495 END SUBROUTINE input_aux_model_input5
497 SUBROUTINE input_aux_model_input6 ( fid , grid , config_flags , ierr )
500 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
501 INTEGER, INTENT(IN) :: fid
502 INTEGER, INTENT(INOUT) :: ierr
503 IF ( config_flags%io_form_auxinput6 .GT. 0 ) THEN
504 CALL input_wrf ( fid , grid , config_flags , aux_model_input6_only , ierr )
507 END SUBROUTINE input_aux_model_input6
508 SUBROUTINE input_aux_model_input7 ( fid , grid , config_flags , ierr )
511 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
512 INTEGER, INTENT(IN) :: fid
513 INTEGER, INTENT(INOUT) :: ierr
514 IF ( config_flags%io_form_auxinput7 .GT. 0 ) THEN
515 CALL input_wrf ( fid , grid , config_flags , aux_model_input7_only , ierr )
518 END SUBROUTINE input_aux_model_input7
519 SUBROUTINE input_aux_model_input8 ( fid , grid , config_flags , ierr )
522 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
523 INTEGER, INTENT(IN) :: fid
524 INTEGER, INTENT(INOUT) :: ierr
525 IF ( config_flags%io_form_auxinput8 .GT. 0 ) THEN
526 CALL input_wrf ( fid , grid , config_flags , aux_model_input8_only , ierr )
529 END SUBROUTINE input_aux_model_input8
530 SUBROUTINE input_aux_model_input9 ( fid , grid , config_flags , ierr )
533 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
534 INTEGER, INTENT(IN) :: fid
535 INTEGER, INTENT(INOUT) :: ierr
536 IF ( config_flags%io_form_auxinput9 .GT. 0 ) THEN
537 CALL input_wrf ( fid , grid , config_flags , aux_model_input9_only , ierr )
540 END SUBROUTINE input_aux_model_input9
541 SUBROUTINE input_aux_model_input10 ( fid , grid , config_flags , ierr )
544 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
545 INTEGER, INTENT(IN) :: fid
546 INTEGER, INTENT(INOUT) :: ierr
547 IF ( config_flags%io_form_gfdda .GT. 0 ) THEN
548 CALL input_wrf ( fid , grid , config_flags , aux_model_input10_only , ierr )
551 END SUBROUTINE input_aux_model_input10
552 SUBROUTINE input_aux_model_input11 ( fid , grid , config_flags , ierr )
555 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
556 INTEGER, INTENT(IN) :: fid
557 INTEGER, INTENT(INOUT) :: ierr
558 IF ( config_flags%io_form_auxinput11 .GT. 0 ) THEN
559 CALL input_wrf ( fid , grid , config_flags , aux_model_input11_only , ierr )
562 END SUBROUTINE input_aux_model_input11
564 ! ------------ Input model history data sets
566 SUBROUTINE input_history ( fid , grid , config_flags , ierr )
569 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
570 INTEGER, INTENT(IN) :: fid
571 INTEGER, INTENT(INOUT) :: ierr
572 IF ( config_flags%io_form_history .GT. 0 ) THEN
573 CALL input_wrf ( fid , grid , config_flags , history_only , ierr )
576 END SUBROUTINE input_history
578 SUBROUTINE input_aux_hist1 ( fid , grid , config_flags , ierr )
581 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
582 INTEGER, INTENT(IN) :: fid
583 INTEGER, INTENT(INOUT) :: ierr
584 IF ( config_flags%io_form_auxhist1 .GT. 0 ) THEN
585 CALL input_wrf ( fid , grid , config_flags , aux_hist1_only , ierr )
588 END SUBROUTINE input_aux_hist1
590 SUBROUTINE input_aux_hist2 ( fid , grid , config_flags , ierr )
593 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
594 INTEGER, INTENT(IN) :: fid
595 INTEGER, INTENT(INOUT) :: ierr
596 IF ( config_flags%io_form_auxhist2 .GT. 0 ) THEN
597 CALL input_wrf ( fid , grid , config_flags , aux_hist2_only , ierr )
600 END SUBROUTINE input_aux_hist2
602 SUBROUTINE input_aux_hist3 ( fid , grid , config_flags , ierr )
605 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
606 INTEGER, INTENT(IN) :: fid
607 INTEGER, INTENT(INOUT) :: ierr
608 IF ( config_flags%io_form_auxhist3 .GT. 0 ) THEN
609 CALL input_wrf ( fid , grid , config_flags , aux_hist3_only , ierr )
612 END SUBROUTINE input_aux_hist3
614 SUBROUTINE input_aux_hist4 ( fid , grid , config_flags , ierr )
617 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
618 INTEGER, INTENT(IN) :: fid
619 INTEGER, INTENT(INOUT) :: ierr
620 IF ( config_flags%io_form_auxhist4 .GT. 0 ) THEN
621 CALL input_wrf ( fid , grid , config_flags , aux_hist4_only , ierr )
624 END SUBROUTINE input_aux_hist4
626 SUBROUTINE input_aux_hist5 ( fid , grid , config_flags , ierr )
629 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
630 INTEGER, INTENT(IN) :: fid
631 INTEGER, INTENT(INOUT) :: ierr
632 IF ( config_flags%io_form_auxhist5 .GT. 0 ) THEN
633 CALL input_wrf ( fid , grid , config_flags , aux_hist5_only , ierr )
636 END SUBROUTINE input_aux_hist5
638 SUBROUTINE input_aux_hist6 ( fid , grid , config_flags , ierr )
641 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
642 INTEGER, INTENT(IN) :: fid
643 INTEGER, INTENT(INOUT) :: ierr
644 IF ( config_flags%io_form_auxhist6 .GT. 0 ) THEN
645 CALL input_wrf ( fid , grid , config_flags , aux_hist6_only , ierr )
648 END SUBROUTINE input_aux_hist6
649 SUBROUTINE input_aux_hist7 ( fid , grid , config_flags , ierr )
652 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
653 INTEGER, INTENT(IN) :: fid
654 INTEGER, INTENT(INOUT) :: ierr
655 IF ( config_flags%io_form_auxhist7 .GT. 0 ) THEN
656 CALL input_wrf ( fid , grid , config_flags , aux_hist7_only , ierr )
659 END SUBROUTINE input_aux_hist7
660 SUBROUTINE input_aux_hist8 ( fid , grid , config_flags , ierr )
663 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
664 INTEGER, INTENT(IN) :: fid
665 INTEGER, INTENT(INOUT) :: ierr
666 IF ( config_flags%io_form_auxhist8 .GT. 0 ) THEN
667 CALL input_wrf ( fid , grid , config_flags , aux_hist8_only , ierr )
670 END SUBROUTINE input_aux_hist8
671 SUBROUTINE input_aux_hist9 ( fid , grid , config_flags , ierr )
674 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
675 INTEGER, INTENT(IN) :: fid
676 INTEGER, INTENT(INOUT) :: ierr
677 IF ( config_flags%io_form_auxhist9 .GT. 0 ) THEN
678 CALL input_wrf ( fid , grid , config_flags , aux_hist9_only , ierr )
681 END SUBROUTINE input_aux_hist9
682 SUBROUTINE input_aux_hist10 ( fid , grid , config_flags , ierr )
685 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
686 INTEGER, INTENT(IN) :: fid
687 INTEGER, INTENT(INOUT) :: ierr
688 IF ( config_flags%io_form_auxhist10 .GT. 0 ) THEN
689 CALL input_wrf ( fid , grid , config_flags , aux_hist10_only , ierr )
692 END SUBROUTINE input_aux_hist10
693 SUBROUTINE input_aux_hist11 ( fid , grid , config_flags , ierr )
696 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
697 INTEGER, INTENT(IN) :: fid
698 INTEGER, INTENT(INOUT) :: ierr
699 IF ( config_flags%io_form_auxhist11 .GT. 0 ) THEN
700 CALL input_wrf ( fid , grid , config_flags , aux_hist11_only , ierr )
703 END SUBROUTINE input_aux_hist11
705 ! ------------ Input model restart data sets
707 SUBROUTINE input_restart ( fid , grid , config_flags , ierr )
710 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
711 INTEGER, INTENT(IN) :: fid
712 INTEGER, INTENT(INOUT) :: ierr
713 IF ( config_flags%io_form_restart .GT. 0 ) THEN
714 CALL input_wrf ( fid , grid , config_flags , restart_only , ierr )
717 END SUBROUTINE input_restart
719 ! ------------ Input model boundary data sets
721 SUBROUTINE input_boundary ( fid , grid , config_flags , ierr )
724 TYPE(grid_config_rec_type), INTENT(IN ) :: config_flags
725 INTEGER, INTENT(IN) :: fid
726 INTEGER, INTENT(INOUT) :: ierr
727 IF ( config_flags%io_form_boundary .GT. 0 ) THEN
728 CALL input_wrf ( fid , grid , config_flags , boundary_only , ierr )
731 END SUBROUTINE input_boundary
733 END MODULE module_io_domain
735 ! move outside module so callable without USE of module
736 SUBROUTINE construct_filename1( result , basename , fld1 , len1 )
738 CHARACTER*(*) :: result
739 CHARACTER*(*) :: basename
740 INTEGER , INTENT(IN) :: fld1 , len1
741 CHARACTER*64 :: t1, zeros
743 CALL zero_pad ( t1 , fld1 , len1 )
744 result = TRIM(basename) // "_d" // TRIM(t1)
745 CALL maybe_remove_colons(result)
747 END SUBROUTINE construct_filename1
749 SUBROUTINE construct_filename2( result , basename , fld1 , len1 , date_char )
751 CHARACTER*(*) :: result
752 CHARACTER*(*) :: basename
753 CHARACTER*(*) :: date_char
755 INTEGER , INTENT(IN) :: fld1 , len1
756 CHARACTER*64 :: t1, zeros
757 CALL zero_pad ( t1 , fld1 , len1 )
758 result = TRIM(basename) // ".d" // TRIM(t1) // "." // TRIM(date_char)
759 CALL maybe_remove_colons(result)
761 END SUBROUTINE construct_filename2
763 ! this version looks for <date> and <domain> in the basename and replaces with the arguments
765 SUBROUTINE construct_filename2a( result , basename , fld1 , len1 , date_char )
767 CHARACTER*(*) :: result
768 CHARACTER*(*) :: basename
769 CHARACTER*(*) :: date_char
771 INTEGER , INTENT(IN) :: fld1 , len1
772 CHARACTER*64 :: t1, zeros
775 CALL zero_pad ( t1 , fld1 , len1 )
776 i = index( basename , '<domain>' )
777 l = len(trim(basename))
779 result = basename(1:i-1) // TRIM(t1) // basename(i+8:l)
781 i = index( result , '<date>' )
782 l = len(trim(result))
784 result = result(1:i-1) // TRIM(date_char) // result(i+6:l)
786 CALL maybe_remove_colons(result)
788 END SUBROUTINE construct_filename2a
790 SUBROUTINE construct_filename ( result , basename , fld1 , len1 , fld2 , len2 )
792 CHARACTER*(*) :: result
793 CHARACTER*(*) :: basename
794 INTEGER , INTENT(IN) :: fld1 , len1 , fld2 , len2
795 CHARACTER*64 :: t1, t2, zeros
797 CALL zero_pad ( t1 , fld1 , len1 )
798 CALL zero_pad ( t2 , fld2 , len2 )
799 result = TRIM(basename) // "_d" // TRIM(t1) // "_" // TRIM(t2)
800 CALL maybe_remove_colons(result)
802 END SUBROUTINE construct_filename
804 SUBROUTINE construct_filename3 ( result , basename , fld1 , len1 , fld2 , len2, fld3, len3 )
806 CHARACTER*(*) :: result
807 CHARACTER*(*) :: basename
808 INTEGER , INTENT(IN) :: fld1 , len1 , fld2 , len2, fld3, len3
809 CHARACTER*64 :: t1, t2, t3, zeros
811 CALL zero_pad ( t1 , fld1 , len1 )
812 CALL zero_pad ( t2 , fld2 , len2 )
813 CALL zero_pad ( t3 , fld3 , len3 )
814 result = TRIM(basename) // "_d" // TRIM(t1) // "_" // TRIM(t2) // "_" // TRIM(t3)
815 CALL maybe_remove_colons(result)
817 END SUBROUTINE construct_filename3
819 SUBROUTINE construct_filename4( result , basename , fld1 , len1 , date_char , io_form )
820 USE module_state_description
822 CHARACTER*(*) :: result
823 CHARACTER*(*) :: basename
824 CHARACTER*(*) :: date_char
826 INTEGER, EXTERNAL :: use_package
827 INTEGER , INTENT(IN) :: fld1 , len1 , io_form
828 CHARACTER*64 :: t1, zeros
830 CALL zero_pad ( t1 , fld1 , len1 )
831 IF ( use_package(io_form) .EQ. IO_INTIO ) THEN
833 ELSE IF ( use_package(io_form) .EQ. IO_NETCDF ) THEN
835 ELSE IF ( use_package(io_form) .EQ. IO_PNETCDF ) THEN
837 ELSE IF ( use_package(io_form) .EQ. IO_GRIB1 ) THEN
840 CALL wrf_error_fatal ('improper io_form')
842 result = TRIM(basename) // ".d" // TRIM(t1) // "." // TRIM(date_char) // TRIM(ext)
843 CALL maybe_remove_colons(result)
845 END SUBROUTINE construct_filename4
847 ! this version looks for <date> and <domain> in the basename and replaces with the arguments
849 SUBROUTINE construct_filename4a( result , basename , fld1 , len1 , date_char , io_form )
850 USE module_state_description
852 CHARACTER*(*) :: result
853 CHARACTER*(*) :: basename
854 CHARACTER*(*) :: date_char
856 INTEGER, EXTERNAL :: use_package
857 INTEGER , INTENT(IN) :: fld1 , len1 , io_form
858 CHARACTER*64 :: t1, zeros
862 CALL zero_pad ( t1 , fld1 , len1 )
863 IF ( use_package(io_form) .EQ. IO_INTIO ) THEN
865 ELSE IF ( use_package(io_form) .EQ. IO_NETCDF ) THEN
867 ELSE IF ( use_package(io_form) .EQ. IO_PNETCDF ) THEN
869 ELSE IF ( use_package(io_form) .EQ. IO_GRIB1 ) THEN
872 CALL wrf_error_fatal ('improper io_form')
874 l = len(trim(basename))
875 result = basename(1:l) // TRIM(ext)
876 i = index( result , '<domain>' )
877 l = len(trim(result))
879 result = result(1:i-1) // TRIM(t1) // result(i+8:l)
881 i = index( result , '<date>' )
882 l = len(trim(result))
884 result = result(1:i-1) // TRIM(date_char) // result(i+6:l)
886 CALL maybe_remove_colons(result)
888 END SUBROUTINE construct_filename4a
890 SUBROUTINE append_to_filename ( result , basename , fld1 , len1 )
892 CHARACTER*(*) :: result
893 CHARACTER*(*) :: basename
894 INTEGER , INTENT(IN) :: fld1 , len1
895 CHARACTER*64 :: t1, zeros
897 CALL zero_pad ( t1 , fld1 , len1 )
898 result = TRIM(basename) // "_" // TRIM(t1)
899 CALL maybe_remove_colons(result)
901 END SUBROUTINE append_to_filename
903 SUBROUTINE zero_pad ( result , fld1 , len1 )
905 CHARACTER*(*) :: result
906 INTEGER , INTENT (IN) :: fld1 , len1
908 CHARACTER*64 :: t2, zeros
915 zeros = '0000000000000000000000000000000'
916 result = zeros(1:len1-d) // t2(9-d+1:9)
918 END SUBROUTINE zero_pad
920 SUBROUTINE init_wrfio
924 CALL wrf_ioinit(ierr)
925 END SUBROUTINE init_wrfio
928 ! This routine figures out the nearest previous time instant
929 ! that corresponds to a multiple of the input time interval.
930 ! Example use is to give the time instant that corresponds to
931 ! an I/O interval, even when the current time is a little bit
932 ! past that time when, for example, the number of model time
933 ! steps does not evenly divide the I/O interval. JM 20051013
936 SUBROUTINE adjust_io_timestr ( TI, CT, ST, timestr )
940 TYPE(WRFU_Time), INTENT(IN) :: ST,CT ! domain start and current time
941 TYPE(WRFU_TimeInterval), INTENT(IN) :: TI ! interval
942 CHARACTER*(*), INTENT(INOUT) :: timestr ! returned string
944 TYPE(WRFU_Time) :: OT
945 TYPE(WRFU_TimeInterval) :: IOI
948 IOI = CT-ST ! length of time since starting
949 n = WRFU_TimeIntervalDIVQuot( IOI , TI ) ! number of whole time intervals
950 IOI = TI * n ! amount of time since starting in whole time intervals
951 OT = ST + IOI ! previous nearest time instant
952 CALL wrf_timetoa( OT, timestr ) ! generate string
954 END SUBROUTINE adjust_io_timestr
956 ! Modify the filename to remove things like ':' from the file name
957 ! unless it is a drive number. Convert to '_' instead.
959 SUBROUTINE maybe_remove_colons( FileName )
961 CHARACTER*(*) FileName
965 l = LEN(TRIM(FileName))
966 ! do not change first two characters (naive way of dealing with
967 ! possiblity of drive name in a microsoft path
968 CALL nl_get_nocolons(1,nocolons)
971 IF ( FileName(i:i) .EQ. ':' ) THEN