-
Notifications
You must be signed in to change notification settings - Fork 16
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
Interpolation update #85
Conversation
altered point in poly to remove div/0
Conflicts: pysgrid/sgrid.py
# Conflicts: # pysgrid/sgrid.py # pysgrid/utils.py # pysgrid/variables.py
NOTE: tests failing due to lack of cellTree@d pacckage. That is available on the NOAA-ORR-ERD anaconda channel: https://anaconda.org/noaa-orr-erd (at least for py2 -- py3 shouldn't be a big deal, but we haven't had a reason to do it) We should probably put it up on PyPi too -- it is a self contained build, so should be pip-installable. These will all need to be addressed before being merged. |
cell_tree2d is now up on pypi. |
two grids should be able to share the same tree
Pinging again @ocefpaf @rsignell-usgs @ayan-usgs @kwilcox @ChrisBarker-NOAA |
@jay-hennen I am back and I will review this PR. I am also working on getting |
Great! Thanks Filipe. |
Note that we've got cellTree2d up on Pypi now. It requires a compiler (and we haven't put any binary wheels up), but the only dependencies are numpy and cython, so a lot of people should be able to pip install it out of the box. (hmm, maybe we should ship the cyton generated source, so that's not a build dependency) And this is weird -- if I do "pip install cell_tree2d", it finds it an downloads it. But if I go to the PYPi web site and search for it, I can't find it... |
ping! We need this functionality, and we'd rather not have to continue to work off a fork. I'm pretty sure that this doesn't change the API, and no one will now it's there unless they want to use it :-) It does introduce a new dependency, though, which is optional -- i.e. only gets imported if you need it. But we do need it for tests. |
@jay-hennen |
pysgrid is new and API changes are OK.
That argument is not 100% valid when talking about community software. Code health is important to attract users and contributors. That said, there is not code health issue with your additions, just failing due to the lack of the |
Edit: How can I confirm that cell_tree2d is being properly installed by Travis? Nothing in this PR will work properly without that. |
For cell_tree2d, maybe make sure there is a test or two that directly tests using cell_tree2d without much else. Then you can see if those are passing. Not really what should get tested by a lib using it, but it would be a way to test the environment. Alternatively, we could make sure that the cell_tree2d tests are installed with the package, and I think we could add a line to run that test on Travis after instaling it. |
DANGER: it segfaults seemingly randomly -- probably celltree2d causing it. at least with cell_tree2d v. 0.1.3 and master.
This PR has been going on for awhile now. Where exactly are we with the cell_tree2d issues? While .travis.yml appears to be going for the conda package and previous comments report that the install problems have been fixed, the most recent travis run appears to have failed due to installation problems. I think the package is looking for a newer version of cell_tree2d than |
I was hoping to get this cleaned up at the script sprints, but ended While a segfault is by definition a bug, we may be able to work around I think Filipe is going to try to track that down.
|
@ChrisBarker-NOAA I can run all the tests with the pinned version we have on Travis-CI.
I cannot find any place where that happens. @ayan-usgs used
I am changing it to use |
[closes sgrid#85]
Most of PR #78 can still describe this. However, there are a few important additions:
sgrid.interpolate_var_to_points(points, sgrid.u, slices=[time_idx, v_idx])
The variable in this case is lazy-loaded and sliced appropriately. There are a variety of other possible uses:
sgrid.interpolate_var_to_points(points, sgrid.u[time_idx, v_idx])
This pre-loads the whole variable slice
sgrid.interpolate_var_to_points(points, nc.variables['u'], slices=[time_idx, depth_idx])
You can use a raw variable or array-like of any kind, as long as it can be sliced, and has a shape that can fit on one of the grids.
sgrid.interpolate_var_to_points(points, sgrid.u, indices=ind, alphas=alphas, slices=[time_idx, depth_idx])
Considerable performance gains can be had by passing in pre-computed information, such as indices, alphas, or even translated indices (advanced). To see an example of this, you can see the interpolation function in demos/matlabanim.py.
Much of the code has stablilized. There are still improvements to be made, but no planned API or algorithm changes/additions.