<div dir="ltr"><div><div>Sorry, I am not sure how to do this. <br><br></div>You can readily get the height and wind components at the lowest model level. The method I suggested is my only guess. Maybe someone else has abetter idea.<br><br></div>Good Luck<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 6, 2017 at 1:43 PM,  <span dir="ltr">&lt;<a href="mailto:leilane.passos@inpe.br" target="_blank">leilane.passos@inpe.br</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div>
<p>Dear Denis,</p>
<p>Thank you for the answer.</p>
<p>I tried to make in another way. I interpolated from hybrid-sigma levels to pressure using the NCL script vinth2p_ecmwf.ncl, that is for CESM hybrid coordinates to pressure coordinates but uses an ECMWF formulation to extrapolate values below ground (<a href="https://bb.cgd.ucar.edu/converting-hybrid-levels-pressures" target="_blank">https://bb.cgd.ucar.edu/<wbr>converting-hybrid-levels-<wbr>pressures</a>). This interpolation was good, so I tried to do the interpolation from pressure to height, like your suggestions in this post: <a href="https://www.ncl.ucar.edu/Support/talk_archives/2004/0394.html" target="_blank">https://www.ncl.ucar.edu/<wbr>Support/talk_archives/2004/<wbr>0394.html</a><br><br>And the interpolation was not good. Is there any NCL script to interpolate wind from pressure levels to 10m height? I need the wind in 10m just over the ocean.</p>
<p><span id="m_6849271967405665071result_box" class="m_6849271967405665071short_text"><span>My script is attached.</span></span></p>
<p><span class="m_6849271967405665071short_text"><span>Best regards.<br></span></span></p>
<p><span class="m_6849271967405665071short_text"><span>Leilane</span></span></p><div><div class="h5">
<p> </p>
<p>Em 22-05-2017 16:49, Dennis Shea escreveu:</p>
<blockquote type="cite" style="padding-left:5px;border-left:#1010ff 2px solid;margin-left:5px;width:100%">
<div dir="ltr">
<div>The wrf_* functions were developed for the WRF model(s) with the WRF &#39;eta&#39; vertical coordinate system.<br>[ <a href="https://www.researchgate.net/post/Does_WRF_simulation_use_sigma_or_eta_vertical_coordinate_system" target="_blank">https://www.researchgate.net/<wbr>post/Does_WRF_simulation_use_<wbr>sigma_or_eta_vertical_<wbr>coordinate_system</a> ]<br><br></div>
<div>Hence, these functions are not appropriate for CAM data.</div>
<div>---</div>
<div>The calculation of CAM U10 is non-trivial. Many factors are involved: surface roughness, atmospheric stability, ...<br><br></div>
<div>Over the oceans, for neutral stability something like the following is used:</div>
<div><br>    U10 = UL / [ 1 + (sqrt(CN10)/k)*log(ZL/10-PSI)]<wbr>   ;   [1] <br><br></div>
<div>The following variables are readily available at each grid point</div>
<div> </div>
<div>UL  - zonal component of the wind at the Lowest model level<br>ZL  - geopotential height at the Lowest model level</div>
<div>PSI - Sfc. geopotential<br><br></div>
<div> The CN10 must be derived:<br><br></div>
<div>   CN10 - drag Coefficient at 10-m height and Neutral stability
<div style="font-size:19.9253px;font-family:sans-serif"> </div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small">where:</span></div>
<div style="font-family:serif"><span style="font-size:small">    CN10 = (C4/U10) + C5 + C6*U10         [2]<br><br></span></div>
<div style="font-family:serif"><span style="font-size:small">and, over the ocean,<br></span></div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small">    C4=0.0027 m/s , C5=0.000142, C6=0.0000764 m/s<br><br></span></div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small">Note that U10 appears in both [1] and [2]. Hence the solution requires iteration.<br>----<br></span></div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small">Over land, ????? <br>---<br></span></div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small">If you need &#39;numbers&#39; as a filler then maybe using a simple  u10 = U*log(..) could be used. <br><br></span></div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small">Attached is a VERY SIMPLE function. The function requires &#39;surface roughness length&#39; which can be a function of time (season).  This information may be available online.<br><br></span></div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small">Also, as noted within the function, the approximation is most valid in the lowest 100m of the atmosphere.<br></span></div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small"> </span></div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small">Good Luck<br></span></div>
<div style="font-size:19.9253px;font-family:sans-serif"><span style="font-size:small"><br><br></span></div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, May 15, 2017 at 1:09 PM, <span>&lt;<a href="mailto:leilane.passos@inpe.br" target="_blank">leilane.passos@inpe.br</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span style="text-decoration:underline"></span>
<div>
<p>Hi,</p>
<p>I need to interpolate the wind results from CCSM4(CAM) in hybrid sigma level coordinate to height of 10 m. Then, I tried to use the function wrf_user_intrp3d with the u, v and the geopotential height (Z3), but the interpolated field has undefined values and I don&#39;t know the reason. I have the following questions:</p>
<p>1) I think that I should find the interpolated values in the entire domain. But why did I find undefined values in certain areas like Andes Chain?</p>
<p>2) If I use the command vinth2p to interpolate from hybrid to pressure coordinates, what is a similar function that I could use to convert from pressure to height of 10 m?</p>
<p> </p>
<p>; --------------  LOAD FUNCTIONS AND PROCEDURES ----------------<br><br>    load &quot;/usr/share/ncarg/nclscripts/<wbr>csm/gsn_code.ncl&quot;<br>    load &quot;/usr/share/ncarg/nclscripts/<wbr>csm/gsn_csm.ncl&quot;<br>    load &quot;/usr/share/ncarg/nclscripts/<wbr>csm/contributed.ncl&quot;<br>    load &quot;/usr/share/ncarg/nclscripts/<wbr>csm/shea_util.ncl&quot;<br>    load &quot;/usr/share/ncarg/nclscripts/<wbr>wrf/WRFUserARW.ncl&quot;<br>    load &quot;/usr/share/ncarg/nclscripts/<wbr>acentos.ncl&quot;<br><br>    ; --------------  BEGINING OF NCL SCRIPT ----------------<br><br>    begin<br><br>    outfile = &quot;<a href="http://test_U10mV10m.1985.20thC.nc" target="_blank">test_U10mV10m.1985.20thC.nc</a>&quot;<br><br>    if (isfilepresent(outfile)) then<br>        system(&quot;rm -rf &quot;+outfile)          ;-- make sure that file does not exist<br>    end if<br><br>    ;-- open data file<br><br>    in_u = addfile(&quot;<a href="http://224331.U.1985.20thC.U.nc" target="_blank">224331.U.1985.20thC.<wbr>U.nc</a>&quot;,&quot;r&quot;)<br>    in_v = addfile(&quot;<a href="http://224331.V.1985.20thC.V.nc" target="_blank">224331.V.1985.20thC.<wbr>V.nc</a>&quot;,&quot;r&quot;)<br>    in_z = addfile(&quot;<a href="http://239928.Z3.1985.20thC.Z3.nc" target="_blank">239928.Z3.1985.20thC.<wbr>Z3.nc</a>&quot;,&quot;r&quot;)<br><br>    ;-- get variable t and its dimensions and dimension sizes<br><br>    u    =   in_u-&gt;U ;(time, lev, lat, lon)                       ;-- get variable u<br>    v    =   in_v-&gt;V ;(time, lev, lat, lon)                       ;-- get variable v<br>    z    =   in_z-&gt;Z3 ;(time, lev, lat, lon)                      ;-- get variable u<br><br>    time  =  in_u-&gt;time                    ;-- get dimension time<br>    lev   =  in_u-&gt;lev                     ;-- get dimension lev<br>    lat   =  in_u-&gt;lat                     ;-- get dimension lat<br>    lon   =  in_u-&gt;lon                     ;-- get dimension lon<br><br>    ntim  =  dimsizes(time)              ;-- get dimension sizes of time<br>    nlev  =  dimsizes(lev)               ;-- get dimension sizes of lev<br>    nlat  =  dimsizes(lat)               ;-- get dimension sizes of lat<br>    nlon  =  dimsizes(lon)               ;-- get dimension sizes of lon<br><br>    ;--  Interpolate u and v to 10m:<br>    ;u10m       = u                             <wbr>               ;-- copy variable and its dimensions and attributes<br>    u10m        = wrf_user_intrp3d(u,z,&quot;h&quot;,10.0,<wbr>0.,False)   ;-- interpolate u<br>    u10m@units  = &quot;m/s&quot;                         <wbr>                ;-- define new units<br>    ;v10m       = v                             <wbr>               ;-- copy variable and its dimensions and attributes<br>    v10m        = wrf_user_intrp3d(v,z,&quot;h&quot;,10.0,<wbr>0.,False) ;-- interpolate v<br>    v10m@units  = &quot;m/s&quot;                         <wbr>                ;-- define new units<br>    ;print(u10m)<br><br>    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;<br>    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;<br>    ;-- create new netCDF file<br>    fout = addfile(outfile,&quot;c&quot;)<br><br>    ;-- begin output file settings<br>    setfileoption(fout,&quot;<wbr>DefineMode&quot;,True) ;-- explicitly declare file definition mode<br><br>    ;-- create global attributes of the file<br>    fAtt                  =  True        ;-- assign file attributes<br>    fAtt@title            = &quot;NCL Efficient Approach to netCDF Creation&quot;<br>    fAtt@source_file      = &quot;CCSM4.nc&quot;<br>    fAtt@Conventions      = &quot;CF&quot;<br>    fAtt@creation_date    =  systemfunc (&quot;date&quot;)<br>    fAtt@history          =  &quot;NCL script: ex_netcdf_2.ncl&quot;<br>    fAtt@comment          = &quot;Convert variable t: Kelvin to Celsius&quot;<br>    fileattdef(fout,fAtt)         <wbr>       ;-- copy file attributes<br><br>    ;-- predefine the coordinate variables and their dimensionality<br>    dimNames = (/&quot;time&quot;, &quot;lat&quot;, &quot;lon&quot;/)<br>    dimSizes = (/ -1   , nlat,  nlon /)<br>    dimUnlim = (/ True , False, False/)<br>    filedimdef(fout,dimNames,<wbr>dimSizes,dimUnlim)<br><br>    ;-- predefine the the dimensionality of the variables to be written out<br>    filevardef(fout, &quot;time&quot; ,typeof(time),getvardims(time)<wbr>)<br>    filevardef(fout, &quot;lat&quot;  ,typeof(lat), getvardims(lat))<br>    filevardef(fout, &quot;lon&quot;  ,typeof(lon), getvardims(lon))<br>    filevardef(fout, &quot;u10m&quot; ,typeof(u10m),  getvardims(u10m))<br>    filevardef(fout, &quot;v10m&quot; ,typeof(v10m),  getvardims(v10m))<br><br>    ;-- copy attributes associated with each variable to the file<br>    filevarattdef(fout,&quot;time&quot; ,time)       ;-- copy time attributes<br>    filevarattdef(fout,&quot;lat&quot;  ,lat)        ;-- copy lat attributes<br>    filevarattdef(fout,&quot;lon&quot;  ,lon)        ;-- copy lon attributes<br>    filevarattdef(fout,&quot;u10m&quot; ,u10m)       ;-- copy u10m attributes<br>    filevarattdef(fout,&quot;v10m&quot; ,v10m)       ;-- copy v10m attributes<br><br>    ;-- explicitly exit file definition mode (not required)<br>    setfileoption(fout,&quot;<wbr>DefineMode&quot;,False)<br><br>    ;-- output only the data values since the dimensionality and such have been predefined.<br>    ;-- The &quot;(/&quot;, &quot;/)&quot; syntax tells NCL to only output the data values to the predefined<br>    ;-- locations on the file.<br>    fout-&gt;time   =  (/time/)               ;-- write time to new netCDF file<br><br>    fout-&gt;lat    =  (/lat/)                ;-- write lat to new netCDF file<br>    fout-&gt;lon    =  (/lon/)                ;-- write lon to new netCDF file<br>    fout-&gt;u10m   =  (/u10m/)               ;-- write variable to new netCDF file<br>    fout-&gt;v10m   =  (/v10m/)               ;-- write variable to new netCDF file<br><br>end<br><br></p>
<p> </p>
<p> </p>
<p>Best regards,</p>
<p>Leilane</p>
<div> </div>
</div>
<br>______________________________<wbr>_________________<br> ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br> List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br><br></blockquote>
</div>
</div>
</blockquote>
<p> </p>
<div> </div>
</div></div></div>
</blockquote></div><br></div>