@idfkit/weather¶
Browser-side EPW weather-file retrieval. Search the climate.onebuilding.org TMYx
station index, then download and unpack weather files — with no filesystem and
no dependencies, so the same code runs in Node, a browser, a worker, or an edge
runtime. Reaching the network goes through the global fetch, overridable per
call for a CORS proxy. Node-only conveniences live in
@idfkit/weather/node.
For a task-shaped walkthrough, see How to fetch a weather file.
GeocodingError
¶
RateLimiter
¶
Serializes calls so that consecutive requests are at least minIntervalMs
apart. JavaScript is single-threaded, so a chained promise is all it takes —
no locks, unlike the Python version.
StationIndex
¶
countries
¶
lastModified
¶
size
¶
stations
¶
filter
¶
getByFilename
¶
getByWmo
¶
nearest
¶
search
¶
Fuzzy-search by name, city, state, WMO number, or EPW filename.
Matching is case-insensitive and substring/token-prefix based — no NLP dependency. A canonical EPW filename is detected and resolved through getByFilename on the fast path.
fromStations
¶
WeatherStation
¶
Metadata for a single weather-file entry from climate.onebuilding.org.
Instances are immutable: every field is read-only, and the computed properties are derived from the download URL. Construct one directly for a test, or let StationIndex hand them to you from the bundled index.
ashraeClimateZone
¶
ASHRAE HOF climate-zone label, e.g. "5A - Cool - Humid".
cdd10
¶
Cooling degree-days, base 10 °C.
city
¶
City or station name as indexed, e.g. "Chicago.OHare.Intl.AP".
coolingDesignDbC
¶
1% cooling design dry-bulb temperature, °C.
country
¶
ISO 3166 country code, e.g. "USA".
designConditionsSourceWmo
¶
When a station borrows design conditions from a neighbour, that
neighbour's WMO number; otherwise null.
elevation
¶
Metres above sea level.
hdd18
¶
Heating degree-days, base 18 °C.
heatingDesignDbC
¶
99% heating design dry-bulb temperature, °C.
latitude
¶
Decimal degrees, north positive.
longitude
¶
Decimal degrees, east positive.
source
¶
Dataset source identifier, e.g. "TMYx.2009-2023" or "Custom-725300".
state
¶
State or province abbreviation, e.g. "IL". Empty when the index has none.
timezone
¶
Hours offset from GMT, e.g. -6.
url
¶
Full download URL for the ZIP archive.
wmo
¶
WMO station number, kept as a string so leading zeros survive.
coolingDesignDbF
¶
datasetVariant
¶
displayName
¶
filenameStem
¶
heatingDesignDbF
¶
toJSON
¶
Serialize to the snake-case StationRecord wire form.
fromJSON
¶
DetectLocationOptions
¶
Options for detectLocation.
FetchWeatherOptions
¶
Options common to the retrieval functions.
FilterOptions
¶
Options for StationIndex.filter.
GeocodeOptions
¶
Options accepted by geocode and detectLocation.
IndexData
¶
LoadIndexOptions
¶
Options for loadStationIndex.
NearestOptions
¶
Options for StationIndex.nearest.
RefreshIndexOptions
¶
Options for refreshStationIndex.
SearchOptions
¶
Options for StationIndex.search.
SearchResult
¶
SpatialResult
¶
StationRecord
¶
The wire form of a station: the exact keys stored in stations.json.gz.
Snake-case on purpose. This is the serialized shape the Python idfkit library
ships, so the two bundles are byte-for-byte interchangeable and a refresh()
on either side produces a file the other can read. The camelCase API lives on
the WeatherStation class; the conversion is confined to
WeatherStation.fromJSON and WeatherStation.toJSON.
WeatherFiles
¶
The decoded weather files for a station.
ddy
¶
The DDY (design-day) file text, or null if the archive had none.
epw
¶
The EPW file text, ready to hand to a simulation engine.
members
¶
Every archive member, by filename, as raw bytes — including the ones with
no decoded convenience field (.clm, .wea, .rain, .pvsyst).
stat
¶
The STAT (climate statistics) file text, or null if absent.
station
¶
WeatherStationFields
¶
The fields a WeatherStation is built from.
ashraeClimateZone
¶
ASHRAE HOF climate-zone label, e.g. "5A - Cool - Humid".
cdd10
¶
Cooling degree-days, base 10 °C.
city
¶
City or station name as indexed, e.g. "Chicago.OHare.Intl.AP".
coolingDesignDbC
¶
1% cooling design dry-bulb temperature, °C.
country
¶
ISO 3166 country code, e.g. "USA".
designConditionsSourceWmo
¶
When a station borrows design conditions from a neighbour, that
neighbour's WMO number; otherwise null.
elevation
¶
Metres above sea level.
hdd18
¶
Heating degree-days, base 18 °C.
heatingDesignDbC
¶
99% heating design dry-bulb temperature, °C.
latitude
¶
Decimal degrees, north positive.
longitude
¶
Decimal degrees, east positive.
source
¶
Dataset source identifier, e.g. "TMYx.2009-2023" or "Custom-725300".
state
¶
State or province abbreviation, e.g. "IL". Empty when the index has none.
timezone
¶
Hours offset from GMT, e.g. -6.
url
¶
Full download URL for the ZIP archive.
wmo
¶
WMO station number, kept as a string so leading zeros survive.
FetchLike
¶
The subset of the fetch signature this package relies on.
MatchField
¶
Which field a text search matched on.
INDEX_FILES
¶
The ten regional TMYx KML index files, together covering the globe.
SOURCES_BASE_URL
¶
The upstream directory holding the regional KML index files.