-
Notifications
You must be signed in to change notification settings - Fork 9
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
start of plotting "help" module #258
Conversation
Great start! maybe call the module Maybe the two goals could be combined? i.e. the function that returns the LineCollection returns extra lines when crossing the dateline to accommodate? How do we make sure that the assigned colors of the lines for the drifters that cross the dateline are the same? |
What do you think about |
We can then have a separate function that segments the dateline specifically, so the desired functionality here would be by chaining the two functions. |
I have no preference about the name of the module and/or the location of those functions. I was going to make the first function to insert
I can switch it to |
If we include |
Not sure exactly how to proceed now, |
@selipot want to test? I guess I might have some time next week during Thanksgiving to play with this. |
I'm abandoning the idea of rebasing this branch. Many files have been renamed, deleted and functions moved around, making this very annoying. I might just reopen another PR once we are closer to merging this. |
Sorry about that, that happens when a PR is open for too long for a version 0.x software I guess. Do you want me to test before you open another PR or after? |
No worries, the easiest would be just to copy the function. |
74f06eb
to
7976234
Compare
One question, how can I test something that requires optional dependencies... 🤔 I guess we would need to have a different environment for the test, which would include all the mandatory and optional packages. |
How about installing all dependencies (core and optional) for testing? |
The examples need editing which I can do once you submit a new PR. |
Did you try the latest version? You can use this branch, I fix it yesterday. |
I copied the code for the function from the PR branch as you instructed. Again, lines 132-150 don't make sense to me or rather the error I get makes sense. Why would you test for ax to have the attribute coastline if it is only plt.Axes?
|
If it has attributes coastline, it is a geoAxe and we have to also try to load cartopy. This way, the function can be used with matplotlib only. The else condition should be one (or two) level(s) further aligned with the if isinstance(geoAxe). I'm on the plane but can fix in ~2h. |
Yes but the exception to your |
@selipot fix now. |
What's next with this @philippemiron ? |
Did you have chance to give it a try? |
Yes! Works for me. But did not test with cartopy. |
…into plotting-utils
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.
This looks good to go to me. I installed it, plotted some stuff, looks good. Tests pass after installing matplotlib and cartopy.
utility
as a module name is quite generic. Should we call this plotting
?
clouddrift/utility.py
Outdated
the trajectories are splitted into segments and each segment is colored according | ||
to the corresponding color value. If colors is the same shape as rowsize, the | ||
trajectories are uniformly colored according to the corresponding color value. | ||
*args : tuple |
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.
**kwargs
are below. LGTM.
tests/utility_tests.py
Outdated
@@ -0,0 +1,149 @@ | |||
import cartopy.crs as ccrs | |||
from clouddrift.utility import plot_ragged | |||
import matplotlib.pyplot as plt |
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 there a mechanism to skip these tests if optional dependencies are not installed?
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.
True, I assumed that it was installed in the ci/cd, but I see that this wouldn't work if you don't have those packages locally.
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.
Can you try again with the latest modification?
Co-authored-by: Milan Curcic <caomaco@gmail.com>
I forgot one important thing: we should add a note to the installation instructions (in README.md and docs/install.rst) about installing optional dependencies. |
I think we discussed and established that matplotlib-core is already implicitly installed by depending on xarray, correct? In that case, I think only cartopy should be an optional dependency. |
If I installed the environment I don't get matplotlib. |
do we really need this? If someone tries to import the module it already say:
|
My bad... I got confused about matplotlib-core. Not installed in my venv either. |
@selipot please check on your end if all good, and merge when ready. |
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.
just small editing of the docstring examples needed.
As of right now, the goals are:
apply_ragged()
withmatplotlib
functions (to fix apply_ragged with cartopy #227).