Skip to content

At-large district H5 files named XX-00 instead of XX-01 #558

@baogorek

Description

@baogorek

Description

At-large congressional district H5 files are now named with 0-based numbering (e.g., AK-00.h5) instead of the conventional 1-based numbering (AK-01.h5).

Congressional districts are conventionally 1-indexed — North Carolina's 1st district is NC-01, and Alaska's sole at-large district should be AK-01.

Root cause

Commit 5a04c9f ("Fix at-large district geoid mismatch") correctly changed the internal GEOID for at-large districts from XX01 to XX00 to match Census/FIPS conventions and fix data lookup mismatches. However, the display name logic derives the district number directly from the GEOID (cd_int % 100), so at-large districts now produce 00 in filenames.

Affected states

AK, DE, MT, ND, SD, VT, WY, DC — all at-large districts now get XX-00.h5 instead of XX-01.h5.

Proposed fix

Change district_num = cd_int % 100 to district_num = max(cd_int % 100, 1) in the friendly-name construction, at 4 locations:

  • publish_local_area.py (3 occurrences, lines ~153, ~231, ~330)
  • stacked_dataset_builder.py (1 occurrence, line ~922)

Internal GEOIDs remain unchanged (XX00). Only the display/filename convention is affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions