[ncl-talk] help ncl script for extraction of station data

Ramchandra Karki rammetro at hotmail.com
Tue Apr 19 08:59:55 MDT 2016


Dear NCL group,I tried to extract hourly air temperature data from wrf out and used the following scripts. would you figure out if there is any errors in it because when i run it it stops with showing time information and then pressing q several times it can execute the script but it is too time consuming and difficult to work because i have to press q for the size of times in file. I look foward for kind response

    ; --------------  LOAD FUNCTIONS AND PROCEDURES ----------------
    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"    load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
    ; --------------  BEGINING OF NCL SCRIPT ----------------beginDATADir = "/mnt/gpfs1/data/private/fgvy024/Build_WRF/WRFV3/run/"FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d03* ")numFILES = dimsizes(FILES)a = addfiles(FILES+".nc","r");times = wrf_user_list_times(a)     ; get times in the filentimes = 4320            ; number of times in the filetemp = new(ntimes,float) do it = 0, ntimes-1                 ;Loop for the time: time = it;************************************************ ;  - Select lon & lat of the point of interest - ;************************************************  ; - The function wrf_user_ll_to_ij find the nearest grid point for a specific lat and lon
Latitude = 27.959167  ;phakdingLongitude = 86.81278res = True      res at returnInt = True                       point = wrf_user_ll_to_ij(a,Longitude,Latitude,res) x = point(0)-1y = point(1)-1;tc2 = wrf_user_getvar(a,"HGT",it)     ; heigth extractiontc2 = wrf_user_getvar(a,"T2",it)       ; temp extractiontc2 = tc2 -273.16
temp(it) = tc2(y,x) end do
    npts=ntimes    fName = "pyramid_1km.txt"    data  = new( npts, "string")                print("  Time      temp       ")         do it = 0, ntimes-1 ;ntimes-1
        print (sprintf("%5.0f",it)    +" " \          +sprintf("%21.2f", temp(it)) +"  " )
    end do                     ; end of time loop
    do it = 0,ntimes-1 ;ntimes-1
       data (it)= (sprintf("%5.0f",it)    +" " \          +sprintf("%21.2f", temp(it)) +"  "  )
 end do                     ; end of time loop asciiwrite (fName , data)end
Regards
Ramchandra KarkiPhD Student,  Institute of Geography, University of HamburgBundesstrase 55, Hamburg Germany
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160419/f344f2cd/attachment.html 


More information about the ncl-talk mailing list