2 ! Author(s)/Contact(s):
7 ! Parameters: <Specify typical arguments passed>
9 ! <list file names and briefly describe the data they include>
11 ! <list file names and briefly describe the information they include>
14 ! <list exit condition or error codes returned >
15 ! If appropriate, descriptive troubleshooting instructions or
16 ! likely causes for failures could be mentioned here with the
17 ! appropriate error code
19 ! User controllable options: <if applicable>
21 module module_lsm_forcing
26 use module_HYDRO_io, only: get_2d_netcdf, get_soilcat_netcdf, get2d_int
27 use module_hydro_stop, only:HYDRO_stop
32 character(len=19) out_date
34 interface read_hydro_forcing
36 !yw module procedure read_hydro_forcing_mpp
37 module procedure read_hydro_forcing_mpp1
39 module procedure read_hydro_forcing_seq
45 subroutine READFORC_WRF(flnm,ix,jx,target_date,t,q,u,v,p,lw,sw,pcp,lai,fpar)
48 character(len=*), intent(in) :: flnm
49 integer, intent(in) :: ix
50 integer, intent(in) :: jx
51 character(len=*), intent(in) :: target_date
52 real, dimension(ix,jx) :: t,q,u,v,p,lw,sw,pcp,pcpc, lai,fpar
55 character(len=256) :: units
64 ! Open the NetCDF file.
65 ierr = nf_open(flnm, NF_NOWRITE, ncid)
67 write(*,'("READFORC_WRF Problem opening netcdf file: ''", A, "''")') trim(flnm)
68 call hydro_stop("In READFORC_WRF() - Problem opening netcdf file")
71 call get_2d_netcdf_ruc("T2", ncid, t, ix, jx,tlevel, .true., ierr)
72 call get_2d_netcdf_ruc("Q2", ncid, q, ix, jx,tlevel, .true., ierr)
73 call get_2d_netcdf_ruc("U10", ncid, u, ix, jx,tlevel, .true., ierr)
74 call get_2d_netcdf_ruc("V10", ncid, v, ix, jx,tlevel, .true., ierr)
75 call get_2d_netcdf_ruc("PSFC", ncid, p, ix, jx,tlevel, .true., ierr)
76 call get_2d_netcdf_ruc("GLW", ncid, lw, ix, jx,tlevel, .true., ierr)
77 call get_2d_netcdf_ruc("SWDOWN", ncid, sw, ix, jx,tlevel, .true., ierr)
78 call get_2d_netcdf_ruc("RAINC", ncid, pcpc, ix, jx,tlevel, .true., ierr)
79 call get_2d_netcdf_ruc("RAINNC", ncid, pcp, ix, jx,tlevel, .true., ierr)
80 call get_2d_netcdf_ruc("VEGFRA", ncid, fpar, ix, jx,tlevel, .true., ierr)
82 if(maxval(fpar) .gt. 10 .and. (maxval(fpar) .lt. 10000) ) fpar = fpar*0.01
84 call get_2d_netcdf_ruc("LAI", ncid, lai, ix, jx,tlevel, .true., ierr)
88 !DJG Add the convective and non-convective rain components (note: conv. comp=0
89 !for cloud resolving runs...)
90 !DJG Note that for WRF these are accumulated values to be adjusted to rates in
93 pcp=pcp+pcpc ! assumes pcpc=0 for resolved convection...
95 end subroutine READFORC_WRF
97 subroutine read_hrldas_hdrinfo(geo_static_flnm, ix, jx, land_cat, soil_cat)
98 ! Simply return the dimensions of the grid.
100 character(len=*), intent(in) :: geo_static_flnm
101 integer, intent(out) :: ix, jx, land_cat, soil_cat ! dimensions
103 integer :: iret, ncid, dimid
105 ! Open the NetCDF file.
106 iret = nf_open(geo_static_flnm, NF_NOWRITE, ncid)
108 write(*,'("Problem opening geo_static file: ''", A, "''")') &
109 trim(geo_static_flnm)
110 call hydro_stop("In read_hrldas_hdrinfo() - Problem opening geo_static file")
113 iret = nf_inq_dimid(ncid, "west_east", dimid)
116 ! print*, "nf_inq_dimid: west_east"
117 call hydro_stop("In read_hrldas_hdrinfo() - nf_inq_dimid: west_east problem")
120 iret = nf_inq_dimlen(ncid, dimid, ix)
122 ! print*, "nf_inq_dimlen: west_east"
123 call hydro_stop("In read_hrldas_hdrinfo() - nf_inq_dimlen: west_east problem")
126 iret = nf_inq_dimid(ncid, "south_north", dimid)
128 ! print*, "nf_inq_dimid: south_north"
129 call hydro_stop("In read_hrldas_hdrinfo() - nf_inq_dimid: south_north problem")
132 iret = nf_inq_dimlen(ncid, dimid, jx)
134 ! print*, "nf_inq_dimlen: south_north"
135 call hydro_stop("In read_hrldas_hdrinfo() - nf_inq_dimlen: south_north problem")
138 iret = nf_inq_dimid(ncid, "land_cat", dimid)
140 ! print*, "nf_inq_dimid: land_cat"
141 call hydro_stop("In read_hrldas_hdrinfo() - nf_inq_dimid: land_cat problem")
144 iret = nf_inq_dimlen(ncid, dimid, land_cat)
146 print*, "nf_inq_dimlen: land_cat"
147 call hydro_stop("In read_hrldas_hdrinfo() - nf_inq_dimlen: land_cat problem")
150 iret = nf_inq_dimid(ncid, "soil_cat", dimid)
152 ! print*, "nf_inq_dimid: soil_cat"
153 call hydro_stop("In read_hrldas_hdrinfo() - nf_inq_dimid: soil_cat problem")
156 iret = nf_inq_dimlen(ncid, dimid, soil_cat)
158 ! print*, "nf_inq_dimlen: soil_cat"
159 call hydro_stop("In read_hrldas_hdrinfo() - nf_inq_dimlen: soil_cat problem")
162 iret = nf_close(ncid)
164 end subroutine read_hrldas_hdrinfo
168 subroutine readland_hrldas(geo_static_flnm,ix,jx,land_cat,soil_cat,vegtyp,soltyp, &
169 terrain,latitude,longitude,SOLVEG_INITSWC)
171 character(len=*), intent(in) :: geo_static_flnm
172 integer, intent(in) :: ix, jx, land_cat, soil_cat,SOLVEG_INITSWC
173 integer, dimension(ix,jx), intent(out) :: vegtyp, soltyp
174 real, dimension(ix,jx), intent(out) :: terrain, latitude, longitude
176 character(len=256) :: units
177 integer :: ierr,i,j,jj
178 integer :: ncid,varid
179 real, dimension(ix,jx) :: xdum
180 integer, dimension(ix,jx) :: vegtyp_inv, soiltyp_inv,xdum_int
181 integer flag ! flag = 1 from wrfsi, flag =2 from WPS.
182 CHARACTER(len=256) :: var_name
183 integer :: islake, iswater, isoilwater
185 ! Open the NetCDF file.
186 ierr = nf_open(geo_static_flnm, NF_NOWRITE, ncid)
189 write(*,'("Problem opening geo_static file: ''", A, "''")') trim(geo_static_flnm)
190 call hydro_stop("In readland_hrldas() - Problem opening geo_static file")
194 ierr = nf_inq_varid(ncid,"XLAT", varid)
197 ierr = nf_inq_varid(ncid,"XLAT_M", varid)
199 ! write(6,*) "XLAT not found from wrfstatic file. "
200 call hydro_stop("In readland_hrldas() - XLAT not found from wrfstatic file")
207 call get_2d_netcdf("XLAT", ncid, latitude, units, ix, jx, .TRUE., ierr)
209 call get_2d_netcdf("XLAT_M", ncid, latitude, units, ix, jx, .TRUE., ierr)
212 ! Get Longitude (lon)
214 call get_2d_netcdf("XLONG", ncid, longitude, units, ix, jx, .TRUE., ierr)
216 call get_2d_netcdf("XLONG_M", ncid, longitude, units, ix, jx, .TRUE., ierr)
221 call get_2d_netcdf("HGT", ncid, terrain, units, ix, jx, .TRUE., ierr)
223 call get_2d_netcdf("HGT_M", ncid, terrain, units, ix, jx, .TRUE., ierr)
227 if (SOLVEG_INITSWC.eq.0) then
228 ! ! Get Dominant Land Use categories (use)
229 ! call get_landuse_netcdf(ncid, xdum , units, ix, jx, land_cat)
230 ! vegtyp = nint(xdum)
232 var_name = "LU_INDEX"
233 call get2d_int(var_name,xdum_int,ix,jx,&
234 trim(geo_static_flnm))
237 ! Get Dominant Soil Type categories in the top layer (stl)
238 call get_soilcat_netcdf(ncid, xdum , units, ix, jx, soil_cat)
241 else if (SOLVEG_INITSWC.eq.1) then
243 call get2d_int(var_name,VEGTYP_inv,ix,jx,&
244 trim(geo_static_flnm))
247 call get2d_int(var_name,SOILTYP_inv,ix,jx,&
248 trim(geo_static_flnm))
252 VEGTYP(i,j)=VEGTYP_inv(i,jj)
253 SOLTYP(i,j)=SOILTYP_inv(i,jj)
260 ierr = NF_GET_ATT_INT(ncid, NF_GLOBAL, 'ISWATER', iswater)
262 call hydro_stop("In readland_hrldas() - Attribute ISWATER unable to be read from geo_static_flnm")
265 ierr = NF_GET_ATT_INT(ncid, NF_GLOBAL, 'ISOILWATER', isoilwater)
267 call hydro_stop("In readland_hrldas() - Attribute ISOILWATER unable to be read from geo_static_flnm")
270 ierr = NF_GET_ATT_INT(ncid, NF_GLOBAL, 'ISLAKE', islake)
272 call hydro_stop("In readland_hrldas() - Attribute ISLAKE unable to be read from geo_static_flnm")
275 ! Close the NetCDF file
276 ierr = nf_close(ncid)
278 print*, "MODULE_NOAHLSM_HRLDAS_INPUT: READLAND_HRLDAS: NF_CLOSE"
279 call hydro_stop("In readland_hrldas() - NF_CLOSE problem")
282 write(6, *) "readland_hrldas: ISLAKE ISWATER ISOILWATER", islake, iswater, isoilwater
284 ! Make sure vegtyp and soltyp are consistent when it comes to water points,
285 ! by setting soil category to water when vegetation category is water, and
287 where (vegtyp == islake) vegtyp = iswater
288 where (vegtyp == iswater) soltyp = isoilwater
289 where (soltyp == isoilwater) vegtyp = iswater
291 !DJG test for deep gw function...
292 ! where (soltyp <> 14) soltyp = 1
294 end subroutine readland_hrldas
297 subroutine get_2d_netcdf_ruc(var_name,ncid,var, &
298 ix,jx,tlevel,fatal_if_error,ierr)
299 character(len=*), intent(in) :: var_name
300 integer,intent(in) :: ncid,ix,jx,tlevel
301 real, intent(out):: var(ix,jx)
302 logical, intent(in) :: fatal_if_error
303 integer dims(4), dim_len(4)
306 integer start(4),count(4)
312 ierr = nf_inq_varid(ncid, var_name, varid)
315 if (fatal_IF_ERROR) then
316 print*, "MODULE_NOAHLSM_HRLDAS_INPUT: get_2d_netcdf_ruc:nf_inq_varid ", trim(var_name)
317 call hydro_stop("In get_2d_netcdf_ruc() - nf_inq_varid problem")
323 ierr = nf_get_vara_real(ncid, varid, start,count,var)
327 end subroutine get_2d_netcdf_ruc
330 subroutine get_2d_netcdf_cows(var_name,ncid,var, &
331 ix,jx,tlevel,fatal_if_error,ierr)
332 character(len=*), intent(in) :: var_name
333 integer,intent(in) :: ncid,ix,jx,tlevel
334 real, intent(out):: var(ix,jx)
335 logical, intent(in) :: fatal_if_error
338 integer start(4),count(4)
344 iret = nf_inq_varid(ncid, var_name, varid)
347 if (fatal_IF_ERROR) then
348 print*, "MODULE_NOAHLSM_HRLDAS_INPUT: get_2d_netcdf_cows:nf_inq_varid"
349 call hydro_stop("In get_2d_netcdf_cows() - nf_inq_varid problem")
355 iret = nf_get_vara_real(ncid, varid, start,count,var)
358 end subroutine get_2d_netcdf_cows
364 subroutine readinit_hrldas(netcdf_flnm, ix, jx, nsoil, target_date, &
365 smc, stc, sh2o, cmc, t1, weasd, snodep)
367 character(len=*), intent(in) :: netcdf_flnm
368 integer, intent(in) :: ix
369 integer, intent(in) :: jx
370 integer, intent(in) :: nsoil
371 character(len=*), intent(in) :: target_date
372 real, dimension(ix,jx,nsoil), intent(out) :: smc
373 real, dimension(ix,jx,nsoil), intent(out) :: stc
374 real, dimension(ix,jx,nsoil), intent(out) :: sh2o
375 real, dimension(ix,jx), intent(out) :: cmc
376 real, dimension(ix,jx), intent(out) :: t1
377 real, dimension(ix,jx), intent(out) :: weasd
378 real, dimension(ix,jx), intent(out) :: snodep
380 character(len=256) :: units
381 character(len=8) :: name
382 integer :: ix_read, jx_read,i,j
384 integer :: ierr, ncid, ierr_snodep
387 logical :: found_canwat, found_skintemp, found_weasd, found_stemp, found_smois
389 ! Open the NetCDF file.
390 ierr = nf_open(netcdf_flnm, NF_NOWRITE, ncid)
392 write(*,'("READINIT Problem opening netcdf file: ''", A, "''")') &
394 call hydro_stop("In readinit_hrldas()- Problem opening netcdf file")
397 call get_2d_netcdf("CANWAT", ncid, cmc, units, ix, jx, .TRUE., ierr)
398 call get_2d_netcdf("SKINTEMP", ncid, t1, units, ix, jx, .TRUE., ierr)
399 call get_2d_netcdf("WEASD", ncid, weasd, units, ix, jx, .TRUE., ierr)
401 if (trim(units) == "m") then
402 ! No conversion necessary
403 else if (trim(units) == "mm") then
404 ! convert WEASD from mm to m
405 weasd = weasd * 1.E-3
407 print*, 'units = "'//trim(units)//'"'
408 ! print*, "Unrecognized units on WEASD"
409 call hydro_stop("In readinit_hrldas() - Unrecognized units on WEASD")
412 call get_2d_netcdf("SNODEP", ncid, snodep, units, ix, jx, .FALSE., ierr_snodep)
413 call get_2d_netcdf("STEMP_1", ncid, stc(:,:,1), units, ix, jx, .TRUE., ierr)
414 call get_2d_netcdf("STEMP_2", ncid, stc(:,:,2), units, ix, jx, .TRUE., ierr)
415 call get_2d_netcdf("STEMP_3", ncid, stc(:,:,3), units, ix, jx, .TRUE., ierr)
416 call get_2d_netcdf("STEMP_4", ncid, stc(:,:,4), units, ix, jx, .TRUE., ierr)
417 call get_2d_netcdf("SMOIS_1", ncid, smc(:,:,1), units, ix, jx, .TRUE., ierr)
418 call get_2d_netcdf("SMOIS_2", ncid, smc(:,:,2), units, ix, jx, .TRUE., ierr)
419 call get_2d_netcdf("SMOIS_3", ncid, smc(:,:,3), units, ix, jx, .TRUE., ierr)
420 call get_2d_netcdf("SMOIS_4", ncid, smc(:,:,4), units, ix, jx, .TRUE., ierr)
423 if (ierr_snodep /= 0) then
424 ! Quick assumption regarding snow depth.
429 !DJG check for erroneous neg WEASD or SNOWD due to offline interpolation...
432 if (WEASD(i,j).lt.0.) WEASD(i,j)=0.0 !set lower bound to correct bi-lin interp err...
433 if (snodep(i,j).lt.0.) snodep(i,j)=0.0 !set lower bound to correct bi-lin interp err...
440 ierr = nf_close(ncid)
441 end subroutine readinit_hrldas
446 subroutine READFORC_HRLDAS(flnm,ix,jx,target_date, t,q,u,v,p,lw,sw,pcp,lai,fpar)
449 character(len=*), intent(in) :: flnm
450 integer, intent(in) :: ix
451 integer, intent(in) :: jx
452 character(len=*), intent(in) :: target_date
453 real, dimension(ix,jx), intent(out) :: t
454 real, dimension(ix,jx), intent(out) :: q
455 real, dimension(ix,jx), intent(out) :: u
456 real, dimension(ix,jx), intent(out) :: v
457 real, dimension(ix,jx), intent(out) :: p
458 real, dimension(ix,jx), intent(out) :: lw
459 real, dimension(ix,jx), intent(out) :: sw
460 real, dimension(ix,jx), intent(out) :: pcp
461 real, dimension(ix,jx), intent(inout) :: lai
462 real, dimension(ix,jx), intent(inout) :: fpar
464 character(len=256) :: units
468 ! Open the NetCDF file.
469 ierr = nf_open(trim(flnm), NF_NOWRITE, ncid)
471 write(*,'("READFORC Problem opening netcdf file: ''", A, "''")') trim(flnm)
472 call hydro_stop("In READFORC_HRLDAS() - Problem opening netcdf file")
475 call get_2d_netcdf("T2D", ncid, t, units, ix, jx, .TRUE., ierr)
476 call get_2d_netcdf("Q2D", ncid, q, units, ix, jx, .TRUE., ierr)
477 call get_2d_netcdf("U2D", ncid, u, units, ix, jx, .TRUE., ierr)
478 call get_2d_netcdf("V2D", ncid, v, units, ix, jx, .TRUE., ierr)
479 call get_2d_netcdf("PSFC", ncid, p, units, ix, jx, .TRUE., ierr)
480 call get_2d_netcdf("LWDOWN", ncid, lw, units, ix, jx, .TRUE., ierr)
481 call get_2d_netcdf("SWDOWN", ncid, sw, units, ix, jx, .TRUE., ierr)
482 call get_2d_netcdf("RAINRATE",ncid, pcp, units, ix, jx, .TRUE., ierr)
483 call get_2d_netcdf("VEGFRA", ncid, fpar, units, ix, jx, .FALSE., ierr)
485 if(maxval(fpar) .gt. 10 .and. maxval(fpar) .lt. 10000) fpar = fpar * 1.E-2
487 call get_2d_netcdf("LAI", ncid, lai, units, ix, jx, .FALSE., ierr)
489 ierr = nf_close(ncid)
491 end subroutine READFORC_HRLDAS
495 subroutine READFORC_DMIP(flnm,ix,jx,var)
498 character(len=*), intent(in) :: flnm
499 integer, intent(in) :: ix
500 integer, intent(in) :: jx
501 real, dimension(ix,jx), intent(out) :: var
502 character(len=13) :: head
503 integer :: ncols, nrows, cellsize
504 real :: xllc, yllc, no_data
506 character(len=256) ::junk
508 open (77,file=trim(flnm),form="formatted",status="old")
510 ! read(77,732) head,ncols
511 ! read(77,732) head,nrows
513 ! read(77,733) head,xllc
514 ! read(77,733) head,yllc
515 !733 FORMAT(A13,F16.9)
516 ! read(77,732) head,cellsize
517 ! read(77,732) head,no_data
527 read(77,*) (var(I,J),I=1,ix)
531 end subroutine READFORC_DMIP
535 subroutine READFORC_MDV(flnm,ix,jx,pcp,mmflag,ierr_flg)
538 character(len=*), intent(in) :: flnm
539 integer, intent(in) :: ix
540 integer, intent(in) :: jx
541 integer, intent(out) :: ierr_flg
542 integer :: it,jew,zsn
543 real, dimension(ix,jx), intent(out) :: pcp
545 character(len=256) :: units
546 integer :: ierr,i,j,i2,j2,varid
547 integer :: ncid,mmflag
548 real, dimension(ix,jx) :: temp
550 mmflag = 0 ! flag for units spec. (0=mm, 1=mm/s)
554 ierr_flg = nf_open(flnm, NF_NOWRITE, ncid)
555 if (ierr_flg /= 0) then
557 write(*,'("READFORC_MDV Problem opening netcdf file: ''",A,"''")') &
563 ierr = nf_inq_varid(ncid, "precip", varid)
564 if(ierr /= 0) ierr_flg = ierr
566 ierr = nf_inq_varid(ncid, "precip_rate", varid) !recheck variable name...
568 ierr = nf_inq_varid(ncid, "RAINRATE", varid) !recheck variable name...
571 write(*,'("READFORC_MDV Problem reading precip netcdf file: ''", A,"''")') &
579 ierr = nf_get_var_real(ncid, varid, pcp)
580 ierr = nf_close(ncid)
584 write(*,'("READFORC_MDV Problem reading netcdf file: ''", A,"''")') trim(flnm)
588 end subroutine READFORC_MDV
592 subroutine READFORC_NAMPCP(flnm,ix,jx,pcp,k,product)
595 character(len=*), intent(in) :: flnm
596 integer, intent(in) :: ix
597 integer, intent(in) :: jx
598 integer, intent(in) :: k
599 character(len=*), intent(in) :: product
600 integer :: it,jew,zsn
601 parameter(it = 496,jew = 449, zsn = 499) ! domain 1
602 ! parameter(it = 496,jew = 74, zsn = 109) ! domain 2
603 real, dimension(it,jew,zsn) :: buf
604 real, dimension(ix,jx), intent(out) :: pcp
606 character(len=256) :: units
607 integer :: ierr,i,j,i2,j2,varid
609 real, dimension(ix,jx) :: temp
611 ! varname = trim(product)
615 ierr = nf_open(flnm, NF_NOWRITE, ncid)
617 write(*,'("READFORC_NAMPCP1 Problem opening netcdf file: ''",A, "''")') &
619 call hydro_stop("In READFORC_NAMPCP() - Problem opening netcdf file")
622 ierr = nf_inq_varid(ncid, trim(product), varid)
623 ierr = nf_get_var_real(ncid, varid, buf)
624 ierr = nf_close(ncid)
627 write(*,'("READFORC_NAMPCP2 Problem reading netcdf file: ''", A,"''")') &
629 call hydro_stop("In READFORC_NAMPCP() - Problem reading netcdf file")
633 print *, "Data read in...",it,ix,jx,k
636 ! Extract single time slice from dataset...
640 pcp(i,j) = buf(k,i,j)
644 ! call get_2d_netcdf_ruc("trmm",ncid, pcp, jx, ix,k, .true., ierr)
646 end subroutine READFORC_NAMPCP
651 subroutine READFORC_COWS(flnm,ix,jx,target_date, t,q,u,p,lw,sw,pcp,tlevel)
654 character(len=*), intent(in) :: flnm
655 integer, intent(in) :: ix
656 integer, intent(in) :: jx
657 character(len=*), intent(in) :: target_date
658 real, dimension(ix,jx), intent(out) :: t
659 real, dimension(ix,jx), intent(out) :: q
660 real, dimension(ix,jx), intent(out) :: u
661 real, dimension(ix,jx) :: v
662 real, dimension(ix,jx), intent(out) :: p
663 real, dimension(ix,jx), intent(out) :: lw
664 real, dimension(ix,jx), intent(out) :: sw
665 real, dimension(ix,jx), intent(out) :: pcp
668 character(len=256) :: units
672 ! Open the NetCDF file.
673 ierr = nf_open(flnm, NF_NOWRITE, ncid)
675 write(*,'("READFORC_COWS Problem opening netcdf file: ''", A, "''")') trim(flnm)
676 call hydro_stop("In READFORC_COWS() - Problem opening netcdf file")
679 call get_2d_netcdf_cows("TA2", ncid, t, ix, jx,tlevel, .TRUE., ierr)
680 call get_2d_netcdf_cows("QV2", ncid, q, ix, jx,tlevel, .TRUE., ierr)
681 call get_2d_netcdf_cows("WSPD10", ncid, u, ix, jx,tlevel, .TRUE., ierr)
682 call get_2d_netcdf_cows("PRES", ncid, p, ix, jx,tlevel, .TRUE., ierr)
683 call get_2d_netcdf_cows("GLW", ncid, lw, ix, jx,tlevel, .TRUE., ierr)
684 call get_2d_netcdf_cows("RSD", ncid, sw, ix, jx,tlevel, .TRUE., ierr)
685 call get_2d_netcdf_cows("RAIN", ncid, pcp, ix, jx,tlevel, .TRUE., ierr)
686 !yw call get_2d_netcdf_cows("V2D", ncid, v, ix, jx,tlevel, .TRUE., ierr)
688 ierr = nf_close(ncid)
690 end subroutine READFORC_COWS
695 subroutine READFORC_RUC(flnm,ix,jx,target_date,t,q,u,v,p,lw,sw,pcp)
699 character(len=*), intent(in) :: flnm
700 integer, intent(in) :: ix
701 integer, intent(in) :: jx
702 character(len=*), intent(in) :: target_date
703 real, dimension(ix,jx) :: t,q,u,v,p,lw,sw,pcp,pcpc
706 character(len=256) :: units
712 ! Open the NetCDF file.
713 ierr = nf_open(flnm, NF_NOWRITE, ncid)
715 write(*,'("READFORC_RUC Problem opening netcdf file: ''", A, "''")') trim(flnm)
716 call hydro_stop("In READFORC_RUC() - Problem opening netcdf file")
719 call get_2d_netcdf_ruc("T2", ncid, t, ix, jx,tlevel, .true., ierr)
720 call get_2d_netcdf_ruc("Q2", ncid, q, ix, jx,tlevel, .true., ierr)
721 call get_2d_netcdf_ruc("U10", ncid, u, ix, jx,tlevel, .true., ierr)
722 call get_2d_netcdf_ruc("V10", ncid, v, ix, jx,tlevel, .true., ierr)
723 call get_2d_netcdf_ruc("PSFC", ncid, p, ix, jx,tlevel, .true., ierr)
724 call get_2d_netcdf_ruc("GLW", ncid, lw, ix, jx,tlevel, .true., ierr)
725 call get_2d_netcdf_ruc("SWDOWN", ncid, sw, ix, jx,tlevel, .true., ierr)
726 call get_2d_netcdf_ruc("RAINC", ncid, pcpc, ix, jx,tlevel, .true., ierr)
727 call get_2d_netcdf_ruc("RAINNC", ncid, pcp, ix, jx,tlevel, .true., ierr)
729 ierr = nf_close(ncid)
732 !DJG Add the convective and non-convective rain components (note: conv. comp=0
733 !for cloud resolving runs...)
734 !DJG Note that for RUC these are accumulated values to be adjusted to rates in
737 pcp=pcp+pcpc ! assumes pcpc=0 for resolved convection...
739 end subroutine READFORC_RUC
744 subroutine READSNOW_FORC(flnm,ix,jx,weasd,snodep)
747 character(len=*), intent(in) :: flnm
748 integer, intent(in) :: ix
749 integer, intent(in) :: jx
750 real, dimension(ix,jx), intent(out) :: weasd
751 real, dimension(ix,jx), intent(out) :: snodep
752 real, dimension(ix,jx) :: tmp
754 character(len=256) :: units
758 ! Open the NetCDF file.
760 ierr = nf_open(flnm, NF_NOWRITE, ncid)
762 write(*,'("READSNOW Problem opening netcdf file: ''", A, "''")') trim(flnm)
763 call hydro_stop("In READSNOW_FORC() - Problem opening netcdf file")
766 call get_2d_netcdf("WEASD", ncid, tmp, units, ix, jx, .FALSE., ierr)
768 call get_2d_netcdf("SNOW", ncid, tmp, units, ix, jx, .FALSE., ierr)
771 print *, "read WEASD from wrfoutput ...... "
776 if (trim(units) == "m") then
777 ! No conversion necessary
778 else if (trim(units) == "mm") then
779 ! convert WEASD from mm to m
780 weasd = weasd * 1.E-3
785 print *, "!!!!! NO WEASD present in input file...initialize to 0."
788 call get_2d_netcdf("SNODEP", ncid, tmp, units, ix, jx, .FALSE., ierr)
790 ! Quick assumption regarding snow depth.
791 call get_2d_netcdf("SNOWH", ncid, tmp, units, ix, jx, .FALSE., ierr)
793 print *, "read snow depth from wrfoutput ... "
801 ! Quick assumption regarding snow depth.
802 !yw snodep = weasd * 10.
803 where(snodep .lt. weasd) snodep = weasd*10 !set lower bound to correct bi-lin interp err...
806 !DJG check for erroneous neg WEASD or SNOWD due to offline interpolation...
807 where(snodep .lt. 0) snodep = 0
808 where(weasd .lt. 0) weasd = 0
809 ierr = nf_close(ncid)
811 end subroutine READSNOW_FORC
813 subroutine get2d_hrldas(inflnm,ix,jx,nsoil,smc,stc,sh2ox,cmc,t1,weasd,snodep)
815 integer :: iret,varid,ncid,ix,jx,nsoil,ierr
816 real,dimension(ix,jx):: weasd,snodep,cmc,t1
817 real,dimension(ix,jx,nsoil):: smc,stc,sh2ox
818 character(len=*), intent(in) :: inflnm
819 character(len=256):: units
820 iret = nf_open(trim(inflnm), NF_NOWRITE, ncid)
822 write(6,*) "Error: failed to open file :",trim(inflnm)
823 call hydro_stop("In get2d_hrldas() - failed to open file")
826 call get2d_hrldas_real("CMC", ncid, cmc, ix, jx)
827 call get2d_hrldas_real("TSKIN", ncid, t1, ix, jx)
828 call get2d_hrldas_real("SWE", ncid, weasd, ix, jx)
829 call get2d_hrldas_real("SNODEP", ncid, snodep, ix, jx)
831 call get2d_hrldas_real("SOIL_T_1", ncid, stc(:,:,1), ix, jx)
832 call get2d_hrldas_real("SOIL_T_2", ncid, stc(:,:,2), ix, jx)
833 call get2d_hrldas_real("SOIL_T_3", ncid, stc(:,:,3), ix, jx)
834 call get2d_hrldas_real("SOIL_T_4", ncid, stc(:,:,4), ix, jx)
835 call get2d_hrldas_real("SOIL_T_5", ncid, stc(:,:,5), ix, jx)
836 call get2d_hrldas_real("SOIL_T_6", ncid, stc(:,:,6), ix, jx)
837 call get2d_hrldas_real("SOIL_T_7", ncid, stc(:,:,7), ix, jx)
838 call get2d_hrldas_real("SOIL_T_8", ncid, stc(:,:,8), ix, jx)
840 call get2d_hrldas_real("SOIL_M_1", ncid, SMC(:,:,1), ix, jx)
841 call get2d_hrldas_real("SOIL_M_2", ncid, SMC(:,:,2), ix, jx)
842 call get2d_hrldas_real("SOIL_M_3", ncid, SMC(:,:,3), ix, jx)
843 call get2d_hrldas_real("SOIL_M_4", ncid, SMC(:,:,4), ix, jx)
844 call get2d_hrldas_real("SOIL_M_5", ncid, SMC(:,:,5), ix, jx)
845 call get2d_hrldas_real("SOIL_M_6", ncid, SMC(:,:,6), ix, jx)
846 call get2d_hrldas_real("SOIL_M_7", ncid, SMC(:,:,7), ix, jx)
847 call get2d_hrldas_real("SOIL_M_8", ncid, SMC(:,:,8), ix, jx)
849 call get2d_hrldas_real("SOIL_W_1", ncid, SH2OX(:,:,1), ix, jx)
850 call get2d_hrldas_real("SOIL_W_2", ncid, SH2OX(:,:,2), ix, jx)
851 call get2d_hrldas_real("SOIL_W_3", ncid, SH2OX(:,:,3), ix, jx)
852 call get2d_hrldas_real("SOIL_W_4", ncid, SH2OX(:,:,4), ix, jx)
853 call get2d_hrldas_real("SOIL_W_5", ncid, SH2OX(:,:,5), ix, jx)
854 call get2d_hrldas_real("SOIL_W_6", ncid, SH2OX(:,:,6), ix, jx)
855 call get2d_hrldas_real("SOIL_W_7", ncid, SH2OX(:,:,7), ix, jx)
856 call get2d_hrldas_real("SOIL_W_8", ncid, SH2OX(:,:,8), ix, jx)
858 iret = nf_close(ncid)
860 end subroutine get2d_hrldas
862 subroutine get2d_hrldas_real(var_name,ncid,out_buff,ix,jx)
864 integer ::iret,varid,ncid,ix,jx
866 character(len=*), intent(in) :: var_name
867 iret = nf_inq_varid(ncid,trim(var_name), varid)
868 iret = nf_get_var_real(ncid, varid, out_buff)
870 end subroutine get2d_hrldas_real
872 subroutine read_stage4(flnm,IX,JX,pcp)
873 integer IX,JX,ierr,ncid,i,j
874 real pcp(IX,JX),buf(ix,jx)
875 character(len=*), intent(in) :: flnm
876 character(len=256) :: units
878 ierr = nf_open(flnm, NF_NOWRITE, ncid)
881 call hydro_stop("In read_stage4() - failed to open stage4 file.")
884 call get_2d_netcdf("RAINRATE",ncid, buf, units, ix, jx, .TRUE., ierr)
885 ierr = nf_close(ncid)
888 if(buf(i,j) .lt. 0) then
895 END subroutine read_stage4
900 subroutine read_hydro_forcing_seq( &
901 indir,olddate,hgrid, &
902 ix,jx,forc_typ,snow_assim, &
903 T2,q2x,u,v,pres,xlong,short,prcp1,&
904 lai,fpar,snodep,dt,k,prcp_old)
905 ! This subrouting is going to read different forcing.
908 character(len=*) :: olddate,hgrid,indir
909 character(len=256) :: filename
910 integer :: ix,jx,forc_typ,k,snow_assim ! k is time loop
911 real,dimension(ix,jx):: T2,q2x,u,v,pres,xlong,short,prcp1,&
912 prcpnew,weasd,snodep,prcp0,prcp2,prcp_old
915 character(len=256) :: inflnm, inflnm2, product
916 integer :: i,j,mmflag,ierr_flg
917 real,dimension(ix,jx):: lai,fpar
918 character(len=4) nwxst_t
921 inflnm = trim(indir)//"/"//&
922 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
923 ".LDASIN_DOMAIN"//hgrid
925 !!!DJG... Call READFORC_(variable) Subroutine for forcing data...
926 !!!DJG HRLDAS Format Forcing with hour format filename (NOTE: precip must be in mm/s!!!)
927 if(FORC_TYP.eq.1) then
928 !!Create forcing data filename...
929 call geth_newdate(out_date,olddate,nint(dt))
930 inflnm = trim(indir)//"/"//&
931 out_date(1:4)//out_date(6:7)//out_date(9:10)//out_date(12:13)//&
932 ".LDASIN_DOMAIN"//hgrid
934 inquire (file=trim(inflnm), exist=fexist)
935 if ( .not. fexist ) then
936 print*, "no forcing data found", inflnm
937 call hydro_stop("In read_hydro_forcing_seq")
940 CALL READFORC_HRLDAS(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
941 PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
947 !!!DJG HRLDAS Forcing with minute format filename (NOTE: precip must be in mm/s!!!)
948 if(FORC_TYP.eq.2) then
949 !!Create forcing data filename...
950 call geth_newdate(out_date,olddate,nint(dt))
951 inflnm = trim(indir)//"/"//&
952 out_date(1:4)//out_date(6:7)//out_date(9:10)//out_date(12:13)//&
953 out_date(15:16)//".LDASIN_DOMAIN"//hgrid
954 inquire (file=trim(inflnm), exist=fexist)
955 if ( .not. fexist ) then
956 print*, "no forcing data found", inflnm
957 call hydro_stop("In read_hydro_forcing_seq() - no forcing data found")
959 CALL READFORC_HRLDAS(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
960 PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
967 !!!DJG WRF Output File Direct Ingest Forcing...
968 if(FORC_TYP.eq.3) then
969 !!Create forcing data filename...
970 inflnm = trim(indir)//"/"//&
971 "wrfout_d0"//hgrid//"_"//&
972 olddate(1:4)//"-"//olddate(6:7)//"-"//olddate(9:10)//&
973 "_"//olddate(12:13)//":00:00"
975 inquire (file=trim(inflnm), exist=fexist)
976 if ( .not. fexist ) then
977 print*, "no forcing data found", inflnm
978 call hydro_stop("In read_hydro_forcing_seq() - no forcing data found")
981 do i_forcing = 1, int(24*3600/dt)
982 wrf_dt = i_forcing*dt
983 call geth_newdate(out_date,olddate,nint(wrf_dt))
984 inflnm2 = trim(indir)//"/"//&
985 "wrfout_d0"//hgrid//"_"//&
986 out_date(1:4)//"-"//out_date(6:7)//"-"//out_date(9:10)//&
987 "_"//out_date(12:13)//":00:00"
988 inquire (file=trim(inflnm2), exist=fexist)
989 if (fexist ) goto 991
993 if(.not. fexist) then
994 write(6,*) "FATAL ERROR: could not find file ",trim(inflnm2)
995 call hydro_stop("In read_hydro_forcing_seq() - could not find file ")
998 print*, "read WRF forcing data: ", trim(inflnm)
999 print*, "read WRF forcing data: ", trim(inflnm2)
1001 CALL READFORC_WRF(inflnm2,IX,JX,OLDDATE,T2,Q2X,U,V, &
1002 PRES,XLONG,SHORT,PRCPnew,lai,fpar)
1003 CALL READFORC_WRF(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
1004 PRES,XLONG,SHORT,prcp0,lai,fpar)
1005 PRCP1=(PRCPnew-prcp0)/wrf_dt !Adjustment to convert accum to rate...(mm/s)
1009 !!!DJG CONSTant, idealized forcing...
1010 if(FORC_TYP.eq.4) then
1011 ! Impose a fixed diurnal cycle...
1012 ! assumes model timestep is 1 hr
1013 ! assumes K=1 is 12z (Ks or ~ sunrise)
1016 PRCP1 =25.4/3600.0 !units mm/s (Simulates 1"/hr for first time step...)
1017 ! PRCP1 =0./3600.0 !units mm/s (Simulates <1"/hr for first 10 hours...)
1018 ELSEIF (K.GT.1) THEN
1019 ! PRCP1 =0./3600.0 !units mm/s
1024 ! PRCP1 =10./3600.0 !units mm/s
1025 ! Other Met. Vars...
1026 T2=290.0 + 3.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
1031 XLONG=400.0 + 25.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
1032 SHORT=450.0 + 450.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
1034 ! print *, "PCP", PRCP1
1038 !!!DJG Idealized Met. w/ Specified Precip. Forcing Data...(Note: input precip units here are in 'mm/hr')
1039 ! This option uses hard-wired met forcing EXCEPT precipitation which is read in
1040 ! from a single, separate input file called 'YYYYMMDDHHMM.PRECIP_FORCING.nc'
1042 if(FORC_TYP.eq.5) then
1043 ! Standard Met. Vars...
1044 T2=290.0 + 3.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
1049 XLONG=400.0 + 25.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
1050 SHORT=450.0 + 450.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
1052 !Get specified precip....
1053 !!!VIP, dimensions of grid are currently hardwired in input subroutine!!!
1055 ! inflnm = trim(indir)//"/"//"sat_domain1.nc"
1056 !!Create forcing data filename...
1057 inflnm = trim(indir)//"/"//&
1058 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1059 olddate(15:16)//".PRECIP_FORCING.nc"
1060 inquire (file=trim(inflnm), exist=fexist)
1061 if ( .not. fexist ) then
1062 print*, "no specified precipitation data found", inflnm
1063 call hydro_stop("In read_hydro_forcing_seq() - no specified precipitation data found")
1070 print *, "Opening supplemental precipitation forcing file...",inflnm
1072 CALL READFORC_MDV(inflnm,IX,JX, &
1073 PRCP2,mmflag,ierr_flg)
1075 !If radar or spec. data is ok use if not, skip to original NARR data...
1076 IF (ierr_flg.eq.0) then ! use spec. precip
1077 !Convert units if necessary
1078 IF (mmflag.eq.0) then !Convert pcp grid to units of mm/s...
1079 PRCP1=PRCP2/DT !convert from mm to mm/s
1081 print*, "Supplemental pcp is accumulated pcp/dt. "
1084 PRCP1=PRCP2 !assumes PRCP2 is in mm/s
1086 print*, "Supplemental pcp is rate. "
1088 END IF ! Endif mmflag
1089 ELSE ! either stop or default to original forcing data...
1091 print *,"Current RADAR precip data not found !!! Using previous available file..."
1094 END IF ! Endif ierr_flg
1096 ! Loop through data to screen for plausible values
1099 if (PRCP1(i,j).lt.0.) PRCP1(i,j)= PRCP_old(i,j)
1100 if (PRCP1(i,j).gt.0.138889) PRCP1(i,j)=0.138889 !set max pcp intens = 500 mm/h
1110 !!!DJG HRLDAS Forcing with hourly format filename with specified precipitation forcing...
1111 ! This option uses HRLDAS-formatted met forcing EXCEPT precipitation which is read in
1112 ! from a single, separate input file called 'YYYYMMDDHHMM.PRECIP_FORCING.nc'
1114 if(FORC_TYP.eq.6) then
1116 !!Create forcing data filename...
1117 inflnm = trim(indir)//"/"//&
1118 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1119 ".LDASIN_DOMAIN"//hgrid
1121 inquire (file=trim(inflnm), exist=fexist)
1123 if ( .not. fexist ) then
1124 do i_forcing = 1, nint(12*3600/dt)
1125 call geth_newdate(out_date,olddate,nint(i_forcing*dt))
1126 inflnm = trim(indir)//"/"//&
1127 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1128 olddate(15:16)//".LDASIN_DOMAIN"//hgrid
1129 inquire (file=trim(inflnm), exist=fexist)
1136 if ( .not. fexist ) then
1138 print*, "no ATM forcing data found at this time", inflnm
1142 print*, "reading forcing data at this time", inflnm
1145 CALL READFORC_HRLDAS(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
1146 PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
1147 PRCP_old = PRCP1 ! This assigns new precip to last precip as a fallback for missing data...
1151 !Get specified precip....
1152 !!!VIP, dimensions of grid are currently hardwired in input subroutine!!!
1153 !!Create forcing data filename...
1154 inflnm = trim(indir)//"/"//&
1155 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1156 olddate(15:16)//".PRECIP_FORCING.nc"
1157 inquire (file=trim(inflnm), exist=fexist)
1160 print*, "using specified pcp forcing: ",trim(inflnm)
1162 print*, "no specified pcp forcing: ",trim(inflnm)
1165 if ( .not. fexist ) then
1166 prcp1 = PRCP_old ! for missing pcp data use analysis/model input
1168 CALL READFORC_MDV(inflnm,IX,JX, &
1169 PRCP2,mmflag,ierr_flg)
1170 !If radar or spec. data is ok use if not, skip to original NARR data...
1171 if(ierr_flg .ne. 0) then
1173 print*, "WARNING: pcp reading problem: ", trim(inflnm)
1177 PRCP1=PRCP2 !assumes PRCP2 is in mm/s
1178 IF (mmflag.eq.0) then !Convert pcp grid to units of mm/s...
1179 PRCP1=PRCP2/DT !convert from mm to mm/s
1180 END IF ! Endif mmflag
1182 print*, "replace pcp successfully! ",trim(inflnm)
1188 ! Loop through data to screen for plausible values
1189 where(PRCP1 .lt. 0) PRCP1=PRCP_old
1190 where(PRCP1 .gt. 10 ) PRCP1= PRCP_old
1193 if (PRCP1(i,j).lt.0.) PRCP1(i,j)=0.0
1194 if (PRCP1(i,j).gt.0.138889) PRCP1(i,j)=0.138889 !set max pcp intens = 500 mm/h
1201 !!!! FORC_TYP 7: uses WRF forcing data plus additional pcp forcing.
1203 if(FORC_TYP.eq.7) then
1205 !!Create forcing data filename...
1206 inflnm = trim(indir)//"/"//&
1207 "wrfout_d0"//hgrid//"_"//&
1208 olddate(1:4)//"-"//olddate(6:7)//"-"//olddate(9:10)//&
1209 "_"//olddate(12:13)//":00:00"
1211 inquire (file=trim(inflnm), exist=fexist)
1214 if ( .not. fexist ) then
1216 print*, "no forcing data found", inflnm
1219 do i_forcing = 1, int(24*3600/dt)
1220 wrf_dt = i_forcing*dt
1221 call geth_newdate(out_date,olddate,nint(wrf_dt))
1222 inflnm2 = trim(indir)//"/"//&
1223 "wrfout_d0"//hgrid//"_"//&
1224 out_date(1:4)//"-"//out_date(6:7)//"-"//out_date(9:10)//&
1225 "_"//out_date(12:13)//":00:00"
1226 inquire (file=trim(inflnm2), exist=fexist)
1227 if (fexist ) goto 992
1232 print*, "read WRF forcing data: ", trim(inflnm)
1233 print*, "read WRF forcing data: ", trim(inflnm2)
1235 CALL READFORC_WRF(inflnm2,IX,JX,OLDDATE,T2,Q2X,U,V, &
1236 PRES,XLONG,SHORT,PRCPnew,lai,fpar)
1237 CALL READFORC_WRF(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
1238 PRES,XLONG,SHORT,prcp0,lai,fpar)
1239 PRCP1=(PRCPnew-prcp0)/wrf_dt !Adjustment to convert accum to rate...(mm/s)
1243 !Get specified precip....
1244 !!!VIP, dimensions of grid are currently hardwired in input subroutine!!!
1245 !!Create forcing data filename...
1246 inflnm = trim(indir)//"/"//&
1247 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1248 olddate(15:16)//".PRECIP_FORCING.nc"
1249 inquire (file=trim(inflnm), exist=fexist)
1252 print*, "using specified pcp forcing: ",trim(inflnm)
1254 print*, "no specified pcp forcing: ",trim(inflnm)
1257 if ( .not. fexist ) then
1258 prcp1 = PRCP_old ! for missing pcp data use analysis/model input
1260 CALL READFORC_MDV(inflnm,IX,JX, &
1261 PRCP2,mmflag,ierr_flg)
1262 !If radar or spec. data is ok use if not, skip to original NARR data...
1263 if(ierr_flg .ne. 0) then
1265 print*, "WARNING: pcp reading problem: ", trim(inflnm)
1269 PRCP1=PRCP2 !assumes PRCP2 is in mm/s
1270 IF (mmflag.eq.0) then !Convert pcp grid to units of mm/s...
1272 write(6,*) "using supplemental pcp time interval ", DT
1274 PRCP1=PRCP2/DT !convert from mm to mm/s
1277 write(6,*) "using supplemental pcp rates "
1279 END IF ! Endif mmflag
1281 print*, "replace pcp successfully! ",trim(inflnm)
1287 ! Loop through data to screen for plausible values
1288 where(PRCP1 .lt. 0) PRCP1=PRCP_old
1289 where(PRCP1 .gt. 10 ) PRCP1= PRCP_old ! set maximum to be 500 mm/h
1290 where(PRCP1 .gt. 0.138889) PRCP1= 0.138889 ! set maximum to be 500 mm/h
1293 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1294 !!!The other forcing data types below here are obsolete and left for reference...
1295 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1297 !!!DJG HRLDAS Single Input with Multiple Input Times File Forcing...
1298 ! if(FORC_TYP.eq.6) then
1299 !!Create forcing data filename...
1300 ! if (len_trim(range) == 0) then
1301 ! inflnm = trim(indir)//"/"//&
1302 ! startdate(1:4)//startdate(6:7)//startdate(9:10)//startdate(12:13)//&
1303 ! olddate(15:16)//".LDASIN_DOMAIN"//hgrid//"_multiple"
1304 !! "MET_LIS_CRO_2D_SANTEE_LU_1KM."//&
1305 !! ".156hrfcst.radar"
1308 ! CALL READFORC_HRLDAS_mult(inflnm,IX,JX,OLDDATE,T2,Q2X,U, &
1309 ! PRES,XLONG,SHORT,PRCP1,K)
1311 !! IF (K.GT.0.AND.K.LT.10) THEN
1312 !! PRCP1 = 10.0/3600.0 ! units mm/s
1313 !! PRCP1 = 0.254/3600.0
1321 !!!!!DJG NARR Met. w/ NARR Precip. Forcing Data...
1322 !! Assumes standard 3-hrly NARR data has been resampled to NDHMS grid...
1323 !! Assumes one 3hrly time-step per forcing data file
1324 !! Input precip units here are in 'mm' accumulated over 3 hrs...
1325 ! if(FORC_TYP.eq.7) then !NARR Met. w/ NARR Precip.
1326 !!!Create forcing data filename...
1327 ! if (len_trim(range) == 0) then
1328 ! inflnm = trim(indir)//"/"//&
1329 ! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1330 ! ".LDASIN_DOMAIN"//hgrid
1332 ! inflnm = trim(indir)//"/"//&
1333 ! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1334 ! ".LDASIN_DOMAIN"//hgrid//"."//trim(range)
1336 ! CALL READFORC_HRLDAS(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
1337 ! PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
1338 ! PRCP1=PRCP1/(3.0*3600.0) ! convert from 3hr accum to mm/s which is what NDHMS expects
1339 ! end if !NARR Met. w/ NARR Precip.
1346 !!!!DJG NARR Met. w/ Specified Precip. Forcing Data...
1347 ! if(FORC_TYP.eq.8) then !NARR Met. w/ Specified Precip.
1349 !!Check to make sure if Noah time step is 3 hrs as is NARR...
1353 ! if(K.eq.1.OR.(MOD((K-1)*INT(DT),10800)).eq.0) then !if/then 3 hr check
1354 !!!Create forcing data filename...
1355 ! if (len_trim(range) == 0) then
1356 ! inflnm = trim(indir)//"/"//&
1357 ! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1358 ! ".LDASIN_DOMAIN"//hgrid
1359 !! startdate(1:4)//startdate(6:7)//startdate(9:10)//startdate(12:13)//&
1362 ! inflnm = trim(indir)//"/"//&
1363 ! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1364 ! ".LDASIN_DOMAIN"//hgrid//"."//trim(range)
1366 ! CALL READFORC_HRLDAS(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
1367 ! PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
1368 !! PRCP1=PRCP1/(3.0*3600.0) !NARR 3hrly precip product in mm
1369 ! PRCP1=PRCP1 !NAM model data in mm/s
1370 ! end if !3 hr check
1373 !!Get spec. precip....
1374 !! NAM Remote sensing...
1375 !!!!VIP, dimensions of grid are currently hardwired in input subroutine!!!
1377 !! inflnm = trim(indir)//"/"//"sat_domain1.nc"
1378 !!! inflnm = trim(indir)//"/"//"sat_domain2.nc"
1380 !! CALL READFORC_NAMPCP(inflnm,IX,JX, &
1384 !!!Convert pcp grid to units of mm/s...
1385 !! PRCP1=PRCP1/(3.0*3600.0) !3hrly precip product
1387 !!Read from filelist (NAME HE...,others)...
1389 !! open(unit=93,file="filelist.txt",form="formatted",status="old")
1391 !! read (93,*) filename
1392 !! inflnm = trim(indir)//"/"//trim(filename)
1395 !!Front Range MDV Radar...
1397 !! inflnm = "/ptmp/weiyu/rt_2008/radar_obs/"//&
1398 !! inflnm = "/d3/hydrolab/HRLDAS_forcing/FRNG_research/20080809/"//&
1399 !! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1400 !! olddate(15:16)//"_radar.nc"
1401 !! olddate(15:16)//"_chill.nc"
1403 !! inflnm = "/d2/hydrolab/HRLDAS/forcing/FRNG/Big_Thomp_04/"//&
1404 !! inflnm = "/d2/hydrolab/HRLDAS/forcing/FRNG/RT_2008/radar_obs/"//&
1405 !! inflnm = "/d3/hydrolab/HRLDAS_forcing/FRNG_research/20080809/"//&
1406 ! inflnm = trim(indir)//"/"//&
1407 ! olddate(1:4)//olddate(6:7)//olddate(9:10)//"_"//olddate(12:13)//&
1408 !! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1409 !! olddate(15:16)//"00_Pcp60min.nc"
1410 !! olddate(15:16)//"00_Pcp30min.nc"
1411 !! olddate(15:16)//"00_30min.nc"
1412 ! olddate(15:16)//"00_Pcp5min.nc"
1413 !! olddate(15:16)//"_chill.nc"
1415 !! inflnm = "/d2/hydrolab/HRLDAS/forcing/COWS/"//&
1416 !! olddate(1:4)//olddate(6:7)//olddate(9:10)//"_"//olddate(12:13)//&
1417 !! olddate(15:16)//"00_Pcp5min.nc"
1418 !! olddate(15:16)//"00_5.nc"
1420 !! inflnm = "" ! use this for NAM frxst runs with 30 min time-step
1424 !! if (K.le.6) then ! use for 30min nowcast...
1426 !! open(unit=94,file="start_file.txt",form="formatted",status="replace")
1427 !!! inflnm2 = "/d2/hydrolab/HRLDAS/forcing/FRNG/RT_2008/radar_obs/"//&
1428 !! inflnm2 = "/d3/hydrolab/HRLDAS_forcing/FRNG_research/"//&
1429 !! olddate(1:4)//olddate(6:7)//olddate(9:10)//"_"//olddate(12:13)//&
1430 !! olddate(15:16)//"00_"
1432 !! nwxst_t = "5"! calc minutes from timestep and convert to char...
1433 !! inflnm = trim(inflnm2)//trim(nwxst_t)//".nc"
1436 !! nwxst_t = "10" ! calc minutes from timestep and convert to char...
1437 !! open(unit=94,file="start_file.txt",form="formatted",status="old")
1438 !! read (94,*) inflnm2
1440 !! inflnm = trim(inflnm2)//trim(nwxst_t)//".nc"
1443 !! nwxst_t = "15" ! calc minutes from timestep and convert to char...
1444 !! open(unit=94,file="start_file.txt",form="formatted",status="old")
1445 !! read (94,*) inflnm
1447 !! inflnm = trim(inflnm2)//trim(nwxst_t)//".nc"
1450 !! nwxst_t = "20" ! calc minutes from timestep and convert to char...
1451 !! open(unit=94,file="start_file.txt",form="formatted",status="old")
1452 !! read (94,*) inflnm
1454 !! inflnm = trim(inflnm2)//trim(nwxst_t)//".nc"
1457 !! nwxst_t = "25" ! calc minutes from timestep and convert to char...
1458 !! open(unit=94,file="start_file.txt",form="formatted",status="old")
1459 !! read (94,*) inflnm
1461 !! inflnm = trim(inflnm2)//trim(nwxst_t)//".nc"
1464 !! nwxst_t = "30" ! calc minutes from timestep and convert to char...
1465 !! open(unit=94,file="start_file.txt",form="formatted",status="old")
1466 !! read (94,*) inflnm
1468 !! inflnm = trim(inflnm2)//trim(nwxst_t)//".nc"
1471 !! inflnm = "" ! use this for NAM frxst runs with 30 min time-step
1474 !! olddate(1:4)//olddate(6:7)//olddate(9:10)//"_"//olddate(12:13)//&
1475 !! olddate(15:16)//"00_Pcp30minMerge.nc"
1477 ! CALL READFORC_MDV(inflnm,IX,JX, &
1478 ! PRCP2,mmflag,ierr_flg)
1480 !!If radar or spec. data is ok use if not, skip to original NARR data...
1481 ! IF (ierr_flg.eq.0) then ! use spec. precip
1482 ! PRCP1=PRCP2 !assumes PRCP2 is in mm/s
1483 !!Convert units if necessary
1484 ! IF (mmflag.eq.0) then !Convert pcp grid to units of mm/s...
1485 ! PRCP1=PRCP2/DT !convert from mm to mm/s
1486 ! END IF ! Endif mmflag
1487 ! ELSE ! either stop or default to original forcing data...
1489 ! END IF ! Endif ierr_flg
1491 !! Loop through data to screen for plausible values
1494 ! if (PRCP1(i,j).lt.0.) PRCP1(i,j)=0.0
1495 ! if (PRCP1(i,j).gt.0.0555) PRCP1(i,j)=0.0555 !set max pcp intens = 200 mm/h
1497 !! PRCP1(i,j) = 0.02 !override w/ const. precip for gw testing only...
1501 !! if (K.eq.1) then ! quick dump for site specific precip...
1502 ! open(unit=94,file="Christman_accumpcp.txt",form="formatted",status="new")
1506 ! end if !NARR Met. w/ Specified Precip.
1512 !!!!DJG NLDAS Met. w/ NLDAS Precip. Forcing Data...
1513 !! Assumes standard hrly NLDAS data has been resampled to NDHMS grid...
1514 !! Assumes one 1-hrly time-step per forcing data file
1515 !! Input precip units here are in 'mm' accumulated over 1 hr...
1516 ! if(FORC_TYP.eq.9) then !NLDAS Met. w/ NLDAS Precip.
1517 !!!Create forcing data filename...
1518 ! if (len_trim(range) == 0) then
1519 ! inflnm = trim(indir)//"/"//&
1520 ! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1521 !!Use this for minute forcing... olddate(15:16)//".LDASIN_DOMAIN"//hgrid
1522 ! ".LDASIN_DOMAIN"//hgrid
1524 ! inflnm = trim(indir)//"/"//&
1525 ! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1526 ! ".LDASIN_DOMAIN"//hgrid//"."//trim(range)
1528 ! CALL READFORC_HRLDAS(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
1529 ! PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
1530 ! PRCP1=PRCP1/(1.0*3600.0) ! convert hourly NLDAS hourly accum pcp to mm/s which is what NDHMS expects
1531 ! end if !NLDAS Met. w/ NLDAS Precip.
1537 !!!!DJG NARR Met. w/ DMIP Precip. & Temp. Forcing Data...
1538 ! if(FORC_TYP.eq.10) then ! If/Then for DMIP forcing data...
1539 !!Check to make sure if Noah time step is 3 hrs as is NARR...
1541 ! if(K.eq.1.OR.(MOD((K-1)*INT(DT),10800)).eq.0) then !if/then 3 hr check
1542 !!!Create forcing data filename...
1543 ! if (len_trim(range) == 0) then
1544 ! inflnm = trim(indir)//"/"//&
1545 ! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1546 ! ".LDASIN_DOMAIN"//hgrid
1547 !! startdate(1:4)//startdate(6:7)//startdate(9:10)//startdate(12:13)//&
1550 ! inflnm = trim(indir)//"/"//&
1551 ! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1552 ! ".LDASIN_DOMAIN"//hgrid//"."//trim(range)
1554 ! CALL READFORC_HRLDAS(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
1555 ! PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
1556 ! PRCP1=PRCP1/(3.0*3600.0) ! convert to mm/s which is what HRLDAS expects
1557 ! end if !3 hr check
1559 !!Get DMIP Precip...
1560 !! inflnm = "/d3/gochis/HRLDAS/forcing/DMIP_II/PRECIP_HRAP/precip_finished"//"/"//&
1561 ! inflnm = "/d2/hydrolab/HRLDAS/forcing/DMIP_II_AmerR/PRECIP_HRAP"//"/"//&
1563 ! olddate(6:7)//olddate(9:10)//olddate(1:4)//olddate(12:13)//&
1566 ! CALL READFORC_DMIP(inflnm,IX,JX,PRCP1)
1567 ! PRCP1 = PRCP1 / 100.0 ! Convert from native hundreths of mm to mm
1568 !! IF (K.LT.34) THEN
1569 !! PRCP1 = 5.0/3600.0 ! units mm/s
1575 !! inflnm = "/d3/gochis/HRLDAS/forcing/DMIP_II/TEMP_HRAP/tair_finished"//"/"//&
1576 ! inflnm = "/d2/hydrolab/HRLDAS/forcing/DMIP_II_AmerR/TEMP_HRAP"//"/"//&
1578 ! olddate(6:7)//olddate(9:10)//olddate(1:4)//olddate(12:13)//&
1580 ! CALL READFORC_DMIP(inflnm,IX,JX,T2)
1581 ! T2 = (5./9.)*(T2-32.0) + 273.15 !Convert from deg F to deg K
1583 ! end if !End if for DMIP forcing data...
1587 !! : add reading forcing precipitation data
1588 !! ywinflnm = "/ptmp/weiyu/hrldas/v2/st4"//"/"//&
1589 !! olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
1590 !! ".LDASIN_DOMAIN2"
1591 !! call read_stage4(ywinflnm,IX,JX,PRCP1)
1595 !!!!DJG Check for snow data assimilation...
1597 if (SNOW_ASSIM .eq. 1) then
1599 ! Every 24 hours, update the snow field from analyses.
1600 if(forc_typ .ne. 3 .or. forc_typ .ne. 6) then
1601 if ( OLDDATE(12:13) == "00") then
1602 CALL READSNOW_FORC(inflnm,IX,JX,WEASD,SNODEP)
1605 CALL READSNOW_FORC(inflnm,IX,JX,WEASD,SNODEP)
1610 #ifdef PRECIP_DOUBLE
1612 print*,'PRECIP DOUBLE'
1617 end subroutine read_hydro_forcing_seq
1621 subroutine mpp_readland_hrldas(geo_static_flnm,&
1622 ix,jx,land_cat,soil_cat,&
1623 vegtyp,soltyp,terrain,latitude,longitude,&
1624 global_nx,global_ny,SOLVEG_INITSWC)
1626 character(len=*), intent(in) :: geo_static_flnm
1627 integer, intent(in) :: ix, jx, land_cat, soil_cat, &
1628 global_nx,global_ny,SOLVEG_INITSWC
1629 integer, dimension(ix,jx), intent(out) :: vegtyp, soltyp
1630 real, dimension(ix,jx), intent(out) :: terrain, latitude, longitude
1631 real, dimension(global_nx,global_ny) ::g_terrain, g_latitude, g_longitude
1632 integer, dimension(global_nx,global_ny) :: g_vegtyp, g_soltyp
1634 character(len=256) :: units
1636 integer :: ncid,varid
1637 real, dimension(ix,jx) :: xdum
1638 integer flag ! flag = 1 from wrfsi, flag =2 from WPS.
1639 if(my_id.eq.IO_id) then
1640 CALL READLAND_HRLDAS(geo_static_flnm,global_nx, &
1641 global_ny,LAND_CAT,SOIL_CAT, &
1642 g_VEGTYP,g_SOLTYP,g_TERRAIN,g_LATITUDE,g_LONGITUDE, SOLVEG_INITSWC)
1644 ! distribute the data to computation node.
1645 call mpp_land_bcast_int1(LAND_CAT)
1646 call mpp_land_bcast_int1(SOIL_CAT)
1647 call decompose_data_int(g_VEGTYP,VEGTYP)
1648 call decompose_data_int(g_SOLTYP,SOLTYP)
1649 call decompose_data_real(g_TERRAIN,TERRAIN)
1650 call decompose_data_real(g_LATITUDE,LATITUDE)
1651 call decompose_data_real(g_LONGITUDE,LONGITUDE)
1653 end subroutine mpp_readland_hrldas
1656 subroutine MPP_READSNOW_FORC(flnm,ix,jx,OLDDATE,weasd,snodep,&
1657 global_nX, global_ny)
1660 character(len=*), intent(in) :: flnm,OLDDATE
1661 integer, intent(in) :: ix, global_nx,global_ny
1662 integer, intent(in) :: jx
1663 real, dimension(ix,jx), intent(out) :: weasd
1664 real, dimension(ix,jx), intent(out) :: snodep
1666 real,dimension(global_nX, global_ny):: g_weasd, g_snodep
1668 character(len=256) :: units
1672 if(my_id .eq. IO_id) then
1673 CALL READSNOW_FORC(trim(flnm),global_nX, global_ny,g_WEASD,g_SNODEP)
1675 call decompose_data_real(g_WEASD,WEASD)
1676 call decompose_data_real(g_SNODEP,SNODEP)
1679 end subroutine MPP_READSNOW_FORC
1681 subroutine MPP_DEEPGW_HRLDAS(ix,jx,in_SMCMAX,&
1682 global_nX, global_ny,nsoil,out_SMC,out_SH2OX)
1685 integer, intent(in) :: ix,global_nx,global_ny
1686 integer, intent(in) :: jx,nsoil
1687 real, dimension(ix,jx), intent(in) :: in_smcmax
1688 real, dimension(ix,jx,nsoil), intent(out) :: out_smc,out_sh2ox
1690 real,dimension(global_nX, global_ny,nsoil):: g_smc, g_sh2ox
1691 real,dimension(global_nX, global_ny):: g_smcmax
1695 call write_IO_real(in_smcmax,g_smcmax) ! get global grid of smcmax
1698 write (*,*) "In deep GW...", nsoil
1701 !loop to overwrite soils to saturation...
1704 g_smc(i,j,1:NSOIL) = g_smcmax(i,j)
1705 g_sh2ox(i,j,1:NSOIL) = g_smcmax(i,j)
1709 !decompose global grid to parallel tiles...
1711 call decompose_data_real(g_smc(:,:,k),out_smc(:,:,k))
1712 call decompose_data_real(g_sh2ox(:,:,k),out_sh2ox(:,:,k))
1716 end subroutine MPP_DEEPGW_HRLDAS
1719 subroutine read_hydro_forcing_mpp( &
1720 indir,olddate,hgrid, &
1721 ix,jx,forc_typ,snow_assim, &
1722 T2,q2x,u,v,pres,xlong,short,prcp1,&
1723 lai,fpar,snodep,dt,k,prcp_old)
1724 ! This subrouting is going to read different forcing.
1729 character(len=*) :: olddate,hgrid,indir
1730 character(len=256) :: filename
1731 integer :: ix,jx,forc_typ,k,snow_assim ! k is time loop
1732 real,dimension(ix,jx):: T2,q2x,u,v,pres,xlong,short,prcp1,&
1733 prcpnew,lai,fpar,snodep,prcp_old
1736 character(len=256) :: inflnm, product
1737 integer :: i,j,mmflag
1738 real,dimension(global_nx,global_ny):: g_T2,g_Q2X,g_U,g_V,g_XLONG, &
1739 g_SHORT,g_PRCP1,g_PRES,g_lai,g_snodep,g_prcp_old, g_fpar
1744 call write_io_real(T2,g_T2)
1745 call write_io_real(Q2X,g_Q2X)
1746 call write_io_real(U,g_U)
1747 call write_io_real(V,g_V)
1748 call write_io_real(XLONG,g_XLONG)
1749 call write_io_real(SHORT,g_SHORT)
1750 call write_io_real(PRCP1,g_PRCP1)
1751 call write_io_real(PRES,g_PRES)
1752 call write_io_real(prcp_old,g_PRCP_old)
1754 call write_io_real(lai,g_lai)
1755 call write_io_real(fpar,g_fpar)
1756 call write_io_real(snodep,g_snodep)
1760 if(my_id .eq. IO_id) then
1761 call read_hydro_forcing_seq( &
1762 indir,olddate,hgrid,&
1763 global_nx,global_ny,forc_typ,snow_assim, &
1764 g_T2,g_q2x,g_u,g_v,g_pres,g_xlong,g_short,g_prcp1,&
1765 g_lai,g_fpar,g_snodep,dt,k,g_prcp_old)
1767 write(6,*) "finish read forcing,olddate ",olddate
1771 call decompose_data_real(g_T2,T2)
1772 call decompose_data_real(g_Q2X,Q2X)
1773 call decompose_data_real(g_U,U)
1774 call decompose_data_real(g_V,V)
1775 call decompose_data_real(g_XLONG,XLONG)
1776 call decompose_data_real(g_SHORT,SHORT)
1777 call decompose_data_real(g_PRCP1,PRCP1)
1778 call decompose_data_real(g_prcp_old,prcp_old)
1779 call decompose_data_real(g_PRES,PRES)
1781 call decompose_data_real(g_lai,lai)
1782 call decompose_data_real(g_fpar,fpar)
1783 call decompose_data_real(g_snodep,snodep)
1786 end subroutine read_hydro_forcing_mpp
1789 integer function nfeb_yw(year)
1791 ! Compute the number of days in February for the given year.
1794 integer, intent(in) :: year ! Four-digit year
1796 nfeb_yw = 28 ! By default, February has 28 days ...
1797 if (mod(year,4).eq.0) then
1798 nfeb_yw = 29 ! But every four years, it has 29 days ...
1799 if (mod(year,100).eq.0) then
1800 nfeb_yw = 28 ! Except every 100 years, when it has 28 days ...
1801 if (mod(year,400).eq.0) then
1802 nfeb_yw = 29 ! Except every 400 years, when it has 29 days ...
1803 if (mod(year,3600).eq.0) then
1804 nfeb_yw = 28 ! Except every 3600 years, when it has 28 days.
1809 end function nfeb_yw
1811 subroutine geth_newdate (ndate, odate, idt)
1814 ! From old date ("YYYY-MM-DD HH:MM:SS.ffff" or "YYYYMMDDHHMMSSffff") and
1815 ! delta-time, compute the new date.
1817 ! on entry - odate - the old hdate.
1818 ! idt - the change in time
1820 ! on exit - ndate - the new hdate.
1822 integer, intent(in) :: idt
1823 character (len=*), intent(out) :: ndate
1824 character (len=*), intent(in) :: odate
1828 ! yrold - indicates the year associated with "odate"
1829 ! moold - indicates the month associated with "odate"
1830 ! dyold - indicates the day associated with "odate"
1831 ! hrold - indicates the hour associated with "odate"
1832 ! miold - indicates the minute associated with "odate"
1833 ! scold - indicates the second associated with "odate"
1835 ! yrnew - indicates the year associated with "ndate"
1836 ! monew - indicates the month associated with "ndate"
1837 ! dynew - indicates the day associated with "ndate"
1838 ! hrnew - indicates the hour associated with "ndate"
1839 ! minew - indicates the minute associated with "ndate"
1840 ! scnew - indicates the second associated with "ndate"
1842 ! mday - a list assigning the number of days in each month
1845 ! nday - the integer number of days represented by "idt"
1846 ! nhour - the integer number of hours in "idt" after taking out
1847 ! all the whole days
1848 ! nmin - the integer number of minutes in "idt" after taking out
1849 ! all the whole days and whole hours.
1850 ! nsec - the integer number of minutes in "idt" after taking out
1851 ! all the whole days, whole hours, and whole minutes.
1853 integer :: newlen, oldlen
1854 integer :: yrnew, monew, dynew, hrnew, minew, scnew, frnew
1855 integer :: yrold, moold, dyold, hrold, miold, scold, frold
1856 integer :: nday, nhour, nmin, nsec, nfrac, i, ifrc
1858 character (len=10) :: hfrc
1859 character (len=1) :: sp
1861 integer :: yrstart, yrend, mostart, moend, dystart, dyend
1862 integer :: hrstart, hrend, mistart, miend, scstart, scend, frstart
1864 integer, dimension(12) :: mday = (/31,28,31,30,31,30,31,31,30,31,30,31/)
1867 ! Determine if odate is "YYYY-MM-DD_HH ... " or "YYYYMMDDHH...."
1868 if (odate(5:5) == "-") then
1874 ! Break down old hdate into parts
1895 select case (oldlen)
1921 write(*,*) 'ERROR: geth_newdate: odd length: #'//trim(odate)//'#'
1922 call hydro_stop("In geth_newdate() - error odd length")
1925 if (oldlen.ge.11) then
1947 select case (oldlen)
1973 write(*,*) 'ERROR: geth_newdate: odd length: #'//trim(odate)//'#'
1974 call hydro_stop("In geth_newdate() - error odd length")
1978 ! Use internal READ statements to convert the CHARACTER string
1979 ! date into INTEGER components.
1981 read(odate(yrstart:yrend), '(i4)') yrold
1982 read(odate(mostart:moend), '(i2)') moold
1983 read(odate(dystart:dyend), '(i2)') dyold
1984 if (units.ge.2) then
1985 read(odate(hrstart:hrend),'(i2)') hrold
1986 if (units.ge.3) then
1987 read(odate(mistart:miend),'(i2)') miold
1988 if (units.ge.4) then
1989 read(odate(scstart:scend),'(i2)') scold
1990 if (units.ge.5) then
1991 read(odate(frstart:oldlen),*) frold
1997 ! Set the number of days in February for that year.
1999 mday(2) = nfeb_yw(yrold)
2001 ! Check that ODATE makes sense.
2005 ! Check that the month of ODATE makes sense.
2007 if ((moold.gt.12).or.(moold.lt.1)) then
2009 write(*,*) 'GETH_NEWDATE: Month of ODATE = ', moold
2014 ! Check that the day of ODATE makes sense.
2016 if ((dyold.gt.mday(moold)).or.(dyold.lt.1)) then
2018 write(*,*) 'GETH_NEWDATE: Day of ODATE = ', dyold
2023 ! Check that the hour of ODATE makes sense.
2025 if ((hrold.gt.23).or.(hrold.lt.0)) then
2027 write(*,*) 'GETH_NEWDATE: Hour of ODATE = ', hrold
2032 ! Check that the minute of ODATE makes sense.
2034 if ((miold.gt.59).or.(miold.lt.0)) then
2036 write(*,*) 'GETH_NEWDATE: Minute of ODATE = ', miold
2041 ! Check that the second of ODATE makes sense.
2043 if ((scold.gt.59).or.(scold.lt.0)) then
2045 write(*,*) 'GETH_NEWDATE: Second of ODATE = ', scold
2050 ! Check that the fractional part of ODATE makes sense.
2051 if (.not.opass) then
2052 write(*,*) 'Crazy ODATE: ', odate(1:oldlen), oldlen
2053 call hydro_stop("In geth_newdate")
2056 ! Date Checks are completed. Continue.
2059 ! Compute the number of days, hours, minutes, and seconds in idt
2061 if (units.ge.5) then !idt should be in fractions of seconds
2062 ifrc = oldlen-(frstart)+1
2064 nday = abs(idt)/(86400*ifrc)
2065 nhour = mod(abs(idt),86400*ifrc)/(3600*ifrc)
2066 nmin = mod(abs(idt),3600*ifrc)/(60*ifrc)
2067 nsec = mod(abs(idt),60*ifrc)/(ifrc)
2068 nfrac = mod(abs(idt), ifrc)
2069 else if (units.eq.4) then !idt should be in seconds
2071 nday = abs(idt)/86400 ! integer number of days in delta-time
2072 nhour = mod(abs(idt),86400)/3600
2073 nmin = mod(abs(idt),3600)/60
2074 nsec = mod(abs(idt),60)
2076 else if (units.eq.3) then !idt should be in minutes
2078 nday = abs(idt)/1440 ! integer number of days in delta-time
2079 nhour = mod(abs(idt),1440)/60
2080 nmin = mod(abs(idt),60)
2083 else if (units.eq.2) then !idt should be in hours
2085 nday = abs(idt)/24 ! integer number of days in delta-time
2086 nhour = mod(abs(idt),24)
2090 else if (units.eq.1) then !idt should be in days
2092 nday = abs(idt) ! integer number of days in delta-time
2098 write(*,'(''GETH_NEWDATE: Strange length for ODATE: '', i3)') &
2100 write(*,*) '#'//odate(1:oldlen)//'#'
2101 call hydro_stop("In geth_newdate")
2106 frnew = frold + nfrac
2107 if (frnew.ge.ifrc) then
2108 frnew = frnew - ifrc
2112 scnew = scold + nsec
2113 if (scnew .ge. 60) then
2118 minew = miold + nmin
2119 if (minew .ge. 60) then
2124 hrnew = hrold + nhour
2125 if (hrnew .ge. 24) then
2135 if (dynew.gt.mday(monew)) then
2136 dynew = dynew - mday(monew)
2138 if (monew .gt. 12) then
2141 ! If the year changes, recompute the number of days in February
2142 mday(2) = nfeb_yw(yrnew)
2147 else if (idt.lt.0) then
2149 frnew = frold - nfrac
2150 if (frnew .lt. 0) then
2151 frnew = frnew + ifrc
2155 scnew = scold - nsec
2156 if (scnew .lt. 00) then
2161 minew = miold - nmin
2162 if (minew .lt. 00) then
2167 hrnew = hrold - nhour
2168 if (hrnew .lt. 00) then
2178 if (dynew.eq.0) then
2180 if (monew.eq.0) then
2183 ! If the year changes, recompute the number of days in February
2184 mday(2) = nfeb_yw(yrnew)
2191 ! Now construct the new mdate
2197 if (newlen.gt.frstart) then
2198 write(ndate(1:scend),19) yrnew, monew, dynew, hrnew, minew, scnew
2199 write(hfrc,'(i10)') frnew+1000000000
2200 ndate = ndate(1:scend)//'.'//hfrc(31-newlen:10)
2202 else if (newlen.eq.scend) then
2203 write(ndate(1:scend),19) yrnew, monew, dynew, hrnew, minew, scnew
2204 19 format(i4,'-',i2.2,'-',i2.2,'_',i2.2,':',i2.2,':',i2.2)
2206 else if (newlen.eq.miend) then
2207 write(ndate,16) yrnew, monew, dynew, hrnew, minew
2208 16 format(i4,'-',i2.2,'-',i2.2,'_',i2.2,':',i2.2)
2210 else if (newlen.eq.hrend) then
2211 write(ndate,13) yrnew, monew, dynew, hrnew
2212 13 format(i4,'-',i2.2,'-',i2.2,'_',i2.2)
2214 else if (newlen.eq.dyend) then
2215 write(ndate,10) yrnew, monew, dynew
2216 10 format(i4,'-',i2.2,'-',i2.2)
2222 if (newlen.gt.frstart) then
2223 write(ndate(1:scend),119) yrnew, monew, dynew, hrnew, minew, scnew
2224 write(hfrc,'(i10)') frnew+1000000000
2225 ndate = ndate(1:scend)//'.'//hfrc(31-newlen:10)
2227 else if (newlen.eq.scend) then
2228 write(ndate(1:scend),119) yrnew, monew, dynew, hrnew, minew, scnew
2229 119 format(i4,i2.2,i2.2,i2.2,i2.2,i2.2)
2231 else if (newlen.eq.miend) then
2232 write(ndate,116) yrnew, monew, dynew, hrnew, minew
2233 116 format(i4,i2.2,i2.2,i2.2,i2.2)
2235 else if (newlen.eq.hrend) then
2236 write(ndate,113) yrnew, monew, dynew, hrnew
2237 113 format(i4,i2.2,i2.2,i2.2)
2239 else if (newlen.eq.dyend) then
2240 write(ndate,110) yrnew, monew, dynew
2241 110 format(i4,i2.2,i2.2)
2247 if (punct .and. (oldlen.ge.11) .and. (newlen.ge.11)) ndate(11:11) = sp
2249 end subroutine geth_newdate
2252 subroutine read_hydro_forcing_mpp1( &
2253 indir,olddate,hgrid, &
2254 ix,jx,forc_typ,snow_assim, &
2255 T2,q2x,u,v,pres,xlong,short,prcp1,&
2256 lai,fpar,snodep,dt,k,prcp_old)
2257 ! This subrouting is going to read different forcing.
2260 character(len=*) :: olddate,hgrid,indir
2261 character(len=256) :: filename
2262 integer :: ix,jx,forc_typ,k,snow_assim ! k is time loop
2263 real,dimension(ix,jx):: T2,q2x,u,v,pres,xlong,short,prcp1,&
2264 prcpnew,weasd,snodep,prcp0,prcp2,prcp_old
2267 character(len=256) :: inflnm, inflnm2, product
2268 integer :: i,j,mmflag,ierr_flg
2269 real,dimension(ix,jx):: lai,fpar
2270 character(len=4) nwxst_t
2273 inflnm = trim(indir)//"/"//&
2274 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
2275 ".LDASIN_DOMAIN"//hgrid
2277 !!!DJG... Call READFORC_(variable) Subroutine for forcing data...
2278 !!!DJG HRLDAS Format Forcing with hour format filename (NOTE: precip must be in mm/s!!!)
2281 !!! FORC_TYPE 1 ============================================================================
2282 if(FORC_TYP.eq.1) then
2283 !!Create forcing data filename...
2284 call geth_newdate(out_date,olddate,nint(dt))
2285 inflnm = trim(indir)//"/"//&
2286 out_date(1:4)//out_date(6:7)//out_date(9:10)//out_date(12:13)//&
2287 ".LDASIN_DOMAIN"//hgrid
2289 inquire (file=trim(inflnm), exist=fexist)
2292 call mpp_land_bcast_logical(fexist)
2294 if ( .not. fexist ) then
2295 print*, "no forcing data found", inflnm
2296 call hydro_stop("In read_hydro_forcing_mpp1() - no forcing data found")
2300 print*, "read forcing data at ", OLDDATE, trim(inflnm)
2302 call READFORC_HRLDAS_mpp(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
2303 PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
2305 where(PRCP1 .lt. 0) PRCP1= 0 ! set minimum to be 0
2306 where(PRCP1 .gt. 0.138889) PRCP1= 0.138889 ! set maximum to be 500 mm/h
2311 !!! FORC_TYPE 2 ============================================================================
2312 !!!DJG HRLDAS Forcing with minute format filename (NOTE: precip must be in mm/s!!!)
2313 if(FORC_TYP.eq.2) then
2315 !!Create forcing data filename...
2316 call geth_newdate(out_date,olddate,nint(dt))
2317 inflnm = trim(indir)//"/"//&
2318 out_date(1:4)//out_date(6:7)//out_date(9:10)//out_date(12:13)//&
2319 out_date(15:16)//".LDASIN_DOMAIN"//hgrid
2320 inquire (file=trim(inflnm), exist=fexist)
2322 call mpp_land_bcast_logical(fexist)
2324 if ( .not. fexist ) then
2325 print*, "no forcing data found", inflnm
2326 call hydro_stop("In read_hydro_forcing_mpp1() - no forcing data found")
2328 call READFORC_HRLDAS_mpp(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
2329 PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
2331 where(PRCP1 .lt. 0) PRCP1= 0 ! set minimum to be 0
2332 where(PRCP1 .gt. 0.138889) PRCP1= 0.138889 ! set maximum to be 500 mm/h
2337 !!! FORC_TYPE 3 ============================================================================
2338 !!!DJG WRF Output File Direct Ingest Forcing...
2339 if(FORC_TYP.eq.3) then
2340 !!Create forcing data filename...
2341 inflnm = trim(indir)//"/"//&
2342 "wrfout_d0"//hgrid//"_"//&
2343 olddate(1:4)//"-"//olddate(6:7)//"-"//olddate(9:10)//&
2344 "_"//olddate(12:13)//":00:00"
2346 inquire (file=trim(inflnm), exist=fexist)
2348 call mpp_land_bcast_logical(fexist)
2350 if ( .not. fexist ) then
2351 print*, "no forcing data found", inflnm
2352 call hydro_stop("read_hydro_forcing_seq")
2355 do i_forcing = 1, int(24*3600/dt)
2356 wrf_dt = i_forcing*dt
2357 call geth_newdate(out_date,olddate,nint(wrf_dt))
2358 inflnm2 = trim(indir)//"/"//&
2359 "wrfout_d0"//hgrid//"_"//&
2360 out_date(1:4)//"-"//out_date(6:7)//"-"//out_date(9:10)//&
2361 "_"//out_date(12:13)//":00:00"
2362 inquire (file=trim(inflnm2), exist=fexist)
2364 call mpp_land_bcast_logical(fexist)
2366 if (fexist ) goto 991
2370 if(.not. fexist) then
2371 write(6,*) "Error: could not find file ",trim(inflnm2)
2372 call hydro_stop("In read_hydro_forcing_mpp1() - could not find WRF forcing file")
2375 print*, "read WRF forcing data: ", trim(inflnm)
2376 print*, "read WRF forcing data: ", trim(inflnm2)
2380 call READFORC_WRF_mpp(inflnm2,IX,JX,OLDDATE,T2,Q2X,U,V, &
2381 PRES,XLONG,SHORT,PRCPnew,lai,fpar)
2382 call READFORC_WRF_mpp(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
2383 PRES,XLONG,SHORT,prcp0,lai,fpar)
2384 PRCP1=(PRCPnew-prcp0)/wrf_dt !Adjustment to convert accum to rate...(mm/s)
2389 !!! FORC_TYPE4 ============================================================================
2390 !!!DJG CONSTant, idealized forcing...
2391 if(FORC_TYP.eq.4) then
2392 ! Impose a fixed diurnal cycle...
2393 ! assumes model timestep is 1 hr
2394 ! assumes K=1 is 12z (Ks or ~ sunrise)
2396 ! IF (K.GE.1 .and. K.LE.2) THEN
2398 PRCP1 =25.4/3600.0 !units mm/s (Simulates 1"/hr for first time step...)
2399 elseif (K.gt.1) then
2402 ! Other Met. Vars...
2403 T2=290.0 + 3.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
2408 XLONG=400.0 + 25.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
2409 SHORT=450.0 + 450.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
2413 !!! FORC_TYPE 5 ============================================================================
2414 !!!DJG Idealized Met. w/ Specified Precip. Forcing Data...(Note: input precip units here are in 'mm/hr')
2415 ! This option uses hard-wired met forcing EXCEPT precipitation which is read in
2416 ! from a single, separate input file called 'YYYYMMDDHHMM.PRECIP_FORCING.nc'
2418 if(FORC_TYP.eq.5) then
2419 ! Standard Met. Vars...
2420 T2=290.0 + 3.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
2425 XLONG=400.0 + 25.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
2426 SHORT=450.0 + 450.0*(cos((2*3.1416*K/24.0)-12.0*2*3.1416/24.0))
2428 !Get specified precip....
2429 !!!VIP, dimensions of grid are currently hardwired in input subroutine!!!
2431 ! inflnm = trim(indir)//"/"//"sat_domain1.nc"
2432 !!Create forcing data filename...
2433 inflnm = trim(indir)//"/"//&
2434 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
2435 olddate(15:16)//".PRECIP_FORCING.nc"
2436 inquire (file=trim(inflnm), exist=fexist)
2438 call mpp_land_bcast_logical(fexist)
2440 if ( .not. fexist ) then
2441 print*, "no specified precipitation data found", inflnm
2442 call hydro_stop("In read_hydro_forcing_mpp1() - no specified precipitation data found")
2449 print *, "Opening supplemental precipitation forcing file...",inflnm
2451 call READFORC_MDV_mpp(inflnm,IX,JX, &
2452 PRCP2,mmflag,ierr_flg)
2454 !If radar or spec. data is ok use if not, skip to original NARR data...
2455 if (ierr_flg.eq.0) then ! use spec. precip
2456 !Convert units if necessary
2457 if (mmflag.eq.0) then !Convert pcp grid to units of mm/s...
2458 PRCP1=PRCP2/DT !convert from mm to mm/s
2460 print*, "Supplemental pcp is accumulated pcp/dt. "
2463 PRCP1=PRCP2 !assumes PRCP2 is in mm/s
2465 print*, "Supplemental pcp is rate. "
2467 end if ! Endif mmflag
2468 else ! either stop or default to original forcing data...
2470 print *,"Current RADAR precip data not found !!! Using previous available file..."
2473 end if ! Endif ierr_flg
2475 ! Loop through data to screen for plausible values
2478 if (PRCP1(i,j).lt.0.) PRCP1(i,j)= PRCP_old(i,j)
2479 if (PRCP1(i,j).gt.0.138889) PRCP1(i,j)=0.138889 !set max pcp intens = 500 mm/h
2486 !!! FORC_TYPE 6 ============================================================================
2487 !!!DJG HRLDAS Forcing with hourly format filename with specified precipitation forcing...
2488 ! This option uses HRLDAS-formatted met forcing EXCEPT precipitation which is read in
2489 ! from a single, separate input file called 'YYYYMMDDHHMM.PRECIP_FORCING.nc'
2491 if(FORC_TYP.eq.6) then
2493 !!Create forcing data filename...
2496 if(my_id .eq. io_id) then
2498 do i_forcing = 1, nint(3600*12/dt)
2499 call geth_newdate(out_date,olddate,nint(dt*i_forcing))
2500 inflnm = trim(indir)//"/"//&
2501 out_date(1:4)//out_date(6:7)//out_date(9:10)//out_date(12:13)//&
2502 ".LDASIN_DOMAIN"//hgrid
2504 inquire (file=trim(inflnm), exist=fexist)
2510 call mpp_land_bcast_logical(fexist)
2513 if ( .not. fexist ) then
2515 if(my_id .eq. io_id) then
2517 do i_forcing = 1, nint(3600*12/dt)
2518 call geth_newdate(out_date,olddate,nint(dt*i_forcing))
2519 inflnm = trim(indir)//"/"//&
2520 out_date(1:4)//out_date(6:7)//out_date(9:10)//out_date(12:13)//&
2521 out_date(15:16)//".LDASIN_DOMAIN"//hgrid
2522 inquire (file=trim(inflnm), exist=fexist)
2528 call mpp_land_bcast_logical(fexist)
2533 if ( .not. fexist ) then
2535 print*, "no ATM forcing data found at this time", inflnm
2539 print*, "reading forcing data at this time", inflnm
2542 call READFORC_HRLDAS_mpp(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
2543 PRES,XLONG,SHORT,PRCP1,LAI,FPAR)
2544 PRCP_old = PRCP1 ! This assigns new precip to last precip as a fallback for missing data...
2548 !Get specified precip....
2549 !VIP, dimensions of grid are currently hardwired in input subroutine!!!
2550 !!Create forcing data filename...
2551 call geth_newdate(out_date,olddate,nint(dt))
2552 inflnm = trim(indir)//"/"//&
2553 out_date(1:4)//out_date(6:7)//out_date(9:10)//out_date(12:13)//&
2554 out_date(15:16)//".PRECIP_FORCING.nc"
2555 inquire (file=trim(inflnm), exist=fexist)
2557 call mpp_land_bcast_logical(fexist)
2560 if(my_id .eq. io_id) then
2562 print*, "using specified pcp forcing: ",trim(inflnm)
2564 print*, "no specified pcp forcing: ",trim(inflnm)
2568 if ( .not. fexist ) then
2569 prcp1 = PRCP_old ! for missing pcp data use analysis/model input
2571 call READFORC_MDV_mpp(inflnm,IX,JX, &
2572 PRCP2,mmflag,ierr_flg)
2573 !If radar or spec. data is ok use if not, skip to original NARR data...
2574 if(ierr_flg .ne. 0) then
2576 print*, "WARNING: pcp reading problem: ", trim(inflnm)
2580 PRCP1=PRCP2 !assumes PRCP2 is in mm/s
2581 if (mmflag.eq.0) then !Convert pcp grid to units of mm/s...
2582 PRCP1=PRCP2/DT !convert from mm to mm/s
2583 end if ! Endif mmflag
2585 if(my_id .eq. io_id) then
2586 print*, "replace pcp successfully! ",trim(inflnm)
2593 ! Loop through data to screen for plausible values
2594 where(PRCP1 .lt. 0) PRCP1=PRCP_old
2595 where(PRCP1 .gt. 10 ) PRCP1= PRCP_old
2598 if (PRCP1(i,j).lt.0.) PRCP1(i,j)=0.0
2599 if (PRCP1(i,j).gt.0.138889) PRCP1(i,j)=0.138889 !set max pcp intens = 500 mm/h
2607 !!! FORC_TYPE 7 ============================================================================
2608 !!!! FORC_TYP 7: uses WRF forcing data plus additional pcp forcing.
2610 if(FORC_TYP.eq.7) then
2612 !!Create forcing data filename...
2613 inflnm = trim(indir)//"/"//&
2614 "wrfout_d0"//hgrid//"_"//&
2615 olddate(1:4)//"-"//olddate(6:7)//"-"//olddate(9:10)//&
2616 "_"//olddate(12:13)//":00:00"
2618 inquire (file=trim(inflnm), exist=fexist)
2620 call mpp_land_bcast_logical(fexist)
2624 if ( .not. fexist ) then
2626 print*, "no forcing data found", inflnm
2629 do i_forcing = 1, int(24*3600/dt)
2630 wrf_dt = i_forcing*dt
2631 call geth_newdate(out_date,olddate,nint(wrf_dt))
2632 inflnm2 = trim(indir)//"/"//&
2633 "wrfout_d0"//hgrid//"_"//&
2634 out_date(1:4)//"-"//out_date(6:7)//"-"//out_date(9:10)//&
2635 "_"//out_date(12:13)//":00:00"
2636 inquire (file=trim(inflnm2), exist=fexist)
2638 call mpp_land_bcast_logical(fexist)
2640 if (fexist ) goto 992
2645 print*, "read WRF forcing data: ", trim(inflnm)
2646 print*, "read WRF forcing data: ", trim(inflnm2)
2648 call READFORC_WRF_mpp(inflnm2,IX,JX,OLDDATE,T2,Q2X,U,V, &
2649 PRES,XLONG,SHORT,PRCPnew,lai,fpar)
2650 call READFORC_WRF_mpp(inflnm,IX,JX,OLDDATE,T2,Q2X,U,V, &
2651 PRES,XLONG,SHORT,prcp0,lai,fpar)
2652 PRCP1=(PRCPnew-prcp0)/wrf_dt !Adjustment to convert accum to rate...(mm/s)
2656 !Get specified precip....
2657 !VIP, dimensions of grid are currently hardwired in input subroutine!!!
2658 !!Create forcing data filename...
2659 inflnm = trim(indir)//"/"//&
2660 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
2661 olddate(15:16)//".PRECIP_FORCING.nc"
2662 inquire (file=trim(inflnm), exist=fexist)
2664 call mpp_land_bcast_logical(fexist)
2668 print*, "using specified pcp forcing: ",trim(inflnm)
2670 print*, "no specified pcp forcing: ",trim(inflnm)
2673 if ( .not. fexist ) then
2674 prcp1 = PRCP_old ! for missing pcp data use analysis/model input
2676 call READFORC_MDV_mpp(inflnm,IX,JX, &
2677 PRCP2,mmflag,ierr_flg)
2678 !If radar or spec. data is ok use if not, skip to original NARR data...
2679 if(ierr_flg .ne. 0) then
2681 print*, "WARNING: pcp reading problem: ", trim(inflnm)
2685 PRCP1=PRCP2 !assumes PRCP2 is in mm/s
2686 if (mmflag.eq.0) then !Convert pcp grid to units of mm/s...
2687 write(6,*) "using supplemental pcp time interval ", DT
2688 PRCP1=PRCP2/DT !convert from mm to mm/s
2690 write(6,*) "using supplemental pcp rates "
2691 end if ! Endif mmflag
2693 print*, "replace pcp successfully! ",trim(inflnm)
2699 ! Loop through data to screen for plausible values
2700 where(PRCP1 .lt. 0) PRCP1=PRCP_old
2701 where(PRCP1 .gt. 10 ) PRCP1= PRCP_old ! set maximum to be 500 mm/h
2702 where(PRCP1 .gt. 0.138889) PRCP1= 0.138889 ! set maximum to be 500 mm/h
2707 !!!!DJG Check for snow data assimilation...
2708 if (SNOW_ASSIM .eq. 1) then
2710 ! Every 24 hours, update the snow field from analyses.
2711 if(forc_typ .ne. 3 .or. forc_typ .ne. 6) then
2712 if ( OLDDATE(12:13) == "00") then
2713 call READSNOW_FORC_mpp(inflnm,IX,JX,WEASD,SNODEP)
2716 call READSNOW_FORC_mpp(inflnm,IX,JX,WEASD,SNODEP)
2721 #ifdef PRECIP_DOUBLE
2723 print*,'PRECIP DOUBLE'
2728 end subroutine read_hydro_forcing_mpp1
2732 subroutine READFORC_HRLDAS_mpp(flnm,ix,jx,target_date, t,q,u,v,p,lw,sw,pcp,lai,fpar)
2735 character(len=*), intent(in) :: flnm
2736 integer, intent(in) :: ix
2737 integer, intent(in) :: jx
2738 character(len=*), intent(in) :: target_date
2739 real, dimension(ix,jx), intent(out) :: t
2740 real, dimension(ix,jx), intent(out) :: q
2741 real, dimension(ix,jx), intent(out) :: u
2742 real, dimension(ix,jx), intent(out) :: v
2743 real, dimension(ix,jx), intent(out) :: p
2744 real, dimension(ix,jx), intent(out) :: lw
2745 real, dimension(ix,jx), intent(out) :: sw
2746 real, dimension(ix,jx), intent(out) :: pcp
2747 real, dimension(ix,jx), intent(inout) :: lai
2748 real, dimension(ix,jx), intent(inout) :: fpar
2750 character(len=256) :: units
2754 ! Open the NetCDF file.
2756 real, allocatable, dimension(:,:):: buf2
2757 if(my_id .eq. io_id) then
2758 allocate(buf2(global_nx,global_ny))
2762 if(my_id .eq. io_id) then
2763 ierr = nf_open(trim(flnm), NF_NOWRITE, ncid)
2765 call mpp_land_bcast_int1(ierr)
2767 write(*,'("READFORC Problem opening netcdf file: ''", A, "''")') trim(flnm)
2768 call hydro_stop("In READFORC_HRLDAS_mpp() - Problem opening netcdf file")
2772 if(my_id .eq. io_id ) call get_2d_netcdf("T2D", ncid,buf2, units, global_nx, global_ny, .TRUE., ierr)
2773 call decompose_data_real (buf2,t)
2774 if(my_id .eq. io_id ) call get_2d_netcdf("Q2D", ncid,buf2, units, global_nx, global_ny, .TRUE., ierr)
2775 call decompose_data_real (buf2,q)
2776 if(my_id .eq. io_id ) call get_2d_netcdf("U2D", ncid,buf2, units, global_nx, global_ny, .TRUE., ierr)
2777 call decompose_data_real (buf2,u)
2778 if(my_id .eq. io_id ) call get_2d_netcdf("V2D", ncid,buf2, units, global_nx, global_ny, .TRUE., ierr)
2779 call decompose_data_real (buf2,v)
2780 if(my_id .eq. io_id ) call get_2d_netcdf("PSFC", ncid,buf2, units, global_nx, global_ny, .TRUE., ierr)
2781 call decompose_data_real (buf2,p)
2782 if(my_id .eq. io_id ) call get_2d_netcdf("LWDOWN", ncid,buf2, units, global_nx, global_ny, .TRUE., ierr)
2783 call decompose_data_real (buf2,lw)
2784 if(my_id .eq. io_id ) call get_2d_netcdf("SWDOWN", ncid,buf2, units, global_nx, global_ny, .TRUE., ierr)
2785 call decompose_data_real (buf2,sw)
2786 if(my_id .eq. io_id ) call get_2d_netcdf("RAINRATE", ncid,buf2, units, global_nx, global_ny, .TRUE., ierr)
2787 call decompose_data_real (buf2,pcp)
2788 if(my_id .eq. io_id ) then
2789 call get_2d_netcdf("VEGFRA", ncid,buf2, units, global_nx, global_ny, .FALSE., ierr)
2791 if(maxval(buf2) .gt. 10 .and. maxval(buf2) .lt. 10000) buf2 = buf2 * 1.E-2
2794 call mpp_land_bcast_int1(ierr)
2795 if(ierr == 0) call decompose_data_real (buf2,fpar)
2796 if(my_id .eq. io_id ) call get_2d_netcdf("LAI", ncid, buf2, units, global_nx, global_ny, .FALSE., ierr)
2797 call mpp_land_bcast_int1(ierr)
2798 if(ierr == 0) call decompose_data_real (buf2,lai)
2802 ierr = nf_open(trim(flnm), NF_NOWRITE, ncid)
2804 write(*,'("READFORC Problem opening netcdf file: ''", A, "''")') trim(flnm)
2805 call hydro_stop("READFORC_HRLDAS")
2807 call get_2d_netcdf("T2D", ncid, t, units, ix, jx, .TRUE., ierr)
2808 call get_2d_netcdf("Q2D", ncid, q, units, ix, jx, .TRUE., ierr)
2809 call get_2d_netcdf("U2D", ncid, u, units, ix, jx, .TRUE., ierr)
2810 call get_2d_netcdf("V2D", ncid, v, units, ix, jx, .TRUE., ierr)
2811 call get_2d_netcdf("PSFC", ncid, p, units, ix, jx, .TRUE., ierr)
2812 call get_2d_netcdf("LWDOWN", ncid, lw, units, ix, jx, .TRUE., ierr)
2813 call get_2d_netcdf("SWDOWN", ncid, sw, units, ix, jx, .TRUE., ierr)
2814 call get_2d_netcdf("RAINRATE",ncid, pcp, units, ix, jx, .TRUE., ierr)
2815 call get_2d_netcdf("VEGFRA", ncid, fpar, units, ix, jx, .FALSE., ierr)
2818 if(maxval(fpar) .gt. 10 .and. maxval(fpar) .lt. 10000) fpar = fpar * 1.E-2
2820 call get_2d_netcdf("LAI", ncid, lai, units, ix, jx, .FALSE., ierr)
2823 ierr = nf_close(ncid)
2825 end subroutine READFORC_HRLDAS_mpp
2827 subroutine READFORC_WRF_mpp(flnm,ix,jx,target_date,t,q,u,v,p,lw,sw,pcp,lai,fpar)
2830 character(len=*), intent(in) :: flnm
2831 integer, intent(in) :: ix
2832 integer, intent(in) :: jx
2833 character(len=*), intent(in) :: target_date
2834 real, dimension(ix,jx) :: t,q,u,v,p,lw,sw,pcp,pcpc, lai,fpar
2837 character(len=256) :: units
2841 real, allocatable, dimension(:,:) :: buf2
2849 if(my_id .eq. io_id) then
2850 allocate(buf2(global_nx, global_ny) )
2852 allocate(buf2(1, 1) )
2855 ! Open the NetCDF file.
2857 if(my_id .eq. io_id) ierr = nf_open(flnm, NF_NOWRITE, ncid)
2858 call mpp_land_bcast_int1(ierr)
2860 write(*,'("READFORC_WRF Problem opening netcdf file: ''", A, "''")') trim(flnm)
2861 call hydro_stop("In READFORC_WRF_mpp() - Problem opening netcdf file")
2863 if(my_id .eq. io_id) call get_2d_netcdf_ruc("T2", ncid, buf2, global_nx, global_ny,tlevel, .true., ierr)
2864 call decompose_data_real (buf2,t)
2865 if(my_id .eq. io_id) call get_2d_netcdf_ruc("Q2", ncid, buf2, global_nx, global_ny,tlevel, .true., ierr)
2866 call decompose_data_real (buf2,q)
2867 if(my_id .eq. io_id) call get_2d_netcdf_ruc("U10", ncid, buf2, global_nx, global_ny,tlevel, .true., ierr)
2868 call decompose_data_real (buf2,u)
2869 if(my_id .eq. io_id) call get_2d_netcdf_ruc("V10", ncid, buf2, global_nx, global_ny,tlevel, .true., ierr)
2870 call decompose_data_real (buf2,v)
2871 if(my_id .eq. io_id) call get_2d_netcdf_ruc("PSFC", ncid, buf2, global_nx, global_ny,tlevel, .true., ierr)
2872 call decompose_data_real (buf2,p)
2873 if(my_id .eq. io_id) call get_2d_netcdf_ruc("GLW", ncid, buf2, global_nx, global_ny,tlevel, .true., ierr)
2874 call decompose_data_real (buf2,lw)
2875 if(my_id .eq. io_id) call get_2d_netcdf_ruc("SWDOWN", ncid, buf2, global_nx, global_ny,tlevel, .true., ierr)
2876 call decompose_data_real (buf2,sw)
2877 if(my_id .eq. io_id) call get_2d_netcdf_ruc("RAINC", ncid, buf2, global_nx, global_ny,tlevel, .true., ierr)
2878 call decompose_data_real (buf2,pcpc)
2879 if(my_id .eq. io_id) call get_2d_netcdf_ruc("RAINNC", ncid, buf2, global_nx, global_ny,tlevel, .true., ierr)
2880 call decompose_data_real (buf2,pcp)
2881 if(my_id .eq. io_id) call get_2d_netcdf_ruc("LAI", ncid, buf2, global_nx, global_ny,tlevel, .false., ierr)
2882 call mpp_land_bcast_int1(ierr)
2883 if(ierr == 0) call decompose_data_real (buf2,lai)
2884 if(my_id .eq. io_id) then
2885 call get_2d_netcdf_ruc("VEGFRA", ncid, buf2, global_nx, global_ny, tlevel, .true., ierr)
2887 if(maxval(buf2) .gt. 10 .and. maxval(buf2) .lt. 10000) buf2 = buf2 * 1.E-2
2890 call mpp_land_bcast_int1(ierr)
2891 if(ierr == 0) call decompose_data_real (buf2,fpar)
2895 ! Open the NetCDF file.
2896 ierr = nf_open(flnm, NF_NOWRITE, ncid)
2898 write(*,'("READFORC_WRF Problem opening netcdf file: ''", A, "''")') trim(flnm)
2899 call hydro_stop("In READFORC_WRF_mpp() - Problem opening netcdf file")
2901 call get_2d_netcdf_ruc("T2", ncid, t, ix, jx,tlevel, .true., ierr)
2902 call get_2d_netcdf_ruc("Q2", ncid, q, ix, jx,tlevel, .true., ierr)
2903 call get_2d_netcdf_ruc("U10", ncid, u, ix, jx,tlevel, .true., ierr)
2904 call get_2d_netcdf_ruc("V10", ncid, v, ix, jx,tlevel, .true., ierr)
2905 call get_2d_netcdf_ruc("PSFC", ncid, p, ix, jx,tlevel, .true., ierr)
2906 call get_2d_netcdf_ruc("GLW", ncid, lw, ix, jx,tlevel, .true., ierr)
2907 call get_2d_netcdf_ruc("SWDOWN", ncid, sw, ix, jx,tlevel, .true., ierr)
2908 call get_2d_netcdf_ruc("RAINC", ncid, pcpc, ix, jx,tlevel, .true., ierr)
2909 call get_2d_netcdf_ruc("RAINNC", ncid, pcp, ix, jx,tlevel, .true., ierr)
2910 call get_2d_netcdf_ruc("VEGFRA", ncid, fpar, ix, jx,tlevel, .false., ierr)
2912 if(maxval(fpar) .gt. 10 .and. (maxval(fpar) .lt. 10000) ) fpar = fpar * 0.01
2914 call get_2d_netcdf_ruc("LAI", ncid, lai, ix, jx,tlevel, .false., ierr)
2919 pcp=pcp+pcpc ! assumes pcpc=0 for resolved convection...
2920 ierr = nf_close(ncid)
2923 end subroutine READFORC_WRF_mpp
2925 subroutine READFORC_MDV_mpp(flnm,ix,jx,pcp,mmflag,ierr_flg)
2928 character(len=*), intent(in) :: flnm
2929 integer, intent(in) :: ix
2930 integer, intent(in) :: jx
2931 integer, intent(out) :: ierr_flg
2932 integer :: it,jew,zsn
2933 real, dimension(ix,jx), intent(out) :: pcp
2935 character(len=256) :: units
2936 integer :: ierr,i,j,i2,j2,varid
2937 integer :: ncid,mmflag
2938 real, dimension(ix,jx) :: temp
2940 real, allocatable, dimension(:,:) :: buf2
2941 if(my_id .eq. io_id) then
2942 allocate(buf2(global_nx, global_ny))
2948 mmflag = 0 ! flag for units spec. (0=mm, 1=mm/s)
2951 !open NetCDF file...
2953 if(my_id .eq. io_id) then
2955 ierr_flg = nf_open(flnm, NF_NOWRITE, ncid)
2958 call mpp_land_bcast_int1(ierr_flg)
2960 if (ierr_flg /= 0) then
2961 write(*,'("READFORC_MDV Problem opening netcdf file: ''",A,"''")') &
2970 if(my_id .eq. io_id) then
2972 ierr = nf_inq_varid(ncid, "precip", varid)
2975 call mpp_land_bcast_int1(ierr)
2977 if(ierr /= 0) ierr_flg = ierr
2980 if(my_id .eq. io_id) then
2982 ierr = nf_inq_varid(ncid, "precip_rate", varid) !recheck variable name...
2985 call mpp_land_bcast_int1(ierr)
2989 if(my_id .eq. io_id) then
2991 ierr = nf_inq_varid(ncid, "RAINRATE", varid) !recheck variable name...
2994 call mpp_land_bcast_int1(ierr)
2997 write(*,'("READFORC_MDV Problem reading precip netcdf file: ''", A,"''")') &
3009 if(my_id .eq. io_id) then
3010 ierr = nf_get_var_real(ncid, varid, buf2)
3012 call mpp_land_bcast_int1(ierr)
3013 if(ierr ==0) call decompose_data_real (buf2,pcp)
3016 ierr = nf_get_var_real(ncid, varid, pcp)
3019 write(*,'("READFORC_MDV Problem reading netcdf file: ''", A,"''")') trim(flnm)
3021 ierr = nf_close(ncid)
3023 end subroutine READFORC_MDV_mpp
3025 subroutine READSNOW_FORC_mpp(flnm,ix,jx,weasd,snodep)
3028 character(len=*), intent(in) :: flnm
3029 integer, intent(in) :: ix
3030 integer, intent(in) :: jx
3031 real, dimension(ix,jx), intent(out) :: weasd
3032 real, dimension(ix,jx), intent(out) :: snodep
3033 real, dimension(ix,jx) :: tmp
3035 character(len=256) :: units
3039 real, allocatable, dimension(:,:) :: buf2
3040 if(my_id .eq. io_id) then
3041 allocate(buf2(global_nx, global_ny))
3047 ! Open the NetCDF file.
3049 if(my_id .eq. io_id) then
3051 ierr = nf_open(flnm, NF_NOWRITE, ncid)
3054 call mpp_land_bcast_int1(ierr)
3057 write(*,'("READSNOW Problem opening netcdf file: ''", A, "''")') trim(flnm)
3058 call hydro_stop("In READSNOW_FORC_mpp() - Problem opening netcdf file")
3062 if(my_id .eq. io_id) then
3063 call get_2d_netcdf("WEASD", ncid, buf2, units, ix, jx, .FALSE., ierr)
3065 call mpp_land_bcast_int1(ierr)
3066 if(ierr == 0) call decompose_data_real (buf2,tmp)
3068 call get_2d_netcdf("WEASD", ncid, tmp, units, ix, jx, .FALSE., ierr)
3071 call get_2d_netcdf("SNOW", ncid, tmp, units, ix, jx, .FALSE., ierr)
3075 print *, "read WEASD from wrfoutput ...... "
3081 if (trim(units) == "m") then
3082 ! No conversion necessary
3083 else if (trim(units) == "mm") then
3084 ! convert WEASD from mm to m
3085 weasd = weasd * 1.E-3
3090 print *, "!!!!! NO WEASD present in input file...initialize to 0."
3093 if(my_id .eq. io_id) then
3094 call get_2d_netcdf("SNODEP", ncid, buf2, units, ix, jx, .FALSE., ierr)
3096 call mpp_land_bcast_int1(ierr)
3097 if(ierr == 0) call decompose_data_real (buf2,tmp)
3099 call get_2d_netcdf("SNODEP", ncid, tmp, units, ix, jx, .FALSE., ierr)
3102 ! Quick assumption regarding snow depth.
3105 if(my_id .eq. io_id) then
3106 call get_2d_netcdf("SNOWH", ncid, buf2, units, ix, jx, .FALSE., ierr)
3108 call mpp_land_bcast_int1(ierr)
3109 if(ierr == 0) call decompose_data_real (buf2,tmp)
3111 call get_2d_netcdf("SNOWH", ncid, tmp, units, ix, jx, .FALSE., ierr)
3113 if(ierr .eq. 0) then
3115 print *, "read snow depth from wrfoutput ... "
3124 ! Quick assumption regarding snow depth.
3125 !yw snodep = weasd * 10.
3126 where(snodep .lt. weasd) snodep = weasd*10 !set lower bound to correct bi-lin interp err...
3129 !DJG check for erroneous neg WEASD or SNOWD due to offline interpolation...
3130 where(snodep .lt. 0) snodep = 0
3131 where(weasd .lt. 0) weasd = 0
3132 ierr = nf_close(ncid)
3134 end subroutine READSNOW_FORC_mpp
3136 subroutine read_ldasout(olddate,hgrid, indir, dt,ix,jx,infxsrt,soldrain)
3141 character(len=*) :: olddate,hgrid,indir
3142 character(len=19) :: outdate
3143 character(len=256) :: inflnm, inflnm2
3145 real, dimension(ix,jx):: infxsrt,infxsrt2,soldrain,soldrain2
3146 integer :: ncid, ierr
3147 character(len=256) :: units
3149 real, dimension(global_nx,global_ny) :: gArr
3152 ! check for file with hours first
3153 inflnm = trim(indir)//"/"//&
3154 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
3155 ".LDASOUT_DOMAIN"//hgrid
3156 inquire (file=trim(inflnm), exist=fexist)
3158 if(.not. fexist) then
3159 ! check for file with minutes
3160 inflnm = trim(indir)//"/"//&
3161 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//olddate(15:16)//&
3162 ".LDASOUT_DOMAIN"//hgrid
3163 inquire (file=trim(inflnm), exist=fexist)
3165 if(.not. fexist) then
3166 write(6,*) "Error: input file does not exist. Check ", trim(olddate)
3167 call hydro_stop( "LDASOUT input Error")
3170 call geth_newdate(outdate,olddate,nint(dt))
3171 ! check file for next date
3172 ! check for file with hours first
3173 inflnm2 = trim(indir)//"/"//&
3174 outdate(1:4)//outdate(6:7)//outdate(9:10)//outdate(12:13)//&
3175 ".LDASOUT_DOMAIN"//hgrid
3176 inquire (file=trim(inflnm2), exist=fexist)
3178 if(.not. fexist) then
3179 ! check for file with minutes
3180 inflnm2 = trim(indir)//"/"//&
3181 outdate(1:4)//outdate(6:7)//outdate(9:10)//outdate(12:13)//outdate(15:16)//&
3182 ".LDASOUT_DOMAIN"//hgrid
3183 inquire (file=trim(inflnm2), exist=fexist)
3185 if(.not. fexist) then
3186 write(6,*) "FATAL ERROR: input file does not exist. Check ", trim(outdate)
3187 call hydro_stop( "LDASOUT input Error")
3191 if(my_id .eq. io_id) then
3192 ierr = nf_open(trim(inflnm), NF_NOWRITE, ncid)
3193 call get_2d_netcdf("SFCRNOFF", ncid, gArr, units, global_nx, global_ny, .TRUE., ierr)
3195 call decompose_data_real (gArr,infxsrt)
3196 if(my_id .eq. io_id) then
3197 call get_2d_netcdf("UGDRNOFF", ncid, gArr, units, global_nx, global_ny, .TRUE., ierr)
3199 call decompose_data_real (gArr,soldrain)
3200 if(my_id .eq. io_id) then
3201 ierr = nf_close(ncid)
3204 ierr = nf_open(trim(inflnm), NF_NOWRITE, ncid)
3205 call get_2d_netcdf("SFCRNOFF", ncid, infxsrt, units, ix, jx, .TRUE., ierr)
3206 call get_2d_netcdf("UGDRNOFF", ncid, soldrain, units, ix, jx, .TRUE., ierr)
3207 ierr = nf_close(ncid)
3211 if(my_id .eq. io_id) then
3212 ierr = nf_open(trim(inflnm2), NF_NOWRITE, ncid)
3213 call get_2d_netcdf("SFCRNOFF", ncid, gArr, units, global_nx, global_ny, .TRUE., ierr)
3215 call decompose_data_real (gArr,infxsrt2)
3216 if(my_id .eq. io_id) then
3217 call get_2d_netcdf("UGDRNOFF", ncid, gArr, units, global_nx, global_ny, .TRUE., ierr)
3219 call decompose_data_real (gArr,soldrain2)
3220 if(my_id .eq. io_id) then
3221 ierr = nf_close(ncid)
3224 ierr = nf_open(trim(inflnm2), NF_NOWRITE, ncid)
3225 call get_2d_netcdf("SFCRNOFF", ncid, infxsrt2, units, ix, jx, .TRUE., ierr)
3226 call get_2d_netcdf("UGDRNOFF", ncid, soldrain2, units, ix, jx, .TRUE., ierr)
3227 ierr = nf_close(ncid)
3230 infxsrt = infxsrt2 - infxsrt
3231 soldrain = soldrain2 - soldrain
3233 end subroutine read_ldasout
3235 !temporary for Noah model
3237 subroutine read_ldasout_seq(olddate,hgrid, indir, dt,ix,jx,infxsrt,soldrain)
3241 character(len=*) :: olddate,hgrid,indir
3242 character(len=19) :: outdate
3243 character(len=256) :: inflnm, inflnm2
3245 real, dimension(ix,jx):: infxsrt,infxsrt2,soldrain,soldrain2
3246 integer :: ncid, ierr
3247 character(len=256) :: units
3249 ! check for file with hours first
3250 inflnm = trim(indir)//"/"//&
3251 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//&
3252 ".LDASOUT_DOMAIN"//hgrid
3253 inquire (file=trim(inflnm), exist=fexist)
3255 if(.not. fexist) then
3256 ! check for file with minutes
3257 inflnm = trim(indir)//"/"//&
3258 olddate(1:4)//olddate(6:7)//olddate(9:10)//olddate(12:13)//olddate(15:16)//&
3259 ".LDASOUT_DOMAIN"//hgrid
3260 inquire (file=trim(inflnm), exist=fexist)
3262 if(.not. fexist) then
3263 write(6,*) "FATAL ERROR: input file does not exist. Check ", trim(olddate)
3264 call hydro_stop( "LDASOUT input Error")
3267 call geth_newdate(outdate,olddate,nint(dt))
3268 ! check file for next date
3269 ! check for file with hours first
3270 inflnm2 = trim(indir)//"/"//&
3271 outdate(1:4)//outdate(6:7)//outdate(9:10)//outdate(12:13)//&
3272 ".LDASOUT_DOMAIN"//hgrid
3273 inquire (file=trim(inflnm2), exist=fexist)
3275 if(.not. fexist) then
3276 ! check for file with minutes
3277 inflnm2 = trim(indir)//"/"//&
3278 outdate(1:4)//outdate(6:7)//outdate(9:10)//outdate(12:13)//outdate(15:16)//&
3279 ".LDASOUT_DOMAIN"//hgrid
3280 inquire (file=trim(inflnm2), exist=fexist)
3282 if(.not. fexist) then
3283 write(6,*) "FATAL ERROR: input file does not exist. Check ", trim(outdate)
3284 call hydro_stop( "LDASOUT input Error")
3287 ierr = nf_open(trim(inflnm), NF_NOWRITE, ncid)
3288 call get_2d_netcdf("SFCRNOFF", ncid, infxsrt, units, ix, jx, .TRUE., ierr)
3289 call get_2d_netcdf("UGDRNOFF", ncid, soldrain, units, ix, jx, .TRUE., ierr)
3290 ierr = nf_close(ncid)
3292 ierr = nf_open(trim(inflnm2), NF_NOWRITE, ncid)
3293 call get_2d_netcdf("SFCRNOFF", ncid, infxsrt2, units, ix, jx, .TRUE., ierr)
3294 call get_2d_netcdf("UGDRNOFF", ncid, soldrain2, units, ix, jx, .TRUE., ierr)
3295 ierr = nf_close(ncid)
3297 infxsrt = infxsrt2 - infxsrt
3298 soldrain = soldrain2 - soldrain
3300 end subroutine read_ldasout_seq
3301 end module module_lsm_forcing
3303 subroutine read_forc_ldasout(olddate,hgrid, indir, dt,ix,jx,infxsrt,soldrain)
3304 use module_lsm_forcing, only: read_ldasout
3307 character(len=*) :: olddate,hgrid,indir
3309 real, dimension(ix,jx):: infxsrt,soldrain
3310 call read_ldasout(olddate,hgrid, indir, dt,ix,jx,infxsrt,soldrain)
3311 end subroutine read_forc_ldasout
3313 subroutine read_forc_ldasout_seq(olddate,hgrid, indir, dt,ix,jx,infxsrt,soldrain)
3314 ! temporary for Noah model
3315 use module_lsm_forcing, only: read_ldasout_seq
3318 character(len=*) :: olddate,hgrid,indir
3320 real, dimension(ix,jx):: infxsrt,soldrain
3321 call read_ldasout_seq(olddate,hgrid, indir, dt,ix,jx,infxsrt,soldrain)
3322 end subroutine read_forc_ldasout_seq