FAILURE MAP
← Case archive

FA-70011 / Map projection transforms / Open access

UTM zone and latitude band lookup: band domain limits · case 01

Points on the southern and northern band limits lose their band letter.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The band domain is treated as open, so the -80 and 84 limits report None.

VERIFIED REPAIR

At the band domain limits step restore `if lat < -80.0 or lat > 84.0:`, leaving the rest of the model unchanged.

Unsuccessful approach: The southern edge is fixed but lat=84 still returns None although band X includes 84.

Case contract

Input [lon, lat]. zone = floor((lon+180)/6)+1, with lon=180 mapped to zone 60. Exceptions: lat in [56, 64) and lon in [3, 12) is zone 32; lat in [72, 84] uses zone 31 for lon in [0, 9), 33 for [9, 21), 35 for [21, 33) and 37 for [33, 42). Band letters "CDEFGHJKLMNPQRSTUVWX" (no I or O) cover 8 degrees each from -80; band X also covers up to 84 inclusive. Outside [-80, 84] the band is None. Return [zone, band].

Why this case matters

Grid references, MGRS labels and CRS selection rely on the zone and band, including the Norway and Svalbard exceptions.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    lon, lat = x
    zone = int(math.floor((lon + 180.0) / 6.0)) + 1
    if zone > 60:
        zone = 60
    if 56.0 <= lat < 64.0 and 3.0 <= lon < 12.0:
        zone = 32
    if 72.0 <= lat <= 84.0 and 0.0 <= lon < 42.0:
        if lon < 9.0:
            zone = 31
        elif lon < 21.0:
            zone = 33
        elif lon < 33.0:
            zone = 35
        else:
            zone = 37
    letters = 'CDEFGHJKLMNPQRSTUVWX'
    if lat <= -80.0 or lat >= 84.0:
        band = None
    else:
        band = letters[min(int((lat + 80.0) // 8), 19)]
    return [zone, band]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [-63.1, 21.44], [20, 'Q']), ('control #1', [-175.96, 80.22], [1, 'X']), ('control #2', [115.33, 82.84], [50, 'X']), ('control #3', [-84.72, -46.68], [16, 'G']), ('control #4', [-159.4, -47.6], [4, 'G']), ('control #5', [-170.34, 33.06], [2, 'S']), ('boundary #24', [10.0, 84.0], [33, 'X']), ('boundary #40', [-100.0, 84.0], [14, 'X'])], [('control #3', [-84.72, -46.68], [16, 'G']), ('control #4', [-159.4, -47.6], [4, 'G']), ('control #5', [-170.34, 33.06], [2, 'S']), ('control #6', [-48.09, 53.12], [22, 'U']), ('control #7', [93.32, -22.41], [46, 'K']), ('control #8', [-119.29, -22.68], [11, 'K']), ('boundary #26', [10.0, -80.0], [32, 'C']), ('boundary #40', [-100.0, 84.0], [14, 'X'])], [('control #6', [-48.09, 53.12], [22, 'U']), ('control #7', [93.32, -22.41], [46, 'K']), ('control #8', [-119.29, -22.68], [11, 'K']), ('control #9', [-168.15, 26.03], [2, 'R']), ('control #10', [-111.05, -54.91], [12, 'F']), ('control #11', [139.05, -8.2], [54, 'L']), ('boundary #24', [10.0, 84.0], [33, 'X']), ('boundary #40', [-100.0, 84.0], [14, 'X'])], [('control #9', [-168.15, 26.03], [2, 'R']), ('control #10', [-111.05, -54.91], [12, 'F']), ('control #11', [139.05, -8.2], [54, 'L']), ('boundary #12', [180.0, 10.0], [60, 'P']), ('boundary #13', [-180.0, -10.0], [1, 'L']), ('regression #14', [5.0, 60.0], [32, 'V']), ('boundary #40', [-100.0, 84.0], [14, 'X']), ('boundary #41', [60.0, -80.0], [41, 'C'])], [('boundary #12', [180.0, 10.0], [60, 'P']), ('boundary #13', [-180.0, -10.0], [1, 'L']), ('regression #14', [5.0, 60.0], [32, 'V']), ('boundary #15', [3.0, 56.0], [32, 'V']), ('boundary #16', [2.99, 60.0], [31, 'V']), ('boundary #17', [11.99, 63.99], [32, 'V']), ('boundary #24', [10.0, 84.0], [33, 'X']), ('boundary #40', [-100.0, 84.0], [14, 'X'])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control #0[20, 'Q'][20, 'Q']Passed
control #1[1, 'X'][1, 'X']Passed
control #2[50, 'X'][50, 'X']Passed
control #3[16, 'G'][16, 'G']Passed
control #4[4, 'G'][4, 'G']Passed
control #5[2, 'S'][2, 'S']Passed
boundary #24[33, None][33, 'X']Failed
boundary #40[14, None][14, 'X']Failed

SHA-256 / 2dca0759d45a4f954703aaccaab1d3c7716f8b0923fb4d60bc8c7c867532b9b9

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    lon, lat = x
    zone = int(math.floor((lon + 180.0) / 6.0)) + 1
    if zone > 60:
        zone = 60
    if 56.0 <= lat < 64.0 and 3.0 <= lon < 12.0:
        zone = 32
    if 72.0 <= lat <= 84.0 and 0.0 <= lon < 42.0:
        if lon < 9.0:
            zone = 31
        elif lon < 21.0:
            zone = 33
        elif lon < 33.0:
            zone = 35
        else:
            zone = 37
    letters = 'CDEFGHJKLMNPQRSTUVWX'
    if lat < -80.0 or lat >= 84.0:
        band = None
    else:
        band = letters[min(int((lat + 80.0) // 8), 19)]
    return [zone, band]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [-63.1, 21.44], [20, 'Q']), ('control #1', [-175.96, 80.22], [1, 'X']), ('control #2', [115.33, 82.84], [50, 'X']), ('control #3', [-84.72, -46.68], [16, 'G']), ('control #4', [-159.4, -47.6], [4, 'G']), ('control #5', [-170.34, 33.06], [2, 'S']), ('boundary #24', [10.0, 84.0], [33, 'X']), ('boundary #40', [-100.0, 84.0], [14, 'X'])], [('control #3', [-84.72, -46.68], [16, 'G']), ('control #4', [-159.4, -47.6], [4, 'G']), ('control #5', [-170.34, 33.06], [2, 'S']), ('control #6', [-48.09, 53.12], [22, 'U']), ('control #7', [93.32, -22.41], [46, 'K']), ('control #8', [-119.29, -22.68], [11, 'K']), ('boundary #26', [10.0, -80.0], [32, 'C']), ('boundary #40', [-100.0, 84.0], [14, 'X'])], [('control #6', [-48.09, 53.12], [22, 'U']), ('control #7', [93.32, -22.41], [46, 'K']), ('control #8', [-119.29, -22.68], [11, 'K']), ('control #9', [-168.15, 26.03], [2, 'R']), ('control #10', [-111.05, -54.91], [12, 'F']), ('control #11', [139.05, -8.2], [54, 'L']), ('boundary #24', [10.0, 84.0], [33, 'X']), ('boundary #40', [-100.0, 84.0], [14, 'X'])], [('control #9', [-168.15, 26.03], [2, 'R']), ('control #10', [-111.05, -54.91], [12, 'F']), ('control #11', [139.05, -8.2], [54, 'L']), ('boundary #12', [180.0, 10.0], [60, 'P']), ('boundary #13', [-180.0, -10.0], [1, 'L']), ('regression #14', [5.0, 60.0], [32, 'V']), ('boundary #40', [-100.0, 84.0], [14, 'X']), ('boundary #41', [60.0, -80.0], [41, 'C'])], [('boundary #12', [180.0, 10.0], [60, 'P']), ('boundary #13', [-180.0, -10.0], [1, 'L']), ('regression #14', [5.0, 60.0], [32, 'V']), ('boundary #15', [3.0, 56.0], [32, 'V']), ('boundary #16', [2.99, 60.0], [31, 'V']), ('boundary #17', [11.99, 63.99], [32, 'V']), ('boundary #24', [10.0, 84.0], [33, 'X']), ('boundary #40', [-100.0, 84.0], [14, 'X'])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control #0[20, 'Q'][20, 'Q']Passed
control #1[1, 'X'][1, 'X']Passed
control #2[50, 'X'][50, 'X']Passed
control #3[16, 'G'][16, 'G']Passed
control #4[4, 'G'][4, 'G']Passed
control #5[2, 'S'][2, 'S']Passed
boundary #24[33, None][33, 'X']Failed
boundary #40[14, None][14, 'X']Failed

SHA-256 / 5e1fc17be22ae4f71a83dc878be54ffe034d92c8b2a599f61617b0d7bb22319c

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    lon, lat = x
    zone = int(math.floor((lon + 180.0) / 6.0)) + 1
    if zone > 60:
        zone = 60
    if 56.0 <= lat < 64.0 and 3.0 <= lon < 12.0:
        zone = 32
    if 72.0 <= lat <= 84.0 and 0.0 <= lon < 42.0:
        if lon < 9.0:
            zone = 31
        elif lon < 21.0:
            zone = 33
        elif lon < 33.0:
            zone = 35
        else:
            zone = 37
    letters = 'CDEFGHJKLMNPQRSTUVWX'
    if lat < -80.0 or lat > 84.0:
        band = None
    else:
        band = letters[min(int((lat + 80.0) // 8), 19)]
    return [zone, band]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [-63.1, 21.44], [20, 'Q']), ('control #1', [-175.96, 80.22], [1, 'X']), ('control #2', [115.33, 82.84], [50, 'X']), ('control #3', [-84.72, -46.68], [16, 'G']), ('control #4', [-159.4, -47.6], [4, 'G']), ('control #5', [-170.34, 33.06], [2, 'S']), ('boundary #24', [10.0, 84.0], [33, 'X']), ('boundary #40', [-100.0, 84.0], [14, 'X'])], [('control #3', [-84.72, -46.68], [16, 'G']), ('control #4', [-159.4, -47.6], [4, 'G']), ('control #5', [-170.34, 33.06], [2, 'S']), ('control #6', [-48.09, 53.12], [22, 'U']), ('control #7', [93.32, -22.41], [46, 'K']), ('control #8', [-119.29, -22.68], [11, 'K']), ('boundary #26', [10.0, -80.0], [32, 'C']), ('boundary #40', [-100.0, 84.0], [14, 'X'])], [('control #6', [-48.09, 53.12], [22, 'U']), ('control #7', [93.32, -22.41], [46, 'K']), ('control #8', [-119.29, -22.68], [11, 'K']), ('control #9', [-168.15, 26.03], [2, 'R']), ('control #10', [-111.05, -54.91], [12, 'F']), ('control #11', [139.05, -8.2], [54, 'L']), ('boundary #24', [10.0, 84.0], [33, 'X']), ('boundary #40', [-100.0, 84.0], [14, 'X'])], [('control #9', [-168.15, 26.03], [2, 'R']), ('control #10', [-111.05, -54.91], [12, 'F']), ('control #11', [139.05, -8.2], [54, 'L']), ('boundary #12', [180.0, 10.0], [60, 'P']), ('boundary #13', [-180.0, -10.0], [1, 'L']), ('regression #14', [5.0, 60.0], [32, 'V']), ('boundary #40', [-100.0, 84.0], [14, 'X']), ('boundary #41', [60.0, -80.0], [41, 'C'])], [('boundary #12', [180.0, 10.0], [60, 'P']), ('boundary #13', [-180.0, -10.0], [1, 'L']), ('regression #14', [5.0, 60.0], [32, 'V']), ('boundary #15', [3.0, 56.0], [32, 'V']), ('boundary #16', [2.99, 60.0], [31, 'V']), ('boundary #17', [11.99, 63.99], [32, 'V']), ('boundary #24', [10.0, 84.0], [33, 'X']), ('boundary #40', [-100.0, 84.0], [14, 'X'])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control #0[20, 'Q'][20, 'Q']Passed
control #1[1, 'X'][1, 'X']Passed
control #2[50, 'X'][50, 'X']Passed
control #3[16, 'G'][16, 'G']Passed
control #4[4, 'G'][4, 'G']Passed
control #5[2, 'S'][2, 'S']Passed
boundary #24[33, 'X'][33, 'X']Passed
boundary #40[14, 'X'][14, 'X']Passed

SHA-256 / e7e70dea6904e955285ec62fae7ec0be0aaab2205bfb61d44628e6d546f19a14

Verification & scope

Stipulated deterministic toy contract on a bounded input domain; results are rounded as stated and no conformance with any published standard or library is claimed. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:48:16.662595+00:00.

Case digest / 2886116e814376b757db070b7d108e1a889fd9029ed3388e43e374ab02a07786