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

Dennis Shea shea at ucar.edu
Mon May 22 13:49:04 MDT 2017


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_si
gma_or_eta_vertical_coordinate_system ]

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"
>
>     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","r")
>     in_v = addfile("224331.V.1985.20thC.V.nc","r")
>     in_z = addfile("239928.Z3.1985.20thC.Z3.nc","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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/897487de/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wind_log_extrap.ncl
Type: application/octet-stream
Size: 1077 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/897487de/attachment.obj 


More information about the ncl-talk mailing list