; --------------------------------------------------------------------------- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Program Name: narr_lapse.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 height regridding. ; ; ; ; Input: height file1, height file2, variable file, output file ; ; ; ; Output: height adjust file ; ; ; ; For non-fatal errors output is witten to $DATA/logs ; ; ; ; Author(s)/Contact(s): Linlin Pan, lpan@ucar.edu ; ; Origination June, 2015 ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ;---------------------------------------------------------------------- begin inputFile1 = getenv("inputFile1") ; air data inputFile2 = getenv("inputFile2") ; hgt data outFile = getenv("outFile") ; outFile data ; input files f1 = addfile(inputFile1,"r") f2 = addfile(inputFile2,"r") ; out files fout = addfile(outFile,"w") ; input variables air = short2flt(f1->air(:,:,:,:)) air@_FillValue=792.81 hgt = short2flt(f2->hgt(:,:,:,:)) y = (f2->y) x = (f2->x) hgt@_FillValue=64031 ; calculation dair=air(:,0,:,:)-air(:,3,:,:) dhgt=hgt(:,3,:,:)-hgt(:,0,:,:) lap = dair/dhgt lap_ave =dim_avg_n(lap,0) lap_ave@_FillValue=792.81 lap_ave=lap_ave*1000. ; lap_ave = where (lap_ave.eq.792.81,lap_ave,6.49) ; delete(lap_ave@_FillValue ) lap_ave@_FillValue=6.49 delete(lap_ave@_FillValue) lap_ave!0="y" lap_ave!1="x" ; lap_ave@y=y ; lap_ave@x=x ;print(lap_ave) fout->lapse = lap_ave ; output ; end