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
Log interpolation #453
Log interpolation #453
Conversation
Some duplication with |
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.
The approach is fine--unit handling is ugly, but not unreadably so. Just some questions about naming/documentation.
x : array-like | ||
The x-coordinates of the interpolated values. | ||
|
||
xp : array-like |
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.
Maybe x_data
instead of xp
?
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 named these to match np.interp
since we are emulating a log version of it.
xp : array-like | ||
The x-coordinates of the data points. | ||
|
||
fp : array-like |
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.
How about ydata
?
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.
Same as above
metpy/calc/tools.py
Outdated
The x-coordinates of the data points. | ||
|
||
fp : array-like | ||
The y-coordinates of the data points, same length as cp. |
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.
cp?
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.
Same
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.
Pretty sure that's a typo for xp
------- | ||
array-like | ||
The interpolated values, same shape as x. | ||
|
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.
One feedback we've gotten is that people would like more simple examples. Can you add a doctest-style example of usage here?
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.
Good idea! I'll add a quick three liner.
I'm open to suggestions on how to make the unit handling look better, but I didn't see a way that covered all the cases without this many attribute checks. |
1b6c2b6
to
ab132e8
Compare
I don't have any better suggestions on the unit-handling, so just fix the typo and we can get this merged. |
ab132e8
to
7b9485d
Compare
7b9485d
to
4b7bdeb
Compare
Adds a log interpolation function to make interpolating things in pressure coordinates easier. This is needed for the layer helper functions being developed, but that PR was already getting rather huge.
I don't like all the unit checking and munging here. Interpolate drops units silently and log throws errors. Open to suggestions on if we should force unit usage here or not.