-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nearest neighbor interpolation issue when gridding #957
Comments
Hi @lauratomkins, do you have the most recent github clone of pyart or is it a conda forge install? We recently had a fixed for nearest neighbor, but I haven't done a new pyart conda-forge release yet. |
I have a conda forge install |
Gotcha, can you try a install of the github clone? The fix isn't in the conda release. I'll need to get going on a new release. |
@zssherman I was able to install with github and here's what the nearest interpolation looks like now. Seems to be better (in that the data is better represented) but still has issues. Very psychedelic though! |
Hmm, yeah @rcjackson I wonder if the nearest neighbor is still having issues. We can try to reproduce on our end. @lauratomkins Are you only running on this one case? If so, you could use the parameter in grid_from_radars, gridding_algo='map_to_grid'. This is an unoptimized version of the grid algos so its kinda slow, but it works. If your doing multiple cases, that might be too slow for that, but if its just the one, it should help for now, until we come up with a solution |
Hi @zssherman, I updated the gridding_algo parameter, but no difference in the end result. I also plan to process hundreds of cases so not really an option for me right now. |
Gotcha, we'll be taken a look at the code to see if we can figure out whats going on. |
@rcjackson Thanks for your comment, I'm getting similar results as well with this workaround. Not super ideal but hopefully should work for what I'm doing. |
Hi @zssherman and @rcjackson. I'm wanted to document some additional issues that I'm having with the nearest neighbor interpolation in the For reference, here is the dealiased velocity in polar coordinates (zoomed in on the right) Here is what the gridded dealiased velocity looks like using the default gridding algorithm. The main issues are the really low values in the velocity (close to -5000) and the missing data (which on closer look seems slightly reminiscent of the pattern in the previous plots in this thread). Then, here is what the field looks like when I change the gridding algorithm to Any thoughts on this? I tried with the updated pyart package from the source instead of conda-forge, but no luck either. Any insight would be greatly appreciate. |
The -5000 m/s values show up *after* gridding. Before gridding the lowest
value is ~-60 m/s so this seems to be an error that shows up during the
interpolation process.
|
@lauratomkins Yeah after discussion with @rcjackson seems there might be an issue on how the mask is being applied. We will be taking a look at it. |
Unless I'm mistaken, it looks like the gates values are being mapped to a grid instead of a grid being populated with the nearest gate values. This would explain the empty grid boxes in the data shown by @lauratomkins. Basically, no data are being mapped to those empty grid boxes since there are other grid boxes closer to the surrounding gates. I'm not sure what's going on where the values are really low. |
Here is the file. The second example I've shown with the dealiased velocity is a different file/radar/time compared to the first example. Sorry for not clarifying that. And I'm actually using a grid spacing of 500 m, that's a typo on my figures above. |
This is the code I'm using. I tried adding in the center_lat, center_lon, _ = pyart.io.nexrad_common.get_nexrad_location('KDIX') # gets central radar lat, lon, altitude
# define grid for interpolating
dx = 0.5; dy = 0.5
xpts = (dx*1000)*np.arange(-(150/dx),(150/dx)+1,1); ypts = (dy*1000)*np.arange(-(150/dy),(150/dy)+1,1); zpts = np.zeros([1,len(xpts)]); # array for interpolation
grid = pyart.map.grid_from_radars(
(radar,), grid_origin = (center_lat, center_lon), grid_shape=(1, len(ypts), len(xpts)),
grid_limits=((0, 10000), (np.min(ypts), np.max(ypts)), (np.min(xpts), np.max(xpts))),
grid_projection = {'proj':'lcca', 'lat_0': center_lat,'lon_0': center_lon},
weighting_function = 'Nearest') |
You may want to install pyart from source. We have made a few fixes to the nearest neighbor code since the conda forge release. To install pyart from the latest build, you'll want to uninstall your conda pyart and then do: pip install git+https://github.com/ARM-DOE/pyart This should include this latest fix. |
And I'll get a new release out shortly. |
A new release is now out, I would give it 20 minutes or so for conda-forge to update and have the new downloads. |
I'm having an issue with the
weighting = 'Nearest'
option in thepyart.map.grid_from_radars
function with NEXRAD Level 2 data. Anytime I use this weighting option, every field except the reflectivity looks wrong. I can use the Cressman weighting with no issues. I've provided some example images and code to reproduce. Any insight would be very helpful! Thanks.Here is an example set of images using
weighting = 'Nearest'
And here are the same example set using
weighting = 'Cressman'
Here is the code to reproduce:
The text was updated successfully, but these errors were encountered: