Skip to content

Out-of-state row files: blank state silently becomes CA #2

Description

@mighkel

Out-of-state rows: state silently defaults to CA, and name-based placement is California-only

Working up an Idaho row file and hit a few things that are fine for CA data but get
in the way of the "any state, any public safety agency" case. All small, all in
tools/build_comms_catalog.py. Nothing here blocks me — I have coordinates for
every row, which sidesteps all of it — but the next person who tries a state file
will hit them in this order.

Filing as one issue since they're the same theme; happy to split.

1. A blank state silently becomes California

Line 804:

r["_st"] = (r.get("state") or "CA").upper()

A row that forgets state is filed in California. No warning, no error.

It survives the correction pass too. For a blank-state, blank-county Idaho row:
county_of() resolves the county correctly (TIGER is nationwide), returns FIPS
16, and then line 1025:

if fips in STATE_FIPS and s["st"] != STATE_FIPS[fips]:

STATE_FIPS holds {"06": "CA", "32": "NV", "41": "OR", "04": "AZ"}, so 16 is not
in it and st stays "CA". Net result is a site labelled Boise County, CA
wrong, and plausible enough to survive review.

Two directions, either works:

  • Make state required for row files and fail the row without it, rather than
    defaulting.
  • Trust the FIPS lookup over the row: it already has the authoritative answer, so
    set st from it whenever they disagree. Needs the full 50-state table instead
    of the four.

The silent part is the real problem — a hard error on a missing state would have
been fine.

2. The USFS site layer is fetched CA-only

Line 766:

usfs = arcgis_all(USFS_SITES, where="state='CA'", ...)

EDW_SpecialUsesCommunicationsSites_01 is a national layer, so this is the one
place where a small change buys the most: without it, a row naming a real USFS
communications site in Idaho, Montana or Colorado can't be placed by name even
though the authoritative record exists.

Guessing the filter is there for fetch size. If so, taking the states actually
present in the row files would keep that benefit:

where="state IN ('CA','ID',...)"   # states seen across row_files

3. area=CO:<county> hardcodes California's FIPS

Line 511:

where="NAME='%s County' AND STATE='06'" % name.replace("'", "''")

06 is California. So area=CO:Boise looks for Boise County, CA, finds nothing,
and the row falls through to "no boundary" handling.

The row already carries state, so the FIPS could come from there. Worth noting
that the comments around the GNIS passes make a strong case that a county is the
single most valuable constraint for placing a named site — this is the column that
delivers it, and outside CA it's inert.

USFS: and NPS: are fine; both hit national services.

4. Four columns the parser reads aren't in the sites.csv header

area, net_name, net_rx_tone, net_tx_tone are all read from row files but
absent from the template header and its comment block. net_name in particular
matters outside California: with no MACS 441-1 designator to use as an id, net
ends up carrying a local string and net_name is what makes it readable.

The net_rx_tone / net_tx_tone versus rx_tone / tx_tone distinction is
genuinely easy to get wrong from the header alone — the code comment explaining it
("a repeater net has one pair and a different tone at every site") is the thing a
contributor needs and it's only visible in the source.

Not a request, just a note

Elevation and county filling are already nationwide (EPQS, TIGER) and worked
without any changes. That is most of what I expected to have to supply by hand, so
the CA-specific parts are a narrower set than they first looked.


Drafted with AI assistance against a read of build_comms_catalog.py at
05b5dd0; line numbers are from that commit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions