[ncl-talk] Doubt about interpolation from hybrid sigma level coordinate to height of 10m

leilane.passos at inpe.br leilane.passos at inpe.br
Tue Jun 6 13:43:19 MDT 2017


 

Dear Denis, 

Thank you for the answer. 

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
(https://bb.cgd.ucar.edu/converting-hybrid-levels-pressures). This
interpolation was good, so I tried to do the interpolation from pressure
to height, like your suggestions in this post:
https://www.ncl.ucar.edu/Support/talk_archives/2004/0394.html

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. 

My script is attached. 

Best regards.

Leilane 

Em 22-05-2017
16:49, Dennis Shea escreveu: 

> The wrf_* functions were developed for
the WRF model(s) with the WRF 'eta' vertical coordinate system.
> [
https://www.researchgate.net/post/Does_WRF_simulation_use_sigma_or_eta_vertical_coordinate_system
[6] ]
> 
> Hence, these functions are not appropriate for CAM data. 
>
--- 
> The calculation of CAM U10 is non-trivial. Many factors are
involved: surface roughness, atmospheric stability, ...
> 
> Over the
oceans, for neutral stability something like the following is used: 
>

> U10 = UL / [ 1 + (sqrt(CN10)/k)*log(ZL/10-PSI)] ; [1] 
> 
> The
following variables are readily available at each grid point 
> 
> UL -
zonal component of the wind at the Lowest model level
> ZL -
geopotential height at the Lowest model level 
> PSI - Sfc.
geopotential
> 
> The CN10 must be derived:
> 
> CN10 - drag Coefficient
at 10-m height and Neutral stability 
> 
> where: 
> CN10 = (C4/U10) +
C5 + C6*U10 [2]
> 
> and, over the ocean,
> 
> C4=0.0027 m/s ,
C5=0.000142, C6=0.0000764 m/s
> 
> Note that U10 appears in both [1] and
[2]. Hence the solution requires iteration.
> ----
> 
> Over land, ?????

> ---
> 
> If you need 'numbers' as a filler then maybe using a simple
u10 = U*log(..) could be used. 
> 
> 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.
> 
> Also,
as noted within the function, the approximation is most valid in the
lowest 100m of the atmosphere.
> 
> Good Luck
> 
> On Mon, May 15, 2017
at 1:09 PM, <leilane.passos at inpe.br> wrote:
> 
>> Hi, 
>> 
>> 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: 
>> 
>> 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? 
>> 
>> 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? 
>> 
>> ; -------------- LOAD FUNCTIONS AND PROCEDURES
----------------
>> 
>> load
"/usr/share/ncarg/nclscripts/csm/gsn_code.ncl"
>> load
"/usr/share/ncarg/nclscripts/csm/gsn_csm.ncl"
>> load
"/usr/share/ncarg/nclscripts/csm/contributed.ncl"
>> load
"/usr/share/ncarg/nclscripts/csm/shea_util.ncl"
>> load
"/usr/share/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>> load
"/usr/share/ncarg/nclscripts/acentos.ncl"
>> 
>> ; --------------
BEGINING OF NCL SCRIPT ----------------
>> 
>> begin
>> 
>> outfile =
"test_U10mV10m.1985.20thC.nc [1]"
>> 
>> if (isfilepresent(outfile))
then
>> system("rm -rf "+outfile) ;-- make sure that file does not
exist
>> end if
>> 
>> ;-- open data file
>> 
>> in_u =
addfile("224331.U.1985.20thC.U.nc [2]","r")
>> in_v =
addfile("224331.V.1985.20thC.V.nc [3]","r")
>> in_z =
addfile("239928.Z3.1985.20thC.Z3.nc [4]","r")
>> 
>> ;-- get variable t
and its dimensions and dimension sizes
>> 
>> u = in_u->U ;(time, lev,
lat, lon) ;-- get variable u
>> v = in_v->V ;(time, lev, lat, lon) ;--
get variable v
>> z = in_z->Z3 ;(time, lev, lat, lon) ;-- get variable
u
>> 
>> time = in_u->time ;-- get dimension time
>> lev = in_u->lev ;--
get dimension lev
>> lat = in_u->lat ;-- get dimension lat
>> lon =
in_u->lon ;-- get dimension lon
>> 
>> ntim = dimsizes(time) ;-- get
dimension sizes of time
>> nlev = dimsizes(lev) ;-- get dimension sizes
of lev
>> nlat = dimsizes(lat) ;-- get dimension sizes of lat
>> nlon =
dimsizes(lon) ;-- get dimension sizes of lon
>> 
>> ;-- Interpolate u
and v to 10m:
>> ;u10m = u ;-- copy variable and its dimensions and
attributes
>> u10m = wrf_user_intrp3d(u,z,"h",10.0,0.,False) ;--
interpolate u
>> u10m at units = "m/s" ;-- define new units
>> ;v10m = v
;-- copy variable and its dimensions and attributes
>> v10m =
wrf_user_intrp3d(v,z,"h",10.0,0.,False) ;-- interpolate v
>> v10m at units
= "m/s" ;-- define new units
>> ;print(u10m)
>> 
>>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>
;-- create new netCDF file
>> fout = addfile(outfile,"c")
>> 
>> ;--
begin output file settings
>> setfileoption(fout,"DefineMode",True) ;--
explicitly declare file definition mode
>> 
>> ;-- create global
attributes of the file
>> fAtt = True ;-- assign file attributes
>>
fAtt at title = "NCL Efficient Approach to netCDF Creation"
>>
fAtt at source_file = "CCSM4.nc"
>> fAtt at Conventions = "CF"
>>
fAtt at creation_date = systemfunc ("date")
>> fAtt at history = "NCL script:
ex_netcdf_2.ncl"
>> fAtt at comment = "Convert variable t: Kelvin to
Celsius"
>> fileattdef(fout,fAtt) ;-- copy file attributes
>> 
>> ;--
predefine the coordinate variables and their dimensionality
>> dimNames
= (/"time", "lat", "lon"/)
>> dimSizes = (/ -1 , nlat, nlon /)
>>
dimUnlim = (/ True , False, False/)
>>
filedimdef(fout,dimNames,dimSizes,dimUnlim)
>> 
>> ;-- predefine the the
dimensionality of the variables to be written out
>> filevardef(fout,
"time" ,typeof(time),getvardims(time))
>> filevardef(fout, "lat"
,typeof(lat), getvardims(lat))
>> filevardef(fout, "lon" ,typeof(lon),
getvardims(lon))
>> filevardef(fout, "u10m" ,typeof(u10m),
getvardims(u10m))
>> filevardef(fout, "v10m" ,typeof(v10m),
getvardims(v10m))
>> 
>> ;-- copy attributes associated with each
variable to the file
>> filevarattdef(fout,"time" ,time) ;-- copy time
attributes
>> filevarattdef(fout,"lat" ,lat) ;-- copy lat attributes
>>
filevarattdef(fout,"lon" ,lon) ;-- copy lon attributes
>>
filevarattdef(fout,"u10m" ,u10m) ;-- copy u10m attributes
>>
filevarattdef(fout,"v10m" ,v10m) ;-- copy v10m attributes
>> 
>> ;--
explicitly exit file definition mode (not required)
>>
setfileoption(fout,"DefineMode",False)
>> 
>> ;-- output only the data
values since the dimensionality and such have been predefined.
>> ;--
The "(/", "/)" syntax tells NCL to only output the data values to the
predefined
>> ;-- locations on the file.
>> fout->time = (/time/) ;--
write time to new netCDF file
>> 
>> fout->lat = (/lat/) ;-- write lat
to new netCDF file
>> fout->lon = (/lon/) ;-- write lon to new netCDF
file
>> fout->u10m = (/u10m/) ;-- write variable to new netCDF file
>>
fout->v10m = (/v10m/) ;-- write variable to new netCDF file
>> 
>>
end
>> 
>> Best regards, 
>> 
>> Leilane 
>> 
>>
_______________________________________________
>> ncl-talk mailing
list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options,
unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk [5]




Links:
------
[1] http://test_U10mV10m.1985.20thC.nc
[2]
http://224331.U.1985.20thC.U.nc
[3] http://224331.V.1985.20thC.V.nc
[4]
http://239928.Z3.1985.20thC.Z3.nc
[5]
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
[6]
https://www.researchgate.net/post/Does_WRF_simulation_use_sigma_or_eta_vertical_coordinate_system
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170606/5c0634b3/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CAM4_hybrid2pressure_height.ncl
Url: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170606/5c0634b3/attachment.pl 


More information about the ncl-talk mailing list