Skip to content

Conversation

@bendudson
Copy link
Contributor

Averages fields in Z. Smooth variation between 0 (no averaging) and 1 (full averaging). Intermediate values will retain some Z variation.

Averages fields in Z. Smooth variation between 0 (no averaging) and
1 (full averaging). Intermediate values will retain some Z variation.
Copy link
Member

@ZedThree ZedThree left a 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,
Copy link
Member

Choose a reason for hiding this comment

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

Default to None?

Suggested change
averageZ=0.0,
averageZ : None | float = None,

if outformat is None:
outformat = informat

averageZ = min([averageZ, 1.0])
Copy link
Member

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?

Suggested change
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:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if averageZ > 0.0:
if averageZ is not None:

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