29 integer,
intent(in) :: localpet
31 character(len=13) :: outfile
33 integer :: fsize=65536, initial = 0
34 integer :: header_buffer_val = 16384
35 integer :: error, ncid, dim_nvcoord
36 integer :: dim_levp1, id_ntrac, id_vcoord
37 integer :: num_tracers_output
39 real(kind=esmf_kind_r8),
allocatable :: tmp(:,:)
41 if (localpet /= 0)
return
43 outfile=
"./gfs_ctrl.nc"
45 print*,
"- WRITE ATMOSPHERIC HEADER FILE: ", trim(outfile)
47 error = nf90_create(outfile, ior(nf90_netcdf4,nf90_classic_model), &
48 ncid, initialsize=initial, chunksize=fsize)
49 call
netcdf_err(error,
'CREATING FILE='//trim(outfile) )
51 error = nf90_def_dim(ncid,
'nvcoord', nvcoord_target, dim_nvcoord)
52 call
netcdf_err(error,
'define dimension nvcoord for file='//trim(outfile) )
54 error = nf90_def_dim(ncid,
'levsp', levp1_target, dim_levp1)
55 call
netcdf_err(error,
'define dimension levsp for file='//trim(outfile) )
57 error = nf90_def_var(ncid,
'ntrac', nf90_int, id_ntrac)
58 call
netcdf_err(error,
'define var ntrac for file='//trim(outfile) )
60 error = nf90_def_var(ncid,
'vcoord', nf90_double, (/dim_levp1, dim_nvcoord/), id_vcoord)
61 call
netcdf_err(error,
'define var vcoord for file='//trim(outfile) )
63 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
64 call
netcdf_err(error,
'end meta define for file='//trim(outfile) )
66 num_tracers_output = num_tracers
67 if (use_thomp_mp_climo) num_tracers_output = num_tracers + 2
68 error = nf90_put_var( ncid, id_ntrac, num_tracers_output)
69 call
netcdf_err(error,
'write var ntrac for file='//trim(outfile) )
71 allocate(tmp(levp1_target, nvcoord_target))
72 tmp(1:levp1_target,:) = vcoord_target(levp1_target:1:-1,:)
74 error = nf90_put_var( ncid, id_vcoord, tmp)
75 call
netcdf_err(error,
'write var vcoord for file='//trim(outfile) )
79 error = nf90_close(ncid)
108 use atmosphere, only : lev_target, levp1_target, &
111 tracers_target_grid, &
118 qnifa_climo_target_grid, &
119 qnwfa_climo_target_grid
121 use model_grid, only : i_target, ip1_target, j_target, jp1_target
124 input_type, tracers, num_tracers, &
129 integer,
intent(in) :: localpet
131 character(len=50) :: name
133 integer :: fsize=65536, initial = 0
134 integer :: header_buffer_val = 16384
135 integer :: ncid, error, tile, i, n
136 integer :: dim_lon, dim_lat
137 integer :: dim_lonp, dim_halo
138 integer :: dim_halop, dim_latm
139 integer :: dim_lev, dim_levp1
140 integer :: j_target2, halo, halo_p1
141 integer :: id_i_bottom, id_j_bottom
142 integer :: id_i_top, id_j_top
143 integer :: id_i_right, id_j_right
144 integer :: id_i_left, id_j_left
145 integer :: id_qnifa_bottom, id_qnifa_top
146 integer :: id_qnifa_right, id_qnifa_left
147 integer :: id_qnwfa_bottom, id_qnwfa_top
148 integer :: id_qnwfa_right, id_qnwfa_left
149 integer :: id_ps_bottom, id_ps_top
150 integer :: id_ps_right, id_ps_left
151 integer :: id_t_bottom, id_t_top
152 integer :: id_t_right, id_t_left
153 integer :: id_w_bottom, id_w_top
154 integer :: id_w_right, id_w_left
155 integer :: id_zh_bottom, id_zh_top
156 integer :: id_zh_right, id_zh_left
157 integer,
allocatable :: id_tracer_bottom(:), id_tracer_top(:)
158 integer,
allocatable :: id_tracer_right(:), id_tracer_left(:)
159 integer :: id_i_w_bottom, id_j_w_bottom
160 integer :: id_i_w_top, id_j_w_top
161 integer :: id_j_w_right, id_i_w_left
162 integer :: id_j_w_left, id_i_w_right
163 integer :: id_u_w_bottom, id_u_w_top
164 integer :: id_u_w_right, id_u_w_left
165 integer :: id_v_w_bottom, id_v_w_top
166 integer :: id_v_w_right, id_v_w_left
167 integer :: id_i_s_bottom, id_j_s_bottom
168 integer :: id_i_s_top, id_j_s_top
169 integer :: id_i_s_right, id_j_s_right
170 integer :: id_i_s_left, id_j_s_left
171 integer :: id_u_s_bottom, id_u_s_top
172 integer :: id_u_s_right, id_u_s_left
173 integer :: id_v_s_bottom, id_v_s_top
174 integer :: id_v_s_right, id_v_s_left
175 integer :: i_start_top, i_end_top
176 integer :: j_start_top, j_end_top
177 integer :: i_start_bottom, i_end_bottom
178 integer :: j_start_bottom, j_end_bottom
179 integer :: i_start_left, i_end_left
180 integer :: j_start_left, j_end_left
181 integer :: i_start_right, i_end_right
182 integer :: j_start_right, j_end_right
183 integer(kind=4),
allocatable :: idum(:)
185 real(kind=4),
allocatable :: dum2d_top(:,:), dum2d_bottom(:,:)
186 real(kind=4),
allocatable :: dum2d_left(:,:), dum2d_right(:,:)
187 real(kind=4),
allocatable :: dum3d_top(:,:,:), dum3d_bottom(:,:,:)
188 real(kind=4),
allocatable :: dum3d_left(:,:,:), dum3d_right(:,:,:)
189 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
190 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
192 print*,
"- OUTPUT LATERAL BOUNDARY DATA."
194 halo = halo_bndy + halo_blend
197 allocate(id_tracer_bottom(num_tracers))
198 allocate(id_tracer_top(num_tracers))
199 allocate(id_tracer_left(num_tracers))
200 allocate(id_tracer_right(num_tracers))
202 if (localpet == 0)
then
205 error = nf90_create(
"./gfs.bndy.nc", ior(nf90_netcdf4,nf90_classic_model), &
206 ncid, initialsize=initial, chunksize=fsize)
209 error = nf90_def_dim(ncid,
'lon', i_target, dim_lon)
210 call
netcdf_err(error,
'defining lon dimension')
212 j_target2 = j_target - (2*halo_bndy)
213 error = nf90_def_dim(ncid,
'lat', j_target2, dim_lat)
214 call
netcdf_err(error,
'DEFINING LAT DIMENSION')
216 error = nf90_def_dim(ncid,
'lonp', ip1_target, dim_lonp)
217 call
netcdf_err(error,
'DEFINING LONP DIMENSION')
219 j_target2 = j_target - (2*halo_bndy) - 1
220 error = nf90_def_dim(ncid,
'latm', j_target2, dim_latm)
221 call
netcdf_err(error,
'DEFINING LATM DIMENSION')
223 error = nf90_def_dim(ncid,
'halo', halo, dim_halo)
224 call
netcdf_err(error,
'DEFINING HALO DIMENSION')
226 error = nf90_def_dim(ncid,
'halop', halo_p1, dim_halop)
227 call
netcdf_err(error,
'DEFINING HALOP DIMENSION')
229 error = nf90_def_dim(ncid,
'lev', lev_target, dim_lev)
230 call
netcdf_err(error,
'DEFINING LEV DIMENSION')
232 error = nf90_def_dim(ncid,
'levp', levp1_target, dim_levp1)
233 call
netcdf_err(error,
'DEFINING LEVP DIMENSION')
235 error = nf90_def_var(ncid,
'i_bottom', nf90_int, &
236 (/dim_lon/), id_i_bottom)
239 error = nf90_def_var(ncid,
'j_bottom', nf90_int, &
240 (/dim_halo/), id_j_bottom)
243 error = nf90_def_var(ncid,
'i_top', nf90_int, &
244 (/dim_lon/), id_i_top)
247 error = nf90_def_var(ncid,
'j_top', nf90_int, &
248 (/dim_halo/), id_j_top)
251 error = nf90_def_var(ncid,
'i_right', nf90_int, &
252 (/dim_halo/), id_i_right)
255 error = nf90_def_var(ncid,
'j_right', nf90_int, &
256 (/dim_lat/), id_j_right)
259 error = nf90_def_var(ncid,
'i_left', nf90_int, &
260 (/dim_halo/), id_i_left)
263 error = nf90_def_var(ncid,
'j_left', nf90_int, &
264 (/dim_lat/), id_j_left)
267 error = nf90_def_var(ncid,
'ps_bottom', nf90_float, &
268 (/dim_lon, dim_halo/), id_ps_bottom)
271 error = nf90_def_var(ncid,
'ps_top', nf90_float, &
272 (/dim_lon, dim_halo/), id_ps_top)
275 error = nf90_def_var(ncid,
'ps_right', nf90_float, &
276 (/dim_halo, dim_lat/), id_ps_right)
279 error = nf90_def_var(ncid,
'ps_left', nf90_float, &
280 (/dim_halo, dim_lat/), id_ps_left)
283 error = nf90_def_var(ncid,
't_bottom', nf90_float, &
284 (/dim_lon, dim_halo, dim_lev/), id_t_bottom)
287 error = nf90_def_var(ncid,
't_top', nf90_float, &
288 (/dim_lon, dim_halo, dim_lev/), id_t_top)
291 error = nf90_def_var(ncid,
't_right', nf90_float, &
292 (/dim_halo, dim_lat, dim_lev/), id_t_right)
295 error = nf90_def_var(ncid,
't_left', nf90_float, &
296 (/dim_halo, dim_lat, dim_lev/), id_t_left)
299 error = nf90_def_var(ncid,
'w_bottom', nf90_float, &
300 (/dim_lon, dim_halo, dim_lev/), id_w_bottom)
303 error = nf90_def_var(ncid,
'w_top', nf90_float, &
304 (/dim_lon, dim_halo, dim_lev/), id_w_top)
307 error = nf90_def_var(ncid,
'w_right', nf90_float, &
308 (/dim_halo, dim_lat, dim_lev/), id_w_right)
311 error = nf90_def_var(ncid,
'w_left', nf90_float, &
312 (/dim_halo, dim_lat, dim_lev/), id_w_left)
315 error = nf90_def_var(ncid,
'zh_bottom', nf90_float, &
316 (/dim_lon, dim_halo, dim_levp1/), id_zh_bottom)
319 error = nf90_def_var(ncid,
'zh_top', nf90_float, &
320 (/dim_lon, dim_halo, dim_levp1/), id_zh_top)
323 error = nf90_def_var(ncid,
'zh_right', nf90_float, &
324 (/dim_halo, dim_lat, dim_levp1/), id_zh_right)
327 error = nf90_def_var(ncid,
'zh_left', nf90_float, &
328 (/dim_halo, dim_lat, dim_levp1/), id_zh_left)
331 do n = 1, num_tracers
333 name = trim(tracers(n)) //
"_bottom"
334 error = nf90_def_var(ncid, name, nf90_float, &
335 (/dim_lon, dim_halo, dim_lev/), id_tracer_bottom(n))
336 call
netcdf_err(error,
'DEFINING TRACER_BOTTOM')
338 name = trim(tracers(n)) //
"_top"
339 error = nf90_def_var(ncid, name, nf90_float, &
340 (/dim_lon, dim_halo, dim_lev/), id_tracer_top(n))
343 name = trim(tracers(n)) //
"_right"
344 error = nf90_def_var(ncid, name, nf90_float, &
345 (/dim_halo, dim_lat, dim_lev/), id_tracer_right(n))
346 call
netcdf_err(error,
'DEFINING TRACER_RIGHT')
348 name = trim(tracers(n)) //
"_left"
349 error = nf90_def_var(ncid, name, nf90_float, &
350 (/dim_halo, dim_lat, dim_lev/), id_tracer_left(n))
351 call
netcdf_err(error,
'DEFINING TRACER_LEFT')
355 if (use_thomp_mp_climo)
then
357 name =
"ice_aero_bottom"
358 error = nf90_def_var(ncid, name, nf90_float, &
359 (/dim_lon, dim_halo, dim_lev/), id_qnifa_bottom)
360 call
netcdf_err(error,
'DEFINING QNIFA_BOTTOM')
362 name =
"ice_aero_top"
363 error = nf90_def_var(ncid, name, nf90_float, &
364 (/dim_lon, dim_halo, dim_lev/), id_qnifa_top)
367 name =
"ice_aero_right"
368 error = nf90_def_var(ncid, name, nf90_float, &
369 (/dim_halo, dim_lat, dim_lev/), id_qnifa_right)
370 call
netcdf_err(error,
'DEFINING QNIFA_RIGHT')
372 name =
"ice_aero_left"
373 error = nf90_def_var(ncid, name, nf90_float, &
374 (/dim_halo, dim_lat, dim_lev/), id_qnifa_left)
377 name =
"liq_aero_bottom"
378 error = nf90_def_var(ncid, name, nf90_float, &
379 (/dim_lon, dim_halo, dim_lev/), id_qnwfa_bottom)
380 call
netcdf_err(error,
'DEFINING QNWFA_BOTTOM')
382 name =
"liq_aero_top"
383 error = nf90_def_var(ncid, name, nf90_float, &
384 (/dim_lon, dim_halo, dim_lev/), id_qnwfa_top)
387 name =
"liq_aero_right"
388 error = nf90_def_var(ncid, name, nf90_float, &
389 (/dim_halo, dim_lat, dim_lev/), id_qnwfa_right)
390 call
netcdf_err(error,
'DEFINING QNWFA_RIGHT')
392 name =
"liq_aero_left"
393 error = nf90_def_var(ncid, name, nf90_float, &
394 (/dim_halo, dim_lat, dim_lev/), id_qnwfa_left)
399 error = nf90_def_var(ncid,
'i_w_bottom', nf90_int, &
400 (/dim_lonp/), id_i_w_bottom)
403 error = nf90_def_var(ncid,
'j_w_bottom', nf90_int, &
404 (/dim_halo/), id_j_w_bottom)
407 error = nf90_def_var(ncid,
'i_w_top', nf90_int, &
408 (/dim_lonp/), id_i_w_top)
411 error = nf90_def_var(ncid,
'j_w_top', nf90_int, &
412 (/dim_halo/), id_j_w_top)
415 error = nf90_def_var(ncid,
'i_w_right', nf90_int, &
416 (/dim_halop/), id_i_w_right)
419 error = nf90_def_var(ncid,
'j_w_right', nf90_int, &
420 (/dim_lat/), id_j_w_right)
423 error = nf90_def_var(ncid,
'i_w_left', nf90_int, &
424 (/dim_halop/), id_i_w_left)
427 error = nf90_def_var(ncid,
'j_w_left', nf90_int, &
428 (/dim_lat/), id_j_w_left)
431 error = nf90_def_var(ncid,
'u_w_bottom', nf90_float, &
432 (/dim_lonp, dim_halo, dim_lev/), id_u_w_bottom)
435 error = nf90_def_var(ncid,
'u_w_top', nf90_float, &
436 (/dim_lonp, dim_halo, dim_lev/), id_u_w_top)
439 error = nf90_def_var(ncid,
'u_w_right', nf90_float, &
440 (/dim_halop, dim_lat, dim_lev/), id_u_w_right)
443 error = nf90_def_var(ncid,
'u_w_left', nf90_float, &
444 (/dim_halop, dim_lat, dim_lev/), id_u_w_left)
447 error = nf90_def_var(ncid,
'v_w_bottom', nf90_float, &
448 (/dim_lonp, dim_halo, dim_lev/), id_v_w_bottom)
451 error = nf90_def_var(ncid,
'v_w_top', nf90_float, &
452 (/dim_lonp, dim_halo, dim_lev/), id_v_w_top)
455 error = nf90_def_var(ncid,
'v_w_right', nf90_float, &
456 (/dim_halop, dim_lat, dim_lev/), id_v_w_right)
459 error = nf90_def_var(ncid,
'v_w_left', nf90_float, &
460 (/dim_halop, dim_lat, dim_lev/), id_v_w_left)
463 error = nf90_def_var(ncid,
'i_s_bottom', nf90_int, &
464 (/dim_lon/), id_i_s_bottom)
467 error = nf90_def_var(ncid,
'j_s_bottom', nf90_int, &
468 (/dim_halop/), id_j_s_bottom)
471 error = nf90_def_var(ncid,
'i_s_top', nf90_int, &
472 (/dim_lon/), id_i_s_top)
475 error = nf90_def_var(ncid,
'j_s_top', nf90_int, &
476 (/dim_halop/), id_j_s_top)
479 error = nf90_def_var(ncid,
'i_s_right', nf90_int, &
480 (/dim_halo/), id_i_s_right)
483 error = nf90_def_var(ncid,
'j_s_right', nf90_int, &
484 (/dim_latm/), id_j_s_right)
487 error = nf90_def_var(ncid,
'i_s_left', nf90_int, &
488 (/dim_halo/), id_i_s_left)
491 error = nf90_def_var(ncid,
'j_s_left', nf90_int, &
492 (/dim_latm/), id_j_s_left)
495 error = nf90_def_var(ncid,
'u_s_bottom', nf90_float, &
496 (/dim_lon, dim_halop, dim_lev/), id_u_s_bottom)
499 error = nf90_def_var(ncid,
'u_s_top', nf90_float, &
500 (/dim_lon, dim_halop, dim_lev/), id_u_s_top)
503 error = nf90_def_var(ncid,
'u_s_right', nf90_float, &
504 (/dim_halo, dim_latm, dim_lev/), id_u_s_right)
507 error = nf90_def_var(ncid,
'u_s_left', nf90_float, &
508 (/dim_halo, dim_latm, dim_lev/), id_u_s_left)
511 error = nf90_def_var(ncid,
'v_s_bottom', nf90_float, &
512 (/dim_lon, dim_halop, dim_lev/), id_v_s_bottom)
515 error = nf90_def_var(ncid,
'v_s_top', nf90_float, &
516 (/dim_lon, dim_halop, dim_lev/), id_v_s_top)
519 error = nf90_def_var(ncid,
'v_s_right', nf90_float, &
520 (/dim_halo, dim_latm, dim_lev/), id_v_s_right)
523 error = nf90_def_var(ncid,
'v_s_left', nf90_float, &
524 (/dim_halo, dim_latm, dim_lev/), id_v_s_left)
528 if (trim(input_type) ==
"gaussian_nemsio")
then
529 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NEMSIO FILE')
530 elseif (trim(input_type) ==
"gfs_gaussian_nemsio")
then
531 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS GAUSSIAN NEMSIO FILE')
532 elseif (trim(input_type) ==
"gfs_sigio")
then
533 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS SIGIO FILE')
534 elseif (trim(input_type) ==
"history")
then
535 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED HISTORY FILE')
536 elseif (trim(input_type) ==
"restart")
then
537 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED RESTART FILE')
538 elseif (trim(input_type) ==
"gaussian_netcdf")
then
539 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NETCDF FILE')
540 elseif (trim(input_type) ==
"grib2")
then
541 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GRIB2 FILE')
544 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
545 call
netcdf_err(error,
'DEFINING END OF HEADER')
556 j_start_top = j_target - halo + 1
560 i_end_bottom = i_target
566 j_start_left = halo_bndy + 1
567 j_end_left = j_target - halo_bndy
569 i_start_right = i_target - halo + 1
570 i_end_right = i_target
571 j_start_right = halo_bndy + 1
572 j_end_right = j_target - halo_bndy
574 if (localpet == 0)
then
579 allocate(idum(i_start_top:i_end_top))
580 do i = i_start_top, i_end_top
581 idum(i) = i - halo_bndy
583 error = nf90_put_var(ncid, id_i_top, idum)
586 allocate(idum(i_start_bottom:i_end_bottom))
587 do i = i_start_bottom, i_end_bottom
588 idum(i) = i - halo_bndy
590 error = nf90_put_var(ncid, id_i_bottom, idum)
593 allocate(idum(i_start_left:i_end_left))
594 do i = i_start_left, i_end_left
595 idum(i) = i - halo_bndy
597 error = nf90_put_var(ncid, id_i_left, idum)
600 allocate(idum(i_start_right:i_end_right))
601 do i = i_start_right, i_end_right
602 idum(i) = i - halo_bndy
604 error = nf90_put_var(ncid, id_i_right, idum)
607 allocate(idum(j_start_top:j_end_top))
608 do i = j_start_top, j_end_top
609 idum(i) = i - halo_bndy
611 error = nf90_put_var(ncid, id_j_top, idum)
614 allocate(idum(j_start_bottom:j_end_bottom))
615 do i = j_start_bottom, j_end_bottom
616 idum(i) = i - halo_bndy
618 error = nf90_put_var(ncid, id_j_bottom, idum)
621 allocate(idum(j_start_left:j_end_left))
622 do i = j_start_left, j_end_left
623 idum(i) = i - halo_bndy
625 error = nf90_put_var(ncid, id_j_left, idum)
628 allocate(idum(j_start_right:j_end_right))
629 do i = j_start_right, j_end_right
630 idum(i) = i - halo_bndy
632 error = nf90_put_var(ncid, id_j_right, idum)
639 if (localpet == 0)
then
640 allocate(data_one_tile(i_target,j_target))
641 allocate(dum2d_top(i_start_top:i_end_top, j_start_top:j_end_top))
642 allocate(dum2d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom))
643 allocate(dum2d_left(i_start_left:i_end_left, j_start_left:j_end_left))
644 allocate(dum2d_right(i_start_right:i_end_right, j_start_right:j_end_right))
646 allocate(data_one_tile(0,0))
647 allocate(dum2d_top(0,0))
648 allocate(dum2d_bottom(0,0))
649 allocate(dum2d_left(0,0))
650 allocate(dum2d_right(0,0))
655 print*,
"- CALL FieldGather FOR TARGET GRID SURFACE PRESSURE"
656 call esmf_fieldgather(ps_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
657 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
660 if (localpet == 0)
then
661 dum2d_top(:,:) = data_one_tile(i_start_top:i_end_top, j_start_top:j_end_top)
662 error = nf90_put_var( ncid, id_ps_top, dum2d_top)
664 dum2d_bottom(:,:) = data_one_tile(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom)
665 error = nf90_put_var( ncid, id_ps_bottom, dum2d_bottom)
667 dum2d_left(:,:) = data_one_tile(i_start_left:i_end_left, j_start_left:j_end_left)
668 error = nf90_put_var( ncid, id_ps_left, dum2d_left)
670 dum2d_right(:,:) = data_one_tile(i_start_right:i_end_right, j_start_right:j_end_right)
671 error = nf90_put_var( ncid, id_ps_right, dum2d_right)
675 deallocate(dum2d_top, dum2d_bottom, dum2d_left, dum2d_right, data_one_tile)
679 if (localpet == 0)
then
680 allocate(data_one_tile_3d(i_target,j_target,levp1_target))
681 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top, levp1_target))
682 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom, levp1_target))
683 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left, levp1_target))
684 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right, levp1_target))
686 allocate(data_one_tile_3d(0,0,0))
687 allocate(dum3d_top(0,0,0))
688 allocate(dum3d_bottom(0,0,0))
689 allocate(dum3d_left(0,0,0))
690 allocate(dum3d_right(0,0,0))
693 print*,
"- CALL FieldGather FOR TARGET GRID HEIGHT FOR TILE: ", tile
694 call esmf_fieldgather(zh_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
695 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
698 if (localpet == 0)
then
699 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
700 dum3d_top(:,:,1:levp1_target) = dum3d_top(:,:,levp1_target:1:-1)
701 error = nf90_put_var( ncid, id_zh_top, dum3d_top)
703 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
704 dum3d_bottom(:,:,1:levp1_target) = dum3d_bottom(:,:,levp1_target:1:-1)
705 error = nf90_put_var( ncid, id_zh_bottom, dum3d_bottom)
707 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
708 dum3d_left(:,:,1:levp1_target) = dum3d_left(:,:,levp1_target:1:-1)
709 error = nf90_put_var( ncid, id_zh_left, dum3d_left)
711 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
712 dum3d_right(:,:,1:levp1_target) = dum3d_right(:,:,levp1_target:1:-1)
713 error = nf90_put_var( ncid, id_zh_right, dum3d_right)
717 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
721 if (localpet == 0)
then
722 allocate(data_one_tile_3d(i_target,j_target,lev_target))
723 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top, lev_target))
724 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom, lev_target))
725 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left, lev_target))
726 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right, lev_target))
728 allocate(data_one_tile_3d(0,0,0))
729 allocate(dum3d_top(0,0,0))
730 allocate(dum3d_bottom(0,0,0))
731 allocate(dum3d_left(0,0,0))
732 allocate(dum3d_right(0,0,0))
735 do n = 1, num_tracers
737 print*,
"- CALL FieldGather FOR TARGET GRID TRACER FOR TILE: ", trim(tracers(n)), tile
738 call esmf_fieldgather(tracers_target_grid(n), data_one_tile_3d, rootpet=0, tile=tile, rc=error)
739 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
742 if (localpet == 0)
then
743 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
744 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
745 error = nf90_put_var( ncid, id_tracer_top(n), dum3d_top)
747 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
748 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
749 error = nf90_put_var( ncid, id_tracer_bottom(n), dum3d_bottom)
750 call
netcdf_err(error,
'WRITING TRACER BOTTOM' )
751 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
752 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
753 error = nf90_put_var( ncid, id_tracer_left(n), dum3d_left)
754 call
netcdf_err(error,
'WRITING TRACER LEFT' )
755 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
756 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
757 error = nf90_put_var( ncid, id_tracer_right(n), dum3d_right)
758 call
netcdf_err(error,
'WRITING TRACER RIGHT' )
765 print*,
"- CALL FieldGather FOR TARGET GRID W FOR TILE: ", tile
766 call esmf_fieldgather(dzdt_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
767 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
770 if (localpet == 0)
then
771 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
772 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
773 error = nf90_put_var( ncid, id_w_top, dum3d_top)
775 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
776 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
777 error = nf90_put_var( ncid, id_w_bottom, dum3d_bottom)
779 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
780 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
781 error = nf90_put_var( ncid, id_w_left, dum3d_left)
783 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
784 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
785 error = nf90_put_var( ncid, id_w_right, dum3d_right)
791 print*,
"- CALL FieldGather FOR TARGET GRID TEMPERATURE FOR TILE: ", tile
792 call esmf_fieldgather(temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
793 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
796 if (localpet == 0)
then
797 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
798 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
799 error = nf90_put_var( ncid, id_t_top, dum3d_top)
801 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
802 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
803 error = nf90_put_var( ncid, id_t_bottom, dum3d_bottom)
805 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
806 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
807 error = nf90_put_var( ncid, id_t_left, dum3d_left)
809 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
810 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
811 error = nf90_put_var( ncid, id_t_right, dum3d_right)
815 if (use_thomp_mp_climo)
then
817 print*,
"- CALL FieldGather FOR TARGET GRID CLIMO QNIFA FOR TILE: ", tile
818 call esmf_fieldgather(qnifa_climo_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
819 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
822 if (localpet == 0)
then
823 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
824 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
825 error = nf90_put_var( ncid, id_qnifa_top, dum3d_top)
826 call
netcdf_err(error,
'WRITING QNIFA CLIMO TOP' )
827 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
828 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
829 error = nf90_put_var( ncid, id_qnifa_bottom, dum3d_bottom)
830 call
netcdf_err(error,
'WRITING QNIFA CLIMO BOTTOM' )
831 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
832 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
833 error = nf90_put_var( ncid, id_qnifa_left, dum3d_left)
834 call
netcdf_err(error,
'WRITING QNIFA CLIMO LEFT' )
835 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
836 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
837 error = nf90_put_var( ncid, id_qnifa_right, dum3d_right)
838 call
netcdf_err(error,
'WRITING QNIFA CLIMO RIGHT' )
841 print*,
"- CALL FieldGather FOR TARGET GRID CLIMO QNWFA FOR TILE: ", tile
842 call esmf_fieldgather(qnwfa_climo_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
843 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
846 if (localpet == 0)
then
847 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
848 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
849 error = nf90_put_var( ncid, id_qnwfa_top, dum3d_top)
850 call
netcdf_err(error,
'WRITING QNWFA CLIMO TOP' )
851 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
852 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
853 error = nf90_put_var( ncid, id_qnwfa_bottom, dum3d_bottom)
854 call
netcdf_err(error,
'WRITING QNWFA CLIMO BOTTOM' )
855 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
856 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
857 error = nf90_put_var( ncid, id_qnwfa_left, dum3d_left)
858 call
netcdf_err(error,
'WRITING QNWFA CLIMO LEFT' )
859 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
860 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
861 error = nf90_put_var( ncid, id_qnwfa_right, dum3d_right)
862 call
netcdf_err(error,
'WRITING QNWFA CLIMO RIGHT' )
867 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
876 j_start_top = jp1_target - halo_p1 + 1
877 j_end_top = jp1_target
880 i_end_bottom = i_target
882 j_end_bottom = halo_p1
886 j_start_left = halo_bndy + 2
887 j_end_left = j_target - halo_bndy
889 i_start_right = i_target - halo + 1
890 i_end_right = i_target
891 j_start_right = halo_bndy + 2
892 j_end_right = j_target - halo_bndy
894 if (localpet == 0)
then
899 allocate(idum(i_start_top:i_end_top))
900 do i = i_start_top, i_end_top
901 idum(i) = i - halo_bndy
903 error = nf90_put_var(ncid, id_i_s_top, idum)
906 allocate(idum(i_start_bottom:i_end_bottom))
907 do i = i_start_bottom, i_end_bottom
908 idum(i) = i - halo_bndy
910 error = nf90_put_var(ncid, id_i_s_bottom, idum)
913 allocate(idum(i_start_left:i_end_left))
914 do i = i_start_left, i_end_left
915 idum(i) = i - halo_bndy
917 error = nf90_put_var(ncid, id_i_s_left, idum)
920 allocate(idum(i_start_right:i_end_right))
921 do i = i_start_right, i_end_right
922 idum(i) = i - halo_bndy
924 error = nf90_put_var(ncid, id_i_s_right, idum)
927 allocate(idum(j_start_top:j_end_top))
928 do i = j_start_top, j_end_top
929 idum(i) = i - halo_bndy
931 error = nf90_put_var(ncid, id_j_s_top, idum)
934 allocate(idum(j_start_bottom:j_end_bottom))
935 do i = j_start_bottom, j_end_bottom
936 idum(i) = i - halo_bndy
938 error = nf90_put_var(ncid, id_j_s_bottom, idum)
941 allocate(idum(j_start_left:j_end_left))
942 do i = j_start_left, j_end_left
943 idum(i) = i - halo_bndy
945 error = nf90_put_var(ncid, id_j_s_left, idum)
948 allocate(idum(j_start_right:j_end_right))
949 do i = j_start_right, j_end_right
950 idum(i) = i - halo_bndy
952 error = nf90_put_var(ncid, id_j_s_right, idum)
959 if (localpet == 0)
then
960 allocate(data_one_tile_3d(i_target,jp1_target,lev_target))
961 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top, lev_target))
962 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom, lev_target))
963 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left, lev_target))
964 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right, lev_target))
966 allocate(data_one_tile_3d(0,0,0))
967 allocate(dum3d_top(0,0,0))
968 allocate(dum3d_bottom(0,0,0))
969 allocate(dum3d_left(0,0,0))
970 allocate(dum3d_right(0,0,0))
973 print*,
"- CALL FieldGather FOR TARGET GRID U_S FOR TILE: ", tile
974 call esmf_fieldgather(u_s_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
975 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
978 if (localpet == 0)
then
979 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
980 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
981 error = nf90_put_var( ncid, id_u_s_top, dum3d_top)
983 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
984 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
985 error = nf90_put_var( ncid, id_u_s_bottom, dum3d_bottom)
987 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
988 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
989 error = nf90_put_var( ncid, id_u_s_left, dum3d_left)
991 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
992 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
993 error = nf90_put_var( ncid, id_u_s_right, dum3d_right)
999 print*,
"- CALL FieldGather FOR TARGET GRID V_S FOR TILE: ", tile
1000 call esmf_fieldgather(v_s_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
1001 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1004 if (localpet == 0)
then
1005 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
1006 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
1007 error = nf90_put_var( ncid, id_v_s_top, dum3d_top)
1009 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
1010 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
1011 error = nf90_put_var( ncid, id_v_s_bottom, dum3d_bottom)
1012 call
netcdf_err(error,
'WRITING V_S BOTTOM' )
1013 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
1014 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
1015 error = nf90_put_var( ncid, id_v_s_left, dum3d_left)
1017 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
1018 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
1019 error = nf90_put_var( ncid, id_v_s_right, dum3d_right)
1023 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
1031 i_end_top = ip1_target
1032 j_start_top = j_target - halo + 1
1033 j_end_top = j_target
1036 i_end_bottom = ip1_target
1041 i_end_left = halo_p1
1042 j_start_left = halo_bndy + 1
1043 j_end_left = j_target - halo_bndy
1045 i_start_right = ip1_target - halo_p1 + 1
1046 i_end_right = ip1_target
1047 j_start_right = halo_bndy + 1
1048 j_end_right = j_target - halo_bndy
1050 if (localpet == 0)
then
1055 allocate(idum(i_start_top:i_end_top))
1056 do i = i_start_top, i_end_top
1057 idum(i) = i - halo_bndy
1059 error = nf90_put_var(ncid, id_i_w_top, idum)
1062 allocate(idum(i_start_bottom:i_end_bottom))
1063 do i = i_start_bottom, i_end_bottom
1064 idum(i) = i - halo_bndy
1066 error = nf90_put_var(ncid, id_i_w_bottom, idum)
1069 allocate(idum(i_start_left:i_end_left))
1070 do i = i_start_left, i_end_left
1071 idum(i) = i - halo_bndy
1073 error = nf90_put_var(ncid, id_i_w_left, idum)
1076 allocate(idum(i_start_right:i_end_right))
1077 do i = i_start_right, i_end_right
1078 idum(i) = i - halo_bndy
1080 error = nf90_put_var(ncid, id_i_w_right, idum)
1083 allocate(idum(j_start_top:j_end_top))
1084 do i = j_start_top, j_end_top
1085 idum(i) = i - halo_bndy
1087 error = nf90_put_var(ncid, id_j_w_top, idum)
1090 allocate(idum(j_start_bottom:j_end_bottom))
1091 do i = j_start_bottom, j_end_bottom
1092 idum(i) = i - halo_bndy
1094 error = nf90_put_var(ncid, id_j_w_bottom, idum)
1097 allocate(idum(j_start_left:j_end_left))
1098 do i = j_start_left, j_end_left
1099 idum(i) = i - halo_bndy
1101 error = nf90_put_var(ncid, id_j_w_left, idum)
1104 allocate(idum(j_start_right:j_end_right))
1105 do i = j_start_right, j_end_right
1106 idum(i) = i - halo_bndy
1108 error = nf90_put_var(ncid, id_j_w_right, idum)
1115 if (localpet == 0)
then
1116 allocate(data_one_tile_3d(ip1_target,j_target,lev_target))
1117 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top, lev_target))
1118 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom, lev_target))
1119 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left, lev_target))
1120 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right, lev_target))
1122 allocate(data_one_tile_3d(0,0,0))
1123 allocate(dum3d_top(0,0,0))
1124 allocate(dum3d_bottom(0,0,0))
1125 allocate(dum3d_left(0,0,0))
1126 allocate(dum3d_right(0,0,0))
1129 print*,
"- CALL FieldGather FOR TARGET GRID U_W FOR TILE: ", tile
1130 call esmf_fieldgather(u_w_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
1131 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1134 if (localpet == 0)
then
1135 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
1136 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
1137 error = nf90_put_var( ncid, id_u_w_top, dum3d_top)
1139 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
1140 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
1141 error = nf90_put_var( ncid, id_u_w_bottom, dum3d_bottom)
1142 call
netcdf_err(error,
'WRITING U_W BOTTOM' )
1143 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
1144 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
1145 error = nf90_put_var( ncid, id_u_w_left, dum3d_left)
1147 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
1148 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
1149 error = nf90_put_var( ncid, id_u_w_right, dum3d_right)
1155 print*,
"- CALL FieldGather FOR TARGET GRID V_W FOR TILE: ", tile
1156 call esmf_fieldgather(v_w_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
1157 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1160 if (localpet == 0)
then
1161 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
1162 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
1163 error = nf90_put_var( ncid, id_v_w_top, dum3d_top)
1165 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
1166 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
1167 error = nf90_put_var( ncid, id_v_w_bottom, dum3d_bottom)
1168 call
netcdf_err(error,
'WRITING V_W BOTTOM' )
1169 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
1170 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
1171 error = nf90_put_var( ncid, id_v_w_left, dum3d_left)
1173 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
1174 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
1175 error = nf90_put_var( ncid, id_v_w_right, dum3d_right)
1179 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
1180 deallocate(id_tracer_bottom, id_tracer_top, id_tracer_left, id_tracer_right)
1182 if (localpet == 0) error = nf90_close(ncid)
1200 input_type, tracers, num_tracers, &
1201 use_thomp_mp_climo, &
1209 qnifa_climo_target_grid, &
1210 qnwfa_climo_target_grid, &
1211 tracers_target_grid, &
1219 use model_grid, only : num_tiles_target_grid, &
1220 i_target, j_target, &
1221 ip1_target, jp1_target, &
1222 longitude_target_grid, &
1223 latitude_target_grid, &
1224 longitude_s_target_grid, &
1225 latitude_s_target_grid, &
1226 longitude_w_target_grid, &
1227 latitude_w_target_grid
1231 integer,
intent(in) :: localpet
1233 character(len=128) :: outfile
1235 integer :: error, ncid, tile, n
1236 integer :: fsize=65536, initial = 0
1237 integer :: header_buffer_val = 16384
1238 integer :: dim_lon, dim_lat
1239 integer :: dim_lonp, dim_latp
1240 integer :: dim_lev, dim_levp1, dim_ntracer
1241 integer,
allocatable :: id_tracers(:)
1242 integer :: id_lon, id_lat, id_ps
1243 integer :: id_lat_s, id_lon_s
1244 integer :: id_lat_w, id_lon_w
1245 integer :: id_w, id_zh, id_u_w
1246 integer :: id_v_w, id_u_s, id_v_s
1247 integer :: id_t, id_delp, id_qnifa, id_qnwfa
1248 integer :: i_start, i_end, j_start, j_end
1249 integer :: i_target_out, j_target_out
1250 integer :: ip1_target_out, jp1_target_out
1251 integer :: ip1_end, jp1_end, num_tracers_output
1253 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
1254 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
1255 real(kind=4),
allocatable :: dum2d(:,:)
1256 real(kind=4),
allocatable :: dum3d(:,:,:)
1260 i_target_out = i_target-(2*halo)
1261 j_target_out = j_target-(2*halo)
1265 i_end = i_target - halo
1266 j_end = j_target - halo
1268 ip1_target_out = i_target_out + 1
1269 jp1_target_out = j_target_out + 1
1274 if (localpet < num_tiles_target_grid)
then
1275 allocate(data_one_tile(i_target,j_target))
1276 allocate(dum2d(i_target_out,j_target_out))
1278 allocate(data_one_tile(0,0))
1279 allocate(dum2d(0,0))
1282 allocate(id_tracers(num_tracers))
1284 header :
if (localpet < num_tiles_target_grid)
then
1287 if (regional > 0)
then
1288 outfile =
"out.atm.tile7.nc"
1290 WRITE(outfile,
'(A, I1, A)')
'out.atm.tile', tile,
'.nc'
1294 error = nf90_create(outfile, ior(nf90_netcdf4,nf90_classic_model), &
1295 ncid, initialsize=initial, chunksize=fsize)
1296 call
netcdf_err(error,
'CREATING FILE='//trim(outfile) )
1299 error = nf90_def_dim(ncid,
'lon', i_target_out, dim_lon)
1300 call
netcdf_err(error,
'DEFINING LON DIMENSION' )
1301 error = nf90_def_dim(ncid,
'lat', j_target_out, dim_lat)
1302 call
netcdf_err(error,
'DEFINING LAT DIMENSION' )
1303 error = nf90_def_dim(ncid,
'lonp', ip1_target_out, dim_lonp)
1304 call
netcdf_err(error,
'DEFINING LONP DIMENSION' )
1305 error = nf90_def_dim(ncid,
'latp', jp1_target_out, dim_latp)
1306 call
netcdf_err(error,
'DEFINING LATP DIMENSION' )
1307 error = nf90_def_dim(ncid,
'lev', lev_target, dim_lev)
1308 call
netcdf_err(error,
'DEFINING LEV DIMENSION' )
1309 error = nf90_def_dim(ncid,
'levp', levp1_target, dim_levp1)
1310 call
netcdf_err(error,
'DEFINING LEVP DIMENSION' )
1311 num_tracers_output = num_tracers
1312 if (use_thomp_mp_climo) num_tracers_output = num_tracers + 2
1313 error = nf90_def_dim(ncid,
'ntracer', num_tracers_output, dim_ntracer)
1314 call
netcdf_err(error,
'DEFINING NTRACER DIMENSION' )
1317 if (trim(input_type) ==
"gaussian_nemsio")
then
1318 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NEMSIO FILE')
1319 elseif (trim(input_type) ==
"gaussian_netcdf")
then
1320 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NETCDF FILE')
1321 elseif (trim(input_type) ==
"gfs_gaussian_nemsio")
then
1322 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS GAUSSIAN NEMSIO FILE')
1323 elseif (trim(input_type) ==
"gfs_sigio")
then
1324 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS SIGIO FILE')
1325 elseif (trim(input_type) ==
"history")
then
1326 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED HISTORY FILE')
1327 elseif (trim(input_type) ==
"restart")
then
1328 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED RESTART FILE')
1329 elseif (trim(input_type) ==
"grib2")
then
1330 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GRIB2 FILE')
1334 error = nf90_def_var(ncid,
'geolon', nf90_float, (/dim_lon,dim_lat/), id_lon)
1335 call
netcdf_err(error,
'DEFINING GEOLON FIELD' )
1336 error = nf90_put_att(ncid, id_lon,
"long_name",
"Longitude")
1337 call
netcdf_err(error,
'DEFINING GEOLON NAME' )
1338 error = nf90_put_att(ncid, id_lon,
"units",
"degrees_east")
1339 call
netcdf_err(error,
'DEFINING GEOLON UNITS' )
1341 error = nf90_def_var(ncid,
'geolat', nf90_float, (/dim_lon,dim_lat/), id_lat)
1342 call
netcdf_err(error,
'DEFINING GEOLAT FIELD' )
1343 error = nf90_put_att(ncid, id_lat,
"long_name",
"Latitude")
1344 call
netcdf_err(error,
'DEFINING GEOLAT NAME' )
1345 error = nf90_put_att(ncid, id_lat,
"units",
"degrees_north")
1346 call
netcdf_err(error,
'DEFINING GEOLAT UNITS' )
1348 error = nf90_def_var(ncid,
'geolon_s', nf90_float, (/dim_lon,dim_latp/), id_lon_s)
1349 call
netcdf_err(error,
'DEFINING GEOLON_S FIELD' )
1350 error = nf90_put_att(ncid, id_lon_s,
"long_name",
"Longitude_s")
1351 call
netcdf_err(error,
'DEFINING GEOLON_S NAME' )
1352 error = nf90_put_att(ncid, id_lon_s,
"units",
"degrees_east")
1353 call
netcdf_err(error,
'DEFINING GEOLON_S UNITS' )
1355 error = nf90_def_var(ncid,
'geolat_s', nf90_float, (/dim_lon,dim_latp/), id_lat_s)
1356 call
netcdf_err(error,
'DEFINING GEOLAT_S FIELD' )
1357 error = nf90_put_att(ncid, id_lat_s,
"long_name",
"Latitude_s")
1358 call
netcdf_err(error,
'DEFINING GEOLAT_S NAME' )
1359 error = nf90_put_att(ncid, id_lat_s,
"units",
"degrees_north")
1360 call
netcdf_err(error,
'DEFINING GEOLAT_S UNITS' )
1362 error = nf90_def_var(ncid,
'geolon_w', nf90_float, (/dim_lonp,dim_lat/), id_lon_w)
1363 call
netcdf_err(error,
'DEFINING GEOLON_W FIELD' )
1364 error = nf90_put_att(ncid, id_lon_w,
"long_name",
"Longitude_w")
1365 call
netcdf_err(error,
'DEFINING GEOLON_W NAME' )
1366 error = nf90_put_att(ncid, id_lon_w,
"units",
"degrees_east")
1367 call
netcdf_err(error,
'DEFINING GEOLON_W UNITS' )
1369 error = nf90_def_var(ncid,
'geolat_w', nf90_float, (/dim_lonp,dim_lat/), id_lat_w)
1370 call
netcdf_err(error,
'DEFINING GEOLAT_W FIELD' )
1371 error = nf90_put_att(ncid, id_lat_w,
"long_name",
"Latitude_w")
1372 call
netcdf_err(error,
'DEFINING GEOLAT_W NAME' )
1373 error = nf90_put_att(ncid, id_lat_w,
"units",
"degrees_north")
1374 call
netcdf_err(error,
'DEFINING GEOLAT_W UNITS' )
1376 error = nf90_def_var(ncid,
'ps', nf90_float, (/dim_lon,dim_lat/), id_ps)
1378 error = nf90_put_att(ncid, id_ps,
"coordinates",
"geolon geolat")
1381 error = nf90_def_var(ncid,
'w', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_w)
1383 error = nf90_put_att(ncid, id_w,
"coordinates",
"geolon geolat")
1386 error = nf90_def_var(ncid,
'zh', nf90_float, (/dim_lon,dim_lat,dim_levp1/), id_zh)
1388 error = nf90_put_att(ncid, id_zh,
"coordinates",
"geolon geolat")
1391 error = nf90_def_var(ncid,
't', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_t)
1393 error = nf90_put_att(ncid, id_t,
"coordinates",
"geolon geolat")
1396 error = nf90_def_var(ncid,
'delp', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_delp)
1398 error = nf90_put_att(ncid, id_delp,
"coordinates",
"geolon geolat")
1399 call
netcdf_err(error,
'DEFINING DELP COORD' )
1401 do n = 1, num_tracers
1402 error = nf90_def_var(ncid, tracers(n), nf90_float, (/dim_lon,dim_lat,dim_lev/), id_tracers(n))
1404 error = nf90_put_att(ncid, id_tracers(n),
"coordinates",
"geolon geolat")
1405 call
netcdf_err(error,
'DEFINING TRACERS COORD' )
1408 if (use_thomp_mp_climo)
then
1409 error = nf90_def_var(ncid,
'ice_aero', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_qnifa)
1411 error = nf90_put_att(ncid, id_qnifa,
"coordinates",
"geolon geolat")
1412 call
netcdf_err(error,
'DEFINING QNIFA COORD' )
1414 error = nf90_def_var(ncid,
'liq_aero', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_qnwfa)
1416 error = nf90_put_att(ncid, id_qnwfa,
"coordinates",
"geolon geolat")
1417 call
netcdf_err(error,
'DEFINING QNWFA COORD' )
1420 error = nf90_def_var(ncid,
'u_w', nf90_float, (/dim_lonp,dim_lat,dim_lev/), id_u_w)
1422 error = nf90_put_att(ncid, id_u_w,
"coordinates",
"geolon_w geolat_w")
1423 call
netcdf_err(error,
'DEFINING U_W COORD' )
1425 error = nf90_def_var(ncid,
'v_w', nf90_float, (/dim_lonp,dim_lat,dim_lev/), id_v_w)
1427 error = nf90_put_att(ncid, id_v_w,
"coordinates",
"geolon_w geolat_w")
1428 call
netcdf_err(error,
'DEFINING V_W COORD' )
1430 error = nf90_def_var(ncid,
'u_s', nf90_float, (/dim_lon,dim_latp,dim_lev/), id_u_s)
1432 error = nf90_put_att(ncid, id_u_s,
"coordinates",
"geolon_s geolat_s")
1433 call
netcdf_err(error,
'DEFINING U_S COORD' )
1435 error = nf90_def_var(ncid,
'v_s', nf90_float, (/dim_lon,dim_latp,dim_lev/), id_v_s)
1437 error = nf90_put_att(ncid, id_v_s,
"coordinates",
"geolon_s geolat_s")
1438 call
netcdf_err(error,
'DEFINING V_S COORD' )
1440 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
1447 do tile = 1, num_tiles_target_grid
1448 print*,
"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile
1449 call esmf_fieldgather(longitude_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1450 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1454 if (localpet < num_tiles_target_grid)
then
1455 dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end)
1456 error = nf90_put_var( ncid, id_lon, dum2d)
1457 call
netcdf_err(error,
'WRITING LONGITUDE RECORD' )
1462 do tile = 1, num_tiles_target_grid
1463 print*,
"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile
1464 call esmf_fieldgather(latitude_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1465 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1469 if (localpet < num_tiles_target_grid)
then
1470 dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end)
1471 error = nf90_put_var( ncid, id_lat, dum2d)
1472 call
netcdf_err(error,
'WRITING LATITUDE RECORD' )
1477 do tile = 1, num_tiles_target_grid
1478 print*,
"- CALL FieldGather FOR TARGET GRID SURFACE PRESSURE FOR TILE: ", tile
1479 call esmf_fieldgather(ps_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1480 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1484 if (localpet < num_tiles_target_grid)
then
1485 dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end)
1486 error = nf90_put_var( ncid, id_ps, dum2d)
1487 call
netcdf_err(error,
'WRITING SURFACE PRESSURE RECORD' )
1490 deallocate(dum2d, data_one_tile)
1494 if (localpet < num_tiles_target_grid)
then
1495 allocate(dum3d(i_target_out,j_target_out,levp1_target))
1496 allocate(data_one_tile_3d(i_target,j_target,levp1_target))
1498 allocate(dum3d(0,0,0))
1499 allocate(data_one_tile_3d(0,0,0))
1502 do tile = 1, num_tiles_target_grid
1503 print*,
"- CALL FieldGather FOR TARGET GRID HEIGHT FOR TILE: ", tile
1504 call esmf_fieldgather(zh_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1505 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1509 if (localpet < num_tiles_target_grid)
then
1510 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1511 dum3d(:,:,1:levp1_target) = dum3d(:,:,levp1_target:1:-1)
1512 error = nf90_put_var( ncid, id_zh, dum3d)
1513 call
netcdf_err(error,
'WRITING HEIGHT RECORD' )
1516 deallocate(dum3d, data_one_tile_3d)
1520 if (localpet < num_tiles_target_grid)
then
1521 allocate(dum3d(i_target_out,j_target_out,lev_target))
1522 allocate(data_one_tile_3d(i_target,j_target,lev_target))
1524 allocate(dum3d(0,0,0))
1525 allocate(data_one_tile_3d(0,0,0))
1528 do tile = 1, num_tiles_target_grid
1529 print*,
"- CALL FieldGather FOR TARGET GRID VERTICAL VELOCITY FOR TILE: ", tile
1530 call esmf_fieldgather(dzdt_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1531 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1535 if (localpet < num_tiles_target_grid)
then
1536 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1537 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1538 print*,
"MIN MAX W AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1539 error = nf90_put_var( ncid, id_w, dum3d)
1540 call
netcdf_err(error,
'WRITING VERTICAL VELOCITY RECORD' )
1545 do tile = 1, num_tiles_target_grid
1546 print*,
"- CALL FieldGather FOR TARGET GRID DELP FOR TILE: ", tile
1547 call esmf_fieldgather(delp_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1548 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1552 if (localpet < num_tiles_target_grid)
then
1553 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1554 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1555 error = nf90_put_var( ncid, id_delp, dum3d)
1556 call
netcdf_err(error,
'WRITING DELP RECORD' )
1561 do tile = 1, num_tiles_target_grid
1562 print*,
"- CALL FieldGather FOR TARGET GRID TEMPERATURE FOR TILE: ", tile
1563 call esmf_fieldgather(temp_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1564 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1568 if (localpet < num_tiles_target_grid)
then
1569 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1570 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1571 error = nf90_put_var( ncid, id_t, dum3d)
1572 call
netcdf_err(error,
'WRITING TEMPERTAURE RECORD' )
1577 do n = 1, num_tracers
1579 do tile = 1, num_tiles_target_grid
1580 print*,
"- CALL FieldGather FOR TARGET GRID TRACER ", trim(tracers(n)),
" TILE: ", tile
1581 call esmf_fieldgather(tracers_target_grid(n), data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1582 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1586 if (localpet < num_tiles_target_grid)
then
1587 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1588 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1589 error = nf90_put_var( ncid, id_tracers(n), dum3d)
1590 call
netcdf_err(error,
'WRITING TRACER RECORD' )
1597 if (use_thomp_mp_climo)
then
1598 do tile = 1, num_tiles_target_grid
1599 print*,
"- CALL FieldGather FOR TARGET GRID QNIFA FOR TILE: ", tile
1600 call esmf_fieldgather(qnifa_climo_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1601 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1605 if (localpet < num_tiles_target_grid)
then
1606 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1607 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1608 error = nf90_put_var( ncid, id_qnifa, dum3d)
1609 call
netcdf_err(error,
'WRITING QNIFA RECORD' )
1614 do tile = 1, num_tiles_target_grid
1615 print*,
"- CALL FieldGather FOR TARGET GRID QNWFA FOR TILE: ", tile
1616 call esmf_fieldgather(qnwfa_climo_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1617 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1621 if (localpet < num_tiles_target_grid)
then
1622 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1623 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1624 error = nf90_put_var( ncid, id_qnwfa, dum3d)
1625 call
netcdf_err(error,
'WRITING QNWFA RECORD' )
1629 deallocate(dum3d, data_one_tile_3d)
1633 if (localpet < num_tiles_target_grid)
then
1634 allocate(dum2d(i_target_out,jp1_target_out))
1635 allocate(data_one_tile(i_target,jp1_target))
1637 allocate(dum2d(0,0))
1638 allocate(data_one_tile(0,0))
1641 do tile = 1, num_tiles_target_grid
1642 print*,
"- CALL FieldGather FOR TARGET GRID LON_S FOR TILE: ", tile
1643 call esmf_fieldgather(longitude_s_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1644 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1648 if (localpet < num_tiles_target_grid)
then
1649 dum2d(:,:) = data_one_tile(i_start:i_end,j_start:jp1_end)
1650 error = nf90_put_var( ncid, id_lon_s, dum2d)
1651 call
netcdf_err(error,
'WRITING LON_S RECORD' )
1654 do tile = 1, num_tiles_target_grid
1655 print*,
"- CALL FieldGather FOR TARGET GRID LAT_S FOR TILE: ", tile
1656 call esmf_fieldgather(latitude_s_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1657 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1661 if (localpet < num_tiles_target_grid)
then
1662 dum2d(:,:) = data_one_tile(i_start:i_end,j_start:jp1_end)
1663 error = nf90_put_var( ncid, id_lat_s, dum2d)
1664 call
netcdf_err(error,
'WRITING LAT_S RECORD' )
1667 deallocate(dum2d, data_one_tile)
1671 if (localpet < num_tiles_target_grid)
then
1672 allocate(dum3d(i_target_out,jp1_target_out,lev_target))
1673 allocate(data_one_tile_3d(i_target,jp1_target,lev_target))
1675 allocate(dum3d(0,0,0))
1676 allocate(data_one_tile_3d(0,0,0))
1679 do tile = 1, num_tiles_target_grid
1680 print*,
"- CALL FieldGather FOR TARGET GRID U_S FOR TILE: ", tile
1681 call esmf_fieldgather(u_s_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1682 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1686 if (localpet < num_tiles_target_grid)
then
1687 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:jp1_end,:)
1688 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1689 print*,
"MIN MAX US AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1690 error = nf90_put_var( ncid, id_u_s, dum3d)
1691 call
netcdf_err(error,
'WRITING U_S RECORD' )
1696 do tile = 1, num_tiles_target_grid
1697 print*,
"- CALL FieldGather FOR TARGET GRID V_S FOR TILE: ", tile
1698 call esmf_fieldgather(v_s_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1699 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1703 if (localpet < num_tiles_target_grid)
then
1704 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:jp1_end,:)
1705 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1706 print*,
"MIN MAX VS AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1707 error = nf90_put_var( ncid, id_v_s, dum3d)
1708 call
netcdf_err(error,
'WRITING V_S RECORD' )
1711 deallocate(dum3d, data_one_tile_3d)
1715 if (localpet < num_tiles_target_grid)
then
1716 allocate(dum2d(ip1_target_out,j_target_out))
1717 allocate(data_one_tile(ip1_target,j_target))
1719 allocate(dum2d(0,0))
1720 allocate(data_one_tile(0,0))
1723 do tile = 1, num_tiles_target_grid
1724 print*,
"- CALL FieldGather FOR TARGET GRID LON_W FOR TILE: ", tile
1725 call esmf_fieldgather(longitude_w_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1726 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1730 if (localpet < num_tiles_target_grid)
then
1731 dum2d(:,:) = data_one_tile(i_start:ip1_end,j_start:j_end)
1732 error = nf90_put_var( ncid, id_lon_w, dum2d)
1733 call
netcdf_err(error,
'WRITING LON_W RECORD' )
1736 do tile = 1, num_tiles_target_grid
1737 print*,
"- CALL FieldGather FOR TARGET GRID LAT_W FOR TILE: ", tile
1738 call esmf_fieldgather(latitude_w_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1739 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1743 if (localpet < num_tiles_target_grid)
then
1744 dum2d(:,:) = data_one_tile(i_start:ip1_end,j_start:j_end)
1745 error = nf90_put_var( ncid, id_lat_w, dum2d)
1746 call
netcdf_err(error,
'WRITING LAT_W RECORD' )
1749 deallocate(dum2d, data_one_tile)
1753 if (localpet < num_tiles_target_grid)
then
1754 allocate(dum3d(ip1_target_out,j_target_out,lev_target))
1755 allocate(data_one_tile_3d(ip1_target,j_target,lev_target))
1757 allocate(dum3d(0,0,0))
1758 allocate(data_one_tile_3d(0,0,0))
1761 do tile = 1, num_tiles_target_grid
1762 print*,
"- CALL FieldGather FOR TARGET GRID U_W FOR TILE: ", tile
1763 call esmf_fieldgather(u_w_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1764 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1768 if (localpet < num_tiles_target_grid)
then
1769 dum3d(:,:,:) = data_one_tile_3d(i_start:ip1_end,j_start:j_end,:)
1770 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1771 print*,
"MIN MAX UW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1772 error = nf90_put_var( ncid, id_u_w, dum3d)
1773 call
netcdf_err(error,
'WRITING U_W RECORD' )
1778 do tile = 1, num_tiles_target_grid
1779 print*,
"- CALL FieldGather FOR TARGET GRID V_W FOR TILE: ", tile
1780 call esmf_fieldgather(v_w_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1781 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1785 if (localpet < num_tiles_target_grid)
then
1786 dum3d(:,:,:) = data_one_tile_3d(i_start:ip1_end,j_start:j_end,:)
1787 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1788 print*,
"MIN MAX VW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1789 error = nf90_put_var( ncid, id_v_w, dum3d)
1790 call
netcdf_err(error,
'WRITING V_W RECORD' )
1793 deallocate(dum3d, data_one_tile_3d, id_tracers)
1799 if (localpet < num_tiles_target_grid) error = nf90_close(ncid)
1812 use model_grid, only : num_tiles_target_grid, &
1813 landmask_target_grid, &
1814 latitude_target_grid, &
1815 longitude_target_grid, &
1816 i_target, j_target, lsoil_target
1819 regional, lai_from_climo
1821 use surface, only : canopy_mc_target_grid, &
1825 seaice_depth_target_grid, &
1826 seaice_fract_target_grid, &
1827 seaice_skin_temp_target_grid, &
1828 skin_temp_target_grid, &
1829 soil_temp_target_grid, &
1830 soilm_liq_target_grid, &
1831 soilm_tot_target_grid, &
1832 srflag_target_grid, &
1833 snow_liq_equiv_target_grid, &
1834 snow_depth_target_grid, &
1836 tprcp_target_grid, &
1837 ustar_target_grid, &
1842 d_conv_target_grid, &
1843 dt_cool_target_grid, &
1845 qrain_target_grid, &
1860 alnsf_target_grid, &
1861 alvwf_target_grid, &
1862 alnwf_target_grid, &
1863 facsf_target_grid, &
1864 facwf_target_grid, &
1865 max_veg_greenness_target_grid, &
1866 min_veg_greenness_target_grid, &
1867 mxsno_albedo_target_grid, &
1868 slope_type_target_grid, &
1869 soil_type_target_grid, &
1870 substrate_temp_target_grid, &
1871 veg_greenness_target_grid, &
1872 veg_type_target_grid
1876 integer,
intent(in) :: localpet
1877 character(len=128) :: outfile
1879 integer :: fsize=65536, initial = 0
1880 integer :: header_buffer_val = 16384
1881 integer :: dim_x, dim_y, dim_lsoil, dim_time
1882 integer :: error, i, ncid, tile
1883 integer :: id_x, id_y, id_lsoil
1884 integer :: id_slmsk, id_time
1885 integer :: id_lat, id_lon
1886 integer :: id_tsea, id_sheleg, id_tg3
1887 integer :: id_zorl, id_alvsf, id_alvwf
1888 integer :: id_alnsf, id_alnwf, id_vfrac
1889 integer :: id_canopy, id_f10m, id_t2m
1890 integer :: id_q2m, id_vtype, id_stype
1891 integer :: id_facsf, id_facwf, id_uustar
1892 integer :: id_ffmm, id_ffhh, id_hice
1893 integer :: id_fice, id_tisfc, id_tprcp
1894 integer :: id_srflag, id_snwdph, id_shdmin
1895 integer :: id_shdmax, id_slope, id_snoalb
1897 integer :: id_stc, id_smc, id_slc
1898 integer :: id_tref, id_z_c, id_c_0
1899 integer :: id_c_d, id_w_0, id_w_d
1900 integer :: id_xt, id_xs, id_xu, id_xv
1901 integer :: id_xz, id_zm, id_xtts, id_xzts
1902 integer :: id_d_conv, id_ifd, id_dt_cool
1904 integer :: i_target_out, j_target_out
1905 integer :: istart, iend, jstart, jend
1907 integer(esmf_kind_i8),
allocatable :: idata_one_tile(:,:)
1909 real(kind=4),
allocatable :: lsoil_data(:), x_data(:), y_data(:)
1910 real(kind=8),
allocatable :: dum2d(:,:), dum3d(:,:,:)
1911 real(kind=4) :: times
1912 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
1913 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
1917 i_target_out = i_target-(2*halo)
1918 j_target_out = j_target-(2*halo)
1922 iend = i_target - halo
1923 jend = j_target - halo
1925 allocate(lsoil_data(lsoil_target))
1926 do i = 1, lsoil_target
1927 lsoil_data(i) = float(i)
1930 allocate(x_data(i_target_out))
1931 do i = 1, i_target_out
1932 x_data(i) = float(i)
1935 allocate(y_data(j_target_out))
1936 do i = 1, j_target_out
1937 y_data(i) = float(i)
1940 if (convert_nst)
then
1941 print*,
'- WRITE FV3 SURFACE AND NST DATA TO NETCDF FILE'
1943 print*,
'- WRITE FV3 SURFACE DATA TO NETCDF FILE'
1946 if (localpet == 0)
then
1947 allocate(data_one_tile(i_target,j_target))
1948 allocate(data_one_tile_3d(i_target,j_target,lsoil_target))
1949 allocate(idata_one_tile(i_target,j_target))
1950 allocate(dum2d(i_target_out,j_target_out))
1951 allocate(dum3d(i_target_out,j_target_out,lsoil_target))
1953 allocate(data_one_tile(0,0))
1954 allocate(data_one_tile_3d(0,0,0))
1955 allocate(idata_one_tile(0,0))
1956 allocate(dum2d(0,0))
1957 allocate(dum3d(0,0,0))
1960 tile_loop :
do tile = 1, num_tiles_target_grid
1962 local_pet :
if (localpet == 0)
then
1964 if (regional > 0)
then
1965 outfile =
"out.sfc.tile7.nc"
1967 WRITE(outfile,
'(A, I1, A)')
'out.sfc.tile', tile,
'.nc'
1971 error = nf90_create(outfile, ior(nf90_netcdf4,nf90_classic_model), &
1972 ncid, initialsize=initial, chunksize=fsize)
1973 call
netcdf_err(error,
'CREATING FILE='//trim(outfile) )
1976 error = nf90_def_dim(ncid,
'xaxis_1', i_target_out, dim_x)
1977 call
netcdf_err(error,
'DEFINING XAXIS DIMENSION' )
1978 error = nf90_def_dim(ncid,
'yaxis_1', j_target_out, dim_y)
1979 call
netcdf_err(error,
'DEFINING YAXIS DIMENSION' )
1980 error = nf90_def_dim(ncid,
'zaxis_1', lsoil_target, dim_lsoil)
1981 call
netcdf_err(error,
'DEFINING ZAXIS DIMENSION' )
1982 error = nf90_def_dim(ncid,
'Time', 1, dim_time)
1983 call
netcdf_err(error,
'DEFINING TIME DIMENSION' )
1986 error = nf90_def_var(ncid,
'xaxis_1', nf90_float, (/dim_x/), id_x)
1987 call
netcdf_err(error,
'DEFINING XAXIS_1 FIELD' )
1988 error = nf90_put_att(ncid, id_x,
"long_name",
"xaxis_1")
1989 call
netcdf_err(error,
'DEFINING XAXIS_1 LONG NAME' )
1990 error = nf90_put_att(ncid, id_x,
"units",
"none")
1991 call
netcdf_err(error,
'DEFINING XAXIS_1 UNITS' )
1992 error = nf90_put_att(ncid, id_x,
"cartesian_axis",
"X")
1993 call
netcdf_err(error,
'WRITING XAXIS_1 FIELD' )
1995 error = nf90_def_var(ncid,
'yaxis_1', nf90_float, (/dim_y/), id_y)
1996 call
netcdf_err(error,
'DEFINING YAXIS_1 FIELD' )
1997 error = nf90_put_att(ncid, id_y,
"long_name",
"yaxis_1")
1998 call
netcdf_err(error,
'DEFINING YAXIS_1 LONG NAME' )
1999 error = nf90_put_att(ncid, id_y,
"units",
"none")
2000 call
netcdf_err(error,
'DEFINING YAXIS_1 UNITS' )
2001 error = nf90_put_att(ncid, id_y,
"cartesian_axis",
"Y")
2002 call
netcdf_err(error,
'WRITING YAXIS_1 FIELD' )
2004 error = nf90_def_var(ncid,
'zaxis_1', nf90_float, (/dim_lsoil/), id_lsoil)
2005 call
netcdf_err(error,
'DEFINING ZAXIS_1 FIELD' )
2006 error = nf90_put_att(ncid, id_lsoil,
"long_name",
"zaxis_1")
2007 call
netcdf_err(error,
'DEFINING ZAXIS_1 LONG NAME' )
2008 error = nf90_put_att(ncid, id_lsoil,
"units",
"none")
2009 call
netcdf_err(error,
'DEFINING ZAXIS_1 UNITS' )
2010 error = nf90_put_att(ncid, id_lsoil,
"cartesian_axis",
"Z")
2011 call
netcdf_err(error,
'WRITING ZAXIS_1 FIELD' )
2013 error = nf90_def_var(ncid,
'Time', nf90_float, dim_time, id_time)
2014 call
netcdf_err(error,
'DEFINING TIME FIELD' )
2015 error = nf90_put_att(ncid, id_time,
"long_name",
"Time")
2016 call
netcdf_err(error,
'DEFINING TIME LONG NAME' )
2017 error = nf90_put_att(ncid, id_time,
"units",
"time level")
2018 call
netcdf_err(error,
'DEFINING TIME UNITS' )
2019 error = nf90_put_att(ncid, id_time,
"cartesian_axis",
"T")
2020 call
netcdf_err(error,
'WRITING TIME FIELD' )
2022 error = nf90_def_var(ncid,
'geolon', nf90_double, (/dim_x,dim_y/), id_lon)
2024 error = nf90_put_att(ncid, id_lon,
"long_name",
"Longitude")
2025 call
netcdf_err(error,
'DEFINING GEOLON LONG NAME' )
2026 error = nf90_put_att(ncid, id_lon,
"units",
"degrees_east")
2027 call
netcdf_err(error,
'DEFINING GEOLON UNITS' )
2029 error = nf90_def_var(ncid,
'geolat', nf90_double, (/dim_x,dim_y/), id_lat)
2031 error = nf90_put_att(ncid, id_lat,
"long_name",
"Latitude")
2032 call
netcdf_err(error,
'DEFINING GEOLAT LONG NAME' )
2033 error = nf90_put_att(ncid, id_lat,
"units",
"degrees_north")
2034 call
netcdf_err(error,
'DEFINING GEOLAT UNITS' )
2036 error = nf90_def_var(ncid,
'slmsk', nf90_double, (/dim_x,dim_y,dim_time/), id_slmsk)
2038 error = nf90_put_att(ncid, id_slmsk,
"long_name",
"slmsk")
2039 call
netcdf_err(error,
'DEFINING SLMSK LONG NAME' )
2040 error = nf90_put_att(ncid, id_slmsk,
"units",
"none")
2041 call
netcdf_err(error,
'DEFINING SLMSK UNITS' )
2042 error = nf90_put_att(ncid, id_slmsk,
"coordinates",
"geolon geolat")
2043 call
netcdf_err(error,
'DEFINING SLMSK COORD' )
2045 error = nf90_def_var(ncid,
'tsea', nf90_double, (/dim_x,dim_y,dim_time/), id_tsea)
2047 error = nf90_put_att(ncid, id_tsea,
"long_name",
"tsea")
2048 call
netcdf_err(error,
'DEFINING TSEA LONG NAME' )
2049 error = nf90_put_att(ncid, id_tsea,
"units",
"none")
2050 call
netcdf_err(error,
'DEFINING TSEA UNITS' )
2051 error = nf90_put_att(ncid, id_tsea,
"coordinates",
"geolon geolat")
2052 call
netcdf_err(error,
'DEFINING TSEA COORD' )
2054 error = nf90_def_var(ncid,
'sheleg', nf90_double, (/dim_x,dim_y,dim_time/), id_sheleg)
2056 error = nf90_put_att(ncid, id_sheleg,
"long_name",
"sheleg")
2057 call
netcdf_err(error,
'DEFINING SHELEG LONG NAME' )
2058 error = nf90_put_att(ncid, id_sheleg,
"units",
"none")
2059 call
netcdf_err(error,
'DEFINING SHELEG UNITS' )
2060 error = nf90_put_att(ncid, id_sheleg,
"coordinates",
"geolon geolat")
2061 call
netcdf_err(error,
'DEFINING SHELEG COORD' )
2063 error = nf90_def_var(ncid,
'tg3', nf90_double, (/dim_x,dim_y,dim_time/), id_tg3)
2065 error = nf90_put_att(ncid, id_tg3,
"long_name",
"tg3")
2066 call
netcdf_err(error,
'DEFINING TG3 LONG NAME' )
2067 error = nf90_put_att(ncid, id_tg3,
"units",
"none")
2068 call
netcdf_err(error,
'DEFINING TG3 UNITS' )
2069 error = nf90_put_att(ncid, id_tg3,
"coordinates",
"geolon geolat")
2070 call
netcdf_err(error,
'DEFINING TG3 COORD' )
2072 error = nf90_def_var(ncid,
'zorl', nf90_double, (/dim_x,dim_y,dim_time/), id_zorl)
2074 error = nf90_put_att(ncid, id_zorl,
"long_name",
"zorl")
2075 call
netcdf_err(error,
'DEFINING ZORL LONG NAME' )
2076 error = nf90_put_att(ncid, id_zorl,
"units",
"none")
2077 call
netcdf_err(error,
'DEFINING ZORL UNITS' )
2078 error = nf90_put_att(ncid, id_zorl,
"coordinates",
"geolon geolat")
2079 call
netcdf_err(error,
'DEFINING ZORL COORD' )
2081 error = nf90_def_var(ncid,
'alvsf', nf90_double, (/dim_x,dim_y,dim_time/), id_alvsf)
2083 error = nf90_put_att(ncid, id_alvsf,
"long_name",
"alvsf")
2084 call
netcdf_err(error,
'DEFINING ALVSF LONG NAME' )
2085 error = nf90_put_att(ncid, id_alvsf,
"units",
"none")
2086 call
netcdf_err(error,
'DEFINING ALVSF UNITS' )
2087 error = nf90_put_att(ncid, id_alvsf,
"coordinates",
"geolon geolat")
2088 call
netcdf_err(error,
'DEFINING ALVSF COORD' )
2090 error = nf90_def_var(ncid,
'alvwf', nf90_double, (/dim_x,dim_y,dim_time/), id_alvwf)
2092 error = nf90_put_att(ncid, id_alvwf,
"long_name",
"alvwf")
2093 call
netcdf_err(error,
'DEFINING ALVWF LONG NAME' )
2094 error = nf90_put_att(ncid, id_alvwf,
"units",
"none")
2095 call
netcdf_err(error,
'DEFINING ALVWF UNITS' )
2096 error = nf90_put_att(ncid, id_alvwf,
"coordinates",
"geolon geolat")
2097 call
netcdf_err(error,
'DEFINING ALVWF COORD' )
2099 error = nf90_def_var(ncid,
'alnsf', nf90_double, (/dim_x,dim_y,dim_time/), id_alnsf)
2101 error = nf90_put_att(ncid, id_alnsf,
"long_name",
"alnsf")
2102 call
netcdf_err(error,
'DEFINING ALNSF LONG NAME' )
2103 error = nf90_put_att(ncid, id_alnsf,
"units",
"none")
2104 call
netcdf_err(error,
'DEFINING ALNSF UNITS' )
2105 error = nf90_put_att(ncid, id_alnsf,
"coordinates",
"geolon geolat")
2106 call
netcdf_err(error,
'DEFINING ALNSF COORD' )
2108 error = nf90_def_var(ncid,
'alnwf', nf90_double, (/dim_x,dim_y,dim_time/), id_alnwf)
2110 error = nf90_put_att(ncid, id_alnwf,
"long_name",
"alnwf")
2111 call
netcdf_err(error,
'DEFINING ALNWF LONG NAME' )
2112 error = nf90_put_att(ncid, id_alnwf,
"units",
"none")
2113 call
netcdf_err(error,
'DEFINING ALNWF UNITS' )
2114 error = nf90_put_att(ncid, id_alnwf,
"coordinates",
"geolon geolat")
2115 call
netcdf_err(error,
'DEFINING ALNWF COORD' )
2117 error = nf90_def_var(ncid,
'facsf', nf90_double, (/dim_x,dim_y,dim_time/), id_facsf)
2119 error = nf90_put_att(ncid, id_facsf,
"long_name",
"facsf")
2120 call
netcdf_err(error,
'DEFINING FACSF LONG NAME' )
2121 error = nf90_put_att(ncid, id_facsf,
"units",
"none")
2122 call
netcdf_err(error,
'DEFINING FACSF UNITS' )
2123 error = nf90_put_att(ncid, id_facsf,
"coordinates",
"geolon geolat")
2124 call
netcdf_err(error,
'DEFINING FACSF COORD' )
2126 error = nf90_def_var(ncid,
'facwf', nf90_double, (/dim_x,dim_y,dim_time/), id_facwf)
2128 error = nf90_put_att(ncid, id_facwf,
"long_name",
"facwf")
2129 call
netcdf_err(error,
'DEFINING FACWF LONG NAME' )
2130 error = nf90_put_att(ncid, id_facwf,
"units",
"none")
2131 call
netcdf_err(error,
'DEFINING FACWF UNITS' )
2132 error = nf90_put_att(ncid, id_facwf,
"coordinates",
"geolon geolat")
2133 call
netcdf_err(error,
'DEFINING FACWF COORD' )
2135 error = nf90_def_var(ncid,
'vfrac', nf90_double, (/dim_x,dim_y,dim_time/), id_vfrac)
2137 error = nf90_put_att(ncid, id_vfrac,
"long_name",
"vfrac")
2138 call
netcdf_err(error,
'DEFINING VFRAC LONG NAME' )
2139 error = nf90_put_att(ncid, id_vfrac,
"units",
"none")
2140 call
netcdf_err(error,
'DEFINING VFRAC UNITS' )
2141 error = nf90_put_att(ncid, id_vfrac,
"coordinates",
"geolon geolat")
2142 call
netcdf_err(error,
'DEFINING VFRAC COORD' )
2144 error = nf90_def_var(ncid,
'canopy', nf90_double, (/dim_x,dim_y,dim_time/), id_canopy)
2146 error = nf90_put_att(ncid, id_canopy,
"long_name",
"canopy")
2147 call
netcdf_err(error,
'DEFINING CANOPY LONG NAME' )
2148 error = nf90_put_att(ncid, id_canopy,
"units",
"none")
2149 call
netcdf_err(error,
'DEFINING CANOPY UNITS' )
2150 error = nf90_put_att(ncid, id_canopy,
"coordinates",
"geolon geolat")
2151 call
netcdf_err(error,
'DEFINING CANOPY COORD' )
2153 error = nf90_def_var(ncid,
'f10m', nf90_double, (/dim_x,dim_y,dim_time/), id_f10m)
2155 error = nf90_put_att(ncid, id_f10m,
"long_name",
"f10m")
2156 call
netcdf_err(error,
'DEFINING F10M LONG NAME' )
2157 error = nf90_put_att(ncid, id_f10m,
"units",
"none")
2158 call
netcdf_err(error,
'DEFINING F10M UNITS' )
2159 error = nf90_put_att(ncid, id_f10m,
"coordinates",
"geolon geolat")
2160 call
netcdf_err(error,
'DEFINING F10M COORD' )
2162 error = nf90_def_var(ncid,
't2m', nf90_double, (/dim_x,dim_y,dim_time/), id_t2m)
2164 error = nf90_put_att(ncid, id_t2m,
"long_name",
"t2m")
2165 call
netcdf_err(error,
'DEFINING T2M LONG NAME' )
2166 error = nf90_put_att(ncid, id_t2m,
"units",
"none")
2167 call
netcdf_err(error,
'DEFINING T2M UNITS' )
2168 error = nf90_put_att(ncid, id_t2m,
"coordinates",
"geolon geolat")
2169 call
netcdf_err(error,
'DEFINING T2M COORD' )
2171 error = nf90_def_var(ncid,
'q2m', nf90_double, (/dim_x,dim_y,dim_time/), id_q2m)
2173 error = nf90_put_att(ncid, id_q2m,
"long_name",
"q2m")
2174 call
netcdf_err(error,
'DEFINING Q2M LONG NAME' )
2175 error = nf90_put_att(ncid, id_q2m,
"units",
"none")
2176 call
netcdf_err(error,
'DEFINING Q2M UNITS' )
2177 error = nf90_put_att(ncid, id_q2m,
"coordinates",
"geolon geolat")
2178 call
netcdf_err(error,
'DEFINING Q2M COORD' )
2180 error = nf90_def_var(ncid,
'vtype', nf90_double, (/dim_x,dim_y,dim_time/), id_vtype)
2182 error = nf90_put_att(ncid, id_vtype,
"long_name",
"vtype")
2183 call
netcdf_err(error,
'DEFINING VTYPE LONG NAME' )
2184 error = nf90_put_att(ncid, id_vtype,
"units",
"none")
2185 call
netcdf_err(error,
'DEFINING VTYPE UNITS' )
2186 error = nf90_put_att(ncid, id_vtype,
"coordinates",
"geolon geolat")
2187 call
netcdf_err(error,
'DEFINING VTYPE COORD' )
2189 error = nf90_def_var(ncid,
'stype', nf90_double, (/dim_x,dim_y,dim_time/), id_stype)
2191 error = nf90_put_att(ncid, id_stype,
"long_name",
"stype")
2192 call
netcdf_err(error,
'DEFINING STYPE LONG NAME' )
2193 error = nf90_put_att(ncid, id_stype,
"units",
"none")
2194 call
netcdf_err(error,
'DEFINING STYPE UNITS' )
2195 error = nf90_put_att(ncid, id_stype,
"coordinates",
"geolon geolat")
2196 call
netcdf_err(error,
'DEFINING STYPE COORD' )
2198 error = nf90_def_var(ncid,
'uustar', nf90_double, (/dim_x,dim_y,dim_time/), id_uustar)
2200 error = nf90_put_att(ncid, id_uustar,
"long_name",
"uustar")
2201 call
netcdf_err(error,
'DEFINING UUSTAR LONG NAME' )
2202 error = nf90_put_att(ncid, id_uustar,
"units",
"none")
2203 call
netcdf_err(error,
'DEFINING UUSTAR UNITS' )
2204 error = nf90_put_att(ncid, id_uustar,
"coordinates",
"geolon geolat")
2205 call
netcdf_err(error,
'DEFINING UUSTAR COORD' )
2207 error = nf90_def_var(ncid,
'ffmm', nf90_double, (/dim_x,dim_y,dim_time/), id_ffmm)
2209 error = nf90_put_att(ncid, id_ffmm,
"long_name",
"ffmm")
2210 call
netcdf_err(error,
'DEFINING FFMM LONG NAME' )
2211 error = nf90_put_att(ncid, id_ffmm,
"units",
"none")
2212 call
netcdf_err(error,
'DEFINING FFMM UNITS' )
2213 error = nf90_put_att(ncid, id_ffmm,
"coordinates",
"geolon geolat")
2214 call
netcdf_err(error,
'DEFINING FFMM COORD' )
2216 error = nf90_def_var(ncid,
'ffhh', nf90_double, (/dim_x,dim_y,dim_time/), id_ffhh)
2218 error = nf90_put_att(ncid, id_ffhh,
"long_name",
"ffhh")
2219 call
netcdf_err(error,
'DEFINING FFHH LONG NAME' )
2220 error = nf90_put_att(ncid, id_ffhh,
"units",
"none")
2221 call
netcdf_err(error,
'DEFINING FFHH UNITS' )
2222 error = nf90_put_att(ncid, id_ffhh,
"coordinates",
"geolon geolat")
2223 call
netcdf_err(error,
'DEFINING FFHH COORD' )
2225 error = nf90_def_var(ncid,
'hice', nf90_double, (/dim_x,dim_y,dim_time/), id_hice)
2227 error = nf90_put_att(ncid, id_hice,
"long_name",
"hice")
2228 call
netcdf_err(error,
'DEFINING HICE LONG NAME' )
2229 error = nf90_put_att(ncid, id_hice,
"units",
"none")
2230 call
netcdf_err(error,
'DEFINING HICE UNITS' )
2231 error = nf90_put_att(ncid, id_hice,
"coordinates",
"geolon geolat")
2232 call
netcdf_err(error,
'DEFINING HICE COORD' )
2234 error = nf90_def_var(ncid,
'fice', nf90_double, (/dim_x,dim_y,dim_time/), id_fice)
2236 error = nf90_put_att(ncid, id_fice,
"long_name",
"fice")
2237 call
netcdf_err(error,
'DEFINING FICE LONG NAME' )
2238 error = nf90_put_att(ncid, id_fice,
"units",
"none")
2239 call
netcdf_err(error,
'DEFINING FICE UNITS' )
2240 error = nf90_put_att(ncid, id_fice,
"coordinates",
"geolon geolat")
2241 call
netcdf_err(error,
'DEFINING FICE COORD' )
2243 error = nf90_def_var(ncid,
'tisfc', nf90_double, (/dim_x,dim_y,dim_time/), id_tisfc)
2245 error = nf90_put_att(ncid, id_tisfc,
"long_name",
"tisfc")
2246 call
netcdf_err(error,
'DEFINING TISFC LONG NAME' )
2247 error = nf90_put_att(ncid, id_tisfc,
"units",
"none")
2248 call
netcdf_err(error,
'DEFINING TISFC UNITS' )
2249 error = nf90_put_att(ncid, id_tisfc,
"coordinates",
"geolon geolat")
2250 call
netcdf_err(error,
'DEFINING TISFC COORD' )
2252 error = nf90_def_var(ncid,
'tprcp', nf90_double, (/dim_x,dim_y,dim_time/), id_tprcp)
2254 error = nf90_put_att(ncid, id_tprcp,
"long_name",
"tprcp")
2255 call
netcdf_err(error,
'DEFINING TPRCP LONG NAME' )
2256 error = nf90_put_att(ncid, id_tprcp,
"units",
"none")
2257 call
netcdf_err(error,
'DEFINING TPRCP UNITS' )
2258 error = nf90_put_att(ncid, id_tprcp,
"coordinates",
"geolon geolat")
2259 call
netcdf_err(error,
'DEFINING TPRCP COORD' )
2261 error = nf90_def_var(ncid,
'srflag', nf90_double, (/dim_x,dim_y,dim_time/), id_srflag)
2263 error = nf90_put_att(ncid, id_srflag,
"long_name",
"srflag")
2264 call
netcdf_err(error,
'DEFINING SRFLAG LONG NAME' )
2265 error = nf90_put_att(ncid, id_srflag,
"units",
"none")
2266 call
netcdf_err(error,
'DEFINING SRFLAG UNITS' )
2267 error = nf90_put_att(ncid, id_srflag,
"coordinates",
"geolon geolat")
2268 call
netcdf_err(error,
'DEFINING SRFLAG COORD' )
2270 error = nf90_def_var(ncid,
'snwdph', nf90_double, (/dim_x,dim_y,dim_time/), id_snwdph)
2272 error = nf90_put_att(ncid, id_snwdph,
"long_name",
"snwdph")
2273 call
netcdf_err(error,
'DEFINING SNWDPH LONG NAME' )
2274 error = nf90_put_att(ncid, id_snwdph,
"units",
"none")
2275 call
netcdf_err(error,
'DEFINING SNWDPH UNITS' )
2276 error = nf90_put_att(ncid, id_snwdph,
"coordinates",
"geolon geolat")
2277 call
netcdf_err(error,
'DEFINING SNWDPH COORD' )
2279 error = nf90_def_var(ncid,
'shdmin', nf90_double, (/dim_x,dim_y,dim_time/), id_shdmin)
2281 error = nf90_put_att(ncid, id_shdmin,
"long_name",
"shdmin")
2282 call
netcdf_err(error,
'DEFINING SHDMIN LONG NAME' )
2283 error = nf90_put_att(ncid, id_shdmin,
"units",
"none")
2284 call
netcdf_err(error,
'DEFINING SHDMIN UNITS' )
2285 error = nf90_put_att(ncid, id_shdmin,
"coordinates",
"geolon geolat")
2286 call
netcdf_err(error,
'DEFINING SHDMIN COORD' )
2288 error = nf90_def_var(ncid,
'shdmax', nf90_double, (/dim_x,dim_y,dim_time/), id_shdmax)
2290 error = nf90_put_att(ncid, id_shdmax,
"long_name",
"shdmax")
2291 call
netcdf_err(error,
'DEFINING SHDMAX LONG NAME' )
2292 error = nf90_put_att(ncid, id_shdmax,
"units",
"none")
2293 call
netcdf_err(error,
'DEFINING SHDMAX UNITS' )
2294 error = nf90_put_att(ncid, id_shdmax,
"coordinates",
"geolon geolat")
2295 call
netcdf_err(error,
'DEFINING SHDMAX COORD' )
2297 error = nf90_def_var(ncid,
'slope', nf90_double, (/dim_x,dim_y,dim_time/), id_slope)
2299 error = nf90_put_att(ncid, id_slope,
"long_name",
"slope")
2300 call
netcdf_err(error,
'DEFINING SLOPE LONG NAME' )
2301 error = nf90_put_att(ncid, id_slope,
"units",
"none")
2302 call
netcdf_err(error,
'DEFINING SLOPE UNITS' )
2303 error = nf90_put_att(ncid, id_slope,
"coordinates",
"geolon geolat")
2304 call
netcdf_err(error,
'DEFINING SLOPE COORD' )
2306 error = nf90_def_var(ncid,
'snoalb', nf90_double, (/dim_x,dim_y,dim_time/), id_snoalb)
2308 error = nf90_put_att(ncid, id_snoalb,
"long_name",
"snoalb")
2309 call
netcdf_err(error,
'DEFINING SNOALB LONG NAME' )
2310 error = nf90_put_att(ncid, id_snoalb,
"units",
"none")
2311 call
netcdf_err(error,
'DEFINING SNOALB UNITS' )
2312 error = nf90_put_att(ncid, id_snoalb,
"coordinates",
"geolon geolat")
2313 call
netcdf_err(error,
'DEFINING SNOALB COORD' )
2315 if (.not. lai_from_climo)
then
2316 error = nf90_def_var(ncid,
'lai', nf90_double, (/dim_x,dim_y,dim_time/), id_lai)
2318 error = nf90_put_att(ncid, id_lai,
"long_name",
"lai")
2319 call
netcdf_err(error,
'DEFINING LAI LONG NAME' )
2320 error = nf90_put_att(ncid, id_lai,
"units",
"none")
2321 call
netcdf_err(error,
'DEFINING LAI UNITS' )
2322 error = nf90_put_att(ncid, id_lai,
"coordinates",
"geolon geolat")
2323 call
netcdf_err(error,
'DEFINING LAI COORD' )
2326 error = nf90_def_var(ncid,
'stc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_stc)
2328 error = nf90_put_att(ncid, id_stc,
"long_name",
"stc")
2329 call
netcdf_err(error,
'DEFINING STC LONG NAME' )
2330 error = nf90_put_att(ncid, id_stc,
"units",
"none")
2331 call
netcdf_err(error,
'DEFINING STC UNITS' )
2332 error = nf90_put_att(ncid, id_stc,
"coordinates",
"geolon geolat")
2333 call
netcdf_err(error,
'DEFINING STC COORD' )
2335 error = nf90_def_var(ncid,
'smc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_smc)
2337 error = nf90_put_att(ncid, id_smc,
"long_name",
"smc")
2338 call
netcdf_err(error,
'DEFINING SMC LONG NAME' )
2339 error = nf90_put_att(ncid, id_smc,
"units",
"none")
2340 call
netcdf_err(error,
'DEFINING SMC UNITS' )
2341 error = nf90_put_att(ncid, id_smc,
"coordinates",
"geolon geolat")
2342 call
netcdf_err(error,
'DEFINING SMC COORD' )
2344 error = nf90_def_var(ncid,
'slc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_slc)
2346 error = nf90_put_att(ncid, id_slc,
"long_name",
"slc")
2347 call
netcdf_err(error,
'DEFINING SLC LONG NAME' )
2348 error = nf90_put_att(ncid, id_slc,
"units",
"none")
2349 call
netcdf_err(error,
'DEFINING SLC UNITS' )
2350 error = nf90_put_att(ncid, id_slc,
"coordinates",
"geolon geolat")
2351 call
netcdf_err(error,
'DEFINING SLC COORD' )
2353 if (convert_nst)
then
2355 error = nf90_def_var(ncid,
'tref', nf90_double, (/dim_x,dim_y,dim_time/), id_tref)
2357 error = nf90_put_att(ncid, id_tref,
"long_name",
"tref")
2358 call
netcdf_err(error,
'DEFINING TREF LONG NAME' )
2359 error = nf90_put_att(ncid, id_tref,
"units",
"none")
2360 call
netcdf_err(error,
'DEFINING TREF UNITS' )
2361 error = nf90_put_att(ncid, id_tref,
"coordinates",
"geolon geolat")
2362 call
netcdf_err(error,
'DEFINING TREF COORD' )
2364 error = nf90_def_var(ncid,
'z_c', nf90_double, (/dim_x,dim_y,dim_time/), id_z_c)
2366 error = nf90_put_att(ncid, id_z_c,
"long_name",
"z_c")
2367 call
netcdf_err(error,
'DEFINING Z_C LONG NAME' )
2368 error = nf90_put_att(ncid, id_z_c,
"units",
"none")
2369 call
netcdf_err(error,
'DEFINING Z_C UNITS' )
2370 error = nf90_put_att(ncid, id_z_c,
"coordinates",
"geolon geolat")
2371 call
netcdf_err(error,
'DEFINING Z_C COORD' )
2373 error = nf90_def_var(ncid,
'c_0', nf90_double, (/dim_x,dim_y,dim_time/), id_c_0)
2375 error = nf90_put_att(ncid, id_c_0,
"long_name",
"c_0")
2376 call
netcdf_err(error,
'DEFINING C_0 LONG NAME' )
2377 error = nf90_put_att(ncid, id_c_0,
"units",
"none")
2378 call
netcdf_err(error,
'DEFINING C_0 UNITS' )
2379 error = nf90_put_att(ncid, id_c_0,
"coordinates",
"geolon geolat")
2380 call
netcdf_err(error,
'DEFINING C_0 COORD' )
2382 error = nf90_def_var(ncid,
'c_d', nf90_double, (/dim_x,dim_y,dim_time/), id_c_d)
2384 error = nf90_put_att(ncid, id_c_d,
"long_name",
"c_d")
2385 call
netcdf_err(error,
'DEFINING C_D LONG NAME' )
2386 error = nf90_put_att(ncid, id_c_d,
"units",
"none")
2387 call
netcdf_err(error,
'DEFINING C_D UNITS' )
2388 error = nf90_put_att(ncid, id_c_d,
"coordinates",
"geolon geolat")
2389 call
netcdf_err(error,
'DEFINING C_D COORD' )
2391 error = nf90_def_var(ncid,
'w_0', nf90_double, (/dim_x,dim_y,dim_time/), id_w_0)
2393 error = nf90_put_att(ncid, id_w_0,
"long_name",
"w_0")
2394 call
netcdf_err(error,
'DEFINING W_0 LONG NAME' )
2395 error = nf90_put_att(ncid, id_w_0,
"units",
"none")
2396 call
netcdf_err(error,
'DEFINING W_0 UNITS' )
2397 error = nf90_put_att(ncid, id_w_0,
"coordinates",
"geolon geolat")
2398 call
netcdf_err(error,
'DEFINING W_0 COORD' )
2400 error = nf90_def_var(ncid,
'w_d', nf90_double, (/dim_x,dim_y,dim_time/), id_w_d)
2402 error = nf90_put_att(ncid, id_w_d,
"long_name",
"w_d")
2403 call
netcdf_err(error,
'DEFINING W_D LONG NAME' )
2404 error = nf90_put_att(ncid, id_w_d,
"units",
"none")
2405 call
netcdf_err(error,
'DEFINING W_D UNITS' )
2406 error = nf90_put_att(ncid, id_w_d,
"coordinates",
"geolon geolat")
2407 call
netcdf_err(error,
'DEFINING W_D COORD' )
2409 error = nf90_def_var(ncid,
'xt', nf90_double, (/dim_x,dim_y,dim_time/), id_xt)
2411 error = nf90_put_att(ncid, id_xt,
"long_name",
"xt")
2412 call
netcdf_err(error,
'DEFINING XT LONG NAME' )
2413 error = nf90_put_att(ncid, id_xt,
"units",
"none")
2415 error = nf90_put_att(ncid, id_xt,
"coordinates",
"geolon geolat")
2418 error = nf90_def_var(ncid,
'xs', nf90_double, (/dim_x,dim_y,dim_time/), id_xs)
2420 error = nf90_put_att(ncid, id_xs,
"long_name",
"xs")
2421 call
netcdf_err(error,
'DEFINING XS LONG NAME' )
2422 error = nf90_put_att(ncid, id_xs,
"units",
"none")
2424 error = nf90_put_att(ncid, id_xs,
"coordinates",
"geolon geolat")
2427 error = nf90_def_var(ncid,
'xu', nf90_double, (/dim_x,dim_y,dim_time/), id_xu)
2429 error = nf90_put_att(ncid, id_xu,
"long_name",
"xu")
2430 call
netcdf_err(error,
'DEFINING XU LONG NAME' )
2431 error = nf90_put_att(ncid, id_xu,
"units",
"none")
2433 error = nf90_put_att(ncid, id_xu,
"coordinates",
"geolon geolat")
2436 error = nf90_def_var(ncid,
'xv', nf90_double, (/dim_x,dim_y,dim_time/), id_xv)
2438 error = nf90_put_att(ncid, id_xv,
"long_name",
"xv")
2439 call
netcdf_err(error,
'DEFINING XV LONG NAME' )
2440 error = nf90_put_att(ncid, id_xv,
"units",
"none")
2442 error = nf90_put_att(ncid, id_xv,
"coordinates",
"geolon geolat")
2445 error = nf90_def_var(ncid,
'xz', nf90_double, (/dim_x,dim_y,dim_time/), id_xz)
2447 error = nf90_put_att(ncid, id_xz,
"long_name",
"xz")
2448 call
netcdf_err(error,
'DEFINING XZ LONG NAME' )
2449 error = nf90_put_att(ncid, id_xz,
"units",
"none")
2451 error = nf90_put_att(ncid, id_xz,
"coordinates",
"geolon geolat")
2454 error = nf90_def_var(ncid,
'zm', nf90_double, (/dim_x,dim_y,dim_time/), id_zm)
2456 error = nf90_put_att(ncid, id_zm,
"long_name",
"zm")
2457 call
netcdf_err(error,
'DEFINING ZM LONG NAME' )
2458 error = nf90_put_att(ncid, id_zm,
"units",
"none")
2460 error = nf90_put_att(ncid, id_zm,
"coordinates",
"geolon geolat")
2463 error = nf90_def_var(ncid,
'xtts', nf90_double, (/dim_x,dim_y,dim_time/), id_xtts)
2465 error = nf90_put_att(ncid, id_xtts,
"long_name",
"xtts")
2466 call
netcdf_err(error,
'DEFINING XTTS LONG NAME' )
2467 error = nf90_put_att(ncid, id_xtts,
"units",
"none")
2468 call
netcdf_err(error,
'DEFINING XTTS UNITS' )
2469 error = nf90_put_att(ncid, id_xtts,
"coordinates",
"geolon geolat")
2470 call
netcdf_err(error,
'DEFINING XTTS COORD' )
2472 error = nf90_def_var(ncid,
'xzts', nf90_double, (/dim_x,dim_y,dim_time/), id_xzts)
2474 error = nf90_put_att(ncid, id_xzts,
"long_name",
"xzts")
2475 call
netcdf_err(error,
'DEFINING XZTS LONG NAME' )
2476 error = nf90_put_att(ncid, id_xzts,
"units",
"none")
2477 call
netcdf_err(error,
'DEFINING XZTS UNITS' )
2478 error = nf90_put_att(ncid, id_xzts,
"coordinates",
"geolon geolat")
2479 call
netcdf_err(error,
'DEFINING XZTS COORD' )
2481 error = nf90_def_var(ncid,
'd_conv', nf90_double, (/dim_x,dim_y,dim_time/), id_d_conv)
2483 error = nf90_put_att(ncid, id_d_conv,
"long_name",
"d_conv")
2484 call
netcdf_err(error,
'DEFINING D_CONV LONG NAME' )
2485 error = nf90_put_att(ncid, id_d_conv,
"units",
"none")
2486 call
netcdf_err(error,
'DEFINING D_CONV UNITS' )
2487 error = nf90_put_att(ncid, id_d_conv,
"coordinates",
"geolon geolat")
2488 call
netcdf_err(error,
'DEFINING D_CONV COORD' )
2490 error = nf90_def_var(ncid,
'ifd', nf90_double, (/dim_x,dim_y,dim_time/), id_ifd)
2492 error = nf90_put_att(ncid, id_ifd,
"long_name",
"ifd")
2493 call
netcdf_err(error,
'DEFINING IFD LONG NAME' )
2494 error = nf90_put_att(ncid, id_ifd,
"units",
"none")
2495 call
netcdf_err(error,
'DEFINING IFD UNITS' )
2496 error = nf90_put_att(ncid, id_ifd,
"coordinates",
"geolon geolat")
2497 call
netcdf_err(error,
'DEFINING IFD COORD' )
2499 error = nf90_def_var(ncid,
'dt_cool', nf90_double, (/dim_x,dim_y,dim_time/), id_dt_cool)
2501 error = nf90_put_att(ncid, id_dt_cool,
"long_name",
"dt_cool")
2502 call
netcdf_err(error,
'DEFINING DT_COOL LONG NAME' )
2503 error = nf90_put_att(ncid, id_dt_cool,
"units",
"none")
2504 call
netcdf_err(error,
'DEFINING DT_COOL UNITS' )
2505 error = nf90_put_att(ncid, id_dt_cool,
"coordinates",
"geolon geolat")
2506 call
netcdf_err(error,
'DEFINING DT_COOL COORD' )
2508 error = nf90_def_var(ncid,
'qrain', nf90_double, (/dim_x,dim_y,dim_time/), id_qrain)
2510 error = nf90_put_att(ncid, id_qrain,
"long_name",
"qrain")
2511 call
netcdf_err(error,
'DEFINING QRAIN LONG NAME' )
2512 error = nf90_put_att(ncid, id_qrain,
"units",
"none")
2513 call
netcdf_err(error,
'DEFINING QRAIN UNITS' )
2514 error = nf90_put_att(ncid, id_qrain,
"coordinates",
"geolon geolat")
2515 call
netcdf_err(error,
'DEFINING QRAIN COORD' )
2519 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
2524 if (localpet == 0)
then
2525 error = nf90_put_var( ncid, id_lsoil, lsoil_data)
2526 call
netcdf_err(error,
'WRITING ZAXIS RECORD' )
2527 error = nf90_put_var( ncid, id_x, x_data)
2528 call
netcdf_err(error,
'WRITING XAXIS RECORD' )
2529 error = nf90_put_var( ncid, id_y, y_data)
2530 call
netcdf_err(error,
'WRITING YAXIS RECORD' )
2532 error = nf90_put_var( ncid, id_time, times)
2533 call
netcdf_err(error,
'WRITING TIME RECORD' )
2536 print*,
"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile
2537 call esmf_fieldgather(latitude_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2538 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2541 if (localpet == 0)
then
2542 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2543 error = nf90_put_var( ncid, id_lat, dum2d)
2544 call
netcdf_err(error,
'WRITING LATITUDE RECORD' )
2547 print*,
"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile
2548 call esmf_fieldgather(longitude_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2549 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2552 if (localpet == 0)
then
2553 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2554 error = nf90_put_var( ncid, id_lon, dum2d)
2555 call
netcdf_err(error,
'WRITING LONGITUDE RECORD' )
2558 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV FOR TILE: ", tile
2559 call esmf_fieldgather(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2560 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2563 if (localpet == 0)
then
2564 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2565 error = nf90_put_var( ncid, id_sheleg, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2566 call
netcdf_err(error,
'WRITING SNOW LIQ EQUIV RECORD' )
2569 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH FOR TILE: ", tile
2570 call esmf_fieldgather(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2571 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2574 if (localpet == 0)
then
2575 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2576 error = nf90_put_var( ncid, id_snwdph, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2577 call
netcdf_err(error,
'WRITING SNWDPH RECORD' )
2580 print*,
"- CALL FieldGather FOR TARGET GRID SLOPE TYPE FOR TILE: ", tile
2581 call esmf_fieldgather(slope_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2582 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2585 if (localpet == 0)
then
2586 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2587 error = nf90_put_var( ncid, id_slope, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2588 call
netcdf_err(error,
'WRITING SLOPE RECORD' )
2591 print*,
"- CALL FieldGather FOR TARGET GRID Z0 FOR TILE: ", tile
2592 call esmf_fieldgather(z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2593 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2596 if (localpet == 0)
then
2597 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2598 error = nf90_put_var( ncid, id_zorl, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2602 print*,
"- CALL FieldGather FOR TARGET GRID MAX SNOW ALBEDO FOR TILE: ", tile
2603 call esmf_fieldgather(mxsno_albedo_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2604 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2607 if (localpet == 0)
then
2608 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2609 error = nf90_put_var( ncid, id_snoalb, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2610 call
netcdf_err(error,
'WRITING MAX SNOW ALBEDO RECORD' )
2613 if (.not. lai_from_climo)
then
2614 print*,
"- CALL FieldGather FOR TARGET GRID LEAF AREA INDEX FOR TILE: ", tile
2615 call esmf_fieldgather(lai_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2616 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2619 if (localpet == 0)
then
2620 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2621 error = nf90_put_var( ncid, id_lai, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2622 call
netcdf_err(error,
'WRITING LEAF AREA INDEX RECORD' )
2626 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TYPE FOR TILE: ", tile
2627 call esmf_fieldgather(soil_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2628 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2631 if (localpet == 0)
then
2632 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2633 error = nf90_put_var( ncid, id_stype, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2634 call
netcdf_err(error,
'WRITING SOIL TYPE RECORD' )
2637 print*,
"- CALL FieldGather FOR TARGET GRID VEGETATION TYPE FOR TILE: ", tile
2638 call esmf_fieldgather(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2639 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2642 if (localpet == 0)
then
2643 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2644 error = nf90_put_var( ncid, id_vtype, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2645 call
netcdf_err(error,
'WRITING VEGETATION TYPE RECORD' )
2648 print*,
"- CALL FieldGather FOR TARGET GRID VEGETATION GREENNESS FOR TILE: ", tile
2649 call esmf_fieldgather(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2650 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2653 if (localpet == 0)
then
2654 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2655 error = nf90_put_var( ncid, id_vfrac, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2656 call
netcdf_err(error,
'WRITING VEGETATION GREENNESS RECORD' )
2659 print*,
"- CALL FieldGather FOR TARGET GRID SUBSTRATE TEMPERATURE FOR TILE: ", tile
2660 call esmf_fieldgather(substrate_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2661 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2664 if (localpet == 0)
then
2665 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2666 error = nf90_put_var( ncid, id_tg3, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2667 call
netcdf_err(error,
'WRITING SUBSTRATE TEMPERATURE RECORD' )
2670 print*,
"- CALL FieldGather FOR TARGET GRID FACSF FOR TILE: ", tile
2671 call esmf_fieldgather(facsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2672 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2675 if (localpet == 0)
then
2676 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2677 error = nf90_put_var( ncid, id_facsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2678 call
netcdf_err(error,
'WRITING FACSF RECORD' )
2681 print*,
"- CALL FieldGather FOR TARGET GRID FACWF FOR TILE: ", tile
2682 call esmf_fieldgather(facwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2683 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2686 if (localpet == 0)
then
2687 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2688 error = nf90_put_var( ncid, id_facwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2689 call
netcdf_err(error,
'WRITING FACWF RECORD' )
2692 print*,
"- CALL FieldGather FOR TARGET GRID ALNSF FOR TILE: ", tile
2693 call esmf_fieldgather(alnsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2694 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2697 if (localpet == 0)
then
2698 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2699 error = nf90_put_var( ncid, id_alnsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2700 call
netcdf_err(error,
'WRITING ALNSF RECORD' )
2703 print*,
"- CALL FieldGather FOR TARGET GRID ALNWF FOR TILE: ", tile
2704 call esmf_fieldgather(alnwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2705 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2708 if (localpet == 0)
then
2709 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2710 error = nf90_put_var( ncid, id_alnwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2711 call
netcdf_err(error,
'WRITING ALNWF RECORD' )
2714 print*,
"- CALL FieldGather FOR TARGET GRID ALVSF FOR TILE: ", tile
2715 call esmf_fieldgather(alvsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2716 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2719 if (localpet == 0)
then
2720 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2721 error = nf90_put_var( ncid, id_alvsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2722 call
netcdf_err(error,
'WRITING ALVSF RECORD' )
2725 print*,
"- CALL FieldGather FOR TARGET GRID ALVWF FOR TILE: ", tile
2726 call esmf_fieldgather(alvwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2727 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2730 if (localpet == 0)
then
2731 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2732 error = nf90_put_var( ncid, id_alvwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2733 call
netcdf_err(error,
'WRITING ALVWF RECORD' )
2736 print*,
"- CALL FieldGather FOR TARGET GRID MAX VEGETATION GREENNESS FOR TILE: ", tile
2737 call esmf_fieldgather(max_veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2738 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2741 if (localpet == 0)
then
2742 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2743 error = nf90_put_var( ncid, id_shdmax, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2744 call
netcdf_err(error,
'WRITING MAX VEGETATION GREENNESS RECORD' )
2747 print*,
"- CALL FieldGather FOR TARGET GRID MIN VEGETATION GREENNESS FOR TILE: ", tile
2748 call esmf_fieldgather(min_veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2749 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2752 if (localpet == 0)
then
2753 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2754 error = nf90_put_var( ncid, id_shdmin, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2755 call
netcdf_err(error,
'WRITING MIN VEGETATION GREENNESS RECORD' )
2758 print*,
"- CALL FieldGather FOR TARGET GRID T2M FOR TILE: ", tile
2759 call esmf_fieldgather(t2m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2760 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2763 if (localpet == 0)
then
2764 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2765 error = nf90_put_var( ncid, id_t2m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2766 call
netcdf_err(error,
'WRITING T2M RECORD' )
2769 print*,
"- CALL FieldGather FOR TARGET GRID Q2M FOR TILE: ", tile
2770 call esmf_fieldgather(q2m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2771 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2774 if (localpet == 0)
then
2775 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2776 error = nf90_put_var( ncid, id_q2m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2777 call
netcdf_err(error,
'WRITING Q2M RECORD' )
2780 print*,
"- CALL FieldGather FOR TARGET GRID TPRCP FOR TILE: ", tile
2781 call esmf_fieldgather(tprcp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2782 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2785 if (localpet == 0)
then
2786 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2787 error = nf90_put_var( ncid, id_tprcp, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2788 call
netcdf_err(error,
'WRITING TPRCP RECORD' )
2791 print*,
"- CALL FieldGather FOR TARGET GRID F10M FOR TILE: ", tile
2792 call esmf_fieldgather(f10m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2793 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2796 if (localpet == 0)
then
2797 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2798 error = nf90_put_var( ncid, id_f10m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2799 call
netcdf_err(error,
'WRITING F10M RECORD' )
2802 print*,
"- CALL FieldGather FOR TARGET GRID FFMM FOR TILE: ", tile
2803 call esmf_fieldgather(ffmm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2804 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2807 if (localpet == 0)
then
2808 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2809 error = nf90_put_var( ncid, id_ffmm, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2810 call
netcdf_err(error,
'WRITING FFMM RECORD' )
2812 error = nf90_put_var( ncid, id_ffhh, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2813 call
netcdf_err(error,
'WRITING FFHH RECORD' )
2816 print*,
"- CALL FieldGather FOR TARGET GRID USTAR FOR TILE: ", tile
2817 call esmf_fieldgather(ustar_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2818 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2821 if (localpet == 0)
then
2822 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2823 error = nf90_put_var( ncid, id_uustar, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2824 call
netcdf_err(error,
'WRITING USTAR RECORD' )
2827 print*,
"- CALL FieldGather FOR TARGET GRID SRFLAG FOR TILE: ", tile
2828 call esmf_fieldgather(srflag_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2829 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2832 if (localpet == 0)
then
2833 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2834 error = nf90_put_var( ncid, id_srflag, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2835 call
netcdf_err(error,
'WRITING SRFLAG RECORD' )
2838 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE FRACTION FOR TILE: ", tile
2839 call esmf_fieldgather(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2840 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2843 if (localpet == 0)
then
2844 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2845 error = nf90_put_var( ncid, id_fice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2846 call
netcdf_err(error,
'WRITING FICE RECORD' )
2849 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE DEPTH FOR TILE: ", tile
2850 call esmf_fieldgather(seaice_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2851 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2854 if (localpet == 0)
then
2855 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2856 error = nf90_put_var( ncid, id_hice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2857 call
netcdf_err(error,
'WRITING HICE RECORD' )
2860 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE SKIN TEMP FOR TILE: ", tile
2861 call esmf_fieldgather(seaice_skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2862 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2865 if (localpet == 0)
then
2866 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2867 error = nf90_put_var( ncid, id_tisfc, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2868 call
netcdf_err(error,
'WRITING TISFC RECORD' )
2871 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMP FOR TILE: ", tile
2872 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2873 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2876 if (localpet == 0)
then
2877 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2878 error = nf90_put_var( ncid, id_tsea, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2879 call
netcdf_err(error,
'WRITING TSEA RECORD' )
2882 print*,
"- CALL FieldGather FOR TARGET GRID LANDMASK FOR TILE: ", tile
2883 call esmf_fieldgather(landmask_target_grid, idata_one_tile, rootpet=0, tile=tile, rc=error)
2884 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2887 if (localpet == 0)
then
2888 dum2d(:,:) = float(idata_one_tile(istart:iend, jstart:jend))
2889 error = nf90_put_var( ncid, id_slmsk, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2890 call
netcdf_err(error,
'WRITING LANDMASK RECORD' )
2893 print*,
"- CALL FieldGather FOR TARGET GRID CANOPY MOISTURE CONTENT FOR TILE: ", tile
2894 call esmf_fieldgather(canopy_mc_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2895 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2898 if (localpet == 0)
then
2899 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2900 error = nf90_put_var( ncid, id_canopy, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2901 call
netcdf_err(error,
'WRITING CANOPY MC RECORD' )
2906 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE FOR TILE: ", tile
2907 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
2908 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2911 if (localpet == 0)
then
2912 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2913 error = nf90_put_var( ncid, id_stc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,lsoil_target,1/))
2914 call
netcdf_err(error,
'WRITING SOIL TEMP RECORD' )
2919 print*,
"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE FOR TILE: ", tile
2920 call esmf_fieldgather(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
2921 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2924 if (localpet == 0)
then
2925 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2926 error = nf90_put_var( ncid, id_smc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,lsoil_target,1/))
2927 call
netcdf_err(error,
'WRITING TOTAL SOIL MOISTURE RECORD' )
2932 print*,
"- CALL FieldGather FOR TARGET GRID LIQUID SOIL MOISTURE FOR TILE: ", tile
2933 call esmf_fieldgather(soilm_liq_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
2934 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2937 if (localpet == 0)
then
2938 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2939 error = nf90_put_var( ncid, id_slc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,lsoil_target,1/))
2940 call
netcdf_err(error,
'WRITING LIQUID SOIL MOISTURE RECORD' )
2943 if (convert_nst)
then
2945 print*,
"- CALL FieldGather FOR TARGET C_D FOR TILE: ", tile
2946 call esmf_fieldgather(c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2947 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2950 if (localpet == 0)
then
2951 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2952 error = nf90_put_var( ncid, id_c_d, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2953 call
netcdf_err(error,
'WRITING C_D RECORD' )
2956 print*,
"- CALL FieldGather FOR TARGET C_0 FOR TILE: ", tile
2957 call esmf_fieldgather(c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2958 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2961 if (localpet == 0)
then
2962 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2963 error = nf90_put_var( ncid, id_c_0, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2964 call
netcdf_err(error,
'WRITING C_0 RECORD' )
2967 print*,
"- CALL FieldGather FOR TARGET D_CONV FOR TILE: ", tile
2968 call esmf_fieldgather(d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2969 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2972 if (localpet == 0)
then
2973 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2974 error = nf90_put_var( ncid, id_d_conv, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2975 call
netcdf_err(error,
'WRITING D_CONV RECORD' )
2978 print*,
"- CALL FieldGather FOR TARGET DT_COOL FOR TILE: ", tile
2979 call esmf_fieldgather(dt_cool_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2980 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2983 if (localpet == 0)
then
2984 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2985 error = nf90_put_var( ncid, id_dt_cool, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2986 call
netcdf_err(error,
'WRITING DT_COOL RECORD' )
2989 print*,
"- CALL FieldGather FOR TARGET IFD FOR TILE: ", tile
2990 call esmf_fieldgather(ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2991 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2994 if (localpet == 0)
then
2995 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2996 error = nf90_put_var( ncid, id_ifd, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2997 call
netcdf_err(error,
'WRITING IFD RECORD' )
3000 print*,
"- CALL FieldGather FOR TARGET QRAIN FOR TILE: ", tile
3001 call esmf_fieldgather(qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3002 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3005 if (localpet == 0)
then
3006 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3007 error = nf90_put_var( ncid, id_qrain, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3008 call
netcdf_err(error,
'WRITING QRAIN RECORD' )
3011 print*,
"- CALL FieldGather FOR TARGET TREF FOR TILE: ", tile
3012 call esmf_fieldgather(tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3013 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3016 if (localpet == 0)
then
3017 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3018 error = nf90_put_var( ncid, id_tref, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3019 call
netcdf_err(error,
'WRITING TREF RECORD' )
3022 print*,
"- CALL FieldGather FOR TARGET W_D FOR TILE: ", tile
3023 call esmf_fieldgather(w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3024 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3027 if (localpet == 0)
then
3028 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3029 error = nf90_put_var( ncid, id_w_d, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3030 call
netcdf_err(error,
'WRITING W_D RECORD' )
3033 print*,
"- CALL FieldGather FOR TARGET W_0 FOR TILE: ", tile
3034 call esmf_fieldgather(w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3035 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3038 if (localpet == 0)
then
3039 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3040 error = nf90_put_var( ncid, id_w_0, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3041 call
netcdf_err(error,
'WRITING W_0 RECORD' )
3044 print*,
"- CALL FieldGather FOR TARGET XS FOR TILE: ", tile
3045 call esmf_fieldgather(xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3046 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3049 if (localpet == 0)
then
3050 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3051 error = nf90_put_var( ncid, id_xs, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3055 print*,
"- CALL FieldGather FOR TARGET XT FOR TILE: ", tile
3056 call esmf_fieldgather(xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3057 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3060 if (localpet == 0)
then
3061 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3062 error = nf90_put_var( ncid, id_xt, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3066 print*,
"- CALL FieldGather FOR TARGET XU FOR TILE: ", tile
3067 call esmf_fieldgather(xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3068 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3071 if (localpet == 0)
then
3072 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3073 error = nf90_put_var( ncid, id_xu, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3077 print*,
"- CALL FieldGather FOR TARGET XV FOR TILE: ", tile
3078 call esmf_fieldgather(xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3079 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3082 if (localpet == 0)
then
3083 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3084 error = nf90_put_var( ncid, id_xv, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3088 print*,
"- CALL FieldGather FOR TARGET XZ FOR TILE: ", tile
3089 call esmf_fieldgather(xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3090 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3093 if (localpet == 0)
then
3094 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3095 error = nf90_put_var( ncid, id_xz, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3099 print*,
"- CALL FieldGather FOR TARGET XTTS FOR TILE: ", tile
3100 call esmf_fieldgather(xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3101 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3104 if (localpet == 0)
then
3105 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3106 error = nf90_put_var( ncid, id_xtts, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3107 call
netcdf_err(error,
'WRITING XTTS RECORD' )
3110 print*,
"- CALL FieldGather FOR TARGET XZTS FOR TILE: ", tile
3111 call esmf_fieldgather(xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3112 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3115 if (localpet == 0)
then
3116 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3117 error = nf90_put_var( ncid, id_xzts, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3118 call
netcdf_err(error,
'WRITING XZTS RECORD' )
3121 print*,
"- CALL FieldGather FOR TARGET Z_C FOR TILE: ", tile
3122 call esmf_fieldgather(z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3123 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3126 if (localpet == 0)
then
3127 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3128 error = nf90_put_var( ncid, id_z_c, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3129 call
netcdf_err(error,
'WRITING Z_C RECORD' )
3132 print*,
"- CALL FieldGather FOR TARGET ZM FOR TILE: ", tile
3133 call esmf_fieldgather(zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3134 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3137 if (localpet == 0)
then
3138 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3139 error = nf90_put_var( ncid, id_zm, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3149 error = nf90_close(ncid)
3153 deallocate(lsoil_data, x_data, y_data)
3154 deallocate(data_one_tile, data_one_tile_3d, idata_one_tile, dum2d, dum3d)
subroutine write_fv3_atm_bndy_data_netcdf(localpet)
Writes atmospheric fields along the lateral boundary.
subroutine write_fv3_sfc_data_netcdf(localpet)
Writes surface and nst data into a 'coldstart' file (netcdf).
Process surface and nst fields.
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
Process atmospheric fields.
subroutine netcdf_err(err, string)
Error handler for netcdf.
subroutine write_fv3_atm_data_netcdf(localpet)
Write atmospheric coldstart files (netcdf format).
subroutine write_fv3_atm_header_netcdf(localpet)
Writes atmospheric header file in netcdf format.
subroutine error_handler(string, rc)
General error handler.
This module contains code to read the setup namelist file, handle the varmap file for GRIB2 data...
Reads static surface climatological data for the target FV3 grid (such as soil type and vegetation ty...