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

Rick Brownrigg brownrig at ucar.edu
Tue Apr 19 09:45:35 MDT 2016


Not totally sure I understand -- it sounds like you are having to "press q"
because the output is paged (displaying one page at a time)?  If that's the
case, you can invoke ncl with a "-q" switch to disable paging:

    ncl -q myscript.ncl

Hope that helps...
Rick

On Tue, Apr 19, 2016 at 8:59 AM, Ramchandra Karki <rammetro at hotmail.com>
wrote:

> 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 ----------------
> begin
> DATADir = "/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 file
> ntimes = 4320            ; number of times in the file
> temp = 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  ;phakding
> Longitude = 86.81278
> res = True
> res at returnInt = True
> point = wrf_user_ll_to_ij(a,Longitude,Latitude,res)
> x = point(0)-1
> y = point(1)-1
> ;tc2 = wrf_user_getvar(a,"HGT",it)     ; heigth extraction
> tc2 = wrf_user_getvar(a,"T2",it)       ; temp extraction
> tc2 = 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
>
>
> *RegardsRamchandra Karki*
> *PhD Student,  *
> *Institute of Geography, **University of Hamburg*
> *Bundesstrase 55, Hamburg Germany*
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160419/447724c2/attachment.html 


More information about the ncl-talk mailing list