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

Unit conversion and resampling not playing along nicely #124

Open
JrtPec opened this issue Apr 19, 2016 · 2 comments
Open

Unit conversion and resampling not playing along nicely #124

JrtPec opened this issue Apr 19, 2016 · 2 comments

Comments

@JrtPec
Copy link
Member

JrtPec commented Apr 19, 2016

I tried putting myself in the shoes of someone who's not so experienced with OpenGrid while trying to design an analysis. I want to do an analysis on monthly gas consumption, preferably in kWh.

gas_sensor.get_data(resample='M', unit='kWh') gives me UndefinedUnitError: 'M' is not defined in the unit registry, other combinations give me a range of ValueError, DimensionalityError, ...

Little did I know that I had to flag diff=False, only so I can do df.diff() afterwards to get a monthly gas consumption in kWh.

Anyhow... something we could work on this evening?

@JrtPec JrtPec added the bug label Apr 19, 2016
@JrtPec
Copy link
Member Author

JrtPec commented Apr 19, 2016

I think the problem lies in sensor._unit_conversion_factor(), on lines like source = self.unit + '/' + resample, which works great when resample is something like 'min' or 'hour'. I just tried 'MS', which is start of month, but was interpreted as MegaSiemens... :-/

@JrtPec
Copy link
Member Author

JrtPec commented Apr 19, 2016

get_data() should have 4 arguments:

  • start,
  • end
  • , with 3 options:
    • power (vermogen)
    • energy (verbruik)
    • energy cumulative
  • resample rate or rule: s, min, h, d, w, m, ...

If the source is cumulative: power & energy imply a diff(), energy cumulative implies no diff.

If the source is not cumulative: power & energy are ok, energy cumulative implies a sum().

We have to rewrite the conversion from power to energy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants