All Classes Functions Variables Properties
List of all members | Public Member Functions | Properties
ICWFGM_WeatherStream Class Reference

Interface ICWFGM WeatherStream. More...

import "WeatherCom.idl";

Collaboration diagram for ICWFGM_WeatherStream:
Collaboration graph

Public Member Functions

HRESULT put_WeatherStation ([in]long key, [in]ICWFGM_WeatherStation *newVal)
 
HRESULT MT_Lock ([in] unsigned short exclusive, [in] unsigned short obtain)
 
HRESULT Clone ([out]ICWFGM_WeatherStream **newWeatherStream)
 
HRESULT GetAttribute ([in]unsigned short option, [out, retval] VARIANT *value)
 
HRESULT SetAttribute ([in]unsigned short option, [in] VARIANT value)
 
HRESULT Import ([in]const BSTR file_name, [in]unsigned short options)
 
HRESULT GetValidTimeRange ([out]unsigned __int64 *start, [out]__int64 *duration)
 
HRESULT GetEventTime ([in] unsigned long flags, [in] unsigned __int64 from_time, [out, retval] unsigned __int64 *next_event)
 
HRESULT MakeHourlyObservations ([in]unsigned __int64 time)
 
HRESULT MakeDailyObservations ([in]unsigned __int64 time)
 
HRESULT IsDailyObservations ([in]unsigned __int64 time)
 
HRESULT GetDailyValues ([in]unsigned __int64 time, [out]double *min_temp, [out]double *max_temp, [out]double *min_ws, [out]double *max_ws, [out]double *rh, [out]double *precip, [out]double *wd)
 
HRESULT SetDailyValues ([in]unsigned __int64 time, [in]double min_temp, [in]double max_temp, [in]double min_ws, [in]double max_ws, [in]double rh, [in]double precip, [in]double wd)
 
HRESULT GetInstantaneousValues ([in]unsigned __int64 time, [in]unsigned long interpolation_method, [out]IWXData *wx, [out]IFWIData *ifwi, [out]DFWIData *dfwi)
 
HRESULT SetInstantaneousValues ([in]unsigned __int64 time, [in]IWXData *wx)
 
HRESULT IsImportedFromFile ([in] unsigned __int64 time)
 
HRESULT DailyStandardFFMC ([in]unsigned __int64 time, [out, retval]double *ffmc)
 
HRESULT ClearWeatherData ()
 

Properties

ICWFGM_WeatherStation WeatherStation [get]
 
VARIANT UserData [get, set]
 

Detailed Description

Interface ICWFGM WeatherStream.

[id(20), helpstring("method GetFFMCStatus")] HRESULT GetFFMCStatus([in]unsigned __int64 time, [out]unsigned short *value); [id(21), helpstring("method GetDMCStatus")] HRESULT GetDMCStatus([in]unsigned __int64 time, [out]unsigned short *value); [id(22), helpstring("method GetDCStatus")] HRESULT GetDCStatus([in]unsigned __int64 time, [out]unsigned short *status);

This object contains weather data for a series of consecutive days, so is such called a weather stream. It has a start time and duration, and the user can inspect and modify various daily or hourly values. Each day of weather data is complete unto itself. The user may also specify alpha, beta, and gamma for Judi Beck's diurnal weather calculations. It also supports the standard COM IPersistStream, IPersistStreamInit, and IPersistStorage interfaces. Any weather stream is automatically saved with the station in order to simplify serialization operations in the client application.

Member Function Documentation

ICWFGM_WeatherStream::ClearWeatherData ( )

Deletes all hourly and daily weather data in the file. Does not reset start time, starting codes, etc.

ICWFGM_WeatherStream::Clone ( [out] ICWFGM_WeatherStream **  newWeatherStream)

Creates a new weather stream with all the same properties and data of the object being called, returns a handle to the new object in 'newWeatherStream'.

