<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dennis</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you so much! I agree "<span style="color: rgb(33, 33, 33); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255); display: inline !important">Likely,
a fortran code with f4.1 was used but should have been f5.1</span>". </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
You code is really helpful: </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span> ndat = numAsciiRow(pthtxt)<br>
</span>
<div> ncol = numAsciiCol(pthtxt)<br>
</div>
<div> print("ndat="+ndat+"; ncol="+ncol)<br>
</div>
<div><br>
</div>
<div> dstr = asciiread(pthtxt, -1, "string")<br>
</div>
<div> dstr := str_sub_str(dstr,"*****","999.9") ; change<br>
</div>
<div> print(dstr)<br>
</div>
<div><br>
</div>
<div> delim = " "<br>
</div>
<div> id = str_get_field(dstr, 1, delim) ; toint(str_get_field(dstr, 1, delim) )<br>
</div>
<div><br>
</div>
<div> col27 = tofloat( str_get_field(dstr,27, delim) )<br>
</div>
<div> col28 = tofloat( str_get_field(dstr,28, delim) )<br>
</div>
<div><br>
</div>
<div> col27 = where(col27.eq.999.9, 99999.0, 88888.0) ; whatever you wany<br>
</div>
<div> i9999 = ind(.not.(col28.eq.999.9)) ; rows/line where a 999.9 does not appear<br>
</div>
<div><br>
</div>
<div> print(id+" "+col27+" "+col28)<br>
</div>
<span></span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Xiaoming </div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dennis Shea <shea@ucar.edu><br>
<b>Sent:</b> Tuesday, April 9, 2019 4:41 PM<br>
<b>To:</b> xiaoming Hu<br>
<b>Cc:</b> Ncl-talk; Xiaoming Hu<br>
<b>Subject:</b> Re: [ncl-talk] readAsciiTable to handle ***** in data</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>Likely, a fortran code with f4.1 was used but should have been f5.1</div>
<div><br>
</div>
<div>===</div>
<div><br>
</div>
<div>%> ncl XiaomingHu.ncl</div>
<div><br>
</div>
<div>===0) ndat=7; ncol=32<br>
<br>
<br>
Variable: dstr<br>
Type: string<br>
Total Size: 56 bytes<br>
7 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [7]<br>
Coordinates: <br>
(0) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 55 7.29 14 94 7000 1.0 5 -70.2 -98.3 18481 18638 12.5 247<br>
(1) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 55 56.21 28 94 6689 1.0 5 -72.3 -99.8 18750 18907 15.5 228<br>
(2) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 56 16.21 21 94 6570 1.0 5 -72.9 999.9 18855 19014 17.2 229<br>
(3) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 56 54.21 28 94 6360 1.0 5 -73.1 999.9 19046 19210 19.1 243<br>
(4) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 58 24.21 28 94 5861 1.0 5 -73.0 999.9 19525 19694 13.5 290<br>
(5) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 58 48.21 21 94 5744 1.0 5 -72.9 999.9 19643 19816 14.3 291<br>
(6) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 59 29.21 28 94 5551 1.0 5 -69.3 -97.6 19846 20025 11.7 290<br>
(0) 72249 88888 -98.3<br>
(1) 72249 88888 -99.8<br>
(2) 72249 88888 999.9<br>
(3) 72249 88888 999.9<br>
(4) 72249 88888 999.9<br>
(5) 72249 88888 999.9<br>
(6) 72249 88888 -97.6<br>
(0) ---<br>
<br>
<br>
Variable: dstr (subsection)<br>
Type: string<br>
Total Size: 24 bytes<br>
3 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [3]<br>
Coordinates: <br>
(0) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 55 7.29 14 94 7000 1.0 5 -70.2 -98.3 18481 18638 12.5 247<br>
(1) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 55 56.21 28 94 6689 1.0 5 -72.3 -99.8 18750 18907 15.5 228<br>
(2) 72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 59 29.21 28 94 5551 1.0 5 -69.3 -97.6 19846 20025 11.7 290<br>
(0) ---<br>
<br>
</div>
</div>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Tue, Apr 9, 2019 at 10:18 AM xiaoming Hu <<a href="mailto:yuanfangcan@hotmail.com">yuanfangcan@hotmail.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I need to read a lot of table data. but some of them contains **** (but the number and location of **** in the file are uncertain), see one of the examples below. </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
What is the best way to handle the **** in these files other than manually removing them? I am currently using readAsciiTable to read. </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks a lot!</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Xiaoming </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 55 7.29 14 94 7000 1.0 5 -70.2 -98.3 18481 18638 12.5 247<br>
</span>
<div>72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 55 56.21 28 94 6689 1.0 5 -72.3 -99.8 18750 18907 15.5 228<br>
</div>
<div>72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 56 16.21 21 94 6570 1.0 5 -72.9 ***** 18855 19014 17.2 229<br>
</div>
<div>72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 56 54.21 28 94 6360 1.0 5 -73.1 ***** 19046 19210 19.1 243<br>
</div>
<div>72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 58 24.21 28 94 5861 1.0 5 -73.0 ***** 19525 19694 13.5 290<br>
</div>
<div>72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 58 48.21 21 94 5744 1.0 5 -72.9 ***** 19643 19816 14.3 291<br>
</div>
<div>72249 03990 87 3 2008 3 31 11 51 55.21 32.83500 -97.29806 199 195 6 2008 3 31 12 59 29.21 28 94 5551 1.0 5 -69.3 -97.6 19846 20025 11.7 290<br>
</div>
<span></span><br>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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>
</div>
</body>
</html>