openclimatefix / openclimatefix/nwp-consumer
Zero division error in _fold_dataarrays_generator
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17
- Forks
- 10
- Avg merge
- 1h 46m
- Merged PRs (30d)
- 1
Description
Describe the bug
Division by zero error if no results yielded by generator (error potential on last line of snippet):
To Reproduce
Provide a generator with no results to yield.
Expected behavior
An explicit exception thrown by an extra check added, before trying to divide by the results length.
Additional context
This division by zero error occurred in Airflow when downloading Met Office data at 2026-04-24 05:12:45
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/nwp_consumer/internal/services/consumer_service.py at the linked lines 59-86 and trace how the generator results are collected and divided. Reproduce the case with a generator that yields nothing. Done means the empty-result case raises an explicit exception before division, rather than producing a zero-division error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100