Skip to content
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

Retain original data's mask when yearly averaging #196

Merged
merged 3 commits into from
Aug 31, 2017

Conversation

spencerahill
Copy link
Owner

Closes #193.

I still need a test for the actual masking issue; the current test checks un-masked data.

Re-factored a bit in the process, namely moved the function from Calc into utils.times.

@spencerahill
Copy link
Owner Author

I'm not sure what to make of these failures in the Travis 2.7-min environment. Not related to the current PR but also not the same as the ongoing issues c.f. #75

The AppVeyor failures are for python 3.5 and are similar-but-different from either those above or the EmptyHeader of #75.

@spencerkclark any ideas on these? Plus a quick review of the PR when you get a chance please :)

Copy link
Collaborator

@spencerkclark spencerkclark left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this @spencerahill! Just a couple minor comments, but otherwise this looks good to me.

yrs_coord = [2000, 2001, 2004]
yr_avgs = np.array([yr2000, yr2001, yr2004])
desired = xr.DataArray(yr_avgs, dims=['year'], coords={'year': yrs_coord})
assert np.allclose(actual.values, desired.values)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Both here and in the masked test, could we use xr.testing.assert_identical(actual, desired)? I think this would check the array values and year coordinate all in one line.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good call; forgot about xr.testing. I'll use xr.testing.assert_allclose though; in some cases I was getting failures because my by-hand averaging weren't bitwise identical with the xarray/numpy methods.

@@ -72,6 +72,9 @@ Bug Fixes
datapoints were invalid instead of just masking points outside the desired
region (fixes :issue:`190` via :pull:`192`). By
`Spencer Clark <https://github.com/spencerkclark>`_.
- Retain original input data's mask during gridpoint-by-gridpoint
tempral averages (fixes :issue:`193` via :pull:`196`). By `Spencer
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo: "tempral" -> "temporal"

@spencerkclark
Copy link
Collaborator

I'm not sure what to make of these failures in the Travis 2.7-min environment. Not related to the current PR but also not the same as the ongoing issues c.f. #75

It seems they've encountered similar error messages in xarray and it's been suggested this is related to a recent update to dask.distributed (pydata/xarray#1540). I think we can follow along there to see what the resolution might be.

The AppVeyor failures are for python 3.5 and are similar-but-different from either those above or the EmptyHeader of #75.

I want to say these are still related to #75, but I'm not 100% sure.

@spencerahill
Copy link
Owner Author

Thanks @spencerkclark. Will merge pending the tests (besides those that #197 will hopefully fix)

@spencerahill spencerahill merged commit 253f1c4 into develop Aug 31, 2017
@spencerahill spencerahill deleted the masked-data-time-avg-bugfix branch August 31, 2017 19:00
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.

None yet

2 participants