4 use misc_definitions_module
7 use module_internal_header_util
12 type (queue) :: unit_desc
14 ! WRF I/O API related variables
19 character (len=1) :: internal_gridtype
24 subroutine input_init(nest_number, istatus)
29 integer, intent(in) :: nest_number
30 integer, intent(out) :: istatus
32 #include "wrf_io_flags.h"
33 #include "wrf_status_codes.h"
37 integer :: comm_1, comm_2
38 character (len=MAX_FILENAME_LEN) :: input_fname
42 if (my_proc_id == IO_NODE .or. do_tiled_input) then
45 if (io_form_input == BINARY) call ext_int_ioinit('sysdep info', istatus)
48 if (io_form_input == NETCDF) call ext_ncd_ioinit('sysdep info', istatus)
51 if (io_form_input == GRIB1) call ext_gr1_ioinit('sysdep info', istatus)
53 call mprintf((istatus /= 0),ERROR,'Error in ext_pkg_ioinit')
58 if (gridtype == 'C') then
60 if (io_form_input == BINARY) input_fname = trim(opt_output_from_geogrid_path)//'geo_em.d .int'
63 if (io_form_input == NETCDF) input_fname = trim(opt_output_from_geogrid_path)//'geo_em.d .nc'
66 if (io_form_input == GRIB1) input_fname = trim(opt_output_from_geogrid_path)//'geo_em.d .grib'
68 i = len_trim(opt_output_from_geogrid_path)
69 write(input_fname(i+9:i+10),'(i2.2)') nest_number
70 else if (gridtype == 'E') then
72 if (io_form_input == BINARY) input_fname = trim(opt_output_from_geogrid_path)//'geo_nmm.d .int'
75 if (io_form_input == NETCDF) input_fname = trim(opt_output_from_geogrid_path)//'geo_nmm.d .nc'
78 if (io_form_input == GRIB1) input_fname = trim(opt_output_from_geogrid_path)//'geo_nmm.d .grib'
80 i = len_trim(opt_output_from_geogrid_path)
81 write(input_fname(i+10:i+11),'(i2.2)') nest_number
84 if (nprocs > 1 .and. do_tiled_input) then
85 write(input_fname(len_trim(input_fname)+1:len_trim(input_fname)+5), '(a1,i4.4)') &
91 if (io_form_input == BINARY) &
92 call ext_int_open_for_read(trim(input_fname), comm_1, comm_2, 'sysdep info', handle, istatus)
95 if (io_form_input == NETCDF) &
96 call ext_ncd_open_for_read(trim(input_fname), comm_1, comm_2, 'sysdep info', handle, istatus)
99 if (io_form_input == GRIB1) &
100 call ext_gr1_open_for_read(trim(input_fname), comm_1, comm_2, 'sysdep info', handle, istatus)
102 call mprintf((istatus /= 0),ERROR,'Couldn''t open file %s for input.',s1=input_fname)
104 call q_init(unit_desc)
106 end if ! (my_proc_id == IO_NODE .or. do_tiled_input)
110 end subroutine input_init
113 subroutine read_next_field(start_patch_i, end_patch_i, &
114 start_patch_j, end_patch_j, &
115 start_patch_k, end_patch_k, &
116 cname, cunits, cdesc, memorder, stagger, &
117 dimnames, sr_x, sr_y, real_array, istatus)
122 integer, intent(out) :: start_patch_i, end_patch_i, &
123 start_patch_j, end_patch_j, &
124 start_patch_k, end_patch_k, &
126 real, pointer, dimension(:,:,:) :: real_array
127 character (len=*), intent(out) :: cname, memorder, stagger, cunits, cdesc
128 character (len=128), dimension(3), intent(inout) :: dimnames
129 integer, intent(inout) :: istatus
131 #include "wrf_io_flags.h"
132 #include "wrf_status_codes.h"
135 integer :: ndim, wrftype
136 integer :: sm1, em1, sm2, em2, sm3, em3, sp1, ep1, sp2, ep2, sp3, ep3
137 integer, dimension(3) :: domain_start, domain_end, temp
138 real, pointer, dimension(:,:,:) :: real_domain
139 character (len=20) :: datestr
142 if (my_proc_id == IO_NODE .or. do_tiled_input) then
144 if (num_calls == 0) then
146 if (io_form_input == BINARY) call ext_int_get_next_time(handle, datestr, istatus)
149 if (io_form_input == NETCDF) call ext_ncd_get_next_time(handle, datestr, istatus)
152 if (io_form_input == GRIB1) call ext_gr1_get_next_time(handle, datestr, istatus)
156 num_calls = num_calls + 1
159 if (io_form_input == BINARY) call ext_int_get_next_var(handle, cname, istatus)
162 if (io_form_input == NETCDF) call ext_ncd_get_next_var(handle, cname, istatus)
165 if (io_form_input == GRIB1) call ext_gr1_get_next_var(handle, cname, istatus)
169 if (nprocs > 1 .and. .not. do_tiled_input) call parallel_bcast_int(istatus)
170 if (istatus /= 0) return
172 if (my_proc_id == IO_NODE .or. do_tiled_input) then
176 if (io_form_input == BINARY) then
177 call ext_int_get_var_info(handle, cname, ndim, memorder, stagger, domain_start, domain_end, wrftype, istatus)
181 if (io_form_input == NETCDF) then
182 call ext_ncd_get_var_info(handle, cname, ndim, memorder, stagger, domain_start, domain_end, wrftype, istatus)
183 call ext_ncd_get_var_ti_integer(handle, 'sr_x', &
184 trim(cname), temp(1), 1, temp(3), istatus)
185 call ext_ncd_get_var_ti_integer(handle, 'sr_y', &
186 trim(cname), temp(2), 1, temp(3), istatus)
190 if (io_form_input == GRIB1) then
191 call ext_gr1_get_var_info(handle, cname, ndim, memorder, stagger, domain_start, domain_end, wrftype, istatus)
192 call ext_gr1_get_var_ti_integer(handle, 'sr_x', &
193 trim(cname), temp(1), 1, temp(3), istatus)
194 call ext_gr1_get_var_ti_integer(handle, 'sr_y', &
195 trim(cname), temp(2), 1, temp(3), istatus)
199 call mprintf((istatus /= 0),ERROR,'In read_next_field(), problems with ext_pkg_get_var_info()')
201 start_patch_i = domain_start(1)
202 start_patch_j = domain_start(2)
203 end_patch_i = domain_end(1)
204 end_patch_j = domain_end(2)
206 start_patch_k = domain_start(3)
207 end_patch_k = domain_end(3)
217 allocate(real_domain(start_patch_i:end_patch_i, start_patch_j:end_patch_j, start_patch_k:end_patch_k))
219 if (io_form_input == BINARY) then
220 call ext_int_read_field(handle, '0000-00-00_00:00:00', cname, real_domain, WRF_REAL, &
221 1, 1, 0, memorder, stagger, &
222 dimnames, domain_start, domain_end, domain_start, domain_end, &
223 domain_start, domain_end, istatus)
227 if (io_form_input == NETCDF) then
228 call ext_ncd_read_field(handle, '0000-00-00_00:00:00', cname, real_domain, WRF_REAL, &
229 1, 1, 0, memorder, stagger, &
230 dimnames, domain_start, domain_end, domain_start, domain_end, &
231 domain_start, domain_end, istatus)
235 if (io_form_input == GRIB1) then
236 call ext_gr1_read_field(handle, '0000-00-00_00:00:00', cname, real_domain, WRF_REAL, &
237 1, 1, 0, memorder, stagger, &
238 dimnames, domain_start, domain_end, domain_start, domain_end, &
239 domain_start, domain_end, istatus)
243 call mprintf((istatus /= 0),ERROR,'In read_next_field(), got error code %i.', i1=istatus)
245 if (io_form_input == BINARY) then
246 qd = q_remove(unit_desc)
248 cdesc = qd%description
260 if (io_form_input == NETCDF) then
261 call ext_ncd_get_var_ti_char(handle, 'units', cname, cunits, istatus)
262 call ext_ncd_get_var_ti_char(handle, 'description', cname, cdesc, istatus)
263 call ext_ncd_get_var_ti_char(handle, 'stagger', cname, stagger, istatus)
267 if (io_form_input == GRIB1) then
268 call ext_gr1_get_var_ti_char(handle, 'units', cname, cunits, istatus)
269 call ext_gr1_get_var_ti_char(handle, 'description', cname, cdesc, istatus)
270 call ext_gr1_get_var_ti_char(handle, 'stagger', cname, stagger, istatus)
275 end if ! (my_proc_id == IO_NODE .or. do_tiled_input)
277 if (nprocs > 1 .and. .not. do_tiled_input) then
278 call parallel_bcast_char(cname, len(cname))
279 call parallel_bcast_char(cunits, len(cunits))
280 call parallel_bcast_char(cdesc, len(cdesc))
281 call parallel_bcast_char(memorder, len(memorder))
282 call parallel_bcast_char(stagger, len(stagger))
283 call parallel_bcast_char(dimnames(1), 128)
284 call parallel_bcast_char(dimnames(2), 128)
285 call parallel_bcast_char(dimnames(3), 128)
286 call parallel_bcast_int(domain_start(3))
287 call parallel_bcast_int(domain_end(3))
288 call parallel_bcast_int(sr_x)
289 call parallel_bcast_int(sr_y)
295 sp3 = domain_start(3)
298 if (internal_gridtype == 'C') then
299 if (my_x /= nproc_x - 1 .or. stagger == 'U' .or. stagger == 'CORNER' .or. sr_x > 1) then
302 if (my_y /= nproc_y - 1 .or. stagger == 'V' .or. stagger == 'CORNER' .or. sr_y > 1) then
305 else if (internal_gridtype == 'E') then
333 allocate(real_array(sm1:em1,sm2:em2,sm3:em3))
334 if (my_proc_id /= IO_NODE) then
335 allocate(real_domain(1,1,1))
343 call scatter_whole_field_r(real_array, &
344 sm1, em1, sm2, em2, sm3, em3, &
345 sp1, ep1, sp2, ep2, sp3, ep3, &
347 domain_start(1), domain_end(1), &
348 domain_start(2), domain_end(2), &
349 domain_start(3), domain_end(3))
350 deallocate(real_domain)
354 real_array => real_domain
358 end subroutine read_next_field
360 subroutine read_global_attrs(title, start_date, grid_type, dyn_opt, &
361 west_east_dim, south_north_dim, bottom_top_dim, &
362 we_patch_s, we_patch_e, we_patch_s_stag, we_patch_e_stag, &
363 sn_patch_s, sn_patch_e, sn_patch_s_stag, sn_patch_e_stag, &
364 map_proj, mminlu, num_land_cat, is_water, is_lake, is_ice, is_urban, &
365 isoilwater, grid_id, parent_id, i_parent_start, j_parent_start, &
366 i_parent_end, j_parent_end, dx, dy, cen_lat, moad_cen_lat, cen_lon, &
367 stand_lon, truelat1, truelat2, pole_lat, pole_lon, parent_grid_ratio, &
368 corner_lats, corner_lons, sr_x, sr_y)
373 integer, intent(out) :: dyn_opt, west_east_dim, south_north_dim, bottom_top_dim, map_proj, &
374 is_water, is_lake, we_patch_s, we_patch_e, we_patch_s_stag, we_patch_e_stag, &
375 sn_patch_s, sn_patch_e, sn_patch_s_stag, sn_patch_e_stag, &
376 is_ice, is_urban, isoilwater, grid_id, parent_id, i_parent_start, j_parent_start, &
377 i_parent_end, j_parent_end, parent_grid_ratio, sr_x, sr_y, num_land_cat
378 real, intent(out) :: dx, dy, cen_lat, moad_cen_lat, cen_lon, stand_lon, truelat1, truelat2, &
380 real, dimension(16), intent(out) :: corner_lats, corner_lons
381 character (len=128), intent(out) :: title, start_date, grid_type, mminlu
384 integer :: istatus, i
386 character (len=128) :: cunits, cdesc, cstagger
387 integer, dimension(3) :: sr
390 if (my_proc_id == IO_NODE .or. do_tiled_input) then
393 if (io_form_input == BINARY) then
395 do while (istatus == 0)
400 call ext_int_get_var_ti_char(handle, 'units', 'VAR', cunits, istatus)
402 if (istatus == 0) then
403 call ext_int_get_var_ti_char(handle, 'description', 'VAR', cdesc, istatus)
405 if (istatus == 0) then
406 call ext_int_get_var_ti_char(handle, 'stagger', 'VAR', cstagger, istatus)
408 if (istatus == 0) then
409 call ext_int_get_var_ti_integer(handle, 'sr_x', 'VAR', sr(1), 1, sr(3), istatus)
411 if (istatus == 0) then
412 call ext_int_get_var_ti_integer(handle, 'sr_y', 'VAR', sr(2), 1, sr(3), istatus)
415 qd%description = cdesc
416 qd%stagger = cstagger
419 call q_insert(unit_desc, qd)
429 call ext_get_dom_ti_char ('TITLE', title)
430 if (index(title,'GEOGRID V4.0') /= 0) then
432 else if (index(title,'GEOGRID V3.9.1') /= 0) then
434 else if (index(title,'GEOGRID V3.9.0.1') /= 0) then
436 else if (index(title,'GEOGRID V3.9') /= 0) then
438 else if (index(title,'GEOGRID V3.8.1') /= 0) then
440 else if (index(title,'GEOGRID V3.8') /= 0) then
442 else if (index(title,'GEOGRID V3.7.1') /= 0) then
444 else if (index(title,'GEOGRID V3.7') /= 0) then
446 else if (index(title,'GEOGRID V3.6.1') /= 0) then
448 else if (index(title,'GEOGRID V3.6') /= 0) then
450 else if (index(title,'GEOGRID V3.5.1') /= 0) then
452 else if (index(title,'GEOGRID V3.5') /= 0) then
454 else if (index(title,'GEOGRID V3.4.1') /= 0) then
456 else if (index(title,'GEOGRID V3.4') /= 0) then
458 else if (index(title,'GEOGRID V3.3.1') /= 0) then
460 else if (index(title,'GEOGRID V3.3') /= 0) then
462 else if (index(title,'GEOGRID V3.2.1') /= 0) then
464 else if (index(title,'GEOGRID V3.2') /= 0) then
466 else if (index(title,'GEOGRID V3.1.1') /= 0) then
468 else if (index(title,'GEOGRID V3.1') /= 0) then
470 else if (index(title,'GEOGRID V3.0.1') /= 0) then
475 call mprintf(.true.,DEBUG,'Reading static data from WPS version %f', f1=wps_version)
476 call ext_get_dom_ti_char ('SIMULATION_START_DATE', start_date)
477 call ext_get_dom_ti_integer_scalar('WEST-EAST_GRID_DIMENSION', west_east_dim)
478 call ext_get_dom_ti_integer_scalar('SOUTH-NORTH_GRID_DIMENSION', south_north_dim)
479 call ext_get_dom_ti_integer_scalar('BOTTOM-TOP_GRID_DIMENSION', bottom_top_dim)
480 call ext_get_dom_ti_integer_scalar('WEST-EAST_PATCH_START_UNSTAG', we_patch_s)
481 call ext_get_dom_ti_integer_scalar('WEST-EAST_PATCH_END_UNSTAG', we_patch_e)
482 call ext_get_dom_ti_integer_scalar('WEST-EAST_PATCH_START_STAG', we_patch_s_stag)
483 call ext_get_dom_ti_integer_scalar('WEST-EAST_PATCH_END_STAG', we_patch_e_stag)
484 call ext_get_dom_ti_integer_scalar('SOUTH-NORTH_PATCH_START_UNSTAG', sn_patch_s)
485 call ext_get_dom_ti_integer_scalar('SOUTH-NORTH_PATCH_END_UNSTAG', sn_patch_e)
486 call ext_get_dom_ti_integer_scalar('SOUTH-NORTH_PATCH_START_STAG', sn_patch_s_stag)
487 call ext_get_dom_ti_integer_scalar('SOUTH-NORTH_PATCH_END_STAG', sn_patch_e_stag)
488 call ext_get_dom_ti_char ('GRIDTYPE', grid_type)
489 call ext_get_dom_ti_real_scalar ('DX', dx)
490 call ext_get_dom_ti_real_scalar ('DY', dy)
491 call ext_get_dom_ti_integer_scalar('DYN_OPT', dyn_opt)
492 call ext_get_dom_ti_real_scalar ('CEN_LAT', cen_lat)
493 call ext_get_dom_ti_real_scalar ('CEN_LON', cen_lon)
494 call ext_get_dom_ti_real_scalar ('TRUELAT1', truelat1)
495 call ext_get_dom_ti_real_scalar ('TRUELAT2', truelat2)
496 call ext_get_dom_ti_real_scalar ('MOAD_CEN_LAT', moad_cen_lat)
497 call ext_get_dom_ti_real_scalar ('STAND_LON', stand_lon)
498 call ext_get_dom_ti_real_scalar ('POLE_LAT', pole_lat)
499 call ext_get_dom_ti_real_scalar ('POLE_LON', pole_lon)
500 call ext_get_dom_ti_real_vector ('corner_lats', corner_lats, 16)
501 call ext_get_dom_ti_real_vector ('corner_lons', corner_lons, 16)
502 call ext_get_dom_ti_integer_scalar('MAP_PROJ', map_proj)
503 call ext_get_dom_ti_char ('MMINLU', mminlu)
504 if ( wps_version >= 3.01 ) then
505 call ext_get_dom_ti_integer_scalar('NUM_LAND_CAT', num_land_cat)
509 call ext_get_dom_ti_integer_scalar('ISWATER', is_water)
510 if ( wps_version >= 3.01 ) then
511 call ext_get_dom_ti_integer_scalar('ISLAKE', is_lake)
515 call ext_get_dom_ti_integer_scalar('ISICE', is_ice)
516 call ext_get_dom_ti_integer_scalar('ISURBAN', is_urban)
517 call ext_get_dom_ti_integer_scalar('ISOILWATER', isoilwater)
518 call ext_get_dom_ti_integer_scalar('grid_id', grid_id)
519 call ext_get_dom_ti_integer_scalar('parent_id', parent_id)
520 call ext_get_dom_ti_integer_scalar('i_parent_start', i_parent_start)
521 call ext_get_dom_ti_integer_scalar('j_parent_start', j_parent_start)
522 call ext_get_dom_ti_integer_scalar('i_parent_end', i_parent_end)
523 call ext_get_dom_ti_integer_scalar('j_parent_end', j_parent_end)
524 call ext_get_dom_ti_integer_scalar('parent_grid_ratio', parent_grid_ratio)
525 call ext_get_dom_ti_integer_scalar('sr_x', sr_x)
526 call ext_get_dom_ti_integer_scalar('sr_y', sr_y)
531 if (nprocs > 1 .and. .not. do_tiled_input) then
533 call parallel_bcast_char(title, len(title))
534 call parallel_bcast_char(start_date, len(start_date))
535 call parallel_bcast_char(grid_type, len(grid_type))
536 call parallel_bcast_int(west_east_dim)
537 call parallel_bcast_int(south_north_dim)
538 call parallel_bcast_int(bottom_top_dim)
539 call parallel_bcast_int(we_patch_s)
540 call parallel_bcast_int(we_patch_e)
541 call parallel_bcast_int(we_patch_s_stag)
542 call parallel_bcast_int(we_patch_e_stag)
543 call parallel_bcast_int(sn_patch_s)
544 call parallel_bcast_int(sn_patch_e)
545 call parallel_bcast_int(sn_patch_s_stag)
546 call parallel_bcast_int(sn_patch_e_stag)
547 call parallel_bcast_int(sr_x)
548 call parallel_bcast_int(sr_y)
550 ! Must figure out patch dimensions from info in parallel module
551 ! we_patch_s = my_minx
552 ! we_patch_s_stag = my_minx
553 ! we_patch_e = my_maxx - 1
554 ! sn_patch_s = my_miny
555 ! sn_patch_s_stag = my_miny
556 ! sn_patch_e = my_maxy - 1
558 ! if (trim(grid_type) == 'C') then
559 ! if (my_x /= nproc_x - 1) then
560 ! we_patch_e_stag = we_patch_e + 1
562 ! if (my_y /= nproc_y - 1) then
563 ! sn_patch_e_stag = sn_patch_e + 1
565 ! else if (trim(grid_type) == 'E') then
566 ! we_patch_e = we_patch_e + 1
567 ! sn_patch_e = sn_patch_e + 1
568 ! we_patch_e_stag = we_patch_e
569 ! sn_patch_e_stag = sn_patch_e
572 call parallel_bcast_real(dx)
573 call parallel_bcast_real(dy)
574 call parallel_bcast_int(dyn_opt)
575 call parallel_bcast_real(cen_lat)
576 call parallel_bcast_real(cen_lon)
577 call parallel_bcast_real(truelat1)
578 call parallel_bcast_real(truelat2)
579 call parallel_bcast_real(pole_lat)
580 call parallel_bcast_real(pole_lon)
581 call parallel_bcast_real(moad_cen_lat)
582 call parallel_bcast_real(stand_lon)
584 call parallel_bcast_real(corner_lats(i))
585 call parallel_bcast_real(corner_lons(i))
587 call parallel_bcast_int(map_proj)
588 call parallel_bcast_char(mminlu, len(mminlu))
589 call parallel_bcast_int(is_water)
590 call parallel_bcast_int(is_lake)
591 call parallel_bcast_int(is_ice)
592 call parallel_bcast_int(is_urban)
593 call parallel_bcast_int(isoilwater)
594 call parallel_bcast_int(grid_id)
595 call parallel_bcast_int(parent_id)
596 call parallel_bcast_int(i_parent_start)
597 call parallel_bcast_int(i_parent_end)
598 call parallel_bcast_int(j_parent_start)
599 call parallel_bcast_int(j_parent_end)
600 call parallel_bcast_int(parent_grid_ratio)
603 internal_gridtype = grid_type
605 end subroutine read_global_attrs
608 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
609 ! Name: ext_get_dom_ti_integer
611 ! Purpose: Read a domain time-independent integer attribute from input.
612 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
613 subroutine ext_get_dom_ti_integer_scalar(var_name, var_value, suppress_errors)
618 integer, intent(out) :: var_value
619 character (len=*), intent(in) :: var_name
620 logical, intent(in), optional :: suppress_errors
623 integer :: istatus, outcount
626 if (io_form_input == BINARY) then
627 call ext_int_get_dom_ti_integer(handle, trim(var_name), &
629 1, outcount, istatus)
633 if (io_form_input == NETCDF) then
634 call ext_ncd_get_dom_ti_integer(handle, trim(var_name), &
636 1, outcount, istatus)
640 if (io_form_input == GRIB1) then
641 call ext_gr1_get_dom_ti_integer(handle, trim(var_name), &
643 1, outcount, istatus)
647 if (present(suppress_errors)) then
648 call mprintf((istatus /= 0 .and. .not.suppress_errors),ERROR,'Error while reading domain time-independent attribute.')
650 call mprintf((istatus /= 0),ERROR,'Error while reading domain time-independent attribute.')
653 end subroutine ext_get_dom_ti_integer_scalar
656 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
657 ! Name: ext_get_dom_ti_integer
659 ! Purpose: Read a domain time-independent integer attribute from input.
660 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
661 subroutine ext_get_dom_ti_integer_vector(var_name, var_value, n)
666 integer, intent(in) :: n
667 integer, dimension(n), intent(out) :: var_value
668 character (len=*), intent(in) :: var_name
671 integer :: istatus, outcount
674 if (io_form_input == BINARY) then
675 call ext_int_get_dom_ti_integer(handle, trim(var_name), &
677 n, outcount, istatus)
681 if (io_form_input == NETCDF) then
682 call ext_ncd_get_dom_ti_integer(handle, trim(var_name), &
684 n, outcount, istatus)
688 if (io_form_input == GRIB1) then
689 call ext_gr1_get_dom_ti_integer(handle, trim(var_name), &
691 n, outcount, istatus)
695 call mprintf((istatus /= 0),ERROR,'Error while reading domain time-independent attribute.')
697 end subroutine ext_get_dom_ti_integer_vector
700 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
701 ! Name: ext_get_dom_ti_real
703 ! Purpose: Read a domain time-independent real attribute from input.
704 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
705 subroutine ext_get_dom_ti_real_scalar(var_name, var_value)
710 real, intent(out) :: var_value
711 character (len=*), intent(in) :: var_name
714 integer :: istatus, outcount
717 if (io_form_input == BINARY) then
718 call ext_int_get_dom_ti_real(handle, trim(var_name), &
720 1, outcount, istatus)
724 if (io_form_input == NETCDF) then
725 call ext_ncd_get_dom_ti_real(handle, trim(var_name), &
727 1, outcount, istatus)
731 if (io_form_input == GRIB1) then
732 call ext_gr1_get_dom_ti_real(handle, trim(var_name), &
734 1, outcount, istatus)
738 call mprintf((istatus /= 0),ERROR,'Error while reading domain time-independent attribute.')
740 end subroutine ext_get_dom_ti_real_scalar
743 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
744 ! Name: ext_get_dom_ti_real
746 ! Purpose: Read a domain time-independent real attribute from input.
747 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
748 subroutine ext_get_dom_ti_real_vector(var_name, var_value, n)
753 integer, intent(in) :: n
754 real, dimension(n), intent(out) :: var_value
755 character (len=*), intent(in) :: var_name
758 integer :: istatus, outcount
761 if (io_form_input == BINARY) then
762 call ext_int_get_dom_ti_real(handle, trim(var_name), &
764 n, outcount, istatus)
768 if (io_form_input == NETCDF) then
769 call ext_ncd_get_dom_ti_real(handle, trim(var_name), &
771 n, outcount, istatus)
775 if (io_form_input == GRIB1) then
776 call ext_gr1_get_dom_ti_real(handle, trim(var_name), &
778 n, outcount, istatus)
782 call mprintf((istatus /= 0),ERROR,'Error while reading domain time-independent attribute.')
784 end subroutine ext_get_dom_ti_real_vector
787 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
788 ! Name: ext_get_dom_ti_char
790 ! Purpose: Read a domain time-independent character attribute from input.
791 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
792 subroutine ext_get_dom_ti_char(var_name, var_value)
797 character (len=*), intent(in) :: var_name
798 character (len=128), intent(out) :: var_value
804 if (io_form_input == BINARY) then
805 call ext_int_get_dom_ti_char(handle, trim(var_name), &
811 if (io_form_input == NETCDF) then
812 call ext_ncd_get_dom_ti_char(handle, trim(var_name), &
818 if (io_form_input == GRIB1) then
819 call ext_gr1_get_dom_ti_char(handle, trim(var_name), &
825 call mprintf((istatus /= 0),ERROR,'Error in reading domain time-independent attribute')
827 end subroutine ext_get_dom_ti_char
830 subroutine input_close()
838 if (my_proc_id == IO_NODE .or. do_tiled_input) then
840 if (io_form_input == BINARY) then
841 call ext_int_ioclose(handle, istatus)
842 call ext_int_ioexit(istatus)
846 if (io_form_input == NETCDF) then
847 call ext_ncd_ioclose(handle, istatus)
848 call ext_ncd_ioexit(istatus)
852 if (io_form_input == GRIB1) then
853 call ext_gr1_ioclose(handle, istatus)
854 call ext_gr1_ioexit(istatus)
859 call q_destroy(unit_desc)
861 end subroutine input_close
863 end module input_module