Parameters
newWeatherStreamA weather stream object.
ICWFGM_WeatherStream::DailyStandardFFMC ( [in] unsigned __int64  time,
[out,retval] double *  ffmc 
)

Retrieves the daily standard (Van Wagner) FFMC for the specified day. Note that other functions typically return the hourly FFMC value. Note that daily FFMC values change at noon LST, not at midnight.

Parameters
timeA GMT time provided as seconds since January 1st, 1600.
ffmcReturn value for daily FFMC.
ICWFGM_WeatherStream::GetAttribute ( [in] unsigned short  option,
[out, retval] VARIANT *  value 
)

Gets the value of an "option" and saves it in the "value" variable provided.

Parameters
optionThe weather option of interest. Valid values are:
  • CWFGM_ATTRIBUTE_LOAD_WARNING BSTR. Any warnings generated by the COM object when deserializating.
  • CWFGM_WEATHER_OPTION_WARNONSUNRISE Boolean. TRUE if sunrise could not be calculated.
  • CWFGM_WEATHER_OPTION_WARNONSUNSET Boolean. TRUE if sunset could not be calculated.
  • CWFGM_WEATHER_OPTION_FFMC_VANWAGNER Boolean. Use the Van Wagner approach to calculating HFFMC values
  • CWFGM_WEATHER_OPTION_FFMC_HYBRID Boolean. Do not use, only for experimental purposes.
  • CWFGM_WEATHER_OPTION_FFMC_LAWSON Boolean. Use the Lawson approach to calculating HFFMC values
  • CWFGM_WEATHER_OPTION_FWI_USE_SPECIFIED Boolean. Use any/all FWI values provided in the input file
  • CWFGM_WEATHER_OPTION_ORIGIN_FILE Boolean. Indicates whether the weather stream data origininated from an imported file.
  • CWFGM_WEATHER_OPTION_FWI_ANY_SPECIFIED Boolean. Indicates whether at least one entry in the inputted weather file had any FWI codes specified.
  • CWFGM_WEATHER_OPTION_TEMP_ALPHA 64-bit floating point. The 'alpha' value for Beck et. al. diurnal equations for temperature.
  • CWFGM_WEATHER_OPTION_TEMP_BETA 64-bit floating point. The 'beta' value for Beck et. al. diurnal equations for temperature.
  • CWFGM_WEATHER_OPTION_TEMP_GAMMA 64-bit floating point. The 'gamma' value for Beck et. al. diurnal equations for temperature.
  • CWFGM_WEATHER_OPTION_WIND_ALPHA 64-bit floating point. The 'alpha' value for Beck et. al. diurnal equations for wind.
  • CWFGM_WEATHER_OPTION_WIND_BETA 64-bit floating point. The 'beta' value for Beck et. al. diurnal equations for wind.
  • CWFGM_WEATHER_OPTION_WIND_GAMMA 64-bit floating point. The 'gamma' value for Beck et. al. diurnal equations for wind.
  • CWFGM_WEATHER_OPTION_INITIAL_FFMC 64-bit floating point. Initial FFMC value for daily FWI calculations.
  • CWFGM_WEATHER_OPTION_INITIAL_HFFMC 64-bit floating point. Initial hourly FFMC value for hourly FWI calculations.
  • CWFGM_WEATHER_OPTION_INITIAL_DC 64-bit floating point. Initial DC value for daily FWI calculations.
  • CWFGM_WEATHER_OPTION_INITIAL_DMC 64-bit floating point. Initial DMC value for daily FWI calculations.
  • CWFGM_WEATHER_OPTION_INITIAL_BUI 64-bit floating point. Optional initial BUI value. If not provided, then BUI is calculated from the initial DC, DMC values. Use -99.0 to clear the specified value.
  • CWFGM_WEATHER_OPTION_INITIAL_RAIN 64-bit floating point. Initial rain for the prior 11/12 hours. Only needed for Van Wagner HFFMC calculations.
  • CWFGM_GRID_ATTRIBUTE_LATITUDE 64-bit floating point, radians.
  • CWFGM_GRID_ATTRIBUTE_LONGITUDE 64-bit floating point, radians.
  • CWFGM_WEATHER_OPTION_INITIAL_HFFMCTIME 64-bit signed integer. Units are in seconds. Hour at which the initial HFFMC value is observed. HFFMC values will be calculated forward and back in time from this value.
  • CWFGM_GRID_ATTRIBUTE_TIMEZONE 64-bit signed integer. Units are in seconds, relative to GMT. For example, MST (Mountain Standard Time) would be -6 * 60 * 60 seconds. Valid values are from -12 hours to +12 hours.
  • CWFGM_GRID_ATTRIBUTE_DAYLIGHT_SAVINGS 64-bit signed integer. Units are in seconds. Amount of correction to apply for daylight savings time.
  • CWFGM_GRID_ATTRIBUTE_DST_START 64-bit unsigned integer. Units are in seconds. Julian date determining when daylight savings starts within the calendar year.
  • CWFGM_GRID_ATTRIBUTE_DST_END 64-bit unsigned integer. Units are in seconds. Julian date determining when daylight savings ends within the calendar year.
  • CWFGM_WEATHER_OPTION_START_TIME 64-bit unsigned integer. GMT time provided as seconds since Midnight January 1, 1600
  • CWFGM_WEATHER_OPTION_END_TIME 64-bit unsigned integer. GMT time provided as seconds since Midnight January 1, 1600
