40 integer,
intent(in) :: localpet
42 character(len=13) :: outfile
44 integer :: fsize=65536, initial = 0
45 integer :: header_buffer_val = 16384
46 integer :: error, ncid, dim_nvcoord
47 integer :: dim_levp1, id_ntrac, id_vcoord
48 integer :: num_tracers_output
50 real(kind=esmf_kind_r8),
allocatable :: tmp(:,:)
52 if (localpet /= 0)
return
54 outfile=
"./gfs_ctrl.nc"
56 print*,
"- WRITE ATMOSPHERIC HEADER FILE: ", trim(outfile)
58 error = nf90_create(outfile, ior(nf90_netcdf4,nf90_classic_model), &
59 ncid, initialsize=initial, chunksize=fsize)
60 call
netcdf_err(error,
'CREATING FILE='//trim(outfile) )
62 error = nf90_def_dim(ncid,
'nvcoord', nvcoord_target, dim_nvcoord)
63 call
netcdf_err(error,
'define dimension nvcoord for file='//trim(outfile) )
65 error = nf90_def_dim(ncid,
'levsp', levp1_target, dim_levp1)
66 call
netcdf_err(error,
'define dimension levsp for file='//trim(outfile) )
68 error = nf90_def_var(ncid,
'ntrac', nf90_int, id_ntrac)
69 call
netcdf_err(error,
'define var ntrac for file='//trim(outfile) )
71 error = nf90_def_var(ncid,
'vcoord', nf90_double, (/dim_levp1, dim_nvcoord/), id_vcoord)
72 call
netcdf_err(error,
'define var vcoord for file='//trim(outfile) )
74 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
75 call
netcdf_err(error,
'end meta define for file='//trim(outfile) )
77 num_tracers_output = num_tracers
78 if (use_thomp_mp_climo) num_tracers_output = num_tracers + 2
79 error = nf90_put_var( ncid, id_ntrac, num_tracers_output)
80 call
netcdf_err(error,
'write var ntrac for file='//trim(outfile) )
82 allocate(tmp(levp1_target, nvcoord_target))
83 tmp(1:levp1_target,:) = vcoord_target(levp1_target:1:-1,:)
85 error = nf90_put_var( ncid, id_vcoord, tmp)
86 call
netcdf_err(error,
'write var vcoord for file='//trim(outfile) )
90 error = nf90_close(ncid)
120 ps_target_grid, zh_target_grid, &
121 tracers_target_grid, dzdt_target_grid, &
122 temp_target_grid, qnifa_climo_target_grid, &
123 qnwfa_climo_target_grid, u_s_target_grid, &
124 v_s_target_grid, u_w_target_grid, v_w_target_grid
126 use model_grid, only : i_target, ip1_target, j_target, jp1_target
129 input_type, tracers, num_tracers, &
134 integer,
intent(in) :: localpet
136 character(len=50) :: name
138 integer :: fsize=65536, initial = 0
139 integer :: header_buffer_val = 16384
140 integer :: ncid, error, tile, i, n
141 integer :: dim_lon, dim_lat
142 integer :: dim_lonp, dim_halo
143 integer :: dim_halop, dim_latm
144 integer :: dim_lev, dim_levp1
145 integer :: j_target2, halo, halo_p1
146 integer :: id_i_bottom, id_j_bottom
147 integer :: id_i_top, id_j_top
148 integer :: id_i_right, id_j_right
149 integer :: id_i_left, id_j_left
150 integer :: id_qnifa_bottom, id_qnifa_top
151 integer :: id_qnifa_right, id_qnifa_left
152 integer :: id_qnwfa_bottom, id_qnwfa_top
153 integer :: id_qnwfa_right, id_qnwfa_left
154 integer :: id_ps_bottom, id_ps_top
155 integer :: id_ps_right, id_ps_left
156 integer :: id_t_bottom, id_t_top
157 integer :: id_t_right, id_t_left
158 integer :: id_w_bottom, id_w_top
159 integer :: id_w_right, id_w_left
160 integer :: id_zh_bottom, id_zh_top
161 integer :: id_zh_right, id_zh_left
162 integer,
allocatable :: id_tracer_bottom(:), id_tracer_top(:)
163 integer,
allocatable :: id_tracer_right(:), id_tracer_left(:)
164 integer :: id_i_w_bottom, id_j_w_bottom
165 integer :: id_i_w_top, id_j_w_top
166 integer :: id_j_w_right, id_i_w_left
167 integer :: id_j_w_left, id_i_w_right
168 integer :: id_u_w_bottom, id_u_w_top
169 integer :: id_u_w_right, id_u_w_left
170 integer :: id_v_w_bottom, id_v_w_top
171 integer :: id_v_w_right, id_v_w_left
172 integer :: id_i_s_bottom, id_j_s_bottom
173 integer :: id_i_s_top, id_j_s_top
174 integer :: id_i_s_right, id_j_s_right
175 integer :: id_i_s_left, id_j_s_left
176 integer :: id_u_s_bottom, id_u_s_top
177 integer :: id_u_s_right, id_u_s_left
178 integer :: id_v_s_bottom, id_v_s_top
179 integer :: id_v_s_right, id_v_s_left
180 integer :: i_start_top, i_end_top
181 integer :: j_start_top, j_end_top
182 integer :: i_start_bottom, i_end_bottom
183 integer :: j_start_bottom, j_end_bottom
184 integer :: i_start_left, i_end_left
185 integer :: j_start_left, j_end_left
186 integer :: i_start_right, i_end_right
187 integer :: j_start_right, j_end_right
188 integer(kind=4),
allocatable :: idum(:)
190 real(kind=4),
allocatable :: dum2d_top(:,:), dum2d_bottom(:,:)
191 real(kind=4),
allocatable :: dum2d_left(:,:), dum2d_right(:,:)
192 real(kind=4),
allocatable :: dum3d_top(:,:,:), dum3d_bottom(:,:,:)
193 real(kind=4),
allocatable :: dum3d_left(:,:,:), dum3d_right(:,:,:)
194 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
195 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
197 print*,
"- OUTPUT LATERAL BOUNDARY DATA."
199 halo = halo_bndy + halo_blend
202 allocate(id_tracer_bottom(num_tracers))
203 allocate(id_tracer_top(num_tracers))
204 allocate(id_tracer_left(num_tracers))
205 allocate(id_tracer_right(num_tracers))
207 if (localpet == 0)
then
210 error = nf90_create(
"./gfs.bndy.nc", ior(nf90_netcdf4,nf90_classic_model), &
211 ncid, initialsize=initial, chunksize=fsize)
214 error = nf90_def_dim(ncid,
'lon', i_target, dim_lon)
215 call
netcdf_err(error,
'defining lon dimension')
217 j_target2 = j_target - (2*halo_bndy)
218 error = nf90_def_dim(ncid,
'lat', j_target2, dim_lat)
219 call
netcdf_err(error,
'DEFINING LAT DIMENSION')
221 error = nf90_def_dim(ncid,
'lonp', ip1_target, dim_lonp)
222 call
netcdf_err(error,
'DEFINING LONP DIMENSION')
224 j_target2 = j_target - (2*halo_bndy) - 1
225 error = nf90_def_dim(ncid,
'latm', j_target2, dim_latm)
226 call
netcdf_err(error,
'DEFINING LATM DIMENSION')
228 error = nf90_def_dim(ncid,
'halo', halo, dim_halo)
229 call
netcdf_err(error,
'DEFINING HALO DIMENSION')
231 error = nf90_def_dim(ncid,
'halop', halo_p1, dim_halop)
232 call
netcdf_err(error,
'DEFINING HALOP DIMENSION')
234 error = nf90_def_dim(ncid,
'lev', lev_target, dim_lev)
235 call
netcdf_err(error,
'DEFINING LEV DIMENSION')
237 error = nf90_def_dim(ncid,
'levp', levp1_target, dim_levp1)
238 call
netcdf_err(error,
'DEFINING LEVP DIMENSION')
240 error = nf90_def_var(ncid,
'i_bottom', nf90_int, &
241 (/dim_lon/), id_i_bottom)
244 error = nf90_def_var(ncid,
'j_bottom', nf90_int, &
245 (/dim_halo/), id_j_bottom)
248 error = nf90_def_var(ncid,
'i_top', nf90_int, &
249 (/dim_lon/), id_i_top)
252 error = nf90_def_var(ncid,
'j_top', nf90_int, &
253 (/dim_halo/), id_j_top)
256 error = nf90_def_var(ncid,
'i_right', nf90_int, &
257 (/dim_halo/), id_i_right)
260 error = nf90_def_var(ncid,
'j_right', nf90_int, &
261 (/dim_lat/), id_j_right)
264 error = nf90_def_var(ncid,
'i_left', nf90_int, &
265 (/dim_halo/), id_i_left)
268 error = nf90_def_var(ncid,
'j_left', nf90_int, &
269 (/dim_lat/), id_j_left)
272 error = nf90_def_var(ncid,
'ps_bottom', nf90_float, &
273 (/dim_lon, dim_halo/), id_ps_bottom)
276 error = nf90_def_var(ncid,
'ps_top', nf90_float, &
277 (/dim_lon, dim_halo/), id_ps_top)
280 error = nf90_def_var(ncid,
'ps_right', nf90_float, &
281 (/dim_halo, dim_lat/), id_ps_right)
284 error = nf90_def_var(ncid,
'ps_left', nf90_float, &
285 (/dim_halo, dim_lat/), id_ps_left)
288 error = nf90_def_var(ncid,
't_bottom', nf90_float, &
289 (/dim_lon, dim_halo, dim_lev/), id_t_bottom)
292 error = nf90_def_var(ncid,
't_top', nf90_float, &
293 (/dim_lon, dim_halo, dim_lev/), id_t_top)
296 error = nf90_def_var(ncid,
't_right', nf90_float, &
297 (/dim_halo, dim_lat, dim_lev/), id_t_right)
300 error = nf90_def_var(ncid,
't_left', nf90_float, &
301 (/dim_halo, dim_lat, dim_lev/), id_t_left)
304 error = nf90_def_var(ncid,
'w_bottom', nf90_float, &
305 (/dim_lon, dim_halo, dim_lev/), id_w_bottom)
308 error = nf90_def_var(ncid,
'w_top', nf90_float, &
309 (/dim_lon, dim_halo, dim_lev/), id_w_top)
312 error = nf90_def_var(ncid,
'w_right', nf90_float, &
313 (/dim_halo, dim_lat, dim_lev/), id_w_right)
316 error = nf90_def_var(ncid,
'w_left', nf90_float, &
317 (/dim_halo, dim_lat, dim_lev/), id_w_left)
320 error = nf90_def_var(ncid,
'zh_bottom', nf90_float, &
321 (/dim_lon, dim_halo, dim_levp1/), id_zh_bottom)
324 error = nf90_def_var(ncid,
'zh_top', nf90_float, &
325 (/dim_lon, dim_halo, dim_levp1/), id_zh_top)
328 error = nf90_def_var(ncid,
'zh_right', nf90_float, &
329 (/dim_halo, dim_lat, dim_levp1/), id_zh_right)
332 error = nf90_def_var(ncid,
'zh_left', nf90_float, &
333 (/dim_halo, dim_lat, dim_levp1/), id_zh_left)
336 do n = 1, num_tracers
338 name = trim(tracers(n)) //
"_bottom"
339 error = nf90_def_var(ncid, name, nf90_float, &
340 (/dim_lon, dim_halo, dim_lev/), id_tracer_bottom(n))
341 call
netcdf_err(error,
'DEFINING TRACER_BOTTOM')
343 name = trim(tracers(n)) //
"_top"
344 error = nf90_def_var(ncid, name, nf90_float, &
345 (/dim_lon, dim_halo, dim_lev/), id_tracer_top(n))
348 name = trim(tracers(n)) //
"_right"
349 error = nf90_def_var(ncid, name, nf90_float, &
350 (/dim_halo, dim_lat, dim_lev/), id_tracer_right(n))
351 call
netcdf_err(error,
'DEFINING TRACER_RIGHT')
353 name = trim(tracers(n)) //
"_left"
354 error = nf90_def_var(ncid, name, nf90_float, &
355 (/dim_halo, dim_lat, dim_lev/), id_tracer_left(n))
356 call
netcdf_err(error,
'DEFINING TRACER_LEFT')
360 if (use_thomp_mp_climo)
then
362 name =
"ice_aero_bottom"
363 error = nf90_def_var(ncid, name, nf90_float, &
364 (/dim_lon, dim_halo, dim_lev/), id_qnifa_bottom)
365 call
netcdf_err(error,
'DEFINING QNIFA_BOTTOM')
367 name =
"ice_aero_top"
368 error = nf90_def_var(ncid, name, nf90_float, &
369 (/dim_lon, dim_halo, dim_lev/), id_qnifa_top)
372 name =
"ice_aero_right"
373 error = nf90_def_var(ncid, name, nf90_float, &
374 (/dim_halo, dim_lat, dim_lev/), id_qnifa_right)
375 call
netcdf_err(error,
'DEFINING QNIFA_RIGHT')
377 name =
"ice_aero_left"
378 error = nf90_def_var(ncid, name, nf90_float, &
379 (/dim_halo, dim_lat, dim_lev/), id_qnifa_left)
382 name =
"liq_aero_bottom"
383 error = nf90_def_var(ncid, name, nf90_float, &
384 (/dim_lon, dim_halo, dim_lev/), id_qnwfa_bottom)
385 call
netcdf_err(error,
'DEFINING QNWFA_BOTTOM')
387 name =
"liq_aero_top"
388 error = nf90_def_var(ncid, name, nf90_float, &
389 (/dim_lon, dim_halo, dim_lev/), id_qnwfa_top)
392 name =
"liq_aero_right"
393 error = nf90_def_var(ncid, name, nf90_float, &
394 (/dim_halo, dim_lat, dim_lev/), id_qnwfa_right)
395 call
netcdf_err(error,
'DEFINING QNWFA_RIGHT')
397 name =
"liq_aero_left"
398 error = nf90_def_var(ncid, name, nf90_float, &
399 (/dim_halo, dim_lat, dim_lev/), id_qnwfa_left)
404 error = nf90_def_var(ncid,
'i_w_bottom', nf90_int, &
405 (/dim_lonp/), id_i_w_bottom)
408 error = nf90_def_var(ncid,
'j_w_bottom', nf90_int, &
409 (/dim_halo/), id_j_w_bottom)
412 error = nf90_def_var(ncid,
'i_w_top', nf90_int, &
413 (/dim_lonp/), id_i_w_top)
416 error = nf90_def_var(ncid,
'j_w_top', nf90_int, &
417 (/dim_halo/), id_j_w_top)
420 error = nf90_def_var(ncid,
'i_w_right', nf90_int, &
421 (/dim_halop/), id_i_w_right)
424 error = nf90_def_var(ncid,
'j_w_right', nf90_int, &
425 (/dim_lat/), id_j_w_right)
428 error = nf90_def_var(ncid,
'i_w_left', nf90_int, &
429 (/dim_halop/), id_i_w_left)
432 error = nf90_def_var(ncid,
'j_w_left', nf90_int, &
433 (/dim_lat/), id_j_w_left)
436 error = nf90_def_var(ncid,
'u_w_bottom', nf90_float, &
437 (/dim_lonp, dim_halo, dim_lev/), id_u_w_bottom)
440 error = nf90_def_var(ncid,
'u_w_top', nf90_float, &
441 (/dim_lonp, dim_halo, dim_lev/), id_u_w_top)
444 error = nf90_def_var(ncid,
'u_w_right', nf90_float, &
445 (/dim_halop, dim_lat, dim_lev/), id_u_w_right)
448 error = nf90_def_var(ncid,
'u_w_left', nf90_float, &
449 (/dim_halop, dim_lat, dim_lev/), id_u_w_left)
452 error = nf90_def_var(ncid,
'v_w_bottom', nf90_float, &
453 (/dim_lonp, dim_halo, dim_lev/), id_v_w_bottom)
456 error = nf90_def_var(ncid,
'v_w_top', nf90_float, &
457 (/dim_lonp, dim_halo, dim_lev/), id_v_w_top)
460 error = nf90_def_var(ncid,
'v_w_right', nf90_float, &
461 (/dim_halop, dim_lat, dim_lev/), id_v_w_right)
464 error = nf90_def_var(ncid,
'v_w_left', nf90_float, &
465 (/dim_halop, dim_lat, dim_lev/), id_v_w_left)
468 error = nf90_def_var(ncid,
'i_s_bottom', nf90_int, &
469 (/dim_lon/), id_i_s_bottom)
472 error = nf90_def_var(ncid,
'j_s_bottom', nf90_int, &
473 (/dim_halop/), id_j_s_bottom)
476 error = nf90_def_var(ncid,
'i_s_top', nf90_int, &
477 (/dim_lon/), id_i_s_top)
480 error = nf90_def_var(ncid,
'j_s_top', nf90_int, &
481 (/dim_halop/), id_j_s_top)
484 error = nf90_def_var(ncid,
'i_s_right', nf90_int, &
485 (/dim_halo/), id_i_s_right)
488 error = nf90_def_var(ncid,
'j_s_right', nf90_int, &
489 (/dim_latm/), id_j_s_right)
492 error = nf90_def_var(ncid,
'i_s_left', nf90_int, &
493 (/dim_halo/), id_i_s_left)
496 error = nf90_def_var(ncid,
'j_s_left', nf90_int, &
497 (/dim_latm/), id_j_s_left)
500 error = nf90_def_var(ncid,
'u_s_bottom', nf90_float, &
501 (/dim_lon, dim_halop, dim_lev/), id_u_s_bottom)
504 error = nf90_def_var(ncid,
'u_s_top', nf90_float, &
505 (/dim_lon, dim_halop, dim_lev/), id_u_s_top)
508 error = nf90_def_var(ncid,
'u_s_right', nf90_float, &
509 (/dim_halo, dim_latm, dim_lev/), id_u_s_right)
512 error = nf90_def_var(ncid,
'u_s_left', nf90_float, &
513 (/dim_halo, dim_latm, dim_lev/), id_u_s_left)
516 error = nf90_def_var(ncid,
'v_s_bottom', nf90_float, &
517 (/dim_lon, dim_halop, dim_lev/), id_v_s_bottom)
520 error = nf90_def_var(ncid,
'v_s_top', nf90_float, &
521 (/dim_lon, dim_halop, dim_lev/), id_v_s_top)
524 error = nf90_def_var(ncid,
'v_s_right', nf90_float, &
525 (/dim_halo, dim_latm, dim_lev/), id_v_s_right)
528 error = nf90_def_var(ncid,
'v_s_left', nf90_float, &
529 (/dim_halo, dim_latm, dim_lev/), id_v_s_left)
533 if (trim(input_type) ==
"gaussian_nemsio")
then
534 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NEMSIO FILE')
535 elseif (trim(input_type) ==
"gfs_gaussian_nemsio")
then
536 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS GAUSSIAN NEMSIO FILE')
537 elseif (trim(input_type) ==
"gfs_sigio")
then
538 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS SIGIO FILE')
539 elseif (trim(input_type) ==
"history")
then
540 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED HISTORY FILE')
541 elseif (trim(input_type) ==
"restart")
then
542 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED RESTART FILE')
543 elseif (trim(input_type) ==
"gaussian_netcdf")
then
544 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NETCDF FILE')
545 elseif (trim(input_type) ==
"grib2")
then
546 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GRIB2 FILE')
549 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
550 call
netcdf_err(error,
'DEFINING END OF HEADER')
561 j_start_top = j_target - halo + 1
565 i_end_bottom = i_target
571 j_start_left = halo_bndy + 1
572 j_end_left = j_target - halo_bndy
574 i_start_right = i_target - halo + 1
575 i_end_right = i_target
576 j_start_right = halo_bndy + 1
577 j_end_right = j_target - halo_bndy
579 if (localpet == 0)
then
584 allocate(idum(i_start_top:i_end_top))
585 do i = i_start_top, i_end_top
586 idum(i) = i - halo_bndy
588 error = nf90_put_var(ncid, id_i_top, idum)
591 allocate(idum(i_start_bottom:i_end_bottom))
592 do i = i_start_bottom, i_end_bottom
593 idum(i) = i - halo_bndy
595 error = nf90_put_var(ncid, id_i_bottom, idum)
598 allocate(idum(i_start_left:i_end_left))
599 do i = i_start_left, i_end_left
600 idum(i) = i - halo_bndy
602 error = nf90_put_var(ncid, id_i_left, idum)
605 allocate(idum(i_start_right:i_end_right))
606 do i = i_start_right, i_end_right
607 idum(i) = i - halo_bndy
609 error = nf90_put_var(ncid, id_i_right, idum)
612 allocate(idum(j_start_top:j_end_top))
613 do i = j_start_top, j_end_top
614 idum(i) = i - halo_bndy
616 error = nf90_put_var(ncid, id_j_top, idum)
619 allocate(idum(j_start_bottom:j_end_bottom))
620 do i = j_start_bottom, j_end_bottom
621 idum(i) = i - halo_bndy
623 error = nf90_put_var(ncid, id_j_bottom, idum)
626 allocate(idum(j_start_left:j_end_left))
627 do i = j_start_left, j_end_left
628 idum(i) = i - halo_bndy
630 error = nf90_put_var(ncid, id_j_left, idum)
633 allocate(idum(j_start_right:j_end_right))
634 do i = j_start_right, j_end_right
635 idum(i) = i - halo_bndy
637 error = nf90_put_var(ncid, id_j_right, idum)
644 if (localpet == 0)
then
645 allocate(data_one_tile(i_target,j_target))
646 allocate(dum2d_top(i_start_top:i_end_top, j_start_top:j_end_top))
647 allocate(dum2d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom))
648 allocate(dum2d_left(i_start_left:i_end_left, j_start_left:j_end_left))
649 allocate(dum2d_right(i_start_right:i_end_right, j_start_right:j_end_right))
651 allocate(data_one_tile(0,0))
652 allocate(dum2d_top(0,0))
653 allocate(dum2d_bottom(0,0))
654 allocate(dum2d_left(0,0))
655 allocate(dum2d_right(0,0))
660 print*,
"- CALL FieldGather FOR TARGET GRID SURFACE PRESSURE"
661 call esmf_fieldgather(ps_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
662 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
665 if (localpet == 0)
then
666 dum2d_top(:,:) = data_one_tile(i_start_top:i_end_top, j_start_top:j_end_top)
667 error = nf90_put_var( ncid, id_ps_top, dum2d_top)
669 dum2d_bottom(:,:) = data_one_tile(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom)
670 error = nf90_put_var( ncid, id_ps_bottom, dum2d_bottom)
672 dum2d_left(:,:) = data_one_tile(i_start_left:i_end_left, j_start_left:j_end_left)
673 error = nf90_put_var( ncid, id_ps_left, dum2d_left)
675 dum2d_right(:,:) = data_one_tile(i_start_right:i_end_right, j_start_right:j_end_right)
676 error = nf90_put_var( ncid, id_ps_right, dum2d_right)
680 deallocate(dum2d_top, dum2d_bottom, dum2d_left, dum2d_right, data_one_tile)
684 if (localpet == 0)
then
685 allocate(data_one_tile_3d(i_target,j_target,levp1_target))
686 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top, levp1_target))
687 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom, levp1_target))
688 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left, levp1_target))
689 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right, levp1_target))
691 allocate(data_one_tile_3d(0,0,0))
692 allocate(dum3d_top(0,0,0))
693 allocate(dum3d_bottom(0,0,0))
694 allocate(dum3d_left(0,0,0))
695 allocate(dum3d_right(0,0,0))
698 print*,
"- CALL FieldGather FOR TARGET GRID HEIGHT FOR TILE: ", tile
699 call esmf_fieldgather(zh_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
700 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
703 if (localpet == 0)
then
704 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
705 dum3d_top(:,:,1:levp1_target) = dum3d_top(:,:,levp1_target:1:-1)
706 error = nf90_put_var( ncid, id_zh_top, dum3d_top)
708 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
709 dum3d_bottom(:,:,1:levp1_target) = dum3d_bottom(:,:,levp1_target:1:-1)
710 error = nf90_put_var( ncid, id_zh_bottom, dum3d_bottom)
712 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
713 dum3d_left(:,:,1:levp1_target) = dum3d_left(:,:,levp1_target:1:-1)
714 error = nf90_put_var( ncid, id_zh_left, dum3d_left)
716 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
717 dum3d_right(:,:,1:levp1_target) = dum3d_right(:,:,levp1_target:1:-1)
718 error = nf90_put_var( ncid, id_zh_right, dum3d_right)
722 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
726 if (localpet == 0)
then
727 allocate(data_one_tile_3d(i_target,j_target,lev_target))
728 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top, lev_target))
729 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom, lev_target))
730 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left, lev_target))
731 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right, lev_target))
733 allocate(data_one_tile_3d(0,0,0))
734 allocate(dum3d_top(0,0,0))
735 allocate(dum3d_bottom(0,0,0))
736 allocate(dum3d_left(0,0,0))
737 allocate(dum3d_right(0,0,0))
740 do n = 1, num_tracers
742 print*,
"- CALL FieldGather FOR TARGET GRID TRACER FOR TILE: ", trim(tracers(n)), tile
743 call esmf_fieldgather(tracers_target_grid(n), data_one_tile_3d, rootpet=0, tile=tile, rc=error)
744 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
747 if (localpet == 0)
then
748 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
749 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
750 error = nf90_put_var( ncid, id_tracer_top(n), dum3d_top)
752 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
753 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
754 error = nf90_put_var( ncid, id_tracer_bottom(n), dum3d_bottom)
755 call
netcdf_err(error,
'WRITING TRACER BOTTOM' )
756 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
757 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
758 error = nf90_put_var( ncid, id_tracer_left(n), dum3d_left)
759 call
netcdf_err(error,
'WRITING TRACER LEFT' )
760 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
761 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
762 error = nf90_put_var( ncid, id_tracer_right(n), dum3d_right)
763 call
netcdf_err(error,
'WRITING TRACER RIGHT' )
770 print*,
"- CALL FieldGather FOR TARGET GRID W FOR TILE: ", tile
771 call esmf_fieldgather(dzdt_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
772 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
775 if (localpet == 0)
then
776 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
777 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
778 error = nf90_put_var( ncid, id_w_top, dum3d_top)
780 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
781 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
782 error = nf90_put_var( ncid, id_w_bottom, dum3d_bottom)
784 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
785 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
786 error = nf90_put_var( ncid, id_w_left, dum3d_left)
788 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
789 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
790 error = nf90_put_var( ncid, id_w_right, dum3d_right)
796 print*,
"- CALL FieldGather FOR TARGET GRID TEMPERATURE FOR TILE: ", tile
797 call esmf_fieldgather(temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
798 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
801 if (localpet == 0)
then
802 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
803 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
804 error = nf90_put_var( ncid, id_t_top, dum3d_top)
806 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
807 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
808 error = nf90_put_var( ncid, id_t_bottom, dum3d_bottom)
810 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
811 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
812 error = nf90_put_var( ncid, id_t_left, dum3d_left)
814 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
815 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
816 error = nf90_put_var( ncid, id_t_right, dum3d_right)
820 if (use_thomp_mp_climo)
then
822 print*,
"- CALL FieldGather FOR TARGET GRID CLIMO QNIFA FOR TILE: ", tile
823 call esmf_fieldgather(qnifa_climo_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
824 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
827 if (localpet == 0)
then
828 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
829 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
830 error = nf90_put_var( ncid, id_qnifa_top, dum3d_top)
831 call
netcdf_err(error,
'WRITING QNIFA CLIMO TOP' )
832 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
833 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
834 error = nf90_put_var( ncid, id_qnifa_bottom, dum3d_bottom)
835 call
netcdf_err(error,
'WRITING QNIFA CLIMO BOTTOM' )
836 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
837 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
838 error = nf90_put_var( ncid, id_qnifa_left, dum3d_left)
839 call
netcdf_err(error,
'WRITING QNIFA CLIMO LEFT' )
840 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
841 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
842 error = nf90_put_var( ncid, id_qnifa_right, dum3d_right)
843 call
netcdf_err(error,
'WRITING QNIFA CLIMO RIGHT' )
846 print*,
"- CALL FieldGather FOR TARGET GRID CLIMO QNWFA FOR TILE: ", tile
847 call esmf_fieldgather(qnwfa_climo_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
848 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
851 if (localpet == 0)
then
852 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
853 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
854 error = nf90_put_var( ncid, id_qnwfa_top, dum3d_top)
855 call
netcdf_err(error,
'WRITING QNWFA CLIMO TOP' )
856 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
857 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
858 error = nf90_put_var( ncid, id_qnwfa_bottom, dum3d_bottom)
859 call
netcdf_err(error,
'WRITING QNWFA CLIMO BOTTOM' )
860 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
861 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
862 error = nf90_put_var( ncid, id_qnwfa_left, dum3d_left)
863 call
netcdf_err(error,
'WRITING QNWFA CLIMO LEFT' )
864 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
865 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
866 error = nf90_put_var( ncid, id_qnwfa_right, dum3d_right)
867 call
netcdf_err(error,
'WRITING QNWFA CLIMO RIGHT' )
872 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
881 j_start_top = jp1_target - halo_p1 + 1
882 j_end_top = jp1_target
885 i_end_bottom = i_target
887 j_end_bottom = halo_p1
891 j_start_left = halo_bndy + 2
892 j_end_left = j_target - halo_bndy
894 i_start_right = i_target - halo + 1
895 i_end_right = i_target
896 j_start_right = halo_bndy + 2
897 j_end_right = j_target - halo_bndy
899 if (localpet == 0)
then
904 allocate(idum(i_start_top:i_end_top))
905 do i = i_start_top, i_end_top
906 idum(i) = i - halo_bndy
908 error = nf90_put_var(ncid, id_i_s_top, idum)
911 allocate(idum(i_start_bottom:i_end_bottom))
912 do i = i_start_bottom, i_end_bottom
913 idum(i) = i - halo_bndy
915 error = nf90_put_var(ncid, id_i_s_bottom, idum)
918 allocate(idum(i_start_left:i_end_left))
919 do i = i_start_left, i_end_left
920 idum(i) = i - halo_bndy
922 error = nf90_put_var(ncid, id_i_s_left, idum)
925 allocate(idum(i_start_right:i_end_right))
926 do i = i_start_right, i_end_right
927 idum(i) = i - halo_bndy
929 error = nf90_put_var(ncid, id_i_s_right, idum)
932 allocate(idum(j_start_top:j_end_top))
933 do i = j_start_top, j_end_top
934 idum(i) = i - halo_bndy
936 error = nf90_put_var(ncid, id_j_s_top, idum)
939 allocate(idum(j_start_bottom:j_end_bottom))
940 do i = j_start_bottom, j_end_bottom
941 idum(i) = i - halo_bndy
943 error = nf90_put_var(ncid, id_j_s_bottom, idum)
946 allocate(idum(j_start_left:j_end_left))
947 do i = j_start_left, j_end_left
948 idum(i) = i - halo_bndy
950 error = nf90_put_var(ncid, id_j_s_left, idum)
953 allocate(idum(j_start_right:j_end_right))
954 do i = j_start_right, j_end_right
955 idum(i) = i - halo_bndy
957 error = nf90_put_var(ncid, id_j_s_right, idum)
964 if (localpet == 0)
then
965 allocate(data_one_tile_3d(i_target,jp1_target,lev_target))
966 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top, lev_target))
967 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom, lev_target))
968 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left, lev_target))
969 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right, lev_target))
971 allocate(data_one_tile_3d(0,0,0))
972 allocate(dum3d_top(0,0,0))
973 allocate(dum3d_bottom(0,0,0))
974 allocate(dum3d_left(0,0,0))
975 allocate(dum3d_right(0,0,0))
978 print*,
"- CALL FieldGather FOR TARGET GRID U_S FOR TILE: ", tile
979 call esmf_fieldgather(u_s_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
980 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
983 if (localpet == 0)
then
984 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
985 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
986 error = nf90_put_var( ncid, id_u_s_top, dum3d_top)
988 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
989 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
990 error = nf90_put_var( ncid, id_u_s_bottom, dum3d_bottom)
992 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
993 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
994 error = nf90_put_var( ncid, id_u_s_left, dum3d_left)
996 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
997 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
998 error = nf90_put_var( ncid, id_u_s_right, dum3d_right)
1004 print*,
"- CALL FieldGather FOR TARGET GRID V_S FOR TILE: ", tile
1005 call esmf_fieldgather(v_s_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
1006 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1009 if (localpet == 0)
then
1010 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
1011 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
1012 error = nf90_put_var( ncid, id_v_s_top, dum3d_top)
1014 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
1015 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
1016 error = nf90_put_var( ncid, id_v_s_bottom, dum3d_bottom)
1017 call
netcdf_err(error,
'WRITING V_S BOTTOM' )
1018 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
1019 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
1020 error = nf90_put_var( ncid, id_v_s_left, dum3d_left)
1022 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
1023 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
1024 error = nf90_put_var( ncid, id_v_s_right, dum3d_right)
1028 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
1036 i_end_top = ip1_target
1037 j_start_top = j_target - halo + 1
1038 j_end_top = j_target
1041 i_end_bottom = ip1_target
1046 i_end_left = halo_p1
1047 j_start_left = halo_bndy + 1
1048 j_end_left = j_target - halo_bndy
1050 i_start_right = ip1_target - halo_p1 + 1
1051 i_end_right = ip1_target
1052 j_start_right = halo_bndy + 1
1053 j_end_right = j_target - halo_bndy
1055 if (localpet == 0)
then
1060 allocate(idum(i_start_top:i_end_top))
1061 do i = i_start_top, i_end_top
1062 idum(i) = i - halo_bndy
1064 error = nf90_put_var(ncid, id_i_w_top, idum)
1067 allocate(idum(i_start_bottom:i_end_bottom))
1068 do i = i_start_bottom, i_end_bottom
1069 idum(i) = i - halo_bndy
1071 error = nf90_put_var(ncid, id_i_w_bottom, idum)
1074 allocate(idum(i_start_left:i_end_left))
1075 do i = i_start_left, i_end_left
1076 idum(i) = i - halo_bndy
1078 error = nf90_put_var(ncid, id_i_w_left, idum)
1081 allocate(idum(i_start_right:i_end_right))
1082 do i = i_start_right, i_end_right
1083 idum(i) = i - halo_bndy
1085 error = nf90_put_var(ncid, id_i_w_right, idum)
1088 allocate(idum(j_start_top:j_end_top))
1089 do i = j_start_top, j_end_top
1090 idum(i) = i - halo_bndy
1092 error = nf90_put_var(ncid, id_j_w_top, idum)
1095 allocate(idum(j_start_bottom:j_end_bottom))
1096 do i = j_start_bottom, j_end_bottom
1097 idum(i) = i - halo_bndy
1099 error = nf90_put_var(ncid, id_j_w_bottom, idum)
1102 allocate(idum(j_start_left:j_end_left))
1103 do i = j_start_left, j_end_left
1104 idum(i) = i - halo_bndy
1106 error = nf90_put_var(ncid, id_j_w_left, idum)
1109 allocate(idum(j_start_right:j_end_right))
1110 do i = j_start_right, j_end_right
1111 idum(i) = i - halo_bndy
1113 error = nf90_put_var(ncid, id_j_w_right, idum)
1120 if (localpet == 0)
then
1121 allocate(data_one_tile_3d(ip1_target,j_target,lev_target))
1122 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top, lev_target))
1123 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom, lev_target))
1124 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left, lev_target))
1125 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right, lev_target))
1127 allocate(data_one_tile_3d(0,0,0))
1128 allocate(dum3d_top(0,0,0))
1129 allocate(dum3d_bottom(0,0,0))
1130 allocate(dum3d_left(0,0,0))
1131 allocate(dum3d_right(0,0,0))
1134 print*,
"- CALL FieldGather FOR TARGET GRID U_W FOR TILE: ", tile
1135 call esmf_fieldgather(u_w_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
1136 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1139 if (localpet == 0)
then
1140 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
1141 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
1142 error = nf90_put_var( ncid, id_u_w_top, dum3d_top)
1144 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
1145 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
1146 error = nf90_put_var( ncid, id_u_w_bottom, dum3d_bottom)
1147 call
netcdf_err(error,
'WRITING U_W BOTTOM' )
1148 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
1149 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
1150 error = nf90_put_var( ncid, id_u_w_left, dum3d_left)
1152 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
1153 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
1154 error = nf90_put_var( ncid, id_u_w_right, dum3d_right)
1160 print*,
"- CALL FieldGather FOR TARGET GRID V_W FOR TILE: ", tile
1161 call esmf_fieldgather(v_w_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
1162 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1165 if (localpet == 0)
then
1166 dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:)
1167 dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1)
1168 error = nf90_put_var( ncid, id_v_w_top, dum3d_top)
1170 dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:)
1171 dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1)
1172 error = nf90_put_var( ncid, id_v_w_bottom, dum3d_bottom)
1173 call
netcdf_err(error,
'WRITING V_W BOTTOM' )
1174 dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:)
1175 dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1)
1176 error = nf90_put_var( ncid, id_v_w_left, dum3d_left)
1178 dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:)
1179 dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1)
1180 error = nf90_put_var( ncid, id_v_w_right, dum3d_right)
1184 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
1185 deallocate(id_tracer_bottom, id_tracer_top, id_tracer_left, id_tracer_right)
1187 if (localpet == 0) error = nf90_close(ncid)
1205 input_type, tracers, num_tracers, &
1206 use_thomp_mp_climo, &
1210 ps_target_grid, zh_target_grid, &
1211 dzdt_target_grid, delp_target_grid, &
1212 temp_target_grid, tracers_target_grid, &
1213 qnifa_climo_target_grid, qnwfa_climo_target_grid, &
1214 u_s_target_grid, v_s_target_grid, &
1215 u_w_target_grid, v_w_target_grid
1217 use model_grid, only : num_tiles_target_grid, &
1218 i_target, j_target, &
1219 ip1_target, jp1_target, &
1220 longitude_target_grid, &
1221 latitude_target_grid, &
1222 longitude_s_target_grid, &
1223 latitude_s_target_grid, &
1224 longitude_w_target_grid, &
1225 latitude_w_target_grid
1229 integer,
intent(in) :: localpet
1231 character(len=128) :: outfile
1233 integer :: error, ncid, tile, n
1234 integer :: fsize=65536, initial = 0
1235 integer :: header_buffer_val = 16384
1236 integer :: dim_lon, dim_lat
1237 integer :: dim_lonp, dim_latp
1238 integer :: dim_lev, dim_levp1, dim_ntracer
1239 integer,
allocatable :: id_tracers(:)
1240 integer :: id_lon, id_lat, id_ps
1241 integer :: id_lat_s, id_lon_s
1242 integer :: id_lat_w, id_lon_w
1243 integer :: id_w, id_zh, id_u_w
1244 integer :: id_v_w, id_u_s, id_v_s
1245 integer :: id_t, id_delp, id_qnifa, id_qnwfa
1246 integer :: i_start, i_end, j_start, j_end
1247 integer :: i_target_out, j_target_out
1248 integer :: ip1_target_out, jp1_target_out
1249 integer :: ip1_end, jp1_end, num_tracers_output
1251 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
1252 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
1253 real(kind=4),
allocatable :: dum2d(:,:)
1254 real(kind=4),
allocatable :: dum3d(:,:,:)
1258 i_target_out = i_target-(2*halo)
1259 j_target_out = j_target-(2*halo)
1263 i_end = i_target - halo
1264 j_end = j_target - halo
1266 ip1_target_out = i_target_out + 1
1267 jp1_target_out = j_target_out + 1
1272 if (localpet < num_tiles_target_grid)
then
1273 allocate(data_one_tile(i_target,j_target))
1274 allocate(dum2d(i_target_out,j_target_out))
1276 allocate(data_one_tile(0,0))
1277 allocate(dum2d(0,0))
1280 allocate(id_tracers(num_tracers))
1282 header :
if (localpet < num_tiles_target_grid)
then
1285 if (regional > 0)
then
1286 outfile =
"out.atm.tile7.nc"
1288 WRITE(outfile,
'(A, I1, A)')
'out.atm.tile', tile,
'.nc'
1292 error = nf90_create(outfile, ior(nf90_netcdf4,nf90_classic_model), &
1293 ncid, initialsize=initial, chunksize=fsize)
1294 call
netcdf_err(error,
'CREATING FILE='//trim(outfile) )
1297 error = nf90_def_dim(ncid,
'lon', i_target_out, dim_lon)
1298 call
netcdf_err(error,
'DEFINING LON DIMENSION' )
1299 error = nf90_def_dim(ncid,
'lat', j_target_out, dim_lat)
1300 call
netcdf_err(error,
'DEFINING LAT DIMENSION' )
1301 error = nf90_def_dim(ncid,
'lonp', ip1_target_out, dim_lonp)
1302 call
netcdf_err(error,
'DEFINING LONP DIMENSION' )
1303 error = nf90_def_dim(ncid,
'latp', jp1_target_out, dim_latp)
1304 call
netcdf_err(error,
'DEFINING LATP DIMENSION' )
1305 error = nf90_def_dim(ncid,
'lev', lev_target, dim_lev)
1306 call
netcdf_err(error,
'DEFINING LEV DIMENSION' )
1307 error = nf90_def_dim(ncid,
'levp', levp1_target, dim_levp1)
1308 call
netcdf_err(error,
'DEFINING LEVP DIMENSION' )
1309 num_tracers_output = num_tracers
1310 if (use_thomp_mp_climo) num_tracers_output = num_tracers + 2
1311 error = nf90_def_dim(ncid,
'ntracer', num_tracers_output, dim_ntracer)
1312 call
netcdf_err(error,
'DEFINING NTRACER DIMENSION' )
1315 if (trim(input_type) ==
"gaussian_nemsio")
then
1316 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NEMSIO FILE')
1317 elseif (trim(input_type) ==
"gaussian_netcdf")
then
1318 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NETCDF FILE')
1319 elseif (trim(input_type) ==
"gfs_gaussian_nemsio")
then
1320 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS GAUSSIAN NEMSIO FILE')
1321 elseif (trim(input_type) ==
"gfs_sigio")
then
1322 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS SIGIO FILE')
1323 elseif (trim(input_type) ==
"history")
then
1324 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED HISTORY FILE')
1325 elseif (trim(input_type) ==
"restart")
then
1326 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED RESTART FILE')
1327 elseif (trim(input_type) ==
"grib2")
then
1328 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GRIB2 FILE')
1332 error = nf90_def_var(ncid,
'geolon', nf90_float, (/dim_lon,dim_lat/), id_lon)
1333 call
netcdf_err(error,
'DEFINING GEOLON FIELD' )
1334 error = nf90_put_att(ncid, id_lon,
"long_name",
"Longitude")
1335 call
netcdf_err(error,
'DEFINING GEOLON NAME' )
1336 error = nf90_put_att(ncid, id_lon,
"units",
"degrees_east")
1337 call
netcdf_err(error,
'DEFINING GEOLON UNITS' )
1339 error = nf90_def_var(ncid,
'geolat', nf90_float, (/dim_lon,dim_lat/), id_lat)
1340 call
netcdf_err(error,
'DEFINING GEOLAT FIELD' )
1341 error = nf90_put_att(ncid, id_lat,
"long_name",
"Latitude")
1342 call
netcdf_err(error,
'DEFINING GEOLAT NAME' )
1343 error = nf90_put_att(ncid, id_lat,
"units",
"degrees_north")
1344 call
netcdf_err(error,
'DEFINING GEOLAT UNITS' )
1346 error = nf90_def_var(ncid,
'geolon_s', nf90_float, (/dim_lon,dim_latp/), id_lon_s)
1347 call
netcdf_err(error,
'DEFINING GEOLON_S FIELD' )
1348 error = nf90_put_att(ncid, id_lon_s,
"long_name",
"Longitude_s")
1349 call
netcdf_err(error,
'DEFINING GEOLON_S NAME' )
1350 error = nf90_put_att(ncid, id_lon_s,
"units",
"degrees_east")
1351 call
netcdf_err(error,
'DEFINING GEOLON_S UNITS' )
1353 error = nf90_def_var(ncid,
'geolat_s', nf90_float, (/dim_lon,dim_latp/), id_lat_s)
1354 call
netcdf_err(error,
'DEFINING GEOLAT_S FIELD' )
1355 error = nf90_put_att(ncid, id_lat_s,
"long_name",
"Latitude_s")
1356 call
netcdf_err(error,
'DEFINING GEOLAT_S NAME' )
1357 error = nf90_put_att(ncid, id_lat_s,
"units",
"degrees_north")
1358 call
netcdf_err(error,
'DEFINING GEOLAT_S UNITS' )
1360 error = nf90_def_var(ncid,
'geolon_w', nf90_float, (/dim_lonp,dim_lat/), id_lon_w)
1361 call
netcdf_err(error,
'DEFINING GEOLON_W FIELD' )
1362 error = nf90_put_att(ncid, id_lon_w,
"long_name",
"Longitude_w")
1363 call
netcdf_err(error,
'DEFINING GEOLON_W NAME' )
1364 error = nf90_put_att(ncid, id_lon_w,
"units",
"degrees_east")
1365 call
netcdf_err(error,
'DEFINING GEOLON_W UNITS' )
1367 error = nf90_def_var(ncid,
'geolat_w', nf90_float, (/dim_lonp,dim_lat/), id_lat_w)
1368 call
netcdf_err(error,
'DEFINING GEOLAT_W FIELD' )
1369 error = nf90_put_att(ncid, id_lat_w,
"long_name",
"Latitude_w")
1370 call
netcdf_err(error,
'DEFINING GEOLAT_W NAME' )
1371 error = nf90_put_att(ncid, id_lat_w,
"units",
"degrees_north")
1372 call
netcdf_err(error,
'DEFINING GEOLAT_W UNITS' )
1374 error = nf90_def_var(ncid,
'ps', nf90_float, (/dim_lon,dim_lat/), id_ps)
1376 error = nf90_put_att(ncid, id_ps,
"coordinates",
"geolon geolat")
1379 error = nf90_def_var(ncid,
'w', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_w)
1381 error = nf90_put_att(ncid, id_w,
"coordinates",
"geolon geolat")
1384 error = nf90_def_var(ncid,
'zh', nf90_float, (/dim_lon,dim_lat,dim_levp1/), id_zh)
1386 error = nf90_put_att(ncid, id_zh,
"coordinates",
"geolon geolat")
1389 error = nf90_def_var(ncid,
't', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_t)
1391 error = nf90_put_att(ncid, id_t,
"coordinates",
"geolon geolat")
1394 error = nf90_def_var(ncid,
'delp', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_delp)
1396 error = nf90_put_att(ncid, id_delp,
"coordinates",
"geolon geolat")
1397 call
netcdf_err(error,
'DEFINING DELP COORD' )
1399 do n = 1, num_tracers
1400 if (localpet==0) print*,
"write to file tracer ", trim(tracers(n))
1401 error = nf90_def_var(ncid, tracers(n), nf90_float, (/dim_lon,dim_lat,dim_lev/), id_tracers(n))
1403 error = nf90_put_att(ncid, id_tracers(n),
"coordinates",
"geolon geolat")
1404 call
netcdf_err(error,
'DEFINING TRACERS COORD' )
1407 if (use_thomp_mp_climo)
then
1408 error = nf90_def_var(ncid,
'ice_aero', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_qnifa)
1410 error = nf90_put_att(ncid, id_qnifa,
"coordinates",
"geolon geolat")
1411 call
netcdf_err(error,
'DEFINING QNIFA COORD' )
1413 error = nf90_def_var(ncid,
'liq_aero', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_qnwfa)
1415 error = nf90_put_att(ncid, id_qnwfa,
"coordinates",
"geolon geolat")
1416 call
netcdf_err(error,
'DEFINING QNWFA COORD' )
1419 error = nf90_def_var(ncid,
'u_w', nf90_float, (/dim_lonp,dim_lat,dim_lev/), id_u_w)
1421 error = nf90_put_att(ncid, id_u_w,
"coordinates",
"geolon_w geolat_w")
1422 call
netcdf_err(error,
'DEFINING U_W COORD' )
1424 error = nf90_def_var(ncid,
'v_w', nf90_float, (/dim_lonp,dim_lat,dim_lev/), id_v_w)
1426 error = nf90_put_att(ncid, id_v_w,
"coordinates",
"geolon_w geolat_w")
1427 call
netcdf_err(error,
'DEFINING V_W COORD' )
1429 error = nf90_def_var(ncid,
'u_s', nf90_float, (/dim_lon,dim_latp,dim_lev/), id_u_s)
1431 error = nf90_put_att(ncid, id_u_s,
"coordinates",
"geolon_s geolat_s")
1432 call
netcdf_err(error,
'DEFINING U_S COORD' )
1434 error = nf90_def_var(ncid,
'v_s', nf90_float, (/dim_lon,dim_latp,dim_lev/), id_v_s)
1436 error = nf90_put_att(ncid, id_v_s,
"coordinates",
"geolon_s geolat_s")
1437 call
netcdf_err(error,
'DEFINING V_S COORD' )
1439 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
1446 do tile = 1, num_tiles_target_grid
1447 print*,
"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile
1448 call esmf_fieldgather(longitude_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1449 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1453 if (localpet < num_tiles_target_grid)
then
1454 dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end)
1455 error = nf90_put_var( ncid, id_lon, dum2d)
1456 call
netcdf_err(error,
'WRITING LONGITUDE RECORD' )
1461 do tile = 1, num_tiles_target_grid
1462 print*,
"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile
1463 call esmf_fieldgather(latitude_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1464 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1468 if (localpet < num_tiles_target_grid)
then
1469 dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end)
1470 error = nf90_put_var( ncid, id_lat, dum2d)
1471 call
netcdf_err(error,
'WRITING LATITUDE RECORD' )
1476 do tile = 1, num_tiles_target_grid
1477 print*,
"- CALL FieldGather FOR TARGET GRID SURFACE PRESSURE FOR TILE: ", tile
1478 call esmf_fieldgather(ps_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1479 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1483 if (localpet < num_tiles_target_grid)
then
1484 dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end)
1485 error = nf90_put_var( ncid, id_ps, dum2d)
1486 call
netcdf_err(error,
'WRITING SURFACE PRESSURE RECORD' )
1489 deallocate(dum2d, data_one_tile)
1493 if (localpet < num_tiles_target_grid)
then
1494 allocate(dum3d(i_target_out,j_target_out,levp1_target))
1495 allocate(data_one_tile_3d(i_target,j_target,levp1_target))
1497 allocate(dum3d(0,0,0))
1498 allocate(data_one_tile_3d(0,0,0))
1501 do tile = 1, num_tiles_target_grid
1502 print*,
"- CALL FieldGather FOR TARGET GRID HEIGHT FOR TILE: ", tile
1503 call esmf_fieldgather(zh_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1504 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1508 if (localpet < num_tiles_target_grid)
then
1509 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1510 dum3d(:,:,1:levp1_target) = dum3d(:,:,levp1_target:1:-1)
1511 error = nf90_put_var( ncid, id_zh, dum3d)
1512 call
netcdf_err(error,
'WRITING HEIGHT RECORD' )
1515 deallocate(dum3d, data_one_tile_3d)
1519 if (localpet < num_tiles_target_grid)
then
1520 allocate(dum3d(i_target_out,j_target_out,lev_target))
1521 allocate(data_one_tile_3d(i_target,j_target,lev_target))
1523 allocate(dum3d(0,0,0))
1524 allocate(data_one_tile_3d(0,0,0))
1527 do tile = 1, num_tiles_target_grid
1528 print*,
"- CALL FieldGather FOR TARGET GRID VERTICAL VELOCITY FOR TILE: ", tile
1529 call esmf_fieldgather(dzdt_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1530 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1534 if (localpet < num_tiles_target_grid)
then
1535 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1536 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1537 print*,
"MIN MAX W AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1538 error = nf90_put_var( ncid, id_w, dum3d)
1539 call
netcdf_err(error,
'WRITING VERTICAL VELOCITY RECORD' )
1544 do tile = 1, num_tiles_target_grid
1545 print*,
"- CALL FieldGather FOR TARGET GRID DELP FOR TILE: ", tile
1546 call esmf_fieldgather(delp_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1547 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1551 if (localpet < num_tiles_target_grid)
then
1552 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1553 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1554 error = nf90_put_var( ncid, id_delp, dum3d)
1555 call
netcdf_err(error,
'WRITING DELP RECORD' )
1560 do tile = 1, num_tiles_target_grid
1561 print*,
"- CALL FieldGather FOR TARGET GRID TEMPERATURE FOR TILE: ", tile
1562 call esmf_fieldgather(temp_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1563 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1567 if (localpet < num_tiles_target_grid)
then
1568 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1569 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1570 error = nf90_put_var( ncid, id_t, dum3d)
1571 call
netcdf_err(error,
'WRITING TEMPERTAURE RECORD' )
1576 do n = 1, num_tracers
1578 do tile = 1, num_tiles_target_grid
1579 print*,
"- CALL FieldGather FOR TARGET GRID TRACER ", trim(tracers(n)),
" TILE: ", tile
1580 call esmf_fieldgather(tracers_target_grid(n), data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1581 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1585 if (localpet < num_tiles_target_grid)
then
1586 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1587 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1588 error = nf90_put_var( ncid, id_tracers(n), dum3d)
1589 call
netcdf_err(error,
'WRITING TRACER RECORD' )
1596 if (use_thomp_mp_climo)
then
1597 do tile = 1, num_tiles_target_grid
1598 print*,
"- CALL FieldGather FOR TARGET GRID QNIFA FOR TILE: ", tile
1599 call esmf_fieldgather(qnifa_climo_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1600 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1604 if (localpet < num_tiles_target_grid)
then
1605 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1606 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1607 error = nf90_put_var( ncid, id_qnifa, dum3d)
1608 call
netcdf_err(error,
'WRITING QNIFA RECORD' )
1613 do tile = 1, num_tiles_target_grid
1614 print*,
"- CALL FieldGather FOR TARGET GRID QNWFA FOR TILE: ", tile
1615 call esmf_fieldgather(qnwfa_climo_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1616 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1620 if (localpet < num_tiles_target_grid)
then
1621 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:)
1622 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1623 error = nf90_put_var( ncid, id_qnwfa, dum3d)
1624 call
netcdf_err(error,
'WRITING QNWFA RECORD' )
1628 deallocate(dum3d, data_one_tile_3d)
1632 if (localpet < num_tiles_target_grid)
then
1633 allocate(dum2d(i_target_out,jp1_target_out))
1634 allocate(data_one_tile(i_target,jp1_target))
1636 allocate(dum2d(0,0))
1637 allocate(data_one_tile(0,0))
1640 do tile = 1, num_tiles_target_grid
1641 print*,
"- CALL FieldGather FOR TARGET GRID LON_S FOR TILE: ", tile
1642 call esmf_fieldgather(longitude_s_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1643 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1647 if (localpet < num_tiles_target_grid)
then
1648 dum2d(:,:) = data_one_tile(i_start:i_end,j_start:jp1_end)
1649 error = nf90_put_var( ncid, id_lon_s, dum2d)
1650 call
netcdf_err(error,
'WRITING LON_S RECORD' )
1653 do tile = 1, num_tiles_target_grid
1654 print*,
"- CALL FieldGather FOR TARGET GRID LAT_S FOR TILE: ", tile
1655 call esmf_fieldgather(latitude_s_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1656 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1660 if (localpet < num_tiles_target_grid)
then
1661 dum2d(:,:) = data_one_tile(i_start:i_end,j_start:jp1_end)
1662 error = nf90_put_var( ncid, id_lat_s, dum2d)
1663 call
netcdf_err(error,
'WRITING LAT_S RECORD' )
1666 deallocate(dum2d, data_one_tile)
1670 if (localpet < num_tiles_target_grid)
then
1671 allocate(dum3d(i_target_out,jp1_target_out,lev_target))
1672 allocate(data_one_tile_3d(i_target,jp1_target,lev_target))
1674 allocate(dum3d(0,0,0))
1675 allocate(data_one_tile_3d(0,0,0))
1678 do tile = 1, num_tiles_target_grid
1679 print*,
"- CALL FieldGather FOR TARGET GRID U_S FOR TILE: ", tile
1680 call esmf_fieldgather(u_s_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1681 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1685 if (localpet < num_tiles_target_grid)
then
1686 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:jp1_end,:)
1687 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1688 print*,
"MIN MAX US AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1689 error = nf90_put_var( ncid, id_u_s, dum3d)
1690 call
netcdf_err(error,
'WRITING U_S RECORD' )
1695 do tile = 1, num_tiles_target_grid
1696 print*,
"- CALL FieldGather FOR TARGET GRID V_S FOR TILE: ", tile
1697 call esmf_fieldgather(v_s_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1698 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1702 if (localpet < num_tiles_target_grid)
then
1703 dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:jp1_end,:)
1704 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1705 print*,
"MIN MAX VS AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1706 error = nf90_put_var( ncid, id_v_s, dum3d)
1707 call
netcdf_err(error,
'WRITING V_S RECORD' )
1710 deallocate(dum3d, data_one_tile_3d)
1714 if (localpet < num_tiles_target_grid)
then
1715 allocate(dum2d(ip1_target_out,j_target_out))
1716 allocate(data_one_tile(ip1_target,j_target))
1718 allocate(dum2d(0,0))
1719 allocate(data_one_tile(0,0))
1722 do tile = 1, num_tiles_target_grid
1723 print*,
"- CALL FieldGather FOR TARGET GRID LON_W FOR TILE: ", tile
1724 call esmf_fieldgather(longitude_w_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1725 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1729 if (localpet < num_tiles_target_grid)
then
1730 dum2d(:,:) = data_one_tile(i_start:ip1_end,j_start:j_end)
1731 error = nf90_put_var( ncid, id_lon_w, dum2d)
1732 call
netcdf_err(error,
'WRITING LON_W RECORD' )
1735 do tile = 1, num_tiles_target_grid
1736 print*,
"- CALL FieldGather FOR TARGET GRID LAT_W FOR TILE: ", tile
1737 call esmf_fieldgather(latitude_w_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1738 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1742 if (localpet < num_tiles_target_grid)
then
1743 dum2d(:,:) = data_one_tile(i_start:ip1_end,j_start:j_end)
1744 error = nf90_put_var( ncid, id_lat_w, dum2d)
1745 call
netcdf_err(error,
'WRITING LAT_W RECORD' )
1748 deallocate(dum2d, data_one_tile)
1752 if (localpet < num_tiles_target_grid)
then
1753 allocate(dum3d(ip1_target_out,j_target_out,lev_target))
1754 allocate(data_one_tile_3d(ip1_target,j_target,lev_target))
1756 allocate(dum3d(0,0,0))
1757 allocate(data_one_tile_3d(0,0,0))
1760 do tile = 1, num_tiles_target_grid
1761 print*,
"- CALL FieldGather FOR TARGET GRID U_W FOR TILE: ", tile
1762 call esmf_fieldgather(u_w_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1763 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1767 if (localpet < num_tiles_target_grid)
then
1768 dum3d(:,:,:) = data_one_tile_3d(i_start:ip1_end,j_start:j_end,:)
1769 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1770 print*,
"MIN MAX UW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1771 error = nf90_put_var( ncid, id_u_w, dum3d)
1772 call
netcdf_err(error,
'WRITING U_W RECORD' )
1777 do tile = 1, num_tiles_target_grid
1778 print*,
"- CALL FieldGather FOR TARGET GRID V_W FOR TILE: ", tile
1779 call esmf_fieldgather(v_w_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1780 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1784 if (localpet < num_tiles_target_grid)
then
1785 dum3d(:,:,:) = data_one_tile_3d(i_start:ip1_end,j_start:j_end,:)
1786 dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1)
1787 print*,
"MIN MAX VW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1788 error = nf90_put_var( ncid, id_v_w, dum3d)
1789 call
netcdf_err(error,
'WRITING V_W RECORD' )
1792 deallocate(dum3d, data_one_tile_3d, id_tracers)
1798 if (localpet < num_tiles_target_grid) error = nf90_close(ncid)
1811 use model_grid, only : num_tiles_target_grid, &
1812 landmask_target_grid, &
1813 latitude_target_grid, &
1814 longitude_target_grid, &
1815 i_target, j_target, lsoil_target
1818 regional, lai_from_climo
1824 seaice_depth_target_grid, &
1825 seaice_fract_target_grid, &
1826 seaice_skin_temp_target_grid, &
1827 skin_temp_target_grid, &
1828 soil_temp_target_grid, &
1829 soilm_liq_target_grid, &
1830 soilm_tot_target_grid, &
1831 srflag_target_grid, &
1832 snow_liq_equiv_target_grid, &
1833 snow_depth_target_grid, &
1835 tprcp_target_grid, &
1836 ustar_target_grid, &
1841 d_conv_target_grid, &
1842 dt_cool_target_grid, &
1844 qrain_target_grid, &
1859 alnsf_target_grid, &
1860 alvwf_target_grid, &
1861 alnwf_target_grid, &
1862 facsf_target_grid, &
1863 facwf_target_grid, &
1864 max_veg_greenness_target_grid, &
1865 min_veg_greenness_target_grid, &
1866 mxsno_albedo_target_grid, &
1867 slope_type_target_grid, &
1868 soil_type_target_grid, &
1869 substrate_temp_target_grid, &
1870 veg_greenness_target_grid, &
1871 veg_type_target_grid
1875 integer,
intent(in) :: localpet
1876 character(len=128) :: outfile
1878 integer :: fsize=65536, initial = 0
1879 integer :: header_buffer_val = 16384
1880 integer :: dim_x, dim_y, dim_lsoil, dim_time
1881 integer :: error, i, ncid, tile
1882 integer :: id_x, id_y, id_lsoil
1883 integer :: id_slmsk, id_time
1884 integer :: id_lat, id_lon
1885 integer :: id_tsea, id_sheleg, id_tg3
1886 integer :: id_zorl, id_alvsf, id_alvwf
1887 integer :: id_alnsf, id_alnwf, id_vfrac
1888 integer :: id_canopy, id_f10m, id_t2m
1889 integer :: id_q2m, id_vtype, id_stype
1890 integer :: id_facsf, id_facwf, id_uustar
1891 integer :: id_ffmm, id_ffhh, id_hice
1892 integer :: id_fice, id_tisfc, id_tprcp
1893 integer :: id_srflag, id_snwdph, id_shdmin
1894 integer :: id_shdmax, id_slope, id_snoalb
1896 integer :: id_stc, id_smc, id_slc
1897 integer :: id_tref, id_z_c, id_c_0
1898 integer :: id_c_d, id_w_0, id_w_d
1899 integer :: id_xt, id_xs, id_xu, id_xv
1900 integer :: id_xz, id_zm, id_xtts, id_xzts
1901 integer :: id_d_conv, id_ifd, id_dt_cool
1903 integer :: i_target_out, j_target_out
1904 integer :: istart, iend, jstart, jend
1906 integer(esmf_kind_i8),
allocatable :: idata_one_tile(:,:)
1908 real(kind=4),
allocatable :: lsoil_data(:), x_data(:), y_data(:)
1909 real(kind=8),
allocatable :: dum2d(:,:), dum3d(:,:,:)
1910 real(kind=4) :: times
1911 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
1912 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
1916 i_target_out = i_target-(2*halo)
1917 j_target_out = j_target-(2*halo)
1921 iend = i_target - halo
1922 jend = j_target - halo
1924 allocate(lsoil_data(lsoil_target))
1925 do i = 1, lsoil_target
1926 lsoil_data(i) = float(i)
1929 allocate(x_data(i_target_out))
1930 do i = 1, i_target_out
1931 x_data(i) = float(i)
1934 allocate(y_data(j_target_out))
1935 do i = 1, j_target_out
1936 y_data(i) = float(i)
1939 if (convert_nst)
then
1940 print*,
'- WRITE FV3 SURFACE AND NST DATA TO NETCDF FILE'
1942 print*,
'- WRITE FV3 SURFACE DATA TO NETCDF FILE'
1945 if (localpet == 0)
then
1946 allocate(data_one_tile(i_target,j_target))
1947 allocate(data_one_tile_3d(i_target,j_target,lsoil_target))
1948 allocate(idata_one_tile(i_target,j_target))
1949 allocate(dum2d(i_target_out,j_target_out))
1950 allocate(dum3d(i_target_out,j_target_out,lsoil_target))
1952 allocate(data_one_tile(0,0))
1953 allocate(data_one_tile_3d(0,0,0))
1954 allocate(idata_one_tile(0,0))
1955 allocate(dum2d(0,0))
1956 allocate(dum3d(0,0,0))
1959 tile_loop :
do tile = 1, num_tiles_target_grid
1961 local_pet :
if (localpet == 0)
then
1963 if (regional > 0)
then
1964 outfile =
"out.sfc.tile7.nc"
1966 WRITE(outfile,
'(A, I1, A)')
'out.sfc.tile', tile,
'.nc'
1970 error = nf90_create(outfile, ior(nf90_netcdf4,nf90_classic_model), &
1971 ncid, initialsize=initial, chunksize=fsize)
1972 call
netcdf_err(error,
'CREATING FILE='//trim(outfile) )
1975 error = nf90_def_dim(ncid,
'xaxis_1', i_target_out, dim_x)
1976 call
netcdf_err(error,
'DEFINING XAXIS DIMENSION' )
1977 error = nf90_def_dim(ncid,
'yaxis_1', j_target_out, dim_y)
1978 call
netcdf_err(error,
'DEFINING YAXIS DIMENSION' )
1979 error = nf90_def_dim(ncid,
'zaxis_1', lsoil_target, dim_lsoil)
1980 call
netcdf_err(error,
'DEFINING ZAXIS DIMENSION' )
1981 error = nf90_def_dim(ncid,
'Time', 1, dim_time)
1982 call
netcdf_err(error,
'DEFINING TIME DIMENSION' )
1985 error = nf90_def_var(ncid,
'xaxis_1', nf90_float, (/dim_x/), id_x)
1986 call
netcdf_err(error,
'DEFINING XAXIS_1 FIELD' )
1987 error = nf90_put_att(ncid, id_x,
"long_name",
"xaxis_1")
1988 call
netcdf_err(error,
'DEFINING XAXIS_1 LONG NAME' )
1989 error = nf90_put_att(ncid, id_x,
"units",
"none")
1990 call
netcdf_err(error,
'DEFINING XAXIS_1 UNITS' )
1991 error = nf90_put_att(ncid, id_x,
"cartesian_axis",
"X")
1992 call
netcdf_err(error,
'WRITING XAXIS_1 FIELD' )
1994 error = nf90_def_var(ncid,
'yaxis_1', nf90_float, (/dim_y/), id_y)
1995 call
netcdf_err(error,
'DEFINING YAXIS_1 FIELD' )
1996 error = nf90_put_att(ncid, id_y,
"long_name",
"yaxis_1")
1997 call
netcdf_err(error,
'DEFINING YAXIS_1 LONG NAME' )
1998 error = nf90_put_att(ncid, id_y,
"units",
"none")
1999 call
netcdf_err(error,
'DEFINING YAXIS_1 UNITS' )
2000 error = nf90_put_att(ncid, id_y,
"cartesian_axis",
"Y")
2001 call
netcdf_err(error,
'WRITING YAXIS_1 FIELD' )
2003 error = nf90_def_var(ncid,
'zaxis_1', nf90_float, (/dim_lsoil/), id_lsoil)
2004 call
netcdf_err(error,
'DEFINING ZAXIS_1 FIELD' )
2005 error = nf90_put_att(ncid, id_lsoil,
"long_name",
"zaxis_1")
2006 call
netcdf_err(error,
'DEFINING ZAXIS_1 LONG NAME' )
2007 error = nf90_put_att(ncid, id_lsoil,
"units",
"none")
2008 call
netcdf_err(error,
'DEFINING ZAXIS_1 UNITS' )
2009 error = nf90_put_att(ncid, id_lsoil,
"cartesian_axis",
"Z")
2010 call
netcdf_err(error,
'WRITING ZAXIS_1 FIELD' )
2012 error = nf90_def_var(ncid,
'Time', nf90_float, dim_time, id_time)
2013 call
netcdf_err(error,
'DEFINING TIME FIELD' )
2014 error = nf90_put_att(ncid, id_time,
"long_name",
"Time")
2015 call
netcdf_err(error,
'DEFINING TIME LONG NAME' )
2016 error = nf90_put_att(ncid, id_time,
"units",
"time level")
2017 call
netcdf_err(error,
'DEFINING TIME UNITS' )
2018 error = nf90_put_att(ncid, id_time,
"cartesian_axis",
"T")
2019 call
netcdf_err(error,
'WRITING TIME FIELD' )
2021 error = nf90_def_var(ncid,
'geolon', nf90_double, (/dim_x,dim_y/), id_lon)
2023 error = nf90_put_att(ncid, id_lon,
"long_name",
"Longitude")
2024 call
netcdf_err(error,
'DEFINING GEOLON LONG NAME' )
2025 error = nf90_put_att(ncid, id_lon,
"units",
"degrees_east")
2026 call
netcdf_err(error,
'DEFINING GEOLON UNITS' )
2028 error = nf90_def_var(ncid,
'geolat', nf90_double, (/dim_x,dim_y/), id_lat)
2030 error = nf90_put_att(ncid, id_lat,
"long_name",
"Latitude")
2031 call
netcdf_err(error,
'DEFINING GEOLAT LONG NAME' )
2032 error = nf90_put_att(ncid, id_lat,
"units",
"degrees_north")
2033 call
netcdf_err(error,
'DEFINING GEOLAT UNITS' )
2035 error = nf90_def_var(ncid,
'slmsk', nf90_double, (/dim_x,dim_y,dim_time/), id_slmsk)
2037 error = nf90_put_att(ncid, id_slmsk,
"long_name",
"slmsk")
2038 call
netcdf_err(error,
'DEFINING SLMSK LONG NAME' )
2039 error = nf90_put_att(ncid, id_slmsk,
"units",
"none")
2040 call
netcdf_err(error,
'DEFINING SLMSK UNITS' )
2041 error = nf90_put_att(ncid, id_slmsk,
"coordinates",
"geolon geolat")
2042 call
netcdf_err(error,
'DEFINING SLMSK COORD' )
2044 error = nf90_def_var(ncid,
'tsea', nf90_double, (/dim_x,dim_y,dim_time/), id_tsea)
2046 error = nf90_put_att(ncid, id_tsea,
"long_name",
"tsea")
2047 call
netcdf_err(error,
'DEFINING TSEA LONG NAME' )
2048 error = nf90_put_att(ncid, id_tsea,
"units",
"none")
2049 call
netcdf_err(error,
'DEFINING TSEA UNITS' )
2050 error = nf90_put_att(ncid, id_tsea,
"coordinates",
"geolon geolat")
2051 call
netcdf_err(error,
'DEFINING TSEA COORD' )
2053 error = nf90_def_var(ncid,
'sheleg', nf90_double, (/dim_x,dim_y,dim_time/), id_sheleg)
2055 error = nf90_put_att(ncid, id_sheleg,
"long_name",
"sheleg")
2056 call
netcdf_err(error,
'DEFINING SHELEG LONG NAME' )
2057 error = nf90_put_att(ncid, id_sheleg,
"units",
"none")
2058 call
netcdf_err(error,
'DEFINING SHELEG UNITS' )
2059 error = nf90_put_att(ncid, id_sheleg,
"coordinates",
"geolon geolat")
2060 call
netcdf_err(error,
'DEFINING SHELEG COORD' )
2062 error = nf90_def_var(ncid,
'tg3', nf90_double, (/dim_x,dim_y,dim_time/), id_tg3)
2064 error = nf90_put_att(ncid, id_tg3,
"long_name",
"tg3")
2065 call
netcdf_err(error,
'DEFINING TG3 LONG NAME' )
2066 error = nf90_put_att(ncid, id_tg3,
"units",
"none")
2067 call
netcdf_err(error,
'DEFINING TG3 UNITS' )
2068 error = nf90_put_att(ncid, id_tg3,
"coordinates",
"geolon geolat")
2069 call
netcdf_err(error,
'DEFINING TG3 COORD' )
2071 error = nf90_def_var(ncid,
'zorl', nf90_double, (/dim_x,dim_y,dim_time/), id_zorl)
2073 error = nf90_put_att(ncid, id_zorl,
"long_name",
"zorl")
2074 call
netcdf_err(error,
'DEFINING ZORL LONG NAME' )
2075 error = nf90_put_att(ncid, id_zorl,
"units",
"none")
2076 call
netcdf_err(error,
'DEFINING ZORL UNITS' )
2077 error = nf90_put_att(ncid, id_zorl,
"coordinates",
"geolon geolat")
2078 call
netcdf_err(error,
'DEFINING ZORL COORD' )
2080 error = nf90_def_var(ncid,
'alvsf', nf90_double, (/dim_x,dim_y,dim_time/), id_alvsf)
2082 error = nf90_put_att(ncid, id_alvsf,
"long_name",
"alvsf")
2083 call
netcdf_err(error,
'DEFINING ALVSF LONG NAME' )
2084 error = nf90_put_att(ncid, id_alvsf,
"units",
"none")
2085 call
netcdf_err(error,
'DEFINING ALVSF UNITS' )
2086 error = nf90_put_att(ncid, id_alvsf,
"coordinates",
"geolon geolat")
2087 call
netcdf_err(error,
'DEFINING ALVSF COORD' )
2089 error = nf90_def_var(ncid,
'alvwf', nf90_double, (/dim_x,dim_y,dim_time/), id_alvwf)
2091 error = nf90_put_att(ncid, id_alvwf,
"long_name",
"alvwf")
2092 call
netcdf_err(error,
'DEFINING ALVWF LONG NAME' )
2093 error = nf90_put_att(ncid, id_alvwf,
"units",
"none")
2094 call
netcdf_err(error,
'DEFINING ALVWF UNITS' )
2095 error = nf90_put_att(ncid, id_alvwf,
"coordinates",
"geolon geolat")
2096 call
netcdf_err(error,
'DEFINING ALVWF COORD' )
2098 error = nf90_def_var(ncid,
'alnsf', nf90_double, (/dim_x,dim_y,dim_time/), id_alnsf)
2100 error = nf90_put_att(ncid, id_alnsf,
"long_name",
"alnsf")
2101 call
netcdf_err(error,
'DEFINING ALNSF LONG NAME' )
2102 error = nf90_put_att(ncid, id_alnsf,
"units",
"none")
2103 call
netcdf_err(error,
'DEFINING ALNSF UNITS' )
2104 error = nf90_put_att(ncid, id_alnsf,
"coordinates",
"geolon geolat")
2105 call
netcdf_err(error,
'DEFINING ALNSF COORD' )
2107 error = nf90_def_var(ncid,
'alnwf', nf90_double, (/dim_x,dim_y,dim_time/), id_alnwf)
2109 error = nf90_put_att(ncid, id_alnwf,
"long_name",
"alnwf")
2110 call
netcdf_err(error,
'DEFINING ALNWF LONG NAME' )
2111 error = nf90_put_att(ncid, id_alnwf,
"units",
"none")
2112 call
netcdf_err(error,
'DEFINING ALNWF UNITS' )
2113 error = nf90_put_att(ncid, id_alnwf,
"coordinates",
"geolon geolat")
2114 call
netcdf_err(error,
'DEFINING ALNWF COORD' )
2116 error = nf90_def_var(ncid,
'facsf', nf90_double, (/dim_x,dim_y,dim_time/), id_facsf)
2118 error = nf90_put_att(ncid, id_facsf,
"long_name",
"facsf")
2119 call
netcdf_err(error,
'DEFINING FACSF LONG NAME' )
2120 error = nf90_put_att(ncid, id_facsf,
"units",
"none")
2121 call
netcdf_err(error,
'DEFINING FACSF UNITS' )
2122 error = nf90_put_att(ncid, id_facsf,
"coordinates",
"geolon geolat")
2123 call
netcdf_err(error,
'DEFINING FACSF COORD' )
2125 error = nf90_def_var(ncid,
'facwf', nf90_double, (/dim_x,dim_y,dim_time/), id_facwf)
2127 error = nf90_put_att(ncid, id_facwf,
"long_name",
"facwf")
2128 call
netcdf_err(error,
'DEFINING FACWF LONG NAME' )
2129 error = nf90_put_att(ncid, id_facwf,
"units",
"none")
2130 call
netcdf_err(error,
'DEFINING FACWF UNITS' )
2131 error = nf90_put_att(ncid, id_facwf,
"coordinates",
"geolon geolat")
2132 call
netcdf_err(error,
'DEFINING FACWF COORD' )
2134 error = nf90_def_var(ncid,
'vfrac', nf90_double, (/dim_x,dim_y,dim_time/), id_vfrac)
2136 error = nf90_put_att(ncid, id_vfrac,
"long_name",
"vfrac")
2137 call
netcdf_err(error,
'DEFINING VFRAC LONG NAME' )
2138 error = nf90_put_att(ncid, id_vfrac,
"units",
"none")
2139 call
netcdf_err(error,
'DEFINING VFRAC UNITS' )
2140 error = nf90_put_att(ncid, id_vfrac,
"coordinates",
"geolon geolat")
2141 call
netcdf_err(error,
'DEFINING VFRAC COORD' )
2143 error = nf90_def_var(ncid,
'canopy', nf90_double, (/dim_x,dim_y,dim_time/), id_canopy)
2145 error = nf90_put_att(ncid, id_canopy,
"long_name",
"canopy")
2146 call
netcdf_err(error,
'DEFINING CANOPY LONG NAME' )
2147 error = nf90_put_att(ncid, id_canopy,
"units",
"none")
2148 call
netcdf_err(error,
'DEFINING CANOPY UNITS' )
2149 error = nf90_put_att(ncid, id_canopy,
"coordinates",
"geolon geolat")
2150 call
netcdf_err(error,
'DEFINING CANOPY COORD' )
2152 error = nf90_def_var(ncid,
'f10m', nf90_double, (/dim_x,dim_y,dim_time/), id_f10m)
2154 error = nf90_put_att(ncid, id_f10m,
"long_name",
"f10m")
2155 call
netcdf_err(error,
'DEFINING F10M LONG NAME' )
2156 error = nf90_put_att(ncid, id_f10m,
"units",
"none")
2157 call
netcdf_err(error,
'DEFINING F10M UNITS' )
2158 error = nf90_put_att(ncid, id_f10m,
"coordinates",
"geolon geolat")
2159 call
netcdf_err(error,
'DEFINING F10M COORD' )
2161 error = nf90_def_var(ncid,
't2m', nf90_double, (/dim_x,dim_y,dim_time/), id_t2m)
2163 error = nf90_put_att(ncid, id_t2m,
"long_name",
"t2m")
2164 call
netcdf_err(error,
'DEFINING T2M LONG NAME' )
2165 error = nf90_put_att(ncid, id_t2m,
"units",
"none")
2166 call
netcdf_err(error,
'DEFINING T2M UNITS' )
2167 error = nf90_put_att(ncid, id_t2m,
"coordinates",
"geolon geolat")
2168 call
netcdf_err(error,
'DEFINING T2M COORD' )
2170 error = nf90_def_var(ncid,
'q2m', nf90_double, (/dim_x,dim_y,dim_time/), id_q2m)
2172 error = nf90_put_att(ncid, id_q2m,
"long_name",
"q2m")
2173 call
netcdf_err(error,
'DEFINING Q2M LONG NAME' )
2174 error = nf90_put_att(ncid, id_q2m,
"units",
"none")
2175 call
netcdf_err(error,
'DEFINING Q2M UNITS' )
2176 error = nf90_put_att(ncid, id_q2m,
"coordinates",
"geolon geolat")
2177 call
netcdf_err(error,
'DEFINING Q2M COORD' )
2179 error = nf90_def_var(ncid,
'vtype', nf90_double, (/dim_x,dim_y,dim_time/), id_vtype)
2181 error = nf90_put_att(ncid, id_vtype,
"long_name",
"vtype")
2182 call
netcdf_err(error,
'DEFINING VTYPE LONG NAME' )
2183 error = nf90_put_att(ncid, id_vtype,
"units",
"none")
2184 call
netcdf_err(error,
'DEFINING VTYPE UNITS' )
2185 error = nf90_put_att(ncid, id_vtype,
"coordinates",
"geolon geolat")
2186 call
netcdf_err(error,
'DEFINING VTYPE COORD' )
2188 error = nf90_def_var(ncid,
'stype', nf90_double, (/dim_x,dim_y,dim_time/), id_stype)
2190 error = nf90_put_att(ncid, id_stype,
"long_name",
"stype")
2191 call
netcdf_err(error,
'DEFINING STYPE LONG NAME' )
2192 error = nf90_put_att(ncid, id_stype,
"units",
"none")
2193 call
netcdf_err(error,
'DEFINING STYPE UNITS' )
2194 error = nf90_put_att(ncid, id_stype,
"coordinates",
"geolon geolat")
2195 call
netcdf_err(error,
'DEFINING STYPE COORD' )
2197 error = nf90_def_var(ncid,
'uustar', nf90_double, (/dim_x,dim_y,dim_time/), id_uustar)
2199 error = nf90_put_att(ncid, id_uustar,
"long_name",
"uustar")
2200 call
netcdf_err(error,
'DEFINING UUSTAR LONG NAME' )
2201 error = nf90_put_att(ncid, id_uustar,
"units",
"none")
2202 call
netcdf_err(error,
'DEFINING UUSTAR UNITS' )
2203 error = nf90_put_att(ncid, id_uustar,
"coordinates",
"geolon geolat")
2204 call
netcdf_err(error,
'DEFINING UUSTAR COORD' )
2206 error = nf90_def_var(ncid,
'ffmm', nf90_double, (/dim_x,dim_y,dim_time/), id_ffmm)
2208 error = nf90_put_att(ncid, id_ffmm,
"long_name",
"ffmm")
2209 call
netcdf_err(error,
'DEFINING FFMM LONG NAME' )
2210 error = nf90_put_att(ncid, id_ffmm,
"units",
"none")
2211 call
netcdf_err(error,
'DEFINING FFMM UNITS' )
2212 error = nf90_put_att(ncid, id_ffmm,
"coordinates",
"geolon geolat")
2213 call
netcdf_err(error,
'DEFINING FFMM COORD' )
2215 error = nf90_def_var(ncid,
'ffhh', nf90_double, (/dim_x,dim_y,dim_time/), id_ffhh)
2217 error = nf90_put_att(ncid, id_ffhh,
"long_name",
"ffhh")
2218 call
netcdf_err(error,
'DEFINING FFHH LONG NAME' )
2219 error = nf90_put_att(ncid, id_ffhh,
"units",
"none")
2220 call
netcdf_err(error,
'DEFINING FFHH UNITS' )
2221 error = nf90_put_att(ncid, id_ffhh,
"coordinates",
"geolon geolat")
2222 call
netcdf_err(error,
'DEFINING FFHH COORD' )
2224 error = nf90_def_var(ncid,
'hice', nf90_double, (/dim_x,dim_y,dim_time/), id_hice)
2226 error = nf90_put_att(ncid, id_hice,
"long_name",
"hice")
2227 call
netcdf_err(error,
'DEFINING HICE LONG NAME' )
2228 error = nf90_put_att(ncid, id_hice,
"units",
"none")
2229 call
netcdf_err(error,
'DEFINING HICE UNITS' )
2230 error = nf90_put_att(ncid, id_hice,
"coordinates",
"geolon geolat")
2231 call
netcdf_err(error,
'DEFINING HICE COORD' )
2233 error = nf90_def_var(ncid,
'fice', nf90_double, (/dim_x,dim_y,dim_time/), id_fice)
2235 error = nf90_put_att(ncid, id_fice,
"long_name",
"fice")
2236 call
netcdf_err(error,
'DEFINING FICE LONG NAME' )
2237 error = nf90_put_att(ncid, id_fice,
"units",
"none")
2238 call
netcdf_err(error,
'DEFINING FICE UNITS' )
2239 error = nf90_put_att(ncid, id_fice,
"coordinates",
"geolon geolat")
2240 call
netcdf_err(error,
'DEFINING FICE COORD' )
2242 error = nf90_def_var(ncid,
'tisfc', nf90_double, (/dim_x,dim_y,dim_time/), id_tisfc)
2244 error = nf90_put_att(ncid, id_tisfc,
"long_name",
"tisfc")
2245 call
netcdf_err(error,
'DEFINING TISFC LONG NAME' )
2246 error = nf90_put_att(ncid, id_tisfc,
"units",
"none")
2247 call
netcdf_err(error,
'DEFINING TISFC UNITS' )
2248 error = nf90_put_att(ncid, id_tisfc,
"coordinates",
"geolon geolat")
2249 call
netcdf_err(error,
'DEFINING TISFC COORD' )
2251 error = nf90_def_var(ncid,
'tprcp', nf90_double, (/dim_x,dim_y,dim_time/), id_tprcp)
2253 error = nf90_put_att(ncid, id_tprcp,
"long_name",
"tprcp")
2254 call
netcdf_err(error,
'DEFINING TPRCP LONG NAME' )
2255 error = nf90_put_att(ncid, id_tprcp,
"units",
"none")
2256 call
netcdf_err(error,
'DEFINING TPRCP UNITS' )
2257 error = nf90_put_att(ncid, id_tprcp,
"coordinates",
"geolon geolat")
2258 call
netcdf_err(error,
'DEFINING TPRCP COORD' )
2260 error = nf90_def_var(ncid,
'srflag', nf90_double, (/dim_x,dim_y,dim_time/), id_srflag)
2262 error = nf90_put_att(ncid, id_srflag,
"long_name",
"srflag")
2263 call
netcdf_err(error,
'DEFINING SRFLAG LONG NAME' )
2264 error = nf90_put_att(ncid, id_srflag,
"units",
"none")
2265 call
netcdf_err(error,
'DEFINING SRFLAG UNITS' )
2266 error = nf90_put_att(ncid, id_srflag,
"coordinates",
"geolon geolat")
2267 call
netcdf_err(error,
'DEFINING SRFLAG COORD' )
2269 error = nf90_def_var(ncid,
'snwdph', nf90_double, (/dim_x,dim_y,dim_time/), id_snwdph)
2271 error = nf90_put_att(ncid, id_snwdph,
"long_name",
"snwdph")
2272 call
netcdf_err(error,
'DEFINING SNWDPH LONG NAME' )
2273 error = nf90_put_att(ncid, id_snwdph,
"units",
"none")
2274 call
netcdf_err(error,
'DEFINING SNWDPH UNITS' )
2275 error = nf90_put_att(ncid, id_snwdph,
"coordinates",
"geolon geolat")
2276 call
netcdf_err(error,
'DEFINING SNWDPH COORD' )
2278 error = nf90_def_var(ncid,
'shdmin', nf90_double, (/dim_x,dim_y,dim_time/), id_shdmin)
2280 error = nf90_put_att(ncid, id_shdmin,
"long_name",
"shdmin")
2281 call
netcdf_err(error,
'DEFINING SHDMIN LONG NAME' )
2282 error = nf90_put_att(ncid, id_shdmin,
"units",
"none")
2283 call
netcdf_err(error,
'DEFINING SHDMIN UNITS' )
2284 error = nf90_put_att(ncid, id_shdmin,
"coordinates",
"geolon geolat")
2285 call
netcdf_err(error,
'DEFINING SHDMIN COORD' )
2287 error = nf90_def_var(ncid,
'shdmax', nf90_double, (/dim_x,dim_y,dim_time/), id_shdmax)
2289 error = nf90_put_att(ncid, id_shdmax,
"long_name",
"shdmax")
2290 call
netcdf_err(error,
'DEFINING SHDMAX LONG NAME' )
2291 error = nf90_put_att(ncid, id_shdmax,
"units",
"none")
2292 call
netcdf_err(error,
'DEFINING SHDMAX UNITS' )
2293 error = nf90_put_att(ncid, id_shdmax,
"coordinates",
"geolon geolat")
2294 call
netcdf_err(error,
'DEFINING SHDMAX COORD' )
2296 error = nf90_def_var(ncid,
'slope', nf90_double, (/dim_x,dim_y,dim_time/), id_slope)
2298 error = nf90_put_att(ncid, id_slope,
"long_name",
"slope")
2299 call
netcdf_err(error,
'DEFINING SLOPE LONG NAME' )
2300 error = nf90_put_att(ncid, id_slope,
"units",
"none")
2301 call
netcdf_err(error,
'DEFINING SLOPE UNITS' )
2302 error = nf90_put_att(ncid, id_slope,
"coordinates",
"geolon geolat")
2303 call
netcdf_err(error,
'DEFINING SLOPE COORD' )
2305 error = nf90_def_var(ncid,
'snoalb', nf90_double, (/dim_x,dim_y,dim_time/), id_snoalb)
2307 error = nf90_put_att(ncid, id_snoalb,
"long_name",
"snoalb")
2308 call
netcdf_err(error,
'DEFINING SNOALB LONG NAME' )
2309 error = nf90_put_att(ncid, id_snoalb,
"units",
"none")
2310 call
netcdf_err(error,
'DEFINING SNOALB UNITS' )
2311 error = nf90_put_att(ncid, id_snoalb,
"coordinates",
"geolon geolat")
2312 call
netcdf_err(error,
'DEFINING SNOALB COORD' )
2314 if (.not. lai_from_climo)
then
2315 error = nf90_def_var(ncid,
'lai', nf90_double, (/dim_x,dim_y,dim_time/), id_lai)
2317 error = nf90_put_att(ncid, id_lai,
"long_name",
"lai")
2318 call
netcdf_err(error,
'DEFINING LAI LONG NAME' )
2319 error = nf90_put_att(ncid, id_lai,
"units",
"none")
2320 call
netcdf_err(error,
'DEFINING LAI UNITS' )
2321 error = nf90_put_att(ncid, id_lai,
"coordinates",
"geolon geolat")
2322 call
netcdf_err(error,
'DEFINING LAI COORD' )
2325 error = nf90_def_var(ncid,
'stc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_stc)
2327 error = nf90_put_att(ncid, id_stc,
"long_name",
"stc")
2328 call
netcdf_err(error,
'DEFINING STC LONG NAME' )
2329 error = nf90_put_att(ncid, id_stc,
"units",
"none")
2330 call
netcdf_err(error,
'DEFINING STC UNITS' )
2331 error = nf90_put_att(ncid, id_stc,
"coordinates",
"geolon geolat")
2332 call
netcdf_err(error,
'DEFINING STC COORD' )
2334 error = nf90_def_var(ncid,
'smc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_smc)
2336 error = nf90_put_att(ncid, id_smc,
"long_name",
"smc")
2337 call
netcdf_err(error,
'DEFINING SMC LONG NAME' )
2338 error = nf90_put_att(ncid, id_smc,
"units",
"none")
2339 call
netcdf_err(error,
'DEFINING SMC UNITS' )
2340 error = nf90_put_att(ncid, id_smc,
"coordinates",
"geolon geolat")
2341 call
netcdf_err(error,
'DEFINING SMC COORD' )
2343 error = nf90_def_var(ncid,
'slc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_slc)
2345 error = nf90_put_att(ncid, id_slc,
"long_name",
"slc")
2346 call
netcdf_err(error,
'DEFINING SLC LONG NAME' )
2347 error = nf90_put_att(ncid, id_slc,
"units",
"none")
2348 call
netcdf_err(error,
'DEFINING SLC UNITS' )
2349 error = nf90_put_att(ncid, id_slc,
"coordinates",
"geolon geolat")
2350 call
netcdf_err(error,
'DEFINING SLC COORD' )
2352 if (convert_nst)
then
2354 error = nf90_def_var(ncid,
'tref', nf90_double, (/dim_x,dim_y,dim_time/), id_tref)
2356 error = nf90_put_att(ncid, id_tref,
"long_name",
"tref")
2357 call
netcdf_err(error,
'DEFINING TREF LONG NAME' )
2358 error = nf90_put_att(ncid, id_tref,
"units",
"none")
2359 call
netcdf_err(error,
'DEFINING TREF UNITS' )
2360 error = nf90_put_att(ncid, id_tref,
"coordinates",
"geolon geolat")
2361 call
netcdf_err(error,
'DEFINING TREF COORD' )
2363 error = nf90_def_var(ncid,
'z_c', nf90_double, (/dim_x,dim_y,dim_time/), id_z_c)
2365 error = nf90_put_att(ncid, id_z_c,
"long_name",
"z_c")
2366 call
netcdf_err(error,
'DEFINING Z_C LONG NAME' )
2367 error = nf90_put_att(ncid, id_z_c,
"units",
"none")
2368 call
netcdf_err(error,
'DEFINING Z_C UNITS' )
2369 error = nf90_put_att(ncid, id_z_c,
"coordinates",
"geolon geolat")
2370 call
netcdf_err(error,
'DEFINING Z_C COORD' )
2372 error = nf90_def_var(ncid,
'c_0', nf90_double, (/dim_x,dim_y,dim_time/), id_c_0)
2374 error = nf90_put_att(ncid, id_c_0,
"long_name",
"c_0")
2375 call
netcdf_err(error,
'DEFINING C_0 LONG NAME' )
2376 error = nf90_put_att(ncid, id_c_0,
"units",
"none")
2377 call
netcdf_err(error,
'DEFINING C_0 UNITS' )
2378 error = nf90_put_att(ncid, id_c_0,
"coordinates",
"geolon geolat")
2379 call
netcdf_err(error,
'DEFINING C_0 COORD' )
2381 error = nf90_def_var(ncid,
'c_d', nf90_double, (/dim_x,dim_y,dim_time/), id_c_d)
2383 error = nf90_put_att(ncid, id_c_d,
"long_name",
"c_d")
2384 call
netcdf_err(error,
'DEFINING C_D LONG NAME' )
2385 error = nf90_put_att(ncid, id_c_d,
"units",
"none")
2386 call
netcdf_err(error,
'DEFINING C_D UNITS' )
2387 error = nf90_put_att(ncid, id_c_d,
"coordinates",
"geolon geolat")
2388 call
netcdf_err(error,
'DEFINING C_D COORD' )
2390 error = nf90_def_var(ncid,
'w_0', nf90_double, (/dim_x,dim_y,dim_time/), id_w_0)
2392 error = nf90_put_att(ncid, id_w_0,
"long_name",
"w_0")
2393 call
netcdf_err(error,
'DEFINING W_0 LONG NAME' )
2394 error = nf90_put_att(ncid, id_w_0,
"units",
"none")
2395 call
netcdf_err(error,
'DEFINING W_0 UNITS' )
2396 error = nf90_put_att(ncid, id_w_0,
"coordinates",
"geolon geolat")
2397 call
netcdf_err(error,
'DEFINING W_0 COORD' )
2399 error = nf90_def_var(ncid,
'w_d', nf90_double, (/dim_x,dim_y,dim_time/), id_w_d)
2401 error = nf90_put_att(ncid, id_w_d,
"long_name",
"w_d")
2402 call
netcdf_err(error,
'DEFINING W_D LONG NAME' )
2403 error = nf90_put_att(ncid, id_w_d,
"units",
"none")
2404 call
netcdf_err(error,
'DEFINING W_D UNITS' )
2405 error = nf90_put_att(ncid, id_w_d,
"coordinates",
"geolon geolat")
2406 call
netcdf_err(error,
'DEFINING W_D COORD' )
2408 error = nf90_def_var(ncid,
'xt', nf90_double, (/dim_x,dim_y,dim_time/), id_xt)
2410 error = nf90_put_att(ncid, id_xt,
"long_name",
"xt")
2411 call
netcdf_err(error,
'DEFINING XT LONG NAME' )
2412 error = nf90_put_att(ncid, id_xt,
"units",
"none")
2414 error = nf90_put_att(ncid, id_xt,
"coordinates",
"geolon geolat")
2417 error = nf90_def_var(ncid,
'xs', nf90_double, (/dim_x,dim_y,dim_time/), id_xs)
2419 error = nf90_put_att(ncid, id_xs,
"long_name",
"xs")
2420 call
netcdf_err(error,
'DEFINING XS LONG NAME' )
2421 error = nf90_put_att(ncid, id_xs,
"units",
"none")
2423 error = nf90_put_att(ncid, id_xs,
"coordinates",
"geolon geolat")
2426 error = nf90_def_var(ncid,
'xu', nf90_double, (/dim_x,dim_y,dim_time/), id_xu)
2428 error = nf90_put_att(ncid, id_xu,
"long_name",
"xu")
2429 call
netcdf_err(error,
'DEFINING XU LONG NAME' )
2430 error = nf90_put_att(ncid, id_xu,
"units",
"none")
2432 error = nf90_put_att(ncid, id_xu,
"coordinates",
"geolon geolat")
2435 error = nf90_def_var(ncid,
'xv', nf90_double, (/dim_x,dim_y,dim_time/), id_xv)
2437 error = nf90_put_att(ncid, id_xv,
"long_name",
"xv")
2438 call
netcdf_err(error,
'DEFINING XV LONG NAME' )
2439 error = nf90_put_att(ncid, id_xv,
"units",
"none")
2441 error = nf90_put_att(ncid, id_xv,
"coordinates",
"geolon geolat")
2444 error = nf90_def_var(ncid,
'xz', nf90_double, (/dim_x,dim_y,dim_time/), id_xz)
2446 error = nf90_put_att(ncid, id_xz,
"long_name",
"xz")
2447 call
netcdf_err(error,
'DEFINING XZ LONG NAME' )
2448 error = nf90_put_att(ncid, id_xz,
"units",
"none")
2450 error = nf90_put_att(ncid, id_xz,
"coordinates",
"geolon geolat")
2453 error = nf90_def_var(ncid,
'zm', nf90_double, (/dim_x,dim_y,dim_time/), id_zm)
2455 error = nf90_put_att(ncid, id_zm,
"long_name",
"zm")
2456 call
netcdf_err(error,
'DEFINING ZM LONG NAME' )
2457 error = nf90_put_att(ncid, id_zm,
"units",
"none")
2459 error = nf90_put_att(ncid, id_zm,
"coordinates",
"geolon geolat")
2462 error = nf90_def_var(ncid,
'xtts', nf90_double, (/dim_x,dim_y,dim_time/), id_xtts)
2464 error = nf90_put_att(ncid, id_xtts,
"long_name",
"xtts")
2465 call
netcdf_err(error,
'DEFINING XTTS LONG NAME' )
2466 error = nf90_put_att(ncid, id_xtts,
"units",
"none")
2467 call
netcdf_err(error,
'DEFINING XTTS UNITS' )
2468 error = nf90_put_att(ncid, id_xtts,
"coordinates",
"geolon geolat")
2469 call
netcdf_err(error,
'DEFINING XTTS COORD' )
2471 error = nf90_def_var(ncid,
'xzts', nf90_double, (/dim_x,dim_y,dim_time/), id_xzts)
2473 error = nf90_put_att(ncid, id_xzts,
"long_name",
"xzts")
2474 call
netcdf_err(error,
'DEFINING XZTS LONG NAME' )
2475 error = nf90_put_att(ncid, id_xzts,
"units",
"none")
2476 call
netcdf_err(error,
'DEFINING XZTS UNITS' )
2477 error = nf90_put_att(ncid, id_xzts,
"coordinates",
"geolon geolat")
2478 call
netcdf_err(error,
'DEFINING XZTS COORD' )
2480 error = nf90_def_var(ncid,
'd_conv', nf90_double, (/dim_x,dim_y,dim_time/), id_d_conv)
2482 error = nf90_put_att(ncid, id_d_conv,
"long_name",
"d_conv")
2483 call
netcdf_err(error,
'DEFINING D_CONV LONG NAME' )
2484 error = nf90_put_att(ncid, id_d_conv,
"units",
"none")
2485 call
netcdf_err(error,
'DEFINING D_CONV UNITS' )
2486 error = nf90_put_att(ncid, id_d_conv,
"coordinates",
"geolon geolat")
2487 call
netcdf_err(error,
'DEFINING D_CONV COORD' )
2489 error = nf90_def_var(ncid,
'ifd', nf90_double, (/dim_x,dim_y,dim_time/), id_ifd)
2491 error = nf90_put_att(ncid, id_ifd,
"long_name",
"ifd")
2492 call
netcdf_err(error,
'DEFINING IFD LONG NAME' )
2493 error = nf90_put_att(ncid, id_ifd,
"units",
"none")
2494 call
netcdf_err(error,
'DEFINING IFD UNITS' )
2495 error = nf90_put_att(ncid, id_ifd,
"coordinates",
"geolon geolat")
2496 call
netcdf_err(error,
'DEFINING IFD COORD' )
2498 error = nf90_def_var(ncid,
'dt_cool', nf90_double, (/dim_x,dim_y,dim_time/), id_dt_cool)
2500 error = nf90_put_att(ncid, id_dt_cool,
"long_name",
"dt_cool")
2501 call
netcdf_err(error,
'DEFINING DT_COOL LONG NAME' )
2502 error = nf90_put_att(ncid, id_dt_cool,
"units",
"none")
2503 call
netcdf_err(error,
'DEFINING DT_COOL UNITS' )
2504 error = nf90_put_att(ncid, id_dt_cool,
"coordinates",
"geolon geolat")
2505 call
netcdf_err(error,
'DEFINING DT_COOL COORD' )
2507 error = nf90_def_var(ncid,
'qrain', nf90_double, (/dim_x,dim_y,dim_time/), id_qrain)
2509 error = nf90_put_att(ncid, id_qrain,
"long_name",
"qrain")
2510 call
netcdf_err(error,
'DEFINING QRAIN LONG NAME' )
2511 error = nf90_put_att(ncid, id_qrain,
"units",
"none")
2512 call
netcdf_err(error,
'DEFINING QRAIN UNITS' )
2513 error = nf90_put_att(ncid, id_qrain,
"coordinates",
"geolon geolat")
2514 call
netcdf_err(error,
'DEFINING QRAIN COORD' )
2518 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
2523 if (localpet == 0)
then
2524 error = nf90_put_var( ncid, id_lsoil, lsoil_data)
2525 call
netcdf_err(error,
'WRITING ZAXIS RECORD' )
2526 error = nf90_put_var( ncid, id_x, x_data)
2527 call
netcdf_err(error,
'WRITING XAXIS RECORD' )
2528 error = nf90_put_var( ncid, id_y, y_data)
2529 call
netcdf_err(error,
'WRITING YAXIS RECORD' )
2531 error = nf90_put_var( ncid, id_time, times)
2532 call
netcdf_err(error,
'WRITING TIME RECORD' )
2535 print*,
"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile
2536 call esmf_fieldgather(latitude_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2537 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2540 if (localpet == 0)
then
2541 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2542 error = nf90_put_var( ncid, id_lat, dum2d)
2543 call
netcdf_err(error,
'WRITING LATITUDE RECORD' )
2546 print*,
"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile
2547 call esmf_fieldgather(longitude_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2548 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2551 if (localpet == 0)
then
2552 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2553 error = nf90_put_var( ncid, id_lon, dum2d)
2554 call
netcdf_err(error,
'WRITING LONGITUDE RECORD' )
2557 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV FOR TILE: ", tile
2558 call esmf_fieldgather(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2559 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2562 if (localpet == 0)
then
2563 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2564 error = nf90_put_var( ncid, id_sheleg, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2565 call
netcdf_err(error,
'WRITING SNOW LIQ EQUIV RECORD' )
2568 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH FOR TILE: ", tile
2569 call esmf_fieldgather(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2570 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2573 if (localpet == 0)
then
2574 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2575 error = nf90_put_var( ncid, id_snwdph, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2576 call
netcdf_err(error,
'WRITING SNWDPH RECORD' )
2579 print*,
"- CALL FieldGather FOR TARGET GRID SLOPE TYPE FOR TILE: ", tile
2580 call esmf_fieldgather(slope_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2581 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2584 if (localpet == 0)
then
2585 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2586 error = nf90_put_var( ncid, id_slope, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2587 call
netcdf_err(error,
'WRITING SLOPE RECORD' )
2590 print*,
"- CALL FieldGather FOR TARGET GRID Z0 FOR TILE: ", tile
2591 call esmf_fieldgather(z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2592 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2595 if (localpet == 0)
then
2596 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2597 error = nf90_put_var( ncid, id_zorl, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2601 print*,
"- CALL FieldGather FOR TARGET GRID MAX SNOW ALBEDO FOR TILE: ", tile
2602 call esmf_fieldgather(mxsno_albedo_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2603 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2606 if (localpet == 0)
then
2607 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2608 error = nf90_put_var( ncid, id_snoalb, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2609 call
netcdf_err(error,
'WRITING MAX SNOW ALBEDO RECORD' )
2612 if (.not. lai_from_climo)
then
2613 print*,
"- CALL FieldGather FOR TARGET GRID LEAF AREA INDEX FOR TILE: ", tile
2614 call esmf_fieldgather(lai_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2615 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2618 if (localpet == 0)
then
2619 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2620 error = nf90_put_var( ncid, id_lai, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2621 call
netcdf_err(error,
'WRITING LEAF AREA INDEX RECORD' )
2625 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TYPE FOR TILE: ", tile
2626 call esmf_fieldgather(soil_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2627 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2630 if (localpet == 0)
then
2631 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2632 error = nf90_put_var( ncid, id_stype, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2633 call
netcdf_err(error,
'WRITING SOIL TYPE RECORD' )
2636 print*,
"- CALL FieldGather FOR TARGET GRID VEGETATION TYPE FOR TILE: ", tile
2637 call esmf_fieldgather(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2638 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2641 if (localpet == 0)
then
2642 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2643 error = nf90_put_var( ncid, id_vtype, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2644 call
netcdf_err(error,
'WRITING VEGETATION TYPE RECORD' )
2647 print*,
"- CALL FieldGather FOR TARGET GRID VEGETATION GREENNESS FOR TILE: ", tile
2648 call esmf_fieldgather(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2649 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2652 if (localpet == 0)
then
2653 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2654 error = nf90_put_var( ncid, id_vfrac, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2655 call
netcdf_err(error,
'WRITING VEGETATION GREENNESS RECORD' )
2658 print*,
"- CALL FieldGather FOR TARGET GRID SUBSTRATE TEMPERATURE FOR TILE: ", tile
2659 call esmf_fieldgather(substrate_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2660 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2663 if (localpet == 0)
then
2664 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2665 error = nf90_put_var( ncid, id_tg3, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2666 call
netcdf_err(error,
'WRITING SUBSTRATE TEMPERATURE RECORD' )
2669 print*,
"- CALL FieldGather FOR TARGET GRID FACSF FOR TILE: ", tile
2670 call esmf_fieldgather(facsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2671 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2674 if (localpet == 0)
then
2675 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2676 error = nf90_put_var( ncid, id_facsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2677 call
netcdf_err(error,
'WRITING FACSF RECORD' )
2680 print*,
"- CALL FieldGather FOR TARGET GRID FACWF FOR TILE: ", tile
2681 call esmf_fieldgather(facwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2682 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2685 if (localpet == 0)
then
2686 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2687 error = nf90_put_var( ncid, id_facwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2688 call
netcdf_err(error,
'WRITING FACWF RECORD' )
2691 print*,
"- CALL FieldGather FOR TARGET GRID ALNSF FOR TILE: ", tile
2692 call esmf_fieldgather(alnsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2693 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2696 if (localpet == 0)
then
2697 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2698 error = nf90_put_var( ncid, id_alnsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2699 call
netcdf_err(error,
'WRITING ALNSF RECORD' )
2702 print*,
"- CALL FieldGather FOR TARGET GRID ALNWF FOR TILE: ", tile
2703 call esmf_fieldgather(alnwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2704 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2707 if (localpet == 0)
then
2708 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2709 error = nf90_put_var( ncid, id_alnwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2710 call
netcdf_err(error,
'WRITING ALNWF RECORD' )
2713 print*,
"- CALL FieldGather FOR TARGET GRID ALVSF FOR TILE: ", tile
2714 call esmf_fieldgather(alvsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2715 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2718 if (localpet == 0)
then
2719 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2720 error = nf90_put_var( ncid, id_alvsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2721 call
netcdf_err(error,
'WRITING ALVSF RECORD' )
2724 print*,
"- CALL FieldGather FOR TARGET GRID ALVWF FOR TILE: ", tile
2725 call esmf_fieldgather(alvwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2726 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2729 if (localpet == 0)
then
2730 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2731 error = nf90_put_var( ncid, id_alvwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2732 call
netcdf_err(error,
'WRITING ALVWF RECORD' )
2735 print*,
"- CALL FieldGather FOR TARGET GRID MAX VEGETATION GREENNESS FOR TILE: ", tile
2736 call esmf_fieldgather(max_veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2737 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2740 if (localpet == 0)
then
2741 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2742 error = nf90_put_var( ncid, id_shdmax, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2743 call
netcdf_err(error,
'WRITING MAX VEGETATION GREENNESS RECORD' )
2746 print*,
"- CALL FieldGather FOR TARGET GRID MIN VEGETATION GREENNESS FOR TILE: ", tile
2747 call esmf_fieldgather(min_veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2748 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2751 if (localpet == 0)
then
2752 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2753 error = nf90_put_var( ncid, id_shdmin, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2754 call
netcdf_err(error,
'WRITING MIN VEGETATION GREENNESS RECORD' )
2757 print*,
"- CALL FieldGather FOR TARGET GRID T2M FOR TILE: ", tile
2758 call esmf_fieldgather(t2m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2759 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2762 if (localpet == 0)
then
2763 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2764 error = nf90_put_var( ncid, id_t2m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2765 call
netcdf_err(error,
'WRITING T2M RECORD' )
2768 print*,
"- CALL FieldGather FOR TARGET GRID Q2M FOR TILE: ", tile
2769 call esmf_fieldgather(q2m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2770 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2773 if (localpet == 0)
then
2774 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2775 error = nf90_put_var( ncid, id_q2m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2776 call
netcdf_err(error,
'WRITING Q2M RECORD' )
2779 print*,
"- CALL FieldGather FOR TARGET GRID TPRCP FOR TILE: ", tile
2780 call esmf_fieldgather(tprcp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2781 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2784 if (localpet == 0)
then
2785 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2786 error = nf90_put_var( ncid, id_tprcp, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2787 call
netcdf_err(error,
'WRITING TPRCP RECORD' )
2790 print*,
"- CALL FieldGather FOR TARGET GRID F10M FOR TILE: ", tile
2791 call esmf_fieldgather(f10m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2792 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2795 if (localpet == 0)
then
2796 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2797 error = nf90_put_var( ncid, id_f10m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2798 call
netcdf_err(error,
'WRITING F10M RECORD' )
2801 print*,
"- CALL FieldGather FOR TARGET GRID FFMM FOR TILE: ", tile
2802 call esmf_fieldgather(ffmm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2803 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2806 if (localpet == 0)
then
2807 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2808 error = nf90_put_var( ncid, id_ffmm, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2809 call
netcdf_err(error,
'WRITING FFMM RECORD' )
2811 error = nf90_put_var( ncid, id_ffhh, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2812 call
netcdf_err(error,
'WRITING FFHH RECORD' )
2815 print*,
"- CALL FieldGather FOR TARGET GRID USTAR FOR TILE: ", tile
2816 call esmf_fieldgather(ustar_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2817 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2820 if (localpet == 0)
then
2821 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2822 error = nf90_put_var( ncid, id_uustar, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2823 call
netcdf_err(error,
'WRITING USTAR RECORD' )
2826 print*,
"- CALL FieldGather FOR TARGET GRID SRFLAG FOR TILE: ", tile
2827 call esmf_fieldgather(srflag_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2828 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2831 if (localpet == 0)
then
2832 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2833 error = nf90_put_var( ncid, id_srflag, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2834 call
netcdf_err(error,
'WRITING SRFLAG RECORD' )
2837 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE FRACTION FOR TILE: ", tile
2838 call esmf_fieldgather(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2839 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2842 if (localpet == 0)
then
2843 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2844 error = nf90_put_var( ncid, id_fice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2845 call
netcdf_err(error,
'WRITING FICE RECORD' )
2848 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE DEPTH FOR TILE: ", tile
2849 call esmf_fieldgather(seaice_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2850 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2853 if (localpet == 0)
then
2854 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2855 error = nf90_put_var( ncid, id_hice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2856 call
netcdf_err(error,
'WRITING HICE RECORD' )
2859 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE SKIN TEMP FOR TILE: ", tile
2860 call esmf_fieldgather(seaice_skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2861 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2864 if (localpet == 0)
then
2865 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2866 error = nf90_put_var( ncid, id_tisfc, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2867 call
netcdf_err(error,
'WRITING TISFC RECORD' )
2870 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMP FOR TILE: ", tile
2871 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2872 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2875 if (localpet == 0)
then
2876 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2877 error = nf90_put_var( ncid, id_tsea, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2878 call
netcdf_err(error,
'WRITING TSEA RECORD' )
2881 print*,
"- CALL FieldGather FOR TARGET GRID LANDMASK FOR TILE: ", tile
2882 call esmf_fieldgather(landmask_target_grid, idata_one_tile, rootpet=0, tile=tile, rc=error)
2883 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2886 if (localpet == 0)
then
2887 dum2d(:,:) = float(idata_one_tile(istart:iend, jstart:jend))
2888 error = nf90_put_var( ncid, id_slmsk, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2889 call
netcdf_err(error,
'WRITING LANDMASK RECORD' )
2892 print*,
"- CALL FieldGather FOR TARGET GRID CANOPY MOISTURE CONTENT FOR TILE: ", tile
2893 call esmf_fieldgather(canopy_mc_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2894 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2897 if (localpet == 0)
then
2898 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2899 error = nf90_put_var( ncid, id_canopy, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2900 call
netcdf_err(error,
'WRITING CANOPY MC RECORD' )
2905 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE FOR TILE: ", tile
2906 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
2907 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2910 if (localpet == 0)
then
2911 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2912 error = nf90_put_var( ncid, id_stc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,lsoil_target,1/))
2913 call
netcdf_err(error,
'WRITING SOIL TEMP RECORD' )
2918 print*,
"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE FOR TILE: ", tile
2919 call esmf_fieldgather(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
2920 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2923 if (localpet == 0)
then
2924 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2925 error = nf90_put_var( ncid, id_smc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,lsoil_target,1/))
2926 call
netcdf_err(error,
'WRITING TOTAL SOIL MOISTURE RECORD' )
2931 print*,
"- CALL FieldGather FOR TARGET GRID LIQUID SOIL MOISTURE FOR TILE: ", tile
2932 call esmf_fieldgather(soilm_liq_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
2933 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2936 if (localpet == 0)
then
2937 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2938 error = nf90_put_var( ncid, id_slc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,lsoil_target,1/))
2939 call
netcdf_err(error,
'WRITING LIQUID SOIL MOISTURE RECORD' )
2942 if (convert_nst)
then
2944 print*,
"- CALL FieldGather FOR TARGET C_D FOR TILE: ", tile
2945 call esmf_fieldgather(c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2946 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2949 if (localpet == 0)
then
2950 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2951 error = nf90_put_var( ncid, id_c_d, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2952 call
netcdf_err(error,
'WRITING C_D RECORD' )
2955 print*,
"- CALL FieldGather FOR TARGET C_0 FOR TILE: ", tile
2956 call esmf_fieldgather(c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2957 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2960 if (localpet == 0)
then
2961 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2962 error = nf90_put_var( ncid, id_c_0, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2963 call
netcdf_err(error,
'WRITING C_0 RECORD' )
2966 print*,
"- CALL FieldGather FOR TARGET D_CONV FOR TILE: ", tile
2967 call esmf_fieldgather(d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2968 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2971 if (localpet == 0)
then
2972 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2973 error = nf90_put_var( ncid, id_d_conv, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2974 call
netcdf_err(error,
'WRITING D_CONV RECORD' )
2977 print*,
"- CALL FieldGather FOR TARGET DT_COOL FOR TILE: ", tile
2978 call esmf_fieldgather(dt_cool_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2979 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2982 if (localpet == 0)
then
2983 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2984 error = nf90_put_var( ncid, id_dt_cool, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2985 call
netcdf_err(error,
'WRITING DT_COOL RECORD' )
2988 print*,
"- CALL FieldGather FOR TARGET IFD FOR TILE: ", tile
2989 call esmf_fieldgather(ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2990 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2993 if (localpet == 0)
then
2994 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2995 error = nf90_put_var( ncid, id_ifd, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2996 call
netcdf_err(error,
'WRITING IFD RECORD' )
2999 print*,
"- CALL FieldGather FOR TARGET QRAIN FOR TILE: ", tile
3000 call esmf_fieldgather(qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3001 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3004 if (localpet == 0)
then
3005 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3006 error = nf90_put_var( ncid, id_qrain, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3007 call
netcdf_err(error,
'WRITING QRAIN RECORD' )
3010 print*,
"- CALL FieldGather FOR TARGET TREF FOR TILE: ", tile
3011 call esmf_fieldgather(tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3012 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3015 if (localpet == 0)
then
3016 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3017 error = nf90_put_var( ncid, id_tref, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3018 call
netcdf_err(error,
'WRITING TREF RECORD' )
3021 print*,
"- CALL FieldGather FOR TARGET W_D FOR TILE: ", tile
3022 call esmf_fieldgather(w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3023 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3026 if (localpet == 0)
then
3027 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3028 error = nf90_put_var( ncid, id_w_d, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3029 call
netcdf_err(error,
'WRITING W_D RECORD' )
3032 print*,
"- CALL FieldGather FOR TARGET W_0 FOR TILE: ", tile
3033 call esmf_fieldgather(w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3034 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3037 if (localpet == 0)
then
3038 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3039 error = nf90_put_var( ncid, id_w_0, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3040 call
netcdf_err(error,
'WRITING W_0 RECORD' )
3043 print*,
"- CALL FieldGather FOR TARGET XS FOR TILE: ", tile
3044 call esmf_fieldgather(xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3045 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3048 if (localpet == 0)
then
3049 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3050 error = nf90_put_var( ncid, id_xs, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3054 print*,
"- CALL FieldGather FOR TARGET XT FOR TILE: ", tile
3055 call esmf_fieldgather(xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3056 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3059 if (localpet == 0)
then
3060 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3061 error = nf90_put_var( ncid, id_xt, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3065 print*,
"- CALL FieldGather FOR TARGET XU FOR TILE: ", tile
3066 call esmf_fieldgather(xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3067 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3070 if (localpet == 0)
then
3071 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3072 error = nf90_put_var( ncid, id_xu, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3076 print*,
"- CALL FieldGather FOR TARGET XV FOR TILE: ", tile
3077 call esmf_fieldgather(xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3078 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3081 if (localpet == 0)
then
3082 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3083 error = nf90_put_var( ncid, id_xv, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3087 print*,
"- CALL FieldGather FOR TARGET XZ FOR TILE: ", tile
3088 call esmf_fieldgather(xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3089 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3092 if (localpet == 0)
then
3093 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3094 error = nf90_put_var( ncid, id_xz, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3098 print*,
"- CALL FieldGather FOR TARGET XTTS FOR TILE: ", tile
3099 call esmf_fieldgather(xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3100 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3103 if (localpet == 0)
then
3104 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3105 error = nf90_put_var( ncid, id_xtts, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3106 call
netcdf_err(error,
'WRITING XTTS RECORD' )
3109 print*,
"- CALL FieldGather FOR TARGET XZTS FOR TILE: ", tile
3110 call esmf_fieldgather(xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3111 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3114 if (localpet == 0)
then
3115 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3116 error = nf90_put_var( ncid, id_xzts, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3117 call
netcdf_err(error,
'WRITING XZTS RECORD' )
3120 print*,
"- CALL FieldGather FOR TARGET Z_C FOR TILE: ", tile
3121 call esmf_fieldgather(z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3122 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3125 if (localpet == 0)
then
3126 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3127 error = nf90_put_var( ncid, id_z_c, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3128 call
netcdf_err(error,
'WRITING Z_C RECORD' )
3131 print*,
"- CALL FieldGather FOR TARGET ZM FOR TILE: ", tile
3132 call esmf_fieldgather(zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3133 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3136 if (localpet == 0)
then
3137 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3138 error = nf90_put_var( ncid, id_zm, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3148 error = nf90_close(ncid)
3152 deallocate(lsoil_data, x_data, y_data)
3153 deallocate(data_one_tile, data_one_tile_3d, idata_one_tile, dum2d, dum3d)
subroutine, public write_fv3_sfc_data_netcdf(localpet)
Writes surface and nst data into a 'coldstart' file (netcdf).
subroutine, public write_fv3_atm_bndy_data_netcdf(localpet)
Writes atmospheric fields along the lateral boundary.
subroutine, public write_fv3_atm_data_netcdf(localpet)
Write atmospheric coldstart files (netcdf format).
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
subroutine, public write_fv3_atm_header_netcdf(localpet)
Writes atmospheric header file in netcdf format.
subroutine netcdf_err(err, string)
Error handler for netcdf.
Module to hold variables and ESMF fields associated with the target grid atmospheric data...
Module to hold ESMF fields associated with the target grid surface data.
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...