-
Notifications
You must be signed in to change notification settings - Fork 3
restart.create: Add averageZ parameter #135
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
base: master
Are you sure you want to change the base?
Conversation
Averages fields in Z. Smooth variation between 0 (no averaging) and 1 (full averaging). Intermediate values will retain some Z variation.
ZedThree
left a comment
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, some small suggestions. Would be nice to get a test on it as well! :)
| def create( | ||
| averagelast=1, final=-1, path="data", output="./", informat="nc", outformat=None | ||
| averagelast=1, | ||
| averageZ=0.0, |
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.
Default to None?
| averageZ=0.0, | |
| averageZ : None | float = None, |
| if outformat is None: | ||
| outformat = informat | ||
|
|
||
| averageZ = min([averageZ, 1.0]) |
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.
Hard error if outside expected range?
| averageZ = min([averageZ, 1.0]) | |
| if not (0 < averageZ < 1.0): | |
| raise ValueError(f"`averageZ` (={averageZ}) must be in (0, 1)") |
| data[(final - averagelast) : final, :, :, :], axis=0 | ||
| ) | ||
|
|
||
| if averageZ > 0.0: |
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.
| if averageZ > 0.0: | |
| if averageZ is not None: |
Averages fields in Z. Smooth variation between 0 (no averaging) and 1 (full averaging). Intermediate values will retain some Z variation.