[ncl-talk] Dealing with 2D lat and lon outputs of WRF

Rick Brownrigg brownrig at ucar.edu
Fri Oct 4 15:58:47 MDT 2019


Hi,

I am not expert at this, but based upon the docs for the
function_latlon_cfd, it looks like it requires a rectilinear grid, which
would imply you'll need to regrid your curvilinear WRF grid. NCL has
numerous functions for doing this (I can't advise which one you should use):

   http://ncl.ucar.edu/Applications/regrid.shtml

I also note in the second warning you provided, its complaining about 3
dimensions in parameter 1 (i.e., the lat variable) -- Is there a time
dimension on that variable as well as X/Y?

Hope that helps...
Rick


On Fri, Oct 4, 2019 at 1:25 PM Prashanth Bhalachandran via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Dear NCL'ers,
> I have a question on dealing with the 2D lat and long variables from WRF
> output. For example, in my code below, I am having trouble using the lat
> long information to either use them as coordinate variables or to be used
> as inputs to the horizontal gradient function. What is the best way to
> create or extract 1D lat and long information so that I can use them here?
>
> Thank you,
> Prashanth
>
> begin
>
>
> a = addfile("wrfout_d04_2005-07-29_12:06:00","r")
>
>
> ctt = wrf_user_getvar(a,"ctt",-1) ; Cloud top temperatures in degree
> Celsius
>
> lat = wrf_user_getvar(a,"XLAT",-1)
>
> lon = wrf_user_getvar(a,"XLONG",-1)
>
>
> ;Original Dimensions and sizes: [Time | 10] x [south_north | 480] x
> [west_east | 480]
>
>
> ; Take the horizontal gradient
>
>   cttLatLon  = grad_latlon_cfd (ctt, lat, lon, False, False)
>
>
>   ctt_grad_lat  = gradLatLon[0]    ; Extract Individual gradients in
> latitudinal direction
>
>   ctt_grad_lon  = gradLatLon[1]    ; Gradient in longitudinal directional
>
>
>   delete(cttLatLon)
>
>
>    if(all(ismissing(ctt_grad_lat))) then
>
>     print("ctt_grad_lat contains all missing values, cannot continue.")
>
>     return
>
>   end if
>
>
>     if(all(ismissing(ctt_grad_lon))) then
>
>     print("ctt_grad_lon contains all missing values, cannot continue.")
>
>     return
>
>   end if
> end
>
>
> Output:
>
> I can't prescribe lat and lon as coordinate variables since they are 2D.
>
> $ ncl -n -Q cloud_top.ncl
>
> fatal:Coordinate variables must have one dimension only
>
> fatal:No coordinate variable exists for dimension (lat) in variable (ctt)
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 12 in
> file cloud_top.ncl
>
>
> or use them as inputs to the gradient function:
>
> $ ncl -n -Q cloud_top.ncl
>
> fatal:Number of dimensions in parameter (1) of (grad_latlon_cfd) is (3),
> (1) dimensions were expected
>
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 12 in
> file cloud_top.ncl
>
>
>
>
> _______________________________________________
> 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/20191004/eeb2721b/attachment.html>


More information about the ncl-talk mailing list