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

Issues with get_generation() #25

Open
mbonvini opened this issue May 27, 2015 · 4 comments
Open

Issues with get_generation() #25

mbonvini opened this issue May 27, 2015 · 4 comments

Comments

@mbonvini
Copy link

Hi

I am using Pyiso to understand the CO2 associated to the production of electric energy. I would like to do this for California
This is the script I have

from pyiso import client_factory
import pandas as pd

caiso = client_factory("CAISO")
data_caiso = caiso.get_generation(latest = True)
df_caiso = pd.DataFrame(data_caiso)
print df_caiso

and this is the results I get

  ba_name freq  fuel_name    gen_MW market                  timestamp
0   CAISO  10m  renewable   1706.00   RT5M  2015-05-27 17:00:00+00:00
1   CAISO  10m      solar   5342.00   RT5M  2015-05-27 17:00:00+00:00
2   CAISO  10m       wind    939.00   RT5M  2015-05-27 17:00:00+00:00
3   CAISO  10m      other  21534.32   RT5M  2015-05-27 17:00:00+00:00

Unfortunately I'd like to have more information and not only other in terms of fuel description.

I tried with other ISOs ("ISONE", "ERCOT" and "PJM") in order to see if they had more info.
Here's an example of script

from pyiso import client_factory
import pandas as pd
from datetime import datetime

isone = client_factory("ISONE")
data_isone = isone.get_generation(latest = True)
df_isone = pd.DataFrame(data_isone)
print df_isone

however I get this error

No handlers could be found for logger "pyiso.base"
Traceback (most recent call last):
  File "get_carbon_footprint.py", line 10, in <module>
    data_isone = isone.get_generation(latest = True)
  File "/usr/local/lib/python2.7/dist-packages/pyiso/isone.py", line 63, in get_generation
    data = self.fetch_data(endpoint, self.auth)
  File "/usr/local/lib/python2.7/dist-packages/pyiso/isone.py", line 35, in fetch_data
    return response.json()
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 819, in json
    return json.loads(self.text, **kwargs)
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 413, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 402, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 420, in raw_decode
    raise JSONDecodeError("No JSON object could be decoded", s, idx)
simplejson.decoder.JSONDecodeError: No JSON object could be decoded: line 1 column 0 (char 0)

any suggestions?

Thanks

@aschn
Copy link
Contributor

aschn commented Jun 11, 2015

Did we resolve this issue by email? Happy to help if you still have questions. If not, let's close this issue.

@mbonvini
Copy link
Author

I was able to get the data I wanted using the following API

# Define parameters
pars =  {
"ba": "CAISO",
"start_at": d2_start.strftime("%Y-%m-%dT%H:%M:%S%z"), \
"end_at": d2_end.strftime("%Y-%m-%dT%H:%M:%S%z"), \
"freq": "10m",
"market": "RT5M",
"page_size":100}

# Create request
res = requests.get("http://api.watttime.org:80/api/v1/datapoints/",
params = pars,
headers = {'Authorization': 'Token <my_token>'})

and I haven't checked if this error is still present or not.
By the way, this API provides the following documentation

API endpoint that allows a single grid data point to be viewed. All times are in UTC. 'carbon' is in lb CO2/MW. 'pk' is a unique numeric identifier for a data point.

is the mass of CO2 per power averaged over the time period associated to the frequency selected in the API call? in this case

lb CO2 / MW / 600 s

while in an other could be different? Or is it always averaged with respect a standard period (e.g. 1hour)?

@JacquelineGarrido
Copy link

I am running the following code
caiso = client_factory('CAISO')
data=caiso.get_generation(latest=True)
df= pd.DataFrame(data)
df

and I am not getting any real time data(Empty DataFrame). This works fine when I change to "Yesterday=True" or "Forecast=True".
Can anyone help me with this? When I checked the CAISO website there is data there http://www.caiso.com/TodaysOutlook/Pages/supply.aspx

@rajkumarks7
Copy link

rajkumarks7 commented Aug 26, 2020

I am running the following code
caiso = client_factory('CAISO')
data=caiso.get_generation(latest=True)
df= pd.DataFrame(data)
df

and I am not getting any real time data(Empty DataFrame). This works fine when I change to "Yesterday=True" or "Forecast=True".
Can anyone help me with this? When I checked the CAISO website there is data there http://www.caiso.com/TodaysOutlook/Pages/supply.aspx

i am also facing the same problem with the CAISO did you get any solution?

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

No branches or pull requests

4 participants