[netcdfgroup] Converting Byte Data Type

Hey,

     I am working on a project where I need to read NEXRAD (Next Generation
Radar) weather data that is stored in the NetCDF format. I am trying to
pull out the data for a variable called SpectrumWidth using Java, but I
noticed that it is stored in the byte data type. I've spent days searching
on how to convert this data into a float or a double, but I haven't been
able to find much.

     Right now the values I am getting are either 0s or the range of about
129-140. However, my partner, who knows more about weather radar data, says
that the values for SpectrumWidth should be either floats or doubles in the
range of 0.0 to around 15.0. I am not sure if this is even possible to do,
but from my understanding, data is stored in the byte data type to save
space, so is there a way to convert this data back to either a float or
double in the range I am looking for?

This is the closest I have come to converting this byte data, but it's not
working how I need it to.

dataFile = NetcdfFile.open(file, null);

Variable spectrumWidth = dataFile.findVariable("SpectrumWidth");

//Store the contents of spectrumWidth in an Array
 Array varArray = spectrumWidth.read();

//Convert the unsigned Array to signed
 Array spec = MAMath.convertUnsigned(varArray);

     I also noticed that SpectrumWidth has three dimensions, so would I
need to store this data in a multi-dimensional array? Sorry for the weird
question, but I hope it makes sense. Any help would be greatly appreciated.
Thanks!

-Mike
  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: