[ncl-talk] Question about the output of 1-2-1 average

Lyndon Mark Olaguera olagueralyndonmark429 at gmail.com
Thu Oct 5 01:22:13 MDT 2017


Dear ncl-experts,

I am just confused about the output of the 1-2-1 average in NCL.

I have a csv file containing 30 years of data (1979-2008). I attached the
raw file (P28-P31.csv) and the smoothed file (P28-P31_filt.csv). After
applying the 3 point 1-2-1 average, I got 29 points with -9999 (missing at
both ends) after applying the script.

Question:

[1] I'm confused now which output point corresponds to a particular year
(which point in the smoothed file corresponds to 1979, 1980,etc).
[2[ Is there a way to add a "filler" value to the points without data after
smoothing automatically?


begin
   diri     = "./"
   files     = systemfunc("ls *.csv")
   numfiles = dimsizes(files)
   do ifil  = 0,numfiles-1
     lines    = asciiread(files(ifil),-1,"string")
     data = lines(1:)
     rain = tofloat(str_get_field(data,1,","))
;;***************************************************
;;Apply 1-2-1 running average (three pentads)
;;****************************************************
  x = wgt_runave(rain, (/0.25, 0.50, 0.25/), 0)
  x at _FillValue = -9999
;;****************************************************
;;Save output to a csv file
;;****************************************************
  flname = str_get_cols(files(ifil),0,6)+"_filt.csv"
  asciiwrite(flname,x)
  end do
end

Thank you in advance for the help.

Sincerely,

Lyndz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171005/44f9abe4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: P28-P31_filt.csv
Type: text/csv
Size: 253 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171005/44f9abe4/attachment.csv>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: P28-P31.csv
Type: text/csv
Size: 433 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171005/44f9abe4/attachment-0001.csv>


More information about the ncl-talk mailing list