<div dir="ltr">Great, thanks for your help guys!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 17, 2014 at 11:42 AM, David Brown <span dir="ltr">&lt;<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Following up on Rick&#39;s comments, he is exactly right about the format.<br>
I downloaded a sample precipitation file from the web site, and tried<br>
to read and plot it using the suggestions at the web page Rick<br>
referred to. The function &#39;cbinread&#39; works well and the data is little<br>
endian, so no byte swapping is needed on my Intel-processor-based<br>
machine. The data is written from top to bottom, so the Y Axis does<br>
need to be reversed to plot in NCL using the native projection which<br>
is basic lat/lon (cylindrical equidistant).<br>
<br>
Here is the code and attached is the PNG file output.<br>
<br>
dat = cbinread(&quot;PRISM_ppt_early_4kmD1_MTD_20141016_bil.bil&quot;,(/621,1405/),&quot;float&quot;)<br>
dat@_FillValue=-9999<br>
wks = gsn_open_wks(&quot;png&quot;,&quot;bil-test&quot;)<br>
res = True<br>
res@cnFillOn = True<br>
res@cnLinesOn = False<br>
res@cnLineLabelsOn = False<br>
res@cnFillMode = &quot;rasterfill&quot;<br>
res@mpMaxLatF=49.916666666669<br>
res@mpMinLatF= res@mpMaxLatF -  .041666666667 * 621<br>
res@mpMinLonF= -125.000000000000<br>
res@mpMaxLonF = res@mpMinLonF + .041666666667 * 1405<br>
res@mpLimitMode = &quot;latlon&quot;<br>
res@tfDoNDCOverlay = True<br>
res@tiMainString = &quot;PRISM_ppt_early_4kmD1_MTD_20141016_bil.bil&quot;<br>
plot = gsn_csm_contour_map(wks,dat(::-1,:),res)<br>
<br>
 -dave<br>
<span class="im HOEnZb"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On Fri, Oct 17, 2014 at 11:08 AM, Rick Brownrigg &lt;<a href="mailto:brownrig@ucar.edu">brownrig@ucar.edu</a>&gt; wrote:<br>
</span><div class="HOEnZb"><div class="h5">&gt; Hi Daniel<br>
&gt;<br>
&gt; &quot;Band-Interleaved Format&quot;  My understanding of the format is that the .bil<br>
&gt; file itself is just a &quot;brick of floats&quot; (or integers, bytes, etc.) that is<br>
&gt; MxNxP, where P is the number of bands that make up this image. It is<br>
&gt; organized as all of the floats (ints) of the first row for band-1, followed<br>
&gt; by the floats for first row&#39;s 2nd ban, ..., the floats of first row&#39;s Pth<br>
&gt; band, then likewise for subsequent rows, ...<br>
&gt;<br>
&gt; In your example, there&#39;s only 1 band. We see that it is 621x1405, comprised<br>
&gt; of 32-bit floats. Hence the first row is 5620 bytes in length:  1405 *<br>
&gt; sizeof(float) = 1405 * 4 = 5620.  This should be relatively straightforward<br>
&gt; to read:<br>
&gt;<br>
&gt; <a href="http://ncl.ucar.edu/Applications/r-binary.shtml" target="_blank">http://ncl.ucar.edu/Applications/r-binary.shtml</a><br>
&gt;<br>
&gt; Its not clear to me from the header whether the first row is the<br>
&gt; bottom/southern-most, or the top/northern-most.<br>
&gt;<br>
&gt; Does that help?<br>
&gt; Rick<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Oct 17, 2014 at 10:37 AM, Daniel Barandiaran<br>
&gt; &lt;<a href="mailto:dbarandiaran@gmail.com">dbarandiaran@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Has anyone dealt with these files?  I&#39;ve done some work with binary files<br>
&gt;&gt; before, but I am no pro by any means.  I&#39;ve read a little about the data<br>
&gt;&gt; format of these .bil files, but I&#39;m still not sure about exactly how these<br>
&gt;&gt; files are formatted.  They have a file header, which contains the following:<br>
&gt;&gt;<br>
&gt;&gt; BYTEORDER      I<br>
&gt;&gt; LAYOUT         BIL<br>
&gt;&gt; NROWS          621<br>
&gt;&gt; NCOLS          1405<br>
&gt;&gt; NBANDS         1<br>
&gt;&gt; NBITS          32<br>
&gt;&gt; BANDROWBYTES   5620<br>
&gt;&gt; TOTALROWBYTES  5620<br>
&gt;&gt; PIXELTYPE      FLOAT<br>
&gt;&gt; ULXMAP         -125<br>
&gt;&gt; ULYMAP         49.9166666666687<br>
&gt;&gt; XDIM           0.04166666666667<br>
&gt;&gt; YDIM           0.04166666666667<br>
&gt;&gt; NODATA         -9999<br>
&gt;&gt;<br>
&gt;&gt; any help would be appreciated!<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Danny Barandiaran<br>
&gt;&gt; Department of Plants, Soils, and Climate<br>
&gt;&gt; Utah State University<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; ncl-talk mailing list<br>
&gt;&gt; List instructions, subscriber options, unsubscribe:<br>
&gt;&gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; ncl-talk mailing list<br>
&gt; List instructions, subscriber options, unsubscribe:<br>
&gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Danny Barandiaran<div>Department of Plants, Soils, and Climate</div><div>Utah State University</div><div><br><div><br></div></div>
</div>