<div dir="ltr"><div><div><div><div><div>I am not sure I understand but ...<br>Let us(226,4350) be of type unsigned short<br><br></div><div>[1] step-by-step<br><br></div><div> us = f->UnsignedShort <br></div><div> printVarSummary(us)<br><br></div><div> dim_us = <b>dimsizes</b>(us)<br></div><div> nleft = dim_us(0) ; 226<br></div><div> nright = dim_us(1) ; 4350<br><br></div><div> ibit = 9 ; skip 9 bits<br></div><div> nbit = 3 ; 10-12<br></div><div> nskip = 16 ; all 'short' are 16 bits<br></div><div> N = nleft*nright<br></div><div><br></div><div> us_1d = <b>ndtooned</b>(us),</div> ubit_1d = <b>dim_gbits</b>(us_1d, ibit, nbit, nskip, N)<br></div> ubit = <b>reshape</b>(ubit_1d, (/nleft,nright/) )<br></div> <b>delete</b>(us_1d, ubit_1d) ; clean up; not really necessary<br></div><div><br></div><div><br></div>[2} slicker but less clear<br><br></div> ubit = reshape( <b>dim_gbits(</b><b>ndtooned</b>(us), ibit, nbit, nskip, N), <b>product</b>(<b>dimsizes</b>(us)) )<br><div><br></div><div>[3] As always<br> <br> <b> printVarSummary</b>(ubit)<br></div><div> <b>printMinMax</b>(ubit, 0)<br><br></div><div>Good Luck<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 3, 2017 at 2:19 AM, qudsia zafar <span dir="ltr"><<a href="mailto:missquaddus@gmail.com" target="_blank">missquaddus@gmail.com</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">Hi,<div><br></div><div>I am working with a 2-D array [226 x 4350] of type 'ushort' consisting of 16-bit integers. I want to extract bits 1-3 in correspondence with bits 10-12 from the array. i have seen the function 'dim_gbits' but am confused in setting the function parameters such as <em style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">ibit</em><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">, </span><em style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">nbits </em><span style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">and</span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px"> </span><em style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">nskip. </em> </div><div><br></div><div>Would very much appreciate the help in this regard.</div><div><br></div><div>Sincerely,</div><div>qudsia </div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>