17 REAL,
ALLOCATABLE :: c_0(:)
18 REAL,
ALLOCATABLE :: c_d(:)
19 REAL,
ALLOCATABLE :: d_conv(:)
20 REAL,
ALLOCATABLE :: dt_cool(:)
21 REAL,
ALLOCATABLE :: ifd(:)
22 REAL,
ALLOCATABLE :: qrain(:)
23 REAL,
ALLOCATABLE :: tref(:)
24 REAL,
ALLOCATABLE :: tfinc(:)
25 REAL,
ALLOCATABLE :: w_0(:)
26 REAL,
ALLOCATABLE :: w_d(:)
27 REAL,
ALLOCATABLE :: xs(:)
28 REAL,
ALLOCATABLE :: xt(:)
29 REAL,
ALLOCATABLE :: xtts(:)
30 REAL,
ALLOCATABLE :: xu(:)
31 REAL,
ALLOCATABLE :: xv(:)
32 REAL,
ALLOCATABLE :: xz(:)
33 REAL,
ALLOCATABLE :: xzts(:)
34 REAL,
ALLOCATABLE :: z_c(:)
35 REAL,
ALLOCATABLE :: zm(:)
38 INTEGER,
PUBLIC :: IDIM_GAUS
40 INTEGER,
PUBLIC :: JDIM_GAUS
42 INTEGER,
ALLOCATABLE,
PUBLIC :: SLMSK_GAUS(:,:)
45 INTEGER,
ALLOCATABLE,
PUBLIC :: SOILSNOW_GAUS(:,:)
49 REAL,
ALLOCATABLE,
PUBLIC :: DTREF_GAUS(:,:)
52 REAL,
ALLOCATABLE,
PUBLIC :: STC_INC_GAUS(:,:,:)
55 REAL,
ALLOCATABLE,
PUBLIC :: SLC_INC_GAUS(:,:,:)
121 do_nsst,nsst,slifcs,tsffcs,vegfcs,swefcs, &
122 tg3fcs,zorfcs,albfcs,alffcs, &
123 cnpfcs,f10m,t2m,q2m,vetfcs, &
124 sotfcs,ustar,fmm,fhh,sicfcs, &
125 sihfcs,sitfcs,tprcp,srflag, &
126 swdfcs,vmnfcs,vmxfcs,slpfcs, &
127 absfcs,slcfcs,smcfcs,stcfcs)
133 integer,
intent(in) :: lensfc, lsoil
134 integer,
intent(in) :: idim, jdim
136 logical,
intent(in) :: do_nsst
138 real,
intent(in),
optional :: slifcs(lensfc),tsffcs(lensfc)
139 real,
intent(in),
optional :: swefcs(lensfc),tg3fcs(lensfc)
140 real,
intent(in),
optional :: zorfcs(lensfc),albfcs(lensfc,4)
141 real,
intent(in),
optional :: alffcs(lensfc,2),cnpfcs(lensfc)
142 real,
intent(in),
optional :: f10m(lensfc),t2m(lensfc)
143 real,
intent(in),
optional :: q2m(lensfc),vegfcs(lensfc)
144 real,
intent(in),
optional :: vetfcs(lensfc),sotfcs(lensfc)
145 real,
intent(in),
optional :: ustar(lensfc),fmm(lensfc)
146 real,
intent(in),
optional :: fhh(lensfc), sicfcs(lensfc)
147 real,
intent(in),
optional :: sihfcs(lensfc), sitfcs(lensfc)
148 real,
intent(in),
optional :: tprcp(lensfc), srflag(lensfc)
149 real,
intent(in),
optional :: swdfcs(lensfc), vmnfcs(lensfc)
150 real,
intent(in),
optional :: vmxfcs(lensfc), slpfcs(lensfc)
151 real,
intent(in),
optional :: absfcs(lensfc), slcfcs(lensfc,lsoil)
152 real,
intent(in),
optional :: smcfcs(lensfc,lsoil), stcfcs(lensfc,lsoil)
156 integer :: dim_x, dim_y, dim_time, dims_3d(3)
158 real :: dum2d(idim,jdim), dum3d(idim,jdim,lsoil)
160 character(len=50) :: fnbgso
161 character(len=3) :: rankch
163 integer :: myrank, error, ncid, id_var
165 call mpi_comm_rank(mpi_comm_world, myrank, error)
167 write(rankch,
'(i3.3)') (myrank+1)
169 fnbgso =
"./fnbgso." // rankch
172 print*,
"update OUTPUT SFC DATA TO: ",trim(fnbgso)
174 error=nf90_open(trim(fnbgso),nf90_write,ncid)
175 CALL
netcdf_err(error,
'OPENING FILE: '//trim(fnbgso) )
177 if(present(slifcs))
then
178 error=nf90_inq_varid(ncid,
"slmsk", id_var)
180 dum2d = reshape(slifcs, (/idim,jdim/))
181 error = nf90_put_var( ncid, id_var, dum2d)
182 call
netcdf_err(error,
'writing slmsk record' )
186 if(present(tsffcs))
then
187 error=nf90_inq_varid(ncid,
"tsea", id_var)
189 dum2d = reshape(tsffcs, (/idim,jdim/))
190 error = nf90_put_var( ncid, id_var, dum2d)
191 call
netcdf_err(error,
'writing tsea record' )
195 if(present(swefcs))
then
196 error=nf90_inq_varid(ncid,
"sheleg", id_var)
198 dum2d = reshape(swefcs, (/idim,jdim/))
199 error = nf90_put_var( ncid, id_var, dum2d)
200 call
netcdf_err(error,
'writing sheleg record' )
204 if(present(tg3fcs))
then
205 error=nf90_inq_varid(ncid,
"tg3", id_var)
207 dum2d = reshape(tg3fcs, (/idim,jdim/))
208 error = nf90_put_var( ncid, id_var, dum2d)
213 if(present(zorfcs))
then
214 error=nf90_inq_varid(ncid,
"zorl", id_var)
216 dum2d = reshape(zorfcs, (/idim,jdim/))
217 error = nf90_put_var( ncid, id_var, dum2d)
218 call
netcdf_err(error,
'writing zorl record' )
222 if(present(albfcs))
then
223 error=nf90_inq_varid(ncid,
"alvsf", id_var)
225 dum2d = reshape(albfcs(:,1), (/idim,jdim/))
226 error = nf90_put_var( ncid, id_var, dum2d)
227 call
netcdf_err(error,
'writing alvsf record' )
230 error=nf90_inq_varid(ncid,
"alvwf", id_var)
232 dum2d = reshape(albfcs(:,2), (/idim,jdim/))
233 error = nf90_put_var( ncid, id_var, dum2d)
234 call
netcdf_err(error,
'writing alvwf record' )
237 error=nf90_inq_varid(ncid,
"alnsf", id_var)
239 dum2d = reshape(albfcs(:,3), (/idim,jdim/))
240 error = nf90_put_var( ncid, id_var, dum2d)
241 call
netcdf_err(error,
'writing alnsf record' )
244 error=nf90_inq_varid(ncid,
"alnwf", id_var)
246 dum2d = reshape(albfcs(:,4), (/idim,jdim/))
247 error = nf90_put_var( ncid, id_var, dum2d)
248 call
netcdf_err(error,
'writing alnwf record' )
252 if(present(alffcs))
then
253 error=nf90_inq_varid(ncid,
"facsf", id_var)
255 dum2d = reshape(alffcs(:,1), (/idim,jdim/))
256 error = nf90_put_var( ncid, id_var, dum2d)
257 call
netcdf_err(error,
'writing facsf record' )
260 error=nf90_inq_varid(ncid,
"facwf", id_var)
262 dum2d = reshape(alffcs(:,2), (/idim,jdim/))
263 error = nf90_put_var( ncid, id_var, dum2d)
264 call
netcdf_err(error,
'writing facwf record' )
268 if(present(vegfcs))
then
269 error=nf90_inq_varid(ncid,
"vfrac", id_var)
271 dum2d = reshape(vegfcs, (/idim,jdim/))
272 error = nf90_put_var( ncid, id_var, dum2d)
273 call
netcdf_err(error,
'writing vegfcs record' )
277 if(present(cnpfcs))
then
278 error=nf90_inq_varid(ncid,
"canopy", id_var)
280 dum2d = reshape(cnpfcs, (/idim,jdim/))
281 error = nf90_put_var( ncid, id_var, dum2d)
282 call
netcdf_err(error,
'writing canopy record' )
286 if(present(f10m))
then
287 error=nf90_inq_varid(ncid,
"f10m", id_var)
289 dum2d = reshape(f10m, (/idim,jdim/))
290 error = nf90_put_var( ncid, id_var, dum2d)
291 call
netcdf_err(error,
'writing f10m record' )
295 if(present(t2m))
then
296 error=nf90_inq_varid(ncid,
"t2m", id_var)
298 dum2d = reshape(t2m, (/idim,jdim/))
299 error = nf90_put_var( ncid, id_var, dum2d)
304 if(present(q2m))
then
305 error=nf90_inq_varid(ncid,
"q2m", id_var)
307 dum2d = reshape(q2m, (/idim,jdim/))
308 error = nf90_put_var( ncid, id_var, dum2d)
313 if(present(vetfcs))
then
314 error=nf90_inq_varid(ncid,
"vtype", id_var)
316 dum2d = reshape(vetfcs, (/idim,jdim/))
317 error = nf90_put_var( ncid, id_var, dum2d)
318 call
netcdf_err(error,
'writing vtype record' )
322 if(present(sotfcs))
then
323 error=nf90_inq_varid(ncid,
"stype", id_var)
325 dum2d = reshape(sotfcs, (/idim,jdim/))
326 error = nf90_put_var( ncid, id_var, dum2d)
327 call
netcdf_err(error,
'writing stype record' )
331 if(present(ustar))
then
332 error=nf90_inq_varid(ncid,
"uustar", id_var)
334 dum2d = reshape(ustar, (/idim,jdim/))
335 error = nf90_put_var( ncid, id_var, dum2d)
336 call
netcdf_err(error,
'writing uustar record' )
340 if(present(fmm))
then
341 error=nf90_inq_varid(ncid,
"ffmm", id_var)
343 dum2d = reshape(fmm, (/idim,jdim/))
344 error = nf90_put_var( ncid, id_var, dum2d)
345 call
netcdf_err(error,
'writing ffmm record' )
349 if(present(fhh))
then
350 error=nf90_inq_varid(ncid,
"ffhh", id_var)
352 dum2d = reshape(fhh, (/idim,jdim/))
353 error = nf90_put_var( ncid, id_var, dum2d)
354 call
netcdf_err(error,
'writing ffhh record' )
358 if(present(sicfcs))
then
359 error=nf90_inq_varid(ncid,
"fice", id_var)
361 dum2d = reshape(sicfcs, (/idim,jdim/))
362 error = nf90_put_var( ncid, id_var, dum2d)
363 call
netcdf_err(error,
'writing fice record' )
367 if(present(sihfcs))
then
368 error=nf90_inq_varid(ncid,
"hice", id_var)
370 dum2d = reshape(sihfcs, (/idim,jdim/))
371 error = nf90_put_var( ncid, id_var, dum2d)
372 call
netcdf_err(error,
'writing hice record' )
376 if(present(sitfcs))
then
377 error=nf90_inq_varid(ncid,
"tisfc", id_var)
379 dum2d = reshape(sitfcs, (/idim,jdim/))
380 error = nf90_put_var( ncid, id_var, dum2d)
381 call
netcdf_err(error,
'writing tisfc record' )
385 if(present(tprcp))
then
386 error=nf90_inq_varid(ncid,
"tprcp", id_var)
388 dum2d = reshape(tprcp, (/idim,jdim/))
389 error = nf90_put_var( ncid, id_var, dum2d)
390 call
netcdf_err(error,
'writing tprcp record' )
394 if(present(srflag))
then
395 error=nf90_inq_varid(ncid,
"srflag", id_var)
397 dum2d = reshape(srflag, (/idim,jdim/))
398 error = nf90_put_var( ncid, id_var, dum2d)
399 call
netcdf_err(error,
'writing srflag record' )
403 if(present(swdfcs))
then
404 error=nf90_inq_varid(ncid,
"snwdph", id_var)
406 dum2d = reshape(swdfcs, (/idim,jdim/))
407 error = nf90_put_var( ncid, id_var, dum2d)
408 call
netcdf_err(error,
'writing snwdph record' )
412 if(present(vmnfcs))
then
413 error=nf90_inq_varid(ncid,
"shdmin", id_var)
415 dum2d = reshape(vmnfcs, (/idim,jdim/))
416 error = nf90_put_var( ncid, id_var, dum2d)
417 call
netcdf_err(error,
'writing shdmin record' )
421 if(present(vmxfcs))
then
422 error=nf90_inq_varid(ncid,
"shdmax", id_var)
424 dum2d = reshape(vmxfcs, (/idim,jdim/))
425 error = nf90_put_var( ncid, id_var, dum2d)
426 call
netcdf_err(error,
'writing shdmax record' )
430 if(present(slpfcs))
then
431 error=nf90_inq_varid(ncid,
"slope", id_var)
433 dum2d = reshape(slpfcs, (/idim,jdim/))
434 error = nf90_put_var( ncid, id_var, dum2d)
435 call
netcdf_err(error,
'writing slope record' )
439 if(present(absfcs))
then
440 error=nf90_inq_varid(ncid,
"snoalb", id_var)
442 dum2d = reshape(absfcs, (/idim,jdim/))
443 error = nf90_put_var( ncid, id_var, dum2d)
444 call
netcdf_err(error,
'writing snoalb record' )
448 if(present(slcfcs))
then
449 error=nf90_inq_varid(ncid,
"slc", id_var)
451 dum3d = reshape(slcfcs, (/idim,jdim,lsoil/))
452 error = nf90_put_var( ncid, id_var, dum3d)
457 if(present(smcfcs))
then
458 error=nf90_inq_varid(ncid,
"smc", id_var)
460 dum3d = reshape(smcfcs, (/idim,jdim,lsoil/))
461 error = nf90_put_var( ncid, id_var, dum3d)
466 if(present(stcfcs))
then
467 error=nf90_inq_varid(ncid,
"stc", id_var)
469 dum3d = reshape(stcfcs, (/idim,jdim,lsoil/))
470 error = nf90_put_var( ncid, id_var, dum3d)
477 error=nf90_inq_varid(ncid,
"tref", id_var)
479 dum2d = reshape(nsst%tref, (/idim,jdim/))
480 error = nf90_put_var( ncid, id_var, dum2d)
481 call
netcdf_err(error,
'WRITING TREF RECORD' )
484 error=nf90_inq_varid(ncid,
"z_c", id_var)
486 dum2d = reshape(nsst%z_c, (/idim,jdim/))
487 error = nf90_put_var( ncid, id_var, dum2d)
491 error=nf90_inq_varid(ncid,
"c_0", id_var)
493 dum2d = reshape(nsst%c_0, (/idim,jdim/))
494 error = nf90_put_var( ncid, id_var, dum2d)
498 error=nf90_inq_varid(ncid,
"c_d", id_var)
500 dum2d = reshape(nsst%c_d, (/idim,jdim/))
501 error = nf90_put_var( ncid, id_var, dum2d)
505 error=nf90_inq_varid(ncid,
"w_0", id_var)
507 dum2d = reshape(nsst%w_0, (/idim,jdim/))
508 error = nf90_put_var( ncid, id_var, dum2d)
512 error=nf90_inq_varid(ncid,
"w_d", id_var)
514 dum2d = reshape(nsst%w_d, (/idim,jdim/))
515 error = nf90_put_var( ncid, id_var, dum2d)
519 error=nf90_inq_varid(ncid,
"xt", id_var)
521 dum2d = reshape(nsst%xt, (/idim,jdim/))
522 error = nf90_put_var( ncid, id_var, dum2d)
526 error=nf90_inq_varid(ncid,
"xs", id_var)
528 dum2d = reshape(nsst%xs, (/idim,jdim/))
529 error = nf90_put_var( ncid, id_var, dum2d)
533 error=nf90_inq_varid(ncid,
"xu", id_var)
535 dum2d = reshape(nsst%xu, (/idim,jdim/))
536 error = nf90_put_var( ncid, id_var, dum2d)
540 error=nf90_inq_varid(ncid,
"xv", id_var)
542 dum2d = reshape(nsst%xv, (/idim,jdim/))
543 error = nf90_put_var( ncid, id_var, dum2d)
547 error=nf90_inq_varid(ncid,
"xz", id_var)
549 dum2d = reshape(nsst%xz, (/idim,jdim/))
550 error = nf90_put_var( ncid, id_var, dum2d)
554 error=nf90_inq_varid(ncid,
"zm", id_var)
556 dum2d = reshape(nsst%zm, (/idim,jdim/))
557 error = nf90_put_var( ncid, id_var, dum2d)
561 error=nf90_inq_varid(ncid,
"xtts", id_var)
563 dum2d = reshape(nsst%xtts, (/idim,jdim/))
564 error = nf90_put_var( ncid, id_var, dum2d)
565 call
netcdf_err(error,
'WRITING XTTS RECORD' )
568 error=nf90_inq_varid(ncid,
"xzts", id_var)
570 dum2d = reshape(nsst%xzts, (/idim,jdim/))
571 error = nf90_put_var( ncid, id_var, dum2d)
572 call
netcdf_err(error,
'WRITING XZTS RECORD' )
575 error=nf90_inq_varid(ncid,
"d_conv", id_var)
577 dum2d = reshape(nsst%d_conv, (/idim,jdim/))
578 error = nf90_put_var( ncid, id_var, dum2d)
579 call
netcdf_err(error,
'WRITING D_CONV RECORD' )
582 error=nf90_inq_varid(ncid,
"ifd", id_var)
584 dum2d = reshape(nsst%ifd, (/idim,jdim/))
585 error = nf90_put_var( ncid, id_var, dum2d)
589 error=nf90_inq_varid(ncid,
"dt_cool", id_var)
591 dum2d = reshape(nsst%dt_cool, (/idim,jdim/))
592 error = nf90_put_var( ncid, id_var, dum2d)
593 call
netcdf_err(error,
'WRITING DT_COOL RECORD' )
596 error=nf90_inq_varid(ncid,
"qrain", id_var)
598 dum2d = reshape(nsst%qrain, (/idim,jdim/))
599 error = nf90_put_var( ncid, id_var, dum2d)
600 call
netcdf_err(error,
'WRITING QRAIN RECORD' )
605 error=nf90_inq_varid(ncid,
"tfinc", id_var)
607 error=nf90_inq_dimid(ncid,
"xaxis_1", dim_x)
609 error=nf90_inq_dimid(ncid,
"yaxis_1", dim_y)
611 error=nf90_inq_dimid(ncid,
"Time", dim_time)
615 dims_3d(3) = dim_time
616 error=nf90_redef(ncid)
617 error = nf90_def_var(ncid,
'tfinc', nf90_double, dims_3d, id_var)
619 error = nf90_put_att(ncid, id_var,
"long_name",
"tfinc")
620 call
netcdf_err(error,
'DEFINING tfinc LONG NAME' )
621 error = nf90_put_att(ncid, id_var,
"units",
"none")
622 call
netcdf_err(error,
'DEFINING tfinc UNITS' )
623 error=nf90_enddef(ncid)
625 dum2d = reshape(nsst%tfinc, (/idim,jdim/))
626 error = nf90_put_var( ncid, id_var, dum2d)
627 call
netcdf_err(error,
'WRITING TFINC RECORD' )
631 error = nf90_close(ncid)
645 integer,
intent(in) :: ncid, id_var
649 error=nf90_inquire_attribute(ncid, id_var,
'checksum')
653 error = nf90_redef(ncid)
654 call
netcdf_err(error,
'entering define mode' )
656 error=nf90_del_att(ncid, id_var,
'checksum')
659 error= nf90_enddef(ncid)
681 tile_num,idim,jdim,ijdim,landfrac)
688 INTEGER,
INTENT(IN) :: idim, jdim, ijdim
690 CHARACTER(LEN=5),
INTENT(OUT) :: tile_num
692 REAL,
INTENT(OUT) :: rla(ijdim),rlo(ijdim)
693 REAL,
INTENT(OUT) :: orog(ijdim),orog_uf(ijdim)
694 REAL(KIND=KIND_IO8),
INTENT(OUT),
OPTIONAL :: landfrac(ijdim)
696 CHARACTER(LEN=50) :: fnorog, fngrid
697 CHARACTER(LEN=3) :: rankch
699 INTEGER :: error, ncid, ncid_orog
700 INTEGER :: i, ii, j, jj, myrank
701 INTEGER :: id_dim, id_var, nx, ny
703 REAL,
ALLOCATABLE :: dummy(:,:), geolat(:,:), geolon(:,:)
704 REAL(KIND=4),
ALLOCATABLE :: dummy4(:,:)
706 CALL mpi_comm_rank(mpi_comm_world, myrank, error)
708 WRITE(rankch,
'(I3.3)') (myrank+1)
710 fngrid =
"./fngrid." // rankch
713 print*,
"READ FV3 GRID INFO FROM: "//trim(fngrid)
715 error=nf90_open(trim(fngrid),nf90_nowrite,ncid)
716 CALL
netcdf_err(error,
'OPENING FILE: '//trim(fngrid) )
718 error=nf90_inq_dimid(ncid,
'nx', id_dim)
719 CALL
netcdf_err(error,
'ERROR READING NX ID' )
721 error=nf90_inquire_dimension(ncid,id_dim,len=nx)
724 error=nf90_inq_dimid(ncid,
'ny', id_dim)
725 CALL
netcdf_err(error,
'ERROR READING NY ID' )
727 error=nf90_inquire_dimension(ncid,id_dim,len=ny)
730 IF ((nx/2) /= idim .OR. (ny/2) /= jdim)
THEN
731 print*,
'FATAL ERROR: DIMENSIONS IN FILE: ',(nx/2),(ny/2)
732 print*,
'DO NOT MATCH GRID DIMENSIONS: ',idim,jdim
733 CALL mpi_abort(mpi_comm_world, 130, error)
736 ALLOCATE(geolon(nx+1,ny+1))
737 ALLOCATE(geolat(nx+1,ny+1))
739 error=nf90_inq_varid(ncid,
'x', id_var)
741 error=nf90_get_var(ncid, id_var, geolon)
742 CALL
netcdf_err(error,
'ERROR READING X RECORD' )
744 error=nf90_inq_varid(ncid,
'y', id_var)
746 error=nf90_get_var(ncid, id_var, geolat)
747 CALL
netcdf_err(error,
'ERROR READING Y RECORD' )
749 ALLOCATE(dummy(idim,jdim))
755 dummy(i,j) = geolon(ii,jj)
759 rlo = reshape(dummy, (/ijdim/))
767 dummy(i,j) = geolat(ii,jj)
771 rla = reshape(dummy, (/ijdim/))
773 DEALLOCATE(geolat, dummy)
775 error=nf90_inq_varid(ncid,
'tile', id_var)
776 CALL
netcdf_err(error,
'ERROR READING TILE ID' )
777 error=nf90_get_var(ncid, id_var, tile_num)
778 CALL
netcdf_err(error,
'ERROR READING TILE RECORD' )
780 error = nf90_close(ncid)
782 fnorog =
"./fnorog." // rankch
785 print*,
"READ FV3 OROG INFO FROM: "//trim(fnorog)
787 error=nf90_open(trim(fnorog),nf90_nowrite,ncid_orog)
788 CALL
netcdf_err(error,
'OPENING FILE: '//trim(fnorog) )
790 ALLOCATE(dummy4(idim,jdim))
792 error=nf90_inq_varid(ncid_orog,
'orog_raw', id_var)
793 CALL
netcdf_err(error,
'ERROR READING orog_raw ID' )
794 error=nf90_get_var(ncid_orog, id_var, dummy4)
795 CALL
netcdf_err(error,
'ERROR READING orog_raw RECORD' )
796 orog_uf = reshape(dummy4, (/ijdim/))
798 error=nf90_inq_varid(ncid_orog,
'orog_filt', id_var)
799 CALL
netcdf_err(error,
'ERROR READING orog_filt ID' )
800 error=nf90_get_var(ncid_orog, id_var, dummy4)
801 CALL
netcdf_err(error,
'ERROR READING orog_filt RECORD' )
802 orog = reshape(dummy4, (/ijdim/))
804 IF(present(landfrac))
THEN
805 error=nf90_inq_varid(ncid_orog,
'land_frac', id_var)
806 CALL
netcdf_err(error,
'ERROR READING land_frac ID' )
807 error=nf90_get_var(ncid_orog, id_var, dummy4)
808 CALL
netcdf_err(error,
'ERROR READING land_frac RECORD' )
809 landfrac = reshape(dummy4, (/ijdim/))
814 error = nf90_close(ncid_orog)
830 INTEGER,
INTENT(IN) :: err
831 CHARACTER(LEN=*),
INTENT(IN) :: string
832 CHARACTER(LEN=80) :: errmsg
835 IF( err == nf90_noerr )
RETURN
836 errmsg = nf90_strerror(err)
838 print*,
'FATAL ERROR: ', trim(string),
': ', trim(errmsg)
840 CALL mpi_abort(mpi_comm_world, 999, iret)
861 CHARACTER(LEN=*),
INTENT(IN) :: gsi_file
862 CHARACTER(LEN=3),
INTENT(IN) :: file_type
863 INTEGER,
INTENT(IN),
OPTIONAL :: lsoil
865 INTEGER :: error, id_dim, ncid
868 INTEGER(KIND=1),
ALLOCATABLE :: idummy(:,:)
870 REAL(KIND=8),
ALLOCATABLE :: dummy(:,:)
872 CHARACTER(LEN=1) :: k_ch
873 CHARACTER(LEN=10) :: incvar
874 CHARACTER(LEN=80) :: err_msg
878 print*,
"READ INPUT GSI DATA FROM: "//trim(gsi_file)
880 error=nf90_open(trim(gsi_file),nf90_nowrite,ncid)
881 CALL
netcdf_err(error,
'OPENING FILE: '//trim(gsi_file) )
883 error=nf90_inq_dimid(ncid,
'latitude', id_dim)
884 CALL
netcdf_err(error,
'READING latitude ID' )
885 error=nf90_inquire_dimension(ncid,id_dim,len=jdim_gaus)
886 CALL
netcdf_err(error,
'READING latitude length' )
887 jdim_gaus = jdim_gaus - 2
889 error=nf90_inq_dimid(ncid,
'longitude', id_dim)
890 CALL
netcdf_err(error,
'READING longitude ID' )
891 error=nf90_inquire_dimension(ncid,id_dim,len=idim_gaus)
892 CALL
netcdf_err(error,
'READING longitude length' )
894 IF (file_type==
'NST')
then
895 ALLOCATE(dummy(idim_gaus,jdim_gaus+2))
896 ALLOCATE(dtref_gaus(idim_gaus,jdim_gaus))
898 error=nf90_inq_varid(ncid,
"dtf", id_var)
900 error=nf90_get_var(ncid, id_var, dummy)
903 ALLOCATE(idummy(idim_gaus,jdim_gaus+2))
904 ALLOCATE(slmsk_gaus(idim_gaus,jdim_gaus))
906 error=nf90_inq_varid(ncid,
"msk", id_var)
908 error=nf90_get_var(ncid, id_var, idummy)
914 slmsk_gaus(:,j) = idummy(:,j+1)
915 dtref_gaus(:,j) = dummy(:,j+1)
918 ELSEIF (file_type==
'LND')
then
920 ALLOCATE(dummy(idim_gaus,jdim_gaus+2))
921 ALLOCATE(stc_inc_gaus(lsoil,idim_gaus,jdim_gaus))
922 ALLOCATE(slc_inc_gaus(lsoil,idim_gaus,jdim_gaus))
926 WRITE(k_ch,
'(I1)') k
928 incvar =
"soilt"//k_ch//
"_inc"
929 error=nf90_inq_varid(ncid, incvar, id_var)
930 err_msg =
"reading "//incvar//
" ID"
932 error=nf90_get_var(ncid, id_var, dummy)
933 err_msg =
"reading "//incvar//
" data"
937 stc_inc_gaus(k,:,j) = dummy(:,j+1)
940 incvar =
"slc"//k_ch//
"_inc"
941 error=nf90_inq_varid(ncid, incvar, id_var)
942 err_msg =
"reading "//incvar//
" ID"
944 error=nf90_get_var(ncid, id_var, dummy)
945 err_msg =
"reading "//incvar//
" data"
949 slc_inc_gaus(k,:,j) = dummy(:,j+1)
954 ALLOCATE(idummy(idim_gaus,jdim_gaus+2))
955 ALLOCATE(soilsnow_gaus(idim_gaus,jdim_gaus))
957 error=nf90_inq_varid(ncid,
"soilsnow_mask", id_var)
958 CALL
netcdf_err(error,
'READING soilsnow_mask ID' )
959 error=nf90_get_var(ncid, id_var, idummy)
960 CALL
netcdf_err(error,
'READING soilsnow_mask' )
965 soilsnow_gaus(:,j) = idummy(:,j+1)
970 print *,
'WARNING: FILE_TYPE', file_type,
'not recognised.', &
971 ', no increments read in'
974 IF(
ALLOCATED(dummy))
DEALLOCATE(dummy)
975 IF(
ALLOCATED(idummy))
DEALLOCATE(idummy)
977 error = nf90_close(ncid)
1029 SUBROUTINE read_data(LSOIL,LENSFC,DO_NSST,INC_FILE,IS_NOAHMP, &
1030 tsffcs,smcfcs,swefcs,stcfcs, &
1032 cvfcs,cvbfcs,cvtfcs,albfcs, &
1033 vegfcs,slifcs,cnpfcs,f10m, &
1034 vetfcs,sotfcs,alffcs, &
1036 sihfcs,sicfcs,sitfcs, &
1037 tprcp,srflag,sndfcs, &
1038 vmnfcs,vmxfcs,slcfcs, &
1039 slpfcs,absfcs,t2m,q2m,slmask, &
1045 INTEGER,
INTENT(IN) :: lsoil, lensfc
1046 LOGICAL,
INTENT(IN) :: do_nsst, inc_file
1048 LOGICAL,
OPTIONAL,
INTENT(OUT) :: is_noahmp
1050 REAL,
OPTIONAL,
INTENT(OUT) :: cvfcs(lensfc), cvbfcs(lensfc)
1051 REAL,
OPTIONAL,
INTENT(OUT) :: cvtfcs(lensfc), albfcs(lensfc,4)
1052 REAL,
OPTIONAL,
INTENT(OUT) :: slifcs(lensfc), cnpfcs(lensfc)
1053 REAL,
OPTIONAL,
INTENT(OUT) :: vegfcs(lensfc), f10m(lensfc)
1054 REAL,
OPTIONAL,
INTENT(OUT) :: vetfcs(lensfc), sotfcs(lensfc)
1055 REAL,
OPTIONAL,
INTENT(OUT) :: tsffcs(lensfc), swefcs(lensfc)
1056 REAL,
OPTIONAL,
INTENT(OUT) :: tg3fcs(lensfc), zorfcs(lensfc)
1057 REAL,
OPTIONAL,
INTENT(OUT) :: alffcs(lensfc,2), ustar(lensfc)
1058 REAL,
OPTIONAL,
INTENT(OUT) :: fmm(lensfc), fhh(lensfc)
1059 REAL,
OPTIONAL,
INTENT(OUT) :: sihfcs(lensfc), sicfcs(lensfc)
1060 REAL,
OPTIONAL,
INTENT(OUT) :: sitfcs(lensfc), tprcp(lensfc)
1061 REAL,
OPTIONAL,
INTENT(OUT) :: srflag(lensfc), sndfcs(lensfc)
1062 REAL,
OPTIONAL,
INTENT(OUT) :: vmnfcs(lensfc), vmxfcs(lensfc)
1063 REAL,
OPTIONAL,
INTENT(OUT) :: slpfcs(lensfc), absfcs(lensfc)
1064 REAL,
OPTIONAL,
INTENT(OUT) :: t2m(lensfc), q2m(lensfc), slmask(lensfc)
1065 REAL,
OPTIONAL,
INTENT(OUT) :: slcfcs(lensfc,lsoil)
1066 REAL,
OPTIONAL,
INTENT(OUT) :: smcfcs(lensfc,lsoil)
1067 REAL,
OPTIONAL,
INTENT(OUT) :: stcfcs(lensfc,lsoil)
1068 REAL(KIND=4),
OPTIONAL,
INTENT(OUT) :: zsoil(lsoil)
1073 CHARACTER(LEN=50) :: fnbgsi
1074 CHARACTER(LEN=3) :: rankch
1076 INTEGER :: error, error2, ncid, myrank
1077 INTEGER :: idim, jdim, id_dim
1078 INTEGER :: id_var, ierr
1080 REAL(KIND=8),
ALLOCATABLE :: dummy(:,:), dummy3d(:,:,:)
1082 CALL mpi_comm_rank(mpi_comm_world, myrank, error)
1084 WRITE(rankch,
'(I3.3)') (myrank+1)
1087 fnbgsi =
"./xainc." // rankch
1089 fnbgsi =
"./fnbgsi." // rankch
1093 print*,
"READ INPUT SFC DATA FROM: "//trim(fnbgsi)
1095 error=nf90_open(trim(fnbgsi),nf90_nowrite,ncid)
1096 CALL
netcdf_err(error,
'OPENING FILE: '//trim(fnbgsi) )
1098 error=nf90_inq_dimid(ncid,
'xaxis_1', id_dim)
1100 error=nf90_inquire_dimension(ncid,id_dim,len=idim)
1103 error=nf90_inq_dimid(ncid,
'yaxis_1', id_dim)
1105 error=nf90_inquire_dimension(ncid,id_dim,len=jdim)
1108 IF ((idim*jdim) /= lensfc)
THEN
1109 print*,
'FATAL ERROR: DIMENSIONS WRONG.'
1110 CALL mpi_abort(mpi_comm_world, 88, ierr)
1116 IF(present(is_noahmp))
THEN
1117 error=nf90_inq_varid(ncid,
"canliqxy", id_var)
1118 error2=nf90_inq_varid(ncid,
"tsnoxy", id_var)
1120 IF(error == 0 .AND. error2 == 0)
THEN
1122 print*,
"- WILL PROCESS FOR NOAH-MP LSM."
1126 ALLOCATE(dummy(idim,jdim))
1128 IF (present(tsffcs))
THEN
1129 error=nf90_inq_varid(ncid,
"tsea", id_var)
1131 error=nf90_get_var(ncid, id_var, dummy)
1133 tsffcs = reshape(dummy, (/lensfc/))
1136 IF (present(swefcs))
THEN
1137 error=nf90_inq_varid(ncid,
"sheleg", id_var)
1139 error=nf90_get_var(ncid, id_var, dummy)
1141 swefcs = reshape(dummy, (/lensfc/))
1144 IF (present(tg3fcs))
THEN
1145 error=nf90_inq_varid(ncid,
"tg3", id_var)
1147 error=nf90_get_var(ncid, id_var, dummy)
1149 tg3fcs = reshape(dummy, (/lensfc/))
1152 IF (present(zorfcs))
THEN
1153 error=nf90_inq_varid(ncid,
"zorl", id_var)
1155 error=nf90_get_var(ncid, id_var, dummy)
1157 zorfcs = reshape(dummy, (/lensfc/))
1160 IF (present(albfcs))
THEN
1162 error=nf90_inq_varid(ncid,
"alvsf", id_var)
1164 error=nf90_get_var(ncid, id_var, dummy)
1166 albfcs(:,1) = reshape(dummy, (/lensfc/))
1168 error=nf90_inq_varid(ncid,
"alvwf", id_var)
1170 error=nf90_get_var(ncid, id_var, dummy)
1172 albfcs(:,2) = reshape(dummy, (/lensfc/))
1174 error=nf90_inq_varid(ncid,
"alnsf", id_var)
1176 error=nf90_get_var(ncid, id_var, dummy)
1178 albfcs(:,3) = reshape(dummy, (/lensfc/))
1180 error=nf90_inq_varid(ncid,
"alnwf", id_var)
1182 error=nf90_get_var(ncid, id_var, dummy)
1184 albfcs(:,4) = reshape(dummy, (/lensfc/))
1188 IF (present(slifcs))
THEN
1189 error=nf90_inq_varid(ncid,
"slmsk", id_var)
1191 error=nf90_get_var(ncid, id_var, dummy)
1193 slifcs = reshape(dummy, (/lensfc/))
1195 WHERE (slmask > 1.5) slmask=0.0
1198 IF (present(cnpfcs))
THEN
1199 error=nf90_inq_varid(ncid,
"canopy", id_var)
1201 error=nf90_get_var(ncid, id_var, dummy)
1203 cnpfcs = reshape(dummy, (/lensfc/))
1206 IF (present(vegfcs))
THEN
1207 error=nf90_inq_varid(ncid,
"vfrac", id_var)
1209 error=nf90_get_var(ncid, id_var, dummy)
1211 vegfcs = reshape(dummy, (/lensfc/))
1214 IF (present(f10m))
THEN
1215 error=nf90_inq_varid(ncid,
"f10m", id_var)
1217 error=nf90_get_var(ncid, id_var, dummy)
1219 f10m = reshape(dummy, (/lensfc/))
1222 IF (present(vetfcs))
THEN
1223 error=nf90_inq_varid(ncid,
"vtype", id_var)
1225 error=nf90_get_var(ncid, id_var, dummy)
1227 vetfcs = reshape(dummy, (/lensfc/))
1230 IF (present(sotfcs))
THEN
1231 error=nf90_inq_varid(ncid,
"stype", id_var)
1233 error=nf90_get_var(ncid, id_var, dummy)
1235 sotfcs = reshape(dummy, (/lensfc/))
1238 IF (present(alffcs))
THEN
1239 error=nf90_inq_varid(ncid,
"facsf", id_var)
1241 error=nf90_get_var(ncid, id_var, dummy)
1243 alffcs(:,1) = reshape(dummy, (/lensfc/))
1245 error=nf90_inq_varid(ncid,
"facwf", id_var)
1247 error=nf90_get_var(ncid, id_var, dummy)
1249 alffcs(:,2) = reshape(dummy, (/lensfc/))
1252 IF (present(ustar))
THEN
1253 error=nf90_inq_varid(ncid,
"uustar", id_var)
1255 error=nf90_get_var(ncid, id_var, dummy)
1257 ustar = reshape(dummy, (/lensfc/))
1260 IF (present(fmm))
THEN
1261 error=nf90_inq_varid(ncid,
"ffmm", id_var)
1263 error=nf90_get_var(ncid, id_var, dummy)
1265 fmm = reshape(dummy, (/lensfc/))
1268 IF (present(fhh))
THEN
1269 error=nf90_inq_varid(ncid,
"ffhh", id_var)
1271 error=nf90_get_var(ncid, id_var, dummy)
1273 fhh = reshape(dummy, (/lensfc/))
1276 IF (present(sihfcs))
THEN
1277 error=nf90_inq_varid(ncid,
"hice", id_var)
1279 error=nf90_get_var(ncid, id_var, dummy)
1281 sihfcs = reshape(dummy, (/lensfc/))
1284 IF (present(sicfcs))
THEN
1285 error=nf90_inq_varid(ncid,
"fice", id_var)
1287 error=nf90_get_var(ncid, id_var, dummy)
1289 sicfcs = reshape(dummy, (/lensfc/))
1292 IF (present(sitfcs))
THEN
1293 error=nf90_inq_varid(ncid,
"tisfc", id_var)
1295 error=nf90_get_var(ncid, id_var, dummy)
1297 sitfcs = reshape(dummy, (/lensfc/))
1300 IF (present(tprcp))
THEN
1301 error=nf90_inq_varid(ncid,
"tprcp", id_var)
1303 error=nf90_get_var(ncid, id_var, dummy)
1305 tprcp = reshape(dummy, (/lensfc/))
1308 IF (present(srflag))
THEN
1309 error=nf90_inq_varid(ncid,
"srflag", id_var)
1311 error=nf90_get_var(ncid, id_var, dummy)
1313 srflag = reshape(dummy, (/lensfc/))
1316 IF (present(sndfcs))
THEN
1317 error=nf90_inq_varid(ncid,
"snwdph", id_var)
1319 error=nf90_get_var(ncid, id_var, dummy)
1321 sndfcs = reshape(dummy, (/lensfc/))
1324 IF (present(vmnfcs))
THEN
1325 error=nf90_inq_varid(ncid,
"shdmin", id_var)
1327 error=nf90_get_var(ncid, id_var, dummy)
1329 vmnfcs = reshape(dummy, (/lensfc/))
1332 IF (present(vmxfcs))
THEN
1333 error=nf90_inq_varid(ncid,
"shdmax", id_var)
1335 error=nf90_get_var(ncid, id_var, dummy)
1337 vmxfcs = reshape(dummy, (/lensfc/))
1340 IF (present(slpfcs))
THEN
1341 error=nf90_inq_varid(ncid,
"slope", id_var)
1343 error=nf90_get_var(ncid, id_var, dummy)
1345 slpfcs = reshape(dummy, (/lensfc/))
1348 IF (present(absfcs))
THEN
1349 error=nf90_inq_varid(ncid,
"snoalb", id_var)
1351 error=nf90_get_var(ncid, id_var, dummy)
1353 absfcs = reshape(dummy, (/lensfc/))
1356 IF (present(t2m))
THEN
1357 error=nf90_inq_varid(ncid,
"t2m", id_var)
1359 error=nf90_get_var(ncid, id_var, dummy)
1361 t2m = reshape(dummy, (/lensfc/))
1364 IF (present(q2m))
THEN
1365 error=nf90_inq_varid(ncid,
"q2m", id_var)
1367 error=nf90_get_var(ncid, id_var, dummy)
1369 q2m = reshape(dummy, (/lensfc/))
1372 nsst_read :
IF(do_nsst)
THEN
1375 print*,
"WILL READ NSST RECORDS."
1377 error=nf90_inq_varid(ncid,
"c_0", id_var)
1379 error=nf90_get_var(ncid, id_var, dummy)
1381 nsst%C_0 = reshape(dummy, (/lensfc/))
1383 error=nf90_inq_varid(ncid,
"c_d", id_var)
1385 error=nf90_get_var(ncid, id_var, dummy)
1387 nsst%C_D = reshape(dummy, (/lensfc/))
1389 error=nf90_inq_varid(ncid,
"d_conv", id_var)
1391 error=nf90_get_var(ncid, id_var, dummy)
1393 nsst%D_CONV = reshape(dummy, (/lensfc/))
1395 error=nf90_inq_varid(ncid,
"dt_cool", id_var)
1396 CALL
netcdf_err(error,
'READING dt_cool ID' )
1397 error=nf90_get_var(ncid, id_var, dummy)
1399 nsst%DT_COOL = reshape(dummy, (/lensfc/))
1401 error=nf90_inq_varid(ncid,
"ifd", id_var)
1403 error=nf90_get_var(ncid, id_var, dummy)
1405 nsst%IFD = reshape(dummy, (/lensfc/))
1407 error=nf90_inq_varid(ncid,
"qrain", id_var)
1409 error=nf90_get_var(ncid, id_var, dummy)
1411 nsst%QRAIN = reshape(dummy, (/lensfc/))
1413 error=nf90_inq_varid(ncid,
"tref", id_var)
1415 error=nf90_get_var(ncid, id_var, dummy)
1417 nsst%TREF = reshape(dummy, (/lensfc/))
1419 error=nf90_inq_varid(ncid,
"w_0", id_var)
1421 error=nf90_get_var(ncid, id_var, dummy)
1423 nsst%W_0 = reshape(dummy, (/lensfc/))
1425 error=nf90_inq_varid(ncid,
"w_d", id_var)
1427 error=nf90_get_var(ncid, id_var, dummy)
1429 nsst%W_D = reshape(dummy, (/lensfc/))
1431 error=nf90_inq_varid(ncid,
"xs", id_var)
1433 error=nf90_get_var(ncid, id_var, dummy)
1435 nsst%XS = reshape(dummy, (/lensfc/))
1437 error=nf90_inq_varid(ncid,
"xt", id_var)
1439 error=nf90_get_var(ncid, id_var, dummy)
1441 nsst%XT = reshape(dummy, (/lensfc/))
1443 error=nf90_inq_varid(ncid,
"xtts", id_var)
1445 error=nf90_get_var(ncid, id_var, dummy)
1447 nsst%XTTS = reshape(dummy, (/lensfc/))
1449 error=nf90_inq_varid(ncid,
"xu", id_var)
1451 error=nf90_get_var(ncid, id_var, dummy)
1453 nsst%XU = reshape(dummy, (/lensfc/))
1455 error=nf90_inq_varid(ncid,
"xv", id_var)
1457 error=nf90_get_var(ncid, id_var, dummy)
1459 nsst%XV = reshape(dummy, (/lensfc/))
1461 error=nf90_inq_varid(ncid,
"xz", id_var)
1463 error=nf90_get_var(ncid, id_var, dummy)
1465 nsst%XZ = reshape(dummy, (/lensfc/))
1467 error=nf90_inq_varid(ncid,
"xzts", id_var)
1469 error=nf90_get_var(ncid, id_var, dummy)
1471 nsst%XZTS = reshape(dummy, (/lensfc/))
1473 error=nf90_inq_varid(ncid,
"z_c", id_var)
1475 error=nf90_get_var(ncid, id_var, dummy)
1477 nsst%Z_C = reshape(dummy, (/lensfc/))
1479 error=nf90_inq_varid(ncid,
"zm", id_var)
1481 error=nf90_get_var(ncid, id_var, dummy)
1483 nsst%ZM = reshape(dummy, (/lensfc/))
1489 ALLOCATE(dummy3d(idim,jdim,lsoil))
1491 IF (present(smcfcs))
THEN
1492 error=nf90_inq_varid(ncid,
"smc", id_var)
1494 error=nf90_get_var(ncid, id_var, dummy3d)
1496 smcfcs = reshape(dummy3d, (/lensfc,lsoil/))
1499 IF (present(slcfcs))
THEN
1500 error=nf90_inq_varid(ncid,
"slc", id_var)
1502 error=nf90_get_var(ncid, id_var, dummy3d)
1504 slcfcs = reshape(dummy3d, (/lensfc,lsoil/))
1507 IF (present(stcfcs))
THEN
1508 error=nf90_inq_varid(ncid,
"stc", id_var)
1510 error=nf90_get_var(ncid, id_var, dummy3d)
1512 stcfcs = reshape(dummy3d, (/lensfc,lsoil/))
1519 IF (present(cvfcs)) cvfcs = 0.0
1520 IF (present(cvtfcs)) cvtfcs = 0.0
1521 IF (present(cvbfcs)) cvbfcs = 0.0
1526 IF (present(zsoil))
THEN
1533 error = nf90_close(ncid)
1560 character(*) ,
intent(in ) :: file_sst
1561 integer ,
intent(in ) :: mon,mlat_sst,mlon_sst
1562 real,
dimension(mlat_sst) ,
intent( out) :: rlats_sst
1563 real,
dimension(mlon_sst) ,
intent( out) :: rlons_sst
1564 real,
dimension(mlon_sst,mlat_sst) ,
intent( out) :: sst
1567 integer,
parameter:: lu_sst = 21
1568 real,
parameter :: deg2rad = 3.141593/180.0
1571 logical(1),
allocatable,
dimension(:) :: lb
1575 integer :: iret,ni,nj
1576 integer :: mscan,kb1,ierr
1577 integer :: jincdir,i,iincdir,kb2,kb3,kf,kg,k,j,jf
1578 integer,
dimension(22):: jgds,kgds
1579 integer,
dimension(25):: jpds,kpds
1584 real,
allocatable,
dimension(:) :: f
1589 write(*,*)
' sstclm : ',file_sst
1590 call baopenr(lu_sst,trim(file_sst),iret)
1591 if (iret /= 0 )
then
1592 write(6,*)
'FATAL ERROR in read_tf_clm_grb: error opening sst file.'
1593 CALL mpi_abort(mpi_comm_world, 111, ierr)
1603 call getgbh(lu_sst,0,j,jpds,jgds,kg,kf,k,kpds,kgds,iret)
1612 allocate(lb(nlat_sst*nlon_sst))
1613 allocate(f(nlat_sst*nlon_sst))
1614 jf=nlat_sst*nlon_sst
1617 call getgb(lu_sst,0,jf,j,jpds,jgds,kf,k,kpds,kgds,lb,f,iret)
1619 write(6,*)
'FATAL ERROR in read_tf_clm_grb: error reading sst analysis data record.'
1621 CALL mpi_abort(mpi_comm_world, 111, ierr)
1624 if ( (nlat_sst /= mlat_sst) .or. (nlon_sst /= mlon_sst) )
then
1625 write(6,*)
'FATAL ERROR in read_rtg_org: inconsistent dimensions. mlat_sst,mlon_sst=',&
1626 mlat_sst,mlon_sst,
' -versus- nlat_sst,nlon_sst=',nlat_sst,nlon_sst
1628 CALL mpi_abort(mpi_comm_world, 111, ierr)
1634 dres = 180.0/
real(nlat_sst)
1635 ysst0 = 0.5*dres-90.0
1640 rlats_sst(j) = ysst0 +
real(j-1)*dres
1644 rlons_sst(i) = (xsst0 +
real(i-1)*dres)
1652 kb1=ibits(mscan,7,1)
1653 kb2=ibits(mscan,6,1)
1654 kb3=ibits(mscan,5,1)
1669 i=(ni+1)*kb1+(mod(k-1,ni)+1)*iincdir
1670 j=(nj+1)*(1-kb2)+jincdir*((k-1)/ni+1)
1672 j=(nj+1)*(1-kb2)+(mod(k-1,nj)+1)*jincdir
1673 i=(ni+1)*kb1+iincdir*((k-1)/nj+1)
1680 call baclose(lu_sst,iret)
1681 if (iret /= 0 )
then
1682 write(6,*)
'FATAL ERROR in read_tf_clm_grb: error closing sst file.'
1683 CALL mpi_abort(mpi_comm_world, 121, ierr)
1701 character(*) ,
intent(in ) :: file_sst
1702 integer ,
intent(out) :: mlat_sst,mlon_sst
1705 integer,
parameter:: lu_sst = 21
1708 integer :: kf,kg,k,j,ierr
1709 integer,
dimension(22):: jgds,kgds
1710 integer,
dimension(25):: jpds,kpds
1715 call baopenr(lu_sst,trim(file_sst),iret)
1716 if (iret /= 0 )
then
1717 write(6,*)
'FATAL ERROR in get_tf_clm_dim: error opening sst file.'
1718 CALL mpi_abort(mpi_comm_world, 111, ierr)
1728 call getgbh(lu_sst,0,j,jpds,jgds,kg,kf,k,kpds,kgds,iret)
1733 write(*,*)
'mlat_sst, mlon_sst : ',mlat_sst, mlon_sst
1735 call baclose(lu_sst,iret)
1736 if (iret /= 0 )
then
1737 write(6,*)
'FATAL ERROR in get_tf_clm_dim: error closing sst file.'
1738 CALL mpi_abort(mpi_comm_world, 121, ierr)
1758 character (len=*),
intent(in) :: filename
1759 integer,
intent(in) :: nlat,nlon
1760 integer,
intent(in) :: itime
1761 real,
dimension(nlat),
intent(out) :: xlats
1762 real,
dimension(nlon),
intent(out) :: xlons
1763 real,
dimension(nlon,nlat),
intent(out) :: sal
1767 integer,
parameter :: ndims = 3
1768 character (len = *),
parameter :: lat_name =
"latitude"
1769 character (len = *),
parameter :: lon_name =
"longitude"
1770 character (len = *),
parameter :: t_name =
"time"
1771 character (len = *),
parameter :: sal_name=
"sal"
1772 integer :: time_varid,lon_varid, lat_varid, sal_varid
1775 integer,
dimension(ndims) :: start, count
1777 character (len = *),
parameter :: units =
"units"
1778 character (len = *),
parameter :: sal_units =
"psu"
1780 character (len = *),
parameter :: time_units =
"months"
1781 character (len = *),
parameter :: lat_units =
"degrees_north"
1782 character (len = *),
parameter :: lon_units =
"degrees_east"
1785 call
nc_check( nf90_open(filename, nf90_nowrite, ncid) )
1788 call
nc_check( nf90_inq_varid(ncid, t_name, time_varid) )
1789 call
nc_check( nf90_inq_varid(ncid, lat_name, lat_varid) )
1790 call
nc_check( nf90_inq_varid(ncid, lon_name, lon_varid) )
1794 call
nc_check( nf90_get_var(ncid, lat_varid, xlats) )
1795 call
nc_check( nf90_get_var(ncid, lon_varid, xlons) )
1798 call
nc_check( nf90_inq_varid(ncid, sal_name,sal_varid) )
1802 start = (/ 1, 1, itime /)
1803 count = (/ nlon, nlat, 1 /)
1807 call
nc_check( nf90_get_var(ncid, sal_varid, sal, start, count) )
1828 character (len=*),
intent(in) :: filename
1829 integer,
intent(out) :: nlat,nlon
1831 character (len = *),
parameter :: lat_name =
"latitude"
1832 character (len = *),
parameter :: lon_name =
"longitude"
1834 integer :: latdimid,londimid
1837 call
nc_check( nf90_open(filename, nf90_nowrite, ncid) )
1840 call
nc_check( nf90_inq_dimid(ncid,lat_name,latdimid) )
1841 call
nc_check( nf90_inq_dimid(ncid,lon_name,londimid) )
1842 call
nc_check( nf90_inquire_dimension(ncid,latdimid,len=nlat) )
1843 call
nc_check( nf90_inquire_dimension(ncid,londimid,len=nlon) )
1866 integer,
intent ( in) :: status
1869 if(status /= nf90_noerr)
then
1870 print *,
'FATAL ERROR:'
1871 print *, trim(nf90_strerror(status))
1872 CALL mpi_abort(mpi_comm_world, 122, ierr)
subroutine, public read_lat_lon_orog(RLA, RLO, OROG, OROG_UF, TILE_NUM, IDIM, JDIM, IJDIM, LANDFRAC)
Read latitude and longitude for the cubed-sphere tile from the 'grid' file.
subroutine nc_check(status)
Check the NetCDF status code.
subroutine netcdf_err(ERR, STRING)
If a NetCDF call returns an error, print out a user-supplied message and the NetCDF library message...
subroutine, public get_dim_nc(filename, nlat, nlon)
Get the i/j dimensions of the data from a NetCDF file.
Holds machine dependent constants for global_cycle.
subroutine, public read_salclm_gfs_nc(filename, sal, xlats, xlons, nlat, nlon, itime)
Read the woa05 salinity monthly climatology file.
subroutine, public read_data(LSOIL, LENSFC, DO_NSST, INC_FILE, IS_NOAHMP, TSFFCS, SMCFCS, SWEFCS, STCFCS, TG3FCS, ZORFCS, CVFCS, CVBFCS, CVTFCS, ALBFCS, VEGFCS, SLIFCS, CNPFCS, F10M, VETFCS, SOTFCS, ALFFCS, USTAR, FMM, FHH, SIHFCS, SICFCS, SITFCS, TPRCP, SRFLAG, SNDFCS, VMNFCS, VMXFCS, SLCFCS, SLPFCS, ABSFCS, T2M, Q2M, SLMASK, ZSOIL, NSST)
Read the first guess surface records and nsst records (if selected) for a single cubed-sphere tile...
subroutine, public get_tf_clm_dim(file_sst, mlat_sst, mlon_sst)
Get the i/j dimensions of RTG SST climatology file.
subroutine, public read_gsi_data(GSI_FILE, FILE_TYPE, LSOIL)
Read increment file from the GSI containing either the foundation temperature increments and mask...
This module contains routines that read and write data.
subroutine, public write_data(lensfc, idim, jdim, lsoil, do_nsst, nsst, slifcs, tsffcs, vegfcs, swefcs, tg3fcs, zorfcs, albfcs, alffcs, cnpfcs, f10m, t2m, q2m, vetfcs, sotfcs, ustar, fmm, fhh, sicfcs, sihfcs, sitfcs, tprcp, srflag, swdfcs, vmnfcs, vmxfcs, slpfcs, absfcs, slcfcs, smcfcs, stcfcs)
Update surface records - and nsst records if selected - on a single cubed-sphere tile to a pre-existi...
subroutine, public read_tf_clim_grb(file_sst, sst, rlats_sst, rlons_sst, mlat_sst, mlon_sst, mon)
Read a GRIB1 sst climatological analysis file.
subroutine remove_checksum(ncid, id_var)
Remove the checksum attribute from a netcdf record.