Re: Cannot read a normal ascii data file?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 11 Jun 2007 15:52:40 -0600

Wang, Yi wrote:
> Hi There:
>
> Attached is a regular ascii file. I cannot read it with asciiread.
>
> I got this message:
>
> "
> Copyright (C) 1995-2006 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 4.2.0.a034
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> (0) READING ASCII FILEs
> fatal:An internal error has occurred. The file format requested does not
> appear to be supported, could not open (snd20001207.dat)
> fatal:Argument type mismatch on argument (0) of (asciiread) can not coerce"
>
> What is wrong? My data? Asciiread? NCL version? Other issues, such as
> dividing spaces?
>
> Thanks,
>
> Yi
>
>
=====
I had no problems.
=====================================
[1] Read as one long vector:

%> x = asciiread ("snd20001207.dat", -1,"float")
%> print(x)

Variable: x
Type: float
Total Size: 24792 bytes
            6198 values
Number of Dimensions: 1
Dimensions and sizes: [6198]
Coordinates:
(0) 21000
(1) 45.8
(2) 215.2
(3) 0.00434958
(4) 1.48265
(5) 2.06844
(6) 20000
(7) 53.7
(8) 215.2
(9) 0.00435602
(10) 2.85706
(11) 2.00267

[SNIP]

[2] If you know the number of rows and columns:

   q = asciiread ("snd20001207.dat", (/1033,6/),"float")

[3] If you do not know the number of rows:

%> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl <http://www.ncl.ucar.edu/Document/Functions/Contributed/contrib.shtml>"

%> ncol = 6
%> y = readAsciiTable ("snd20001207.dat", ncol,"float",0)
%> print(y)

Variable: y
Type: float
Total Size: 24792 bytes
            6198 values
Number of Dimensions: 2
Dimensions and sizes: [1033] x [6]
Coordinates:
Number Of Attributes: 1
  _FillValue : -999
(0,0) 21000
(0,1) 45.8
(0,2) 215.2
(0,3) 0.00434958
(0,4) 1.48265
(0,5) 2.06844
(1,0) 20000
(1,1) 53.7
(1,2) 215.2
(1,3) 0.00435602
(1,4) 2.85706
(1,5) 2.00267
(2,0) 19000
(2,1) 62.8
[SNIP]

==================
good luck
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 11 2007 - 15:52:40 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 14 2007 - 09:39:54 MDT