Class CCWFGM WeatherStream. More...
#include <CWFGM_WeatherStream.h>
Public Member Functions | |
STDMETHOD() | get_WeatherStation (ICWFGM_WeatherStation **pVal) |
STDMETHOD() | put_WeatherStation (long key, ICWFGM_WeatherStation *newVal) |
STDMETHOD() | MT_Lock (USHORT exclusive, USHORT obtain) |
STDMETHOD() | Clone (ICWFGM_WeatherStream **newWeatherStream) |
STDMETHOD() | GetAttribute (USHORT option, VARIANT *value) |
STDMETHOD() | SetAttribute (USHORT option, VARIANT value) |
STDMETHOD() | Import (const BSTR file_name, USHORT options) |
STDMETHOD() | ClearWeatherData () |
STDMETHOD() | GetValidTimeRange (ULONGLONG *start, LONGLONG *duration) |
STDMETHOD() | GetEventTime (ULONG flags, ULONGLONG from_time, ULONGLONG *next_event) |
STDMETHOD() | MakeHourlyObservations (ULONGLONG time) |
STDMETHOD() | MakeDailyObservations (ULONGLONG time) |
STDMETHOD() | IsDailyObservations (ULONGLONG time) |
STDMETHOD() | GetDailyValues (ULONGLONG time, double *min_temp, double *max_temp, double *min_ws, double *max_ws, double *rh, double *precip, double *wd) |
STDMETHOD() | SetDailyValues (ULONGLONG time, double min_temp, double max_temp, double min_ws, double max_ws, double rh, double precip, double wd) |
STDMETHOD() | GetInstantaneousValues (ULONGLONG time, ULONG interpolation_method, IWXData *wx, IFWIData *ifwi, DFWIData *dfwi) |
STDMETHOD() | SetInstantaneousValues (ULONGLONG time, IWXData *wx) |
STDMETHOD() | get_UserData (VARIANT *pVal) |
STDMETHOD() | put_UserData (VARIANT newVal) |
STDMETHOD() | DailyStandardFFMC (ULONGLONG time, double *ffmc) |
STDMETHOD() | IsImportedFromFile (ULONGLONG time) |
Public Member Functions inherited from ICWFGM_WeatherStream | |
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 () |
Additional Inherited Members | |
Properties inherited from ICWFGM_WeatherStream | |
ICWFGM_WeatherStation | WeatherStation [get] |
VARIANT | UserData [get, set] |
Class CCWFGM WeatherStream.
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.
A weather stream must be associated with a weather station to be selected into a scenario.
CCWFGM_WeatherStream::ClearWeatherData | ( | ) |
Deletes all hourly and daily weather data in the file. Does not reset start time, starting codes, etc.
S_OK | Successful |
CCWFGM_WeatherStream::Clone | ( | 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'.
newWeatherStream | A weather stream object. |
E_POINTER | The address provided for "newWeatherStream" is invalid. |
S_OK | Successful. |
E_OUTOFMEMORY | Insufficient memory. |
ERROR_SEVERITY_WARNING | Unspecified failure. |
E_NOINTERFACE | Internal serialization issue. |
CCWFGM_WeatherStream::DailyStandardFFMC | ( | ULONGLONG | time, |
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.
time | A GMT time provided as seconds since January 1st, 1600. |
ffmc | Return value for daily FFMC. |
E_POINTER | The address provided for ffmc is invalid. |
S_OK | Successful. |
ERROR_SEVERITY_WARNING | Time is invalid. |
ERROR_INVALID_TIME | FFMC is invalid. |
CCWFGM_WeatherStream::get_UserData | ( | VARIANT * | pVal | ) |
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.
pVal | Value of UserData |
E_POINTER | The address provided for pVal is invalid |
S_OK | Successful |
CCWFGM_WeatherStream::get_WeatherStation | ( | ICWFGM_WeatherStation ** | pVal | ) |
This method is used to (only) retrieve which weather station a weather stream is associated with.
pVal | A weather station object. |
E_POINTER | The address provided for pVal is invalid. |
S_OK | Successful. |
ERROR_WEATHER_STREAM_NOT_ASSIGNED | The stream is not associated with any station (pVal is set to NULL). |
CCWFGM_WeatherStream::GetAttribute | ( | USHORT | option, |
VARIANT * | value | ||
) |
Gets the value of an "option" and saves it in the "value" variable provided.
option | The weather option of interest. Valid values are:
|
value | The value of the option. |
E_POINTER | The address provided for value is invalid. |
S_OK | Successful. |
ERROR_WEATHER_OPTION_INVALID | The weather option referred to is unknown. |
CCWFGM_WeatherStream::GetDailyValues | ( | ULONGLONG | time, |
double * | min_temp, | ||
double * | max_temp, | ||
double * | min_ws, | ||
double * | max_ws, | ||
double * | rh, | ||
double * | precip, | ||
double * | wd | ||
) |
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.
time | Time identifying the day to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time. |
min_temp | Returned minimum temperature. |
max_temp | Returned maximum temperature. |
min_ws | Returned minimum windspeed. |
max_ws | Returned maximum windspeed. |
rh | Returned relative humidity. |
precip | Returned precipitation for the day. |
wd | Returned mean wind direction, provided in Cartesian radians. |
E_POINTER | The address provided for min_temp, max_temp, min_ws, max_ws, rh, precip or wd is invalid. |
S_OK | Successful. |
ERROR_SEVERITY_WARNING | The day is not present on the weather stream. |
CCWFGM_WeatherStream::GetEventTime | ( | ULONG | flags, |
ULONGLONG | from_time, | ||
ULONGLONG * | 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.
flags | To search backwards or forwards. Valid bit-flag identifiers are:
|
from_time | A GMT time provided as seconds since January 1st, 1600. |
next_event | A GMT time provided as seconds since January 1st, 1600, representing the time for the next event, based on 'flags'. |
ERROR_GRID_UNINITIALIZED | No object in the grid layering to forward the request to. |
S_OK | Successful. |
CCWFGM_WeatherStream::GetInstantaneousValues | ( | ULONGLONG | time, |
ULONG | interpolation_method, | ||
IWXData * | wx, | ||
IFWIData * | ifwi, | ||
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).
time | Time identifying the day and hour to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time. |
interpolation_method | Valid bit-flag values are:
|
wx | The data structure that stores the values for Temperature, Dew DewPointTemperature, RH, Precipitation, WindSpeed and WindDirection. |
ifwi | The data structure that stores the values for FFMC, ISI and FWI. |
dfwi | The data structure that stores the values for dFFMC, dDMC, dDC and dBUI. |
S_OK | This day's data was loaded from a file. |
E_POINTER | Invalid parameters. |
ERROR_SEVERITY_WARNING | Unspecified error. |
CCWFGM_WeatherStream::GetValidTimeRange | ( | ULONGLONG * | start, |
LONGLONG * | 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().
start | Start time for the weather stream, specified in GMT time zone, as count of seconds since Midnight January 1, 1600. |
duration | Duration of the weather stream, provided as a count of seconds. |
E_POINTER | The address provided for start or duration is invalid. |
S_OK | Successful. |
CCWFGM_WeatherStream::Import | ( | const BSTR | file_name, |
USHORT | 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
Optional columns will be identified as
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
It is advised to contact the support team or visit the web site for an example file.
file_name | Path/file of weather stream data. |
options | Determines rules for (re)importing data. Valid options are:
|
S_OK | Successful. |
E_INVALIDARG | Invalid options. |
ERROR_FILE_NOT_FOUND | File cannot be found in the filesystem. |
ERROR_READ_FAULT | The file format is unrecognized, or there is an error in the file format. |
ERROR_ACCESS_DENIED | File cannot be opened. |
ERROR_SEVERITY_WARNING | File cannot be found in the filesystem. |
ERROR_READ_FAULT | | ERROR_SEVERITY_WARNING Cannot read any data from the file. |
ERROR_BAD_FILE_TYPE | | ERROR_SEVERITY_WARNING The file format is unrecognized, or there is an error in the file format. |
ERROR_INVALID_DATA | | ERROR_SEVERITY_WARNING Data in the file is out of range. |
ERROR_INVALID_TIME | | ERROR_SEVERITY_WARNING Time sequence is invalid (out of order or missing entries, etc.). |
ERROR_SEVERITY_WARNING | File cannot be opened. |
ERROR_SCENARIO_SIMULATION_RUNNING | The weather stream data cannot be imported while a scenario simulation is still running. |
ERROR_INVALID_HANDLE | Generic file I/O error. |
ERROR_FILE_EXISTS | The file does not exist. |
ERROR_INVALID_PARAMETER | |
ERROR_TOO_MANY_OPEN_FILES | Too many files are open. |
ERROR_HANDLE_DISK_FULL | Disk full |
CCWFGM_WeatherStream::IsDailyObservations | ( | ULONGLONG | time | ) |
Returns the representation of a given day.
time | Time identifying the day to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time. |
S_OK | The day is represented using daily observations. |
ERROR_NOT_ENOUGH_MEMORY | The day is not present in the data stream. |
ERROR_INVALID_TIME | The day is not present in the data stream. |
ERROR_SEVERITY_WARNING | The day is represented using hourly readings. |
CCWFGM_WeatherStream::IsImportedFromFile | ( | ULONGLONG | time | ) |
Retrieves information regarding whether a particular day's data was loaded from a file.
time | Time identifying the day and hour to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time. |
S_OK | This day's data was loaded from a file. |
ERROR_SEVERITY_WARNING | Time is invalid. |
ERROR_INVALID_TIME | Time is invalid. |
CCWFGM_WeatherStream::MakeDailyObservations | ( | ULONGLONG | 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.
time | Time identifying the day to modify, provided as a count of seconds since Midnight January 1, 1600 GMT time. |
S_OK | Successful. |
ERROR_SEVERITY_WARNING | The operation failed (usually because the requested day is not present or adjacent to existing data). |
ERROR_SCENARIO_SIMULATION_RUNNING | Changes cannot be made if the simulation is running. |
CCWFGM_WeatherStream::MakeHourlyObservations | ( | ULONGLONG | 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.
time | Time identifying the day to modify, provided as a count of seconds since Midnight January 1, 1600 GMT time. |
S_OK | Successful. |
ERROR_SEVERITY_WARNING | The operation failed (usually because the requested day is not present or adjacent to existing data). |
ERROR_SCENARIO_SIMULATION_RUNNING | Changes cannot be made if the simulation is running. |
CCWFGM_WeatherStream::MT_Lock | ( | USHORT | exclusive, |
USHORT | 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.
exclusive | TRUE if the requester wants a write lock, false for read/shared access |
obtain | TRUE 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. |
SUCCESS_STATE_OBJECT_UNLOCKED | Lock was released. |
SUCCESS_STATE_OBJECT_LOCKED_WRITE | Exclusive/write lock obtained. |
SUCCESS_STATE_OBJECT_LOCKED_SCENARIO | A scenario successfully required a lock for purposes of simulating. |
SUCCESS_STATE_OBJECT_LOCKED_READ | Shared/read lock obtained. |
S_OK | Successful |
CCWFGM_WeatherStream::put_UserData | ( | VARIANT | newVal | ) |
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.
newVal | Replacement value for UserData |
S_OK | Successful |
CCWFGM_WeatherStream::put_WeatherStation | ( | long | key, |
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.
key | Internal value. |
newVal | Internal value. |
E_NOINTERFACE | This is returned if the 'put' method should not be called directly or if any of the parameters are invalid. |
ERROR_SCENARIO_SIMULATION_RUNNING | Association could not be built as the simulation is currently running. |
ERROR_WEATHER_STREAM_ALREADY_ASSIGNED | Association already exists. |
S_OK | Successful. |
CCWFGM_WeatherStream::SetAttribute | ( | USHORT | option, |
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.
option | The weather option of interest. Valid values are:
|
value | The value to set the option to. |
S_OK | Successful. |
ERROR_WEATHER_OPTION_INVALID | The weather option referred to is unknown. |
E_INVALIDARG | If value's value is incorrect. |
ERROR_SCENARIO_SIMULATION_RUNNING | Cannot set an attribute if the simulation is running. |
E_FAIL | Failed. |
CCWFGM_WeatherStream::SetDailyValues | ( | ULONGLONG | time, |
double | min_temp, | ||
double | max_temp, | ||
double | min_ws, | ||
double | max_ws, | ||
double | rh, | ||
double | precip, | ||
double | wd | ||
) |
Sets the daily observations for the specified day. If the day is represented as hourly readings, then this method will fail.
time | Time identifying the day to set, provided as a count of seconds since Midnight January 1, 1600 GMT time. |
min_temp | Minimum temperature. |
max_temp | Maximum temperature. |
min_ws | Minimum windspeed. |
max_ws | Maximum windspeed. |
rh | Relative humidity. |
precip | Daily precipitation. |
wd | Mean wind direction. |
S_OK | Successful. |
ERROR_SEVERITY_WARNING | The day is not present in the weather stream, or the day is represented as hourly observations. |
ERROR_SCENARIO_SIMULATION_RUNNING | Cannot set daily values while the simulation is running. |
CCWFGM_WeatherStream::SetInstantaneousValues | ( | ULONGLONG | time, |
IWXData * | wx | ||
) |
Sets the instantaneous values for Temperature, DewPointTemperature, RH, Precipitation, WindSpeed and WindDirection via the IWXData data structure.
time | Time identifying the day and hour to inspect, provided as a count of seconds since Midnight January 1, 1600 GMT time. |
wx | The data structure that stores the values for Temperature, Dew DewPointTemperature, RH, Precipitation, WindSpeed and WindDirection. |
S_OK | This day's data was has been stored. |
E_POINTER | Invalid parameters. |
ERROR_SEVERITY_WARNING | The day is not present in the weather stream, or the day is represented as daily observations. |
ERROR_SCENARIO_SIMULATION_RUNNING | Cannot set values if the scenario simulation is running. |