Re: How to combine multi ascii files into one file?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Aug 27 2012 - 10:51:45 MDT

Untar/gz all your files

===================================

   diri = "./" ; data directory
   fili = systemfunc("cd "+diri+" ; ls "*.op")

   STA = toint( str_get_cols(fili, 0, 5) )
   XXX = toint( str_get_cols(fili, 7,11) )
   YEAR = toint( str_get_cols(fili,13,16) )

Then you can specify a station number and year

   sta = 543860
   year = 2001

Find the appropriate file

   i = ind(STA.eq.sta .and. YEAR.eq.year)

Read the file's data

   data = asciiread(diri+fili(i), .......)

On 8/26/12 4:49 PM, Wen.J.Qu wrote:
> Hi, Mary,
> Thank you very much for your excellent functions to deal with my former
> problems (find the missing days and fill them).
> As a new learner of NCL, forgive me that I must ask another preliminary
> question. I am dealing with this kind of ascii files for 354 stations
> from 1973 to 2010, and there is an ascii file for each staiton in each
> year; so I have total 354*38 files.
> Attached is an example of the ascii files at one station for the 38
> years (1973-2010).
> Could you please give me some suggestion that how do deal with these
> data? Should I combine the data for one station into one ascii file? Or
> I just to find the exact asciifile for the station in the year when I
> need to use the data at that station in that year?
> Thanks a lot for your kind help in my learning of NCL.
> All my best!
> Shawn
> ------------------------------------------------------------------------
> Wen.J.Qu
> 2012-08-26
> ------------------------------------------------------------------------
> *发件人:* Mary Haley
> *发送时间:* 2012-08-24 18:30:34
> *收件人:* Wen.J.Qu@gmail.com
> *抄送:* ncl-talk
> *主题:* Re: [ncl-talk] How to check and fill the missing lines with the
> missing values?
> Shawn,
>
> See the attached file.
>
> I pretty much use str_get_field (and not str_get_cols) to read in all
> your data. I do use "str_get_cols" to parse the yyyymmdd array into yyyy
> and mm.
>
> This function also creates a new yyyymmdd array that doesn't contain any
> missing days, and then creates 15 new arrays (for your 15 other fields)
> that are the same size, with the appropriate indexes filled in.
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 27 10:52:04 2012

This archive was generated by hypermail 2.1.8 : Tue Aug 28 2012 - 08:53:45 MDT