Re: Unsigned/Signed bytes in NCL

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 27 2013 - 12:16:47 MST

Hi Lisa,
You can use the invertible functions tosigned and tounsigned to convert back and forth between signed and unsigned representations of any integer type.
  -dave

On Nov 27, 2013, at 10:54 AM, Lisa Alexander <lisa_s_a@yahoo.ca> wrote:

> Hi Rick,
>
> Here is the variable summary:
>
> Variable: ref
> Type: byte
> Total Size: 39942400 bytes
> 39942400 values
> Number of Dimensions: 2
> Dimensions and sizes: [y | 6320] x [x | 6320]
> Coordinates:
> Number Of Attributes: 2
> missing_value : -99
> units : dBz
>
> I was able to get around the issue by using a byte2flt conversion for the variable, but I was just wondering if there was a better way to read the byte data from the file so this conversion is not necessary?
>
> Thanks for your help,
> Lisa
> --------------------------------------------
> On Wed, 11/27/13, Rick Brownrigg <brownrig@ucar.edu> wrote:
>
> Subject: Re: Unsigned/Signed bytes in NCL
> To: "Lisa Alexander" <lisa_s_a@yahoo.ca>
> Cc: ncl-talk@ucar.edu
> Received: Wednesday, November 27, 2013, 12:43 PM
>
> Hi,
>
> Are you saying that when NCL opens your file, it believes
> the variable in question is of type unsigned-byte?
> What does the output of
> "printVarSummary(…yourVariable…)" look like?
>
> Rick
>
> On Nov 27, 2013, at 10:27 AM, Lisa Alexander <lisa_s_a@yahoo.ca>
> wrote:
>
>> Hello,
>>
>> I am a new user to NCL. I am using NCL version 6.1.2.
>> I have been having some trouble with NCL in reading
> byte data from netCDF files. I have a variable that I am
> trying to read that has all positive values (reflectivity),
> but the missing_value is -99. NCL seems to only want to read
> it as a unsigned byte (0 to 255) which means the variable
> shows a non-uniform error message.
>>
>> Is there any way to get NCL to read the data as a
> signed byte type so that the -99 values are valid in the
> data set?
>>
>> Thanks for your help,
>> Lisa
>>
>>
>> _______________________________________________
>> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Nov 27 12:16:59 2013

This archive was generated by hypermail 2.1.8 : Wed Dec 04 2013 - 20:42:38 MST