valueThe value of the option.
ICWFGM_WeatherStream::GetDailyValues ( [in] unsigned __int64  time,
[out] double *  min_temp,
[out] double *  max_temp,
[out] double *  min_ws,
[out] double *  max_ws,
[out] double *  rh,
[out] double *  precip,
[out] double *  wa 
)

Returns the daily observations for the specified day. If the day is represented as daily observations, this method returns these specified values. If the day is represented as hourly readings, then it returns values calculated from the hourly readings.

Parameters
timeTime identifying the day to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time.
min_tempReturned minimum temperature.
max_tempReturned maximum temperature.
min_wsReturned minimum windspeed.
max_wsReturned maximum windspeed.
rhReturned relative humidity.
precipReturned precipitation for the day.
waReturned mean wind direction, provided in Cartesian radians.
ICWFGM_WeatherStream::GetEventTime ( [in] unsigned long  flags,
[in] unsigned __int64  from_time,
[out,retval] unsigned __int64 *  next_event 
)

Gets the time of the next event by searching forwards or backwards (depending on the value of "flags" parameter) and saves the value of the next event to the "next_time" variable.

Parameters
flagsTo search backwards or forwards. Valid bit-flag identifiers are:
  • CWFGM_GETEVENTTIME_FLAG_SEARCH_FORWARD search forward in time
  • CWFGM_GETEVENTTIME_FLAG_SEARCH_BACKWARD search backwards in time
from_timeA GMT time provided as seconds since January 1st, 1600.
next_eventA GMT time provided as seconds since January 1st, 1600, representing the time for the next event, based on 'flags'.
ICWFGM_WeatherStream::GetInstantaneousValues ( [in] unsigned __int64  time,
[in] unsigned long  interpolation_method,
[out] IWXData wx,
[out] IFWIData ifwi,
[out] DFWIData dfwi 
)

Gets the instantaneous values for Temperature, DewPointTemperature, RH, Precipitation, WindSpeed and WindDirection (and saves these values in the data structure wx). It also gets FFMC, ISI and FWI (and saves theses values in the data structure ifwi) and similarly gets the values for dFFMC, dDMC, dDC and dBUI (and saves them to the data structure dfwi).

Parameters
timeTime identifying the day and hour to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time.
interpolation_methodValid bit-flag values are:
  • CWFGM_SCENARIO_OPTION_WEATHER_INTERPOLATE_TEMPORAL Boolean. When TRUE, temporal weather interpolation is turned on, for all of the WX and hourly/instantantaneous FWI calculations.
