This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Bruce, Looking at the variable attribute, you will see the _Unsigned = "true" attribute. You'll want to convert the unsigned byte to a short. Note that when converting, you cannot take absolute value, as this mapping shows: byte short ... 125 = 125 126 = 126 127 = 127 -128 = 128 -127 = 129 -126 = 130 -125 = 131 -124 = 132 ... Here's the java code to make the conversion: static public short unsignedByteToShort(byte b) { return (short) (b & 0xff); } The scale factor and offset are exactly what you would expect - scale by 0.5 and subract 64.5, respectively. Hope this helps! -Lansing Madry Unidata Boulder, Colorado > Tech/Help, > > I am trying to work with NEXRAD II data files to extract radial velocity. > I have been able to convert the files I have to a NETCDF format (using > your 'java' utility) to more easily access the data I need. > > Within the NEXRAD files the 'RadialVelocity' field is labeled as in > units of 'm/s', but the actual data are in a 'byte' format (ranging in > value from -127 to +127). Could you direct me to where I find out how > to convert the 'byte' data into a floating point velocity in 'm/s' (the > header also lists an 'scale_factor' of 0.5, and an 'offset' of -64.5)? > > Peace, > > BJ > > -- > o o \ ! \| \ / |/ ! / o / o > -|- -/- --o \- | -/ o-- -\ -|- > /_\_____|\_____/__\____ /_o_____/o\_____o_\_____/__\____/_\____/_\ > Bruce Jackson > Air Resources Board/Technical Support Division > Sacramento, California 95812 > address@hidden<mailto:address@hidden> > (916)324-6916 > > > Ticket Details =================== Ticket ID: HEL-720643 Department: Support THREDDS Priority: Normal Status: Open