<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"><<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>></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'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 'cbinread' 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("PRISM_ppt_early_4kmD1_MTD_20141016_bil.bil",(/621,1405/),"float")<br>
dat@_FillValue=-9999<br>
wks = gsn_open_wks("png","bil-test")<br>
res = True<br>
res@cnFillOn = True<br>
res@cnLinesOn = False<br>
res@cnLineLabelsOn = False<br>
res@cnFillMode = "rasterfill"<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 = "latlon"<br>
res@tfDoNDCOverlay = True<br>
res@tiMainString = "PRISM_ppt_early_4kmD1_MTD_20141016_bil.bil"<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 <<a href="mailto:brownrig@ucar.edu">brownrig@ucar.edu</a>> wrote:<br>
</span><div class="HOEnZb"><div class="h5">> Hi Daniel<br>
><br>
> "Band-Interleaved Format" My understanding of the format is that the .bil<br>
> file itself is just a "brick of floats" (or integers, bytes, etc.) that is<br>
> MxNxP, where P is the number of bands that make up this image. It is<br>
> organized as all of the floats (ints) of the first row for band-1, followed<br>
> by the floats for first row's 2nd ban, ..., the floats of first row's Pth<br>
> band, then likewise for subsequent rows, ...<br>
><br>
> In your example, there's only 1 band. We see that it is 621x1405, comprised<br>
> of 32-bit floats. Hence the first row is 5620 bytes in length: 1405 *<br>
> sizeof(float) = 1405 * 4 = 5620. This should be relatively straightforward<br>
> to read:<br>
><br>
> <a href="http://ncl.ucar.edu/Applications/r-binary.shtml" target="_blank">http://ncl.ucar.edu/Applications/r-binary.shtml</a><br>
><br>
> Its not clear to me from the header whether the first row is the<br>
> bottom/southern-most, or the top/northern-most.<br>
><br>
> Does that help?<br>
> Rick<br>
><br>
><br>
> On Fri, Oct 17, 2014 at 10:37 AM, Daniel Barandiaran<br>
> <<a href="mailto:dbarandiaran@gmail.com">dbarandiaran@gmail.com</a>> wrote:<br>
>><br>
>> Has anyone dealt with these files? I've done some work with binary files<br>
>> before, but I am no pro by any means. I've read a little about the data<br>
>> format of these .bil files, but I'm still not sure about exactly how these<br>
>> files are formatted. They have a file header, which contains the following:<br>
>><br>
>> BYTEORDER I<br>
>> LAYOUT BIL<br>
>> NROWS 621<br>
>> NCOLS 1405<br>
>> NBANDS 1<br>
>> NBITS 32<br>
>> BANDROWBYTES 5620<br>
>> TOTALROWBYTES 5620<br>
>> PIXELTYPE FLOAT<br>
>> ULXMAP -125<br>
>> ULYMAP 49.9166666666687<br>
>> XDIM 0.04166666666667<br>
>> YDIM 0.04166666666667<br>
>> NODATA -9999<br>
>><br>
>> any help would be appreciated!<br>
>><br>
>> --<br>
>> Danny Barandiaran<br>
>> Department of Plants, Soils, and Climate<br>
>> Utah State University<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> ncl-talk mailing list<br>
>> List instructions, subscriber options, unsubscribe:<br>
>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> ncl-talk mailing list<br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
><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>