30 use sfc_input_data,
only : lsoil_input, &
31 read_fv3_grid_data_netcdf, &
32 landsea_mask_input_grid
34 use utilities,
only : error_handler
39 type(esmf_field),
public :: c_d_input_grid
40 type(esmf_field),
public :: c_0_input_grid
41 type(esmf_field),
public :: d_conv_input_grid
42 type(esmf_field),
public :: dt_cool_input_grid
43 type(esmf_field),
public :: ifd_input_grid
46 type(esmf_field),
public :: qrain_input_grid
47 type(esmf_field),
public :: tref_input_grid
48 type(esmf_field),
public :: w_d_input_grid
49 type(esmf_field),
public :: w_0_input_grid
50 type(esmf_field),
public :: xs_input_grid
51 type(esmf_field),
public :: xt_input_grid
52 type(esmf_field),
public :: xu_input_grid
53 type(esmf_field),
public :: xv_input_grid
54 type(esmf_field),
public :: xz_input_grid
55 type(esmf_field),
public :: xtts_input_grid
56 type(esmf_field),
public :: xzts_input_grid
57 type(esmf_field),
public :: z_c_input_grid
58 type(esmf_field),
public :: zm_input_grid
60 public :: read_input_nst_data
61 public :: cleanup_input_nst_data
68 subroutine read_input_nst_data(localpet)
72 integer,
intent(in) :: localpet
76 print*,
"- READ INPUT GRID NST DATA."
78 print*,
"- CALL FieldCreate FOR INPUT GRID C_D."
79 c_d_input_grid = esmf_fieldcreate(
input_grid, &
80 typekind=esmf_typekind_r8, &
81 staggerloc=esmf_staggerloc_center, rc=rc)
82 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
83 call error_handler(
"IN FieldCreate", rc)
85 print*,
"- CALL FieldCreate FOR INPUT GRID C_0."
86 c_0_input_grid = esmf_fieldcreate(
input_grid, &
87 typekind=esmf_typekind_r8, &
88 staggerloc=esmf_staggerloc_center, rc=rc)
89 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
90 call error_handler(
"IN FieldCreate", rc)
92 print*,
"- CALL FieldCreate FOR INPUT GRID D_CONV."
93 d_conv_input_grid = esmf_fieldcreate(
input_grid, &
94 typekind=esmf_typekind_r8, &
95 staggerloc=esmf_staggerloc_center, rc=rc)
96 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
97 call error_handler(
"IN FieldCreate", rc)
99 print*,
"- CALL FieldCreate FOR INPUT GRID DT_COOL."
100 dt_cool_input_grid = esmf_fieldcreate(
input_grid, &
101 typekind=esmf_typekind_r8, &
102 staggerloc=esmf_staggerloc_center, rc=rc)
103 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
104 call error_handler(
"IN FieldCreate", rc)
106 print*,
"- CALL FieldCreate FOR INPUT GRID IFD."
107 ifd_input_grid = esmf_fieldcreate(
input_grid, &
108 typekind=esmf_typekind_r8, &
109 staggerloc=esmf_staggerloc_center, rc=rc)
110 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
111 call error_handler(
"IN FieldCreate", rc)
113 print*,
"- CALL FieldCreate FOR INPUT GRID QRAIN."
114 qrain_input_grid = esmf_fieldcreate(
input_grid, &
115 typekind=esmf_typekind_r8, &
116 staggerloc=esmf_staggerloc_center, rc=rc)
117 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
118 call error_handler(
"IN FieldCreate", rc)
120 print*,
"- CALL FieldCreate FOR INPUT GRID TREF."
121 tref_input_grid = esmf_fieldcreate(
input_grid, &
122 typekind=esmf_typekind_r8, &
123 staggerloc=esmf_staggerloc_center, rc=rc)
124 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
125 call error_handler(
"IN FieldCreate", rc)
127 print*,
"- CALL FieldCreate FOR INPUT GRID W_D."
128 w_d_input_grid = esmf_fieldcreate(
input_grid, &
129 typekind=esmf_typekind_r8, &
130 staggerloc=esmf_staggerloc_center, rc=rc)
131 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
132 call error_handler(
"IN FieldCreate", rc)
134 print*,
"- CALL FieldCreate FOR INPUT GRID W_0."
135 w_0_input_grid = esmf_fieldcreate(
input_grid, &
136 typekind=esmf_typekind_r8, &
137 staggerloc=esmf_staggerloc_center, rc=rc)
138 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
139 call error_handler(
"IN FieldCreate", rc)
141 print*,
"- CALL FieldCreate FOR INPUT GRID XS."
142 xs_input_grid = esmf_fieldcreate(
input_grid, &
143 typekind=esmf_typekind_r8, &
144 staggerloc=esmf_staggerloc_center, rc=rc)
145 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
146 call error_handler(
"IN FieldCreate", rc)
148 print*,
"- CALL FieldCreate FOR INPUT GRID XT."
149 xt_input_grid = esmf_fieldcreate(
input_grid, &
150 typekind=esmf_typekind_r8, &
151 staggerloc=esmf_staggerloc_center, rc=rc)
152 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
153 call error_handler(
"IN FieldCreate", rc)
155 print*,
"- CALL FieldCreate FOR INPUT GRID XU."
156 xu_input_grid = esmf_fieldcreate(
input_grid, &
157 typekind=esmf_typekind_r8, &
158 staggerloc=esmf_staggerloc_center, rc=rc)
159 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
160 call error_handler(
"IN FieldCreate", rc)
162 print*,
"- CALL FieldCreate FOR INPUT GRID XV."
163 xv_input_grid = esmf_fieldcreate(
input_grid, &
164 typekind=esmf_typekind_r8, &
165 staggerloc=esmf_staggerloc_center, rc=rc)
166 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
167 call error_handler(
"IN FieldCreate", rc)
169 print*,
"- CALL FieldCreate FOR INPUT GRID XZ."
170 xz_input_grid = esmf_fieldcreate(
input_grid, &
171 typekind=esmf_typekind_r8, &
172 staggerloc=esmf_staggerloc_center, rc=rc)
173 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
174 call error_handler(
"IN FieldCreate", rc)
176 print*,
"- CALL FieldCreate FOR INPUT GRID XTTS."
177 xtts_input_grid = esmf_fieldcreate(
input_grid, &
178 typekind=esmf_typekind_r8, &
179 staggerloc=esmf_staggerloc_center, rc=rc)
180 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
181 call error_handler(
"IN FieldCreate", rc)
183 print*,
"- CALL FieldCreate FOR INPUT GRID XZTS."
184 xzts_input_grid = esmf_fieldcreate(
input_grid, &
185 typekind=esmf_typekind_r8, &
186 staggerloc=esmf_staggerloc_center, rc=rc)
187 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
188 call error_handler(
"IN FieldCreate", rc)
190 print*,
"- CALL FieldCreate FOR INPUT GRID Z_C."
191 z_c_input_grid = esmf_fieldcreate(
input_grid, &
192 typekind=esmf_typekind_r8, &
193 staggerloc=esmf_staggerloc_center, rc=rc)
194 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
195 call error_handler(
"IN FieldCreate", rc)
197 print*,
"- CALL FieldCreate FOR INPUT GRID ZM."
198 zm_input_grid = esmf_fieldcreate(
input_grid, &
199 typekind=esmf_typekind_r8, &
200 staggerloc=esmf_staggerloc_center, rc=rc)
201 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
202 call error_handler(
"IN FieldCreate", rc)
212 call read_input_nst_nemsio_file(localpet)
221 call read_input_nst_netcdf_file(localpet)
226 call read_input_nst_netcdf_file(localpet)
230 end subroutine read_input_nst_data
237 subroutine read_input_nst_netcdf_file(localpet)
241 integer,
intent(in) :: localpet
243 character(len=10) :: field
247 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
249 if (localpet == 0)
then
252 allocate(data_one_tile(0,0))
259 if (localpet == 0)
then
265 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
266 lsoil_input, sfcdata=data_one_tile)
269 print*,
"- CALL FieldScatter FOR INPUT C_D"
270 call esmf_fieldscatter(c_d_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
271 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
272 call error_handler(
"IN FieldScatter", rc)
276 if (localpet == 0)
then
282 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
283 lsoil_input, sfcdata=data_one_tile)
286 print*,
"- CALL FieldScatter FOR INPUT C_0"
287 call esmf_fieldscatter(c_0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
288 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
289 call error_handler(
"IN FieldScatter", rc)
293 if (localpet == 0)
then
299 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
300 lsoil_input, sfcdata=data_one_tile)
303 print*,
"- CALL FieldScatter FOR INPUT D_CONV."
304 call esmf_fieldscatter(d_conv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
305 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
306 call error_handler(
"IN FieldScatter", rc)
310 if (localpet == 0)
then
316 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
317 lsoil_input, sfcdata=data_one_tile)
320 print*,
"- CALL FieldScatter FOR INPUT DT_COOL."
321 call esmf_fieldscatter(dt_cool_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
322 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
323 call error_handler(
"IN FieldScatter", rc)
327 if (localpet == 0)
then
331 print*,
"- CALL FieldScatter FOR INPUT IFD."
332 call esmf_fieldscatter(ifd_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
333 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
334 call error_handler(
"IN FieldScatter", rc)
338 if (localpet == 0)
then
340 lsoil_input, sfcdata=data_one_tile)
343 print*,
"- CALL FieldScatter FOR INPUT QRAIN."
344 call esmf_fieldscatter(qrain_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
345 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
346 call error_handler(
"IN FieldScatter", rc)
350 if (localpet == 0)
then
352 lsoil_input, sfcdata=data_one_tile)
355 print*,
"- CALL FieldScatter FOR INPUT TREF"
356 call esmf_fieldscatter(tref_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
357 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
358 call error_handler(
"IN FieldScatter", rc)
362 if (localpet == 0)
then
368 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
369 lsoil_input, sfcdata=data_one_tile)
372 print*,
"- CALL FieldScatter FOR INPUT W_D"
373 call esmf_fieldscatter(w_d_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
374 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
375 call error_handler(
"IN FieldScatter", rc)
379 if (localpet == 0)
then
385 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
386 lsoil_input, sfcdata=data_one_tile)
389 print*,
"- CALL FieldScatter FOR INPUT W_0"
390 call esmf_fieldscatter(w_0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
391 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
392 call error_handler(
"IN FieldScatter", rc)
396 if (localpet == 0)
then
398 lsoil_input, sfcdata=data_one_tile)
401 print*,
"- CALL FieldScatter FOR INPUT XS"
402 call esmf_fieldscatter(xs_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
403 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
404 call error_handler(
"IN FieldScatter", rc)
408 if (localpet == 0)
then
410 lsoil_input, sfcdata=data_one_tile)
413 print*,
"- CALL FieldScatter FOR INPUT XT"
414 call esmf_fieldscatter(xt_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
415 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
416 call error_handler(
"IN FieldScatter", rc)
420 if (localpet == 0)
then
422 lsoil_input, sfcdata=data_one_tile)
425 print*,
"- CALL FieldScatter FOR INPUT XU"
426 call esmf_fieldscatter(xu_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
427 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
428 call error_handler(
"IN FieldScatter", rc)
432 if (localpet == 0)
then
434 lsoil_input, sfcdata=data_one_tile)
437 print*,
"- CALL FieldScatter FOR INPUT XV"
438 call esmf_fieldscatter(xv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
439 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
440 call error_handler(
"IN FieldScatter", rc)
444 if (localpet == 0)
then
446 lsoil_input, sfcdata=data_one_tile)
449 print*,
"- CALL FieldScatter FOR INPUT XZ"
450 call esmf_fieldscatter(xz_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
451 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
452 call error_handler(
"IN FieldScatter", rc)
456 if (localpet == 0)
then
458 lsoil_input, sfcdata=data_one_tile)
461 print*,
"- CALL FieldScatter FOR INPUT XTTS"
462 call esmf_fieldscatter(xtts_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
463 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
464 call error_handler(
"IN FieldScatter", rc)
468 if (localpet == 0)
then
470 lsoil_input, sfcdata=data_one_tile)
473 print*,
"- CALL FieldScatter FOR INPUT XZTS"
474 call esmf_fieldscatter(xzts_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
475 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
476 call error_handler(
"IN FieldScatter", rc)
480 if (localpet == 0)
then
486 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
487 lsoil_input, sfcdata=data_one_tile)
490 print*,
"- CALL FieldScatter FOR INPUT Z_C"
491 call esmf_fieldscatter(z_c_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
492 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
493 call error_handler(
"IN FieldScatter", rc)
497 if (localpet == 0)
then
501 print*,
"- CALL FieldScatter FOR INPUT ZM"
502 call esmf_fieldscatter(zm_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
503 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
504 call error_handler(
"IN FieldScatter", rc)
508 deallocate(data_one_tile)
510 end subroutine read_input_nst_netcdf_file
523 subroutine read_input_nst_nemsio_file(localpet)
527 integer,
intent(in) :: localpet
529 character(len=300) :: the_file
533 real(nemsio_realkind),
allocatable :: dummy(:)
534 real(esmf_kind_r8),
allocatable :: dummy2d(:,:)
536 type(nemsio_gfile) :: gfile
538 if (trim(
input_type) ==
"gfs_gaussian_nemsio")
then
545 print*,
"- READ NST DATA FROM: ", trim(the_file)
547 if (localpet == 0)
then
550 call nemsio_open(gfile, the_file,
"read", iret=rc)
553 allocate(dummy2d(0,0))
556 if (localpet == 0)
then
558 call nemsio_readrecv(gfile,
"tref",
"sfc", 1, dummy, 0, iret=rc)
559 if (rc /= 0)
call error_handler(
"READING TREF.", rc)
561 print*,
'tref ',maxval(dummy2d),minval(dummy2d)
564 print*,
"- CALL FieldScatter FOR INPUT TREF."
565 call esmf_fieldscatter(tref_input_grid, dummy2d, rootpet=0, rc=rc)
566 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
567 call error_handler(
"IN FieldScatter", rc)
569 if (localpet == 0)
then
571 call nemsio_readrecv(gfile,
"cd",
"sfc", 1, dummy, 0, iret=rc)
572 if (rc /= 0)
call error_handler(
"READING CD.", rc)
574 print*,
'cd ',maxval(dummy2d),minval(dummy2d)
577 print*,
"- CALL FieldScatter FOR INPUT C_D."
578 call esmf_fieldscatter(c_d_input_grid, dummy2d, rootpet=0, rc=rc)
579 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
580 call error_handler(
"IN FieldScatter", rc)
582 if (localpet == 0)
then
584 call nemsio_readrecv(gfile,
"c0",
"sfc", 1, dummy, 0, iret=rc)
585 if (rc /= 0)
call error_handler(
"READING C0.", rc)
587 print*,
'c0 ',maxval(dummy2d),minval(dummy2d)
590 print*,
"- CALL FieldScatter FOR INPUT C_0."
591 call esmf_fieldscatter(c_0_input_grid, dummy2d, rootpet=0, rc=rc)
592 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
593 call error_handler(
"IN FieldScatter", rc)
595 if (localpet == 0)
then
596 print*,
"- READ DCONV"
597 call nemsio_readrecv(gfile,
"dconv",
"sfc", 1, dummy, 0, iret=rc)
598 if (rc /= 0)
call error_handler(
"READING DCONV.", rc)
600 print*,
'dconv ',maxval(dummy2d),minval(dummy2d)
603 print*,
"- CALL FieldScatter FOR INPUT D_CONV."
604 call esmf_fieldscatter(d_conv_input_grid, dummy2d, rootpet=0, rc=rc)
605 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
606 call error_handler(
"IN FieldScatter", rc)
608 if (localpet == 0)
then
609 print*,
"- READ DTCOOL"
610 call nemsio_readrecv(gfile,
"dtcool",
"sfc", 1, dummy, 0, iret=rc)
611 if (rc /= 0)
call error_handler(
"READING DTCOOL.", rc)
613 print*,
'dtcool ',maxval(dummy2d),minval(dummy2d)
616 print*,
"- CALL FieldScatter FOR INPUT DT_COOL."
617 call esmf_fieldscatter(dt_cool_input_grid, dummy2d, rootpet=0, rc=rc)
618 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
619 call error_handler(
"IN FieldScatter", rc)
621 if (localpet == 0)
then
625 print*,
"- CALL FieldScatter FOR INPUT IFD."
626 call esmf_fieldscatter(ifd_input_grid, dummy2d, rootpet=0, rc=rc)
627 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
628 call error_handler(
"IN FieldScatter", rc)
630 if (localpet == 0)
then
631 print*,
"- READ QRAIN"
632 call nemsio_readrecv(gfile,
"qrain",
"sfc", 1, dummy, 0, iret=rc)
633 if (rc /= 0)
call error_handler(
"READING QRAIN.", rc)
635 print*,
'qrain ',maxval(dummy2d),minval(dummy2d)
638 print*,
"- CALL FieldScatter FOR INPUT QRAIN."
639 call esmf_fieldscatter(qrain_input_grid, dummy2d, rootpet=0, rc=rc)
640 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
641 call error_handler(
"IN FieldScatter", rc)
643 if (localpet == 0)
then
645 call nemsio_readrecv(gfile,
"wd",
"sfc", 1, dummy, 0, iret=rc)
646 if (rc /= 0)
call error_handler(
"READING WD.", rc)
648 print*,
'wd ',maxval(dummy2d),minval(dummy2d)
651 print*,
"- CALL FieldScatter FOR INPUT WD."
652 call esmf_fieldscatter(w_d_input_grid, dummy2d, rootpet=0, rc=rc)
653 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
654 call error_handler(
"IN FieldScatter", rc)
656 if (localpet == 0)
then
658 call nemsio_readrecv(gfile,
"w0",
"sfc", 1, dummy, 0, iret=rc)
659 if (rc /= 0)
call error_handler(
"READING W0.", rc)
661 print*,
'w0 ',maxval(dummy2d),minval(dummy2d)
664 print*,
"- CALL FieldScatter FOR INPUT W0."
665 call esmf_fieldscatter(w_0_input_grid, dummy2d, rootpet=0, rc=rc)
666 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
667 call error_handler(
"IN FieldScatter", rc)
669 if (localpet == 0)
then
671 call nemsio_readrecv(gfile,
"xs",
"sfc", 1, dummy, 0, iret=rc)
672 if (rc /= 0)
call error_handler(
"READING XS.", rc)
674 print*,
'xs ',maxval(dummy2d),minval(dummy2d)
677 print*,
"- CALL FieldScatter FOR INPUT XS."
678 call esmf_fieldscatter(xs_input_grid, dummy2d, rootpet=0, rc=rc)
679 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
680 call error_handler(
"IN FieldScatter", rc)
682 if (localpet == 0)
then
684 call nemsio_readrecv(gfile,
"xt",
"sfc", 1, dummy, 0, iret=rc)
685 if (rc /= 0)
call error_handler(
"READING XT.", rc)
687 print*,
'xt ',maxval(dummy2d),minval(dummy2d)
690 print*,
"- CALL FieldScatter FOR INPUT XT."
691 call esmf_fieldscatter(xt_input_grid, dummy2d, rootpet=0, rc=rc)
692 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
693 call error_handler(
"IN FieldScatter", rc)
695 if (localpet == 0)
then
697 call nemsio_readrecv(gfile,
"xu",
"sfc", 1, dummy, 0, iret=rc)
698 if (rc /= 0)
call error_handler(
"READING XU.", rc)
700 print*,
'xu ',maxval(dummy2d),minval(dummy2d)
703 print*,
"- CALL FieldScatter FOR INPUT XU."
704 call esmf_fieldscatter(xu_input_grid, dummy2d, rootpet=0, rc=rc)
705 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
706 call error_handler(
"IN FieldScatter", rc)
708 if (localpet == 0)
then
710 call nemsio_readrecv(gfile,
"xv",
"sfc", 1, dummy, 0, iret=rc)
711 if (rc /= 0)
call error_handler(
"READING XV.", rc)
713 print*,
'xv ',maxval(dummy2d),minval(dummy2d)
716 print*,
"- CALL FieldScatter FOR INPUT XV."
717 call esmf_fieldscatter(xv_input_grid, dummy2d, rootpet=0, rc=rc)
718 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
719 call error_handler(
"IN FieldScatter", rc)
721 if (localpet == 0)
then
723 call nemsio_readrecv(gfile,
"xz",
"sfc", 1, dummy, 0, iret=rc)
724 if (rc /= 0)
call error_handler(
"READING XZ.", rc)
726 print*,
'xz ',maxval(dummy2d),minval(dummy2d)
729 print*,
"- CALL FieldScatter FOR INPUT XZ."
730 call esmf_fieldscatter(xz_input_grid, dummy2d, rootpet=0, rc=rc)
731 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
732 call error_handler(
"IN FieldScatter", rc)
734 if (localpet == 0)
then
736 call nemsio_readrecv(gfile,
"xtts",
"sfc", 1, dummy, 0, iret=rc)
737 if (rc /= 0)
call error_handler(
"READING XTTS.", rc)
739 print*,
'xtts ',maxval(dummy2d),minval(dummy2d)
742 print*,
"- CALL FieldScatter FOR INPUT XTTS."
743 call esmf_fieldscatter(xtts_input_grid, dummy2d, rootpet=0, rc=rc)
744 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
745 call error_handler(
"IN FieldScatter", rc)
747 if (localpet == 0)
then
749 call nemsio_readrecv(gfile,
"xzts",
"sfc", 1, dummy, 0, iret=rc)
750 if (rc /= 0)
call error_handler(
"READING XZTS.", rc)
752 print*,
'xzts ',maxval(dummy2d),minval(dummy2d)
755 print*,
"- CALL FieldScatter FOR INPUT XZTS."
756 call esmf_fieldscatter(xzts_input_grid, dummy2d, rootpet=0, rc=rc)
757 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
758 call error_handler(
"IN FieldScatter", rc)
760 if (localpet == 0)
then
762 call nemsio_readrecv(gfile,
"zc",
"sfc", 1, dummy, 0, iret=rc)
763 if (rc /= 0)
call error_handler(
"READING ZC.", rc)
765 print*,
'zc ',maxval(dummy2d),minval(dummy2d)
768 print*,
"- CALL FieldScatter FOR INPUT Z_C."
769 call esmf_fieldscatter(z_c_input_grid, dummy2d, rootpet=0, rc=rc)
770 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
771 call error_handler(
"IN FieldScatter", rc)
773 if (localpet == 0)
then
777 print*,
"- CALL FieldScatter FOR INPUT ZM."
778 call esmf_fieldscatter(zm_input_grid, dummy2d, rootpet=0, rc=rc)
779 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
780 call error_handler(
"IN FieldScatter", rc)
782 deallocate(dummy, dummy2d)
784 if (localpet == 0)
call nemsio_close(gfile)
786 end subroutine read_input_nst_nemsio_file
793 subroutine cleanup_input_nst_data
799 print*,
'- DESTROY NST INPUT DATA.'
801 call esmf_fielddestroy(landsea_mask_input_grid, rc=rc)
802 call esmf_fielddestroy(c_d_input_grid, rc=rc)
803 call esmf_fielddestroy(c_0_input_grid, rc=rc)
804 call esmf_fielddestroy(d_conv_input_grid, rc=rc)
805 call esmf_fielddestroy(dt_cool_input_grid, rc=rc)
806 call esmf_fielddestroy(ifd_input_grid, rc=rc)
807 call esmf_fielddestroy(qrain_input_grid, rc=rc)
808 call esmf_fielddestroy(tref_input_grid, rc=rc)
809 call esmf_fielddestroy(w_d_input_grid, rc=rc)
810 call esmf_fielddestroy(w_0_input_grid, rc=rc)
811 call esmf_fielddestroy(xs_input_grid, rc=rc)
812 call esmf_fielddestroy(xt_input_grid, rc=rc)
813 call esmf_fielddestroy(xu_input_grid, rc=rc)
814 call esmf_fielddestroy(xv_input_grid, rc=rc)
815 call esmf_fielddestroy(xz_input_grid, rc=rc)
816 call esmf_fielddestroy(xtts_input_grid, rc=rc)
817 call esmf_fielddestroy(xzts_input_grid, rc=rc)
818 call esmf_fielddestroy(z_c_input_grid, rc=rc)
819 call esmf_fielddestroy(zm_input_grid, rc=rc)
821 end subroutine cleanup_input_nst_data
823 end module nst_input_data
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
type(esmf_grid), public input_grid
input grid esmf grid object
integer, public i_input
i-dimension of input grid (or of each global tile)
integer, public num_tiles_input_grid
Number of tiles, input grid.
integer, public j_input
j-dimension of input grid (or of each global tile)
This module contains code to read the setup namelist file, handle the varmap file for GRIB2 data,...
character(len=500), dimension(6), public sfc_files_input_grid
File names containing input surface data.
character(len=500), public nst_files_input_grid
File name of input nst data.
character(len=500), public data_dir_input_grid
Directory containing input atm or sfc files.
character(len=25), public input_type
Input data type: