<div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Hello:</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">I am trying to read Nexrad Reflectivity data from a netCDF file in which Reflectivity has a "byte" format and is defined as:</div><div class="gmail_default" style="font-family:arial,sans-serif">
<p class="gmail-p1" style="font-size:14px;margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="color:rgb(0,0,255);font-variant-ligatures:no-common-ligatures;font-size:small">radar-data/20120611> ncdump -h 20120611T1900Z.nc</span></p><p class="gmail-p1" style="font-style:normal;font-variant:normal;font-kerning:auto;font-feature-settings:normal;font-weight:normal;font-stretch:normal;line-height:normal;font-family:Courier;margin:0px;background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>byte Reflectivity(Altitude, Latitude, Longitude) ;</font></span></p><p class="gmail-p1" style="font-style:normal;font-variant:normal;font-kerning:auto;font-feature-settings:normal;font-weight:normal;font-stretch:normal;line-height:normal;font-family:Courier;margin:0px;background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Reflectivity:long_name = "Radar Reflectivity" ;</font></span></p><p class="gmail-p1" style="font-style:normal;font-variant:normal;font-kerning:auto;font-feature-settings:normal;font-weight:normal;font-stretch:normal;line-height:normal;font-family:Courier;margin:0px;background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Reflectivity:units = "dBZ" ;</font></span></p><p class="gmail-p1" style="font-style:normal;font-variant:normal;font-kerning:auto;font-feature-settings:normal;font-weight:normal;font-stretch:normal;line-height:normal;font-family:Courier;margin:0px;background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Reflectivity:scale_factor = 0.5f ;</font></span></p><p class="gmail-p1" style="font-style:normal;font-variant:normal;font-kerning:auto;font-feature-settings:normal;font-weight:normal;font-stretch:normal;line-height:normal;font-family:Courier;margin:0px;background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Reflectivity:add_offset = -33.f ;</font></span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">
</font></span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Reflectivity:missing_value = 0b ;</font></span></p></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">A printVarSummary of the dBZ_b variable that points to Reflectivity shows:</div><div class="gmail_default" style="font-family:arial,sans-serif">
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">Variable: dBZ_b</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">Type: byte</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">Total Size: 10064208 bytes</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>10064208 values</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">Number of Dimensions: 3</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">Dimensions and sizes:<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>[Altitude | 24] x [Latitude | 539] x [Longitude | 778]</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">Coordinates:<span class="gmail-Apple-converted-space"> </span></font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>Altitude: [ 1..24]</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>Latitude: [30.94..41.7]</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>Longitude: [260.12..275.66]</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">Number Of Attributes: 6</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>long_name :<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Radar Reflectivity</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>units :<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>dBZ</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>scale_factor :<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>0.5</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>add_offset :<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>-33</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>missing_value :<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>0</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><span class="gmail-Apple-converted-space"> </span>_FillValue :<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>0</font></span></p></div><div class="gmail_default" style="font-family:arial,sans-serif"><font color="#0000ff"><br></font></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">After reading the section on "Coercion of types", and for now ignoring scale_factor and add_offset, I simply used the tofloat function to output the max and min values of dBZ_b. I got:</div><div class="gmail_default" style="">
<p class="gmail-p1" style="font-family:Courier;margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">(0)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>--- max dBZ_b = 127</font></span></p>
<p class="gmail-p1" style="font-family:Courier;margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">(0)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>--- min dBZ_b = -128</font></span></p><p class="gmail-p1" style="font-family:Courier;margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff"><br></font></span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font style="" face="arial, sans-serif" color="#000000">Finally, using scale_factor and add_offset, I used the function byte2flt to convert dBZ_b to a float and output the max and min value of dBZ_s, or:</font></span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">
</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="color:rgb(0,0,255);font-variant-ligatures:no-common-ligatures">dBZ_s = byte2flt(dBZ_b)</span><br></p></div><div class="gmail_default" style="font-family:arial,sans-serif">
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">(0)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>--- max dBZ_s = 30.5</font></span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Courier"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font color="#0000ff">(0)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>--- min dBZ_s = -97</font></span></p></div><div><br></div><div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">The maximum value of dBZ_s is much lower than I expected (the maximum value of dBZ_s should actually be 58.5 dBZ, as derived by an IDL script used to plot the nexrad Reflectivity data for a peer-review publication).</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,sans-serif"><span style="font-size:small">Can somebody help me figure out why I am getting values that are too low relative to what I am expecting. I also tried to bypass the byte2flt function and use the scale_factor and add_offset variables </span><font color="#0000ff">(<span style="font-family:courier">x_float = x_byte*scale + offset</span>)</font>, but to no avail.</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">If you interested to help me out, my working directory on cheyenne is <font color="#0000ff"><span style="font-variant-ligatures:no-common-ligatures;font-family:Courier">/glade/u/home/laura/fromYunYao/radar-data/20120611; the data file is </span><span style="font-variant-ligatures:no-common-ligatures;font-family:Courier">20120611T1900Z.nc; the ncl script is read.ncl; and the main idl script is <a href="http://nexrad.pro">nexrad.pro</a>.</span></font></div>
<div class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Many thanks,</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small">Laura</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:small"><br></div></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">!-------------------------------------------------------------------------------------------------------------</font><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">Laura D. Fowler </font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">Mesoscale and Microscale Meteorology Division (MMM) </font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">National Center for Atmospheric Research<br></font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">P.O. Box 3000, Boulder CO 80307-3000</font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)"><br></font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">e-mail: <a href="mailto:laura@ucar.edu" target="_blank">laura@ucar.edu</a></font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">phone: 303-497-1628</font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)"><br></font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">!-------------------------------------------------------------------------------------------------------------</font><br></div></div></div></div>