FA-70126 / Map projection transforms / Open access
Spherical Albers equal-area conic forward: cone constant averaging · case 01
Area totals drift and meridians converge twice as fast as intended.
ROOT CAUSE
The cone constant sums the sines of the standard parallels without halving.
VERIFIED REPAIR
At the cone constant averaging step restore `n = (math.sin(p1) + math.sin(p2)) / 2`, leaving the rest of the model unchanged.
Unsuccessful approach: Taking the sine of the mean parallel matches only tangent cones.
Case contract
Input [lon, lat, lon0, lat0, lat1, lat2] degrees, sphere R = 6371000, lat1 != -lat2. n = (sin p1 + sin p2)/2; C = cos(p1)**2 + 2*n*sin(p1); rho = R*sqrt(C - 2*n*sin(phi))/n; rho0 likewise at lat0; theta = n*dlon with dlon wrapped to [-180, 180). x = rho*sin(theta), y = rho0 - rho*cos(theta), rounded to 2 decimals.
Why this case matters
Continental statistics maps use Albers because it preserves area; a wrong constant silently biases area totals.
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, lon0, lat0, lat1, lat2 = x
R = 6371000.0
p0, p1, p2, phi = [math.radians(v) for v in (lat0, lat1, lat2, lat)]
n = math.sin(p1) + math.sin(p2)
C = math.cos(p1) ** 2 + 2 * n * math.sin(p1)
rho = R * math.sqrt(C - 2 * n * math.sin(phi)) / n
rho0 = R * math.sqrt(C - 2 * n * math.sin(p0)) / n
dl = math.radians(((lon - lon0 + 180.0) % 360.0) - 180.0)
theta = n * dl
return [round(rho * math.sin(theta), 2), round(rho0 - rho * math.cos(theta), 2)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [-74.411, 16.812, -96.0, 23.0, 33.0, 45.0], [2405679.11, -375515.8]), ('control #1', [-7.054, -2.555, 10.0, 52.0, 35.0, 65.0], [-2368752.85, -5460256.95]), ('control #2', [163.654, -41.81, 132.0, 0.0, -18.0, -36.0], [2661851.12, -4920407.16]), ('control #3', [-52.492, -45.412, -60.0, -32.0, -5.0, -42.0], [601606.86, -1530950.07]), ('control #4', [-26.25, -1.472, 0.0, 40.0, 40.0, 40.0], [-3459655.33, -3813601.11]), ('control #5', [24.242, -15.571, 20.0, -45.0, -45.0, -45.0], [499045.1, 3152788.69]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #1', [-7.054, -2.555, 10.0, 52.0, 35.0, 65.0], [-2368752.85, -5460256.95]), ('control #2', [163.654, -41.81, 132.0, 0.0, -18.0, -36.0], [2661851.12, -4920407.16]), ('control #5', [24.242, -15.571, 20.0, -45.0, -45.0, -45.0], [499045.1, 3152788.69]), ('control #7', [-119.961, 31.565, -96.0, 23.0, 33.0, 45.0], [-2250314.51, 1235327.67]), ('control #8', [-25.931, 8.989, 10.0, 52.0, 35.0, 65.0], [-4374379.83, -3619965.56]), ('control #10', [-40.992, -24.699, -60.0, -32.0, -5.0, -42.0], [1816236.48, 739740.04]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #2', [163.654, -41.81, 132.0, 0.0, -18.0, -36.0], [2661851.12, -4920407.16]), ('control #3', [-52.492, -45.412, -60.0, -32.0, -5.0, -42.0], [601606.86, -1530950.07]), ('control #10', [-40.992, -24.699, -60.0, -32.0, -5.0, -42.0], [1816236.48, 739740.04]), ('control #11', [25.244, 44.637, 0.0, 40.0, 40.0, 40.0], [1977746.83, 796959.72]), ('control #12', [-19.298, -12.334, 20.0, -45.0, -45.0, -45.0], [-4597338.48, 2353100.16]), ('control #14', [-128.991, 27.029, -96.0, 23.0, 33.0, 45.0], [-3243071.92, 1029568.66]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #3', [-52.492, -45.412, -60.0, -32.0, -5.0, -42.0], [601606.86, -1530950.07]), ('control #7', [-119.961, 31.565, -96.0, 23.0, 33.0, 45.0], [-2250314.51, 1235327.67]), ('control #14', [-128.991, 27.029, -96.0, 23.0, 33.0, 45.0], [-3243071.92, 1029568.66]), ('control #15', [-24.721, 3.031, 10.0, 52.0, 35.0, 65.0], [-4481724.64, -4195384.79]), ('control #17', [-37.667, -43.269, -60.0, -32.0, -5.0, -42.0], [1818158.31, -1416145.5]), ('control #19', [-7.283, -57.541, 20.0, -45.0, -45.0, -45.0], [-1648585.12, -1661270.39]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #4', [-26.25, -1.472, 0.0, 40.0, 40.0, 40.0], [-3459655.33, -3813601.11]), ('control #7', [-119.961, 31.565, -96.0, 23.0, 33.0, 45.0], [-2250314.51, 1235327.67]), ('control #19', [-7.283, -57.541, 20.0, -45.0, -45.0, -45.0], [-1648585.12, -1661270.39]), ('control #21', [-59.567, 18.585, -96.0, 23.0, 33.0, 45.0], [3917697.15, 316916.45]), ('control #22', [40.214, 4.407, 10.0, 52.0, 35.0, 65.0], [3883538.77, -4321985.71]), ('control #24', [-22.139, -46.424, -60.0, -32.0, -5.0, -42.0], [2976538.67, -1998953.15]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control #0 | [2679761.39, 56664.72] | [2405679.11, -375515.8] | Failed |
| control #1 | [-2902670.03, -5337287.77] | [-2368752.85, -5460256.95] | Failed |
| control #2 | [1732222.4, -5374949.58] | [2661851.12, -4920407.16] | Failed |
| control #3 | [180733.24, -2967656.07] | [601606.86, -1530950.07] | Failed |
| control #4 | [-4180203.63, -2460648.73] | [-3459655.33, -3813601.11] | Failed |
| control #5 | [621199.55, 2725718.09] | [499045.1, 3152788.69] | Failed |
| boundary #28 | [0.0, 0.0] | [0.0, 0.0] | Passed |
| boundary #29 | [0.0, 0.0] | [0.0, 0.0] | Passed |
SHA-256 / 217c4e0133c776225bb64b5b34d0e6dbfc3b7d55e7c1e7535f97d8d0ed42d972
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, lon0, lat0, lat1, lat2 = x
R = 6371000.0
p0, p1, p2, phi = [math.radians(v) for v in (lat0, lat1, lat2, lat)]
n = math.sin((p1 + p2) / 2)
C = math.cos(p1) ** 2 + 2 * n * math.sin(p1)
rho = R * math.sqrt(C - 2 * n * math.sin(phi)) / n
rho0 = R * math.sqrt(C - 2 * n * math.sin(p0)) / n
dl = math.radians(((lon - lon0 + 180.0) % 360.0) - 180.0)
theta = n * dl
return [round(rho * math.sin(theta), 2), round(rho0 - rho * math.cos(theta), 2)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [-74.411, 16.812, -96.0, 23.0, 33.0, 45.0], [2405679.11, -375515.8]), ('control #1', [-7.054, -2.555, 10.0, 52.0, 35.0, 65.0], [-2368752.85, -5460256.95]), ('control #2', [163.654, -41.81, 132.0, 0.0, -18.0, -36.0], [2661851.12, -4920407.16]), ('control #3', [-52.492, -45.412, -60.0, -32.0, -5.0, -42.0], [601606.86, -1530950.07]), ('control #4', [-26.25, -1.472, 0.0, 40.0, 40.0, 40.0], [-3459655.33, -3813601.11]), ('control #5', [24.242, -15.571, 20.0, -45.0, -45.0, -45.0], [499045.1, 3152788.69]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #1', [-7.054, -2.555, 10.0, 52.0, 35.0, 65.0], [-2368752.85, -5460256.95]), ('control #2', [163.654, -41.81, 132.0, 0.0, -18.0, -36.0], [2661851.12, -4920407.16]), ('control #5', [24.242, -15.571, 20.0, -45.0, -45.0, -45.0], [499045.1, 3152788.69]), ('control #7', [-119.961, 31.565, -96.0, 23.0, 33.0, 45.0], [-2250314.51, 1235327.67]), ('control #8', [-25.931, 8.989, 10.0, 52.0, 35.0, 65.0], [-4374379.83, -3619965.56]), ('control #10', [-40.992, -24.699, -60.0, -32.0, -5.0, -42.0], [1816236.48, 739740.04]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #2', [163.654, -41.81, 132.0, 0.0, -18.0, -36.0], [2661851.12, -4920407.16]), ('control #3', [-52.492, -45.412, -60.0, -32.0, -5.0, -42.0], [601606.86, -1530950.07]), ('control #10', [-40.992, -24.699, -60.0, -32.0, -5.0, -42.0], [1816236.48, 739740.04]), ('control #11', [25.244, 44.637, 0.0, 40.0, 40.0, 40.0], [1977746.83, 796959.72]), ('control #12', [-19.298, -12.334, 20.0, -45.0, -45.0, -45.0], [-4597338.48, 2353100.16]), ('control #14', [-128.991, 27.029, -96.0, 23.0, 33.0, 45.0], [-3243071.92, 1029568.66]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #3', [-52.492, -45.412, -60.0, -32.0, -5.0, -42.0], [601606.86, -1530950.07]), ('control #7', [-119.961, 31.565, -96.0, 23.0, 33.0, 45.0], [-2250314.51, 1235327.67]), ('control #14', [-128.991, 27.029, -96.0, 23.0, 33.0, 45.0], [-3243071.92, 1029568.66]), ('control #15', [-24.721, 3.031, 10.0, 52.0, 35.0, 65.0], [-4481724.64, -4195384.79]), ('control #17', [-37.667, -43.269, -60.0, -32.0, -5.0, -42.0], [1818158.31, -1416145.5]), ('control #19', [-7.283, -57.541, 20.0, -45.0, -45.0, -45.0], [-1648585.12, -1661270.39]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #4', [-26.25, -1.472, 0.0, 40.0, 40.0, 40.0], [-3459655.33, -3813601.11]), ('control #7', [-119.961, 31.565, -96.0, 23.0, 33.0, 45.0], [-2250314.51, 1235327.67]), ('control #19', [-7.283, -57.541, 20.0, -45.0, -45.0, -45.0], [-1648585.12, -1661270.39]), ('control #21', [-59.567, 18.585, -96.0, 23.0, 33.0, 45.0], [3917697.15, 316916.45]), ('control #22', [40.214, 4.407, 10.0, 52.0, 35.0, 65.0], [3883538.77, -4321985.71]), ('control #24', [-22.139, -46.424, -60.0, -32.0, -5.0, -42.0], [2976538.67, -1998953.15]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control #0 | [2407501.22, -373232.0] | [2405679.11, -375515.8] | Failed |
| control #1 | [-2391339.96, -5438305.25] | [-2368752.85, -5460256.95] | Failed |
| control #2 | [2652037.07, -4925906.76] | [2661851.12, -4920407.16] | Failed |
| control #3 | [586482.05, -1561057.47] | [601606.86, -1530950.07] | Failed |
| control #4 | [-3459655.33, -3813601.11] | [-3459655.33, -3813601.11] | Passed |
| control #5 | [499045.1, 3152788.69] | [499045.1, 3152788.69] | Passed |
| boundary #28 | [0.0, 0.0] | [0.0, 0.0] | Passed |
| boundary #29 | [0.0, 0.0] | [0.0, 0.0] | Passed |
SHA-256 / 7df7004f8bbaa8f6991a2faa62f36651a97db40e7b35c6cf3b264ae60c58cfee
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, lon0, lat0, lat1, lat2 = x
R = 6371000.0
p0, p1, p2, phi = [math.radians(v) for v in (lat0, lat1, lat2, lat)]
n = (math.sin(p1) + math.sin(p2)) / 2
C = math.cos(p1) ** 2 + 2 * n * math.sin(p1)
rho = R * math.sqrt(C - 2 * n * math.sin(phi)) / n
rho0 = R * math.sqrt(C - 2 * n * math.sin(p0)) / n
dl = math.radians(((lon - lon0 + 180.0) % 360.0) - 180.0)
theta = n * dl
return [round(rho * math.sin(theta), 2), round(rho0 - rho * math.cos(theta), 2)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [-74.411, 16.812, -96.0, 23.0, 33.0, 45.0], [2405679.11, -375515.8]), ('control #1', [-7.054, -2.555, 10.0, 52.0, 35.0, 65.0], [-2368752.85, -5460256.95]), ('control #2', [163.654, -41.81, 132.0, 0.0, -18.0, -36.0], [2661851.12, -4920407.16]), ('control #3', [-52.492, -45.412, -60.0, -32.0, -5.0, -42.0], [601606.86, -1530950.07]), ('control #4', [-26.25, -1.472, 0.0, 40.0, 40.0, 40.0], [-3459655.33, -3813601.11]), ('control #5', [24.242, -15.571, 20.0, -45.0, -45.0, -45.0], [499045.1, 3152788.69]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #1', [-7.054, -2.555, 10.0, 52.0, 35.0, 65.0], [-2368752.85, -5460256.95]), ('control #2', [163.654, -41.81, 132.0, 0.0, -18.0, -36.0], [2661851.12, -4920407.16]), ('control #5', [24.242, -15.571, 20.0, -45.0, -45.0, -45.0], [499045.1, 3152788.69]), ('control #7', [-119.961, 31.565, -96.0, 23.0, 33.0, 45.0], [-2250314.51, 1235327.67]), ('control #8', [-25.931, 8.989, 10.0, 52.0, 35.0, 65.0], [-4374379.83, -3619965.56]), ('control #10', [-40.992, -24.699, -60.0, -32.0, -5.0, -42.0], [1816236.48, 739740.04]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #2', [163.654, -41.81, 132.0, 0.0, -18.0, -36.0], [2661851.12, -4920407.16]), ('control #3', [-52.492, -45.412, -60.0, -32.0, -5.0, -42.0], [601606.86, -1530950.07]), ('control #10', [-40.992, -24.699, -60.0, -32.0, -5.0, -42.0], [1816236.48, 739740.04]), ('control #11', [25.244, 44.637, 0.0, 40.0, 40.0, 40.0], [1977746.83, 796959.72]), ('control #12', [-19.298, -12.334, 20.0, -45.0, -45.0, -45.0], [-4597338.48, 2353100.16]), ('control #14', [-128.991, 27.029, -96.0, 23.0, 33.0, 45.0], [-3243071.92, 1029568.66]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #3', [-52.492, -45.412, -60.0, -32.0, -5.0, -42.0], [601606.86, -1530950.07]), ('control #7', [-119.961, 31.565, -96.0, 23.0, 33.0, 45.0], [-2250314.51, 1235327.67]), ('control #14', [-128.991, 27.029, -96.0, 23.0, 33.0, 45.0], [-3243071.92, 1029568.66]), ('control #15', [-24.721, 3.031, 10.0, 52.0, 35.0, 65.0], [-4481724.64, -4195384.79]), ('control #17', [-37.667, -43.269, -60.0, -32.0, -5.0, -42.0], [1818158.31, -1416145.5]), ('control #19', [-7.283, -57.541, 20.0, -45.0, -45.0, -45.0], [-1648585.12, -1661270.39]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])], [('control #4', [-26.25, -1.472, 0.0, 40.0, 40.0, 40.0], [-3459655.33, -3813601.11]), ('control #7', [-119.961, 31.565, -96.0, 23.0, 33.0, 45.0], [-2250314.51, 1235327.67]), ('control #19', [-7.283, -57.541, 20.0, -45.0, -45.0, -45.0], [-1648585.12, -1661270.39]), ('control #21', [-59.567, 18.585, -96.0, 23.0, 33.0, 45.0], [3917697.15, 316916.45]), ('control #22', [40.214, 4.407, 10.0, 52.0, 35.0, 65.0], [3883538.77, -4321985.71]), ('control #24', [-22.139, -46.424, -60.0, -32.0, -5.0, -42.0], [2976538.67, -1998953.15]), ('boundary #28', [-96.0, 23.0, -96.0, 23.0, 33.0, 45.0], [0.0, 0.0]), ('boundary #29', [5.0, 40.0, 5.0, 40.0, 40.0, 40.0], [0.0, 0.0])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control #0 | [2405679.11, -375515.8] | [2405679.11, -375515.8] | Passed |
| control #1 | [-2368752.85, -5460256.95] | [-2368752.85, -5460256.95] | Passed |
| control #2 | [2661851.12, -4920407.16] | [2661851.12, -4920407.16] | Passed |
| control #3 | [601606.86, -1530950.07] | [601606.86, -1530950.07] | Passed |
| control #4 | [-3459655.33, -3813601.11] | [-3459655.33, -3813601.11] | Passed |
| control #5 | [499045.1, 3152788.69] | [499045.1, 3152788.69] | Passed |
| boundary #28 | [0.0, 0.0] | [0.0, 0.0] | Passed |
| boundary #29 | [0.0, 0.0] | [0.0, 0.0] | Passed |
SHA-256 / 360044e7193b0b17a63f8ee68218a668c32b674d83643cd619063ec7bf79b9de
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:17.712753+00:00.
Case digest / fd80fe2bfb1ae76b32faa6bce0b5b0ae9977bfaace2dbbd5f0b9a1c845f59b2f