Skip to content

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

@amotl

Description

@amotl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions