-
Notifications
You must be signed in to change notification settings - Fork 2
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
Implement ind_from_latlon using a BallTree #59
Conversation
Note, an version for spherical earth can be found here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking changes (ind_from_latlon
is used in scripts in icon-vis):
verbose
argument is removed- returns a
List[int]
rather thanint
.
Also I think its nice to have an example usage section in the docstring.
@AnnikaLau what do you think about the above? Perhaps its nicer to return a List[int] and then in our icon-vis scripts we can just select ind[0].
And I personally thing we should keep the verbose option. But let me know what you think.
Thanks for the update/improvement! I'm still going through it but one thing I'm not sure of yet, would |
@AnnikaLau Would it help if I re-implemented the |
Yes I think the |
@AnnikaLau I dont understand. Does it yield a different location for your case? |
It takes the nearest point to the coordinates given. So in the case the grid cells are big, this can be quite a bit off. |
Co-authored-by: Annika <[email protected]>
I created a corresponding merge request for icon-vis: C2SM/icon-vis#39 |
iconarray/core/utilities.py
Outdated
>>> lats = np.rad2deg(ds.clat.values[:]) | ||
>>> lons = np.rad2deg(ds.clon.values[:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> lats = np.rad2deg(ds.clat.values[:]) | |
>>> lons = np.rad2deg(ds.clon.values[:]) | |
>>> lats = xr.DataArray(np.rad2deg(data.clat), coords=data.clat.coords, dims=data.clat.dims) | |
>>> lons = xr.DataArray(np.rad2deg(data.clon), coords=data.clon.coords, dims=data.clon.dims) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old version doesn't work anymore with the changes to the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont understand why exactly it stopped, but fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get errors when executing the next line otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this still present? Cant reproduce
@AnnikaLau |
Radian and degree are now mixed up for input and output. I would only give degree as input and output as it is much more intuitive. |
Apart from one last thing, which should be fixed, I think it looks good and should be merged together with C2SM/icon-vis#39. |
Co-authored-by: Annika <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for approval of C2SM/icon-vis#39
I tried using ind_from_latlon on with the new ICON-1 domain of MCH and it was kinda slow (20 Min). I implemented a new version using a BallTree.
I also added functionality to return the n closest points. That is super useful if one want to compare against instruments and avoid double penalties by slight location offsets.