openmeteo / enhydris-autoprocess

Automatic processing of time series triggered by their uploading
1 stars 2 forks source link

enhydris_autoprocess.tasks.execute_auto_process: RegularizeError #48

Closed aptiko closed 3 years ago

aptiko commented 3 years ago
Task id: a870d243-fda9-414a-8aa5-64adad4f3f07

Traceback (most recent call last):
  File "haggregate/regularize.pyx", line 20, in haggregate.regularize.regularize
  File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/pandas/tseries/frequencies.py", line 180, in to_offset
    raise ValueError(libfreqs.INVALID_FREQ_ERR_MSG.format(freq))
ValueError: Invalid frequency: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/celery/app/trace.py", line 385, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/opt/enhydris-openhi/venv/lib/python3.7/site-packages/celery/app/trace.py", line 650, in __protected_call__
    return self.run(*args, **kwargs)
  File "/opt/enhydris-openhi/enhydris_autoprocess/tasks.py", line 8, in execute_auto_process
    AutoProcess.objects.get(id=auto_process_id).as_specific_instance.execute()
  File "/opt/enhydris-openhi/enhydris_autoprocess/models.py", line 27, in execute
    result = self.process_timeseries()
  File "/opt/enhydris-openhi/enhydris_autoprocess/models.py", line 431, in process_timeseries
    regularized = self._regularize_time_series(self.htimeseries)
  File "/opt/enhydris-openhi/enhydris_autoprocess/models.py", line 436, in _regularize_time_series
    return regularize(source_htimeseries, new_date_flag="DATEINSERT")
  File "haggregate/regularize.pyx", line 22, in haggregate.regularize.regularize
haggregate.regularize.RegularizeError: The time step is malformed or is specified in months. Only time steps specified in minutes, hours or days are supported.
aptiko commented 3 years ago

This problem occurs during aggregation.

Internally, the process for aggregation is this: It takes the source time series (either raw or checked), regularizes it, then aggregates it. When regularizing, the source time series' time step is being used. If the source time series does not have a time step, this exception occurs.

One solution is to require the source time series to have a time step. Maybe attempt to determine it. Or maybe, the cleanest solution, check if it has a time step; if it doesn't, email the user with instructions.