<div dir="ltr"><pre><a href="http://www.ncl.ucar.edu/Applications/HDF.shtml">http://www.ncl.ucar.edu/Applications/HDF.shtml</a><br><br></pre><pre>provides an application example. As noted, this is a sequence of bits not bytes.<br><br></pre><pre><br>;******************************************************************
; hdf4eos_5.ncl
;
; Concepts illustrated:
; - Plotting EOS-DIS data
; - Reading HDF4 data
; - Using dim_gbits to extract bits of information from a variable
[SNIP]<br>;******************************************************************
; Bit fields within each byte are numbered from the left:
; 7, 6, 5, 4, 3, 2, 1, 0.
; The left-most bit (bit 7) is the most significant bit.
; The right-most bit (bit 0) is the least significant bit.
;
; bit field Description Key
; --------- ----------- ---
; 2, 1 Unobstructed FOV Quality Flag 00 (0) = Cloudy
; 01 (1) = Uncertain
; 10 (2) = Probably Clear
; 11 (3) = Clear
;******************************************************************<br><br>===<br></pre><pre>FYI: There is another function that "Unpacks one-bit chunks from the input array."<br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/getbitsone.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/getbitsone.shtml</a><br><br></pre><pre>Good luck<br></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 2, 2015 at 7:45 AM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi Kevin,<br><br></div>I get the same result. However, your case is not exactly like the examples page, which depicts a sequence of bits, whereas you are feeding a sequence of bytes into the function. If you look at the series of bits within those bytes:<br><br>0000 0000 | 0000 0001 | 0000 0000 ...<br>^ ^ ^<br></div>x[0] x[1] x[2] ...<br><br></div>and then perform the dim_gbits decomposition on that, you do indeed get (/ 0, 0, 2, 0 /)<br><br></div>Hope that helps...<br></div>Rick<br><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Mar 2, 2015 at 6:00 AM, Kevin Vermeesch <span dir="ltr"><<a href="mailto:kevin.c.vermeesch@nasa.gov" target="_blank">kevin.c.vermeesch@nasa.gov</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div bgcolor="#FFFFFF" text="#000000">
<font size="+1"><font face="Courier New">Hi,<br>
I'm trying to use the built-in function dim_gbits (<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_gbits.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_gbits.shtml</a>)
and am not getting the expected result while trying the example
in the link above. Looking at the worked example in the
Description Section, I used the following commands:<br>
<br>
x = tobyte((/0,1,0,1,0,1,1,1,1,1,1,0,0,1,0,0,1,1,0,1,0,0/))<br>
print(dim_gbits(x,5,2,3,4))<br>
<br>
I get: (/0,0,2,0/)<br>
when I was expecting to get: (/3,2,1,0/) as the example
indicates.<br>
<br>
I am using version 6.1.0 (Cygwin) and 6.2.1 (32-bit CentOS). Is
this a bug or am I not using/understanding the function
correctly?<br>
thanks,<br>
Kevin</font></font>
</div>
<br></div></div>_______________________________________________<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></blockquote></div><br></div>
<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></blockquote></div><br></div>