Re: convert a decimal to 32 bit unsigned binary

From: cheryl Ma <xiaoyancloud_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 19 2013 - 07:26:18 MST

Dave,

in this case, "36" is a decimal number. It need be converted to a 32-bit
binary number and then one can know which day having the observation, e.g.
If there is observation on the 1st day of the month, then bit 1 would be
set to true and if there is observation on the 2nd day of the month, then
bit 2 would be set to true and so on.

We can write a fortran code to convert a decimal number to a 32-bit binary
number. My question is if there is a function in ncl to do this?

Thanks,
Xiaoyan

On Mon, Feb 18, 2013 at 4:01 PM, Dave Allured - NOAA Affiliate <
dave.allured@noaa.gov> wrote:

> Xiaoyan,
>
> Be careful. In the example you show, "36" is NOT a decimal number. It
> looks like it is really a list of two separate integers, 3 and 6.
>
> It is good that the example image showed the graphic mapping between
> calendar days and bit positions, because the statement "Days of Month
> Observed = 36" is badly constructed and very misleading. Maybe they should
> have said "Days of Month Observed = 3 and 6".
>
> So, what do you really want to do? Maybe convert a LIST of calendar day
> numbers 1 to 31, to a 32-bit unsigned integer, using bit position encoding
> as shown in this example?
>
> Please reply only to the user list!
>
> --Dave
>
> On Mon, Feb 18, 2013 at 8:57 AM, cheryl Ma <xiaoyancloud@gmail.com> wrote:
>
>> Dear all,
>>
>> Is there any function in NCL to convert a decimal number to a 32-bit
>> unsigned binary? In an example shown below, 36 is a decimal, so its binary
>> is 00100100000000000000000000000000.
>>
>> Thanks,
>> Xiaoyan
>>
>> ==============================================
>> [image: Figure 3: days of month flag interpretation.]
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 19 07:26:29 2013

This archive was generated by hypermail 2.1.8 : Thu Feb 21 2013 - 11:26:43 MST