<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Dave,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I started to reply and then saw that Jim had replied.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">He's correct that you need to apply the scale_factor and add_offset to your data. You can use the special "short2flt" function to do this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">sst = short2flt(f->sst)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It's important to note that packed data is not always packed the same way!  short2flt applies this calculation:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default">     xF = xS*xS@scale_factor + x@add_offset <br></div><div class="gmail_default"><br></div><div class="gmail_default">but we've seen data where the formula was :</div><div class="gmail_default"><br></div><div class="gmail_default">    xF = xS@scale_factor * (xS-xS@add_offset)</div><div class="gmail_default"><br></div><div class="gmail_default">This is a case where you have to look at your data (i.e. via printMinMax) after you do the calculation, to make sure the values look right. Sometimes data will have a "valid_range" attribute that tells you what the expected range of this particular variable is.</div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 28, 2018 at 8:33 AM, dave montgomery <span dir="ltr"><<a href="mailto:montgomery_dave@yahoo.com" target="_blank">montgomery_dave@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:13px"><div>Dear NCL Users,<br><div>I plotted sst on a local scale using NCL. The result for the sst variable are way too high. Plotting the same data with CDO and using ncview, the results for the sst variable are in the values to be expected. In CDO, the variable sst has a range from 297.274K to 300.189K but in NCL the plotted graph showed a range from about 12000 to 16000. Could our most esteem NCL experts help me out here? I would be grateful for your help.<br><div>Attached are the file, script and the corresponding plot.</div><div>I am using NCL version 6.4.0<br><div>Data is from ERA5</div><div><br><div>Best regards</div><span class="HOEnZb"><font color="#888888"><div>Dave Montgomery<br> </div></font></span></div></div></div></div></div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>