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

Prashanth Bhalachandran prashanth.bhalachandran at gmail.com
Fri Oct 4 16:25:45 MDT 2019


Dear Rick,
Thanks for the email.

Yes, there is a time dimension as well.

I'll have to think if regridding is necessary. For example, if all I need
is the X-Y information so that I can make a plot and compute the gradients
in X and Y, I am considering just averaging the latitudes in the E-W
direction and the longitudes in the N-S direction. This will reduce the
dimensionality to 1 if I extract this information at a single time. I am
unsure if that' the correct thing to do.

Let me know what you think.

Regards,
Prashanth

On Fri, Oct 4, 2019 at 2:58 PM Rick Brownrigg <brownrig at ucar.edu> wrote:

> 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
>
>

-- 
Dr. Saiprasanth Bhalachandran (Sai)
Department of Earth System Science,
473 Via Ortega Road, Y2E2 Building, Suite 370.
Stanford University
Website: https://sites.google.com/view/saiprasanth/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191004/2c4b1e60/attachment.html>


More information about the ncl-talk mailing list