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

xiaoming Hu yuanfangcan at hotmail.com
Thu Nov 8 14:07:55 MST 2018


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
To: xiaoming Hu
Cc: ncl-talk at ucar.edu; Xiaoming Hu
Subject: Re: [ncl-talk] how to tell readAsciiTable to ignore ^M ?


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!

--

Stavros NTAFIS (DAFIS)
-----------------------------------------------
Physicist - Meteorologist, M.Sc.
Ph.D. Candidate, Polytechnic School of Paris, France
Laboratory of Dynamic Meteorology (LMD)
Research Associate, National Observatory of Athens (NOA/IERSD)
Tel. : (+33)1 69 33 51 64
(+33)9 81 94 22 12
Mobile: (+33) 066 030 0147
(+30) 697 04 20 242
---------------
Weather charts:
http://www.meteo.gr
http://www.meteo.gr/meteomaps/



Στις 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<mailto: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/3a17a702/attachment.html>


More information about the ncl-talk mailing list