Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

guess_bounds(yearly=True) fails on a single point, monthly=True works

Open Beginner friendly
#7,311 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
90/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
data

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SciTools/iris

All issues in SciTools/iris

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.