-
Notifications
You must be signed in to change notification settings - Fork 0
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
Colorbar levels as list/array in gridmap & small fixes #176
Conversation
… to Dataset, rename extend->extent (plot.py)
…onvert DataArray to Dataset, rename extend->extent (plot.py)
Welcome, new contributor! It appears that this is your first Pull Request. To give credit where it's due, we ask that you add your information to the
Please make sure you've read our contributing guide. We look forward to reviewing your Pull Request shortly ✨ |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@vindelico if you want to not run into formatting issues, run:
|
Co-authored-by: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
) | ||
if levels is not None: | ||
if isinstance(levels, Iterable): | ||
lin = levels |
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.
fyi, it was already possible to pass a list through plot_kw={'levels':[290,294,298,302]}
, but nice to access it also directly here.
I am wondering if we should change to example in the notebook for this instead?
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.
Would be nice to see the option!
if isinstance(data, xr.DataArray): | ||
plot_data = data | ||
data = xr.Dataset({plot_data.name: plot_data}) |
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.
why does it need to be a dataset ?
what if it doesn't have a name ?
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.
TBH, it's been a while that I added that so don't quite remember 🤔 ...
It was something missing on the plot if the dataset was not there.
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.
haha ok!
@@ -749,8 +753,8 @@ def gridmap( | |||
im = plot_data.plot.contourf(**plot_kw) | |||
|
|||
if ax: | |||
if extend: |
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.
good catch!
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.
Looks good, thanks Marco!
CHANGES.rst
Outdated
@@ -19,6 +19,7 @@ Contributors to this version: Sarah-Claude Bourdeau-Goulet (:user:`Sarahclaude`) | |||
|
|||
New features and enhancements | |||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |||
* Use list or ndarray as levels for colorbar in gridmap and small bug fixes (:pull:`176`). |
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.
* Use list or ndarray as levels for colorbar in gridmap and small bug fixes (:pull:`176`). | |
* Use list or ndarray as levels for colorbar in gridmap and small bug fixes (:pull:`176`). |
This should be under v4.0
Pull Request Checklist:
number
) and pull request (:pull:number
) has been added.What kind of change does this PR introduce?
Does this PR introduce a breaking change?
No.
Other information: