grafana-toolbox / grafana-pandas-datasource

Grafana Pandas Datasource - using Python for generating timeseries-, table-data and annotations
GNU Affero General Public License v3.0
53 stars 15 forks source link

Program croaks when acquiring "forecast" data with "--humanize" and "--show-ids" options #6

Closed amotl closed 3 years ago

amotl commented 3 years ago

Hi there,

phenodata currently croaks when trying to acquire forecast data when using both the --humanize and --show-ids options.

phenodata forecast \
    --source=dwd --dataset=immediate --partition=recent --language=german \
    --species-preset=mellifera-de-primary --station=Müncheberg,Oberspiesheim --phase-id=5,7 \
    --humanize --show-ids
Traceback (most recent call last):
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/grafana-pandas-datasource-41rstjPg-py3.9/bin/phenodata", line 33, in <module>
    sys.exit(load_entry_point('phenodata', 'console_scripts', 'phenodata')())
  File "/path/to/phenodata/phenodata/command.py", line 165, in run
    data = client.get_forecast(options, forecast_year=options['forecast-year'], humanize=options['humanize'])
  File "/path/to/phenodata/phenodata/dwd/pheno.py", line 258, in get_forecast
    forecast = self.humanizer.get_forecast(megaframe, target_year=target_year)
  File "/path/to/phenodata/phenodata/dwd/pheno.py", line 518, in get_forecast
    stations, species, phases, quality_levels, quality_bytes = self.get_fields(frame)
  File "/path/to/phenodata/phenodata/dwd/pheno.py", line 574, in get_fields
    station_label += ' [{}]'.format(row['Stations_id'])
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/grafana-pandas-datasource-41rstjPg-py3.9/lib/python3.9/site-packages/pandas/core/series.py", line 882, in __getitem__
    return self._get_value(key)
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/grafana-pandas-datasource-41rstjPg-py3.9/lib/python3.9/site-packages/pandas/core/series.py", line 990, in _get_value
    loc = self.index.get_loc(label)
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/grafana-pandas-datasource-41rstjPg-py3.9/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 2900, in get_loc
    raise KeyError(key) from err
KeyError: 'Stations_id'

With kind regards, Andreas.

amotl commented 3 years ago

This has been filed at the wrong place, sorry for that. I've now created the issue at https://github.com/earthobservations/phenodata/issues/6.