-
Notifications
You must be signed in to change notification settings - Fork 224
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
**Breaking**: data_kind: data is None and required now returns the 'empty' kind #3482
Conversation
…data types fall back to 'vectors'
pygmt/clib/session.py
Outdated
@@ -1791,6 +1791,7 @@ def virtualfile_in( # noqa: PLR0912 | |||
"image": tempfile_from_image, | |||
"stringio": self.virtualfile_from_stringio, | |||
"matrix": self.virtualfile_from_matrix, | |||
"none": self.virtualfile_from_vectors, |
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 we change to another word like "empty" to reduce confusion with None
?
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 have another idea to completely eliminate the "none" kind. I'll open a POC PR later.
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 have another idea to completely eliminate the "none" kind. I'll open a POC PR later.
It turns out the idea can't eliminate the "none" kind. So let's focus on this PR again.
Can we change to another word like "empty" to reduce confusion with
None
?
I want to emphasize that data_kind(data=None)
returns "none"
, so kind == "none"
means data is None
, which IMHO is very intuitive. That's why I choose "none"
as the new kind name, but I'm also OK with a new kind
name if others think "empty"
is a better 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.
The intention of kind == "none"
is to indicate that the data is stored in the x
, y
, z
variables rather than in data
(i.e. data is None
means data is in xyz variables). I thought about naming it as kind="xyz"
but since we are planning to support other 1d arrays like intensity
, symbol
, etc (#1076), maybe we should call it kind="xyzarrays"
? Or I'm ok with using kind="empty"
too, just don't want to use "none"
because it is confusing with None
.
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.
maybe we should call it
kind="xyzarrays"
Although not documented, I think in our codes, when we talk about "arrays", we usually mean numpy arrays, so a better name is "xyzvectors", but I feel it's confusing with the "vectors"
kind. So, rename none
to empty
in a1e67d3.
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 ok, but I think wait for #3351 to be merged first before merging this one.
Co-authored-by: Wei Ji <[email protected]>
…odule performance (#3502) Co-authored-by: Wei Ji <[email protected]>
…das<=2.1 (#3505) Co-authored-by: Wei Ji <[email protected]>
…to_matrix/vectors_to_arrays/array_to_datetime (#3496)
Co-authored-by: Wei Ji <[email protected]>
…a_kind/vectors-none
80c5aa5
to
a469acf
Compare
Need to wait for #3351 or merge directly into #3351.
This PR adds a new kind
"empty"
for thedata=None, required=True
case. The new kind name makes more sense and can simplify the logic of codes.