Documentation

Ensemble

@infoplaza/platform/ensemble

A portable ensemble forecast chart — Recharts plume, line, and bar graphs — without the map stack or app chrome. The models catalog loads through PlatformAuth (GET /api/platform/ensemble-models). Chart series load from GET /api/platform/ensemble-point-forecast unless the host passes charts / getCharts. See the ensemble demo. See API request counts and token credits in the charts platform example.

Packaged vs composed

Sibling product to timeseries and the map. Import only from @infoplaza/platform/ensemble.

<EnsembleForecast
  lat={52.3676}
  lon={4.9041}
  showToolbar={false}
  showFooter={false}
/>
<EnsembleModelsProvider lat={52.3676} lon={4.9041}>
  <EnsembleProvider>
    <EnsembleToolbar />
    <EnsembleBuilder>
      <EnsembleChart />
    </EnsembleBuilder>
    <EnsembleFooter />
  </EnsembleProvider>
</EnsembleModelsProvider>

Default model when omitted: ecmwfensembleglobal if it is in the catalog (DEFAULT_ENSEMBLE_MODEL), otherwise the first catalog model.

API

@infoplaza/platform/ensemble

Compound API. EnsembleModelsProvider is the only writer of the catalog. EnsembleProvider loads charts by default and adds a basic / expert view.
import {
  EnsembleForecast,
  EnsembleModelsProvider,
  EnsembleProvider,
} from '@infoplaza/platform/ensemble'

Also exported: DEFAULT_ENSEMBLE_ELEMENT_GROUPS, DEFAULT_ENSEMBLE_MODEL, ENSEMBLE_TIMESERIES, hooks useEnsemble / useEnsembleContext / useEnsembleChartBlock, and types such as EnsembleChartBlock, EnsembleGraphConfig, EnsembleView.

EnsembleForecast

Packaged plume charts with toolbar, chart, and footer.

Wraps EnsembleModelsProvider and EnsembleProvider, then optional Toolbar, Builder + Chart, and Footer. lat and lon are required. Charts load from GET /api/platform/ensemble-point-forecast unless you pass charts or getCharts. Applies ip-platform for you.

import { EnsembleForecast } from '@infoplaza/platform/ensemble'
  • Do not pass a models array. The catalog is loaded from the auth route.
  • When model / defaultModel are omitted, the provider selects ecmwfensembleglobal if it is in the catalog, otherwise the first model.
  • showToolbar and showFooter default to true.

Required props

PropTypeDefaultDescription
latnumber—Latitude of the forecast point.
lonnumber—Longitude of the forecast point.

Optional props

PropTypeDefaultDescription
basePathstring'/api/platform'Auth handler mount path.
showToolbarbooleantrueRender the model / run pill toolbar.
showFooterbooleantrueRender element-group and Basic / Expert pills.
view / defaultView / onViewChange'basic' | 'expert''basic'Chart density. Expert shows more member detail.
chartsEnsembleChartBlock[]—Host-owned chart blocks. When defined, skips the point-forecast fetch.
getCharts(options) => EnsembleChartBlock[]—Sync override when charts is omitted. Receives model, run, elementGroup, view, models, elementGroups, locale, timezone.
localestring'en'Date axis labels: 'en' | 'nl' | 'de' | 'it' | 'es' | 'fr'.
classNamestring—Extra class on the root wrapper.

Example

<EnsembleForecast
  lat={52.3676}
  lon={4.9041}
  locale="en"
/>

EnsembleModelsProvider

Location-filtered ensemble catalog.

Required lat and lon. Fetches GET {basePath}/ensemble-models?lat=&lon=. Read-only context: { models, loading, error, lat, lon, basePath }. No models setter.

import { EnsembleModelsProvider, useEnsembleModels } from '@infoplaza/platform/ensemble'
  • Catalog is API-only. Never pass a models array into Provider or Forecast.
  • useEnsembleModels() throws outside this provider. useEnsembleModelsContext() is nullable.

Required props

PropTypeDefaultDescription
latnumber—Latitude.
lonnumber—Longitude.

Optional props

PropTypeDefaultDescription
basePathstring'/api/platform'Auth mount path.
childrenReactNode—Usually EnsembleProvider.

EnsembleProvider

Selection, charts, and Basic / Expert view.

Must sit under EnsembleModelsProvider. Holds model / run / elementGroup / view, loads chart blocks, and exposes them to Toolbar, Builder, and Footer. Extra vs timeseries: view is basic | expert.

import { EnsembleProvider, useEnsemble } from '@infoplaza/platform/ensemble'
  • charts wins over getCharts wins over the default point-forecast fetch.
  • run === 'all' fetches one request per catalog runtime and sets each chart subtitle to the formatted runtime.
  • useEnsemble() throws outside the provider. useEnsembleContext() is nullable.

Required props

None.

Optional props

PropTypeDefaultDescription
model / defaultModel / onModelChangestring—Selected catalog slug. Default DEFAULT_ENSEMBLE_MODEL when present in the catalog.
run / defaultRun / onRunChangenumber | 'all'—Selected runtime.
elementGroupsEnsembleElementGroup[]DEFAULT_ENSEMBLE_ELEMENT_GROUPSFooter groups (ENSEMBLE_TIMESERIES.groups).
view / defaultView / onViewChange'basic' | 'expert''basic'Chart mode.
chartsEnsembleChartBlock[]—Host override. Each block is a title plus Recharts config.
getCharts(EnsembleGetChartsOptions) => EnsembleChartBlock[]—Sync host override when charts is omitted.
localestring'en'Date axis locale.

EnsembleToolbar

Model and run pills.

Resolves props ?? context and returns null if neither exists — it does not throw. Reuses timeseries pills internally, not map controls.

import { EnsembleToolbar } from '@infoplaza/platform/ensemble'

Required props

None.

Optional props

PropTypeDefaultDescription
modelstring—Falls back to context.
onModelChange(slug: string) => void—Falls back to context.
runnumber | 'all'—Falls back to context.
onRunChange(run: number | 'all') => void—Falls back to context.

EnsembleBuilder

Maps chart blocks onto Chart. Does not fetch.

Requires EnsembleProvider. Loading skeleton, then one chart-block context per EnsembleChartBlock. Clone children once per block.

import { EnsembleBuilder, EnsembleChart } from '@infoplaza/platform/ensemble'

Required props

None.

Optional props

PropTypeDefaultDescription
childrenReactNode—Typically <EnsembleChart />.

Example

<EnsembleBuilder>
  <EnsembleChart />
</EnsembleBuilder>

EnsembleChart

Bridge from block context to EnsembleGraph.

Reads the current chart block (or explicit graph props) and renders EnsembleGraph.

import { EnsembleChart } from '@infoplaza/platform/ensemble'

Required props

None.

Optional props

PropTypeDefaultDescription
configEnsembleGraphConfig—Explicit Recharts config. Otherwise reads the current builder block.

EnsembleGraph

Low-level Recharts ComposedChart.

Plume areas, member lines, and stacked bars. Used by EnsembleChart; you can also render it with an explicit config.

import { EnsembleGraph } from '@infoplaza/platform/ensemble'

Required props

PropTypeDefaultDescription
configEnsembleGraphConfig—Recharts series, areas, and bars for one chart block.

Optional props

PropTypeDefaultDescription
idstring—DOM id for the chart wrapper.
titlestring—Chart title.
titleExtrastring—Secondary title, e.g. latest.
subtitlestring—Shown under the title (e.g. formatted runtime).
fixedWidthnumber—Optional fixed pixel width.
fixedHeightnumber—Optional fixed pixel height.