[ncl-talk] Extract wrf variable at specific latitude and longitude

Rick Brownrigg brownrig at ucar.edu
Fri Oct 9 09:05:33 MDT 2020


HI,

If I understand correctly, it looks like you are close. You have:

> nl = wrf.extract_dim(f, 'Time')
> len = nl-1
>
> # Find the closest point to the site in WRF grids
> x_y = wrf.ll_to_xy(f, stn_lat, stn_lon,True)
>
> for i in range(len):
>    temp_sub = t2[0:i,x_y[0],x_y[1]]

I'm not sure what you are trying to do with the loop. Simply writing

   temp_sub = t2(:,x_y(0),x_y(1))

would give you an array of all values across the 1st dimension (time?
vert?) at the grid cell closest to the lat/lon you specified (Note that NCL
uses () rather than [] for array indexing).


Rick


On Fri, Oct 9, 2020 at 8:57 AM Alyce via ncl-talk <ncl-talk at mailman.ucar.edu>
wrote:

> Hi again,
>
> Just to be more specific, this is for a timeseries analysis, so will need
> all hours of data from the wrfout file, at a specific lat and long.
>
> Regards
> Alyce
>
> Sent from my iPhone
>
> > On 9 Oct 2020, at 10:12 pm, Alyce Sala Tenna <alsalte at gmail.com> wrote:
> >
> > Hello,
> >
> > I would like to extract temperature at a specific latitude and longitude.
> >
> > I’m new to python and I’m not confident with loops.
> >
> >
> > times = wrf.getvar(f, "times")
> > t2 = wrf.getvar(f, "td2")
> > nl = wrf.extract_dim(f, 'Time')
> > len = nl-1
> >
> > # Find the closest point to the site in WRF grids
> > x_y = wrf.ll_to_xy(f, stn_lat, stn_lon,True)
> >
> > for i in range(len):
> >    temp_sub = t2[0:i,x_y[0],x_y[1]]
> >
> > I know I’m only pulling one slice of data vertically - how do I draw it
> from a specific lat and long?
> >
> > Thanks in advance,
> > Ayce
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201009/b2f4ac01/attachment.html>


More information about the ncl-talk mailing list