-
Notifications
You must be signed in to change notification settings - Fork 293
Add register_fields method #5219
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
base: main
Are you sure you want to change the base?
Conversation
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.
Like it!
would it be possible to make the api |
I think that might require that the index be created first? Which would get in the way. I do like it more, though. |
Yes, this is correct. You need to call this before the field_list is populated. |
so... maybe it should be a keyword argument to |
I think both would be good, but I think for clarity |
Unless I am mistaken, adding a keyword argument to load would be fairly invasive as I would have to make sure it is threaded through every frontend. |
not necessarily ! It is true that adding a keyword argument to |
for completeness; I feel the opposite way: an API that can only be called between |
@neutrinoceros, you might have to lay this out for me because I'm not sure I see how a keyword arg can be added to I take your point about this being a somewhat brittle operation, but there is error checking in place to prevent this from being called incorrectly as well as documentation, so to me it is acceptable, and with the above point, the simpler solution. |
Yes, I'm specifically suggesting that the logic live in yt.load (see for instance how the What matters most in my opinion is that we avoid taking shortcuts in designing the interface, because that part will need to be maintained forever. In contrast, |
Ok, I understand now, thank you. To be honest, I'm not in favor of this solution. The hint keyword has an important place here as it aids in the process of figuring out the right frontend, i.e., one of the main functions of load. On the other hand, adding field registering here prevents the user from instantiating a frontend-specific dataset subclass directly. From an organization of duties perspective, I don't think this is where it belongs. From an implementation perspective, I think this also makes it more difficult to thread the logic into the field system. I'm not in favor of, for example, creating another global configuration object to query. We may need another perspective here. |
that's precisely what the |
I've been mulling this over, and I think I'm increasingly opposed (GASP, HORROR!) to adding more things to I genuinely think that adding it to the In short, what I'm coming to think is that we are in a time when we're making some compromises about the existing field system that will stay within where it is (such as this) and those that seek to move it forward (such as #5226 ). I don't think this is such an invasive change that we should forestall it to a day when the field system is improved -- a day which I never thought before would come, but now which seems much more likely. So I think we should do this like it is, even if it's not where we are in agreement about an ideal. |
To be clear, I'm never going to block any of this:
However, for what it's worth, I would like to explain where my reluctance is coming from: |
(In case it needs be said: this is in no way personal, and I genuinely respect everyone in this conversation. I'm sorry if it comes across any differently.) |
@neutrinoceros, thank you, I've not taken this discussion personally. I appreciate fleshing out the pros and cons of my proposed solution and your alternative. I think I understand your points and where you are coming from in terms of the bloat to the |
I am inclined to thumbs up on this, but need another day to think. |
Overall I'm -0.1 on this: I'm leaning against it, but I'm not invested enough that my vote should be blocking. |
PR Summary
This allows users to define or override properties of on-disk fields, namely units, aliases, and display_name. This is particularly useful if a dataset contains extra fields not defined in a frontend for which the user would like to define units. The syntax is:
Happy to add docs and tests if this looks broadly acceptable.
PR Checklist