-
Notifications
You must be signed in to change notification settings - Fork 12
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
Blog post #142
Blog post #142
Conversation
TomNicholas
commented
Oct 20, 2021
- Closes Blog post to show off pint-xarray integration? #114
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 have a few comments, but this really looks great so far!
Co-authored-by: keewis <keewis@users.noreply.github.com>
Co-authored-by: keewis <keewis@users.noreply.github.com>
Co-authored-by: keewis <keewis@users.noreply.github.com>
Co-authored-by: keewis <keewis@users.noreply.github.com>
Co-authored-by: keewis <keewis@users.noreply.github.com>
I think the doctest failure is a upstream issue: it may have been introduced when I changed the formatting code of |
that's wrong, it is the same issue as above: assigning to the application registry modifies the wrapper and not the unit registry. In this case, instead of |
as decided in the meeting this evening, we'll skip the We still need to wait on the |
blogpost.md
Outdated
@expects("newton * seconds") | ||
def jpl_trajectory_code(impulse): | ||
print(f"Received impulse in units of [{impulse.pint.units}]") |
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.
Change this to a simple if raise statement for now, and add a note that we will improve this API in 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.
Done now, though I should probably print the actual error message that would be raised
## Dequantifying | ||
|
||
To convert our pint arrays back into numpy arrays, we can use `.dequantify`. | ||
This will strip the units from the arrays and replace them into the `.attrs['units']` of each variable. | ||
This is useful when we want to save our data back to a file, as it means that the current units will be preserved in the attributes of a netcdf file (or zarr store etc.), as long as we just do `ds.pint.dequantify().to_netcdf()`. |
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.
Put a note in about option of dequantifying to different formats
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.
@keewis should we bother with this?
for more information, see https://pre-commit.ci
@keewis we should ideally add this content as a new page of examples in the docs |