guess_bounds(yearly=True) fails on a single point, monthly=True works
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 90/100
Research direction
Start in coords.py at the length check used by guess_bounds, then compare the existing yearly and monthly handling. Use test_monthly_single_point as the model for a yearly single-point test. Done means yearly=True accepts one point with the expected bounds while existing monthly and multi-point behavior remains passing.
Written by the indexing model from the issue text.
Description
🐛 Bug Report
The guess_bounds docstring says monthly and yearly "can work for single points", but only monthly does.
How To Reproduce
import iris.coords
for kw in ("monthly", "yearly"):
c = iris.coords.DimCoord([200.0], standard_name="time", units="days since 2000-01-01")
try:
c.guess_bounds(**{kw: True})
print(kw, c.bounds.tolist())
except ValueError as e:
print(kw, e)
monthly [[182, 213]]
yearly Cannot guess bounds for a coordinate of length 1.
Expected behaviour
yearly [[0, 366]]
The length check in coords.py is if not monthly and self.shape[0] < 2:, so yearly never gets past it. I changed it to if not (monthly or yearly) ... locally and the rest of the yearly code handled it fine, giving [[0, 366]] for the single point and [[0, 366], [366, 731]] for two points. There's test_monthly_single_point in the tests but no yearly one.
Environment
- OS & Version: macOS 26.4 (arm64)
- Iris Version: 3.16.1 (pip), also on main (0edd3e0)
- Dominant language
- Python
- Stars
- 725
- Forks
- 317
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 26
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
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.
More from SciTools/iris
-
Agentic
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
kornia/kornia#5263 · 1 comment ·
Maintainers usually reply within 1 day
-
approved correction metadata
Difficulty 1/5 Under an hour Newbie friendliness 88/100
acl-org/acl-anthology#10133 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
BasedHardware/omi#20084 ·
Maintainers usually reply within 1 day
-
bug needs-acceptance wg/evaluation-quality
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
vllm-project/semantic-router#4424 ·
Maintainers usually reply within 1 day