[ncl-talk] Dealing with 2D lat and lon outputs of WRF
Prashanth Bhalachandran
prashanth.bhalachandran at gmail.com
Fri Oct 4 13:24:44 MDT 2019
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191004/ade3e858/attachment.html>
More information about the ncl-talk
mailing list