wxThe data structure that stores the values for Temperature, Dew DewPointTemperature, RH, Precipitation, WindSpeed and WindDirection.
ifwiThe data structure that stores the values for FFMC, ISI and FWI.
dfwiThe data structure that stores the values for dFFMC, dDMC, dDC and dBUI.
ICWFGM_WeatherStream::GetValidTimeRange ( [out] unsigned __int64 *  start,
[out] __int64 *  duration 
)

Returns the start time and duration for the data stored in this weather stream object. These objects return this data in GMT, where local time is set by SetAttribute().

Parameters
startStart time for the weather stream, specified in GMT time zone, as count of seconds since Midnight January 1, 1600.
durationDuration of the weather stream, provided as a count of seconds.
ICWFGM_WeatherStream::Import ( [in] const BSTR  file_name,
[in] unsigned short  options 
)

Imports a weather stream with hourly data or daily data depending on the file. For importing a weather stream with hourly data the file must be of a specific format. The first line contains the header determining the file layout. Necessary columns will be identified as

  • "hour" (synonyms are "Time(CST)")
  • "temp" (synonyms are "temperature", "temp(celsius)")
  • "rh" (synonyms are "relative_humidity")
  • "wd" (synonyms are "dir(degrees)", "dir", "wind_direction")
  • "ws" (synonyms are "wspd", "wind_speed", "spd(kph)")
  • "precip" (synonyms are "rain", "precipitation", "raintot", "rn_1", "rn24").

Optional columns will be identified as

  • "ffmc" (synonyms are "hffmc", "ffmc(h)")
  • "dmc"
  • "dc"
  • "bui"
  • "isi" (synonyms are "hisi", "isi(h)")
  • "fwi" (synonyms are "hfwi", "fwi(h)").

It is advised to contact the support team or visit the web site for an example file.

For importing a weather stream with daily data the file must be of a specific format. The first line contains the header determining the file layout. Column headers may be

  • "min_temp"
  • "max_temp"
  • "rh" (synonyms are "min_rh", "relative_humidity")
  • "wd" (synonyms are "dir(degrees)", "dir", "wind_direction")
  • "min_ws"
  • "max_ws"
  • "precip" (synonyms are "rain", "precipitation", "raintot", "rn_1", "rn24").

It is advised to contact the support team or visit the web site for an example file.

Parameters
file_namePath/file of weather stream data.
optionBit-wise combination of
  • 0 Only valid for importing data into a weather stream with no data.
  • CWFGM_WEATHERSTREAM_IMPORT_PURGE When there is existing data in the weather stream, this option removes this data before performing the import.
  • CWFGM_WEATHERSTREAM_IMPORT_SUPPORT_APPEND When there is existing data in the weather stream, this option will append data to the existing data. Times must be valid.
  • CWFGM_WEATHERSTREAM_IMPORT_SUPPORT_OVERWRITE When there is existing data in the weather stream, this option will conditionally overwrite existing data, depending on times.
  • CWFGM_WEATHERSTREAM_IMPORT_PURGE is mutually exclusive to the other two options. No option supports prepending data. Options are ignored when the weather stream has no existing data in it.
ICWFGM_WeatherStream::IsDailyObservations ( [in] unsigned __int64  time)

Returns the representation of a given day.

Parameters
timeTime identifying the day to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time.
ICWFGM_WeatherStream::IsImportedFromFile ( [in] unsigned __int64  time)

Retrieves information regarding whether a particular day's data was loaded from a file.

Parameters
timeTime identifying the day and hour to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time.
ICWFGM_WeatherStream::MakeDailyObservations ( [in] unsigned __int64  time)

There are two basic formats supported by this weather stream object: a day's values can be specified as hourly conditions or daily observations. If hourly conditions are provided, then daily observations are subsequently calculated. If the day's values are already specified as daily observations, then there is no change. This method may also append a preceding or following day to existing data.

