<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/p<wbr>ost/Does_WRF_simulation_use_si<wbr>gma_or_eta_vertical_coordinate<wbr>_system</a> ]<br><br></div><div>Hence, these functions are not appropriate for CAM data.<br></div><div>---<br></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:<br></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<br></div><div><br></div><div>UL  - zonal component of the wind at the Lowest model level<br>ZL  - geopotential height at the Lowest model level<br></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"><br></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2">where:</font><br></div><div style="font-family:serif"><font size="2">    CN10 = (C4/U10) + C5 + C6*U10         [2]<br><br></font></div><div style="font-family:serif"><font size="2">and, over the ocean,<br></font></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2">    C4=0.0027 m/s , C5=0.000142, C6=0.0000764 m/s<br><br></font></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2">Note that U10 appears in both [1] and [2]. Hence the solution requires iteration.<br>----<br></font></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2">Over land, ????? <br>---<br></font></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2">If you need &#39;numbers&#39; as a filler then maybe using a simple  u10 = U*log(..) could be used. <br><br></font></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2">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></font></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2">Also, as noted within the function, the approximation is most valid in the lowest 100m of the atmosphere.<br></font></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2"><br></font></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2">Good Luck<br></font></div><div style="font-size:19.9253px;font-family:sans-serif"><font size="2"><br><br></font></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 15, 2017 at 1:09 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>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">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>