-
Notifications
You must be signed in to change notification settings - Fork 41
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
Issue464 cube metadata #541
Conversation
issue #464 moved general methods from CollectionMetadata to CubeMetadata only collection parsing specific methods are left in CollectionMetadata This only has a refactoring effect, no functional changes for now
openeo-python-client/openeo/metadata.py Lines 231 to 242 in 498c4c7
Currently functionality does not change due to this function. As this function checks the type and returns an object of the same class, functions like reduce_dimension (who use this function to update a metadata object) will still return a CollectionMetadata object if that was the original object.
Changing this to return a CubeMetadata changes functionality and fails some existing tests. An alternative is to provide an optional argument to set the expected returned class, however this feels more like a quick fix and might be confusing in the future. |
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.
some initial comments
I think it's fine to keep the original type of the metadata, that will indeed avoid breakage at other places. Priority at the moment is having a base metadata class that is not implicitly tied to collection metadata (e.g. for #425 #516 #527 etc) |
_clone_and_update had to be overridden by CollectionMetadata to keep the _orig_metadata attribute
_orig_metadata has been removed from CubeMetadata. Unless we change _clone_and_update to always return a CubeMetadata this is the only clean solution I think. CubeMetadata tests still need to be written. |
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.
some quick notes
== None -> is None set_dimensions -> _set_dimensions
this was less complex and more readable than the previous implementation
TODO:
|
BandsDimension and TemporalDimension needed to override rename and rename labels to ensure that the type checks were correct
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.
some more notes
about test_metadata.py: be careful about adding formatting changes everywhere, that makes it hard to to find the actual things that were changed
can you also add a changelog entry?
Co-authored-by: Stefaan Lippens <[email protected]>
…eneo-python-client into issue464-CubeMetadata
Because I changed the names of the metadata tests using CollectionMetadata to test_collectionmetadata, pre-commit refactored the whole tests causing a large diff. I added an entry in the changelog and processed the last review. |
from issue #464