Parameters
timeTime identifying the day to modify, provided as a count of seconds since Midnight January 1, 1600 GMT time.
ICWFGM_WeatherStream::MakeHourlyObservations ( [in] unsigned __int64  time)

There are two basic formats supported by this weather stream object: a day's values can be specified as hourly conditions or daily observations. If daily observations are provided, then hourly conditions are subsequently calculated. If the day's values are already specified as hourly conditions, then there is no change. This method may also append a preceding or following day to existing data.

Parameters
timeTime identifying the day to modify, provided as a count of seconds since Midnight January 1, 1600 GMT time.
ICWFGM_WeatherStream::MT_Lock ( [in] unsigned short  exclusive,
[in] unsigned short  obtain 
)

Changes the state of the object with respect to access rights. When the object is used by an active simulation, it must not be modified. When the object is somehow modified, it must be done so in an atomic action to prevent concerns with arising from multithreading. Note that these locks are primarily needed to ensure that data contributing during a simulation is not modified while the simulation is executing.

Locking request is forwarded to the attached ICWFGM_WeatherStation object.

In the event of an error, then locking is undone to reflect an error state.

Parameters
exclusiveTRUE if the requester wants a write lock, false for read/shared access
obtainTRUE to obtain the lock, FALSE to release the lock. If this is FALSE, then the 'exclusive' parameter must match the initial call used to obtain the lock.
See Also
ICWFGM_WeatherStation::MT_Lock
ICWFGM_WeatherStream::put_WeatherStation ( [in] long  key,
[in] ICWFGM_WeatherStation newVal 
)

This method is a private method to only be called by a weather station or a weather grid. It is used to build associations between these objects.

Parameters
keyInternal value.
newValInternal value.
ICWFGM_WeatherStream::SetAttribute ( [in] unsigned short  option,
[in] VARIANT  value 
)

Sets the value of an "option" to the value of the "value" variable provided. It is important to set the starting codes of the weather stream before importing the weather data. Changing the starting codes after importing mean Prometheus will recalculate everything.

