openmeteo / enhydris

A database with a web interface for the storage and management of hydro/meteorological measurements and time series
GNU Affero General Public License v3.0
18 stars 11 forks source link

division by zero #372

Closed aptiko closed 4 years ago

aptiko commented 4 years ago

https://system.openhi.net/api/stations/2195/timeseriesgroups/282/timeseries/9931/chart/?start_date=2020-10-29T09:13&end_date=2020-10-29T09:23

File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  54.         return view_func(*args, **kwargs)

File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/rest_framework/viewsets.py" in view
  114.             return self.dispatch(request, *args, **kwargs)

File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/rest_framework/views.py" in dispatch
  505.             response = self.handle_exception(exc)

File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/rest_framework/views.py" in handle_exception
  465.             self.raise_uncaught_exception(exc)

File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/rest_framework/views.py" in raise_uncaught_exception
  476.         raise exc

File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/rest_framework/views.py" in dispatch
  502.             response = handler(request, *args, **kwargs)

File "/opt/enhydris-openhi/enhydris/api/views.py" in chart
  226.             self._get_chart_data(request, timeseries), many=True

File "/opt/enhydris-openhi/enhydris/api/views.py" in _get_chart_data
  236.         return self._get_sampled_data_to_plot(data_frame)

File "/opt/enhydris-openhi/enhydris/api/views.py" in _get_sampled_data_to_plot
  251.         interval = (max_time - min_time) / (number_of_samples - 1)

File "pandas/_libs/tslibs/timedeltas.pyx" in pandas._libs.tslibs.timedeltas.Timedelta.__truediv__
  1374. <source code not available>

Exception Type: ZeroDivisionError at /api/stations/2195/timeseriesgroups/282/timeseries/9931/chart/
Exception Value: division by zero