You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create some unit tests to help us understand the behaviour of each argument:
def test_xarray_da_mean_skipna_true():
- create a simple 1D xarray.DataArray with 10 values of [10., 10., 10., 10., 10., nan, nan, nan, nan, nan]
- test that the average is 2 if you use `skipna=True`
def test_xarray_da_mean_skipna_false():
- create a simple 1D xarray.DataArray with 10 values of [10., 10., 10., 10., 10., nan, nan, nan, nan, nan]
- test that the average is 1 if you use `skipna=False`
If the results are not as above, we need to investigate more.
def test_xarray_da_mean_keep_attrs_true():
- read a variable from our mini-esgf-cache
- average it with `mean` method across the time axis, with `keep_attrs=True`
- assert the original attributes match the new attributes
def test_xarray_da_mean_keep_attrs_false():
- read a variable from our mini-esgf-cache
- average it with `mean` method across the time axis, with `keep_attrs=False`
- examine the attributes of the resulting average DataArray
- assert those values when you know them
Discuss with team whether we want to:
1. Keep attrs
2. Lose attrs
3. Modify attrs (which might be: keep some then remove/edit/add others).
Keep these unit tests in our codebase anyway.
The text was updated successfully, but these errors were encountered:
The Xarray
mean
method is:http://xarray.pydata.org/en/stable/generated/xarray.DataArray.mean.html
It includes two optional arguments:
skipna
- skip missing values (or not)keep_attrs
- keep variable attributes (or not)Create some unit tests to help us understand the behaviour of each argument:
Keep these unit tests in our codebase anyway.
The text was updated successfully, but these errors were encountered: