<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"><<a href="mailto:leilane.passos@inpe.br" target="_blank">leilane.passos@inpe.br</a>></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 'eta' 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 'numbers' 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 'surface roughness length' 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><<a href="mailto:leilane.passos@inpe.br" target="_blank">leilane.passos@inpe.br</a>></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'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 "/usr/share/ncarg/nclscripts/<wbr>csm/gsn_code.ncl"<br> load "/usr/share/ncarg/nclscripts/<wbr>csm/gsn_csm.ncl"<br> load "/usr/share/ncarg/nclscripts/<wbr>csm/contributed.ncl"<br> load "/usr/share/ncarg/nclscripts/<wbr>csm/shea_util.ncl"<br> load "/usr/share/ncarg/nclscripts/<wbr>wrf/WRFUserARW.ncl"<br> load "/usr/share/ncarg/nclscripts/<wbr>acentos.ncl"<br><br> ; -------------- BEGINING OF NCL SCRIPT ----------------<br><br> begin<br><br> outfile = "<a href="http://test_U10mV10m.1985.20thC.nc" target="_blank">test_U10mV10m.1985.20thC.nc</a>"<br><br> if (isfilepresent(outfile)) then<br> system("rm -rf "+outfile) ;-- make sure that file does not exist<br> end if<br><br> ;-- open data file<br><br> in_u = addfile("<a href="http://224331.U.1985.20thC.U.nc" target="_blank">224331.U.1985.20thC.<wbr>U.nc</a>","r")<br> in_v = addfile("<a href="http://224331.V.1985.20thC.V.nc" target="_blank">224331.V.1985.20thC.<wbr>V.nc</a>","r")<br> in_z = addfile("<a href="http://239928.Z3.1985.20thC.Z3.nc" target="_blank">239928.Z3.1985.20thC.<wbr>Z3.nc</a>","r")<br><br> ;-- get variable t and its dimensions and dimension sizes<br><br> u = in_u->U ;(time, lev, lat, lon) ;-- get variable u<br> v = in_v->V ;(time, lev, lat, lon) ;-- get variable v<br> z = in_z->Z3 ;(time, lev, lat, lon) ;-- get variable u<br><br> time = in_u->time ;-- get dimension time<br> lev = in_u->lev ;-- get dimension lev<br> lat = in_u->lat ;-- get dimension lat<br> lon = in_u->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,"h",10.0,<wbr>0.,False) ;-- interpolate u<br> u10m@units = "m/s" <wbr> ;-- define new units<br> ;v10m = v <wbr> ;-- copy variable and its dimensions and attributes<br> v10m = wrf_user_intrp3d(v,z,"h",10.0,<wbr>0.,False) ;-- interpolate v<br> v10m@units = "m/s" <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,"c")<br><br> ;-- begin output file settings<br> setfileoption(fout,"<wbr>DefineMode",True) ;-- explicitly declare file definition mode<br><br> ;-- create global attributes of the file<br> fAtt = True ;-- assign file attributes<br> fAtt@title = "NCL Efficient Approach to netCDF Creation"<br> fAtt@source_file = "CCSM4.nc"<br> fAtt@Conventions = "CF"<br> fAtt@creation_date = systemfunc ("date")<br> fAtt@history = "NCL script: ex_netcdf_2.ncl"<br> fAtt@comment = "Convert variable t: Kelvin to Celsius"<br> fileattdef(fout,fAtt) <wbr> ;-- copy file attributes<br><br> ;-- predefine the coordinate variables and their dimensionality<br> dimNames = (/"time", "lat", "lon"/)<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, "time" ,typeof(time),getvardims(time)<wbr>)<br> filevardef(fout, "lat" ,typeof(lat), getvardims(lat))<br> filevardef(fout, "lon" ,typeof(lon), getvardims(lon))<br> filevardef(fout, "u10m" ,typeof(u10m), getvardims(u10m))<br> filevardef(fout, "v10m" ,typeof(v10m), getvardims(v10m))<br><br> ;-- copy attributes associated with each variable to the file<br> filevarattdef(fout,"time" ,time) ;-- copy time attributes<br> filevarattdef(fout,"lat" ,lat) ;-- copy lat attributes<br> filevarattdef(fout,"lon" ,lon) ;-- copy lon attributes<br> filevarattdef(fout,"u10m" ,u10m) ;-- copy u10m attributes<br> filevarattdef(fout,"v10m" ,v10m) ;-- copy v10m attributes<br><br> ;-- explicitly exit file definition mode (not required)<br> setfileoption(fout,"<wbr>DefineMode",False)<br><br> ;-- output only the data values since the dimensionality and such have been predefined.<br> ;-- The "(/", "/)" syntax tells NCL to only output the data values to the predefined<br> ;-- locations on the file.<br> fout->time = (/time/) ;-- write time to new netCDF file<br><br> fout->lat = (/lat/) ;-- write lat to new netCDF file<br> fout->lon = (/lon/) ;-- write lon to new netCDF file<br> fout->u10m = (/u10m/) ;-- write variable to new netCDF file<br> fout->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>