; --------------------------------------------------------------------------- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Program Name: combine_qpe.ncl ; ; ; ; National Water Model (NWM) WRF-hydro forcing engine is developed by ; ; National Center for Atmospheric Research (NCAR), under the sponsorship ; ; of National Water Center (NWC). ; ; ; ; Team Members: ; ; NCAR Staff: Linlin Pan, Wei Yu, and David Gochis ; ; NWC/OWP Staff: Brian Cosgrove, Zhengtao Cui, Cham Pham, and James Taft ; ; ; ; This is a ncl program to perform file combine. ; ; ; ; Input: hrrr file, rainfall file, output file ; ; ; ; Output: combined file ; ; ; ; For non-fatal errors output is witten to $DATA/logs ; ; ; ; Author(s)/Contact(s): Linlin Pan, lpan@ucar.edu ; ; Origination Sept., 2015 ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; begin hrrrFile = getenv("hrrrFile") ; HRRR data rainFile = getenv("rainFile") ; rain data outFile = getenv("outFile") ; outFile data indexFlag = getenv("INDEX") if(indexFlag .eq. "true") then indexf = addfile("index.nc","r") index = indexf->index end if f2 = addfile(hrrrFile + ".nc","r") f1 = addfile(rainFile,"r") ; system("rm -f "+outFile) fout = addfile(outFile + ".nc" ,"w") ndd = dimsizes(dimsizes(f1->precip_rate)) dd = dimsizes(f1->precip_rate) print("dd="+dd) dimlat = dd(ndd-2) dimlon = dd(ndd-1) v1d = ndtooned(f1->precip_rate) if(indexFlag .eq. "false") then findexOut = addfile("index_out.nc","c") index = ind(ismissing(v1d).or.(v1d.lt.0) ) findexOut->index = index system("mv index_out.nc index.nc") exit end if v1dgfs = ndtooned(f2->RAINRATE) v1d(index) = v1dgfs(index) ; precip_rate = f2->RAINRATE precip_rate = onedtond(v1d,(/1,dimlat,dimlon/)) precip_rate@units="mm s-1" precip_rate@long_name="Surface Precipitation rate" fout->RAINRATE = precip_rate end