<div dir="ltr"><div><div><div>The is no need for a function. Re is a scalar<br><br></div>f = addfile(&quot;foo.grb&quot;,&quot;r&quot;)<br></div>h = f-&gt;<span style="font-size:9pt;font-family:&quot;lucida console&quot;">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 = &quot;Geometric Height&quot;<br></div><div> Z@units = &quot;m&quot;<br></div><div>                            ; copy selected attributes<br></div><div>  Z@coordinates = <span style="font-size:9pt;font-family:&quot;lucida console&quot;">&quot;gridlat_0 gridlon_0&quot;<br> <font size="2">Z@</font></span><font size="2"><span style="font-family:&quot;lucida console&quot;">forecast_time     = h@</span></font><span style="font-size:9pt;font-family:&quot;lucida console&quot;"><font size="2">forecast_time</font><br> Z@</span><span style="font-size:9pt;font-family:&quot;lucida console&quot;">forecast_time_units = h@</span><span style="font-size:9pt;font-family:&quot;lucida console&quot;">forecast_time_units<br> Z@</span><span style="font-size:9pt;font-family:&quot;lucida console&quot;">initial_time        = h@</span><span style="font-size:9pt;font-family:&quot;lucida console&quot;">initial_time <br></span></div><div><span style="font-size:9pt;font-family:&quot;lucida console&quot;">              ; 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(&quot;geometric_height&quot;)<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:&quot;lucida console&quot;"><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 = &quot;Geometric Height&quot;<br></div><div>   Z@units = &quot;m&quot;<br></div><div>                            ; copy selected attributes<br></div><div>   Z@coordinates = <span style="font-size:9pt;font-family:&quot;lucida console&quot;">&quot;gridlat_0 gridlon_0&quot;<br> <font size="2">Z@</font></span><font size="2"><span style="font-family:&quot;lucida console&quot;">forecast_time     = h@</span></font><span style="font-size:9pt;font-family:&quot;lucida console&quot;"><font size="2">forecast_time</font><br> Z@</span><span style="font-size:9pt;font-family:&quot;lucida console&quot;">forecast_time_units = h@</span><span style="font-size:9pt;font-family:&quot;lucida console&quot;">forecast_time_units<br> Z@</span><span style="font-size:9pt;font-family:&quot;lucida console&quot;">initial_time        = h@</span><span style="font-size:9pt;font-family:&quot;lucida console&quot;">initial_time <br></span></div><div><span style="font-size:9pt;font-family:&quot;lucida console&quot;">              ; 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>(&quot;grb&quot;,&quot;SingleElementDimensions&quot;,&quot;Initial_time&quot;)</span></pre>before<br><br>f = addfile(&quot;foo.grb&quot;,&quot;r&quot;)<br>h = f-&gt;<span style="font-size:9pt;font-family:&quot;lucida console&quot;">GEOHGT<br></span></div><div><span style="font-size:9pt;font-family:&quot;lucida console&quot;">print(h)<br><br>===============<br></span></div><div><span style="font-size:9pt;font-family:&quot;lucida console&quot;">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">&lt;<a href="mailto:forrest.black@nasa.gov" target="_blank">forrest.black@nasa.gov</a>&gt;</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:&quot;Lucida Console&quot;">Variable: Geopotential Height<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:&quot;Lucida Console&quot;">Type: float<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:&quot;Lucida Console&quot;">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:&quot;Lucida Console&quot;">            631331 values<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:&quot;Lucida Console&quot;">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:&quot;Lucida Console&quot;">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:&quot;Lucida Console&quot;">Coordinates:<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:&quot;Lucida Console&quot;">            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:&quot;Lucida Console&quot;">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:&quot;Lucida Console&quot;">  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:&quot;Lucida Console&quot;">  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:&quot;Lucida Console&quot;">  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:&quot;Lucida Console&quot;">  units :       gpm<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:&quot;Lucida Console&quot;">  _FillValue :  1e+20<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:&quot;Lucida Console&quot;">  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:&quot;Lucida Console&quot;">  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:&quot;Lucida Console&quot;">  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:&quot;Lucida Console&quot;">  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:&quot;Lucida Console&quot;">  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:&quot;Lucida Console&quot;">  forecast_time :       0<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.0pt;font-family:&quot;Lucida Console&quot;">  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:&quot;Lucida Console&quot;">  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 &quot;Times New Roman&quot;">       
</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>