# Station IDs

> The identifier to store for a station: the NRCS triplet such as 312:ID:SNTL, its format, why the station number alone isn't unique, and a parser.

Snotel identifies a station by its NRCS station triplet and nothing else.

## The format

A triplet is three parts joined by colons: `<station number>:<state>:<network>`.

| Part           | Example | Notes                                                     |
| -------------- | ------- | --------------------------------------------------------- |
| Station number | `312`   | Letters and digits. Not unique across states.             |
| State          | `ID`    | Two upper-case letters.                                   |
| Network        | `SNTL`  | The network code. Snotel uses `SNTL`, the SNOTEL network. |

Examples: `312:ID:SNTL` is Banner Summit in Idaho, `1305:ID:SNTL` is Fish Ck in Idaho and `302:OR:SNTL` is a station in Oregon.

## Why the triplet

The station number is only unique within a state, so `312` could name two stations. The triplet is unambiguous, is what NRCS's own service takes, and sorts and compares as a plain string. Snotel's internal numeric row ids are an implementation detail and never appear in public identifiers.

## Parsing

A triplet matches this pattern, which is the one Snotel validates against:

```ts
const triplet = /^([A-Za-z0-9]+):([A-Z]{2}):([A-Z0-9]+)$/;

const [, stationNumber, state, network] = triplet.exec("312:ID:SNTL") ?? [];
// stationNumber "312", state "ID", network "SNTL"
```

Reject anything that does not match rather than guessing, and keep the triplet whole instead of storing its parts separately.

## Public ids

Every station also has a `publicId` that works across data providers. For an NRCS station it is the triplet, so nothing you have stored changes. A station from any other provider is `<provider>:<provider station id>`, such as `cdec:KTL`: exactly two parts, with the provider's code first and its own station id second.

```ts
const publicId = /^[a-z][a-z0-9]{1,31}:[A-Za-z0-9._-]{1,64}$/;
```

A public id never has three parts, so it cannot be mistaken for a triplet, and no other provider's station is given a US state. `nrcs:<anything>` is not a valid id: an NRCS station is always its triplet. Today every station Snotel serves is an NRCS station; store `publicId` if you want your saved stations to keep working as providers are added.

## Next

- [Data model](https://opensnotel.com/docs/data-model.md): The fields every Snotel value carries and what each means: station, triplet, element, observation, interval, unit, flags, freshness, revision and provenance. Read before storing Snotel data.
- [Stations](https://opensnotel.com/docs/api/stations.md): List or search stations by name, state or network, and get one station by its triplet: location, elevation, UTC offset, period of record and the measurements it reports.

Canonical page: https://opensnotel.com/docs/reference/station-ids
