Skip to content
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

Refactor / add component schemas #7

Merged
merged 8 commits into from
Nov 30, 2021
Merged

Conversation

jhamman
Copy link
Contributor

@jhamman jhamman commented Nov 24, 2021

This PR reorganizes the xarray-schema package. A few new features are included (e.g. to_json) but it is mostly a refactor that includes:

  • Split source code into separate modules
  • component schemas for individual parts of the xarray data model
  • parameterized tests

@codecov
Copy link

codecov bot commented Nov 24, 2021

Codecov Report

Merging #7 (91b2967) into main (2b4b4de) will increase coverage by 11.95%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             main        #7       +/-   ##
============================================
+ Coverage   88.04%   100.00%   +11.95%     
============================================
  Files           2         6        +4     
  Lines          92       258      +166     
============================================
+ Hits           81       258      +177     
+ Misses         11         0       -11     
Impacted Files Coverage Δ
xarray_schema/__init__.py 100.00% <100.00%> (ø)
xarray_schema/base.py 100.00% <100.00%> (ø)
xarray_schema/components.py 100.00% <100.00%> (ø)
xarray_schema/dataarray.py 100.00% <100.00%> (ø)
xarray_schema/dataset.py 100.00% <100.00%> (ø)
xarray_schema/types.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b4b4de...91b2967. Read the comment docs.

Copy link

@norlandrhagen norlandrhagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, very little feedback from me. It'll be nice to play around with it a bit more and get to know how it works.


def __init__(
self,
data_vars: Dict[Hashable, Union[DataArraySchema, None]] = None,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could any of these be abstracted/shared in .typing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so but I wasn't sure which ones I'd use more than once. I'll take another pass through the type definitions.

Parameters
----------
name : str, optional
Name of the DataArray. Currently requires an exact string match.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe temp until regex matching, but would comparing the .lower or .upper name help?

Parameters
----------
name : str, optional
Name of the DataArray. Currently requires an exact string match.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe temp until regex matching, but would comparing the .lower or .upper name help on string matching?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #9 to discuss

Copy link
Contributor

@orianac orianac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions!

@jhamman jhamman merged commit 165e81c into main Nov 30, 2021
@jhamman jhamman deleted the feature/component-schemas branch November 30, 2021 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants