[ncl-talk] warning:["FileSupport.c":3894]:NCL does not know anything about file suffix <csv>.

Mary Haley haley at ucar.edu
Sun Jun 19 22:51:06 MDT 2016


Grace,

You can't open CSV files with addfile or addfiles.  These two functions are
for "supported file formats" which are defined as NetCDF, GRIB 1/2, HDF
4/5, HDF-EOS 2/5, and shapefile.

I think your script is mostly correct, as you are later reading the file
with "asciiread". This is the proper thing to do since CSV files are
considered ASCII files.

To start, you need to remove the "addfiles" call entirely.

Assuming that "filename1" is a list of 29 files, you will also need to
change this line:

       lines  = asciiread(fin1[i],-1,"string")

to be:

       lines  = asciiread(filename1(i),-1,"string")

--Mary


On Sun, Jun 19, 2016 at 9:53 PM, grace <313695096 at qq.com> wrote:

> Hi:
>   All,I have write a script to read and calculate .csv data according to
> the "Reading csv"example on the NCL website,but it appears warning and
> fatal:
>
>  warning:["FileSupport.c":3894]:NCL does not know anything about file
> suffix <csv>.
>  But NCL will try its best to figure out the file format.
>
>  fatal:An internal error has occurred. The file format requested does not
> appear to be supported, could not open
> (/public/home/huanglei/cmaqdata/20160615/Caotan.csv)
>  warning:["FileSupport.c":3894]:NCL does not know anything about file
> suffix <csv>.
>  But NCL will try its best to figure out the file format.
>  ........
> .........
> ........
>
>
> This is my script:
>    ;
> begin
>
>  filename1=systemfunc("ls /public/home/huanglei/cmaqdata/2016*/Caotan.csv")
>      fin1=addfiles(filename1,"r")
>
>
> time_al= new((/29,24/),float,"No_FillValue")
>      oth_al = new((/29,24/),float,"No_FillValue")
>      xa_al  = new((/29,24/),float,"No_FillValue")
>      tc_al  = new((/29,24/),float,"No_FillValue")
>      bj_al  = new((/29,24/),float,"No_FillValue")
>      xy_al  = new((/29,24/),float,"No_FillValue")
>      wn_al  = new((/29,24/),float,"No_FillValue")
>      ya_al  = new((/29,24/),float,"No_FillValue")
> hz_al  = new((/29,24/),float,"No_FillValue")
>      yl_al  = new((/29,24/),float,"No_FillValue")
>      ak_al  = new((/29,24/),float,"No_FillValue")
> sl_al  = new((/29,24/),float,"No_FillValue")
>      do i=0,28
>
>           ;---Read in file as array of strings so we can parse each line.
>        lines  = asciiread(fin1[i],-1,"string")
>        nlines = dimsizes(lines)-1   ; First line is a header
>
>     ;
>     ; Start reading in the fields we care about:
>     ; The first line is a header, so skip this.
>     ;
>       delim     = ","
>       time = str_get_field(lines(1:25),1,delim)
>       oth  = str_get_field(lines(1:25),2,delim)
>       xa   = str_get_field(lines(1:25),3,delim)
>       tc   = str_get_field(lines(1:25),4,delim)
>  bj   = str_get_field(lines(1:25),5,delim)
>       xy   = str_get_field(lines(1:25),6,delim)
>       wn   = str_get_field(lines(1:25),7,delim)
>       ya   = str_get_field(lines(1:25),8,delim)
>  hz   = str_get_field(lines(1:25),9,delim)
>       yl   = str_get_field(lines(1:25),10,delim)
>       ak   = str_get_field(lines(1:25),11,delim)
>       sl   = str_get_field(lines(1:25),12,delim)
>
>
>              time_al(i,:)= time
> oth_al(i,:) = oth
> xa_al(i,:)  = xa
> tc_al(i,:)  = tc
> bj_al(i,:)  = bj
> xy_al(i,:)  = xy
> wn_al(i,:)  = wn
> ya_al(i,:)  = ya
>              hz_al(i,:)  = tc
> yl_al(i,:)  = bj
> ak_al(i,:)  = xy
> sl_al(i,:)  = wn
> end do
>
>               time_all=ndtooned(time_al)
>  oth_all=ndtooned(oth_al)
>  xa_all=ndtooned(xa_al)
>  tc_all=ndtooned(tc_al)
>  bj_all=ndtooned(bj_al)
>  xy_all=ndtooned(xy_al)
>  wn_all=ndtooned(wn_al)
>               ya_all=ndtooned(xy_al)
>  hz_all=ndtooned(wn_al)
>  yl_all=ndtooned(ya_al)
>  ak_all=ndtooned(ak_al)
>  sl_all=ndtooned(sl_al)
>
>
>      print(time_all)
>
>   ; calculate the avg
>
>               oth_avg=avg(oth_al)
>  xa_avg=avg(xa_all)
>  tc_avg=avg(tc_all)
>  bj_avg=avg(bj_all)
>  xy_avg=avg(xy_all)
>  wn_avg=avg(wn_all)
>               ya_avg=avg(xy_all)
>  hz_avg=avg(wn_all)
>  ya_avg=avg(ya_all)
>  ak_avg=avg(ak_all)
>  sl_avg=avg(sl_all)
>
>  ssx = hz_avg + ak_avg + sl_avg
>  nsx = ya_avg + ya_avg
>
>
> end
>
>
> My NCL version is 6.2.0.
>  How can I slove the problem?
>
> _______________________________________________
> 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/20160619/483d4bab/attachment.html 


More information about the ncl-talk mailing list