Parameters
optionThe weather option of interest. Valid values are:
  • CWFGM_WEATHER_OPTION_FFMC_VANWAGNER Boolean. Use the Van Wagner approach to calculating HFFMC values.
  • CWFGM_WEATHER_OPTION_FFMC_HYBRID Boolean. Do not use, only for experimental purposes.
  • CWFGM_WEATHER_OPTION_FFMC_LAWSON Boolean. Use the Lawson approach to calculating HFFMC values
  • CWFGM_WEATHER_OPTION_FWI_USE_SPECIFIED Boolean. Use any/all FWI values provided in the input file
  • CWFGM_WEATHER_OPTION_TEMP_ALPHA 64-bit floating point. The 'alpha' value for Beck et. al. diurnal equations for temperature.
  • CWFGM_WEATHER_OPTION_TEMP_BETA 64-bit floating point. The 'beta' value for Beck et. al. diurnal equations for temperature.
  • CWFGM_WEATHER_OPTION_TEMP_GAMMA 64-bit floating point. The 'gamma' value for Beck et. al. diurnal equations for temperature.
  • CWFGM_WEATHER_OPTION_WIND_ALPHA 64-bit floating point. The 'alpha' value for Beck et. al. diurnal equations for wind.
  • CWFGM_WEATHER_OPTION_WIND_BETA 64-bit floating point. The 'beta' value for Beck et. al. diurnal equations for wind.
  • CWFGM_WEATHER_OPTION_WIND_GAMMA 64-bit floating point. The 'gamma' value for Beck et. al. diurnal equations for wind.
  • CWFGM_WEATHER_OPTION_INITIAL_FFMC 64-bit floating point. Initial FFMC value for daily FWI calculations.
  • CWFGM_WEATHER_OPTION_INITIAL_HFFMC 64-bit floating point. Initial hourly FFMC value for hourly FWI calculations.
  • CWFGM_WEATHER_OPTION_INITIAL_DC 64-bit floating point. Initial DC value for daily FWI calculations.
  • CWFGM_WEATHER_OPTION_INITIAL_DMC 64-bit floating point. Initial DMC value for daily FWI calculations.
  • CWFGM_WEATHER_OPTION_INITIAL_BUI 64-bit floating point. Optional initial BUI value. If not provided, then BUI is calculated from the initial DC, DMC values. Use -99.0 to clear the specified value.
  • CWFGM_WEATHER_OPTION_INITIAL_RAIN 64-bit floating point. Initial rain for the prior 11/12 hours. Only needed for Van Wagner HFFMC calculations.
  • CWFGM_GRID_ATTRIBUTE_LATITUDE 64-bit floating point, radians.
  • CWFGM_GRID_ATTRIBUTE_LONGITUDE 64-bit floating point, radians.
  • CWFGM_WEATHER_OPTION_INITIAL_HFFMCTIME 64-bit signed integer. Units are in seconds. Hour at which the initial HFFMC value is observed. HFFMC values will be calculated forward and back in time from this value.
  • CWFGM_GRID_ATTRIBUTE_TIMEZONE 64-bit signed integer. Units are in seconds, relative to GMT. For example, MST (Mountain Standard Time) would be -6 * 60 * 60 seconds. Valid values are from -12 hours to +12 hours.
  • CWFGM_GRID_ATTRIBUTE_DAYLIGHT_SAVINGS 64-bit signed integer. Units are in seconds. Amount of correction to apply for daylight savings time.
  • CWFGM_GRID_ATTRIBUTE_DST_START 64-bit unsigned integer. Units are in seconds. Julian date determining when daylight savings starts within the calendar year.
  • CWFGM_GRID_ATTRIBUTE_DST_END 64-bit unsigned integer. Units are in seconds. Julian date determining when daylight savings ends within the calendar year.
  • CWFGM_WEATHER_OPTION_START_TIME 64-bit unsigned integer. GMT time provided as seconds since Midnight January 1, 1600
  • CWFGM_WEATHER_OPTION_END_TIME 64-bit unsigned integer. GMT time provided as seconds since Midnight January 1, 1600
valueThe value to set the option to.
ICWFGM_WeatherStream::SetDailyValues ( [in] unsigned __int64  time,
[in] double  min_temp,
[in] double  max_temp,
[in] double  min_ws,
[in] double  max_ws,
[in] double  rh,
[in] double  precip,
[in] double  wa 
)

Sets the daily observations for the specified day. If the day is represented as hourly readings, then this method will fail.

Parameters
timeTime identifying the day to set, provided as a count of seconds since Midnight January 1, 1600 GMT time.
min_tempMinimum temperature.
max_tempMaximum temperature.
min_wsMinimum windspeed.
max_wsMaximum windspeed.
rhRelative humidity.
precipDaily precipitation.
waMean wind direction.
ICWFGM_WeatherStream::SetInstantaneousValues ( [in] unsigned __int64  time,
[in] IWXData wx 
)

Sets the instantaneous values for Temperature, DewPointTemperature, RH, Precipitation, WindSpeed and WindDirection via the IWXData data structure.

Parameters
timeTime identifying the day and hour to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time.
wxThe data structure that stores the values for Temperature, Dew DewPointTemperature, RH, Precipitation, WindSpeed and WindDirection.

Property Documentation

Property ICWFGM_WeatherStream::UserData
getsetproperty

This property is unused by this object, and is available for exclusive use by the client code. It is a VARIANT value to ensure that the client code can store a pointer value (if it chooses) for use in manual subclassing this object. This value is not loaded or saved during serialization operations, and it is the responsibility of the client code to manage any value or object stored here. Access to this property is not thread-safe.

Parameters
pValValue of UserData.
newValReplacement value for UserData.
Property ICWFGM_WeatherStream::WeatherStation
getproperty

This method is used to (only) retrieve which weather station a weather stream is associated with.

Parameters
pValA weather station object.