[ncl-talk] warning during read ascii file
Dennis Shea
shea at ucar.edu
Thu Aug 20 07:10:43 MDT 2015
seismic = asciiread(ascii_filename,(/725,6/),"float")
6*725 =4350 elements
Maybe, the file has fewer rows?
2984/6 = 497.333 This should be an integer
https://www.ncl.ucar.edu/Document/Functions/Contributed/numAsciiRow.shtml
==========
ncol = 6
nrow = numAsciiRow(ascii_filename)
print("nrow="+nrow)
seismic = asciiread(ascii_filename,(/nrow,ncol/),"float")
=========
Are there hidden characters in the file?
On Thu, Aug 20, 2015 at 1:27 AM, grace <313695096 at qq.com> wrote:
> Hi,all:
> I have read data from ASCII file with NCL:
> ascii_filename = "/public/home/huanglei/data/ob.txt"
> seismic = asciiread(ascii_filename,(/725,6/),"float")
>
> time_o= seismic(:,1) ; Column 1 of file contains X values.
> p_o = seismic(:,2) ; Column 2 of file contains Y values.
> t2_o= seismic(:,3) ; Column 3 of file contains Z values.
> wdir_1= seismic(:,4)
> wspd_1 = seismic(:,5)
>
>
>
> the part of data in the ascii file(ob.txt) are like this:
> 57131 2015051122 0 187 199 20
> 57131 2015051123 0 154 250 3
> 57131 2015051200 0 144 309 11
> 57131 2015051201 0 133 25 8
> 57131 2015051202 0 127 31 16
> 57131 2015051203 0 116 15 12
> 57131 2015051204 0 104 272 16
> 57131 2015051205 0 113 91 5
> 57131 2015051206 0 95 340 6
> 57131 2015051207 0 115 349 7
> 57131 2015051208 0 139 323 11
> 57131 2015051209 0 164 252 16
> 57131 2015051210 0 185 204 31
> 57131 2015051211 0 206 247 19
> 57131 2015051212 0 227 212 15
> 57131 2015051213 0 241 301 12
> 57131 2015051214 0 249 144 19
> 57131 2015051215 0 260 187 14
> 57131 2015051216 0 269 183 22
> 57131 2015051217 0 271 212 20
> 57131 2015051218 0 279 276 8
> 57131 2015051219 0 265 295 11
> 57131 2015051220 0 217 310 12
> 57131 2015051221 0 208 339 8
> 57131 2015051222 0 202 35 5
> 57131 2015051223 0 200 279 17
> 57131 2015051300 0 182 32 5
> 57131 2015051301 0 181 20 16
> 57131 2015051302 0 161 98 6
> 57131 2015051303 0 157 40 17
> 57131 2015051304 0 149 125 4
> 57131 2015051305 0 154 185 8
>
> but it have warning:
> warning:asciiread: End of file reached and only (2984) elements were read
> from the file, filling remaining elements with the default missing value for
> the requested type
>
> how to set the default missing value ?
>
> How can I slove the problem?
> Or do you guys have some advice?
> any information will be appreciated
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
More information about the ncl-talk
mailing list