Skip to content

Weather

Read the project site's typical-year weather series. Accessed via snaptrude.analysis.weather.

Returns the hourly weather rows (temperature, humidity, wind, solar irradiance) of the EPW file the sustainability analyses compute against, resolved from the project's geo-located site. This is a synchronous, paged read of an already-resolved weather file — not a job: call getSeries for a date range, then follow nextCursor until it is null. The source.weatherFileId matches the provenance a daylight run echoes and the id program.site.getWeather / core.io.import.epw use. Dates cross as ISO 8601 date strings ("YYYY-MM-DD"); each row's timestamp is a local ISO 8601 string with its UTC offset, and utcOffsetMinutes restates the offset.

Geo-located projects only

getSeries throws a NOT_GEOLOCATED precondition error when the project has no geo-located site (there is no weather file to resolve). Geo-locate the project first with core.io.import.terrain.

At a glance

MethodWhat it doesMutates?
getSeries(args)One page of hourly weather rows + source metadata

Types

PluginWeatherGetSeriesArgs

PropertyTypeDescription
startDatestringInclusive range start, ISO "YYYY-MM-DD"
endDatestringInclusive range end, ISO "YYYY-MM-DD"
interval"hourly"?Sampling interval; "hourly" is the only v1 value
cursorstring?Paging cursor from a prior page's nextCursor

PluginWeatherSourceMeta

Provenance of the resolved weather file.

PropertyTypeDescription
weatherFileIdstringCatalog id (same key as core.io.import.epw's weatherFileId)
stationstringStation/file name
sourceIdstringWMO/station identifier from the EPW header
distanceKmnumber | nullStation → site distance, km; null for pinned override files
selectionMethod"nearest-station" | "user-upload" | "project-override"How the file was matched
checksumstringsha256 of the EPW file — the provenance key
windReferenceHeightMnumberAnemometer height the wind rows are valid at

PluginWeatherRow

One hourly reading. flags is [] for a clean value; known flags are "missing", "substituted", "interpolated".

PropertyTypeDescription
timestampstringLocal ISO 8601 with offset, e.g. "2026-06-21T14:00:00+05:30"
utcOffsetMinutesnumberUTC offset in minutes (restates the timestamp's offset)
dryBulbCnumberDry-bulb temperature, °C
relativeHumidityPercentnumberRelative humidity, %
windSpeedMpsnumberWind speed, m/s (at source.windReferenceHeightM)
ghiWm2numberGlobal horizontal irradiance, W/m²
dniWm2numberDirect normal irradiance, W/m²
dhiWm2numberDiffuse horizontal irradiance, W/m²
flagsstring[]Quality flags; [] = clean value

PluginWeatherSeriesResult

PropertyTypeDescription
sourcePluginWeatherSourceMetaThe resolved weather file's provenance
rowsPluginWeatherRow[]Weather rows for this page
nextCursorstring | nullPass back as args.cursor; null = last page
warningsstring[]?Degradation notices (e.g. "override lookup failed; served nearest-station"); omitted when the page is clean

Functions

getSeries(args)

Get the hourly weather series for a date range, paged. The page size is backend-chosen; when nextCursor is a string, pass it back as args.cursor to fetch the next page, and stop when it is null.

  • Parameters:
    • args: PluginWeatherGetSeriesArgs — the inclusive startDate/endDate, an optional interval, and an optional cursor.
  • Returns: PluginWeatherSeriesResult — the resolved source, this page of rows, and nextCursor.
  • Throws: When the project has no geo-located site (NOT_GEOLOCATED), or when the weather service cannot resolve/serve the range.
ts
let cursor: string | undefined = undefined;
const rows = [];
do {
  const page = await snaptrude.analysis.weather.getSeries({
    startDate: "2026-06-01",
    endDate: "2026-06-30",
    cursor
  });
  rows.push(...page.rows);
  cursor = page.nextCursor ?? undefined;
} while (cursor);