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 if (localpet==0) print*,
"write to file tracer ", trim(tracers(n))
1403 error = nf90_def_var(ncid, tracers(n), nf90_float, (/dim_lon,dim_lat,dim_lev/), id_tracers(n))
1405 error = nf90_put_att(ncid, id_tracers(n),
"coordinates",
"geolon geolat")
1406 call
netcdf_err(error,
'DEFINING TRACERS COORD' )
1409 if (use_thomp_mp_climo)
then
1410 error = nf90_def_var(ncid,
'ice_aero', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_qnifa)
1412 error = nf90_put_att(ncid, id_qnifa,
"coordinates",
"geolon geolat")
1413 call
netcdf_err(error,
'DEFINING QNIFA COORD' )
1415 error = nf90_def_var(ncid,
'liq_aero', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_qnwfa)
1417 error = nf90_put_att(ncid, id_qnwfa,
"coordinates",
"geolon geolat")
1418 call
netcdf_err(error,
'DEFINING QNWFA COORD' )
1421 error = nf90_def_var(ncid,
'u_w', nf90_float, (/dim_lonp,dim_lat,dim_lev/), id_u_w)
1423 error = nf90_put_att(ncid, id_u_w,
"coordinates",
"geolon_w geolat_w")
1424 call
netcdf_err(error,
'DEFINING U_W COORD' )
1426 error = nf90_def_var(ncid,
'v_w', nf90_float, (/dim_lonp,dim_lat,dim_lev/), id_v_w)
1428 error = nf90_put_att(ncid, id_v_w,
"coordinates",
"geolon_w geolat_w")
1429 call
netcdf_err(error,
'DEFINING V_W COORD' )
1431 error = nf90_def_var(ncid,
'u_s', nf90_float, (/dim_lon,dim_latp,dim_lev/), id_u_s)
1433 error = nf90_put_att(ncid, id_u_s,
"coordinates",
"geolon_s geolat_s")
1434 call
netcdf_err(error,
'DEFINING U_S COORD' )
1436 error = nf90_def_var(ncid,
'v_s', nf90_float, (/dim_lon,dim_latp,dim_lev/), id_v_s)
1438 error = nf90_put_att(ncid, id_v_s,
"coordinates",
"geolon_s geolat_s")
1439 call
netcdf_err(error,
'DEFINING V_S COORD' )
1441 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
1448 do tile = 1, num_tiles_target_grid
1449 print*,
"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile
1450 call esmf_fieldgather(longitude_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1451 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1455 if (localpet < num_tiles_target_grid)
then
1456 dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end)
1457 error = nf90_put_var( ncid, id_lon, dum2d)
1458 call
netcdf_err(error,
'WRITING LONGITUDE RECORD' )
1463 do tile = 1, num_tiles_target_grid
1464 print*,
"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile
1465 call esmf_fieldgather(latitude_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1466 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1470 if (localpet < num_tiles_target_grid)
then
1471 dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end)
1472 error = nf90_put_var( ncid, id_lat, dum2d)
1473 call
netcdf_err(error,
'WRITING LATITUDE RECORD' )
1478 do tile = 1, num_tiles_target_grid
1479 print*,
"- CALL FieldGather FOR TARGET GRID SURFACE PRESSURE FOR TILE: ", tile
1480 call esmf_fieldgather(ps_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1481 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1485 if (localpet < num_tiles_target_grid)
then
1486 dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end)
1487 error = nf90_put_var( ncid, id_ps, dum2d)
1488 call
netcdf_err(error,
'WRITING SURFACE PRESSURE RECORD' )
1491 deallocate(dum2d, data_one_tile)
1495 if (localpet < num_tiles_target_grid)
then
1496 allocate(dum3d(i_target_out,j_target_out,levp1_target))
1497 allocate(data_one_tile_3d(i_target,j_target,levp1_target))
1499 allocate(dum3d(0,0,0))
1500 allocate(data_one_tile_3d(0,0,0))
1503 do tile = 1, num_tiles_target_grid
1504 print*,
"- CALL FieldGather FOR TARGET GRID HEIGHT FOR TILE: ", tile
1505 call esmf_fieldgather(zh_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1506 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1510 if (localpet < num_tiles_target_grid)
then
1511 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1512 dum3d(:,:,1:levp1_target) = dum3d(:,:,levp1_target:1:-1)
1513 error = nf90_put_var( ncid, id_zh, dum3d)
1514 call
netcdf_err(error,
'WRITING HEIGHT RECORD' )
1517 deallocate(dum3d, data_one_tile_3d)
1521 if (localpet < num_tiles_target_grid)
then
1522 allocate(dum3d(i_target_out,j_target_out,lev_target))
1523 allocate(data_one_tile_3d(i_target,j_target,lev_target))
1525 allocate(dum3d(0,0,0))
1526 allocate(data_one_tile_3d(0,0,0))
1529 do tile = 1, num_tiles_target_grid
1530 print*,
"- CALL FieldGather FOR TARGET GRID VERTICAL VELOCITY FOR TILE: ", tile
1531 call esmf_fieldgather(dzdt_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1532 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1536 if (localpet < num_tiles_target_grid)
then
1537 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1538 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1539 print*,
"MIN MAX W AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1540 error = nf90_put_var( ncid, id_w, dum3d)
1541 call
netcdf_err(error,
'WRITING VERTICAL VELOCITY RECORD' )
1546 do tile = 1, num_tiles_target_grid
1547 print*,
"- CALL FieldGather FOR TARGET GRID DELP FOR TILE: ", tile
1548 call esmf_fieldgather(delp_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1549 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1553 if (localpet < num_tiles_target_grid)
then
1554 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1555 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1556 error = nf90_put_var( ncid, id_delp, dum3d)
1557 call
netcdf_err(error,
'WRITING DELP RECORD' )
1562 do tile = 1, num_tiles_target_grid
1563 print*,
"- CALL FieldGather FOR TARGET GRID TEMPERATURE FOR TILE: ", tile
1564 call esmf_fieldgather(temp_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1565 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1569 if (localpet < num_tiles_target_grid)
then
1570 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1571 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1572 error = nf90_put_var( ncid, id_t, dum3d)
1573 call
netcdf_err(error,
'WRITING TEMPERTAURE RECORD' )
1578 do n = 1, num_tracers
1580 do tile = 1, num_tiles_target_grid
1581 print*,
"- CALL FieldGather FOR TARGET GRID TRACER ", trim(tracers(n)),
" TILE: ", tile
1582 call esmf_fieldgather(tracers_target_grid(n), data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1583 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1587 if (localpet < num_tiles_target_grid)
then
1588 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1589 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1590 error = nf90_put_var( ncid, id_tracers(n), dum3d)
1591 call
netcdf_err(error,
'WRITING TRACER RECORD' )
1598 if (use_thomp_mp_climo)
then
1599 do tile = 1, num_tiles_target_grid
1600 print*,
"- CALL FieldGather FOR TARGET GRID QNIFA FOR TILE: ", tile
1601 call esmf_fieldgather(qnifa_climo_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1602 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1606 if (localpet < num_tiles_target_grid)
then
1607 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1608 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1609 error = nf90_put_var( ncid, id_qnifa, dum3d)
1610 call
netcdf_err(error,
'WRITING QNIFA RECORD' )
1615 do tile = 1, num_tiles_target_grid
1616 print*,
"- CALL FieldGather FOR TARGET GRID QNWFA FOR TILE: ", tile
1617 call esmf_fieldgather(qnwfa_climo_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1618 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1622 if (localpet < num_tiles_target_grid)
then
1623 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1624 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1625 error = nf90_put_var( ncid, id_qnwfa, dum3d)
1626 call
netcdf_err(error,
'WRITING QNWFA RECORD' )
1630 deallocate(dum3d, data_one_tile_3d)
1634 if (localpet < num_tiles_target_grid)
then
1635 allocate(dum2d(i_target_out,jp1_target_out))
1636 allocate(data_one_tile(i_target,jp1_target))
1638 allocate(dum2d(0,0))
1639 allocate(data_one_tile(0,0))
1642 do tile = 1, num_tiles_target_grid
1643 print*,
"- CALL FieldGather FOR TARGET GRID LON_S FOR TILE: ", tile
1644 call esmf_fieldgather(longitude_s_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1645 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1649 if (localpet < num_tiles_target_grid)
then
1650 dum2d(:,:) = data_one_tile(i_start:i_end,j_start:jp1_end)
1651 error = nf90_put_var( ncid, id_lon_s, dum2d)
1652 call
netcdf_err(error,
'WRITING LON_S RECORD' )
1655 do tile = 1, num_tiles_target_grid
1656 print*,
"- CALL FieldGather FOR TARGET GRID LAT_S FOR TILE: ", tile
1657 call esmf_fieldgather(latitude_s_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1658 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1662 if (localpet < num_tiles_target_grid)
then
1663 dum2d(:,:) = data_one_tile(i_start:i_end,j_start:jp1_end)
1664 error = nf90_put_var( ncid, id_lat_s, dum2d)
1665 call
netcdf_err(error,
'WRITING LAT_S RECORD' )
1668 deallocate(dum2d, data_one_tile)
1672 if (localpet < num_tiles_target_grid)
then
1673 allocate(dum3d(i_target_out,jp1_target_out,lev_target))
1674 allocate(data_one_tile_3d(i_target,jp1_target,lev_target))
1676 allocate(dum3d(0,0,0))
1677 allocate(data_one_tile_3d(0,0,0))
1680 do tile = 1, num_tiles_target_grid
1681 print*,
"- CALL FieldGather FOR TARGET GRID U_S FOR TILE: ", tile
1682 call esmf_fieldgather(u_s_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1683 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1687 if (localpet < num_tiles_target_grid)
then
1688 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:jp1_end,:)
1689 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1690 print*,
"MIN MAX US AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1691 error = nf90_put_var( ncid, id_u_s, dum3d)
1692 call
netcdf_err(error,
'WRITING U_S RECORD' )
1697 do tile = 1, num_tiles_target_grid
1698 print*,
"- CALL FieldGather FOR TARGET GRID V_S FOR TILE: ", tile
1699 call esmf_fieldgather(v_s_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1700 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1704 if (localpet < num_tiles_target_grid)
then
1705 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:jp1_end,:)
1706 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1707 print*,
"MIN MAX VS AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1708 error = nf90_put_var( ncid, id_v_s, dum3d)
1709 call
netcdf_err(error,
'WRITING V_S RECORD' )
1712 deallocate(dum3d, data_one_tile_3d)
1716 if (localpet < num_tiles_target_grid)
then
1717 allocate(dum2d(ip1_target_out,j_target_out))
1718 allocate(data_one_tile(ip1_target,j_target))
1720 allocate(dum2d(0,0))
1721 allocate(data_one_tile(0,0))
1724 do tile = 1, num_tiles_target_grid
1725 print*,
"- CALL FieldGather FOR TARGET GRID LON_W FOR TILE: ", tile
1726 call esmf_fieldgather(longitude_w_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1727 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1731 if (localpet < num_tiles_target_grid)
then
1732 dum2d(:,:) = data_one_tile(i_start:ip1_end,j_start:j_end)
1733 error = nf90_put_var( ncid, id_lon_w, dum2d)
1734 call
netcdf_err(error,
'WRITING LON_W RECORD' )
1737 do tile = 1, num_tiles_target_grid
1738 print*,
"- CALL FieldGather FOR TARGET GRID LAT_W FOR TILE: ", tile
1739 call esmf_fieldgather(latitude_w_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1740 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1744 if (localpet < num_tiles_target_grid)
then
1745 dum2d(:,:) = data_one_tile(i_start:ip1_end,j_start:j_end)
1746 error = nf90_put_var( ncid, id_lat_w, dum2d)
1747 call
netcdf_err(error,
'WRITING LAT_W RECORD' )
1750 deallocate(dum2d, data_one_tile)
1754 if (localpet < num_tiles_target_grid)
then
1755 allocate(dum3d(ip1_target_out,j_target_out,lev_target))
1756 allocate(data_one_tile_3d(ip1_target,j_target,lev_target))
1758 allocate(dum3d(0,0,0))
1759 allocate(data_one_tile_3d(0,0,0))
1762 do tile = 1, num_tiles_target_grid
1763 print*,
"- CALL FieldGather FOR TARGET GRID U_W FOR TILE: ", tile
1764 call esmf_fieldgather(u_w_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1765 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1769 if (localpet < num_tiles_target_grid)
then
1770 dum3d(:,:,:) = data_one_tile_3d(i_start:ip1_end,j_start:j_end,:)
1771 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1772 print*,
"MIN MAX UW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1773 error = nf90_put_var( ncid, id_u_w, dum3d)
1774 call
netcdf_err(error,
'WRITING U_W RECORD' )
1779 do tile = 1, num_tiles_target_grid
1780 print*,
"- CALL FieldGather FOR TARGET GRID V_W FOR TILE: ", tile
1781 call esmf_fieldgather(v_w_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1782 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1786 if (localpet < num_tiles_target_grid)
then
1787 dum3d(:,:,:) = data_one_tile_3d(i_start:ip1_end,j_start:j_end,:)
1788 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1789 print*,
"MIN MAX VW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1790 error = nf90_put_var( ncid, id_v_w, dum3d)
1791 call
netcdf_err(error,
'WRITING V_W RECORD' )
1794 deallocate(dum3d, data_one_tile_3d, id_tracers)
1800 if (localpet < num_tiles_target_grid) error = nf90_close(ncid)
1813 use model_grid, only : num_tiles_target_grid, &
1814 landmask_target_grid, &
1815 latitude_target_grid, &
1816 longitude_target_grid, &
1817 i_target, j_target, lsoil_target
1820 regional, lai_from_climo
1822 use surface, only : canopy_mc_target_grid, &
1826 seaice_depth_target_grid, &
1827 seaice_fract_target_grid, &
1828 seaice_skin_temp_target_grid, &
1829 skin_temp_target_grid, &
1830 soil_temp_target_grid, &
1831 soilm_liq_target_grid, &
1832 soilm_tot_target_grid, &
1833 srflag_target_grid, &
1834 snow_liq_equiv_target_grid, &
1835 snow_depth_target_grid, &
1837 tprcp_target_grid, &
1838 ustar_target_grid, &
1843 d_conv_target_grid, &
1844 dt_cool_target_grid, &
1846 qrain_target_grid, &
1861 alnsf_target_grid, &
1862 alvwf_target_grid, &
1863 alnwf_target_grid, &
1864 facsf_target_grid, &
1865 facwf_target_grid, &
1866 max_veg_greenness_target_grid, &
1867 min_veg_greenness_target_grid, &
1868 mxsno_albedo_target_grid, &
1869 slope_type_target_grid, &
1870 soil_type_target_grid, &
1871 substrate_temp_target_grid, &
1872 veg_greenness_target_grid, &
1873 veg_type_target_grid
1877 integer,
intent(in) :: localpet
1878 character(len=128) :: outfile
1880 integer :: fsize=65536, initial = 0
1881 integer :: header_buffer_val = 16384
1882 integer :: dim_x, dim_y, dim_lsoil, dim_time
1883 integer :: error, i, ncid, tile
1884 integer :: id_x, id_y, id_lsoil
1885 integer :: id_slmsk, id_time
1886 integer :: id_lat, id_lon
1887 integer :: id_tsea, id_sheleg, id_tg3
1888 integer :: id_zorl, id_alvsf, id_alvwf
1889 integer :: id_alnsf, id_alnwf, id_vfrac
1890 integer :: id_canopy, id_f10m, id_t2m
1891 integer :: id_q2m, id_vtype, id_stype
1892 integer :: id_facsf, id_facwf, id_uustar
1893 integer :: id_ffmm, id_ffhh, id_hice
1894 integer :: id_fice, id_tisfc, id_tprcp
1895 integer :: id_srflag, id_snwdph, id_shdmin
1896 integer :: id_shdmax, id_slope, id_snoalb
1898 integer :: id_stc, id_smc, id_slc
1899 integer :: id_tref, id_z_c, id_c_0
1900 integer :: id_c_d, id_w_0, id_w_d
1901 integer :: id_xt, id_xs, id_xu, id_xv
1902 integer :: id_xz, id_zm, id_xtts, id_xzts
1903 integer :: id_d_conv, id_ifd, id_dt_cool
1905 integer :: i_target_out, j_target_out
1906 integer :: istart, iend, jstart, jend
1908 integer(esmf_kind_i8),
allocatable :: idata_one_tile(:,:)
1910 real(kind=4),
allocatable :: lsoil_data(:), x_data(:), y_data(:)
1911 real(kind=8),
allocatable :: dum2d(:,:), dum3d(:,:,:)
1912 real(kind=4) :: times
1913 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
1914 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
1918 i_target_out = i_target-(2*halo)
1919 j_target_out = j_target-(2*halo)
1923 iend = i_target - halo
1924 jend = j_target - halo
1926 allocate(lsoil_data(lsoil_target))
1927 do i = 1, lsoil_target
1928 lsoil_data(i) = float(i)
1931 allocate(x_data(i_target_out))
1932 do i = 1, i_target_out
1933 x_data(i) = float(i)
1936 allocate(y_data(j_target_out))
1937 do i = 1, j_target_out
1938 y_data(i) = float(i)
1941 if (convert_nst)
then
1942 print*,
'- WRITE FV3 SURFACE AND NST DATA TO NETCDF FILE'
1944 print*,
'- WRITE FV3 SURFACE DATA TO NETCDF FILE'
1947 if (localpet == 0)
then
1948 allocate(data_one_tile(i_target,j_target))
1949 allocate(data_one_tile_3d(i_target,j_target,lsoil_target))
1950 allocate(idata_one_tile(i_target,j_target))
1951 allocate(dum2d(i_target_out,j_target_out))
1952 allocate(dum3d(i_target_out,j_target_out,lsoil_target))
1954 allocate(data_one_tile(0,0))
1955 allocate(data_one_tile_3d(0,0,0))
1956 allocate(idata_one_tile(0,0))
1957 allocate(dum2d(0,0))
1958 allocate(dum3d(0,0,0))
1961 tile_loop :
do tile = 1, num_tiles_target_grid
1963 local_pet :
if (localpet == 0)
then
1965 if (regional > 0)
then
1966 outfile =
"out.sfc.tile7.nc"
1968 WRITE(outfile,
'(A, I1, A)')
'out.sfc.tile', tile,
'.nc'
1972 error = nf90_create(outfile, ior(nf90_netcdf4,nf90_classic_model), &
1973 ncid, initialsize=initial, chunksize=fsize)
1974 call
netcdf_err(error,
'CREATING FILE='//trim(outfile) )
1977 error = nf90_def_dim(ncid,
'xaxis_1', i_target_out, dim_x)
1978 call
netcdf_err(error,
'DEFINING XAXIS DIMENSION' )
1979 error = nf90_def_dim(ncid,
'yaxis_1', j_target_out, dim_y)
1980 call
netcdf_err(error,
'DEFINING YAXIS DIMENSION' )
1981 error = nf90_def_dim(ncid,
'zaxis_1', lsoil_target, dim_lsoil)
1982 call
netcdf_err(error,
'DEFINING ZAXIS DIMENSION' )
1983 error = nf90_def_dim(ncid,
'Time', 1, dim_time)
1984 call
netcdf_err(error,
'DEFINING TIME DIMENSION' )
1987 error = nf90_def_var(ncid,
'xaxis_1', nf90_float, (/dim_x/), id_x)
1988 call
netcdf_err(error,
'DEFINING XAXIS_1 FIELD' )
1989 error = nf90_put_att(ncid, id_x,
"long_name",
"xaxis_1")
1990 call
netcdf_err(error,
'DEFINING XAXIS_1 LONG NAME' )
1991 error = nf90_put_att(ncid, id_x,
"units",
"none")
1992 call
netcdf_err(error,
'DEFINING XAXIS_1 UNITS' )
1993 error = nf90_put_att(ncid, id_x,
"cartesian_axis",
"X")
1994 call
netcdf_err(error,
'WRITING XAXIS_1 FIELD' )
1996 error = nf90_def_var(ncid,
'yaxis_1', nf90_float, (/dim_y/), id_y)
1997 call
netcdf_err(error,
'DEFINING YAXIS_1 FIELD' )
1998 error = nf90_put_att(ncid, id_y,
"long_name",
"yaxis_1")
1999 call
netcdf_err(error,
'DEFINING YAXIS_1 LONG NAME' )
2000 error = nf90_put_att(ncid, id_y,
"units",
"none")
2001 call
netcdf_err(error,
'DEFINING YAXIS_1 UNITS' )
2002 error = nf90_put_att(ncid, id_y,
"cartesian_axis",
"Y")
2003 call
netcdf_err(error,
'WRITING YAXIS_1 FIELD' )
2005 error = nf90_def_var(ncid,
'zaxis_1', nf90_float, (/dim_lsoil/), id_lsoil)
2006 call
netcdf_err(error,
'DEFINING ZAXIS_1 FIELD' )
2007 error = nf90_put_att(ncid, id_lsoil,
"long_name",
"zaxis_1")
2008 call
netcdf_err(error,
'DEFINING ZAXIS_1 LONG NAME' )
2009 error = nf90_put_att(ncid, id_lsoil,
"units",
"none")
2010 call
netcdf_err(error,
'DEFINING ZAXIS_1 UNITS' )
2011 error = nf90_put_att(ncid, id_lsoil,
"cartesian_axis",
"Z")
2012 call
netcdf_err(error,
'WRITING ZAXIS_1 FIELD' )
2014 error = nf90_def_var(ncid,
'Time', nf90_float, dim_time, id_time)
2015 call
netcdf_err(error,
'DEFINING TIME FIELD' )
2016 error = nf90_put_att(ncid, id_time,
"long_name",
"Time")
2017 call
netcdf_err(error,
'DEFINING TIME LONG NAME' )
2018 error = nf90_put_att(ncid, id_time,
"units",
"time level")
2019 call
netcdf_err(error,
'DEFINING TIME UNITS' )
2020 error = nf90_put_att(ncid, id_time,
"cartesian_axis",
"T")
2021 call
netcdf_err(error,
'WRITING TIME FIELD' )
2023 error = nf90_def_var(ncid,
'geolon', nf90_double, (/dim_x,dim_y/), id_lon)
2025 error = nf90_put_att(ncid, id_lon,
"long_name",
"Longitude")
2026 call
netcdf_err(error,
'DEFINING GEOLON LONG NAME' )
2027 error = nf90_put_att(ncid, id_lon,
"units",
"degrees_east")
2028 call
netcdf_err(error,
'DEFINING GEOLON UNITS' )
2030 error = nf90_def_var(ncid,
'geolat', nf90_double, (/dim_x,dim_y/), id_lat)
2032 error = nf90_put_att(ncid, id_lat,
"long_name",
"Latitude")
2033 call
netcdf_err(error,
'DEFINING GEOLAT LONG NAME' )
2034 error = nf90_put_att(ncid, id_lat,
"units",
"degrees_north")
2035 call
netcdf_err(error,
'DEFINING GEOLAT UNITS' )
2037 error = nf90_def_var(ncid,
'slmsk', nf90_double, (/dim_x,dim_y,dim_time/), id_slmsk)
2039 error = nf90_put_att(ncid, id_slmsk,
"long_name",
"slmsk")
2040 call
netcdf_err(error,
'DEFINING SLMSK LONG NAME' )
2041 error = nf90_put_att(ncid, id_slmsk,
"units",
"none")
2042 call
netcdf_err(error,
'DEFINING SLMSK UNITS' )
2043 error = nf90_put_att(ncid, id_slmsk,
"coordinates",
"geolon geolat")
2044 call
netcdf_err(error,
'DEFINING SLMSK COORD' )
2046 error = nf90_def_var(ncid,
'tsea', nf90_double, (/dim_x,dim_y,dim_time/), id_tsea)
2048 error = nf90_put_att(ncid, id_tsea,
"long_name",
"tsea")
2049 call
netcdf_err(error,
'DEFINING TSEA LONG NAME' )
2050 error = nf90_put_att(ncid, id_tsea,
"units",
"none")
2051 call
netcdf_err(error,
'DEFINING TSEA UNITS' )
2052 error = nf90_put_att(ncid, id_tsea,
"coordinates",
"geolon geolat")
2053 call
netcdf_err(error,
'DEFINING TSEA COORD' )
2055 error = nf90_def_var(ncid,
'sheleg', nf90_double, (/dim_x,dim_y,dim_time/), id_sheleg)
2057 error = nf90_put_att(ncid, id_sheleg,
"long_name",
"sheleg")
2058 call
netcdf_err(error,
'DEFINING SHELEG LONG NAME' )
2059 error = nf90_put_att(ncid, id_sheleg,
"units",
"none")
2060 call
netcdf_err(error,
'DEFINING SHELEG UNITS' )
2061 error = nf90_put_att(ncid, id_sheleg,
"coordinates",
"geolon geolat")
2062 call
netcdf_err(error,
'DEFINING SHELEG COORD' )
2064 error = nf90_def_var(ncid,
'tg3', nf90_double, (/dim_x,dim_y,dim_time/), id_tg3)
2066 error = nf90_put_att(ncid, id_tg3,
"long_name",
"tg3")
2067 call
netcdf_err(error,
'DEFINING TG3 LONG NAME' )
2068 error = nf90_put_att(ncid, id_tg3,
"units",
"none")
2069 call
netcdf_err(error,
'DEFINING TG3 UNITS' )
2070 error = nf90_put_att(ncid, id_tg3,
"coordinates",
"geolon geolat")
2071 call
netcdf_err(error,
'DEFINING TG3 COORD' )
2073 error = nf90_def_var(ncid,
'zorl', nf90_double, (/dim_x,dim_y,dim_time/), id_zorl)
2075 error = nf90_put_att(ncid, id_zorl,
"long_name",
"zorl")
2076 call
netcdf_err(error,
'DEFINING ZORL LONG NAME' )
2077 error = nf90_put_att(ncid, id_zorl,
"units",
"none")
2078 call
netcdf_err(error,
'DEFINING ZORL UNITS' )
2079 error = nf90_put_att(ncid, id_zorl,
"coordinates",
"geolon geolat")
2080 call
netcdf_err(error,
'DEFINING ZORL COORD' )
2082 error = nf90_def_var(ncid,
'alvsf', nf90_double, (/dim_x,dim_y,dim_time/), id_alvsf)
2084 error = nf90_put_att(ncid, id_alvsf,
"long_name",
"alvsf")
2085 call
netcdf_err(error,
'DEFINING ALVSF LONG NAME' )
2086 error = nf90_put_att(ncid, id_alvsf,
"units",
"none")
2087 call
netcdf_err(error,
'DEFINING ALVSF UNITS' )
2088 error = nf90_put_att(ncid, id_alvsf,
"coordinates",
"geolon geolat")
2089 call
netcdf_err(error,
'DEFINING ALVSF COORD' )
2091 error = nf90_def_var(ncid,
'alvwf', nf90_double, (/dim_x,dim_y,dim_time/), id_alvwf)
2093 error = nf90_put_att(ncid, id_alvwf,
"long_name",
"alvwf")
2094 call
netcdf_err(error,
'DEFINING ALVWF LONG NAME' )
2095 error = nf90_put_att(ncid, id_alvwf,
"units",
"none")
2096 call
netcdf_err(error,
'DEFINING ALVWF UNITS' )
2097 error = nf90_put_att(ncid, id_alvwf,
"coordinates",
"geolon geolat")
2098 call
netcdf_err(error,
'DEFINING ALVWF COORD' )
2100 error = nf90_def_var(ncid,
'alnsf', nf90_double, (/dim_x,dim_y,dim_time/), id_alnsf)
2102 error = nf90_put_att(ncid, id_alnsf,
"long_name",
"alnsf")
2103 call
netcdf_err(error,
'DEFINING ALNSF LONG NAME' )
2104 error = nf90_put_att(ncid, id_alnsf,
"units",
"none")
2105 call
netcdf_err(error,
'DEFINING ALNSF UNITS' )
2106 error = nf90_put_att(ncid, id_alnsf,
"coordinates",
"geolon geolat")
2107 call
netcdf_err(error,
'DEFINING ALNSF COORD' )
2109 error = nf90_def_var(ncid,
'alnwf', nf90_double, (/dim_x,dim_y,dim_time/), id_alnwf)
2111 error = nf90_put_att(ncid, id_alnwf,
"long_name",
"alnwf")
2112 call
netcdf_err(error,
'DEFINING ALNWF LONG NAME' )
2113 error = nf90_put_att(ncid, id_alnwf,
"units",
"none")
2114 call
netcdf_err(error,
'DEFINING ALNWF UNITS' )
2115 error = nf90_put_att(ncid, id_alnwf,
"coordinates",
"geolon geolat")
2116 call
netcdf_err(error,
'DEFINING ALNWF COORD' )
2118 error = nf90_def_var(ncid,
'facsf', nf90_double, (/dim_x,dim_y,dim_time/), id_facsf)
2120 error = nf90_put_att(ncid, id_facsf,
"long_name",
"facsf")
2121 call
netcdf_err(error,
'DEFINING FACSF LONG NAME' )
2122 error = nf90_put_att(ncid, id_facsf,
"units",
"none")
2123 call
netcdf_err(error,
'DEFINING FACSF UNITS' )
2124 error = nf90_put_att(ncid, id_facsf,
"coordinates",
"geolon geolat")
2125 call
netcdf_err(error,
'DEFINING FACSF COORD' )
2127 error = nf90_def_var(ncid,
'facwf', nf90_double, (/dim_x,dim_y,dim_time/), id_facwf)
2129 error = nf90_put_att(ncid, id_facwf,
"long_name",
"facwf")
2130 call
netcdf_err(error,
'DEFINING FACWF LONG NAME' )
2131 error = nf90_put_att(ncid, id_facwf,
"units",
"none")
2132 call
netcdf_err(error,
'DEFINING FACWF UNITS' )
2133 error = nf90_put_att(ncid, id_facwf,
"coordinates",
"geolon geolat")
2134 call
netcdf_err(error,
'DEFINING FACWF COORD' )
2136 error = nf90_def_var(ncid,
'vfrac', nf90_double, (/dim_x,dim_y,dim_time/), id_vfrac)
2138 error = nf90_put_att(ncid, id_vfrac,
"long_name",
"vfrac")
2139 call
netcdf_err(error,
'DEFINING VFRAC LONG NAME' )
2140 error = nf90_put_att(ncid, id_vfrac,
"units",
"none")
2141 call
netcdf_err(error,
'DEFINING VFRAC UNITS' )
2142 error = nf90_put_att(ncid, id_vfrac,
"coordinates",
"geolon geolat")
2143 call
netcdf_err(error,
'DEFINING VFRAC COORD' )
2145 error = nf90_def_var(ncid,
'canopy', nf90_double, (/dim_x,dim_y,dim_time/), id_canopy)
2147 error = nf90_put_att(ncid, id_canopy,
"long_name",
"canopy")
2148 call
netcdf_err(error,
'DEFINING CANOPY LONG NAME' )
2149 error = nf90_put_att(ncid, id_canopy,
"units",
"none")
2150 call
netcdf_err(error,
'DEFINING CANOPY UNITS' )
2151 error = nf90_put_att(ncid, id_canopy,
"coordinates",
"geolon geolat")
2152 call
netcdf_err(error,
'DEFINING CANOPY COORD' )
2154 error = nf90_def_var(ncid,
'f10m', nf90_double, (/dim_x,dim_y,dim_time/), id_f10m)
2156 error = nf90_put_att(ncid, id_f10m,
"long_name",
"f10m")
2157 call
netcdf_err(error,
'DEFINING F10M LONG NAME' )
2158 error = nf90_put_att(ncid, id_f10m,
"units",
"none")
2159 call
netcdf_err(error,
'DEFINING F10M UNITS' )
2160 error = nf90_put_att(ncid, id_f10m,
"coordinates",
"geolon geolat")
2161 call
netcdf_err(error,
'DEFINING F10M COORD' )
2163 error = nf90_def_var(ncid,
't2m', nf90_double, (/dim_x,dim_y,dim_time/), id_t2m)
2165 error = nf90_put_att(ncid, id_t2m,
"long_name",
"t2m")
2166 call
netcdf_err(error,
'DEFINING T2M LONG NAME' )
2167 error = nf90_put_att(ncid, id_t2m,
"units",
"none")
2168 call
netcdf_err(error,
'DEFINING T2M UNITS' )
2169 error = nf90_put_att(ncid, id_t2m,
"coordinates",
"geolon geolat")
2170 call
netcdf_err(error,
'DEFINING T2M COORD' )
2172 error = nf90_def_var(ncid,
'q2m', nf90_double, (/dim_x,dim_y,dim_time/), id_q2m)
2174 error = nf90_put_att(ncid, id_q2m,
"long_name",
"q2m")
2175 call
netcdf_err(error,
'DEFINING Q2M LONG NAME' )
2176 error = nf90_put_att(ncid, id_q2m,
"units",
"none")
2177 call
netcdf_err(error,
'DEFINING Q2M UNITS' )
2178 error = nf90_put_att(ncid, id_q2m,
"coordinates",
"geolon geolat")
2179 call
netcdf_err(error,
'DEFINING Q2M COORD' )
2181 error = nf90_def_var(ncid,
'vtype', nf90_double, (/dim_x,dim_y,dim_time/), id_vtype)
2183 error = nf90_put_att(ncid, id_vtype,
"long_name",
"vtype")
2184 call
netcdf_err(error,
'DEFINING VTYPE LONG NAME' )
2185 error = nf90_put_att(ncid, id_vtype,
"units",
"none")
2186 call
netcdf_err(error,
'DEFINING VTYPE UNITS' )
2187 error = nf90_put_att(ncid, id_vtype,
"coordinates",
"geolon geolat")
2188 call
netcdf_err(error,
'DEFINING VTYPE COORD' )
2190 error = nf90_def_var(ncid,
'stype', nf90_double, (/dim_x,dim_y,dim_time/), id_stype)
2192 error = nf90_put_att(ncid, id_stype,
"long_name",
"stype")
2193 call
netcdf_err(error,
'DEFINING STYPE LONG NAME' )
2194 error = nf90_put_att(ncid, id_stype,
"units",
"none")
2195 call
netcdf_err(error,
'DEFINING STYPE UNITS' )
2196 error = nf90_put_att(ncid, id_stype,
"coordinates",
"geolon geolat")
2197 call
netcdf_err(error,
'DEFINING STYPE COORD' )
2199 error = nf90_def_var(ncid,
'uustar', nf90_double, (/dim_x,dim_y,dim_time/), id_uustar)
2201 error = nf90_put_att(ncid, id_uustar,
"long_name",
"uustar")
2202 call
netcdf_err(error,
'DEFINING UUSTAR LONG NAME' )
2203 error = nf90_put_att(ncid, id_uustar,
"units",
"none")
2204 call
netcdf_err(error,
'DEFINING UUSTAR UNITS' )
2205 error = nf90_put_att(ncid, id_uustar,
"coordinates",
"geolon geolat")
2206 call
netcdf_err(error,
'DEFINING UUSTAR COORD' )
2208 error = nf90_def_var(ncid,
'ffmm', nf90_double, (/dim_x,dim_y,dim_time/), id_ffmm)
2210 error = nf90_put_att(ncid, id_ffmm,
"long_name",
"ffmm")
2211 call
netcdf_err(error,
'DEFINING FFMM LONG NAME' )
2212 error = nf90_put_att(ncid, id_ffmm,
"units",
"none")
2213 call
netcdf_err(error,
'DEFINING FFMM UNITS' )
2214 error = nf90_put_att(ncid, id_ffmm,
"coordinates",
"geolon geolat")
2215 call
netcdf_err(error,
'DEFINING FFMM COORD' )
2217 error = nf90_def_var(ncid,
'ffhh', nf90_double, (/dim_x,dim_y,dim_time/), id_ffhh)
2219 error = nf90_put_att(ncid, id_ffhh,
"long_name",
"ffhh")
2220 call
netcdf_err(error,
'DEFINING FFHH LONG NAME' )
2221 error = nf90_put_att(ncid, id_ffhh,
"units",
"none")
2222 call
netcdf_err(error,
'DEFINING FFHH UNITS' )
2223 error = nf90_put_att(ncid, id_ffhh,
"coordinates",
"geolon geolat")
2224 call
netcdf_err(error,
'DEFINING FFHH COORD' )
2226 error = nf90_def_var(ncid,
'hice', nf90_double, (/dim_x,dim_y,dim_time/), id_hice)
2228 error = nf90_put_att(ncid, id_hice,
"long_name",
"hice")
2229 call
netcdf_err(error,
'DEFINING HICE LONG NAME' )
2230 error = nf90_put_att(ncid, id_hice,
"units",
"none")
2231 call
netcdf_err(error,
'DEFINING HICE UNITS' )
2232 error = nf90_put_att(ncid, id_hice,
"coordinates",
"geolon geolat")
2233 call
netcdf_err(error,
'DEFINING HICE COORD' )
2235 error = nf90_def_var(ncid,
'fice', nf90_double, (/dim_x,dim_y,dim_time/), id_fice)
2237 error = nf90_put_att(ncid, id_fice,
"long_name",
"fice")
2238 call
netcdf_err(error,
'DEFINING FICE LONG NAME' )
2239 error = nf90_put_att(ncid, id_fice,
"units",
"none")
2240 call
netcdf_err(error,
'DEFINING FICE UNITS' )
2241 error = nf90_put_att(ncid, id_fice,
"coordinates",
"geolon geolat")
2242 call
netcdf_err(error,
'DEFINING FICE COORD' )
2244 error = nf90_def_var(ncid,
'tisfc', nf90_double, (/dim_x,dim_y,dim_time/), id_tisfc)
2246 error = nf90_put_att(ncid, id_tisfc,
"long_name",
"tisfc")
2247 call
netcdf_err(error,
'DEFINING TISFC LONG NAME' )
2248 error = nf90_put_att(ncid, id_tisfc,
"units",
"none")
2249 call
netcdf_err(error,
'DEFINING TISFC UNITS' )
2250 error = nf90_put_att(ncid, id_tisfc,
"coordinates",
"geolon geolat")
2251 call
netcdf_err(error,
'DEFINING TISFC COORD' )
2253 error = nf90_def_var(ncid,
'tprcp', nf90_double, (/dim_x,dim_y,dim_time/), id_tprcp)
2255 error = nf90_put_att(ncid, id_tprcp,
"long_name",
"tprcp")
2256 call
netcdf_err(error,
'DEFINING TPRCP LONG NAME' )
2257 error = nf90_put_att(ncid, id_tprcp,
"units",
"none")
2258 call
netcdf_err(error,
'DEFINING TPRCP UNITS' )
2259 error = nf90_put_att(ncid, id_tprcp,
"coordinates",
"geolon geolat")
2260 call
netcdf_err(error,
'DEFINING TPRCP COORD' )
2262 error = nf90_def_var(ncid,
'srflag', nf90_double, (/dim_x,dim_y,dim_time/), id_srflag)
2264 error = nf90_put_att(ncid, id_srflag,
"long_name",
"srflag")
2265 call
netcdf_err(error,
'DEFINING SRFLAG LONG NAME' )
2266 error = nf90_put_att(ncid, id_srflag,
"units",
"none")
2267 call
netcdf_err(error,
'DEFINING SRFLAG UNITS' )
2268 error = nf90_put_att(ncid, id_srflag,
"coordinates",
"geolon geolat")
2269 call
netcdf_err(error,
'DEFINING SRFLAG COORD' )
2271 error = nf90_def_var(ncid,
'snwdph', nf90_double, (/dim_x,dim_y,dim_time/), id_snwdph)
2273 error = nf90_put_att(ncid, id_snwdph,
"long_name",
"snwdph")
2274 call
netcdf_err(error,
'DEFINING SNWDPH LONG NAME' )
2275 error = nf90_put_att(ncid, id_snwdph,
"units",
"none")
2276 call
netcdf_err(error,
'DEFINING SNWDPH UNITS' )
2277 error = nf90_put_att(ncid, id_snwdph,
"coordinates",
"geolon geolat")
2278 call
netcdf_err(error,
'DEFINING SNWDPH COORD' )
2280 error = nf90_def_var(ncid,
'shdmin', nf90_double, (/dim_x,dim_y,dim_time/), id_shdmin)
2282 error = nf90_put_att(ncid, id_shdmin,
"long_name",
"shdmin")
2283 call
netcdf_err(error,
'DEFINING SHDMIN LONG NAME' )
2284 error = nf90_put_att(ncid, id_shdmin,
"units",
"none")
2285 call
netcdf_err(error,
'DEFINING SHDMIN UNITS' )
2286 error = nf90_put_att(ncid, id_shdmin,
"coordinates",
"geolon geolat")
2287 call
netcdf_err(error,
'DEFINING SHDMIN COORD' )
2289 error = nf90_def_var(ncid,
'shdmax', nf90_double, (/dim_x,dim_y,dim_time/), id_shdmax)
2291 error = nf90_put_att(ncid, id_shdmax,
"long_name",
"shdmax")
2292 call
netcdf_err(error,
'DEFINING SHDMAX LONG NAME' )
2293 error = nf90_put_att(ncid, id_shdmax,
"units",
"none")
2294 call
netcdf_err(error,
'DEFINING SHDMAX UNITS' )
2295 error = nf90_put_att(ncid, id_shdmax,
"coordinates",
"geolon geolat")
2296 call
netcdf_err(error,
'DEFINING SHDMAX COORD' )
2298 error = nf90_def_var(ncid,
'slope', nf90_double, (/dim_x,dim_y,dim_time/), id_slope)
2300 error = nf90_put_att(ncid, id_slope,
"long_name",
"slope")
2301 call
netcdf_err(error,
'DEFINING SLOPE LONG NAME' )
2302 error = nf90_put_att(ncid, id_slope,
"units",
"none")
2303 call
netcdf_err(error,
'DEFINING SLOPE UNITS' )
2304 error = nf90_put_att(ncid, id_slope,
"coordinates",
"geolon geolat")
2305 call
netcdf_err(error,
'DEFINING SLOPE COORD' )
2307 error = nf90_def_var(ncid,
'snoalb', nf90_double, (/dim_x,dim_y,dim_time/), id_snoalb)
2309 error = nf90_put_att(ncid, id_snoalb,
"long_name",
"snoalb")
2310 call
netcdf_err(error,
'DEFINING SNOALB LONG NAME' )
2311 error = nf90_put_att(ncid, id_snoalb,
"units",
"none")
2312 call
netcdf_err(error,
'DEFINING SNOALB UNITS' )
2313 error = nf90_put_att(ncid, id_snoalb,
"coordinates",
"geolon geolat")
2314 call
netcdf_err(error,
'DEFINING SNOALB COORD' )
2316 if (.not. lai_from_climo)
then
2317 error = nf90_def_var(ncid,
'lai', nf90_double, (/dim_x,dim_y,dim_time/), id_lai)
2319 error = nf90_put_att(ncid, id_lai,
"long_name",
"lai")
2320 call
netcdf_err(error,
'DEFINING LAI LONG NAME' )
2321 error = nf90_put_att(ncid, id_lai,
"units",
"none")
2322 call
netcdf_err(error,
'DEFINING LAI UNITS' )
2323 error = nf90_put_att(ncid, id_lai,
"coordinates",
"geolon geolat")
2324 call
netcdf_err(error,
'DEFINING LAI COORD' )
2327 error = nf90_def_var(ncid,
'stc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_stc)
2329 error = nf90_put_att(ncid, id_stc,
"long_name",
"stc")
2330 call
netcdf_err(error,
'DEFINING STC LONG NAME' )
2331 error = nf90_put_att(ncid, id_stc,
"units",
"none")
2332 call
netcdf_err(error,
'DEFINING STC UNITS' )
2333 error = nf90_put_att(ncid, id_stc,
"coordinates",
"geolon geolat")
2334 call
netcdf_err(error,
'DEFINING STC COORD' )
2336 error = nf90_def_var(ncid,
'smc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_smc)
2338 error = nf90_put_att(ncid, id_smc,
"long_name",
"smc")
2339 call
netcdf_err(error,
'DEFINING SMC LONG NAME' )
2340 error = nf90_put_att(ncid, id_smc,
"units",
"none")
2341 call
netcdf_err(error,
'DEFINING SMC UNITS' )
2342 error = nf90_put_att(ncid, id_smc,
"coordinates",
"geolon geolat")
2343 call
netcdf_err(error,
'DEFINING SMC COORD' )
2345 error = nf90_def_var(ncid,
'slc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_slc)
2347 error = nf90_put_att(ncid, id_slc,
"long_name",
"slc")
2348 call
netcdf_err(error,
'DEFINING SLC LONG NAME' )
2349 error = nf90_put_att(ncid, id_slc,
"units",
"none")
2350 call
netcdf_err(error,
'DEFINING SLC UNITS' )
2351 error = nf90_put_att(ncid, id_slc,
"coordinates",
"geolon geolat")
2352 call
netcdf_err(error,
'DEFINING SLC COORD' )
2354 if (convert_nst)
then
2356 error = nf90_def_var(ncid,
'tref', nf90_double, (/dim_x,dim_y,dim_time/), id_tref)
2358 error = nf90_put_att(ncid, id_tref,
"long_name",
"tref")
2359 call
netcdf_err(error,
'DEFINING TREF LONG NAME' )
2360 error = nf90_put_att(ncid, id_tref,
"units",
"none")
2361 call
netcdf_err(error,
'DEFINING TREF UNITS' )
2362 error = nf90_put_att(ncid, id_tref,
"coordinates",
"geolon geolat")
2363 call
netcdf_err(error,
'DEFINING TREF COORD' )
2365 error = nf90_def_var(ncid,
'z_c', nf90_double, (/dim_x,dim_y,dim_time/), id_z_c)
2367 error = nf90_put_att(ncid, id_z_c,
"long_name",
"z_c")
2368 call
netcdf_err(error,
'DEFINING Z_C LONG NAME' )
2369 error = nf90_put_att(ncid, id_z_c,
"units",
"none")
2370 call
netcdf_err(error,
'DEFINING Z_C UNITS' )
2371 error = nf90_put_att(ncid, id_z_c,
"coordinates",
"geolon geolat")
2372 call
netcdf_err(error,
'DEFINING Z_C COORD' )
2374 error = nf90_def_var(ncid,
'c_0', nf90_double, (/dim_x,dim_y,dim_time/), id_c_0)
2376 error = nf90_put_att(ncid, id_c_0,
"long_name",
"c_0")
2377 call
netcdf_err(error,
'DEFINING C_0 LONG NAME' )
2378 error = nf90_put_att(ncid, id_c_0,
"units",
"none")
2379 call
netcdf_err(error,
'DEFINING C_0 UNITS' )
2380 error = nf90_put_att(ncid, id_c_0,
"coordinates",
"geolon geolat")
2381 call
netcdf_err(error,
'DEFINING C_0 COORD' )
2383 error = nf90_def_var(ncid,
'c_d', nf90_double, (/dim_x,dim_y,dim_time/), id_c_d)
2385 error = nf90_put_att(ncid, id_c_d,
"long_name",
"c_d")
2386 call
netcdf_err(error,
'DEFINING C_D LONG NAME' )
2387 error = nf90_put_att(ncid, id_c_d,
"units",
"none")
2388 call
netcdf_err(error,
'DEFINING C_D UNITS' )
2389 error = nf90_put_att(ncid, id_c_d,
"coordinates",
"geolon geolat")
2390 call
netcdf_err(error,
'DEFINING C_D COORD' )
2392 error = nf90_def_var(ncid,
'w_0', nf90_double, (/dim_x,dim_y,dim_time/), id_w_0)
2394 error = nf90_put_att(ncid, id_w_0,
"long_name",
"w_0")
2395 call
netcdf_err(error,
'DEFINING W_0 LONG NAME' )
2396 error = nf90_put_att(ncid, id_w_0,
"units",
"none")
2397 call
netcdf_err(error,
'DEFINING W_0 UNITS' )
2398 error = nf90_put_att(ncid, id_w_0,
"coordinates",
"geolon geolat")
2399 call
netcdf_err(error,
'DEFINING W_0 COORD' )
2401 error = nf90_def_var(ncid,
'w_d', nf90_double, (/dim_x,dim_y,dim_time/), id_w_d)
2403 error = nf90_put_att(ncid, id_w_d,
"long_name",
"w_d")
2404 call
netcdf_err(error,
'DEFINING W_D LONG NAME' )
2405 error = nf90_put_att(ncid, id_w_d,
"units",
"none")
2406 call
netcdf_err(error,
'DEFINING W_D UNITS' )
2407 error = nf90_put_att(ncid, id_w_d,
"coordinates",
"geolon geolat")
2408 call
netcdf_err(error,
'DEFINING W_D COORD' )
2410 error = nf90_def_var(ncid,
'xt', nf90_double, (/dim_x,dim_y,dim_time/), id_xt)
2412 error = nf90_put_att(ncid, id_xt,
"long_name",
"xt")
2413 call
netcdf_err(error,
'DEFINING XT LONG NAME' )
2414 error = nf90_put_att(ncid, id_xt,
"units",
"none")
2416 error = nf90_put_att(ncid, id_xt,
"coordinates",
"geolon geolat")
2419 error = nf90_def_var(ncid,
'xs', nf90_double, (/dim_x,dim_y,dim_time/), id_xs)
2421 error = nf90_put_att(ncid, id_xs,
"long_name",
"xs")
2422 call
netcdf_err(error,
'DEFINING XS LONG NAME' )
2423 error = nf90_put_att(ncid, id_xs,
"units",
"none")
2425 error = nf90_put_att(ncid, id_xs,
"coordinates",
"geolon geolat")
2428 error = nf90_def_var(ncid,
'xu', nf90_double, (/dim_x,dim_y,dim_time/), id_xu)
2430 error = nf90_put_att(ncid, id_xu,
"long_name",
"xu")
2431 call
netcdf_err(error,
'DEFINING XU LONG NAME' )
2432 error = nf90_put_att(ncid, id_xu,
"units",
"none")
2434 error = nf90_put_att(ncid, id_xu,
"coordinates",
"geolon geolat")
2437 error = nf90_def_var(ncid,
'xv', nf90_double, (/dim_x,dim_y,dim_time/), id_xv)
2439 error = nf90_put_att(ncid, id_xv,
"long_name",
"xv")
2440 call
netcdf_err(error,
'DEFINING XV LONG NAME' )
2441 error = nf90_put_att(ncid, id_xv,
"units",
"none")
2443 error = nf90_put_att(ncid, id_xv,
"coordinates",
"geolon geolat")
2446 error = nf90_def_var(ncid,
'xz', nf90_double, (/dim_x,dim_y,dim_time/), id_xz)
2448 error = nf90_put_att(ncid, id_xz,
"long_name",
"xz")
2449 call
netcdf_err(error,
'DEFINING XZ LONG NAME' )
2450 error = nf90_put_att(ncid, id_xz,
"units",
"none")
2452 error = nf90_put_att(ncid, id_xz,
"coordinates",
"geolon geolat")
2455 error = nf90_def_var(ncid,
'zm', nf90_double, (/dim_x,dim_y,dim_time/), id_zm)
2457 error = nf90_put_att(ncid, id_zm,
"long_name",
"zm")
2458 call
netcdf_err(error,
'DEFINING ZM LONG NAME' )
2459 error = nf90_put_att(ncid, id_zm,
"units",
"none")
2461 error = nf90_put_att(ncid, id_zm,
"coordinates",
"geolon geolat")
2464 error = nf90_def_var(ncid,
'xtts', nf90_double, (/dim_x,dim_y,dim_time/), id_xtts)
2466 error = nf90_put_att(ncid, id_xtts,
"long_name",
"xtts")
2467 call
netcdf_err(error,
'DEFINING XTTS LONG NAME' )
2468 error = nf90_put_att(ncid, id_xtts,
"units",
"none")
2469 call
netcdf_err(error,
'DEFINING XTTS UNITS' )
2470 error = nf90_put_att(ncid, id_xtts,
"coordinates",
"geolon geolat")
2471 call
netcdf_err(error,
'DEFINING XTTS COORD' )
2473 error = nf90_def_var(ncid,
'xzts', nf90_double, (/dim_x,dim_y,dim_time/), id_xzts)
2475 error = nf90_put_att(ncid, id_xzts,
"long_name",
"xzts")
2476 call
netcdf_err(error,
'DEFINING XZTS LONG NAME' )
2477 error = nf90_put_att(ncid, id_xzts,
"units",
"none")
2478 call
netcdf_err(error,
'DEFINING XZTS UNITS' )
2479 error = nf90_put_att(ncid, id_xzts,
"coordinates",
"geolon geolat")
2480 call
netcdf_err(error,
'DEFINING XZTS COORD' )
2482 error = nf90_def_var(ncid,
'd_conv', nf90_double, (/dim_x,dim_y,dim_time/), id_d_conv)
2484 error = nf90_put_att(ncid, id_d_conv,
"long_name",
"d_conv")
2485 call
netcdf_err(error,
'DEFINING D_CONV LONG NAME' )
2486 error = nf90_put_att(ncid, id_d_conv,
"units",
"none")
2487 call
netcdf_err(error,
'DEFINING D_CONV UNITS' )
2488 error = nf90_put_att(ncid, id_d_conv,
"coordinates",
"geolon geolat")
2489 call
netcdf_err(error,
'DEFINING D_CONV COORD' )
2491 error = nf90_def_var(ncid,
'ifd', nf90_double, (/dim_x,dim_y,dim_time/), id_ifd)
2493 error = nf90_put_att(ncid, id_ifd,
"long_name",
"ifd")
2494 call
netcdf_err(error,
'DEFINING IFD LONG NAME' )
2495 error = nf90_put_att(ncid, id_ifd,
"units",
"none")
2496 call
netcdf_err(error,
'DEFINING IFD UNITS' )
2497 error = nf90_put_att(ncid, id_ifd,
"coordinates",
"geolon geolat")
2498 call
netcdf_err(error,
'DEFINING IFD COORD' )
2500 error = nf90_def_var(ncid,
'dt_cool', nf90_double, (/dim_x,dim_y,dim_time/), id_dt_cool)
2502 error = nf90_put_att(ncid, id_dt_cool,
"long_name",
"dt_cool")
2503 call
netcdf_err(error,
'DEFINING DT_COOL LONG NAME' )
2504 error = nf90_put_att(ncid, id_dt_cool,
"units",
"none")
2505 call
netcdf_err(error,
'DEFINING DT_COOL UNITS' )
2506 error = nf90_put_att(ncid, id_dt_cool,
"coordinates",
"geolon geolat")
2507 call
netcdf_err(error,
'DEFINING DT_COOL COORD' )
2509 error = nf90_def_var(ncid,
'qrain', nf90_double, (/dim_x,dim_y,dim_time/), id_qrain)
2511 error = nf90_put_att(ncid, id_qrain,
"long_name",
"qrain")
2512 call
netcdf_err(error,
'DEFINING QRAIN LONG NAME' )
2513 error = nf90_put_att(ncid, id_qrain,
"units",
"none")
2514 call
netcdf_err(error,
'DEFINING QRAIN UNITS' )
2515 error = nf90_put_att(ncid, id_qrain,
"coordinates",
"geolon geolat")
2516 call
netcdf_err(error,
'DEFINING QRAIN COORD' )
2520 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
2525 if (localpet == 0)
then
2526 error = nf90_put_var( ncid, id_lsoil, lsoil_data)
2527 call
netcdf_err(error,
'WRITING ZAXIS RECORD' )
2528 error = nf90_put_var( ncid, id_x, x_data)
2529 call
netcdf_err(error,
'WRITING XAXIS RECORD' )
2530 error = nf90_put_var( ncid, id_y, y_data)
2531 call
netcdf_err(error,
'WRITING YAXIS RECORD' )
2533 error = nf90_put_var( ncid, id_time, times)
2534 call
netcdf_err(error,
'WRITING TIME RECORD' )
2537 print*,
"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile
2538 call esmf_fieldgather(latitude_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2539 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2542 if (localpet == 0)
then
2543 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2544 error = nf90_put_var( ncid, id_lat, dum2d)
2545 call
netcdf_err(error,
'WRITING LATITUDE RECORD' )
2548 print*,
"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile
2549 call esmf_fieldgather(longitude_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2550 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2553 if (localpet == 0)
then
2554 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2555 error = nf90_put_var( ncid, id_lon, dum2d)
2556 call
netcdf_err(error,
'WRITING LONGITUDE RECORD' )
2559 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV FOR TILE: ", tile
2560 call esmf_fieldgather(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2561 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2564 if (localpet == 0)
then
2565 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2566 error = nf90_put_var( ncid, id_sheleg, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2567 call
netcdf_err(error,
'WRITING SNOW LIQ EQUIV RECORD' )
2570 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH FOR TILE: ", tile
2571 call esmf_fieldgather(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2572 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2575 if (localpet == 0)
then
2576 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2577 error = nf90_put_var( ncid, id_snwdph, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2578 call
netcdf_err(error,
'WRITING SNWDPH RECORD' )
2581 print*,
"- CALL FieldGather FOR TARGET GRID SLOPE TYPE FOR TILE: ", tile
2582 call esmf_fieldgather(slope_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2583 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2586 if (localpet == 0)
then
2587 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2588 error = nf90_put_var( ncid, id_slope, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2589 call
netcdf_err(error,
'WRITING SLOPE RECORD' )
2592 print*,
"- CALL FieldGather FOR TARGET GRID Z0 FOR TILE: ", tile
2593 call esmf_fieldgather(z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2594 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2597 if (localpet == 0)
then
2598 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2599 error = nf90_put_var( ncid, id_zorl, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2603 print*,
"- CALL FieldGather FOR TARGET GRID MAX SNOW ALBEDO FOR TILE: ", tile
2604 call esmf_fieldgather(mxsno_albedo_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2605 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2608 if (localpet == 0)
then
2609 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2610 error = nf90_put_var( ncid, id_snoalb, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2611 call
netcdf_err(error,
'WRITING MAX SNOW ALBEDO RECORD' )
2614 if (.not. lai_from_climo)
then
2615 print*,
"- CALL FieldGather FOR TARGET GRID LEAF AREA INDEX FOR TILE: ", tile
2616 call esmf_fieldgather(lai_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2617 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2620 if (localpet == 0)
then
2621 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2622 error = nf90_put_var( ncid, id_lai, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2623 call
netcdf_err(error,
'WRITING LEAF AREA INDEX RECORD' )
2627 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TYPE FOR TILE: ", tile
2628 call esmf_fieldgather(soil_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2629 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2632 if (localpet == 0)
then
2633 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2634 error = nf90_put_var( ncid, id_stype, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2635 call
netcdf_err(error,
'WRITING SOIL TYPE RECORD' )
2638 print*,
"- CALL FieldGather FOR TARGET GRID VEGETATION TYPE FOR TILE: ", tile
2639 call esmf_fieldgather(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2640 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2643 if (localpet == 0)
then
2644 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2645 error = nf90_put_var( ncid, id_vtype, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2646 call
netcdf_err(error,
'WRITING VEGETATION TYPE RECORD' )
2649 print*,
"- CALL FieldGather FOR TARGET GRID VEGETATION GREENNESS FOR TILE: ", tile
2650 call esmf_fieldgather(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2651 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2654 if (localpet == 0)
then
2655 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2656 error = nf90_put_var( ncid, id_vfrac, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2657 call
netcdf_err(error,
'WRITING VEGETATION GREENNESS RECORD' )
2660 print*,
"- CALL FieldGather FOR TARGET GRID SUBSTRATE TEMPERATURE FOR TILE: ", tile
2661 call esmf_fieldgather(substrate_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2662 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2665 if (localpet == 0)
then
2666 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2667 error = nf90_put_var( ncid, id_tg3, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2668 call
netcdf_err(error,
'WRITING SUBSTRATE TEMPERATURE RECORD' )
2671 print*,
"- CALL FieldGather FOR TARGET GRID FACSF FOR TILE: ", tile
2672 call esmf_fieldgather(facsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2673 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2676 if (localpet == 0)
then
2677 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2678 error = nf90_put_var( ncid, id_facsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2679 call
netcdf_err(error,
'WRITING FACSF RECORD' )
2682 print*,
"- CALL FieldGather FOR TARGET GRID FACWF FOR TILE: ", tile
2683 call esmf_fieldgather(facwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2684 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2687 if (localpet == 0)
then
2688 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2689 error = nf90_put_var( ncid, id_facwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2690 call
netcdf_err(error,
'WRITING FACWF RECORD' )
2693 print*,
"- CALL FieldGather FOR TARGET GRID ALNSF FOR TILE: ", tile
2694 call esmf_fieldgather(alnsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2695 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2698 if (localpet == 0)
then
2699 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2700 error = nf90_put_var( ncid, id_alnsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2701 call
netcdf_err(error,
'WRITING ALNSF RECORD' )
2704 print*,
"- CALL FieldGather FOR TARGET GRID ALNWF FOR TILE: ", tile
2705 call esmf_fieldgather(alnwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2706 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2709 if (localpet == 0)
then
2710 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2711 error = nf90_put_var( ncid, id_alnwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2712 call
netcdf_err(error,
'WRITING ALNWF RECORD' )
2715 print*,
"- CALL FieldGather FOR TARGET GRID ALVSF FOR TILE: ", tile
2716 call esmf_fieldgather(alvsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2717 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2720 if (localpet == 0)
then
2721 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2722 error = nf90_put_var( ncid, id_alvsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2723 call
netcdf_err(error,
'WRITING ALVSF RECORD' )
2726 print*,
"- CALL FieldGather FOR TARGET GRID ALVWF FOR TILE: ", tile
2727 call esmf_fieldgather(alvwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2728 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2731 if (localpet == 0)
then
2732 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2733 error = nf90_put_var( ncid, id_alvwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2734 call
netcdf_err(error,
'WRITING ALVWF RECORD' )
2737 print*,
"- CALL FieldGather FOR TARGET GRID MAX VEGETATION GREENNESS FOR TILE: ", tile
2738 call esmf_fieldgather(max_veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2739 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2742 if (localpet == 0)
then
2743 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2744 error = nf90_put_var( ncid, id_shdmax, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2745 call
netcdf_err(error,
'WRITING MAX VEGETATION GREENNESS RECORD' )
2748 print*,
"- CALL FieldGather FOR TARGET GRID MIN VEGETATION GREENNESS FOR TILE: ", tile
2749 call esmf_fieldgather(min_veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2750 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2753 if (localpet == 0)
then
2754 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2755 error = nf90_put_var( ncid, id_shdmin, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2756 call
netcdf_err(error,
'WRITING MIN VEGETATION GREENNESS RECORD' )
2759 print*,
"- CALL FieldGather FOR TARGET GRID T2M FOR TILE: ", tile
2760 call esmf_fieldgather(t2m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2761 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2764 if (localpet == 0)
then
2765 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2766 error = nf90_put_var( ncid, id_t2m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2767 call
netcdf_err(error,
'WRITING T2M RECORD' )
2770 print*,
"- CALL FieldGather FOR TARGET GRID Q2M FOR TILE: ", tile
2771 call esmf_fieldgather(q2m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2772 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2775 if (localpet == 0)
then
2776 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2777 error = nf90_put_var( ncid, id_q2m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2778 call
netcdf_err(error,
'WRITING Q2M RECORD' )
2781 print*,
"- CALL FieldGather FOR TARGET GRID TPRCP FOR TILE: ", tile
2782 call esmf_fieldgather(tprcp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2783 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2786 if (localpet == 0)
then
2787 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2788 error = nf90_put_var( ncid, id_tprcp, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2789 call
netcdf_err(error,
'WRITING TPRCP RECORD' )
2792 print*,
"- CALL FieldGather FOR TARGET GRID F10M FOR TILE: ", tile
2793 call esmf_fieldgather(f10m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2794 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2797 if (localpet == 0)
then
2798 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2799 error = nf90_put_var( ncid, id_f10m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2800 call
netcdf_err(error,
'WRITING F10M RECORD' )
2803 print*,
"- CALL FieldGather FOR TARGET GRID FFMM FOR TILE: ", tile
2804 call esmf_fieldgather(ffmm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2805 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2808 if (localpet == 0)
then
2809 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2810 error = nf90_put_var( ncid, id_ffmm, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2811 call
netcdf_err(error,
'WRITING FFMM RECORD' )
2813 error = nf90_put_var( ncid, id_ffhh, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2814 call
netcdf_err(error,
'WRITING FFHH RECORD' )
2817 print*,
"- CALL FieldGather FOR TARGET GRID USTAR FOR TILE: ", tile
2818 call esmf_fieldgather(ustar_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2819 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2822 if (localpet == 0)
then
2823 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2824 error = nf90_put_var( ncid, id_uustar, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2825 call
netcdf_err(error,
'WRITING USTAR RECORD' )
2828 print*,
"- CALL FieldGather FOR TARGET GRID SRFLAG FOR TILE: ", tile
2829 call esmf_fieldgather(srflag_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2830 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2833 if (localpet == 0)
then
2834 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2835 error = nf90_put_var( ncid, id_srflag, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2836 call
netcdf_err(error,
'WRITING SRFLAG RECORD' )
2839 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE FRACTION FOR TILE: ", tile
2840 call esmf_fieldgather(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2841 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2844 if (localpet == 0)
then
2845 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2846 error = nf90_put_var( ncid, id_fice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2847 call
netcdf_err(error,
'WRITING FICE RECORD' )
2850 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE DEPTH FOR TILE: ", tile
2851 call esmf_fieldgather(seaice_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2852 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2855 if (localpet == 0)
then
2856 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2857 error = nf90_put_var( ncid, id_hice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2858 call
netcdf_err(error,
'WRITING HICE RECORD' )
2861 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE SKIN TEMP FOR TILE: ", tile
2862 call esmf_fieldgather(seaice_skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2863 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2866 if (localpet == 0)
then
2867 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2868 error = nf90_put_var( ncid, id_tisfc, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2869 call
netcdf_err(error,
'WRITING TISFC RECORD' )
2872 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMP FOR TILE: ", tile
2873 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2874 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2877 if (localpet == 0)
then
2878 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2879 error = nf90_put_var( ncid, id_tsea, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2880 call
netcdf_err(error,
'WRITING TSEA RECORD' )
2883 print*,
"- CALL FieldGather FOR TARGET GRID LANDMASK FOR TILE: ", tile
2884 call esmf_fieldgather(landmask_target_grid, idata_one_tile, rootpet=0, tile=tile, rc=error)
2885 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2888 if (localpet == 0)
then
2889 dum2d(:,:) = float(idata_one_tile(istart:iend, jstart:jend))
2890 error = nf90_put_var( ncid, id_slmsk, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2891 call
netcdf_err(error,
'WRITING LANDMASK RECORD' )
2894 print*,
"- CALL FieldGather FOR TARGET GRID CANOPY MOISTURE CONTENT FOR TILE: ", tile
2895 call esmf_fieldgather(canopy_mc_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2896 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2899 if (localpet == 0)
then
2900 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2901 error = nf90_put_var( ncid, id_canopy, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2902 call
netcdf_err(error,
'WRITING CANOPY MC RECORD' )
2907 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE FOR TILE: ", tile
2908 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
2909 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2912 if (localpet == 0)
then
2913 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2914 error = nf90_put_var( ncid, id_stc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,lsoil_target,1/))
2915 call
netcdf_err(error,
'WRITING SOIL TEMP RECORD' )
2920 print*,
"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE FOR TILE: ", tile
2921 call esmf_fieldgather(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
2922 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2925 if (localpet == 0)
then
2926 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2927 error = nf90_put_var( ncid, id_smc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,lsoil_target,1/))
2928 call
netcdf_err(error,
'WRITING TOTAL SOIL MOISTURE RECORD' )
2933 print*,
"- CALL FieldGather FOR TARGET GRID LIQUID SOIL MOISTURE FOR TILE: ", tile
2934 call esmf_fieldgather(soilm_liq_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
2935 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2938 if (localpet == 0)
then
2939 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2940 error = nf90_put_var( ncid, id_slc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,lsoil_target,1/))
2941 call
netcdf_err(error,
'WRITING LIQUID SOIL MOISTURE RECORD' )
2944 if (convert_nst)
then
2946 print*,
"- CALL FieldGather FOR TARGET C_D FOR TILE: ", tile
2947 call esmf_fieldgather(c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2948 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2951 if (localpet == 0)
then
2952 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2953 error = nf90_put_var( ncid, id_c_d, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2954 call
netcdf_err(error,
'WRITING C_D RECORD' )
2957 print*,
"- CALL FieldGather FOR TARGET C_0 FOR TILE: ", tile
2958 call esmf_fieldgather(c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2959 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2962 if (localpet == 0)
then
2963 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2964 error = nf90_put_var( ncid, id_c_0, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2965 call
netcdf_err(error,
'WRITING C_0 RECORD' )
2968 print*,
"- CALL FieldGather FOR TARGET D_CONV FOR TILE: ", tile
2969 call esmf_fieldgather(d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2970 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2973 if (localpet == 0)
then
2974 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2975 error = nf90_put_var( ncid, id_d_conv, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2976 call
netcdf_err(error,
'WRITING D_CONV RECORD' )
2979 print*,
"- CALL FieldGather FOR TARGET DT_COOL FOR TILE: ", tile
2980 call esmf_fieldgather(dt_cool_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2981 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2984 if (localpet == 0)
then
2985 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2986 error = nf90_put_var( ncid, id_dt_cool, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2987 call
netcdf_err(error,
'WRITING DT_COOL RECORD' )
2990 print*,
"- CALL FieldGather FOR TARGET IFD FOR TILE: ", tile
2991 call esmf_fieldgather(ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2992 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2995 if (localpet == 0)
then
2996 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2997 error = nf90_put_var( ncid, id_ifd, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2998 call
netcdf_err(error,
'WRITING IFD RECORD' )
3001 print*,
"- CALL FieldGather FOR TARGET QRAIN FOR TILE: ", tile
3002 call esmf_fieldgather(qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3003 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3006 if (localpet == 0)
then
3007 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3008 error = nf90_put_var( ncid, id_qrain, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3009 call
netcdf_err(error,
'WRITING QRAIN RECORD' )
3012 print*,
"- CALL FieldGather FOR TARGET TREF FOR TILE: ", tile
3013 call esmf_fieldgather(tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3014 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3017 if (localpet == 0)
then
3018 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3019 error = nf90_put_var( ncid, id_tref, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3020 call
netcdf_err(error,
'WRITING TREF RECORD' )
3023 print*,
"- CALL FieldGather FOR TARGET W_D FOR TILE: ", tile
3024 call esmf_fieldgather(w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3025 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3028 if (localpet == 0)
then
3029 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3030 error = nf90_put_var( ncid, id_w_d, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3031 call
netcdf_err(error,
'WRITING W_D RECORD' )
3034 print*,
"- CALL FieldGather FOR TARGET W_0 FOR TILE: ", tile
3035 call esmf_fieldgather(w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3036 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3039 if (localpet == 0)
then
3040 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3041 error = nf90_put_var( ncid, id_w_0, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3042 call
netcdf_err(error,
'WRITING W_0 RECORD' )
3045 print*,
"- CALL FieldGather FOR TARGET XS FOR TILE: ", tile
3046 call esmf_fieldgather(xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3047 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3050 if (localpet == 0)
then
3051 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3052 error = nf90_put_var( ncid, id_xs, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3056 print*,
"- CALL FieldGather FOR TARGET XT FOR TILE: ", tile
3057 call esmf_fieldgather(xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3058 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3061 if (localpet == 0)
then
3062 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3063 error = nf90_put_var( ncid, id_xt, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3067 print*,
"- CALL FieldGather FOR TARGET XU FOR TILE: ", tile
3068 call esmf_fieldgather(xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3069 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3072 if (localpet == 0)
then
3073 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3074 error = nf90_put_var( ncid, id_xu, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3078 print*,
"- CALL FieldGather FOR TARGET XV FOR TILE: ", tile
3079 call esmf_fieldgather(xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3080 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3083 if (localpet == 0)
then
3084 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3085 error = nf90_put_var( ncid, id_xv, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3089 print*,
"- CALL FieldGather FOR TARGET XZ FOR TILE: ", tile
3090 call esmf_fieldgather(xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3091 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3094 if (localpet == 0)
then
3095 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3096 error = nf90_put_var( ncid, id_xz, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3100 print*,
"- CALL FieldGather FOR TARGET XTTS FOR TILE: ", tile
3101 call esmf_fieldgather(xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3102 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3105 if (localpet == 0)
then
3106 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3107 error = nf90_put_var( ncid, id_xtts, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3108 call
netcdf_err(error,
'WRITING XTTS RECORD' )
3111 print*,
"- CALL FieldGather FOR TARGET XZTS FOR TILE: ", tile
3112 call esmf_fieldgather(xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3113 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3116 if (localpet == 0)
then
3117 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3118 error = nf90_put_var( ncid, id_xzts, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3119 call
netcdf_err(error,
'WRITING XZTS RECORD' )
3122 print*,
"- CALL FieldGather FOR TARGET Z_C FOR TILE: ", tile
3123 call esmf_fieldgather(z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3124 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3127 if (localpet == 0)
then
3128 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3129 error = nf90_put_var( ncid, id_z_c, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3130 call
netcdf_err(error,
'WRITING Z_C RECORD' )
3133 print*,
"- CALL FieldGather FOR TARGET ZM FOR TILE: ", tile
3134 call esmf_fieldgather(zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3135 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3138 if (localpet == 0)
then
3139 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3140 error = nf90_put_var( ncid, id_zm, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3150 error = nf90_close(ncid)
3154 deallocate(lsoil_data, x_data, y_data)
3155 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...