[ncl-talk] reading consecutive ascii files in do loop

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Jun 12 13:09:52 MDT 2018


Dave,

The problem is in "nlvl".  You are using floats in a place that requires
integers only.  Change the function call on this line to
"stringtointeger".  Also, "tointeger" or "toint" would be better.

nlvl = stringtofloat(str_get_cols(data,13,15))

--Dave A.


On Tue, Jun 12, 2018 at 12:51 PM, David Adams <dave.k.adams at gmail.com>
wrote:

> Hi all,
> I am using the skew T plot routine. I try to open each ascii file and plot
> it as a pdf. My file list contains the file name and number of lines (i.e.,
> pressure levels) in the sounding files.
> filename       nlvl
> 7_11_00.dat  129
> 7_11_12.dat  122
> 7_12_00.dat  148
>  etc...
> I read and open the files this way
> -------------------------------------------------------------------------
>  filename ="Sounding_file_list.txt"
>    data = asciiread(filename,-1,"string")
>     input  = str_get_cols(data,0,10)
>     nlvl = stringtofloat(str_get_cols(data,13,15))
>     ncol =11
>
>   do i = 0,47
>       fsl_data = asciiread(input(i),(/nlvl(i),ncol/), "float")
> etc...
> But I get the following error.
>
> fatal:asciiread: The input dimension sizes must be byte, short, integer or
> long  fatal:["Execute.c":8575]:Execute: Error occurred at or near line 27
> in file test.ncl
>
> Here is the print out of the variable filenames
> ---------------------------------------------
> Variable: input
> Type: string
> Total Size: 384 bytes
>             48 values
> Number of Dimensions: 1
> Dimensions and sizes:    [48]
> Coordinates:
>
> I am sure this is a simple error, but I am brain dead at this point.
> thanks in advance,
> Dave
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180612/a77db7c2/attachment.html>


More information about the ncl-talk mailing list