-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add dataset tests #14
Conversation
…lter_by_time(), modify the default None behaviour to choose utcnow() instead of now() to avoid timezone related issues
… add_dataset_tests
… add_dataset_tests
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.
LGTM. We could already merge this if you want
"""Set dataset attributes for each attrs_dict key.""" | ||
for var in attrs_dict: | ||
ds[var].attrs.update(attrs_dict[var]) | ||
|
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.
Not necessarily to be addressed in this PR, but let's try to update the code to return the ds
in such type of functions ;)
So that ds = set_whatever(ds)
dataarray = xr.DataArray(array, dims=["used_dim"]) | ||
dataset = xr.Dataset(data_vars={"var": dataarray}) | ||
dataset = dataset.expand_dims(dim=["unused_dim"]) | ||
# TODO: this does not work, it adds the dimension to all variables. How can this be done? |
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.
I see. I guess to create the test case, you need to create two data arrays, then to one of them you call the expand_dims
, then you xr.merge
, and then you drop the variable with the "unused dim"
.
It might be that you need to define the dimension coordinate to avoid that by dropping the variable it drops also the dimension (because completely unused)
I'll address your comment on |
@sphamba can I merge now? |
Yes! |
Prework
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and communicate accordingly:
The PR fulfills these requirements:
bugfix-<some_key>-<word>
doc-<some_key>-<word>
tutorial-<some_key>-<word>
feature-<some_key>-<word>
refactor-<some_key>-<word>
optimize-<some_key>-<word>
fix #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Summary