<div dir='auto'>Dear All,<div dir="auto">Thanks for your contributions. It worked. Great job guys.</div><div dir="auto">Best regards </div><div dir="auto">Dave M.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 28 Aug 2018 20:01, Dennis Shea <shea@ucar.edu> wrote:<br type="attribution" /><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div>More information:<br /><br /></div>If the netCDF file is CF or COARDS convention conforming as identified by :<br /><br />// global attributes:<br />                :<b>Conventions</b> = "CF-???"<br /><br /></div>then these conventions <b>require </b>that the first formula Mary mentioned be used<b>, </b>Specifically:<b><br /><br /></b><b>   xF = xS*xS@scale_factor + x@add_offset   </b>; x<b>F</b>=>float, x<b>S</b>=>short<b><br /><br /></b></div>The CDO<b> </b>(1) check for the presence of the CF/COARDS <b>Conventions</b> attribute. If present, (2) the CDO automatically applies the formula.<br /><br /></div>While NCL could do the conversion automatically, it assumes that the reader wants what is on the file  <br /><br /></div>    xS = f->xShort                 ; type short<br /></div><div>    printVarSummary(xS)<br /></div><div><br /></div>As noted previously, <br /><br /></div>    xF = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml"><b>short2flt</b></a>( f->xShort )   ; type float<br /></div>    printVarSummary(xF)<br /></div>    printMinMax(xF,0)<br /><div><div><div><div><div><div><b></b></div></div></div></div></div></div></div><div><br /><div class="elided-text">On Tue, Aug 28, 2018 at 9:17 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu">haley@ucar.edu</a>></span> wrote:<br /><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-size:small">Hi Dave,</div><div style="font-size:small"><br /></div><div style="font-size:small">I started to reply and then saw that Jim had replied.</div><div style="font-size:small"><br /></div><div 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 style="font-size:small"><br /></div><div style="font-size:small">sst = short2flt(f->sst)</div><div style="font-size:small"><br /></div><div 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 style="font-size:small"><br /></div><div>     xF = xS*xS@scale_factor + x@add_offset <br /></div><div><br /></div><div>but we've seen data where the formula was :</div><div><br /></div><div>    xF = xS@scale_factor * (xS-xS@add_offset)</div><div><br /></div><div>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><font color="#888888"><div><br /></div><div>--Mary</div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div></font></div><div><br /><div class="elided-text"><div><div>On Tue, Aug 28, 2018 at 8:33 AM, dave montgomery <span dir="ltr"><<a href="mailto:montgomery_dave@yahoo.com">montgomery_dave@yahoo.com</a>></span> wrote:<br /></div></div><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><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><font color="#888888"><div>Dave Montgomery<br /> </div></font></div></div></div></div></div></div><br /></div></div>______________________________<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">http://mailman.ucar.edu/mailma<wbr />n/listinfo/ncl-talk</a><br />
<br /></blockquote></div><br /></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">http://mailman.ucar.edu/<wbr />mailman/listinfo/ncl-talk</a><br />
<br /></blockquote></div><br /></div>
</blockquote></div><br></div>