Abstract base parser class#5
Merged
Merged
Conversation
…ions for each format type
… a property in a trajectory, renamed IntArray to Int1DArray
…entrypoint in pyproject.toml to new entrypoint definition
…renamed test_backend.py to test_entrypoint.py and moved into backends submodule of tests, added tests for guess_can_open
…ats is localized, split up OnDiskArray and OnDiskTrajectory classes
…w for numpy arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactoring the xarray backend and parsers to introduce two protocol interfaces (
OnDiskTrajectoryandOnDiskArray) for a cleaner implementation of the xarray entrypoint. Now, theTrajectoryBackendArrayinside theXMDPYBackendEntrypointclass only depends on the trajectory interface via theOnDiskTrajectoryprotocol.For each trajectory format, the
OnDiskTrajectoryimplementation contains the relevant trajectory information for that specific format and provides helper functions to generalize the steps taken when creating the finalDatasetobject with the trajectory information.The different types of array-like information in the trajectory file (e.g., XYZ coordinates, cell information, etc.) are provided as
OnDiskArrays by theOnDiskTrajectoryimplementation. Indexing anOnDiskArrayinstance will parse the trajectory file for the associated data it represents (e.g., the XYZ coordinates) and return it, but the result is not cached like in lazy loading. The lazy loading is instead performed by theLazilyIndexedArray(provided by xarray) which wraps theTrajectoryBackendArray. The trajectory data is accessed via several, nested objects when loading the trajectory into the final xarrayDatasetobject. From highest to lowest levels, the order is as follows:xarray.Datasetxarray.Variablexarray.core.indexing.LazilyIndexedArrayTrajectoryBackendArrayOnDiskArray(via theOnDiskTrajectoryobject)raw datain trajectory fileAs a result,
XMDPYBackendEntrypointrelies on theOnDiskTrajectoryinterface to provide the trajectory data in a standardized, iterable format when creating the finalxarray.Datasetobject, simplifying the steps need to patch everything together. Lastly, thebackend.namessubmodule was added to standardize the naming of trajectory variables, coordinates, and dimensions.