<div dir="ltr"><div><div><div>The is no need for a function. Re is a scalar<br><br></div>f = addfile("foo.grb","r")<br></div>h = f-><span style="font-size:9pt;font-family:"lucida console"">GEOHGT ;[lv_ISBL0 | 37] x [ygrid_0 | 113] x [xgrid_0 | 151]<br><br><font size="2"> Re = </font></span><font size="2">6356766.0</font><br> Z = (h*Re)/(Re-h)<br><div> ; assign appropriate attributes<br></div><div> Z@long_name = "Geometric Height"<br></div><div> Z@units = "m"<br></div><div> ; copy selected attributes<br></div><div> Z@coordinates = <span style="font-size:9pt;font-family:"lucida console"">"gridlat_0 gridlon_0"<br> <font size="2">Z@</font></span><font size="2"><span style="font-family:"lucida console"">forecast_time = h@</span></font><span style="font-size:9pt;font-family:"lucida console""><font size="2">forecast_time</font><br> Z@</span><span style="font-size:9pt;font-family:"lucida console"">forecast_time_units = h@</span><span style="font-size:9pt;font-family:"lucida console"">forecast_time_units<br> Z@</span><span style="font-size:9pt;font-family:"lucida console"">initial_time = h@</span><span style="font-size:9pt;font-family:"lucida console"">initial_time <br></span></div><div><span style="font-size:9pt;font-family:"lucida console""> ; copy any coordinate variables<br></span></div> copy_VarCoords(h,Z)<br></div> printVarSummary(Z)<div><div><div><div><br>=============================<br></div><div>You may wish to create your own function<br><br></div><div>undef("geometric_height")<br></div><div>function geometric_height(h:numeric)<br></div><div>local Re, Z<br></div><div>begin<br> <span style="font-size:9pt;font-family:"lucida console""><font size="2">Re = </font></span><font size="2">6356766.0</font><br> Z = (h*Re)/(Re-h)<br><div> ; assign appropriate attributes<br></div><div> Z@long_name = "Geometric Height"<br></div><div> Z@units = "m"<br></div><div> ; copy selected attributes<br></div><div> Z@coordinates = <span style="font-size:9pt;font-family:"lucida console"">"gridlat_0 gridlon_0"<br> <font size="2">Z@</font></span><font size="2"><span style="font-family:"lucida console"">forecast_time = h@</span></font><span style="font-size:9pt;font-family:"lucida console""><font size="2">forecast_time</font><br> Z@</span><span style="font-size:9pt;font-family:"lucida console"">forecast_time_units = h@</span><span style="font-size:9pt;font-family:"lucida console"">forecast_time_units<br> Z@</span><span style="font-size:9pt;font-family:"lucida console"">initial_time = h@</span><span style="font-size:9pt;font-family:"lucida console"">initial_time <br></span></div><div><span style="font-size:9pt;font-family:"lucida console""> ; copy any coordinate variables<br></span></div> copy_VarCoords(h,Z)<br></div><div> return(Z)<br></div><div>end <br><br>=============<br><br></div><div>As an experiment, add<br></div><div><pre><span style="font-family:arial,helvetica,sans-serif"><strong>setfileoption</strong>("grb","SingleElementDimensions","Initial_time")</span></pre>before<br><br>f = addfile("foo.grb","r")<br>h = f-><span style="font-size:9pt;font-family:"lucida console"">GEOHGT<br></span></div><div><span style="font-size:9pt;font-family:"lucida console"">print(h)<br><br>===============<br></span></div><div><span style="font-size:9pt;font-family:"lucida console"">If you are new to NCL, please see the DKRXZ tutorials at:<br><br><a href="https://www.ncl.ucar.edu/Document/Manuals/">https://www.ncl.ucar.edu/Document/Manuals/</a><br></span></div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 6, 2017 at 9:04 AM, Black, Forrest (LARC-D318)[UNIVERSITIES SPACE RESEARCH ASSOCIATION] <span dir="ltr"><<a href="mailto:forrest.black@nasa.gov" target="_blank">forrest.black@nasa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="#0563C1" vlink="#954F72" lang="EN-US">
<div class="m_-7628191577050244225WordSection1">
<p class="MsoNormal">Hello all,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am trying to solve the following equation in NCL:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Z = (h*Re)/(Re-h)’<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Z: Geometric Height<u></u><u></u></p>
<p class="MsoNormal">h: Geopotential height (3D Array)<u></u><u></u></p>
<p class="MsoNormal">Re: Radius of Earth, assumed constant (6356766m)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have looked at some old threads, but am still unsure of what functions I would use to calculate (Re-h)’.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Can anyone give me some suggestions on how to tackle this?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This is the Attribute data for Geopotential Height: <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console"">Variable: Geopotential Height<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console"">Type: float<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console"">Total Size: 2525324 bytes<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> 631331 values<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console"">Number of Dimensions: 3<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console"">Dimensions and sizes: [lv_ISBL0 | 37] x [ygrid_0 | 113] x [xgrid_0 | 151]<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console"">Coordinates:<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> lv_ISBL0: [10000..100000]<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console"">Number Of Attributes: 13<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> center : US National Weather Service - NCEP (WMC)<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> production_status : Operational products<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> long_name : Geopotential height<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> units : gpm<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> _FillValue : 1e+20<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> coordinates : gridlat_0 gridlon_0<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> grid_type : Lambert Conformal can be secant or tangent, conical or bipolar<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> parameter_discipline_and_<wbr>category : Meteorological products, Mass<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> parameter_template_discipline_<wbr>category_number : ( 0, 0, 3, 5 )<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> level_type : Isobaric surface (Pa)<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> forecast_time : 0<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> forecast_time_units : hours<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:"Lucida Console""> initial_time : 01/31/2017 (00:00)<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks for any help.<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="m_-7628191577050244225MsoListParagraph"><u></u><span>-<span style="font:7.0pt "Times New Roman"">
</span></span><u></u>Forrest<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</font></span></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>