<div dir="ltr"><div>Thanks Dave. When I use
<span class="gmail-il">fbinrecread</span> as shown below , I am still getting warning and generated figure does not show any value.<br></div><div>
setfileoption("bin","readbyteorder","littleendian")
</div><div> d1 = fbindirread("./Test/modelout.dat",0,-1,"float")<br><br> printVarSummary(d1)<br> print(d1(0:100))<br></div><div> nlat = 384<br> mlon = 384<br> UNDEF = -999.0<br> </div><div> N1d = dimsizes(d1)<br> M1d = N1d-(nlat*mlon)<br> print("N1d="+N1d+" M1d="+M1d)<br><br> x = onedtond(d1(1:), (/nlat,mlon/))<br> x@_FillValue = UNDEF ;<br> printVarSummary(x)<br> printMinMax(x,0)</div><div><br></div><div> Variable: d1<br>Type: float<br>Total Size: 589832 bytes<br> 147458 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [147458]<br>Coordinates:<br><br><br>Variable: d1 (subsection)<br>Type: float<br>Total Size: 404 bytes<br> 101 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [101]<br>Coordinates:<br>(0) 8.265195e-40<br>(1) 0</div><div>.....[SNIP]</div><div><b>(0) N1d=147458 M1d=2<br>warning:onedtond : output dimension sizes have fewer elements than input, some data not copied<br></b><br>Variable: x<br>Type: float<br>Total Size: 589824 bytes<br> 147456 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [384] x [384]<br>Coordinates:<br>Number Of Attributes: 1<br> _FillValue : -999<br>(0) min=0 max=6.12579e-07, <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 9, 2020 at 2:55 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>That looks like fortran unformatted sequential format, not flat binary. Confirm by seeing if the first four bytes are 00 00 09 00, the same as the last four bytes that you showed. This would be the record size as a little-endian 4-byte integer, which would be correct for this format. This would also explain the 8-byte difference.</div><div><br></div><div>Read in NCL with fbinrecread, not cbinread. Please see the function docs and follow the prototype.</div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 9, 2020 at 12:34 PM Rick Brownrigg via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Well I don't think you want to read it as double, particularly not if you are certain the dimensions are 384x384. I'm wondering if you can safely ignore that last 8 bytes (and ignore the warning). A quick plot would reveal whether the data seem reasonable or definitely misaligned.</div><div><br></div><div>RB<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 9, 2020 at 12:14 PM Debasish Hazra <<a href="mailto:debasish.hazra5@gmail.com" target="_blank">debasish.hazra5@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Thanks Rick.Should I read it as double?</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 9, 2020 at 1:39 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Well, the math works out: 4x384x384=589824. Further, the last 8 bytes of that file do not look like valid floating point values. They are:</div><div><br></div><div> 00 00 00 00 00 00 09 00 <br></div><div><br></div><div>Do you have reason to believe the data is not being read correctly, or are you mostly concerned about the warning message?</div><div><br></div><div>BTW - the data are mostly zeros. <br></div><div><br></div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 9, 2020 at 11:09 AM Debasish Hazra via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div>I am trying to read binary file (attached in the email) through NCL and file size is 589832 bytes. I am reading it as float but it coming out to be 589824. I am not sure what needs to be done to read it.</div><div><br></div><div> setfileoption("bin","readbyteorder","littleendian")</div><div> d1 = cbinread("./Test/modelout.dat",(/4,384,384/),"float")</div><div><br></div><div>warning:cbinread: The size implied by the dimension arrays is less that the size of the file.<br> Only the first 589824 contiguous bytes of the file will be read in.<br>Note dimensions and values may not be aligned properly</div><div><br></div><div>Any help on this is appreciated.</div><div>Thanks</div><div>Debasish</div></div></blockquote></div></blockquote></div></div></blockquote></div></blockquote></div></div>
</blockquote></div>