BCCN-Prog / weather_2016

For the BCCN 2016 advanced programming project
3 stars 1 forks source link

QueryEngine: KeyError: "Unable to open object (Object 'site_indices' doesn't exist)" #73

Closed clauslang closed 8 years ago

clauslang commented 8 years ago
# Scenario 02

import sys
sys.path.append('../../')
sys.path.append('../../wrapper/')
from query_engine_v2 import QueryEngine

qe = QueryEngine.QueryEngine('daily_database_sc02.hdf5',
                             'hourly_database_sc02.hdf5') # not using hourly DB for now

#print(qe.daily.f["weather_data"][:])
data= qe.smart_slice('daily', ['low', 'high'], 'site', 0, 4)

leads to

Traceback (most recent call last):

  File "<ipython-input-39-15e1e8ebf5d2>", line 1, in <module>
    runfile('/Users/clauslang/Desktop/BCCN/weather_2016/scenarios/scenario02/scenario02.py', wdir='/Users/clauslang/Desktop/BCCN/weather_2016/scenarios/scenario02')

  File "//anaconda/lib/python3.5/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
    execfile(filename, namespace)

  File "//anaconda/lib/python3.5/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 88, in execfile
    exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

  File "/Users/clauslang/Desktop/BCCN/weather_2016/scenarios/scenario02/scenario02.py", line 15, in <module>
    data= qe.smart_slice('daily', ['low', 'high'], 'site', 0, 4)

  File "../../query_engine_v2/QueryEngine.py", line 169, in smart_slice
    s = dset.f["weather_data"][:,params_intersect_int[i]][dset.f[dset_names[i]]]

  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/work/h5py/_objects.c:2579)

  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/work/h5py/_objects.c:2538)

  File "//anaconda/lib/python3.5/site-packages/h5py/_hl/group.py", line 164, in __getitem__
    oid = h5o.open(self.id, self._e(name), lapl=self._lapl)

  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/work/h5py/_objects.c:2579)

  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/work/h5py/_objects.c:2538)

  File "h5py/h5o.pyx", line 190, in h5py.h5o.open (/Users/ilan/minonda/conda-bld/work/h5py/h5o.c:3551)

KeyError: "Unable to open object (Object 'site_indices' doesn't exist)"
ge00rg commented 8 years ago

This is not a problem with the Query Engine but rather that the database is faulty.