<div dir="ltr">A quick NCL search for 'read ascii' reveals a function that can do what you want.<div><br></div><div><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/asciiread.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/asciiread.shtml</a><br></div><div><br></div><div>I use this function for exactly this purpose, and combine with str_get_field as necessary to parse out values from columns.</div><div><br></div><div>Be sure to read the part to understand the dimension setting to ensure the file is read by individual lines.</div><div><br></div><div><br></div><div>Kyle</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">----------------------------------------<div>Kyle S. Griffin</div><div>Department of Atmospheric and Oceanic Sciences</div><div>University of Wisconsin - Madison</div><div>Room 1407</div><div>1225 W Dayton St, Madison, WI 53706</div><div>Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Nov 19, 2015 at 6:09 AM, Marston Johnston <span dir="ltr"><<a href="mailto:marston.johnston@gu.se" target="_blank">marston.johnston@gu.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
It is possible to read an ascii file line by line with NCL?<br>
I have a file with header information but some rows have<br>
fewer columns than others. The causes NCL to misread the file since it doesn’t pad the missing columns with 0s.<br>
Here’s and example of the file:<br>
<br>
90 000001 017<br>
13 000001 001 1989010118 1989 01 01 18 -22.50 76.50 97321.5 -999.999 -999.999<br>
13 000001 002 1989010200 1989 01 02 00 -15.00 78.00 96884.5 -999.999 -999.999<br>
13 000001 003 1989010206 1989 01 02 06 -9.00 78.00 96481.6 -999.999 -999.999<br>
13 000001 004 1989010212 1989 01 02 12 9.00 78.00 95855.4 -999.999 -999.999<br>
13 000001 005 1989010218 1989 01 02 18 10.50 79.50 95618.0 -999.999 -999.999<br>
13 000001 006 1989010300 1989 01 03 00 10.50 79.50 95862.3 -999.999 -999.999<br>
13 000001 007 1989010306 1989 01 03 06 24.00 79.50 96049.5 -999.999 -999.999<br>
13 000001 008 1989010312 1989 01 03 12 25.50 79.50 96741.5 -999.999 -999.999<br>
13 000001 009 1989010318 1989 01 03 18 30.00 76.50 97431.5 -999.999 -999.999<br>
13 000001 010 1989010400 1989 01 04 00 37.50 75.00 98005.7 -999.999 -999.999<br>
13 000001 011 1989010406 1989 01 04 06 51.00 78.00 98294.2 -999.999 -999.999<br>
13 000001 012 1989010412 1989 01 04 12 52.50 78.00 98539.0 -999.999 -999.999<br>
13 000001 013 1989010418 1989 01 04 18 54.00 78.00 98684.7 -999.999 -999.999<br>
13 000001 014 1989010500 1989 01 05 00 52.50 78.00 98801.7 -999.999 -999.999<br>
13 000001 015 1989010506 1989 01 05 06 49.50 78.00 98859.1 -999.999 -999.999<br>
13 000001 016 1989010512 1989 01 05 12 49.50 78.00 99021.5 -999.999 -999.999<br>
13 000001 017 1989010518 1989 01 05 18 60.00 76.50 98882.8 -999.999 -999.999<br>
90 000002 020<br>
13 000002 001 1989010100 1989 01 01 00 49.50 51.00 98664.4 -999.999 -999.999<br>
13 000002 002 1989010106 1989 01 01 06 57.75 53.25 98746.9 -999.999 -999.999<br>
<br>
<br>
Any help is appreciated,<br>
/Marston<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>