earthobservations / wetterdienst

Open weather data for humans.
https://wetterdienst.readthedocs.io/
MIT License
349 stars 54 forks source link

TypeError: '>=' not supported between instances of 'int' and 'datetime.datetime' #373

Closed amotl closed 3 years ago

amotl commented 3 years ago

Hi again,

while giving the CLI invocation examples some love, I found those examples will croak:

# Acquire monthly data from 2017-01 to 2019-12
wetterdienst dwd observations values --station=1048,4411 --parameter=kl --resolution=monthly --date=2017-01/2019-12

# Acquire annual data for 2019
wetterdienst dwd observations values --station=1048,4411 --parameter=kl --resolution=annual --date=2019

# Acquire annual data from 2010 to 2020
wetterdienst dwd observations values --station=1048,4411 --parameter=kl --resolution=annual --date=2010/2020
Traceback (most recent call last):
  File "/Users/amo/dev/earthobservations/wetterdienst/.venv/bin/wetterdienst", line 5, in <module>
    run()
  File "/Users/amo/dev/earthobservations/wetterdienst/wetterdienst/cli.py", line 262, in run
    df = df.dwd.filter_by_date(options.date, stations.stations.resolution)
  File "/Users/amo/dev/earthobservations/wetterdienst/wetterdienst/dwd/pandas.py", line 95, in filter_by_date
    expression = (date_from <= self.df[DWDMetaColumns.FROM_DATE.value]) & (
  File "/Users/amo/dev/earthobservations/wetterdienst/.venv/lib/python3.8/site-packages/pandas/core/ops/common.py", line 65, in new_method
    return method(self, other)
  File "/Users/amo/dev/earthobservations/wetterdienst/.venv/lib/python3.8/site-packages/pandas/core/ops/__init__.py", line 370, in wrapper
    res_values = comparison_op(lvalues, rvalues, op)
  File "/Users/amo/dev/earthobservations/wetterdienst/.venv/lib/python3.8/site-packages/pandas/core/ops/array_ops.py", line 251, in comparison_op
    res_values = na_arithmetic_op(lvalues, rvalues, op, is_cmp=True)
  File "/Users/amo/dev/earthobservations/wetterdienst/.venv/lib/python3.8/site-packages/pandas/core/ops/array_ops.py", line 143, in na_arithmetic_op
    result = expressions.evaluate(op, left, right)
  File "/Users/amo/dev/earthobservations/wetterdienst/.venv/lib/python3.8/site-packages/pandas/core/computation/expressions.py", line 233, in evaluate
    return _evaluate(op, op_str, a, b)  # type: ignore
  File "/Users/amo/dev/earthobservations/wetterdienst/.venv/lib/python3.8/site-packages/pandas/core/computation/expressions.py", line 68, in _evaluate_standard
    return op(a, b)
TypeError: '>=' not supported between instances of 'int' and 'datetime.datetime'

With kind regards, Andreas.

P.S.: This is just a note while going through all CLI invocation variants in order to give us a heads up. I might be able to investigate and fix this on my own behalf though.

amotl commented 3 years ago

Will be fixed through #378.