3 use utilities,
only : error_handler, netcdf_err
7 public :: write_fv3_atm_header_netcdf
8 public :: write_fv3_atm_bndy_data_netcdf
9 public :: write_fv3_atm_data_netcdf
10 public :: write_fv3_sfc_data_netcdf
28 subroutine write_fv3_atm_header_netcdf(localpet)
42 integer,
intent(in) :: localpet
44 character(len=13) :: outfile
46 integer :: header_buffer_val = 16384
47 integer :: error, ncid, dim_nvcoord
48 integer :: dim_levp1, id_ntrac, id_vcoord
49 integer :: num_tracers_output
51 real(kind=esmf_kind_r8),
allocatable :: tmp(:,:)
53 if (localpet /= 0)
return 55 outfile=
"./gfs_ctrl.nc" 57 print*,
"- WRITE ATMOSPHERIC HEADER FILE: ", trim(outfile)
59 error = nf90_create(outfile, nf90_netcdf4, ncid)
60 call netcdf_err(error,
'CREATING FILE='//trim(outfile) )
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) )
79 error = nf90_put_var( ncid, id_ntrac, num_tracers_output)
80 call netcdf_err(error,
'write var ntrac for file='//trim(outfile) )
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)
92 end subroutine write_fv3_atm_header_netcdf
99 subroutine write_fv3_atm_bndy_data_netcdf(localpet)
134 integer,
intent(in) :: localpet
136 character(len=50) :: name
138 integer :: header_buffer_val = 16384
139 integer :: ncid, error, tile, i, n
140 integer :: dim_lon, dim_lat
141 integer :: dim_lonp, dim_halo
142 integer :: dim_halop, dim_latm
143 integer :: dim_lev, dim_levp1
144 integer :: j_target2, halo, halo_p1
145 integer :: id_i_bottom, id_j_bottom
146 integer :: id_i_top, id_j_top
147 integer :: id_i_right, id_j_right
148 integer :: id_i_left, id_j_left
149 integer :: id_qnifa_bottom, id_qnifa_top
150 integer :: id_qnifa_right, id_qnifa_left
151 integer :: id_qnwfa_bottom, id_qnwfa_top
152 integer :: id_qnwfa_right, id_qnwfa_left
153 integer :: id_ps_bottom, id_ps_top
154 integer :: id_ps_right, id_ps_left
155 integer :: id_t_bottom, id_t_top
156 integer :: id_t_right, id_t_left
157 integer :: id_w_bottom, id_w_top
158 integer :: id_w_right, id_w_left
159 integer :: id_zh_bottom, id_zh_top
160 integer :: id_zh_right, id_zh_left
161 integer,
allocatable :: id_tracer_bottom(:), id_tracer_top(:)
162 integer,
allocatable :: id_tracer_right(:), id_tracer_left(:)
163 integer :: id_i_w_bottom, id_j_w_bottom
164 integer :: id_i_w_top, id_j_w_top
165 integer :: id_j_w_right, id_i_w_left
166 integer :: id_j_w_left, id_i_w_right
167 integer :: id_u_w_bottom, id_u_w_top
168 integer :: id_u_w_right, id_u_w_left
169 integer :: id_v_w_bottom, id_v_w_top
170 integer :: id_v_w_right, id_v_w_left
171 integer :: id_i_s_bottom, id_j_s_bottom
172 integer :: id_i_s_top, id_j_s_top
173 integer :: id_i_s_right, id_j_s_right
174 integer :: id_i_s_left, id_j_s_left
175 integer :: id_u_s_bottom, id_u_s_top
176 integer :: id_u_s_right, id_u_s_left
177 integer :: id_v_s_bottom, id_v_s_top
178 integer :: id_v_s_right, id_v_s_left
179 integer :: i_start_top, i_end_top
180 integer :: j_start_top, j_end_top
181 integer :: i_start_bottom, i_end_bottom
182 integer :: j_start_bottom, j_end_bottom
183 integer :: i_start_left, i_end_left
184 integer :: j_start_left, j_end_left
185 integer :: i_start_right, i_end_right
186 integer :: j_start_right, j_end_right
187 integer(kind=4),
allocatable :: idum(:)
189 real(kind=4),
allocatable :: dum2d_top(:,:), dum2d_bottom(:,:)
190 real(kind=4),
allocatable :: dum2d_left(:,:), dum2d_right(:,:)
191 real(kind=4),
allocatable :: dum3d_top(:,:,:), dum3d_bottom(:,:,:)
192 real(kind=4),
allocatable :: dum3d_left(:,:,:), dum3d_right(:,:,:)
193 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
194 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
196 print*,
"- OUTPUT LATERAL BOUNDARY DATA." 206 if (localpet == 0)
then 209 error = nf90_create(
"./gfs.bndy.nc", nf90_netcdf4, ncid)
210 call netcdf_err(error,
'CREATING BNDY FILE' )
212 error = nf90_def_dim(ncid,
'lon',
i_target, dim_lon)
213 call netcdf_err(error,
'defining lon dimension')
216 error = nf90_def_dim(ncid,
'lat', j_target2, dim_lat)
217 call netcdf_err(error,
'DEFINING LAT DIMENSION')
219 error = nf90_def_dim(ncid,
'lonp',
ip1_target, dim_lonp)
220 call netcdf_err(error,
'DEFINING LONP DIMENSION')
223 error = nf90_def_dim(ncid,
'latm', j_target2, dim_latm)
224 call netcdf_err(error,
'DEFINING LATM DIMENSION')
226 error = nf90_def_dim(ncid,
'halo', halo, dim_halo)
227 call netcdf_err(error,
'DEFINING HALO DIMENSION')
229 error = nf90_def_dim(ncid,
'halop', halo_p1, dim_halop)
230 call netcdf_err(error,
'DEFINING HALOP DIMENSION')
232 error = nf90_def_dim(ncid,
'lev',
lev_target, dim_lev)
233 call netcdf_err(error,
'DEFINING LEV DIMENSION')
235 error = nf90_def_dim(ncid,
'levp',
levp1_target, dim_levp1)
236 call netcdf_err(error,
'DEFINING LEVP DIMENSION')
238 error = nf90_def_var(ncid,
'i_bottom', nf90_int, &
239 (/dim_lon/), id_i_bottom)
240 call netcdf_err(error,
'DEFINING I_BOTTOM')
242 error = nf90_def_var(ncid,
'j_bottom', nf90_int, &
243 (/dim_halo/), id_j_bottom)
244 call netcdf_err(error,
'DEFINING J_BOTTOM')
246 error = nf90_def_var(ncid,
'i_top', nf90_int, &
247 (/dim_lon/), id_i_top)
248 call netcdf_err(error,
'DEFINING I_TOP')
250 error = nf90_def_var(ncid,
'j_top', nf90_int, &
251 (/dim_halo/), id_j_top)
252 call netcdf_err(error,
'DEFINING J_TOP')
254 error = nf90_def_var(ncid,
'i_right', nf90_int, &
255 (/dim_halo/), id_i_right)
256 call netcdf_err(error,
'DEFINING I_RIGHT')
258 error = nf90_def_var(ncid,
'j_right', nf90_int, &
259 (/dim_lat/), id_j_right)
260 call netcdf_err(error,
'DEFINING J_RIGHT')
262 error = nf90_def_var(ncid,
'i_left', nf90_int, &
263 (/dim_halo/), id_i_left)
264 call netcdf_err(error,
'DEFINING I_LEFT')
266 error = nf90_def_var(ncid,
'j_left', nf90_int, &
267 (/dim_lat/), id_j_left)
268 call netcdf_err(error,
'DEFINING J_LEFT')
270 error = nf90_def_var(ncid,
'ps_bottom', nf90_float, &
271 (/dim_lon, dim_halo/), id_ps_bottom)
272 call netcdf_err(error,
'DEFINING PS_BOTTOM')
274 error = nf90_def_var(ncid,
'ps_top', nf90_float, &
275 (/dim_lon, dim_halo/), id_ps_top)
276 call netcdf_err(error,
'DEFINING PS_TOP')
278 error = nf90_def_var(ncid,
'ps_right', nf90_float, &
279 (/dim_halo, dim_lat/), id_ps_right)
280 call netcdf_err(error,
'DEFINING PS_RIGHT')
282 error = nf90_def_var(ncid,
'ps_left', nf90_float, &
283 (/dim_halo, dim_lat/), id_ps_left)
284 call netcdf_err(error,
'DEFINING PS_LEFT')
286 error = nf90_def_var(ncid,
't_bottom', nf90_float, &
287 (/dim_lon, dim_halo, dim_lev/), id_t_bottom)
288 call netcdf_err(error,
'DEFINING T_BOTTOM')
290 error = nf90_def_var(ncid,
't_top', nf90_float, &
291 (/dim_lon, dim_halo, dim_lev/), id_t_top)
292 call netcdf_err(error,
'DEFINING T_TOP')
294 error = nf90_def_var(ncid,
't_right', nf90_float, &
295 (/dim_halo, dim_lat, dim_lev/), id_t_right)
296 call netcdf_err(error,
'DEFINING T_RIGHT')
298 error = nf90_def_var(ncid,
't_left', nf90_float, &
299 (/dim_halo, dim_lat, dim_lev/), id_t_left)
300 call netcdf_err(error,
'DEFINING T_LEFT')
302 error = nf90_def_var(ncid,
'w_bottom', nf90_float, &
303 (/dim_lon, dim_halo, dim_lev/), id_w_bottom)
304 call netcdf_err(error,
'DEFINING W_BOTTOM')
306 error = nf90_def_var(ncid,
'w_top', nf90_float, &
307 (/dim_lon, dim_halo, dim_lev/), id_w_top)
308 call netcdf_err(error,
'DEFINING W_TOP')
310 error = nf90_def_var(ncid,
'w_right', nf90_float, &
311 (/dim_halo, dim_lat, dim_lev/), id_w_right)
312 call netcdf_err(error,
'DEFINING W_RIGHT')
314 error = nf90_def_var(ncid,
'w_left', nf90_float, &
315 (/dim_halo, dim_lat, dim_lev/), id_w_left)
316 call netcdf_err(error,
'DEFINING W_LEFT')
318 error = nf90_def_var(ncid,
'zh_bottom', nf90_float, &
319 (/dim_lon, dim_halo, dim_levp1/), id_zh_bottom)
320 call netcdf_err(error,
'DEFINING ZH_BOTTOM')
322 error = nf90_def_var(ncid,
'zh_top', nf90_float, &
323 (/dim_lon, dim_halo, dim_levp1/), id_zh_top)
324 call netcdf_err(error,
'DEFINING ZH_TOP')
326 error = nf90_def_var(ncid,
'zh_right', nf90_float, &
327 (/dim_halo, dim_lat, dim_levp1/), id_zh_right)
328 call netcdf_err(error,
'DEFINING ZH_RIGHT')
330 error = nf90_def_var(ncid,
'zh_left', nf90_float, &
331 (/dim_halo, dim_lat, dim_levp1/), id_zh_left)
332 call netcdf_err(error,
'DEFINING ZH_LEFT')
336 name = trim(
tracers(n)) //
"_bottom" 337 error = nf90_def_var(ncid, name, nf90_float, &
338 (/dim_lon, dim_halo, dim_lev/), id_tracer_bottom(n))
339 call netcdf_err(error,
'DEFINING TRACER_BOTTOM')
341 name = trim(
tracers(n)) //
"_top" 342 error = nf90_def_var(ncid, name, nf90_float, &
343 (/dim_lon, dim_halo, dim_lev/), id_tracer_top(n))
344 call netcdf_err(error,
'DEFINING TRACER_TOP')
346 name = trim(
tracers(n)) //
"_right" 347 error = nf90_def_var(ncid, name, nf90_float, &
348 (/dim_halo, dim_lat, dim_lev/), id_tracer_right(n))
349 call netcdf_err(error,
'DEFINING TRACER_RIGHT')
351 name = trim(
tracers(n)) //
"_left" 352 error = nf90_def_var(ncid, name, nf90_float, &
353 (/dim_halo, dim_lat, dim_lev/), id_tracer_left(n))
354 call netcdf_err(error,
'DEFINING TRACER_LEFT')
360 name =
"ice_aero_bottom" 361 error = nf90_def_var(ncid, name, nf90_float, &
362 (/dim_lon, dim_halo, dim_lev/), id_qnifa_bottom)
363 call netcdf_err(error,
'DEFINING QNIFA_BOTTOM')
365 name =
"ice_aero_top" 366 error = nf90_def_var(ncid, name, nf90_float, &
367 (/dim_lon, dim_halo, dim_lev/), id_qnifa_top)
368 call netcdf_err(error,
'DEFINING QNIFA_TOP')
370 name =
"ice_aero_right" 371 error = nf90_def_var(ncid, name, nf90_float, &
372 (/dim_halo, dim_lat, dim_lev/), id_qnifa_right)
373 call netcdf_err(error,
'DEFINING QNIFA_RIGHT')
375 name =
"ice_aero_left" 376 error = nf90_def_var(ncid, name, nf90_float, &
377 (/dim_halo, dim_lat, dim_lev/), id_qnifa_left)
378 call netcdf_err(error,
'DEFINING QNIFA_LEFT')
380 name =
"liq_aero_bottom" 381 error = nf90_def_var(ncid, name, nf90_float, &
382 (/dim_lon, dim_halo, dim_lev/), id_qnwfa_bottom)
383 call netcdf_err(error,
'DEFINING QNWFA_BOTTOM')
385 name =
"liq_aero_top" 386 error = nf90_def_var(ncid, name, nf90_float, &
387 (/dim_lon, dim_halo, dim_lev/), id_qnwfa_top)
388 call netcdf_err(error,
'DEFINING QNWFA_TOP')
390 name =
"liq_aero_right" 391 error = nf90_def_var(ncid, name, nf90_float, &
392 (/dim_halo, dim_lat, dim_lev/), id_qnwfa_right)
393 call netcdf_err(error,
'DEFINING QNWFA_RIGHT')
395 name =
"liq_aero_left" 396 error = nf90_def_var(ncid, name, nf90_float, &
397 (/dim_halo, dim_lat, dim_lev/), id_qnwfa_left)
398 call netcdf_err(error,
'DEFINING QNWFA_LEFT')
402 error = nf90_def_var(ncid,
'i_w_bottom', nf90_int, &
403 (/dim_lonp/), id_i_w_bottom)
404 call netcdf_err(error,
'DEFINING I_W_BOTTOM')
406 error = nf90_def_var(ncid,
'j_w_bottom', nf90_int, &
407 (/dim_halo/), id_j_w_bottom)
408 call netcdf_err(error,
'DEFINING J_W_BOTTOM')
410 error = nf90_def_var(ncid,
'i_w_top', nf90_int, &
411 (/dim_lonp/), id_i_w_top)
412 call netcdf_err(error,
'DEFINING I_W_TOP')
414 error = nf90_def_var(ncid,
'j_w_top', nf90_int, &
415 (/dim_halo/), id_j_w_top)
416 call netcdf_err(error,
'DEFINING J_W_TOP')
418 error = nf90_def_var(ncid,
'i_w_right', nf90_int, &
419 (/dim_halop/), id_i_w_right)
420 call netcdf_err(error,
'DEFINING I_W_RIGHT')
422 error = nf90_def_var(ncid,
'j_w_right', nf90_int, &
423 (/dim_lat/), id_j_w_right)
424 call netcdf_err(error,
'DEFINING J_W_RIGHT')
426 error = nf90_def_var(ncid,
'i_w_left', nf90_int, &
427 (/dim_halop/), id_i_w_left)
428 call netcdf_err(error,
'DEFINING I_W_LEFT')
430 error = nf90_def_var(ncid,
'j_w_left', nf90_int, &
431 (/dim_lat/), id_j_w_left)
432 call netcdf_err(error,
'DEFINING J_W_LEFT')
434 error = nf90_def_var(ncid,
'u_w_bottom', nf90_float, &
435 (/dim_lonp, dim_halo, dim_lev/), id_u_w_bottom)
436 call netcdf_err(error,
'DEFINING U_W_BOTTOM')
438 error = nf90_def_var(ncid,
'u_w_top', nf90_float, &
439 (/dim_lonp, dim_halo, dim_lev/), id_u_w_top)
440 call netcdf_err(error,
'DEFINING U_W_TOP')
442 error = nf90_def_var(ncid,
'u_w_right', nf90_float, &
443 (/dim_halop, dim_lat, dim_lev/), id_u_w_right)
444 call netcdf_err(error,
'DEFINING U_W_RIGHT')
446 error = nf90_def_var(ncid,
'u_w_left', nf90_float, &
447 (/dim_halop, dim_lat, dim_lev/), id_u_w_left)
448 call netcdf_err(error,
'DEFINING U_W_LEFT')
450 error = nf90_def_var(ncid,
'v_w_bottom', nf90_float, &
451 (/dim_lonp, dim_halo, dim_lev/), id_v_w_bottom)
452 call netcdf_err(error,
'DEFINING V_W_BOTTOM')
454 error = nf90_def_var(ncid,
'v_w_top', nf90_float, &
455 (/dim_lonp, dim_halo, dim_lev/), id_v_w_top)
456 call netcdf_err(error,
'DEFINING V_W_TOP')
458 error = nf90_def_var(ncid,
'v_w_right', nf90_float, &
459 (/dim_halop, dim_lat, dim_lev/), id_v_w_right)
460 call netcdf_err(error,
'DEFINING V_W_RIGHT')
462 error = nf90_def_var(ncid,
'v_w_left', nf90_float, &
463 (/dim_halop, dim_lat, dim_lev/), id_v_w_left)
464 call netcdf_err(error,
'DEFINING V_W_LEFT')
466 error = nf90_def_var(ncid,
'i_s_bottom', nf90_int, &
467 (/dim_lon/), id_i_s_bottom)
468 call netcdf_err(error,
'DEFINING I_S_BOTTOM')
470 error = nf90_def_var(ncid,
'j_s_bottom', nf90_int, &
471 (/dim_halop/), id_j_s_bottom)
472 call netcdf_err(error,
'DEFINING J_S_BOTTOM')
474 error = nf90_def_var(ncid,
'i_s_top', nf90_int, &
475 (/dim_lon/), id_i_s_top)
476 call netcdf_err(error,
'DEFINING I_S_TOP')
478 error = nf90_def_var(ncid,
'j_s_top', nf90_int, &
479 (/dim_halop/), id_j_s_top)
480 call netcdf_err(error,
'DEFINING J_S_TOP')
482 error = nf90_def_var(ncid,
'i_s_right', nf90_int, &
483 (/dim_halo/), id_i_s_right)
484 call netcdf_err(error,
'DEFINING I_S_RIGHT')
486 error = nf90_def_var(ncid,
'j_s_right', nf90_int, &
487 (/dim_latm/), id_j_s_right)
488 call netcdf_err(error,
'DEFINING J_S_RIGHT')
490 error = nf90_def_var(ncid,
'i_s_left', nf90_int, &
491 (/dim_halo/), id_i_s_left)
492 call netcdf_err(error,
'DEFINING I_S_LEFT')
494 error = nf90_def_var(ncid,
'j_s_left', nf90_int, &
495 (/dim_latm/), id_j_s_left)
496 call netcdf_err(error,
'DEFINING J_S_LEFT')
498 error = nf90_def_var(ncid,
'u_s_bottom', nf90_float, &
499 (/dim_lon, dim_halop, dim_lev/), id_u_s_bottom)
500 call netcdf_err(error,
'DEFINING U_S_BOTTOM')
502 error = nf90_def_var(ncid,
'u_s_top', nf90_float, &
503 (/dim_lon, dim_halop, dim_lev/), id_u_s_top)
504 call netcdf_err(error,
'DEFINING U_S_TOP')
506 error = nf90_def_var(ncid,
'u_s_right', nf90_float, &
507 (/dim_halo, dim_latm, dim_lev/), id_u_s_right)
508 call netcdf_err(error,
'DEFINING U_S_RIGHT')
510 error = nf90_def_var(ncid,
'u_s_left', nf90_float, &
511 (/dim_halo, dim_latm, dim_lev/), id_u_s_left)
512 call netcdf_err(error,
'DEFINING U_S_LEFT')
514 error = nf90_def_var(ncid,
'v_s_bottom', nf90_float, &
515 (/dim_lon, dim_halop, dim_lev/), id_v_s_bottom)
516 call netcdf_err(error,
'DEFINING V_S_BOTTOM')
518 error = nf90_def_var(ncid,
'v_s_top', nf90_float, &
519 (/dim_lon, dim_halop, dim_lev/), id_v_s_top)
520 call netcdf_err(error,
'DEFINING V_S_TOP')
522 error = nf90_def_var(ncid,
'v_s_right', nf90_float, &
523 (/dim_halo, dim_latm, dim_lev/), id_v_s_right)
524 call netcdf_err(error,
'DEFINING V_S_RIGHT')
526 error = nf90_def_var(ncid,
'v_s_left', nf90_float, &
527 (/dim_halo, dim_latm, dim_lev/), id_v_s_left)
528 call netcdf_err(error,
'DEFINING V_S_LEFT')
531 if (trim(
input_type) ==
"gaussian_nemsio")
then 532 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NEMSIO FILE')
533 elseif (trim(
input_type) ==
"gfs_gaussian_nemsio")
then 534 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS GAUSSIAN NEMSIO FILE')
536 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS SIGIO FILE')
538 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED HISTORY FILE')
540 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED RESTART FILE')
541 elseif (trim(
input_type) ==
"gaussian_netcdf")
then 542 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NETCDF FILE')
544 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GRIB2 FILE')
547 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
548 call netcdf_err(error,
'DEFINING END OF HEADER')
577 if (localpet == 0)
then 582 allocate(idum(i_start_top:i_end_top))
583 do i = i_start_top, i_end_top
586 error = nf90_put_var(ncid, id_i_top, idum)
587 call netcdf_err(error,
"WRITING I_TOP")
589 allocate(idum(i_start_bottom:i_end_bottom))
590 do i = i_start_bottom, i_end_bottom
593 error = nf90_put_var(ncid, id_i_bottom, idum)
594 call netcdf_err(error,
"WRITING I_BOTTOM")
596 allocate(idum(i_start_left:i_end_left))
597 do i = i_start_left, i_end_left
600 error = nf90_put_var(ncid, id_i_left, idum)
601 call netcdf_err(error,
"WRITING I_LEFT")
603 allocate(idum(i_start_right:i_end_right))
604 do i = i_start_right, i_end_right
607 error = nf90_put_var(ncid, id_i_right, idum)
608 call netcdf_err(error,
"WRITING I_RIGHT")
610 allocate(idum(j_start_top:j_end_top))
611 do i = j_start_top, j_end_top
614 error = nf90_put_var(ncid, id_j_top, idum)
615 call netcdf_err(error,
"WRITING J_TOP")
617 allocate(idum(j_start_bottom:j_end_bottom))
618 do i = j_start_bottom, j_end_bottom
621 error = nf90_put_var(ncid, id_j_bottom, idum)
622 call netcdf_err(error,
"WRITING J_BOTTOM")
624 allocate(idum(j_start_left:j_end_left))
625 do i = j_start_left, j_end_left
628 error = nf90_put_var(ncid, id_j_left, idum)
629 call netcdf_err(error,
"WRITING J_LEFT")
631 allocate(idum(j_start_right:j_end_right))
632 do i = j_start_right, j_end_right
635 error = nf90_put_var(ncid, id_j_right, idum)
636 call netcdf_err(error,
"WRITING J_RIGHT")
642 if (localpet == 0)
then 644 allocate(dum2d_top(i_start_top:i_end_top, j_start_top:j_end_top))
645 allocate(dum2d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom))
646 allocate(dum2d_left(i_start_left:i_end_left, j_start_left:j_end_left))
647 allocate(dum2d_right(i_start_right:i_end_right, j_start_right:j_end_right))
649 allocate(data_one_tile(0,0))
650 allocate(dum2d_top(0,0))
651 allocate(dum2d_bottom(0,0))
652 allocate(dum2d_left(0,0))
653 allocate(dum2d_right(0,0))
658 print*,
"- CALL FieldGather FOR TARGET GRID SURFACE PRESSURE" 659 call esmf_fieldgather(
ps_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
660 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
661 call error_handler(
"IN FieldGather", error)
663 if (localpet == 0)
then 664 dum2d_top(:,:) =
real(data_one_tile(i_start_top:i_end_top, j_start_top:j_end_top),kind=4)
665 error = nf90_put_var( ncid, id_ps_top, dum2d_top)
666 call netcdf_err(error,
'WRITING PS TOP' )
667 dum2d_bottom(:,:) =
real(data_one_tile(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom),kind=4)
668 error = nf90_put_var( ncid, id_ps_bottom, dum2d_bottom)
669 call netcdf_err(error,
'WRITING PS BOTTOM' )
670 dum2d_left(:,:) =
real(data_one_tile(i_start_left:i_end_left, j_start_left:j_end_left),kind=4)
671 error = nf90_put_var( ncid, id_ps_left, dum2d_left)
672 call netcdf_err(error,
'WRITING PS LEFT' )
673 dum2d_right(:,:) =
real(data_one_tile(i_start_right:i_end_right, j_start_right:j_end_right),kind=4)
674 error = nf90_put_var( ncid, id_ps_right, dum2d_right)
675 call netcdf_err(error,
'WRITING PS RIGHT' )
678 deallocate(dum2d_top, dum2d_bottom, dum2d_left, dum2d_right, data_one_tile)
682 if (localpet == 0)
then 684 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top,
levp1_target))
685 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom,
levp1_target))
686 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left,
levp1_target))
687 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right,
levp1_target))
689 allocate(data_one_tile_3d(0,0,0))
690 allocate(dum3d_top(0,0,0))
691 allocate(dum3d_bottom(0,0,0))
692 allocate(dum3d_left(0,0,0))
693 allocate(dum3d_right(0,0,0))
696 print*,
"- CALL FieldGather FOR TARGET GRID HEIGHT FOR TILE: ", tile
697 call esmf_fieldgather(
zh_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
698 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
699 call error_handler(
"IN FieldGather", error)
701 if (localpet == 0)
then 702 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
704 error = nf90_put_var( ncid, id_zh_top, dum3d_top)
705 call netcdf_err(error,
'WRITING ZH TOP' )
706 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
708 error = nf90_put_var( ncid, id_zh_bottom, dum3d_bottom)
709 call netcdf_err(error,
'WRITING ZH BOTTOM' )
710 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
712 error = nf90_put_var( ncid, id_zh_left, dum3d_left)
713 call netcdf_err(error,
'WRITING ZH LEFT' )
714 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
716 error = nf90_put_var( ncid, id_zh_right, dum3d_right)
717 call netcdf_err(error,
'WRITING ZH RIGHT' )
720 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
724 if (localpet == 0)
then 726 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top,
lev_target))
727 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom,
lev_target))
728 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left,
lev_target))
729 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right,
lev_target))
731 allocate(data_one_tile_3d(0,0,0))
732 allocate(dum3d_top(0,0,0))
733 allocate(dum3d_bottom(0,0,0))
734 allocate(dum3d_left(0,0,0))
735 allocate(dum3d_right(0,0,0))
740 print*,
"- CALL FieldGather FOR TARGET GRID TRACER FOR TILE: ", trim(
tracers(n)), tile
741 call esmf_fieldgather(
tracers_target_grid(n), data_one_tile_3d, rootpet=0, tile=tile, rc=error)
742 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
743 call error_handler(
"IN FieldGather", error)
745 if (localpet == 0)
then 746 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
748 error = nf90_put_var( ncid, id_tracer_top(n), dum3d_top)
749 call netcdf_err(error,
'WRITING TRACER TOP' )
750 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
752 error = nf90_put_var( ncid, id_tracer_bottom(n), dum3d_bottom)
753 call netcdf_err(error,
'WRITING TRACER BOTTOM' )
754 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
756 error = nf90_put_var( ncid, id_tracer_left(n), dum3d_left)
757 call netcdf_err(error,
'WRITING TRACER LEFT' )
758 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
760 error = nf90_put_var( ncid, id_tracer_right(n), dum3d_right)
761 call netcdf_err(error,
'WRITING TRACER RIGHT' )
768 print*,
"- CALL FieldGather FOR TARGET GRID W FOR TILE: ", tile
769 call esmf_fieldgather(
dzdt_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
770 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
771 call error_handler(
"IN FieldGather", error)
773 if (localpet == 0)
then 774 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
776 error = nf90_put_var( ncid, id_w_top, dum3d_top)
777 call netcdf_err(error,
'WRITING W TOP' )
778 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
780 error = nf90_put_var( ncid, id_w_bottom, dum3d_bottom)
781 call netcdf_err(error,
'WRITING W BOTTOM' )
782 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
784 error = nf90_put_var( ncid, id_w_left, dum3d_left)
785 call netcdf_err(error,
'WRITING W LEFT' )
786 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
788 error = nf90_put_var( ncid, id_w_right, dum3d_right)
789 call netcdf_err(error,
'WRITING W RIGHT' )
794 print*,
"- CALL FieldGather FOR TARGET GRID TEMPERATURE FOR TILE: ", tile
795 call esmf_fieldgather(
temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
796 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
797 call error_handler(
"IN FieldGather", error)
799 if (localpet == 0)
then 800 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
802 error = nf90_put_var( ncid, id_t_top, dum3d_top)
803 call netcdf_err(error,
'WRITING T TOP' )
804 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
806 error = nf90_put_var( ncid, id_t_bottom, dum3d_bottom)
807 call netcdf_err(error,
'WRITING T BOTTOM' )
808 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
810 error = nf90_put_var( ncid, id_t_left, dum3d_left)
811 call netcdf_err(error,
'WRITING T LEFT' )
812 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
814 error = nf90_put_var( ncid, id_t_right, dum3d_right)
815 call netcdf_err(error,
'WRITING T RIGHT' )
820 print*,
"- CALL FieldGather FOR TARGET GRID CLIMO QNIFA FOR TILE: ", tile
822 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
823 call error_handler(
"IN FieldGather", error)
825 if (localpet == 0)
then 826 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
828 error = nf90_put_var( ncid, id_qnifa_top, dum3d_top)
829 call netcdf_err(error,
'WRITING QNIFA CLIMO TOP' )
830 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
832 error = nf90_put_var( ncid, id_qnifa_bottom, dum3d_bottom)
833 call netcdf_err(error,
'WRITING QNIFA CLIMO BOTTOM' )
834 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
836 error = nf90_put_var( ncid, id_qnifa_left, dum3d_left)
837 call netcdf_err(error,
'WRITING QNIFA CLIMO LEFT' )
838 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
840 error = nf90_put_var( ncid, id_qnifa_right, dum3d_right)
841 call netcdf_err(error,
'WRITING QNIFA CLIMO RIGHT' )
844 print*,
"- CALL FieldGather FOR TARGET GRID CLIMO QNWFA FOR TILE: ", tile
846 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
847 call error_handler(
"IN FieldGather", error)
849 if (localpet == 0)
then 850 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
852 error = nf90_put_var( ncid, id_qnwfa_top, dum3d_top)
853 call netcdf_err(error,
'WRITING QNWFA CLIMO TOP' )
854 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
856 error = nf90_put_var( ncid, id_qnwfa_bottom, dum3d_bottom)
857 call netcdf_err(error,
'WRITING QNWFA CLIMO BOTTOM' )
858 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
860 error = nf90_put_var( ncid, id_qnwfa_left, dum3d_left)
861 call netcdf_err(error,
'WRITING QNWFA CLIMO LEFT' )
862 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
864 error = nf90_put_var( ncid, id_qnwfa_right, dum3d_right)
865 call netcdf_err(error,
'WRITING QNWFA CLIMO RIGHT' )
870 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
885 j_end_bottom = halo_p1
897 if (localpet == 0)
then 902 allocate(idum(i_start_top:i_end_top))
903 do i = i_start_top, i_end_top
906 error = nf90_put_var(ncid, id_i_s_top, idum)
907 call netcdf_err(error,
"WRITING I_S_TOP")
909 allocate(idum(i_start_bottom:i_end_bottom))
910 do i = i_start_bottom, i_end_bottom
913 error = nf90_put_var(ncid, id_i_s_bottom, idum)
914 call netcdf_err(error,
"WRITING I_S_BOTTOM")
916 allocate(idum(i_start_left:i_end_left))
917 do i = i_start_left, i_end_left
920 error = nf90_put_var(ncid, id_i_s_left, idum)
921 call netcdf_err(error,
"WRITING I_S_LEFT")
923 allocate(idum(i_start_right:i_end_right))
924 do i = i_start_right, i_end_right
927 error = nf90_put_var(ncid, id_i_s_right, idum)
928 call netcdf_err(error,
"WRITING I_S_RIGHT")
930 allocate(idum(j_start_top:j_end_top))
931 do i = j_start_top, j_end_top
934 error = nf90_put_var(ncid, id_j_s_top, idum)
935 call netcdf_err(error,
"WRITING J_S_TOP")
937 allocate(idum(j_start_bottom:j_end_bottom))
938 do i = j_start_bottom, j_end_bottom
941 error = nf90_put_var(ncid, id_j_s_bottom, idum)
942 call netcdf_err(error,
"WRITING J_S_BOTTOM")
944 allocate(idum(j_start_left:j_end_left))
945 do i = j_start_left, j_end_left
948 error = nf90_put_var(ncid, id_j_s_left, idum)
949 call netcdf_err(error,
"WRITING J_S_LEFT")
951 allocate(idum(j_start_right:j_end_right))
952 do i = j_start_right, j_end_right
955 error = nf90_put_var(ncid, id_j_s_right, idum)
956 call netcdf_err(error,
"WRITING J_S_RIGHT")
962 if (localpet == 0)
then 964 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top,
lev_target))
965 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom,
lev_target))
966 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left,
lev_target))
967 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right,
lev_target))
969 allocate(data_one_tile_3d(0,0,0))
970 allocate(dum3d_top(0,0,0))
971 allocate(dum3d_bottom(0,0,0))
972 allocate(dum3d_left(0,0,0))
973 allocate(dum3d_right(0,0,0))
976 print*,
"- CALL FieldGather FOR TARGET GRID U_S FOR TILE: ", tile
977 call esmf_fieldgather(
u_s_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
978 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
979 call error_handler(
"IN FieldGather", error)
981 if (localpet == 0)
then 982 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
984 error = nf90_put_var( ncid, id_u_s_top, dum3d_top)
985 call netcdf_err(error,
'WRITING U_S TOP' )
986 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
988 error = nf90_put_var( ncid, id_u_s_bottom, dum3d_bottom)
989 call netcdf_err(error,
'WRITING U_S BOTTOM' )
990 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
992 error = nf90_put_var( ncid, id_u_s_left, dum3d_left)
993 call netcdf_err(error,
'WRITING U_S LEFT' )
994 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
996 error = nf90_put_var( ncid, id_u_s_right, dum3d_right)
997 call netcdf_err(error,
'WRITING U_S RIGHT' )
1002 print*,
"- CALL FieldGather FOR TARGET GRID V_S FOR TILE: ", tile
1003 call esmf_fieldgather(
v_s_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
1004 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1005 call error_handler(
"IN FieldGather", error)
1007 if (localpet == 0)
then 1008 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
1010 error = nf90_put_var( ncid, id_v_s_top, dum3d_top)
1011 call netcdf_err(error,
'WRITING V_S TOP' )
1012 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
1014 error = nf90_put_var( ncid, id_v_s_bottom, dum3d_bottom)
1015 call netcdf_err(error,
'WRITING V_S BOTTOM' )
1016 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
1018 error = nf90_put_var( ncid, id_v_s_left, dum3d_left)
1019 call netcdf_err(error,
'WRITING V_S LEFT' )
1020 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
1022 error = nf90_put_var( ncid, id_v_s_right, dum3d_right)
1023 call netcdf_err(error,
'WRITING V_S RIGHT' )
1026 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
1044 i_end_left = halo_p1
1053 if (localpet == 0)
then 1058 allocate(idum(i_start_top:i_end_top))
1059 do i = i_start_top, i_end_top
1062 error = nf90_put_var(ncid, id_i_w_top, idum)
1063 call netcdf_err(error,
"WRITING I_W_TOP")
1065 allocate(idum(i_start_bottom:i_end_bottom))
1066 do i = i_start_bottom, i_end_bottom
1069 error = nf90_put_var(ncid, id_i_w_bottom, idum)
1070 call netcdf_err(error,
"WRITING I_W_BOTTOM")
1072 allocate(idum(i_start_left:i_end_left))
1073 do i = i_start_left, i_end_left
1076 error = nf90_put_var(ncid, id_i_w_left, idum)
1077 call netcdf_err(error,
"WRITING I_W_LEFT")
1079 allocate(idum(i_start_right:i_end_right))
1080 do i = i_start_right, i_end_right
1083 error = nf90_put_var(ncid, id_i_w_right, idum)
1084 call netcdf_err(error,
"WRITING I_W_RIGHT")
1086 allocate(idum(j_start_top:j_end_top))
1087 do i = j_start_top, j_end_top
1090 error = nf90_put_var(ncid, id_j_w_top, idum)
1091 call netcdf_err(error,
"WRITING J_W_TOP")
1093 allocate(idum(j_start_bottom:j_end_bottom))
1094 do i = j_start_bottom, j_end_bottom
1097 error = nf90_put_var(ncid, id_j_w_bottom, idum)
1098 call netcdf_err(error,
"WRITING J_W_BOTTOM")
1100 allocate(idum(j_start_left:j_end_left))
1101 do i = j_start_left, j_end_left
1104 error = nf90_put_var(ncid, id_j_w_left, idum)
1105 call netcdf_err(error,
"WRITING J_W_LEFT")
1107 allocate(idum(j_start_right:j_end_right))
1108 do i = j_start_right, j_end_right
1111 error = nf90_put_var(ncid, id_j_w_right, idum)
1112 call netcdf_err(error,
"WRITING J_W_RIGHT")
1118 if (localpet == 0)
then 1120 allocate(dum3d_top(i_start_top:i_end_top, j_start_top:j_end_top,
lev_target))
1121 allocate(dum3d_bottom(i_start_bottom:i_end_bottom, j_start_bottom:j_end_bottom,
lev_target))
1122 allocate(dum3d_left(i_start_left:i_end_left, j_start_left:j_end_left,
lev_target))
1123 allocate(dum3d_right(i_start_right:i_end_right, j_start_right:j_end_right,
lev_target))
1125 allocate(data_one_tile_3d(0,0,0))
1126 allocate(dum3d_top(0,0,0))
1127 allocate(dum3d_bottom(0,0,0))
1128 allocate(dum3d_left(0,0,0))
1129 allocate(dum3d_right(0,0,0))
1132 print*,
"- CALL FieldGather FOR TARGET GRID U_W FOR TILE: ", tile
1133 call esmf_fieldgather(
u_w_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
1134 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1135 call error_handler(
"IN FieldGather", error)
1137 if (localpet == 0)
then 1138 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
1140 error = nf90_put_var( ncid, id_u_w_top, dum3d_top)
1141 call netcdf_err(error,
'WRITING U_W TOP' )
1142 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
1144 error = nf90_put_var( ncid, id_u_w_bottom, dum3d_bottom)
1145 call netcdf_err(error,
'WRITING U_W BOTTOM' )
1146 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
1148 error = nf90_put_var( ncid, id_u_w_left, dum3d_left)
1149 call netcdf_err(error,
'WRITING U_W LEFT' )
1150 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
1152 error = nf90_put_var( ncid, id_u_w_right, dum3d_right)
1153 call netcdf_err(error,
'WRITING U_W RIGHT' )
1158 print*,
"- CALL FieldGather FOR TARGET GRID V_W FOR TILE: ", tile
1159 call esmf_fieldgather(
v_w_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=error)
1160 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1161 call error_handler(
"IN FieldGather", error)
1163 if (localpet == 0)
then 1164 dum3d_top(:,:,:) =
real(data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:),kind=4)
1166 error = nf90_put_var( ncid, id_v_w_top, dum3d_top)
1167 call netcdf_err(error,
'WRITING V_W TOP' )
1168 dum3d_bottom(:,:,:) =
real(data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:),kind=4)
1170 error = nf90_put_var( ncid, id_v_w_bottom, dum3d_bottom)
1171 call netcdf_err(error,
'WRITING V_W BOTTOM' )
1172 dum3d_left(:,:,:) =
real(data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:),kind=4)
1174 error = nf90_put_var( ncid, id_v_w_left, dum3d_left)
1175 call netcdf_err(error,
'WRITING V_W LEFT' )
1176 dum3d_right(:,:,:) =
real(data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:),kind=4)
1178 error = nf90_put_var( ncid, id_v_w_right, dum3d_right)
1179 call netcdf_err(error,
'WRITING V_W RIGHT' )
1182 deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d)
1183 deallocate(id_tracer_bottom, id_tracer_top, id_tracer_left, id_tracer_right)
1185 if (localpet == 0) error = nf90_close(ncid)
1187 end subroutine write_fv3_atm_bndy_data_netcdf
1197 subroutine write_fv3_atm_data_netcdf(localpet)
1227 integer,
intent(in) :: localpet
1229 character(len=128) :: outfile
1231 integer :: error, ncid, tile, n
1232 integer :: header_buffer_val = 16384
1233 integer :: dim_lon, dim_lat
1234 integer :: dim_lonp, dim_latp
1235 integer :: dim_lev, dim_levp1, dim_ntracer
1236 integer,
allocatable :: id_tracers(:)
1237 integer :: id_lon, id_lat, id_ps
1238 integer :: id_lat_s, id_lon_s
1239 integer :: id_lat_w, id_lon_w
1240 integer :: id_w, id_zh, id_u_w
1241 integer :: id_v_w, id_u_s, id_v_s
1242 integer :: id_t, id_delp, id_qnifa, id_qnwfa
1243 integer :: i_start, i_end, j_start, j_end
1244 integer :: i_target_out, j_target_out
1245 integer :: ip1_target_out, jp1_target_out
1246 integer :: ip1_end, jp1_end, num_tracers_output
1248 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
1249 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
1250 real(kind=4),
allocatable :: dum2d(:,:)
1251 real(kind=4),
allocatable :: dum3d(:,:,:)
1263 ip1_target_out = i_target_out + 1
1264 jp1_target_out = j_target_out + 1
1271 allocate(dum2d(i_target_out,j_target_out))
1273 allocate(data_one_tile(0,0))
1274 allocate(dum2d(0,0))
1283 outfile =
"out.atm.tile7.nc" 1285 WRITE(outfile,
'(A, I1, A)')
'out.atm.tile', tile,
'.nc' 1289 error = nf90_create(outfile, nf90_netcdf4, ncid)
1290 call netcdf_err(error,
'CREATING FILE='//trim(outfile) )
1293 error = nf90_def_dim(ncid,
'lon', i_target_out, dim_lon)
1294 call netcdf_err(error,
'DEFINING LON DIMENSION' )
1295 error = nf90_def_dim(ncid,
'lat', j_target_out, dim_lat)
1296 call netcdf_err(error,
'DEFINING LAT DIMENSION' )
1297 error = nf90_def_dim(ncid,
'lonp', ip1_target_out, dim_lonp)
1298 call netcdf_err(error,
'DEFINING LONP DIMENSION' )
1299 error = nf90_def_dim(ncid,
'latp', jp1_target_out, dim_latp)
1300 call netcdf_err(error,
'DEFINING LATP DIMENSION' )
1301 error = nf90_def_dim(ncid,
'lev',
lev_target, dim_lev)
1302 call netcdf_err(error,
'DEFINING LEV DIMENSION' )
1303 error = nf90_def_dim(ncid,
'levp',
levp1_target, dim_levp1)
1304 call netcdf_err(error,
'DEFINING LEVP DIMENSION' )
1307 error = nf90_def_dim(ncid,
'ntracer', num_tracers_output, dim_ntracer)
1308 call netcdf_err(error,
'DEFINING NTRACER DIMENSION' )
1311 if (trim(
input_type) ==
"gaussian_nemsio")
then 1312 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NEMSIO FILE')
1313 elseif (trim(
input_type) ==
"gaussian_netcdf")
then 1314 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GAUSSIAN NETCDF FILE')
1315 elseif (trim(
input_type) ==
"gfs_gaussian_nemsio")
then 1316 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS GAUSSIAN NEMSIO FILE')
1317 elseif (trim(
input_type) ==
"gfs_sigio")
then 1318 error = nf90_put_att(ncid, nf90_global,
'source',
'SPECTRAL GFS SIGIO FILE')
1320 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED HISTORY FILE')
1322 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS TILED RESTART FILE')
1324 error = nf90_put_att(ncid, nf90_global,
'source',
'FV3GFS GRIB2 FILE')
1328 error = nf90_def_var(ncid,
'geolon', nf90_float, (/dim_lon,dim_lat/), id_lon)
1329 call netcdf_err(error,
'DEFINING GEOLON FIELD' )
1330 error = nf90_put_att(ncid, id_lon,
"long_name",
"Longitude")
1331 call netcdf_err(error,
'DEFINING GEOLON NAME' )
1332 error = nf90_put_att(ncid, id_lon,
"units",
"degrees_east")
1333 call netcdf_err(error,
'DEFINING GEOLON UNITS' )
1335 error = nf90_def_var(ncid,
'geolat', nf90_float, (/dim_lon,dim_lat/), id_lat)
1336 call netcdf_err(error,
'DEFINING GEOLAT FIELD' )
1337 error = nf90_put_att(ncid, id_lat,
"long_name",
"Latitude")
1338 call netcdf_err(error,
'DEFINING GEOLAT NAME' )
1339 error = nf90_put_att(ncid, id_lat,
"units",
"degrees_north")
1340 call netcdf_err(error,
'DEFINING GEOLAT UNITS' )
1342 error = nf90_def_var(ncid,
'geolon_s', nf90_float, (/dim_lon,dim_latp/), id_lon_s)
1343 call netcdf_err(error,
'DEFINING GEOLON_S FIELD' )
1344 error = nf90_put_att(ncid, id_lon_s,
"long_name",
"Longitude_s")
1345 call netcdf_err(error,
'DEFINING GEOLON_S NAME' )
1346 error = nf90_put_att(ncid, id_lon_s,
"units",
"degrees_east")
1347 call netcdf_err(error,
'DEFINING GEOLON_S UNITS' )
1349 error = nf90_def_var(ncid,
'geolat_s', nf90_float, (/dim_lon,dim_latp/), id_lat_s)
1350 call netcdf_err(error,
'DEFINING GEOLAT_S FIELD' )
1351 error = nf90_put_att(ncid, id_lat_s,
"long_name",
"Latitude_s")
1352 call netcdf_err(error,
'DEFINING GEOLAT_S NAME' )
1353 error = nf90_put_att(ncid, id_lat_s,
"units",
"degrees_north")
1354 call netcdf_err(error,
'DEFINING GEOLAT_S UNITS' )
1356 error = nf90_def_var(ncid,
'geolon_w', nf90_float, (/dim_lonp,dim_lat/), id_lon_w)
1357 call netcdf_err(error,
'DEFINING GEOLON_W FIELD' )
1358 error = nf90_put_att(ncid, id_lon_w,
"long_name",
"Longitude_w")
1359 call netcdf_err(error,
'DEFINING GEOLON_W NAME' )
1360 error = nf90_put_att(ncid, id_lon_w,
"units",
"degrees_east")
1361 call netcdf_err(error,
'DEFINING GEOLON_W UNITS' )
1363 error = nf90_def_var(ncid,
'geolat_w', nf90_float, (/dim_lonp,dim_lat/), id_lat_w)
1364 call netcdf_err(error,
'DEFINING GEOLAT_W FIELD' )
1365 error = nf90_put_att(ncid, id_lat_w,
"long_name",
"Latitude_w")
1366 call netcdf_err(error,
'DEFINING GEOLAT_W NAME' )
1367 error = nf90_put_att(ncid, id_lat_w,
"units",
"degrees_north")
1368 call netcdf_err(error,
'DEFINING GEOLAT_W UNITS' )
1370 error = nf90_def_var(ncid,
'ps', nf90_float, (/dim_lon,dim_lat/), id_ps)
1371 call netcdf_err(error,
'DEFINING PS' )
1372 error = nf90_put_att(ncid, id_ps,
"coordinates",
"geolon geolat")
1373 call netcdf_err(error,
'DEFINING PS COORD' )
1375 error = nf90_def_var(ncid,
'w', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_w)
1376 call netcdf_err(error,
'DEFINING W' )
1377 error = nf90_put_att(ncid, id_w,
"coordinates",
"geolon geolat")
1378 call netcdf_err(error,
'DEFINING W COORD' )
1380 error = nf90_def_var(ncid,
'zh', nf90_float, (/dim_lon,dim_lat,dim_levp1/), id_zh)
1381 call netcdf_err(error,
'DEFINING ZH' )
1382 error = nf90_put_att(ncid, id_zh,
"coordinates",
"geolon geolat")
1383 call netcdf_err(error,
'DEFINING ZH COORD' )
1385 error = nf90_def_var(ncid,
't', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_t)
1386 call netcdf_err(error,
'DEFINING T' )
1387 error = nf90_put_att(ncid, id_t,
"coordinates",
"geolon geolat")
1388 call netcdf_err(error,
'DEFINING T COORD' )
1390 error = nf90_def_var(ncid,
'delp', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_delp)
1391 call netcdf_err(error,
'DEFINING DELP' )
1392 error = nf90_put_att(ncid, id_delp,
"coordinates",
"geolon geolat")
1393 call netcdf_err(error,
'DEFINING DELP COORD' )
1396 if (localpet==0) print*,
"write to file tracer ", trim(
tracers(n))
1397 error = nf90_def_var(ncid,
tracers(n), nf90_float, (/dim_lon,dim_lat,dim_lev/), id_tracers(n))
1398 call netcdf_err(error,
'DEFINING TRACERS' )
1399 error = nf90_put_att(ncid, id_tracers(n),
"coordinates",
"geolon geolat")
1400 call netcdf_err(error,
'DEFINING TRACERS COORD' )
1404 error = nf90_def_var(ncid,
'ice_aero', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_qnifa)
1405 call netcdf_err(error,
'DEFINING QNIFA' )
1406 error = nf90_put_att(ncid, id_qnifa,
"coordinates",
"geolon geolat")
1407 call netcdf_err(error,
'DEFINING QNIFA COORD' )
1409 error = nf90_def_var(ncid,
'liq_aero', nf90_float, (/dim_lon,dim_lat,dim_lev/), id_qnwfa)
1410 call netcdf_err(error,
'DEFINING QNWFA' )
1411 error = nf90_put_att(ncid, id_qnwfa,
"coordinates",
"geolon geolat")
1412 call netcdf_err(error,
'DEFINING QNWFA COORD' )
1415 error = nf90_def_var(ncid,
'u_w', nf90_float, (/dim_lonp,dim_lat,dim_lev/), id_u_w)
1416 call netcdf_err(error,
'DEFINING U_W' )
1417 error = nf90_put_att(ncid, id_u_w,
"coordinates",
"geolon_w geolat_w")
1418 call netcdf_err(error,
'DEFINING U_W COORD' )
1420 error = nf90_def_var(ncid,
'v_w', nf90_float, (/dim_lonp,dim_lat,dim_lev/), id_v_w)
1421 call netcdf_err(error,
'DEFINING V_W' )
1422 error = nf90_put_att(ncid, id_v_w,
"coordinates",
"geolon_w geolat_w")
1423 call netcdf_err(error,
'DEFINING V_W COORD' )
1425 error = nf90_def_var(ncid,
'u_s', nf90_float, (/dim_lon,dim_latp,dim_lev/), id_u_s)
1426 call netcdf_err(error,
'DEFINING U_S' )
1427 error = nf90_put_att(ncid, id_u_s,
"coordinates",
"geolon_s geolat_s")
1428 call netcdf_err(error,
'DEFINING U_S COORD' )
1430 error = nf90_def_var(ncid,
'v_s', nf90_float, (/dim_lon,dim_latp,dim_lev/), id_v_s)
1431 call netcdf_err(error,
'DEFINING V_S' )
1432 error = nf90_put_att(ncid, id_v_s,
"coordinates",
"geolon_s geolat_s")
1433 call netcdf_err(error,
'DEFINING V_S COORD' )
1435 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
1436 call netcdf_err(error,
'DEFINING HEADER' )
1443 print*,
"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile
1445 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1446 call error_handler(
"IN FieldGather", error)
1450 dum2d(:,:) =
real(data_one_tile(i_start:i_end, j_start:j_end),kind=4)
1451 error = nf90_put_var( ncid, id_lon, dum2d)
1452 call netcdf_err(error,
'WRITING LONGITUDE RECORD' )
1458 print*,
"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile
1459 call esmf_fieldgather(
latitude_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1460 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1461 call error_handler(
"IN FieldGather", error)
1465 dum2d(:,:) =
real(data_one_tile(i_start:i_end, j_start:j_end),kind=4)
1466 error = nf90_put_var( ncid, id_lat, dum2d)
1467 call netcdf_err(error,
'WRITING LATITUDE RECORD' )
1473 print*,
"- CALL FieldGather FOR TARGET GRID SURFACE PRESSURE FOR TILE: ", tile
1474 call esmf_fieldgather(
ps_target_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=error)
1475 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1476 call error_handler(
"IN FieldGather", error)
1480 dum2d(:,:) =
real(data_one_tile(i_start:i_end, j_start:j_end),kind=4)
1481 error = nf90_put_var( ncid, id_ps, dum2d)
1482 call netcdf_err(error,
'WRITING SURFACE PRESSURE RECORD' )
1485 deallocate(dum2d, data_one_tile)
1490 allocate(dum3d(i_target_out,j_target_out,
levp1_target))
1493 allocate(dum3d(0,0,0))
1494 allocate(data_one_tile_3d(0,0,0))
1498 print*,
"- CALL FieldGather FOR TARGET GRID HEIGHT FOR TILE: ", tile
1499 call esmf_fieldgather(
zh_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1500 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1501 call error_handler(
"IN FieldGather", error)
1505 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:i_end,j_start:j_end,:),kind=4)
1507 error = nf90_put_var( ncid, id_zh, dum3d)
1508 call netcdf_err(error,
'WRITING HEIGHT RECORD' )
1511 deallocate(dum3d, data_one_tile_3d)
1516 allocate(dum3d(i_target_out,j_target_out,
lev_target))
1519 allocate(dum3d(0,0,0))
1520 allocate(data_one_tile_3d(0,0,0))
1524 print*,
"- CALL FieldGather FOR TARGET GRID VERTICAL VELOCITY FOR TILE: ", tile
1525 call esmf_fieldgather(
dzdt_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1526 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1527 call error_handler(
"IN FieldGather", error)
1531 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:i_end,j_start:j_end,:),kind=4)
1533 print*,
"MIN MAX W AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1534 error = nf90_put_var( ncid, id_w, dum3d)
1535 call netcdf_err(error,
'WRITING VERTICAL VELOCITY RECORD' )
1541 print*,
"- CALL FieldGather FOR TARGET GRID DELP FOR TILE: ", tile
1542 call esmf_fieldgather(
delp_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1543 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1544 call error_handler(
"IN FieldGather", error)
1548 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:i_end,j_start:j_end,:),kind=4)
1550 error = nf90_put_var( ncid, id_delp, dum3d)
1551 call netcdf_err(error,
'WRITING DELP RECORD' )
1557 print*,
"- CALL FieldGather FOR TARGET GRID TEMPERATURE FOR TILE: ", tile
1558 call esmf_fieldgather(
temp_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1559 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1560 call error_handler(
"IN FieldGather", error)
1564 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:i_end,j_start:j_end,:),kind=4)
1566 error = nf90_put_var( ncid, id_t, dum3d)
1567 call netcdf_err(error,
'WRITING TEMPERTAURE RECORD' )
1575 print*,
"- CALL FieldGather FOR TARGET GRID TRACER ", trim(
tracers(n)),
" TILE: ", tile
1576 call esmf_fieldgather(
tracers_target_grid(n), data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1577 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1578 call error_handler(
"IN FieldGather", error)
1582 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:i_end,j_start:j_end,:),kind=4)
1584 error = nf90_put_var( ncid, id_tracers(n), dum3d)
1585 call netcdf_err(error,
'WRITING TRACER RECORD' )
1594 print*,
"- CALL FieldGather FOR TARGET GRID QNIFA FOR TILE: ", tile
1596 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1597 call error_handler(
"IN FieldGather", error)
1601 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:i_end,j_start:j_end,:),kind=4)
1603 error = nf90_put_var( ncid, id_qnifa, dum3d)
1604 call netcdf_err(error,
'WRITING QNIFA RECORD' )
1610 print*,
"- CALL FieldGather FOR TARGET GRID QNWFA FOR TILE: ", tile
1612 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1613 call error_handler(
"IN FieldGather", error)
1617 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:i_end,j_start:j_end,:),kind=4)
1619 error = nf90_put_var( ncid, id_qnwfa, dum3d)
1620 call netcdf_err(error,
'WRITING QNWFA RECORD' )
1624 deallocate(dum3d, data_one_tile_3d)
1629 allocate(dum2d(i_target_out,jp1_target_out))
1632 allocate(dum2d(0,0))
1633 allocate(data_one_tile(0,0))
1637 print*,
"- CALL FieldGather FOR TARGET GRID LON_S FOR TILE: ", tile
1639 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1640 call error_handler(
"IN FieldGather", error)
1644 dum2d(:,:) =
real(data_one_tile(i_start:i_end,j_start:jp1_end),kind=4)
1645 error = nf90_put_var( ncid, id_lon_s, dum2d)
1646 call netcdf_err(error,
'WRITING LON_S RECORD' )
1650 print*,
"- CALL FieldGather FOR TARGET GRID LAT_S FOR TILE: ", tile
1652 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1653 call error_handler(
"IN FieldGather", error)
1657 dum2d(:,:) =
real(data_one_tile(i_start:i_end,j_start:jp1_end),kind=4)
1658 error = nf90_put_var( ncid, id_lat_s, dum2d)
1659 call netcdf_err(error,
'WRITING LAT_S RECORD' )
1662 deallocate(dum2d, data_one_tile)
1667 allocate(dum3d(i_target_out,jp1_target_out,
lev_target))
1670 allocate(dum3d(0,0,0))
1671 allocate(data_one_tile_3d(0,0,0))
1675 print*,
"- CALL FieldGather FOR TARGET GRID U_S FOR TILE: ", tile
1676 call esmf_fieldgather(
u_s_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1677 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1678 call error_handler(
"IN FieldGather", error)
1682 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:i_end,j_start:jp1_end,:),kind=4)
1684 print*,
"MIN MAX US AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1685 error = nf90_put_var( ncid, id_u_s, dum3d)
1686 call netcdf_err(error,
'WRITING U_S RECORD' )
1692 print*,
"- CALL FieldGather FOR TARGET GRID V_S FOR TILE: ", tile
1693 call esmf_fieldgather(
v_s_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1694 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1695 call error_handler(
"IN FieldGather", error)
1699 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:i_end,j_start:jp1_end,:),kind=4)
1701 print*,
"MIN MAX VS AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1702 error = nf90_put_var( ncid, id_v_s, dum3d)
1703 call netcdf_err(error,
'WRITING V_S RECORD' )
1706 deallocate(dum3d, data_one_tile_3d)
1711 allocate(dum2d(ip1_target_out,j_target_out))
1714 allocate(dum2d(0,0))
1715 allocate(data_one_tile(0,0))
1719 print*,
"- CALL FieldGather FOR TARGET GRID LON_W FOR TILE: ", tile
1721 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1722 call error_handler(
"IN FieldGather", error)
1726 dum2d(:,:) =
real(data_one_tile(i_start:ip1_end,j_start:j_end),kind=4)
1727 error = nf90_put_var( ncid, id_lon_w, dum2d)
1728 call netcdf_err(error,
'WRITING LON_W RECORD' )
1732 print*,
"- CALL FieldGather FOR TARGET GRID LAT_W FOR TILE: ", tile
1734 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1735 call error_handler(
"IN FieldGather", error)
1739 dum2d(:,:) =
real(data_one_tile(i_start:ip1_end,j_start:j_end),kind=4)
1740 error = nf90_put_var( ncid, id_lat_w, dum2d)
1741 call netcdf_err(error,
'WRITING LAT_W RECORD' )
1744 deallocate(dum2d, data_one_tile)
1749 allocate(dum3d(ip1_target_out,j_target_out,
lev_target))
1752 allocate(dum3d(0,0,0))
1753 allocate(data_one_tile_3d(0,0,0))
1757 print*,
"- CALL FieldGather FOR TARGET GRID U_W FOR TILE: ", tile
1758 call esmf_fieldgather(
u_w_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1759 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1760 call error_handler(
"IN FieldGather", error)
1764 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:ip1_end,j_start:j_end,:),kind=4)
1766 print*,
"MIN MAX UW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1767 error = nf90_put_var( ncid, id_u_w, dum3d)
1768 call netcdf_err(error,
'WRITING U_W RECORD' )
1774 print*,
"- CALL FieldGather FOR TARGET GRID V_W FOR TILE: ", tile
1775 call esmf_fieldgather(
v_w_target_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=error)
1776 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1777 call error_handler(
"IN FieldGather", error)
1781 dum3d(:,:,:) =
real(data_one_tile_3d(i_start:ip1_end,j_start:j_end,:),kind=4)
1783 print*,
"MIN MAX VW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:))
1784 error = nf90_put_var( ncid, id_v_w, dum3d)
1785 call netcdf_err(error,
'WRITING V_W RECORD' )
1788 deallocate(dum3d, data_one_tile_3d, id_tracers)
1796 end subroutine write_fv3_atm_data_netcdf
1802 subroutine write_fv3_sfc_data_netcdf(localpet)
1871 integer,
intent(in) :: localpet
1872 character(len=128) :: outfile
1874 integer :: header_buffer_val = 16384
1875 integer :: dim_x, dim_y, dim_lsoil, dim_time
1876 integer :: error, i, ncid, tile
1877 integer :: id_x, id_y, id_lsoil
1878 integer :: id_slmsk, id_time
1879 integer :: id_lat, id_lon
1880 integer :: id_tsea, id_sheleg, id_tg3
1881 integer :: id_zorl, id_alvsf, id_alvwf
1882 integer :: id_alnsf, id_alnwf, id_vfrac
1883 integer :: id_canopy, id_f10m, id_t2m
1884 integer :: id_q2m, id_vtype, id_stype
1885 integer :: id_facsf, id_facwf, id_uustar
1886 integer :: id_ffmm, id_ffhh, id_hice
1887 integer :: id_fice, id_tisfc, id_tprcp
1888 integer :: id_srflag, id_snwdph, id_shdmin
1889 integer :: id_shdmax, id_slope, id_snoalb
1891 integer :: id_stc, id_smc, id_slc
1892 integer :: id_tref, id_z_c, id_c_0
1893 integer :: id_c_d, id_w_0, id_w_d
1894 integer :: id_xt, id_xs, id_xu, id_xv
1895 integer :: id_xz, id_zm, id_xtts, id_xzts
1896 integer :: id_d_conv, id_ifd, id_dt_cool
1898 integer :: i_target_out, j_target_out
1899 integer :: istart, iend, jstart, jend
1901 integer(esmf_kind_i8),
allocatable :: idata_one_tile(:,:)
1903 real(kind=4),
allocatable :: lsoil_data(:), x_data(:), y_data(:)
1904 real(kind=8),
allocatable :: dum2d(:,:), dum3d(:,:,:)
1905 real(kind=4) :: times
1906 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
1907 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
1921 lsoil_data(i) =
real(float(i),kind=4)
1924 allocate(x_data(i_target_out))
1925 do i = 1, i_target_out
1926 x_data(i) =
real(float(i),kind=4)
1929 allocate(y_data(j_target_out))
1930 do i = 1, j_target_out
1931 y_data(i) =
real(float(i),kind=4)
1935 print*,
'- WRITE FV3 SURFACE AND NST DATA TO NETCDF FILE' 1937 print*,
'- WRITE FV3 SURFACE DATA TO NETCDF FILE' 1940 if (localpet == 0)
then 1944 allocate(dum2d(i_target_out,j_target_out))
1945 allocate(dum3d(i_target_out,j_target_out,
lsoil_target))
1947 allocate(data_one_tile(0,0))
1948 allocate(data_one_tile_3d(0,0,0))
1949 allocate(idata_one_tile(0,0))
1950 allocate(dum2d(0,0))
1951 allocate(dum3d(0,0,0))
1956 local_pet :
if (localpet == 0)
then 1959 outfile =
"out.sfc.tile7.nc" 1961 WRITE(outfile,
'(A, I1, A)')
'out.sfc.tile', tile,
'.nc' 1965 error = nf90_create(outfile, nf90_netcdf4, ncid)
1966 call netcdf_err(error,
'CREATING FILE='//trim(outfile) )
1969 error = nf90_def_dim(ncid,
'xaxis_1', i_target_out, dim_x)
1970 call netcdf_err(error,
'DEFINING XAXIS DIMENSION' )
1971 error = nf90_def_dim(ncid,
'yaxis_1', j_target_out, dim_y)
1972 call netcdf_err(error,
'DEFINING YAXIS DIMENSION' )
1973 error = nf90_def_dim(ncid,
'zaxis_1',
lsoil_target, dim_lsoil)
1974 call netcdf_err(error,
'DEFINING ZAXIS DIMENSION' )
1975 error = nf90_def_dim(ncid,
'Time', 1, dim_time)
1976 call netcdf_err(error,
'DEFINING TIME DIMENSION' )
1979 error = nf90_def_var(ncid,
'xaxis_1', nf90_float, (/dim_x/), id_x)
1980 call netcdf_err(error,
'DEFINING XAXIS_1 FIELD' )
1981 error = nf90_put_att(ncid, id_x,
"long_name",
"xaxis_1")
1982 call netcdf_err(error,
'DEFINING XAXIS_1 LONG NAME' )
1983 error = nf90_put_att(ncid, id_x,
"units",
"none")
1984 call netcdf_err(error,
'DEFINING XAXIS_1 UNITS' )
1985 error = nf90_put_att(ncid, id_x,
"cartesian_axis",
"X")
1986 call netcdf_err(error,
'WRITING XAXIS_1 FIELD' )
1988 error = nf90_def_var(ncid,
'yaxis_1', nf90_float, (/dim_y/), id_y)
1989 call netcdf_err(error,
'DEFINING YAXIS_1 FIELD' )
1990 error = nf90_put_att(ncid, id_y,
"long_name",
"yaxis_1")
1991 call netcdf_err(error,
'DEFINING YAXIS_1 LONG NAME' )
1992 error = nf90_put_att(ncid, id_y,
"units",
"none")
1993 call netcdf_err(error,
'DEFINING YAXIS_1 UNITS' )
1994 error = nf90_put_att(ncid, id_y,
"cartesian_axis",
"Y")
1995 call netcdf_err(error,
'WRITING YAXIS_1 FIELD' )
1997 error = nf90_def_var(ncid,
'zaxis_1', nf90_float, (/dim_lsoil/), id_lsoil)
1998 call netcdf_err(error,
'DEFINING ZAXIS_1 FIELD' )
1999 error = nf90_put_att(ncid, id_lsoil,
"long_name",
"zaxis_1")
2000 call netcdf_err(error,
'DEFINING ZAXIS_1 LONG NAME' )
2001 error = nf90_put_att(ncid, id_lsoil,
"units",
"none")
2002 call netcdf_err(error,
'DEFINING ZAXIS_1 UNITS' )
2003 error = nf90_put_att(ncid, id_lsoil,
"cartesian_axis",
"Z")
2004 call netcdf_err(error,
'WRITING ZAXIS_1 FIELD' )
2006 error = nf90_def_var(ncid,
'Time', nf90_float, dim_time, id_time)
2007 call netcdf_err(error,
'DEFINING TIME FIELD' )
2008 error = nf90_put_att(ncid, id_time,
"long_name",
"Time")
2009 call netcdf_err(error,
'DEFINING TIME LONG NAME' )
2010 error = nf90_put_att(ncid, id_time,
"units",
"time level")
2011 call netcdf_err(error,
'DEFINING TIME UNITS' )
2012 error = nf90_put_att(ncid, id_time,
"cartesian_axis",
"T")
2013 call netcdf_err(error,
'WRITING TIME FIELD' )
2015 error = nf90_def_var(ncid,
'geolon', nf90_double, (/dim_x,dim_y/), id_lon)
2016 call netcdf_err(error,
'DEFINING GEOLON' )
2017 error = nf90_put_att(ncid, id_lon,
"long_name",
"Longitude")
2018 call netcdf_err(error,
'DEFINING GEOLON LONG NAME' )
2019 error = nf90_put_att(ncid, id_lon,
"units",
"degrees_east")
2020 call netcdf_err(error,
'DEFINING GEOLON UNITS' )
2022 error = nf90_def_var(ncid,
'geolat', nf90_double, (/dim_x,dim_y/), id_lat)
2023 call netcdf_err(error,
'DEFINING GEOLAT' )
2024 error = nf90_put_att(ncid, id_lat,
"long_name",
"Latitude")
2025 call netcdf_err(error,
'DEFINING GEOLAT LONG NAME' )
2026 error = nf90_put_att(ncid, id_lat,
"units",
"degrees_north")
2027 call netcdf_err(error,
'DEFINING GEOLAT UNITS' )
2029 error = nf90_def_var(ncid,
'slmsk', nf90_double, (/dim_x,dim_y,dim_time/), id_slmsk)
2030 call netcdf_err(error,
'DEFINING SLMSK' )
2031 error = nf90_put_att(ncid, id_slmsk,
"long_name",
"slmsk")
2032 call netcdf_err(error,
'DEFINING SLMSK LONG NAME' )
2033 error = nf90_put_att(ncid, id_slmsk,
"units",
"none")
2034 call netcdf_err(error,
'DEFINING SLMSK UNITS' )
2035 error = nf90_put_att(ncid, id_slmsk,
"coordinates",
"geolon geolat")
2036 call netcdf_err(error,
'DEFINING SLMSK COORD' )
2038 error = nf90_def_var(ncid,
'tsea', nf90_double, (/dim_x,dim_y,dim_time/), id_tsea)
2039 call netcdf_err(error,
'DEFINING TSEA' )
2040 error = nf90_put_att(ncid, id_tsea,
"long_name",
"tsea")
2041 call netcdf_err(error,
'DEFINING TSEA LONG NAME' )
2042 error = nf90_put_att(ncid, id_tsea,
"units",
"none")
2043 call netcdf_err(error,
'DEFINING TSEA UNITS' )
2044 error = nf90_put_att(ncid, id_tsea,
"coordinates",
"geolon geolat")
2045 call netcdf_err(error,
'DEFINING TSEA COORD' )
2047 error = nf90_def_var(ncid,
'sheleg', nf90_double, (/dim_x,dim_y,dim_time/), id_sheleg)
2048 call netcdf_err(error,
'DEFINING SHELEG' )
2049 error = nf90_put_att(ncid, id_sheleg,
"long_name",
"sheleg")
2050 call netcdf_err(error,
'DEFINING SHELEG LONG NAME' )
2051 error = nf90_put_att(ncid, id_sheleg,
"units",
"none")
2052 call netcdf_err(error,
'DEFINING SHELEG UNITS' )
2053 error = nf90_put_att(ncid, id_sheleg,
"coordinates",
"geolon geolat")
2054 call netcdf_err(error,
'DEFINING SHELEG COORD' )
2056 error = nf90_def_var(ncid,
'tg3', nf90_double, (/dim_x,dim_y,dim_time/), id_tg3)
2057 call netcdf_err(error,
'DEFINING TG3' )
2058 error = nf90_put_att(ncid, id_tg3,
"long_name",
"tg3")
2059 call netcdf_err(error,
'DEFINING TG3 LONG NAME' )
2060 error = nf90_put_att(ncid, id_tg3,
"units",
"none")
2061 call netcdf_err(error,
'DEFINING TG3 UNITS' )
2062 error = nf90_put_att(ncid, id_tg3,
"coordinates",
"geolon geolat")
2063 call netcdf_err(error,
'DEFINING TG3 COORD' )
2065 error = nf90_def_var(ncid,
'zorl', nf90_double, (/dim_x,dim_y,dim_time/), id_zorl)
2066 call netcdf_err(error,
'DEFINING ZORL' )
2067 error = nf90_put_att(ncid, id_zorl,
"long_name",
"zorl")
2068 call netcdf_err(error,
'DEFINING ZORL LONG NAME' )
2069 error = nf90_put_att(ncid, id_zorl,
"units",
"none")
2070 call netcdf_err(error,
'DEFINING ZORL UNITS' )
2071 error = nf90_put_att(ncid, id_zorl,
"coordinates",
"geolon geolat")
2072 call netcdf_err(error,
'DEFINING ZORL COORD' )
2074 error = nf90_def_var(ncid,
'alvsf', nf90_double, (/dim_x,dim_y,dim_time/), id_alvsf)
2075 call netcdf_err(error,
'DEFINING ALVSF' )
2076 error = nf90_put_att(ncid, id_alvsf,
"long_name",
"alvsf")
2077 call netcdf_err(error,
'DEFINING ALVSF LONG NAME' )
2078 error = nf90_put_att(ncid, id_alvsf,
"units",
"none")
2079 call netcdf_err(error,
'DEFINING ALVSF UNITS' )
2080 error = nf90_put_att(ncid, id_alvsf,
"coordinates",
"geolon geolat")
2081 call netcdf_err(error,
'DEFINING ALVSF COORD' )
2083 error = nf90_def_var(ncid,
'alvwf', nf90_double, (/dim_x,dim_y,dim_time/), id_alvwf)
2084 call netcdf_err(error,
'DEFINING ALVWF' )
2085 error = nf90_put_att(ncid, id_alvwf,
"long_name",
"alvwf")
2086 call netcdf_err(error,
'DEFINING ALVWF LONG NAME' )
2087 error = nf90_put_att(ncid, id_alvwf,
"units",
"none")
2088 call netcdf_err(error,
'DEFINING ALVWF UNITS' )
2089 error = nf90_put_att(ncid, id_alvwf,
"coordinates",
"geolon geolat")
2090 call netcdf_err(error,
'DEFINING ALVWF COORD' )
2092 error = nf90_def_var(ncid,
'alnsf', nf90_double, (/dim_x,dim_y,dim_time/), id_alnsf)
2093 call netcdf_err(error,
'DEFINING ALNSF' )
2094 error = nf90_put_att(ncid, id_alnsf,
"long_name",
"alnsf")
2095 call netcdf_err(error,
'DEFINING ALNSF LONG NAME' )
2096 error = nf90_put_att(ncid, id_alnsf,
"units",
"none")
2097 call netcdf_err(error,
'DEFINING ALNSF UNITS' )
2098 error = nf90_put_att(ncid, id_alnsf,
"coordinates",
"geolon geolat")
2099 call netcdf_err(error,
'DEFINING ALNSF COORD' )
2101 error = nf90_def_var(ncid,
'alnwf', nf90_double, (/dim_x,dim_y,dim_time/), id_alnwf)
2102 call netcdf_err(error,
'DEFINING ALNWF' )
2103 error = nf90_put_att(ncid, id_alnwf,
"long_name",
"alnwf")
2104 call netcdf_err(error,
'DEFINING ALNWF LONG NAME' )
2105 error = nf90_put_att(ncid, id_alnwf,
"units",
"none")
2106 call netcdf_err(error,
'DEFINING ALNWF UNITS' )
2107 error = nf90_put_att(ncid, id_alnwf,
"coordinates",
"geolon geolat")
2108 call netcdf_err(error,
'DEFINING ALNWF COORD' )
2110 error = nf90_def_var(ncid,
'facsf', nf90_double, (/dim_x,dim_y,dim_time/), id_facsf)
2111 call netcdf_err(error,
'DEFINING FACSF' )
2112 error = nf90_put_att(ncid, id_facsf,
"long_name",
"facsf")
2113 call netcdf_err(error,
'DEFINING FACSF LONG NAME' )
2114 error = nf90_put_att(ncid, id_facsf,
"units",
"none")
2115 call netcdf_err(error,
'DEFINING FACSF UNITS' )
2116 error = nf90_put_att(ncid, id_facsf,
"coordinates",
"geolon geolat")
2117 call netcdf_err(error,
'DEFINING FACSF COORD' )
2119 error = nf90_def_var(ncid,
'facwf', nf90_double, (/dim_x,dim_y,dim_time/), id_facwf)
2120 call netcdf_err(error,
'DEFINING FACWF' )
2121 error = nf90_put_att(ncid, id_facwf,
"long_name",
"facwf")
2122 call netcdf_err(error,
'DEFINING FACWF LONG NAME' )
2123 error = nf90_put_att(ncid, id_facwf,
"units",
"none")
2124 call netcdf_err(error,
'DEFINING FACWF UNITS' )
2125 error = nf90_put_att(ncid, id_facwf,
"coordinates",
"geolon geolat")
2126 call netcdf_err(error,
'DEFINING FACWF COORD' )
2128 error = nf90_def_var(ncid,
'vfrac', nf90_double, (/dim_x,dim_y,dim_time/), id_vfrac)
2129 call netcdf_err(error,
'DEFINING VFRAC' )
2130 error = nf90_put_att(ncid, id_vfrac,
"long_name",
"vfrac")
2131 call netcdf_err(error,
'DEFINING VFRAC LONG NAME' )
2132 error = nf90_put_att(ncid, id_vfrac,
"units",
"none")
2133 call netcdf_err(error,
'DEFINING VFRAC UNITS' )
2134 error = nf90_put_att(ncid, id_vfrac,
"coordinates",
"geolon geolat")
2135 call netcdf_err(error,
'DEFINING VFRAC COORD' )
2137 error = nf90_def_var(ncid,
'canopy', nf90_double, (/dim_x,dim_y,dim_time/), id_canopy)
2138 call netcdf_err(error,
'DEFINING CANOPY' )
2139 error = nf90_put_att(ncid, id_canopy,
"long_name",
"canopy")
2140 call netcdf_err(error,
'DEFINING CANOPY LONG NAME' )
2141 error = nf90_put_att(ncid, id_canopy,
"units",
"none")
2142 call netcdf_err(error,
'DEFINING CANOPY UNITS' )
2143 error = nf90_put_att(ncid, id_canopy,
"coordinates",
"geolon geolat")
2144 call netcdf_err(error,
'DEFINING CANOPY COORD' )
2146 error = nf90_def_var(ncid,
'f10m', nf90_double, (/dim_x,dim_y,dim_time/), id_f10m)
2147 call netcdf_err(error,
'DEFINING F10M' )
2148 error = nf90_put_att(ncid, id_f10m,
"long_name",
"f10m")
2149 call netcdf_err(error,
'DEFINING F10M LONG NAME' )
2150 error = nf90_put_att(ncid, id_f10m,
"units",
"none")
2151 call netcdf_err(error,
'DEFINING F10M UNITS' )
2152 error = nf90_put_att(ncid, id_f10m,
"coordinates",
"geolon geolat")
2153 call netcdf_err(error,
'DEFINING F10M COORD' )
2155 error = nf90_def_var(ncid,
't2m', nf90_double, (/dim_x,dim_y,dim_time/), id_t2m)
2156 call netcdf_err(error,
'DEFINING T2M' )
2157 error = nf90_put_att(ncid, id_t2m,
"long_name",
"t2m")
2158 call netcdf_err(error,
'DEFINING T2M LONG NAME' )
2159 error = nf90_put_att(ncid, id_t2m,
"units",
"none")
2160 call netcdf_err(error,
'DEFINING T2M UNITS' )
2161 error = nf90_put_att(ncid, id_t2m,
"coordinates",
"geolon geolat")
2162 call netcdf_err(error,
'DEFINING T2M COORD' )
2164 error = nf90_def_var(ncid,
'q2m', nf90_double, (/dim_x,dim_y,dim_time/), id_q2m)
2165 call netcdf_err(error,
'DEFINING Q2M' )
2166 error = nf90_put_att(ncid, id_q2m,
"long_name",
"q2m")
2167 call netcdf_err(error,
'DEFINING Q2M LONG NAME' )
2168 error = nf90_put_att(ncid, id_q2m,
"units",
"none")
2169 call netcdf_err(error,
'DEFINING Q2M UNITS' )
2170 error = nf90_put_att(ncid, id_q2m,
"coordinates",
"geolon geolat")
2171 call netcdf_err(error,
'DEFINING Q2M COORD' )
2173 error = nf90_def_var(ncid,
'vtype', nf90_double, (/dim_x,dim_y,dim_time/), id_vtype)
2174 call netcdf_err(error,
'DEFINING VTYPE' )
2175 error = nf90_put_att(ncid, id_vtype,
"long_name",
"vtype")
2176 call netcdf_err(error,
'DEFINING VTYPE LONG NAME' )
2177 error = nf90_put_att(ncid, id_vtype,
"units",
"none")
2178 call netcdf_err(error,
'DEFINING VTYPE UNITS' )
2179 error = nf90_put_att(ncid, id_vtype,
"coordinates",
"geolon geolat")
2180 call netcdf_err(error,
'DEFINING VTYPE COORD' )
2182 error = nf90_def_var(ncid,
'stype', nf90_double, (/dim_x,dim_y,dim_time/), id_stype)
2183 call netcdf_err(error,
'DEFINING STYPE' )
2184 error = nf90_put_att(ncid, id_stype,
"long_name",
"stype")
2185 call netcdf_err(error,
'DEFINING STYPE LONG NAME' )
2186 error = nf90_put_att(ncid, id_stype,
"units",
"none")
2187 call netcdf_err(error,
'DEFINING STYPE UNITS' )
2188 error = nf90_put_att(ncid, id_stype,
"coordinates",
"geolon geolat")
2189 call netcdf_err(error,
'DEFINING STYPE COORD' )
2191 error = nf90_def_var(ncid,
'uustar', nf90_double, (/dim_x,dim_y,dim_time/), id_uustar)
2192 call netcdf_err(error,
'DEFINING UUSTAR' )
2193 error = nf90_put_att(ncid, id_uustar,
"long_name",
"uustar")
2194 call netcdf_err(error,
'DEFINING UUSTAR LONG NAME' )
2195 error = nf90_put_att(ncid, id_uustar,
"units",
"none")
2196 call netcdf_err(error,
'DEFINING UUSTAR UNITS' )
2197 error = nf90_put_att(ncid, id_uustar,
"coordinates",
"geolon geolat")
2198 call netcdf_err(error,
'DEFINING UUSTAR COORD' )
2200 error = nf90_def_var(ncid,
'ffmm', nf90_double, (/dim_x,dim_y,dim_time/), id_ffmm)
2201 call netcdf_err(error,
'DEFINING FFMM' )
2202 error = nf90_put_att(ncid, id_ffmm,
"long_name",
"ffmm")
2203 call netcdf_err(error,
'DEFINING FFMM LONG NAME' )
2204 error = nf90_put_att(ncid, id_ffmm,
"units",
"none")
2205 call netcdf_err(error,
'DEFINING FFMM UNITS' )
2206 error = nf90_put_att(ncid, id_ffmm,
"coordinates",
"geolon geolat")
2207 call netcdf_err(error,
'DEFINING FFMM COORD' )
2209 error = nf90_def_var(ncid,
'ffhh', nf90_double, (/dim_x,dim_y,dim_time/), id_ffhh)
2210 call netcdf_err(error,
'DEFINING FFHH' )
2211 error = nf90_put_att(ncid, id_ffhh,
"long_name",
"ffhh")
2212 call netcdf_err(error,
'DEFINING FFHH LONG NAME' )
2213 error = nf90_put_att(ncid, id_ffhh,
"units",
"none")
2214 call netcdf_err(error,
'DEFINING FFHH UNITS' )
2215 error = nf90_put_att(ncid, id_ffhh,
"coordinates",
"geolon geolat")
2216 call netcdf_err(error,
'DEFINING FFHH COORD' )
2218 error = nf90_def_var(ncid,
'hice', nf90_double, (/dim_x,dim_y,dim_time/), id_hice)
2219 call netcdf_err(error,
'DEFINING HICE' )
2220 error = nf90_put_att(ncid, id_hice,
"long_name",
"hice")
2221 call netcdf_err(error,
'DEFINING HICE LONG NAME' )
2222 error = nf90_put_att(ncid, id_hice,
"units",
"none")
2223 call netcdf_err(error,
'DEFINING HICE UNITS' )
2224 error = nf90_put_att(ncid, id_hice,
"coordinates",
"geolon geolat")
2225 call netcdf_err(error,
'DEFINING HICE COORD' )
2227 error = nf90_def_var(ncid,
'fice', nf90_double, (/dim_x,dim_y,dim_time/), id_fice)
2228 call netcdf_err(error,
'DEFINING FICE' )
2229 error = nf90_put_att(ncid, id_fice,
"long_name",
"fice")
2230 call netcdf_err(error,
'DEFINING FICE LONG NAME' )
2231 error = nf90_put_att(ncid, id_fice,
"units",
"none")
2232 call netcdf_err(error,
'DEFINING FICE UNITS' )
2233 error = nf90_put_att(ncid, id_fice,
"coordinates",
"geolon geolat")
2234 call netcdf_err(error,
'DEFINING FICE COORD' )
2236 error = nf90_def_var(ncid,
'tisfc', nf90_double, (/dim_x,dim_y,dim_time/), id_tisfc)
2237 call netcdf_err(error,
'DEFINING TISFC' )
2238 error = nf90_put_att(ncid, id_tisfc,
"long_name",
"tisfc")
2239 call netcdf_err(error,
'DEFINING TISFC LONG NAME' )
2240 error = nf90_put_att(ncid, id_tisfc,
"units",
"none")
2241 call netcdf_err(error,
'DEFINING TISFC UNITS' )
2242 error = nf90_put_att(ncid, id_tisfc,
"coordinates",
"geolon geolat")
2243 call netcdf_err(error,
'DEFINING TISFC COORD' )
2245 error = nf90_def_var(ncid,
'tprcp', nf90_double, (/dim_x,dim_y,dim_time/), id_tprcp)
2246 call netcdf_err(error,
'DEFINING TPRCP' )
2247 error = nf90_put_att(ncid, id_tprcp,
"long_name",
"tprcp")
2248 call netcdf_err(error,
'DEFINING TPRCP LONG NAME' )
2249 error = nf90_put_att(ncid, id_tprcp,
"units",
"none")
2250 call netcdf_err(error,
'DEFINING TPRCP UNITS' )
2251 error = nf90_put_att(ncid, id_tprcp,
"coordinates",
"geolon geolat")
2252 call netcdf_err(error,
'DEFINING TPRCP COORD' )
2254 error = nf90_def_var(ncid,
'srflag', nf90_double, (/dim_x,dim_y,dim_time/), id_srflag)
2255 call netcdf_err(error,
'DEFINING SRFLAG' )
2256 error = nf90_put_att(ncid, id_srflag,
"long_name",
"srflag")
2257 call netcdf_err(error,
'DEFINING SRFLAG LONG NAME' )
2258 error = nf90_put_att(ncid, id_srflag,
"units",
"none")
2259 call netcdf_err(error,
'DEFINING SRFLAG UNITS' )
2260 error = nf90_put_att(ncid, id_srflag,
"coordinates",
"geolon geolat")
2261 call netcdf_err(error,
'DEFINING SRFLAG COORD' )
2263 error = nf90_def_var(ncid,
'snwdph', nf90_double, (/dim_x,dim_y,dim_time/), id_snwdph)
2264 call netcdf_err(error,
'DEFINING SNWDPH' )
2265 error = nf90_put_att(ncid, id_snwdph,
"long_name",
"snwdph")
2266 call netcdf_err(error,
'DEFINING SNWDPH LONG NAME' )
2267 error = nf90_put_att(ncid, id_snwdph,
"units",
"none")
2268 call netcdf_err(error,
'DEFINING SNWDPH UNITS' )
2269 error = nf90_put_att(ncid, id_snwdph,
"coordinates",
"geolon geolat")
2270 call netcdf_err(error,
'DEFINING SNWDPH COORD' )
2272 error = nf90_def_var(ncid,
'shdmin', nf90_double, (/dim_x,dim_y,dim_time/), id_shdmin)
2273 call netcdf_err(error,
'DEFINING SHDMIN' )
2274 error = nf90_put_att(ncid, id_shdmin,
"long_name",
"shdmin")
2275 call netcdf_err(error,
'DEFINING SHDMIN LONG NAME' )
2276 error = nf90_put_att(ncid, id_shdmin,
"units",
"none")
2277 call netcdf_err(error,
'DEFINING SHDMIN UNITS' )
2278 error = nf90_put_att(ncid, id_shdmin,
"coordinates",
"geolon geolat")
2279 call netcdf_err(error,
'DEFINING SHDMIN COORD' )
2281 error = nf90_def_var(ncid,
'shdmax', nf90_double, (/dim_x,dim_y,dim_time/), id_shdmax)
2282 call netcdf_err(error,
'DEFINING SHDMAX' )
2283 error = nf90_put_att(ncid, id_shdmax,
"long_name",
"shdmax")
2284 call netcdf_err(error,
'DEFINING SHDMAX LONG NAME' )
2285 error = nf90_put_att(ncid, id_shdmax,
"units",
"none")
2286 call netcdf_err(error,
'DEFINING SHDMAX UNITS' )
2287 error = nf90_put_att(ncid, id_shdmax,
"coordinates",
"geolon geolat")
2288 call netcdf_err(error,
'DEFINING SHDMAX COORD' )
2290 error = nf90_def_var(ncid,
'slope', nf90_double, (/dim_x,dim_y,dim_time/), id_slope)
2291 call netcdf_err(error,
'DEFINING SLOPE' )
2292 error = nf90_put_att(ncid, id_slope,
"long_name",
"slope")
2293 call netcdf_err(error,
'DEFINING SLOPE LONG NAME' )
2294 error = nf90_put_att(ncid, id_slope,
"units",
"none")
2295 call netcdf_err(error,
'DEFINING SLOPE UNITS' )
2296 error = nf90_put_att(ncid, id_slope,
"coordinates",
"geolon geolat")
2297 call netcdf_err(error,
'DEFINING SLOPE COORD' )
2299 error = nf90_def_var(ncid,
'snoalb', nf90_double, (/dim_x,dim_y,dim_time/), id_snoalb)
2300 call netcdf_err(error,
'DEFINING SNOALB' )
2301 error = nf90_put_att(ncid, id_snoalb,
"long_name",
"snoalb")
2302 call netcdf_err(error,
'DEFINING SNOALB LONG NAME' )
2303 error = nf90_put_att(ncid, id_snoalb,
"units",
"none")
2304 call netcdf_err(error,
'DEFINING SNOALB UNITS' )
2305 error = nf90_put_att(ncid, id_snoalb,
"coordinates",
"geolon geolat")
2306 call netcdf_err(error,
'DEFINING SNOALB COORD' )
2309 error = nf90_def_var(ncid,
'lai', nf90_double, (/dim_x,dim_y,dim_time/), id_lai)
2310 call netcdf_err(error,
'DEFINING LAI' )
2311 error = nf90_put_att(ncid, id_lai,
"long_name",
"lai")
2312 call netcdf_err(error,
'DEFINING LAI LONG NAME' )
2313 error = nf90_put_att(ncid, id_lai,
"units",
"none")
2314 call netcdf_err(error,
'DEFINING LAI UNITS' )
2315 error = nf90_put_att(ncid, id_lai,
"coordinates",
"geolon geolat")
2316 call netcdf_err(error,
'DEFINING LAI COORD' )
2319 error = nf90_def_var(ncid,
'stc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_stc)
2320 call netcdf_err(error,
'DEFINING STC' )
2321 error = nf90_put_att(ncid, id_stc,
"long_name",
"stc")
2322 call netcdf_err(error,
'DEFINING STC LONG NAME' )
2323 error = nf90_put_att(ncid, id_stc,
"units",
"none")
2324 call netcdf_err(error,
'DEFINING STC UNITS' )
2325 error = nf90_put_att(ncid, id_stc,
"coordinates",
"geolon geolat")
2326 call netcdf_err(error,
'DEFINING STC COORD' )
2328 error = nf90_def_var(ncid,
'smc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_smc)
2329 call netcdf_err(error,
'DEFINING SMC' )
2330 error = nf90_put_att(ncid, id_smc,
"long_name",
"smc")
2331 call netcdf_err(error,
'DEFINING SMC LONG NAME' )
2332 error = nf90_put_att(ncid, id_smc,
"units",
"none")
2333 call netcdf_err(error,
'DEFINING SMC UNITS' )
2334 error = nf90_put_att(ncid, id_smc,
"coordinates",
"geolon geolat")
2335 call netcdf_err(error,
'DEFINING SMC COORD' )
2337 error = nf90_def_var(ncid,
'slc', nf90_double, (/dim_x,dim_y,dim_lsoil,dim_time/), id_slc)
2338 call netcdf_err(error,
'DEFINING SLC' )
2339 error = nf90_put_att(ncid, id_slc,
"long_name",
"slc")
2340 call netcdf_err(error,
'DEFINING SLC LONG NAME' )
2341 error = nf90_put_att(ncid, id_slc,
"units",
"none")
2342 call netcdf_err(error,
'DEFINING SLC UNITS' )
2343 error = nf90_put_att(ncid, id_slc,
"coordinates",
"geolon geolat")
2344 call netcdf_err(error,
'DEFINING SLC COORD' )
2348 error = nf90_def_var(ncid,
'tref', nf90_double, (/dim_x,dim_y,dim_time/), id_tref)
2349 call netcdf_err(error,
'DEFINING TREF' )
2350 error = nf90_put_att(ncid, id_tref,
"long_name",
"tref")
2351 call netcdf_err(error,
'DEFINING TREF LONG NAME' )
2352 error = nf90_put_att(ncid, id_tref,
"units",
"none")
2353 call netcdf_err(error,
'DEFINING TREF UNITS' )
2354 error = nf90_put_att(ncid, id_tref,
"coordinates",
"geolon geolat")
2355 call netcdf_err(error,
'DEFINING TREF COORD' )
2357 error = nf90_def_var(ncid,
'z_c', nf90_double, (/dim_x,dim_y,dim_time/), id_z_c)
2358 call netcdf_err(error,
'DEFINING Z_C' )
2359 error = nf90_put_att(ncid, id_z_c,
"long_name",
"z_c")
2360 call netcdf_err(error,
'DEFINING Z_C LONG NAME' )
2361 error = nf90_put_att(ncid, id_z_c,
"units",
"none")
2362 call netcdf_err(error,
'DEFINING Z_C UNITS' )
2363 error = nf90_put_att(ncid, id_z_c,
"coordinates",
"geolon geolat")
2364 call netcdf_err(error,
'DEFINING Z_C COORD' )
2366 error = nf90_def_var(ncid,
'c_0', nf90_double, (/dim_x,dim_y,dim_time/), id_c_0)
2367 call netcdf_err(error,
'DEFINING C_0' )
2368 error = nf90_put_att(ncid, id_c_0,
"long_name",
"c_0")
2369 call netcdf_err(error,
'DEFINING C_0 LONG NAME' )
2370 error = nf90_put_att(ncid, id_c_0,
"units",
"none")
2371 call netcdf_err(error,
'DEFINING C_0 UNITS' )
2372 error = nf90_put_att(ncid, id_c_0,
"coordinates",
"geolon geolat")
2373 call netcdf_err(error,
'DEFINING C_0 COORD' )
2375 error = nf90_def_var(ncid,
'c_d', nf90_double, (/dim_x,dim_y,dim_time/), id_c_d)
2376 call netcdf_err(error,
'DEFINING C_D' )
2377 error = nf90_put_att(ncid, id_c_d,
"long_name",
"c_d")
2378 call netcdf_err(error,
'DEFINING C_D LONG NAME' )
2379 error = nf90_put_att(ncid, id_c_d,
"units",
"none")
2380 call netcdf_err(error,
'DEFINING C_D UNITS' )
2381 error = nf90_put_att(ncid, id_c_d,
"coordinates",
"geolon geolat")
2382 call netcdf_err(error,
'DEFINING C_D COORD' )
2384 error = nf90_def_var(ncid,
'w_0', nf90_double, (/dim_x,dim_y,dim_time/), id_w_0)
2385 call netcdf_err(error,
'DEFINING W_0' )
2386 error = nf90_put_att(ncid, id_w_0,
"long_name",
"w_0")
2387 call netcdf_err(error,
'DEFINING W_0 LONG NAME' )
2388 error = nf90_put_att(ncid, id_w_0,
"units",
"none")
2389 call netcdf_err(error,
'DEFINING W_0 UNITS' )
2390 error = nf90_put_att(ncid, id_w_0,
"coordinates",
"geolon geolat")
2391 call netcdf_err(error,
'DEFINING W_0 COORD' )
2393 error = nf90_def_var(ncid,
'w_d', nf90_double, (/dim_x,dim_y,dim_time/), id_w_d)
2394 call netcdf_err(error,
'DEFINING W_D' )
2395 error = nf90_put_att(ncid, id_w_d,
"long_name",
"w_d")
2396 call netcdf_err(error,
'DEFINING W_D LONG NAME' )
2397 error = nf90_put_att(ncid, id_w_d,
"units",
"none")
2398 call netcdf_err(error,
'DEFINING W_D UNITS' )
2399 error = nf90_put_att(ncid, id_w_d,
"coordinates",
"geolon geolat")
2400 call netcdf_err(error,
'DEFINING W_D COORD' )
2402 error = nf90_def_var(ncid,
'xt', nf90_double, (/dim_x,dim_y,dim_time/), id_xt)
2403 call netcdf_err(error,
'DEFINING XT' )
2404 error = nf90_put_att(ncid, id_xt,
"long_name",
"xt")
2405 call netcdf_err(error,
'DEFINING XT LONG NAME' )
2406 error = nf90_put_att(ncid, id_xt,
"units",
"none")
2407 call netcdf_err(error,
'DEFINING XT UNITS' )
2408 error = nf90_put_att(ncid, id_xt,
"coordinates",
"geolon geolat")
2409 call netcdf_err(error,
'DEFINING XT COORD' )
2411 error = nf90_def_var(ncid,
'xs', nf90_double, (/dim_x,dim_y,dim_time/), id_xs)
2412 call netcdf_err(error,
'DEFINING XS' )
2413 error = nf90_put_att(ncid, id_xs,
"long_name",
"xs")
2414 call netcdf_err(error,
'DEFINING XS LONG NAME' )
2415 error = nf90_put_att(ncid, id_xs,
"units",
"none")
2416 call netcdf_err(error,
'DEFINING XS UNITS' )
2417 error = nf90_put_att(ncid, id_xs,
"coordinates",
"geolon geolat")
2418 call netcdf_err(error,
'DEFINING XS COORD' )
2420 error = nf90_def_var(ncid,
'xu', nf90_double, (/dim_x,dim_y,dim_time/), id_xu)
2421 call netcdf_err(error,
'DEFINING XU' )
2422 error = nf90_put_att(ncid, id_xu,
"long_name",
"xu")
2423 call netcdf_err(error,
'DEFINING XU LONG NAME' )
2424 error = nf90_put_att(ncid, id_xu,
"units",
"none")
2425 call netcdf_err(error,
'DEFINING XU UNITS' )
2426 error = nf90_put_att(ncid, id_xu,
"coordinates",
"geolon geolat")
2427 call netcdf_err(error,
'DEFINING XU COORD' )
2429 error = nf90_def_var(ncid,
'xv', nf90_double, (/dim_x,dim_y,dim_time/), id_xv)
2430 call netcdf_err(error,
'DEFINING XV' )
2431 error = nf90_put_att(ncid, id_xv,
"long_name",
"xv")
2432 call netcdf_err(error,
'DEFINING XV LONG NAME' )
2433 error = nf90_put_att(ncid, id_xv,
"units",
"none")
2434 call netcdf_err(error,
'DEFINING XV UNITS' )
2435 error = nf90_put_att(ncid, id_xv,
"coordinates",
"geolon geolat")
2436 call netcdf_err(error,
'DEFINING XV COORD' )
2438 error = nf90_def_var(ncid,
'xz', nf90_double, (/dim_x,dim_y,dim_time/), id_xz)
2439 call netcdf_err(error,
'DEFINING XZ' )
2440 error = nf90_put_att(ncid, id_xz,
"long_name",
"xz")
2441 call netcdf_err(error,
'DEFINING XZ LONG NAME' )
2442 error = nf90_put_att(ncid, id_xz,
"units",
"none")
2443 call netcdf_err(error,
'DEFINING XZ UNITS' )
2444 error = nf90_put_att(ncid, id_xz,
"coordinates",
"geolon geolat")
2445 call netcdf_err(error,
'DEFINING XZ COORD' )
2447 error = nf90_def_var(ncid,
'zm', nf90_double, (/dim_x,dim_y,dim_time/), id_zm)
2448 call netcdf_err(error,
'DEFINING ZM' )
2449 error = nf90_put_att(ncid, id_zm,
"long_name",
"zm")
2450 call netcdf_err(error,
'DEFINING ZM LONG NAME' )
2451 error = nf90_put_att(ncid, id_zm,
"units",
"none")
2452 call netcdf_err(error,
'DEFINING ZM UNITS' )
2453 error = nf90_put_att(ncid, id_zm,
"coordinates",
"geolon geolat")
2454 call netcdf_err(error,
'DEFINING ZM COORD' )
2456 error = nf90_def_var(ncid,
'xtts', nf90_double, (/dim_x,dim_y,dim_time/), id_xtts)
2457 call netcdf_err(error,
'DEFINING XTTS' )
2458 error = nf90_put_att(ncid, id_xtts,
"long_name",
"xtts")
2459 call netcdf_err(error,
'DEFINING XTTS LONG NAME' )
2460 error = nf90_put_att(ncid, id_xtts,
"units",
"none")
2461 call netcdf_err(error,
'DEFINING XTTS UNITS' )
2462 error = nf90_put_att(ncid, id_xtts,
"coordinates",
"geolon geolat")
2463 call netcdf_err(error,
'DEFINING XTTS COORD' )
2465 error = nf90_def_var(ncid,
'xzts', nf90_double, (/dim_x,dim_y,dim_time/), id_xzts)
2466 call netcdf_err(error,
'DEFINING XZTS' )
2467 error = nf90_put_att(ncid, id_xzts,
"long_name",
"xzts")
2468 call netcdf_err(error,
'DEFINING XZTS LONG NAME' )
2469 error = nf90_put_att(ncid, id_xzts,
"units",
"none")
2470 call netcdf_err(error,
'DEFINING XZTS UNITS' )
2471 error = nf90_put_att(ncid, id_xzts,
"coordinates",
"geolon geolat")
2472 call netcdf_err(error,
'DEFINING XZTS COORD' )
2474 error = nf90_def_var(ncid,
'd_conv', nf90_double, (/dim_x,dim_y,dim_time/), id_d_conv)
2475 call netcdf_err(error,
'DEFINING D_CONV' )
2476 error = nf90_put_att(ncid, id_d_conv,
"long_name",
"d_conv")
2477 call netcdf_err(error,
'DEFINING D_CONV LONG NAME' )
2478 error = nf90_put_att(ncid, id_d_conv,
"units",
"none")
2479 call netcdf_err(error,
'DEFINING D_CONV UNITS' )
2480 error = nf90_put_att(ncid, id_d_conv,
"coordinates",
"geolon geolat")
2481 call netcdf_err(error,
'DEFINING D_CONV COORD' )
2483 error = nf90_def_var(ncid,
'ifd', nf90_double, (/dim_x,dim_y,dim_time/), id_ifd)
2484 call netcdf_err(error,
'DEFINING IFD' )
2485 error = nf90_put_att(ncid, id_ifd,
"long_name",
"ifd")
2486 call netcdf_err(error,
'DEFINING IFD LONG NAME' )
2487 error = nf90_put_att(ncid, id_ifd,
"units",
"none")
2488 call netcdf_err(error,
'DEFINING IFD UNITS' )
2489 error = nf90_put_att(ncid, id_ifd,
"coordinates",
"geolon geolat")
2490 call netcdf_err(error,
'DEFINING IFD COORD' )
2492 error = nf90_def_var(ncid,
'dt_cool', nf90_double, (/dim_x,dim_y,dim_time/), id_dt_cool)
2493 call netcdf_err(error,
'DEFINING DT_COOL' )
2494 error = nf90_put_att(ncid, id_dt_cool,
"long_name",
"dt_cool")
2495 call netcdf_err(error,
'DEFINING DT_COOL LONG NAME' )
2496 error = nf90_put_att(ncid, id_dt_cool,
"units",
"none")
2497 call netcdf_err(error,
'DEFINING DT_COOL UNITS' )
2498 error = nf90_put_att(ncid, id_dt_cool,
"coordinates",
"geolon geolat")
2499 call netcdf_err(error,
'DEFINING DT_COOL COORD' )
2501 error = nf90_def_var(ncid,
'qrain', nf90_double, (/dim_x,dim_y,dim_time/), id_qrain)
2502 call netcdf_err(error,
'DEFINING QRAIN' )
2503 error = nf90_put_att(ncid, id_qrain,
"long_name",
"qrain")
2504 call netcdf_err(error,
'DEFINING QRAIN LONG NAME' )
2505 error = nf90_put_att(ncid, id_qrain,
"units",
"none")
2506 call netcdf_err(error,
'DEFINING QRAIN UNITS' )
2507 error = nf90_put_att(ncid, id_qrain,
"coordinates",
"geolon geolat")
2508 call netcdf_err(error,
'DEFINING QRAIN COORD' )
2512 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
2513 call netcdf_err(error,
'DEFINING HEADER' )
2517 if (localpet == 0)
then 2518 error = nf90_put_var( ncid, id_lsoil, lsoil_data)
2519 call netcdf_err(error,
'WRITING ZAXIS RECORD' )
2520 error = nf90_put_var( ncid, id_x, x_data)
2521 call netcdf_err(error,
'WRITING XAXIS RECORD' )
2522 error = nf90_put_var( ncid, id_y, y_data)
2523 call netcdf_err(error,
'WRITING YAXIS RECORD' )
2525 error = nf90_put_var( ncid, id_time, times)
2526 call netcdf_err(error,
'WRITING TIME RECORD' )
2529 print*,
"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile
2531 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2532 call error_handler(
"IN FieldGather", error)
2534 if (localpet == 0)
then 2535 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2536 error = nf90_put_var( ncid, id_lat, dum2d)
2537 call netcdf_err(error,
'WRITING LATITUDE RECORD' )
2540 print*,
"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile
2542 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2543 call error_handler(
"IN FieldGather", error)
2545 if (localpet == 0)
then 2546 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2547 error = nf90_put_var( ncid, id_lon, dum2d)
2548 call netcdf_err(error,
'WRITING LONGITUDE RECORD' )
2551 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV FOR TILE: ", tile
2553 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2554 call error_handler(
"IN FieldGather", error)
2556 if (localpet == 0)
then 2557 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2558 error = nf90_put_var( ncid, id_sheleg, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2559 call netcdf_err(error,
'WRITING SNOW LIQ EQUIV RECORD' )
2562 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH FOR TILE: ", tile
2564 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2565 call error_handler(
"IN FieldGather", error)
2567 if (localpet == 0)
then 2568 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2569 error = nf90_put_var( ncid, id_snwdph, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2570 call netcdf_err(error,
'WRITING SNWDPH RECORD' )
2573 print*,
"- CALL FieldGather FOR TARGET GRID SLOPE TYPE FOR TILE: ", tile
2575 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2576 call error_handler(
"IN FieldGather", error)
2578 if (localpet == 0)
then 2579 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2580 error = nf90_put_var( ncid, id_slope, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2581 call netcdf_err(error,
'WRITING SLOPE RECORD' )
2584 print*,
"- CALL FieldGather FOR TARGET GRID Z0 FOR TILE: ", tile
2585 call esmf_fieldgather(
z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2586 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2587 call error_handler(
"IN FieldGather", error)
2589 if (localpet == 0)
then 2590 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2591 error = nf90_put_var( ncid, id_zorl, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2592 call netcdf_err(error,
'WRITING Z0 RECORD' )
2595 print*,
"- CALL FieldGather FOR TARGET GRID MAX SNOW ALBEDO FOR TILE: ", tile
2597 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2598 call error_handler(
"IN FieldGather", error)
2600 if (localpet == 0)
then 2601 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2602 error = nf90_put_var( ncid, id_snoalb, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2603 call netcdf_err(error,
'WRITING MAX SNOW ALBEDO RECORD' )
2607 print*,
"- CALL FieldGather FOR TARGET GRID LEAF AREA INDEX FOR TILE: ", tile
2608 call esmf_fieldgather(
lai_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2609 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2610 call error_handler(
"IN FieldGather", error)
2612 if (localpet == 0)
then 2613 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2614 error = nf90_put_var( ncid, id_lai, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2615 call netcdf_err(error,
'WRITING LEAF AREA INDEX RECORD' )
2619 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TYPE FOR TILE: ", tile
2621 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2622 call error_handler(
"IN FieldGather", error)
2624 if (localpet == 0)
then 2625 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2626 error = nf90_put_var( ncid, id_stype, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2627 call netcdf_err(error,
'WRITING SOIL TYPE RECORD' )
2630 print*,
"- CALL FieldGather FOR TARGET GRID VEGETATION TYPE FOR TILE: ", tile
2632 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2633 call error_handler(
"IN FieldGather", error)
2635 if (localpet == 0)
then 2636 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2637 error = nf90_put_var( ncid, id_vtype, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2638 call netcdf_err(error,
'WRITING VEGETATION TYPE RECORD' )
2641 print*,
"- CALL FieldGather FOR TARGET GRID VEGETATION GREENNESS FOR TILE: ", tile
2643 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2644 call error_handler(
"IN FieldGather", error)
2646 if (localpet == 0)
then 2647 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2648 error = nf90_put_var( ncid, id_vfrac, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2649 call netcdf_err(error,
'WRITING VEGETATION GREENNESS RECORD' )
2652 print*,
"- CALL FieldGather FOR TARGET GRID SUBSTRATE TEMPERATURE FOR TILE: ", tile
2654 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2655 call error_handler(
"IN FieldGather", error)
2657 if (localpet == 0)
then 2658 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2659 error = nf90_put_var( ncid, id_tg3, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2660 call netcdf_err(error,
'WRITING SUBSTRATE TEMPERATURE RECORD' )
2663 print*,
"- CALL FieldGather FOR TARGET GRID FACSF FOR TILE: ", tile
2664 call esmf_fieldgather(
facsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2665 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2666 call error_handler(
"IN FieldGather", error)
2668 if (localpet == 0)
then 2669 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2670 error = nf90_put_var( ncid, id_facsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2671 call netcdf_err(error,
'WRITING FACSF RECORD' )
2674 print*,
"- CALL FieldGather FOR TARGET GRID FACWF FOR TILE: ", tile
2675 call esmf_fieldgather(
facwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2676 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2677 call error_handler(
"IN FieldGather", error)
2679 if (localpet == 0)
then 2680 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2681 error = nf90_put_var( ncid, id_facwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2682 call netcdf_err(error,
'WRITING FACWF RECORD' )
2685 print*,
"- CALL FieldGather FOR TARGET GRID ALNSF FOR TILE: ", tile
2686 call esmf_fieldgather(
alnsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2687 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2688 call error_handler(
"IN FieldGather", error)
2690 if (localpet == 0)
then 2691 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2692 error = nf90_put_var( ncid, id_alnsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2693 call netcdf_err(error,
'WRITING ALNSF RECORD' )
2696 print*,
"- CALL FieldGather FOR TARGET GRID ALNWF FOR TILE: ", tile
2697 call esmf_fieldgather(
alnwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2698 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2699 call error_handler(
"IN FieldGather", error)
2701 if (localpet == 0)
then 2702 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2703 error = nf90_put_var( ncid, id_alnwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2704 call netcdf_err(error,
'WRITING ALNWF RECORD' )
2707 print*,
"- CALL FieldGather FOR TARGET GRID ALVSF FOR TILE: ", tile
2708 call esmf_fieldgather(
alvsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2709 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2710 call error_handler(
"IN FieldGather", error)
2712 if (localpet == 0)
then 2713 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2714 error = nf90_put_var( ncid, id_alvsf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2715 call netcdf_err(error,
'WRITING ALVSF RECORD' )
2718 print*,
"- CALL FieldGather FOR TARGET GRID ALVWF FOR TILE: ", tile
2719 call esmf_fieldgather(
alvwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2720 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2721 call error_handler(
"IN FieldGather", error)
2723 if (localpet == 0)
then 2724 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2725 error = nf90_put_var( ncid, id_alvwf, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2726 call netcdf_err(error,
'WRITING ALVWF RECORD' )
2729 print*,
"- CALL FieldGather FOR TARGET GRID MAX VEGETATION GREENNESS FOR TILE: ", tile
2731 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2732 call error_handler(
"IN FieldGather", error)
2734 if (localpet == 0)
then 2735 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2736 error = nf90_put_var( ncid, id_shdmax, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2737 call netcdf_err(error,
'WRITING MAX VEGETATION GREENNESS RECORD' )
2740 print*,
"- CALL FieldGather FOR TARGET GRID MIN VEGETATION GREENNESS FOR TILE: ", tile
2742 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2743 call error_handler(
"IN FieldGather", error)
2745 if (localpet == 0)
then 2746 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2747 error = nf90_put_var( ncid, id_shdmin, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2748 call netcdf_err(error,
'WRITING MIN VEGETATION GREENNESS RECORD' )
2751 print*,
"- CALL FieldGather FOR TARGET GRID T2M FOR TILE: ", tile
2752 call esmf_fieldgather(
t2m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2753 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2754 call error_handler(
"IN FieldGather", error)
2756 if (localpet == 0)
then 2757 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2758 error = nf90_put_var( ncid, id_t2m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2759 call netcdf_err(error,
'WRITING T2M RECORD' )
2762 print*,
"- CALL FieldGather FOR TARGET GRID Q2M FOR TILE: ", tile
2763 call esmf_fieldgather(
q2m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2764 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2765 call error_handler(
"IN FieldGather", error)
2767 if (localpet == 0)
then 2768 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2769 error = nf90_put_var( ncid, id_q2m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2770 call netcdf_err(error,
'WRITING Q2M RECORD' )
2773 print*,
"- CALL FieldGather FOR TARGET GRID TPRCP FOR TILE: ", tile
2774 call esmf_fieldgather(
tprcp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2775 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2776 call error_handler(
"IN FieldGather", error)
2778 if (localpet == 0)
then 2779 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2780 error = nf90_put_var( ncid, id_tprcp, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2781 call netcdf_err(error,
'WRITING TPRCP RECORD' )
2784 print*,
"- CALL FieldGather FOR TARGET GRID F10M FOR TILE: ", tile
2785 call esmf_fieldgather(
f10m_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2786 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2787 call error_handler(
"IN FieldGather", error)
2789 if (localpet == 0)
then 2790 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2791 error = nf90_put_var( ncid, id_f10m, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2792 call netcdf_err(error,
'WRITING F10M RECORD' )
2795 print*,
"- CALL FieldGather FOR TARGET GRID FFMM FOR TILE: ", tile
2796 call esmf_fieldgather(
ffmm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2797 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2798 call error_handler(
"IN FieldGather", error)
2800 if (localpet == 0)
then 2801 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2802 error = nf90_put_var( ncid, id_ffmm, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2803 call netcdf_err(error,
'WRITING FFMM RECORD' )
2805 error = nf90_put_var( ncid, id_ffhh, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2806 call netcdf_err(error,
'WRITING FFHH RECORD' )
2809 print*,
"- CALL FieldGather FOR TARGET GRID USTAR FOR TILE: ", tile
2810 call esmf_fieldgather(
ustar_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2811 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2812 call error_handler(
"IN FieldGather", error)
2814 if (localpet == 0)
then 2815 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2816 error = nf90_put_var( ncid, id_uustar, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2817 call netcdf_err(error,
'WRITING USTAR RECORD' )
2820 print*,
"- CALL FieldGather FOR TARGET GRID SRFLAG FOR TILE: ", tile
2821 call esmf_fieldgather(
srflag_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2822 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2823 call error_handler(
"IN FieldGather", error)
2825 if (localpet == 0)
then 2826 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2827 error = nf90_put_var( ncid, id_srflag, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2828 call netcdf_err(error,
'WRITING SRFLAG RECORD' )
2831 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE FRACTION FOR TILE: ", tile
2833 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2834 call error_handler(
"IN FieldGather", error)
2836 if (localpet == 0)
then 2837 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2838 error = nf90_put_var( ncid, id_fice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2839 call netcdf_err(error,
'WRITING FICE RECORD' )
2842 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE DEPTH FOR TILE: ", tile
2844 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2845 call error_handler(
"IN FieldGather", error)
2847 if (localpet == 0)
then 2848 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2849 error = nf90_put_var( ncid, id_hice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2850 call netcdf_err(error,
'WRITING HICE RECORD' )
2853 print*,
"- CALL FieldGather FOR TARGET GRID SEA ICE SKIN TEMP FOR TILE: ", tile
2855 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2856 call error_handler(
"IN FieldGather", error)
2858 if (localpet == 0)
then 2859 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2860 error = nf90_put_var( ncid, id_tisfc, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2861 call netcdf_err(error,
'WRITING TISFC RECORD' )
2864 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMP FOR TILE: ", tile
2866 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2867 call error_handler(
"IN FieldGather", error)
2869 if (localpet == 0)
then 2870 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2871 error = nf90_put_var( ncid, id_tsea, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2872 call netcdf_err(error,
'WRITING TSEA RECORD' )
2875 print*,
"- CALL FieldGather FOR TARGET GRID LANDMASK FOR TILE: ", tile
2877 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2878 call error_handler(
"IN FieldGather", error)
2880 if (localpet == 0)
then 2881 dum2d(:,:) = float(idata_one_tile(istart:iend, jstart:jend))
2882 error = nf90_put_var( ncid, id_slmsk, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2883 call netcdf_err(error,
'WRITING LANDMASK RECORD' )
2886 print*,
"- CALL FieldGather FOR TARGET GRID CANOPY MOISTURE CONTENT FOR TILE: ", tile
2888 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2889 call error_handler(
"IN FieldGather", error)
2891 if (localpet == 0)
then 2892 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2893 error = nf90_put_var( ncid, id_canopy, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2894 call netcdf_err(error,
'WRITING CANOPY MC RECORD' )
2899 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE FOR TILE: ", tile
2901 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2902 call error_handler(
"IN FieldGather", error)
2904 if (localpet == 0)
then 2905 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2906 error = nf90_put_var( ncid, id_stc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,
lsoil_target,1/))
2907 call netcdf_err(error,
'WRITING SOIL TEMP RECORD' )
2912 print*,
"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE FOR TILE: ", tile
2914 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2915 call error_handler(
"IN FieldGather", error)
2917 if (localpet == 0)
then 2918 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2919 error = nf90_put_var( ncid, id_smc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,
lsoil_target,1/))
2920 call netcdf_err(error,
'WRITING TOTAL SOIL MOISTURE RECORD' )
2925 print*,
"- CALL FieldGather FOR TARGET GRID LIQUID SOIL MOISTURE FOR TILE: ", tile
2927 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2928 call error_handler(
"IN FieldGather", error)
2930 if (localpet == 0)
then 2931 dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:)
2932 error = nf90_put_var( ncid, id_slc, dum3d, start=(/1,1,1,1/), count=(/i_target_out,j_target_out,
lsoil_target,1/))
2933 call netcdf_err(error,
'WRITING LIQUID SOIL MOISTURE RECORD' )
2938 print*,
"- CALL FieldGather FOR TARGET C_D FOR TILE: ", tile
2939 call esmf_fieldgather(
c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2940 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2941 call error_handler(
"IN FieldGather", error)
2943 if (localpet == 0)
then 2944 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2945 error = nf90_put_var( ncid, id_c_d, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2946 call netcdf_err(error,
'WRITING C_D RECORD' )
2949 print*,
"- CALL FieldGather FOR TARGET C_0 FOR TILE: ", tile
2950 call esmf_fieldgather(
c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2951 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2952 call error_handler(
"IN FieldGather", error)
2954 if (localpet == 0)
then 2955 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2956 error = nf90_put_var( ncid, id_c_0, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2957 call netcdf_err(error,
'WRITING C_0 RECORD' )
2960 print*,
"- CALL FieldGather FOR TARGET D_CONV FOR TILE: ", tile
2961 call esmf_fieldgather(
d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2962 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2963 call error_handler(
"IN FieldGather", error)
2965 if (localpet == 0)
then 2966 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2967 error = nf90_put_var( ncid, id_d_conv, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2968 call netcdf_err(error,
'WRITING D_CONV RECORD' )
2971 print*,
"- CALL FieldGather FOR TARGET DT_COOL FOR TILE: ", tile
2973 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2974 call error_handler(
"IN FieldGather", error)
2976 if (localpet == 0)
then 2977 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2978 error = nf90_put_var( ncid, id_dt_cool, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2979 call netcdf_err(error,
'WRITING DT_COOL RECORD' )
2982 print*,
"- CALL FieldGather FOR TARGET IFD FOR TILE: ", tile
2983 call esmf_fieldgather(
ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2984 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2985 call error_handler(
"IN FieldGather", error)
2987 if (localpet == 0)
then 2988 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
2989 error = nf90_put_var( ncid, id_ifd, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
2990 call netcdf_err(error,
'WRITING IFD RECORD' )
2993 print*,
"- CALL FieldGather FOR TARGET QRAIN FOR TILE: ", tile
2994 call esmf_fieldgather(
qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
2995 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2996 call error_handler(
"IN FieldGather", error)
2998 if (localpet == 0)
then 2999 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3000 error = nf90_put_var( ncid, id_qrain, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3001 call netcdf_err(error,
'WRITING QRAIN RECORD' )
3004 print*,
"- CALL FieldGather FOR TARGET TREF FOR TILE: ", tile
3005 call esmf_fieldgather(
tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3006 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3007 call error_handler(
"IN FieldGather", error)
3009 if (localpet == 0)
then 3010 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3011 error = nf90_put_var( ncid, id_tref, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3012 call netcdf_err(error,
'WRITING TREF RECORD' )
3015 print*,
"- CALL FieldGather FOR TARGET W_D FOR TILE: ", tile
3016 call esmf_fieldgather(
w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3017 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3018 call error_handler(
"IN FieldGather", error)
3020 if (localpet == 0)
then 3021 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3022 error = nf90_put_var( ncid, id_w_d, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3023 call netcdf_err(error,
'WRITING W_D RECORD' )
3026 print*,
"- CALL FieldGather FOR TARGET W_0 FOR TILE: ", tile
3027 call esmf_fieldgather(
w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3028 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3029 call error_handler(
"IN FieldGather", error)
3031 if (localpet == 0)
then 3032 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3033 error = nf90_put_var( ncid, id_w_0, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3034 call netcdf_err(error,
'WRITING W_0 RECORD' )
3037 print*,
"- CALL FieldGather FOR TARGET XS FOR TILE: ", tile
3038 call esmf_fieldgather(
xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3039 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3040 call error_handler(
"IN FieldGather", error)
3042 if (localpet == 0)
then 3043 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3044 error = nf90_put_var( ncid, id_xs, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3045 call netcdf_err(error,
'WRITING XS RECORD' )
3048 print*,
"- CALL FieldGather FOR TARGET XT FOR TILE: ", tile
3049 call esmf_fieldgather(
xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3050 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3051 call error_handler(
"IN FieldGather", error)
3053 if (localpet == 0)
then 3054 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3055 error = nf90_put_var( ncid, id_xt, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3056 call netcdf_err(error,
'WRITING XT RECORD' )
3059 print*,
"- CALL FieldGather FOR TARGET XU FOR TILE: ", tile
3060 call esmf_fieldgather(
xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3061 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3062 call error_handler(
"IN FieldGather", error)
3064 if (localpet == 0)
then 3065 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3066 error = nf90_put_var( ncid, id_xu, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3067 call netcdf_err(error,
'WRITING XU RECORD' )
3070 print*,
"- CALL FieldGather FOR TARGET XV FOR TILE: ", tile
3071 call esmf_fieldgather(
xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3072 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3073 call error_handler(
"IN FieldGather", error)
3075 if (localpet == 0)
then 3076 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3077 error = nf90_put_var( ncid, id_xv, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3078 call netcdf_err(error,
'WRITING XV RECORD' )
3081 print*,
"- CALL FieldGather FOR TARGET XZ FOR TILE: ", tile
3082 call esmf_fieldgather(
xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3083 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3084 call error_handler(
"IN FieldGather", error)
3086 if (localpet == 0)
then 3087 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3088 error = nf90_put_var( ncid, id_xz, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3089 call netcdf_err(error,
'WRITING XZ RECORD' )
3092 print*,
"- CALL FieldGather FOR TARGET XTTS FOR TILE: ", tile
3093 call esmf_fieldgather(
xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3094 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3095 call error_handler(
"IN FieldGather", error)
3097 if (localpet == 0)
then 3098 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3099 error = nf90_put_var( ncid, id_xtts, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3100 call netcdf_err(error,
'WRITING XTTS RECORD' )
3103 print*,
"- CALL FieldGather FOR TARGET XZTS FOR TILE: ", tile
3104 call esmf_fieldgather(
xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3105 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3106 call error_handler(
"IN FieldGather", error)
3108 if (localpet == 0)
then 3109 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3110 error = nf90_put_var( ncid, id_xzts, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3111 call netcdf_err(error,
'WRITING XZTS RECORD' )
3114 print*,
"- CALL FieldGather FOR TARGET Z_C FOR TILE: ", tile
3115 call esmf_fieldgather(
z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3116 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3117 call error_handler(
"IN FieldGather", error)
3119 if (localpet == 0)
then 3120 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3121 error = nf90_put_var( ncid, id_z_c, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3122 call netcdf_err(error,
'WRITING Z_C RECORD' )
3125 print*,
"- CALL FieldGather FOR TARGET ZM FOR TILE: ", tile
3126 call esmf_fieldgather(
zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error)
3127 if(esmf_logfounderror(rctocheck=error,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3128 call error_handler(
"IN FieldGather", error)
3130 if (localpet == 0)
then 3131 dum2d(:,:) = data_one_tile(istart:iend, jstart:jend)
3132 error = nf90_put_var( ncid, id_zm, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/))
3133 call netcdf_err(error,
'WRITING ZM RECORD' )
3142 error = nf90_close(ncid)
3146 deallocate(lsoil_data, x_data, y_data)
3147 deallocate(data_one_tile, data_one_tile_3d, idata_one_tile, dum2d, dum3d)
3151 end subroutine write_fv3_sfc_data_netcdf
3153 end module write_data
type(esmf_field), public d_conv_target_grid
Thickness of free convection layer.
integer, public j_target
j dimension of each global tile, or of a nest, target grid.
type(esmf_field), public zm_target_grid
Oceanic mixed layer depth.
This module contains code to read the setup namelist file, handle the varmap file for GRIB2 data...
integer, public num_tiles_target_grid
Number of tiles, target grid.
integer, public lsoil_target
Number of soil layers, target grid.
type(esmf_field), public canopy_mc_target_grid
Canopy moisture content.
type(esmf_field), public v_w_target_grid
V-wind, 'west' edge of grid cell.
type(esmf_field), public longitude_w_target_grid
longitude of 'west' edge of grid box, target grid
type(esmf_field), public f10m_target_grid
log((z0+10)*1/z0) See sfc_diff.f for details.
type(esmf_field), public c_d_target_grid
Coefficient 2 to calculate d(tz)/d(ts).
type(esmf_field), public ifd_target_grid
Model mode index.
type(esmf_field), public w_d_target_grid
Coefficient 4 to calculate d(tz)/d(ts).
type(esmf_field), public xtts_target_grid
d(xt)/d(ts).
logical, public lai_from_climo
If false, interpolate leaf area index from the input data to the target grid instead of using data fr...
integer, public regional
For regional target grids.
type(esmf_field), public srflag_target_grid
Snow/rain flag.
type(esmf_field), public xu_target_grid
u-current content in diurnal thermocline layer.
character(len=20), dimension(max_tracers), public tracers
Name of each atmos tracer to be processed.
real(esmf_kind_r8), dimension(:,:), allocatable, public vcoord_target
Vertical coordinate.
Module to hold ESMF fields associated with the target grid surface data.
type(esmf_field), public min_veg_greenness_target_grid
minimum annual greenness fraction
type(esmf_field), public tprcp_target_grid
Precipitation.
type(esmf_field), public max_veg_greenness_target_grid
maximum annual greenness fraction
type(esmf_field), public mxsno_albedo_target_grid
maximum snow albedo
type(esmf_field), public longitude_s_target_grid
longitude of 'south' edge of grid box, target grid
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
type(esmf_field), public alvwf_target_grid
visible white sky albedo
type(esmf_field), public qnifa_climo_target_grid
Number concentration of ice friendly aerosols.
type(esmf_field), public latitude_target_grid
latitude of grid center, target grid
integer, public i_target
i dimension of each global tile, or of a nest, target grid.
integer, public halo_bndy
Number of row/cols of lateral halo, where pure lateral bndy conditions are applied (regional target g...
type(esmf_field), public xzts_target_grid
d(xz)/d(ts).
type(esmf_field), public latitude_s_target_grid
latitude of 'south' edge of grid box, target grid
type(esmf_field), public c_0_target_grid
Coefficient 1 to calculate d(tz)/d(ts).
type(esmf_field), public soilm_liq_target_grid
3-d liquid soil moisture.
type(esmf_field), public zh_target_grid
3-d height.
type(esmf_field), public alnsf_target_grid
near ir black sky albedo
type(esmf_field), public xz_target_grid
Diurnal thermocline layer thickness.
type(esmf_field), public latitude_w_target_grid
latitude of 'west' edge of grid box, target grid
type(esmf_field), public delp_target_grid
Pressure thickness.
type(esmf_field), public z_c_target_grid
Sub-layer cooling thickness.
integer, public lev_target
Number of vertical levels.
type(esmf_field), public lai_target_grid
Leaf area index.
type(esmf_field), public landmask_target_grid
land mask target grid - '1' land; '0' non-land
type(esmf_field), public seaice_fract_target_grid
Sea ice fraction.
logical, public convert_nst
Convert nst data when true.
type(esmf_field), public snow_liq_equiv_target_grid
Liquid equivalent snow depth.
type(esmf_field), public qrain_target_grid
Sensible heat flux due to rainfall.
type(esmf_field), public soilm_tot_target_grid
3-d total soil moisture.
Module to hold variables and ESMF fields associated with the target grid atmospheric data...
type(esmf_field), public seaice_depth_target_grid
Sea ice depth.
type(esmf_field), public ffmm_target_grid
log((z0+z1)*1/z0) See sfc_diff.f for details.
type(esmf_field), public seaice_skin_temp_target_grid
Sea ice skin temperature.
type(esmf_field), public longitude_target_grid
longitude of grid center, target grid
type(esmf_field), public alvsf_target_grid
visible black sky albedo
type(esmf_field), public slope_type_target_grid
slope type
Reads static surface climatological data for the target FV3 grid (such as soil type and vegetation ty...
type(esmf_field), public qnwfa_climo_target_grid
Number concentration of water friendly aerosols.
type(esmf_field), public v_s_target_grid
V-wind, 'south' edge of grid cell.
type(esmf_field), public xs_target_grid
Salinity content in diurnal thermocline layer.
integer, public nvcoord_target
Number of vertical coordinate variables.
type(esmf_field), public ustar_target_grid
Friction velocity.
type(esmf_field), public u_s_target_grid
U-wind, 'south' edge of grid cell.
type(esmf_field), public tref_target_grid
Reference temperature.
type(esmf_field), public q2m_target_grid
2-m specific humidity.
type(esmf_field), public ps_target_grid
Surface pressure.
type(esmf_field), public u_w_target_grid
U-wind, 'west' edge of grid cell.
integer, public ip1_target
ip1_target plus 1
character(len=25), public input_type
Input data type:
integer, public num_tracers
Number of atmospheric tracers to be processed.
type(esmf_field), public substrate_temp_target_grid
soil subtrate temperature
type(esmf_field), public veg_greenness_target_grid
vegetation greenness fraction
type(esmf_field), public skin_temp_target_grid
Skin temperature/sst.
type(esmf_field), public temp_target_grid
Temperautre.
integer, public levp1_target
Number of vertical levels plus 1.
type(esmf_field), public xv_target_grid
v-current content in diurnal thermocline layer.
type(esmf_field), public xt_target_grid
Heat content in diurnal thermocline layer.
logical, public use_thomp_mp_climo
When true, read and process Thompson MP climatological tracers.
type(esmf_field), public veg_type_target_grid
vegetation type
type(esmf_field), dimension(:), allocatable, public tracers_target_grid
Tracers.
type(esmf_field), public z0_target_grid
Roughness length.
type(esmf_field), public facwf_target_grid
fractional coverage for weak zenith angle dependent albedo
integer, public halo_blend
Number of row/cols of blending halo, where model tendencies and lateral boundary tendencies are appli...
type(esmf_field), public dzdt_target_grid
Vertical velocity.
type(esmf_field), public t2m_target_grid
2-m temperatrure.
type(esmf_field), public soil_temp_target_grid
3-d soil temperature.
type(esmf_field), public alnwf_target_grid
near ir white sky albedo
type(esmf_field), public dt_cool_target_grid
Sub-layer cooling amount.
type(esmf_field), public w_0_target_grid
Coefficient 3 to calculate d(tz)/d(ts).
type(esmf_field), public facsf_target_grid
fractional coverage for strong zenith angle dependent albedo
integer, public jp1_target
jp1_target plus 1
type(esmf_field), public snow_depth_target_grid
Physical snow depth.
type(esmf_field), public soil_type_target_grid
soil type