Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ForecastCalculator

Hierarchy

Index

Constructors

constructor

Properties

city

city: string

The city to fetch the forecast for. Must be one of the predefined cities for the specified province.

date

date: string

The date to fetch the forecast for. Forecasts are not available for future dates and only exist approximately a month into the past.

Protected fetchState

fetchState: number = 0

forecastType

forecastType: string

The type of forecast to get (either hour or day).

model

model: string

The forecast model to use. Must be one of GEM, GEM_DETER, NCEP, or CUSTOM.

modelIds

modelIds: string[]

An array of integer model IDs to use with the custom model type. Will be ignored if the model type is not CUSTOM.

percentile

percentile: number

The percentile to use for calculating the forecast. Not valid for GEM Deterministic.

province

province: string

The province to fetch the forecast for (can be either the full name or abbreviation).

results

results: ForecastHour[] | ForecastDay[]

The calculated forecast values.

time

time: string

Forecasts are generated at both 00Z and 12Z. This specifies which of those times to get the forecast data for. Must be one of 00Z and 12Z.

timezone

timezone: number

The timezone index to format the returned forecast times in. Must be from the list obtained from Timezone::getTimezoneNameList().

Static Private Readonly GET_FORECAST

GET_FORECAST: "FORECAST_GET" = "FORECAST_GET"

Methods

fetchForecast

  • Lookup a forecast for the currently specified location and model.

    throws

    This method can only be called once at a time per instance.

    Parameters

    Returns void

Private fetchForecastInternal

  • fetchForecastInternal(callback?: (forecast: ForecastCalculator) => any, error?: (message: any) => any): void

fetchForecastPromise

  • Lookup a forecast for the currently specified location and model.

    throws

    This method can only be called once at a time per instance.

    Returns Promise<ForecastCalculator>

    The current ForecastCalculator object.

Static getCities

  • getCities(province: Province, callback?: (forecast: string[]) => any): void
  • Get a list of supported cities in the provided province.

    Parameters

    • province: Province

      The province to get the available cities for.

    • Optional callback: (forecast: string[]) => any
        • (forecast: string[]): any
        • Parameters

          • forecast: string[]

          Returns any

    Returns void

Static getCitiesPromise

  • getCitiesPromise(province: Province): Promise<string[]>
  • Get a list of supported cities in the provided province.

    throws

    This method can only be called once at a time per instance.

    Parameters

    • province: Province

      The province to get the available cities for.

    Returns Promise<string[]>

    A list of supported cities for the requested province.