[ncl-talk] how to tell readAsciiTable to ignore ^M ? apply dos2unix once or more times

Mary Haley haley at ucar.edu
Thu Nov 8 23:03:56 MST 2018


Hi Dave,

We are moving from JIRA to GitHub for issue tracking (and will be making an
official announcement soon). Would you be willing to open an issue on this
via:

https://github.com/NCAR/ncl/issues

Thanks,

--Mary


On Thu, Nov 8, 2018 at 3:41 PM, Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> NCL Support,
>
> Suggestion.  Please update readAsciiTable and similar text input
> functions to automatically recognize and remove both DOS and Unix line
> endings.  Thanks.
>
> --Dave
>
>
> On Thu, Nov 8, 2018 at 2:07 PM, xiaoming Hu <yuanfangcan at hotmail.com>
> wrote:
>
>> Hello Stavros
>>
>> You are right, if I do dos2unix, I remove one ^M at each line, and do
>> another dos2unix and remove the other ^M at each line.
>> So to be safe, I probably need to do once or twice dos2unix before
>> I readAsciiTable
>>
>> Thanks a lot!
>> Xiaoming
>>
>> ------------------------------
>> *From:* sdafis <sdafis at noa.gr>
>> *Sent:* Thursday, November 8, 2018 2:58 PM
>>
>> Hi Xiaoming,
>>
>> It seems that you are trying to read a file DOS line endings. You must
>> convert it to Unix type, so I suggest using a software like dos2unix:
>> http://dos2unix.sourceforge.net/
>>
>> There are plenty of other ways of converting the file. Then NCL will read
>> the file without problems.
>>
>> Good luck!
>>
>>
>> Στις 2018-11-08 21:50, xiaoming Hu έγραψε:
>>
>> Hello
>>   I have trouble to readAsciiTable   the following data:
>> VERSION 03.30^M^M
>> 54342 0123.5167 041.7333 0052.5^M^M
>> GFE(L)-1 12.2 GTS1 -00262833792 028 0750 0400 2650 1500 352^M^M
>> 026.0 026.0 00.0 1000.7 1001.2 -0.5 068 065 03 1^M^M
>> 20130714111522 20130714192922 20130714123100 20130714123100 06 06 26985
>> 25904 002.00 28.1 1000.7 069 000 000.0 010.0 00 // // 000 10- // // //
>> 090.00 -01.00 070.00^M^M
>> ZCZC SECOND^M^M
>> TimeStep     T            Press        RH           angle
>>  direction    distance     delta_lon    delta_lat    xx           xx
>>     xx
>>        0.000       28.100     1000.700       69.000       -1.000
>> 90.000        0.070        0.000        0.000        0.000        0.000
>>   52.000
>>        1.000     -999.000     -999.000     -999.000        3.370
>> 67.810        0.108        0.000        0.000        0.000        0.000
>>   64.000
>>        2.000     -999.000     -999.000     -999.000        3.970
>> 67.620        0.108        0.000        0.000        0.000        0.000
>>   69.000
>>
>> see:
>> ncl 8> data_second = readAsciiTable("Z_UPAR_I_54342
>> _20130712111513_O_TEMP-L.txt.SECOND", 12, "float", 7)
>>
>> warning:asciiread: End of file reached and only (76173) elements were
>> read from the file, filling remaining elements with the default missing
>> value for the requested type
>> ncl 9> print(data_second(:2,0))
>>
>>
>> Variable: data_second (subsection)
>> Type: float
>> Total Size: 12 bytes
>>             3 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [3]
>> Coordinates:
>> Number Of Attributes: 1
>>   _FillValue : 9.96921e+36
>> (0) 2.013071e+13
>> (1) 315
>> (2) 70
>>
>> It appears NCL  treated   ^M^M   as an additional line.
>> How can I tell NCL to treat ^M as characters?
>> Thanks
>> Xiaoming
>>
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181108/3c0a9945/attachment.html>


More information about the ncl-talk mailing list