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
Add sunnyportal2file #9
Conversation
Just to let you know that I haven't forgot about this PR. I just haven't had time to look at it yet. |
All good, cheers Erik :)
-------- Original message --------From: Erik Johansson <notifications@github.com> Date: 18/5/20 1:58 am (GMT+10:00) To: erijo/sunnyportal-py <sunnyportal-py@noreply.github.com> Cc: Subscribed <subscribed@noreply.github.com> Subject: Re: [erijo/sunnyportal-py] Add sunnyportal2file (#9)
Just to let you know that I haven't forgot about this PR. I just haven't had time to look at it yet.
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.
[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "#9 (comment)",
"url": "#9 (comment)",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
|
sunnyportal/responses.py
Outdated
Power = namedtuple('Power', ['timestamp', 'power']) | ||
Power = namedtuple('Power', ['timestamp', 'min_power','mean_power','max_power']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've merged these changes in a slightly different form (see 45bcd9d). The power
member is still there and the other two are called min
and max
.
Please rebase your changes ontop of this.
sunnyportal/responses.py
Outdated
@@ -253,11 +253,13 @@ def parse(self, data): | |||
self.power_measurements = [] | |||
tag_name = "fiveteen" if self.quarter else "hour" | |||
for entry in tag.iterfind('./channel/day/%s' % tag_name): | |||
mean = self.kw_to_w(entry.get('mean')) | |||
if mean is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of always including all power measurements I added a parameter in 2986ad0 to only include it when requested.
…hanged so that also timestamps with no production is included in power_measurements from DayOverviewResponse.parse.
The script can be used to save data from Sunny Portal to a number of different formats.
Thanks for your contribution! |
The file sunnyportal2file can be used to download data from Sunny Portal to file. It currently allows 7 output format (csv, json, pickle, hdf, parquet, feather and excel). It also contains a flag --append which can be used to only download new data and append it to existing file.