29 use sfc_input_data,
only : lsoil_input, &
30 read_fv3_grid_data_netcdf, &
31 landsea_mask_input_grid
33 use utilities,
only : error_handler
38 type(esmf_field),
public :: c_d_input_grid
39 type(esmf_field),
public :: c_0_input_grid
40 type(esmf_field),
public :: d_conv_input_grid
41 type(esmf_field),
public :: dt_cool_input_grid
42 type(esmf_field),
public :: ifd_input_grid
45 type(esmf_field),
public :: qrain_input_grid
46 type(esmf_field),
public :: tref_input_grid
47 type(esmf_field),
public :: w_d_input_grid
48 type(esmf_field),
public :: w_0_input_grid
49 type(esmf_field),
public :: xs_input_grid
50 type(esmf_field),
public :: xt_input_grid
51 type(esmf_field),
public :: xu_input_grid
52 type(esmf_field),
public :: xv_input_grid
53 type(esmf_field),
public :: xz_input_grid
54 type(esmf_field),
public :: xtts_input_grid
55 type(esmf_field),
public :: xzts_input_grid
56 type(esmf_field),
public :: z_c_input_grid
57 type(esmf_field),
public :: zm_input_grid
59 public :: read_input_nst_data
60 public :: cleanup_input_nst_data
67 subroutine read_input_nst_data(localpet)
71 integer,
intent(in) :: localpet
75 print*,
"- READ INPUT GRID NST DATA." 77 print*,
"- CALL FieldCreate FOR INPUT GRID C_D." 78 c_d_input_grid = esmf_fieldcreate(
input_grid, &
79 typekind=esmf_typekind_r8, &
80 staggerloc=esmf_staggerloc_center, rc=rc)
81 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
82 call error_handler(
"IN FieldCreate", rc)
84 print*,
"- CALL FieldCreate FOR INPUT GRID C_0." 85 c_0_input_grid = esmf_fieldcreate(
input_grid, &
86 typekind=esmf_typekind_r8, &
87 staggerloc=esmf_staggerloc_center, rc=rc)
88 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
89 call error_handler(
"IN FieldCreate", rc)
91 print*,
"- CALL FieldCreate FOR INPUT GRID D_CONV." 92 d_conv_input_grid = esmf_fieldcreate(
input_grid, &
93 typekind=esmf_typekind_r8, &
94 staggerloc=esmf_staggerloc_center, rc=rc)
95 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
96 call error_handler(
"IN FieldCreate", rc)
98 print*,
"- CALL FieldCreate FOR INPUT GRID DT_COOL." 99 dt_cool_input_grid = esmf_fieldcreate(
input_grid, &
100 typekind=esmf_typekind_r8, &
101 staggerloc=esmf_staggerloc_center, rc=rc)
102 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
103 call error_handler(
"IN FieldCreate", rc)
105 print*,
"- CALL FieldCreate FOR INPUT GRID IFD." 106 ifd_input_grid = esmf_fieldcreate(
input_grid, &
107 typekind=esmf_typekind_r8, &
108 staggerloc=esmf_staggerloc_center, rc=rc)
109 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
110 call error_handler(
"IN FieldCreate", rc)
112 print*,
"- CALL FieldCreate FOR INPUT GRID QRAIN." 113 qrain_input_grid = esmf_fieldcreate(
input_grid, &
114 typekind=esmf_typekind_r8, &
115 staggerloc=esmf_staggerloc_center, rc=rc)
116 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
117 call error_handler(
"IN FieldCreate", rc)
119 print*,
"- CALL FieldCreate FOR INPUT GRID TREF." 120 tref_input_grid = esmf_fieldcreate(
input_grid, &
121 typekind=esmf_typekind_r8, &
122 staggerloc=esmf_staggerloc_center, rc=rc)
123 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
124 call error_handler(
"IN FieldCreate", rc)
126 print*,
"- CALL FieldCreate FOR INPUT GRID W_D." 127 w_d_input_grid = esmf_fieldcreate(
input_grid, &
128 typekind=esmf_typekind_r8, &
129 staggerloc=esmf_staggerloc_center, rc=rc)
130 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
131 call error_handler(
"IN FieldCreate", rc)
133 print*,
"- CALL FieldCreate FOR INPUT GRID W_0." 134 w_0_input_grid = esmf_fieldcreate(
input_grid, &
135 typekind=esmf_typekind_r8, &
136 staggerloc=esmf_staggerloc_center, rc=rc)
137 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
138 call error_handler(
"IN FieldCreate", rc)
140 print*,
"- CALL FieldCreate FOR INPUT GRID XS." 141 xs_input_grid = esmf_fieldcreate(
input_grid, &
142 typekind=esmf_typekind_r8, &
143 staggerloc=esmf_staggerloc_center, rc=rc)
144 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
145 call error_handler(
"IN FieldCreate", rc)
147 print*,
"- CALL FieldCreate FOR INPUT GRID XT." 148 xt_input_grid = esmf_fieldcreate(
input_grid, &
149 typekind=esmf_typekind_r8, &
150 staggerloc=esmf_staggerloc_center, rc=rc)
151 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
152 call error_handler(
"IN FieldCreate", rc)
154 print*,
"- CALL FieldCreate FOR INPUT GRID XU." 155 xu_input_grid = esmf_fieldcreate(
input_grid, &
156 typekind=esmf_typekind_r8, &
157 staggerloc=esmf_staggerloc_center, rc=rc)
158 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
159 call error_handler(
"IN FieldCreate", rc)
161 print*,
"- CALL FieldCreate FOR INPUT GRID XV." 162 xv_input_grid = esmf_fieldcreate(
input_grid, &
163 typekind=esmf_typekind_r8, &
164 staggerloc=esmf_staggerloc_center, rc=rc)
165 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
166 call error_handler(
"IN FieldCreate", rc)
168 print*,
"- CALL FieldCreate FOR INPUT GRID XZ." 169 xz_input_grid = esmf_fieldcreate(
input_grid, &
170 typekind=esmf_typekind_r8, &
171 staggerloc=esmf_staggerloc_center, rc=rc)
172 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
173 call error_handler(
"IN FieldCreate", rc)
175 print*,
"- CALL FieldCreate FOR INPUT GRID XTTS." 176 xtts_input_grid = esmf_fieldcreate(
input_grid, &
177 typekind=esmf_typekind_r8, &
178 staggerloc=esmf_staggerloc_center, rc=rc)
179 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
180 call error_handler(
"IN FieldCreate", rc)
182 print*,
"- CALL FieldCreate FOR INPUT GRID XZTS." 183 xzts_input_grid = esmf_fieldcreate(
input_grid, &
184 typekind=esmf_typekind_r8, &
185 staggerloc=esmf_staggerloc_center, rc=rc)
186 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
187 call error_handler(
"IN FieldCreate", rc)
189 print*,
"- CALL FieldCreate FOR INPUT GRID Z_C." 190 z_c_input_grid = esmf_fieldcreate(
input_grid, &
191 typekind=esmf_typekind_r8, &
192 staggerloc=esmf_staggerloc_center, rc=rc)
193 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
194 call error_handler(
"IN FieldCreate", rc)
196 print*,
"- CALL FieldCreate FOR INPUT GRID ZM." 197 zm_input_grid = esmf_fieldcreate(
input_grid, &
198 typekind=esmf_typekind_r8, &
199 staggerloc=esmf_staggerloc_center, rc=rc)
200 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
201 call error_handler(
"IN FieldCreate", rc)
210 call read_input_nst_nemsio_file(localpet)
219 call read_input_nst_netcdf_file(localpet)
223 end subroutine read_input_nst_data
230 subroutine read_input_nst_netcdf_file(localpet)
234 integer,
intent(in) :: localpet
236 character(len=10) :: field
240 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
242 if (localpet == 0)
then 245 allocate(data_one_tile(0,0))
252 if (localpet == 0)
then 258 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
259 lsoil_input, sfcdata=data_one_tile)
262 print*,
"- CALL FieldScatter FOR INPUT C_D" 263 call esmf_fieldscatter(c_d_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
264 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
265 call error_handler(
"IN FieldScatter", rc)
269 if (localpet == 0)
then 275 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
276 lsoil_input, sfcdata=data_one_tile)
279 print*,
"- CALL FieldScatter FOR INPUT C_0" 280 call esmf_fieldscatter(c_0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
281 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
282 call error_handler(
"IN FieldScatter", rc)
286 if (localpet == 0)
then 292 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
293 lsoil_input, sfcdata=data_one_tile)
296 print*,
"- CALL FieldScatter FOR INPUT D_CONV." 297 call esmf_fieldscatter(d_conv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
298 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
299 call error_handler(
"IN FieldScatter", rc)
303 if (localpet == 0)
then 309 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
310 lsoil_input, sfcdata=data_one_tile)
313 print*,
"- CALL FieldScatter FOR INPUT DT_COOL." 314 call esmf_fieldscatter(dt_cool_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
315 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
316 call error_handler(
"IN FieldScatter", rc)
320 if (localpet == 0)
then 324 print*,
"- CALL FieldScatter FOR INPUT IFD." 325 call esmf_fieldscatter(ifd_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
326 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
327 call error_handler(
"IN FieldScatter", rc)
331 if (localpet == 0)
then 333 lsoil_input, sfcdata=data_one_tile)
336 print*,
"- CALL FieldScatter FOR INPUT QRAIN." 337 call esmf_fieldscatter(qrain_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
338 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
339 call error_handler(
"IN FieldScatter", rc)
343 if (localpet == 0)
then 345 lsoil_input, sfcdata=data_one_tile)
348 print*,
"- CALL FieldScatter FOR INPUT TREF" 349 call esmf_fieldscatter(tref_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
350 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
351 call error_handler(
"IN FieldScatter", rc)
355 if (localpet == 0)
then 361 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
362 lsoil_input, sfcdata=data_one_tile)
365 print*,
"- CALL FieldScatter FOR INPUT W_D" 366 call esmf_fieldscatter(w_d_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
367 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
368 call error_handler(
"IN FieldScatter", rc)
372 if (localpet == 0)
then 378 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
379 lsoil_input, sfcdata=data_one_tile)
382 print*,
"- CALL FieldScatter FOR INPUT W_0" 383 call esmf_fieldscatter(w_0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
384 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
385 call error_handler(
"IN FieldScatter", rc)
389 if (localpet == 0)
then 391 lsoil_input, sfcdata=data_one_tile)
394 print*,
"- CALL FieldScatter FOR INPUT XS" 395 call esmf_fieldscatter(xs_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
396 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
397 call error_handler(
"IN FieldScatter", rc)
401 if (localpet == 0)
then 403 lsoil_input, sfcdata=data_one_tile)
406 print*,
"- CALL FieldScatter FOR INPUT XT" 407 call esmf_fieldscatter(xt_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
408 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
409 call error_handler(
"IN FieldScatter", rc)
413 if (localpet == 0)
then 415 lsoil_input, sfcdata=data_one_tile)
418 print*,
"- CALL FieldScatter FOR INPUT XU" 419 call esmf_fieldscatter(xu_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
420 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
421 call error_handler(
"IN FieldScatter", rc)
425 if (localpet == 0)
then 427 lsoil_input, sfcdata=data_one_tile)
430 print*,
"- CALL FieldScatter FOR INPUT XV" 431 call esmf_fieldscatter(xv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
432 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
433 call error_handler(
"IN FieldScatter", rc)
437 if (localpet == 0)
then 439 lsoil_input, sfcdata=data_one_tile)
442 print*,
"- CALL FieldScatter FOR INPUT XZ" 443 call esmf_fieldscatter(xz_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
444 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
445 call error_handler(
"IN FieldScatter", rc)
449 if (localpet == 0)
then 451 lsoil_input, sfcdata=data_one_tile)
454 print*,
"- CALL FieldScatter FOR INPUT XTTS" 455 call esmf_fieldscatter(xtts_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
456 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
457 call error_handler(
"IN FieldScatter", rc)
461 if (localpet == 0)
then 463 lsoil_input, sfcdata=data_one_tile)
466 print*,
"- CALL FieldScatter FOR INPUT XZTS" 467 call esmf_fieldscatter(xzts_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
468 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
469 call error_handler(
"IN FieldScatter", rc)
473 if (localpet == 0)
then 479 call read_fv3_grid_data_netcdf(trim(field), tile,
i_input,
j_input, &
480 lsoil_input, sfcdata=data_one_tile)
483 print*,
"- CALL FieldScatter FOR INPUT Z_C" 484 call esmf_fieldscatter(z_c_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
485 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
486 call error_handler(
"IN FieldScatter", rc)
490 if (localpet == 0)
then 494 print*,
"- CALL FieldScatter FOR INPUT ZM" 495 call esmf_fieldscatter(zm_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
496 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
497 call error_handler(
"IN FieldScatter", rc)
501 deallocate(data_one_tile)
503 end subroutine read_input_nst_netcdf_file
514 subroutine read_input_nst_nemsio_file(localpet)
518 integer,
intent(in) :: localpet
520 character(len=300) :: the_file
524 real(nemsio_realkind),
allocatable :: dummy(:)
525 real(esmf_kind_r8),
allocatable :: dummy2d(:,:)
527 type(nemsio_gfile) :: gfile
529 if (trim(
input_type) ==
"gfs_gaussian_nemsio")
then 536 print*,
"- READ NST DATA FROM: ", trim(the_file)
538 if (localpet == 0)
then 541 call nemsio_open(gfile, the_file,
"read", iret=rc)
544 allocate(dummy2d(0,0))
547 if (localpet == 0)
then 549 call nemsio_readrecv(gfile,
"tref",
"sfc", 1, dummy, 0, iret=rc)
550 if (rc /= 0)
call error_handler(
"READING TREF.", rc)
552 print*,
'tref ',maxval(dummy2d),minval(dummy2d)
555 print*,
"- CALL FieldScatter FOR INPUT TREF." 556 call esmf_fieldscatter(tref_input_grid, dummy2d, rootpet=0, rc=rc)
557 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
558 call error_handler(
"IN FieldScatter", rc)
560 if (localpet == 0)
then 562 call nemsio_readrecv(gfile,
"cd",
"sfc", 1, dummy, 0, iret=rc)
563 if (rc /= 0)
call error_handler(
"READING CD.", rc)
565 print*,
'cd ',maxval(dummy2d),minval(dummy2d)
568 print*,
"- CALL FieldScatter FOR INPUT C_D." 569 call esmf_fieldscatter(c_d_input_grid, dummy2d, rootpet=0, rc=rc)
570 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
571 call error_handler(
"IN FieldScatter", rc)
573 if (localpet == 0)
then 575 call nemsio_readrecv(gfile,
"c0",
"sfc", 1, dummy, 0, iret=rc)
576 if (rc /= 0)
call error_handler(
"READING C0.", rc)
578 print*,
'c0 ',maxval(dummy2d),minval(dummy2d)
581 print*,
"- CALL FieldScatter FOR INPUT C_0." 582 call esmf_fieldscatter(c_0_input_grid, dummy2d, rootpet=0, rc=rc)
583 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
584 call error_handler(
"IN FieldScatter", rc)
586 if (localpet == 0)
then 587 print*,
"- READ DCONV" 588 call nemsio_readrecv(gfile,
"dconv",
"sfc", 1, dummy, 0, iret=rc)
589 if (rc /= 0)
call error_handler(
"READING DCONV.", rc)
591 print*,
'dconv ',maxval(dummy2d),minval(dummy2d)
594 print*,
"- CALL FieldScatter FOR INPUT D_CONV." 595 call esmf_fieldscatter(d_conv_input_grid, dummy2d, rootpet=0, rc=rc)
596 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
597 call error_handler(
"IN FieldScatter", rc)
599 if (localpet == 0)
then 600 print*,
"- READ DTCOOL" 601 call nemsio_readrecv(gfile,
"dtcool",
"sfc", 1, dummy, 0, iret=rc)
602 if (rc /= 0)
call error_handler(
"READING DTCOOL.", rc)
604 print*,
'dtcool ',maxval(dummy2d),minval(dummy2d)
607 print*,
"- CALL FieldScatter FOR INPUT DT_COOL." 608 call esmf_fieldscatter(dt_cool_input_grid, dummy2d, rootpet=0, rc=rc)
609 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
610 call error_handler(
"IN FieldScatter", rc)
612 if (localpet == 0)
then 616 print*,
"- CALL FieldScatter FOR INPUT IFD." 617 call esmf_fieldscatter(ifd_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 622 print*,
"- READ QRAIN" 623 call nemsio_readrecv(gfile,
"qrain",
"sfc", 1, dummy, 0, iret=rc)
624 if (rc /= 0)
call error_handler(
"READING QRAIN.", rc)
626 print*,
'qrain ',maxval(dummy2d),minval(dummy2d)
629 print*,
"- CALL FieldScatter FOR INPUT QRAIN." 630 call esmf_fieldscatter(qrain_input_grid, dummy2d, rootpet=0, rc=rc)
631 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
632 call error_handler(
"IN FieldScatter", rc)
634 if (localpet == 0)
then 636 call nemsio_readrecv(gfile,
"wd",
"sfc", 1, dummy, 0, iret=rc)
637 if (rc /= 0)
call error_handler(
"READING WD.", rc)
639 print*,
'wd ',maxval(dummy2d),minval(dummy2d)
642 print*,
"- CALL FieldScatter FOR INPUT WD." 643 call esmf_fieldscatter(w_d_input_grid, dummy2d, rootpet=0, rc=rc)
644 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
645 call error_handler(
"IN FieldScatter", rc)
647 if (localpet == 0)
then 649 call nemsio_readrecv(gfile,
"w0",
"sfc", 1, dummy, 0, iret=rc)
650 if (rc /= 0)
call error_handler(
"READING W0.", rc)
652 print*,
'w0 ',maxval(dummy2d),minval(dummy2d)
655 print*,
"- CALL FieldScatter FOR INPUT W0." 656 call esmf_fieldscatter(w_0_input_grid, dummy2d, rootpet=0, rc=rc)
657 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
658 call error_handler(
"IN FieldScatter", rc)
660 if (localpet == 0)
then 662 call nemsio_readrecv(gfile,
"xs",
"sfc", 1, dummy, 0, iret=rc)
663 if (rc /= 0)
call error_handler(
"READING XS.", rc)
665 print*,
'xs ',maxval(dummy2d),minval(dummy2d)
668 print*,
"- CALL FieldScatter FOR INPUT XS." 669 call esmf_fieldscatter(xs_input_grid, dummy2d, rootpet=0, rc=rc)
670 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
671 call error_handler(
"IN FieldScatter", rc)
673 if (localpet == 0)
then 675 call nemsio_readrecv(gfile,
"xt",
"sfc", 1, dummy, 0, iret=rc)
676 if (rc /= 0)
call error_handler(
"READING XT.", rc)
678 print*,
'xt ',maxval(dummy2d),minval(dummy2d)
681 print*,
"- CALL FieldScatter FOR INPUT XT." 682 call esmf_fieldscatter(xt_input_grid, dummy2d, rootpet=0, rc=rc)
683 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
684 call error_handler(
"IN FieldScatter", rc)
686 if (localpet == 0)
then 688 call nemsio_readrecv(gfile,
"xu",
"sfc", 1, dummy, 0, iret=rc)
689 if (rc /= 0)
call error_handler(
"READING XU.", rc)
691 print*,
'xu ',maxval(dummy2d),minval(dummy2d)
694 print*,
"- CALL FieldScatter FOR INPUT XU." 695 call esmf_fieldscatter(xu_input_grid, dummy2d, rootpet=0, rc=rc)
696 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
697 call error_handler(
"IN FieldScatter", rc)
699 if (localpet == 0)
then 701 call nemsio_readrecv(gfile,
"xv",
"sfc", 1, dummy, 0, iret=rc)
702 if (rc /= 0)
call error_handler(
"READING XV.", rc)
704 print*,
'xv ',maxval(dummy2d),minval(dummy2d)
707 print*,
"- CALL FieldScatter FOR INPUT XV." 708 call esmf_fieldscatter(xv_input_grid, dummy2d, rootpet=0, rc=rc)
709 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
710 call error_handler(
"IN FieldScatter", rc)
712 if (localpet == 0)
then 714 call nemsio_readrecv(gfile,
"xz",
"sfc", 1, dummy, 0, iret=rc)
715 if (rc /= 0)
call error_handler(
"READING XZ.", rc)
717 print*,
'xz ',maxval(dummy2d),minval(dummy2d)
720 print*,
"- CALL FieldScatter FOR INPUT XZ." 721 call esmf_fieldscatter(xz_input_grid, dummy2d, rootpet=0, rc=rc)
722 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
723 call error_handler(
"IN FieldScatter", rc)
725 if (localpet == 0)
then 727 call nemsio_readrecv(gfile,
"xtts",
"sfc", 1, dummy, 0, iret=rc)
728 if (rc /= 0)
call error_handler(
"READING XTTS.", rc)
730 print*,
'xtts ',maxval(dummy2d),minval(dummy2d)
733 print*,
"- CALL FieldScatter FOR INPUT XTTS." 734 call esmf_fieldscatter(xtts_input_grid, dummy2d, rootpet=0, rc=rc)
735 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
736 call error_handler(
"IN FieldScatter", rc)
738 if (localpet == 0)
then 740 call nemsio_readrecv(gfile,
"xzts",
"sfc", 1, dummy, 0, iret=rc)
741 if (rc /= 0)
call error_handler(
"READING XZTS.", rc)
743 print*,
'xzts ',maxval(dummy2d),minval(dummy2d)
746 print*,
"- CALL FieldScatter FOR INPUT XZTS." 747 call esmf_fieldscatter(xzts_input_grid, dummy2d, rootpet=0, rc=rc)
748 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
749 call error_handler(
"IN FieldScatter", rc)
751 if (localpet == 0)
then 753 call nemsio_readrecv(gfile,
"zc",
"sfc", 1, dummy, 0, iret=rc)
754 if (rc /= 0)
call error_handler(
"READING ZC.", rc)
756 print*,
'zc ',maxval(dummy2d),minval(dummy2d)
759 print*,
"- CALL FieldScatter FOR INPUT Z_C." 760 call esmf_fieldscatter(z_c_input_grid, dummy2d, rootpet=0, rc=rc)
761 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
762 call error_handler(
"IN FieldScatter", rc)
764 if (localpet == 0)
then 768 print*,
"- CALL FieldScatter FOR INPUT ZM." 769 call esmf_fieldscatter(zm_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 deallocate(dummy, dummy2d)
775 if (localpet == 0)
call nemsio_close(gfile)
777 end subroutine read_input_nst_nemsio_file
782 subroutine cleanup_input_nst_data
788 print*,
'- DESTROY NST INPUT DATA.' 790 call esmf_fielddestroy(landsea_mask_input_grid, rc=rc)
791 call esmf_fielddestroy(c_d_input_grid, rc=rc)
792 call esmf_fielddestroy(c_0_input_grid, rc=rc)
793 call esmf_fielddestroy(d_conv_input_grid, rc=rc)
794 call esmf_fielddestroy(dt_cool_input_grid, rc=rc)
795 call esmf_fielddestroy(ifd_input_grid, rc=rc)
796 call esmf_fielddestroy(qrain_input_grid, rc=rc)
797 call esmf_fielddestroy(tref_input_grid, rc=rc)
798 call esmf_fielddestroy(w_d_input_grid, rc=rc)
799 call esmf_fielddestroy(w_0_input_grid, rc=rc)
800 call esmf_fielddestroy(xs_input_grid, rc=rc)
801 call esmf_fielddestroy(xt_input_grid, rc=rc)
802 call esmf_fielddestroy(xu_input_grid, rc=rc)
803 call esmf_fielddestroy(xv_input_grid, rc=rc)
804 call esmf_fielddestroy(xz_input_grid, rc=rc)
805 call esmf_fielddestroy(xtts_input_grid, rc=rc)
806 call esmf_fielddestroy(xzts_input_grid, rc=rc)
807 call esmf_fielddestroy(z_c_input_grid, rc=rc)
808 call esmf_fielddestroy(zm_input_grid, rc=rc)
810 end subroutine cleanup_input_nst_data
812 end module nst_input_data
This module contains code to read the setup namelist file, handle the varmap file for GRIB2 data...
character(len=500), public nst_files_input_grid
File name of input nst data.
integer, public ip1_input
i_input plus 1
integer, public j_input
j-dimension of input grid (or of each global tile)
integer, public jp1_input
j_input plus 1
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
integer, public num_tiles_input_grid
Number of tiles, input grid.
type(esmf_grid), public input_grid
input grid esmf grid object
character(len=500), public data_dir_input_grid
Directory containing input atm or sfc files.
character(len=25), public input_type
Input data type:
character(len=500), dimension(6), public sfc_files_input_grid
File names containing input surface data.
integer, public i_input
i-dimension of input grid (or of each global tile)