-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Description
Originally noted here
All of the failures are the same error. Note that this one doesn't involve regional averaging, so it's unrelated to what I'm implementing in #266. Here's the traceback of one:
$ py.test test_calc_basic.py::TestCalc3D::test_monthly_ts
================================================================== test session starts ==================================================================
platform darwin -- Python 3.6.3, pytest-3.2.3, py-1.5.1, pluggy-0.4.0
rootdir: /Users/shill/Dropbox/py/aospy, inifile: setup.cfg
plugins: catchlog-1.2.2, hypothesis-3.50.2
collected 1 item
test_calc_basic.py F
======================================================================= FAILURES ========================================================================
______________________________________________________________ TestCalc3D.test_monthly_ts _______________________________________________________________
self = <aospy.test.test_calc_basic.TestCalc3D testMethod=test_monthly_ts>
def test_monthly_ts(self):
calc = Calc(intvl_out=1, dtype_out_time='ts', **self.test_params)
> calc.compute()
calc = <aospy.Calc instance: sphum, example_proj, example_model, example_run>
self = <aospy.test.test_calc_basic.TestCalc3D testMethod=test_monthly_ts>
test_calc_basic.py:88:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../calc.py:569: in compute
self.end_date),
../calc.py:415: in _get_all_data
for n, var in enumerate(self.variables)]
../calc.py:415: in <listcomp>
for n, var in enumerate(self.variables)]
../calc.py:367: in _get_input_data
**self.data_loader_attrs)
../data_loader.py:278: in load_variable
ds, min_year, max_year = _prep_time_data(ds)
../data_loader.py:180: in _prep_time_data
ds = times.ensure_time_avg_has_cf_metadata(ds)
../utils/times.py:417: in ensure_time_avg_has_cf_metadata
raw_start_date = ds[TIME_BOUNDS_STR].isel(**{TIME_STR: 0, BOUNDS_STR: 0})
../../../../miniconda3/envs/py36/lib/python3.6/site-packages/xarray/core/dataarray.py:754: in isel
ds = self._to_temp_dataset().isel(drop=drop, **indexers)
../../../../miniconda3/envs/py36/lib/python3.6/site-packages/xarray/core/dataset.py:1391: in isel
indexers_list = self._validate_indexers(indexers)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Dataset>
Dimensions: (bounds: 2)
Coordinates:
time_bounds (bounds) float64 dask.array<shape=(2,), ... time_weights float64 ...
Data variables:
<this-array> (bounds) float64 dask.array<shape=(2,), chunksize=(2,)>
indexers = {'bounds': 0, 'time': 0}
def _validate_indexers(self, indexers):
""" Here we make sure
+ indexer has a valid keys
+ indexer is in a valid data type
"""
from .dataarray import DataArray
invalid = [k for k in indexers if k not in self.dims]
if invalid:
> raise ValueError("dimensions %r do not exist" % invalid)
E ValueError: dimensions ['time'] do not exist
DataArray = <class 'xarray.core.dataarray.DataArray'>
indexers = {'bounds': 0, 'time': 0}
invalid = ['time']
self = <xarray.Dataset>
Dimensions: (bounds: 2)
Coordinates:
time_bounds (bounds) float64 dask.array<shape=(2,), ... time_weights float64 ...
Data variables:
<this-array> (bounds) float64 dask.array<shape=(2,), chunksize=(2,)>