opengridcc / opengrid-dev

Open source building monitoring, analysis and control
Apache License 2.0
26 stars 21 forks source link

Carpetplots on website are blank #166

Closed JrtPec closed 7 years ago

JrtPec commented 7 years ago

All carpet plots on the website are clear blue. This probably has something to do with the recent version updates

saroele commented 7 years ago

indeed, that's bad. And the standby graphs are not updated since the upgrade.

I'm busy at work now, i'll try to debug this over the weekend.

saroele commented 7 years ago

I see two issues. When running recipes/electricity_standby.py on the droplet, I get a ValueError:

Cache object created for variable: elec_min_night_0-5
/usr/local/lib/python2.7/dist-packages/opengrid/library/analysis.py:54: FutureWarning: how in .resample() is deprecated
the new syntax is .resample(...).min()
  df = df.resample('D', how=agg)
Traceback (most recent call last):
  File "recipes/electricity_standby.py", line 73, in <module>
    agg='min', starttime=starttime, endtime=endtime)
  File "/usr/local/lib/python2.7/dist-packages/opengrid/library/caching.py", line 328, in cache_results
    df_new = hp.get_data(sensors = [sensor], head=last_day)
  File "/usr/local/lib/python2.7/dist-packages/opengrid/library/houseprint/houseprint.py", line 478, in get_data
    df = pd.concat(series, axis=1)
  File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 845, in concat
    copy=copy)
  File "/usr/local/lib/python2.7/dist-packages/pandas/tools/merge.py", line 878, in __init__
    raise ValueError('No objects to concatenate')
ValueError: No objects to concatenate

And when running the notebook analysis/Electricity_Standby.ipynb I get

TypeErrorTraceback (most recent call last)
<ipython-input-4-e30e6884d115> in <module>()
      4 endtime = dt.time(5, tzinfo=BXL)
      5 caching.cache_results(hp=hp, sensors=sensors, resultname='elec_min_night_0-5', AnalysisClass=DailyAgg,  
----> 6                       agg='min', starttime=starttime, endtime=endtime)
      7 
      8 caching.cache_results(hp=hp, sensors=sensors, resultname='elec_max_night_0-5', AnalysisClass=DailyAgg, 

/usr/local/opengrid/opengrid/library/caching.pyc in cache_results(hp, sensors, resultname, AnalysisClass, **kwargs)
    326 
    327         # get new data, full resolution
--> 328         df_new = hp.get_data(sensors = [sensor], head=last_day)
    329 
    330         # apply the method

/usr/local/opengrid/opengrid/library/houseprint/houseprint.py in get_data(self, sensors, sensortype, head, tail, diff, resample, unit)
    471         if sensors is None:
    472             sensors = self.get_sensors(sensortype)
--> 473         series = [sensor.get_data(head=head, tail=tail, diff=diff, resample=resample, unit=unit) for sensor in sensors]
    474 
    475         # workaround for https://github.com/pandas-dev/pandas/issues/12985

/usr/local/opengrid/opengrid/library/houseprint/sensor.py in get_data(self, head, tail, diff, resample, unit)
    278 
    279             # interpolate to requested frequency
--> 280             newindex = data.resample(rule).first().index
    281             data = data.reindex(data.index.union(newindex))
    282             data = data.interpolate(method='time')

TypeError: first() takes exactly 2 arguments (1 given)

These two issues should both be covered by unittests. We have to add the right tests and fix the issues.

saroele commented 7 years ago

Ah, and I think the carpetplot issues are linked to memory shortage... The job gets killed after some time.

saroele commented 7 years ago

The No objects to concatenate issue is caused by a sensor (smart-main) without data. I think applying the new method to check if a sensor uberhaupt has data is a good solution.

JrtPec commented 7 years ago

The commit you did (removing the first, re-introduces the old pandas warnings. I think replacing first by mean, might also fix it.

saroele commented 7 years ago

No, it doesn't. With mean() you get a value (and you get an AttributeError: numpy.float64 has no attribute 'index'

JrtPec commented 7 years ago

What version of pandas are you using here?

saroele commented 7 years ago

I propose to close this issue as the carpetplots are back and issues seem to be solved.