<div dir="ltr"><div>HI,</div><div><br></div><div>If I understand correctly, it looks like you are close. You have:</div><div><br></div><div>> nl = wrf.extract_dim(f, 'Time')<br>
> len = nl-1            <br>
> <br>
> # Find the closest point to the site in WRF grids<br>
> x_y = wrf.ll_to_xy(f, stn_lat, stn_lon,True)<br>
> <br>
> for i in range(len):<br>
>    temp_sub = t2[0:i,x_y[0],x_y[1]]</div><div><br></div><div>I'm not sure what you are trying to do with the loop. Simply writing <br></div><div><br></div><div>   temp_sub = t2(:,x_y(0),x_y(1))</div><div><br></div><div>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).</div><div><br></div><div><br></div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 9, 2020 at 8:57 AM Alyce via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi again, <br>
<br>
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.<br>
<br>
Regards<br>
Alyce <br>
<br>
Sent from my iPhone<br>
<br>
> On 9 Oct 2020, at 10:12 pm, Alyce Sala Tenna <<a href="mailto:alsalte@gmail.com" target="_blank">alsalte@gmail.com</a>> wrote:<br>
> <br>
> Hello,<br>
> <br>
> I would like to extract temperature at a specific latitude and longitude.<br>
> <br>
> I’m new to python and I’m not confident with loops. <br>
> <br>
> <br>
> times = wrf.getvar(f, "times")<br>
> t2 = wrf.getvar(f, "td2")<br>
> nl = wrf.extract_dim(f, 'Time')<br>
> len = nl-1            <br>
> <br>
> # Find the closest point to the site in WRF grids<br>
> x_y = wrf.ll_to_xy(f, stn_lat, stn_lon,True)<br>
> <br>
> for i in range(len):<br>
>    temp_sub = t2[0:i,x_y[0],x_y[1]]<br>
> <br>
> I know I’m only pulling one slice of data vertically - how do I draw it from a specific lat and long?<br>
> <br>
> Thanks in advance,<br>
> Ayce<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>