[ncl-talk] RH timeseries

Alan Brammer abrammer at albany.edu
Mon Jul 31 07:46:28 MDT 2017


You’re overwriting the variable `lines` on every loop iteration.  

you probably want

lines = new( ntimes, “string”)

do  it…
…
lines(it) = times(i)+”...
…
end do



Good luck, 

Alan. 




##############################
Alan Brammer,
Post-Doc Researcher

Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
abrammer at albany.edu
##############################

> On 31 Jul 2017, at 01:20, Muhammad Omer Mughal <m.mughal1 at postgrad.curtin.edu.au> wrote:
> 
> Hi 
> 
> I am trying to evaluate RH time series at a certain location near surface using the following code. I do get it correct when I am printing it on screen but I fail to get it corrected when I use ascii write. Can any one help quickly please.
> 
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> 
> begin
> a=addfile("wrfout_d05_2016-04-01_00:00:00.nc","r")
> loc = wrf_user_ll_to_ij(a, 103.98226667,1.36776667, True)
> x = loc(0) - 1
> y= loc(1) - 1
> 
> times = wrf_user_list_times(a)
> ntimes = dimsizes(times)
> 
> do it = 0,ntimes-1,1
>     RH = wrf_user_getvar(a,"rh",it)
> 
>     RH1=RH(2,y,x)
> lines = times(it)+" "+sprintf("%.5f",RH1)
> ;print("Working on time: " + times(it) + " RH="+RH1)
>   end do
> asciiwrite("RH.csv",lines)
> end
> 
> 
> 
> 
> Muhammad Omer Mughal
> MSc BSc Mechanical Engineering
> PhD  Research Scholar
> Remote Sensing and Satellite Research Group
> Department of Imaging and Applied Physics
> Curtin University
> 
> Curtin University
> Tel | +61 8 9266 7962 
> Fax | +61 8 9266 2377
> Mobile | 0470 237 525  
> 
> Email | m.mughal1 at postgrad.curtin.edu.au <mailto:m.lynch at curtin.edu.au> 
> Web | http://curtin.edu.au <http://curtin.edu.au/>
> 
> Curtin University is a trademark of Curtin University of Technology. 
> CRICOS Provider Code 00301J (WA), 02637B (NSW)
> 
> 
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170731/4aea9cbc/attachment.html 


More information about the ncl-talk mailing list