NCAR / wrf-python

A collection of diagnostic and interpolation routines for use with output from the Weather Research and Forecasting (WRF-ARW) Model.
https://wrf-python.readthedocs.io
Apache License 2.0
410 stars 155 forks source link

Extract data at lat/lon location? #80

Closed moptis closed 5 years ago

moptis commented 5 years ago

Is there a way in wrf-python to simply extract wrf output at a specified lat/lon? There doesn't appear to be.

Thanks!

bladwig1 commented 5 years ago

See https://wrf-python.readthedocs.io/en/latest/user_api/generated/wrf.ll_to_xy.html#wrf.ll_to_xy

Use ll_to_xy to get the array indexes from lat/lon points, then query your variable. If getting the nearest grid point is insufficient, you can use scipy for interpolation or interp2dxy with an xy array of 1 point (https://wrf-python.readthedocs.io/en/latest/user_api/generated/wrf.interp2dxy.html#wrf.interp2dxy). For interp2dxy, the data needs to be 3D, so add a np.newaxis dimension if your data is 2D.

For general usage questions like this, please subscribe to the google group here:

https://groups.google.com/a/ucar.edu/forum/#!forum/wrfpython-talk

I'm trying to keep GitHub issues for bugs only.

Hope this helps.

moptis commented 5 years ago

OK, thanks @bladwig1 !

I submitted a question to wrfpython-talk about 3 weeks ago (different topic) but nobody responded. So I thought I'd try here. If someone is keeping up with questions on wrfpython-talk, I'll send future questions there.

bladwig1 commented 5 years ago

That's my bad. Google was sending all of the wrfpython-talk emails to Spam for some reason. Normally I try to get back within a day.