[ncl-talk] how do I make understand the code that there are so many blank columns not 1
Geeta Geeta
geetag54 at yahoo.com
Mon Feb 9 02:26:38 MST 2026
Thank You Sir, I could get the desired results with insructions that you have given dstr=asciiread(filename,-1,"string") ; Read file as string;print(dstr)printVarSummary(dstr) tab=str_get_tab() split= str_split_csv(dstr,tab,3); printVarSummary(split); print(split)DateTime =split(:,0)C4 = split(:, 4) ; print(C4)C8 = split(:,8)C12 = split(:,12)print(DateTime+" "+C4+" "+C8+" "+C12)
thanks once again
Geeta.
On Thursday, 5 February 2026 at 08:39:15 pm IST, Dave Allured - NOAA Affiliate <dave.allured at noaa.gov> wrote:
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
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, 2900print(dstr(i)) ; split the stringssplit= str_split(dstr(i)," ")print(split) ; it is stringDateTime = split(0)+" "+split(1)+split(2)
following error is comingfatal:Dimension sizes of left hand side and right hand side of assignment do not matchfatal:["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/20260209/e7aa6d0e/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/20260209/e7aa6d0e/attachment.jpg>
More information about the ncl-talk
mailing list