-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Consistent rules for handling merges between variables with different attributes #25
Comments
I would default to 3, and in the exception suggest using a different merge option. Imagine merging two datasets with different _FillValue, unit, or compression attributes. |
For merge itself, I would agree that we may want to default to stricter behavior, but for these other versions of merge we should default to something more flexible. |
It depends on whether x+y does attribute checking before performing the On Wed, Feb 26, 2014 at 2:47 PM, Stephan Hoyer [email protected]:
|
My concern is more that metadata like "title" or "source" should not be required to match, because that metadata will almost always be conflicting. Perhaps "units", "_FIllValue", "scale_factor" and "add_offset" (if values were not automatically masked/scaled) should be specifically blacklisted to prohibit conflicts. |
This is an option, but these lists will break if we try to express other On Wed, Feb 26, 2014 at 3:03 PM, Stephan Hoyer [email protected]:
|
Also, there are plenty of other bits where you don't want conflicts. On Wed, Feb 26, 2014 at 3:13 PM, Eugene Brevdo [email protected] wrote:
|
I see your point, but I favor a more pragmatic approach by default. See my My vision here is a more powerful ndarray enhanced rather than limited by I think that both use cases can be covered as long as the merge/conflict On Wed, Feb 26, 2014 at 3:23 PM, ebrevdo [email protected] wrote:
|
I don't think that example has your intended affect. I don't know why On Wed, Feb 26, 2014 at 3:42 PM, Stephan Hoyer [email protected]:
|
err, which attributes conflict. On Wed, Feb 26, 2014 at 3:45 PM, Eugene Brevdo [email protected] wrote:
|
Stern warnings about conflicting attributes like units may be an Celsius, for example, is a pretty weird physical unit because of how it can On Wed, Feb 26, 2014 at 3:45 PM, ebrevdo [email protected] wrote:
|
Agreed. I would avoid that kind of thing too. Maybe a stern warning for For units specifically, Python has a variety of unit libraries that wrap On Wed, Feb 26, 2014 at 4:07 PM, Stephan Hoyer [email protected]:
|
I think this has been mostly resolved by the |
I'm going to close this issue as fixed, but feel free to complain if you feel otherwise (particularly if you have ideas for how we should improve this). The rule that we seem to have settled on is that xray will either drop all attributes if the result could be ambiguous, or, if there is a clear priority, it will only keep around attributes from the first object. The one firm rule is that xray does not do any checking of attributes for conflicts. Unless In cases where there are two objects to combine but where the priority is clearer (e.g., in |
Currently, variable attributes are checked for equality before allowing for a merge via a call to
xarray_equal
. It should be possible to merge datasets even if some of the variable metadata disagrees (conflicting attributes should be dropped). This is already the behavior for global attributes.The right design of this feature should probably include some optional argument to
Dataset.merge
indicating how strict we want the merge to be. I can see at least three versions that could be useful:We can argue about which of these should be the default option. My inclination is to be as flexible as possible by using 1 or 2 in most cases.
The text was updated successfully, but these errors were encountered: