[ncl-talk] how do I make understand the code that there are so many blank columns not 1

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Thu Feb 5 08:08:34 MST 2026


Geeta, it looks like this is a "tab-separated" ASCII text file.  The symbol
"^I" is code for a single tab character, coming from your print program.
Confirm this by printing a sample line with a low level dump tool, such as
*"od"* (linux) or maybe *"hexdump"* or other such tools.

Or you can read a sample line in binary with NCL, using *cbinread
("sample.txt", -1, "ubyte")*.  This will read each character as a single
8-bit unsigned integer.  Then use NCL *print()* to show the integers.  In
this mode, ASCII tab characters are the number 9 in decimal; spaces are 32;
digits are 48-57; etc.  End of line is 10, or maybe the 13/10 pair.
Consult an ASCII code table.  Once again, this method is only for
confirming the file format.

To split each line into separate data fields, use *str_split_csv* with the
tab character as the delimiter, instead of the usual comma.  Get a single
tab character with *str_get_tab*.  You can also use *str_split_csv* to
split multiple lines, instead of looping over single lines.  This is more
efficient if you have large amounts of data.


On Thu, Feb 5, 2026 at 12:47 AM Geeta Geeta via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hi My data file looks like this [image: Inline image]
> how do I make understand the code that there are so many blank columns not
> 1
> pfa the section of my code
>
> do i =2771, 2900
> print(dstr(i))
> ; split the strings
> split= str_split(dstr(i)," ")
> print(split) ; it is string
> DateTime = split(0)+" "+split(1)+split(2)
>
> following error is coming
> fatal:Dimension sizes of left hand side and right hand side of assignment
> do not match
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 35 in
> file c1.ncl
>
> Geeta.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20260205/ad1623d9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1770277579123blob.jpg
Type: image/jpeg
Size: 41640 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20260205/ad1623d9/attachment.jpg>


More information about the ncl-talk mailing list