Parallel Analog Ensemble
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
AnEnSSE Class Reference

AnEnSSE is an implementation of the abstrct class AnEn for the search space extension algorithm. More...

#include <AnEnSSE.h>

Inheritance diagram for AnEnSSE:
AnEnIS AnEn AnEnSSEMS testAnEnSSEMS

Public Member Functions

 AnEnSSE ()
 
 AnEnSSE (const AnEnSSE &orig)
 
 AnEnSSE (const Config &config)
 
virtual ~AnEnSSE ()
 
virtual void compute (const Forecasts &forecasts, const Observations &observations, std::vector< std::size_t > &fcsts_test_index, std::vector< std::size_t > &fcsts_search_index) override
 
virtual void print (std::ostream &) const override
 
AnEnSSEoperator= (const AnEnSSE &rhs)
 
std::size_t num_nearest () const
 
double distance () const
 
bool extend_obs () const
 
bool save_sims_station_index () const
 
bool exclude_closest_location () const
 
const Array4DPointersims_station_index () const
 
const Functions::Matrixsearch_stations_index () const
 
virtual void compute (const Forecasts &forecasts, const Observations &observations, const Times &test_times, const Times &search_times) override
 
virtual void compute (const Forecasts &forecasts, const Observations &observations, std::vector< std::size_t > &fcsts_test_index, std::vector< std::size_t > &fcsts_search_index) override
 
- Public Member Functions inherited from AnEnIS
 AnEnIS ()
 
 AnEnIS (const AnEnIS &orig)
 
 AnEnIS (const Config &)
 
virtual ~AnEnIS ()
 
AnEnISoperator= (const AnEnIS &rhs)
 
std::size_t num_analogs () const
 
std::size_t num_sims () const
 
std::size_t obs_var_index () const
 
std::size_t max_par_nan () const
 
std::size_t max_flt_nan () const
 
std::size_t flt_radius () const
 
bool save_analogs () const
 
bool save_analogs_time_index () const
 
bool save_sims () const
 
bool save_sims_time_index () const
 
bool operation () const
 
bool quick_sort () const
 
bool prevent_search_future () const
 
bool no_norm () const
 
const std::vector< double > & weights () const
 
const Array4DPointersds () const
 
const Array4DPointersims_metric () const
 
const Array4DPointersims_time_index () const
 
const Array4DPointeranalogs_value () const
 
const Array4DPointeranalogs_time_index () const
 
const Functions::Matrixobs_time_index_table () const
 
- Public Member Functions inherited from AnEn
 AnEn ()
 
 AnEn (const AnEn &orig)
 
 AnEn (const Config &)
 
virtual ~AnEn ()
 
virtual const ProfilergetProfile () const
 
AnEnoperator= (const AnEn &rhs)
 

Static Public Attributes

static const std::size_t _SIM_STATION_INDEX = 3
 
static const std::array< double, 4 > _INIT_ARR_VALUE = {NAN, NAN, NAN, NAN}
 
- Static Public Attributes inherited from AnEnIS
static const std::size_t _SIM_VALUE_INDEX = 0
 
static const std::size_t _SIM_FCST_TIME_INDEX = 1
 
static const std::size_t _SIM_OBS_TIME_INDEX = 2
 
static const std::array< double, 3 > _INIT_ARR_VALUE = {NAN, NAN, NAN}
 

Protected Member Functions

virtual void preprocess_ (const Forecasts &forecasts, const Observations &observations, std::vector< std::size_t > &fcsts_test_index, std::vector< std::size_t > &fcsts_search_index) override
 
virtual void allocateMemory_ (const Forecasts &forecasts, const std::vector< std::size_t > &fcsts_test_index, const std::vector< std::size_t > &fcsts_search_index) override
 
virtual void setMembers_ (const Config &) override
 
virtual void checkSave_ () const override
 
virtual void checkNumberOfMembers_ (std::size_t num_search_times_index) override
 
template<std::size_t len>
void saveAnalogs_ (const SimsVec< len > &sims_arr, const Observations &observations, std::size_t station_i, std::size_t test_time_i, std::size_t flt_i)
 
template<std::size_t len>
void saveSimsStationIndex_ (const SimsVec< len > &sims_arr, std::size_t station_i, std::size_t test_time_i, std::size_t flt_i)
 
- Protected Member Functions inherited from AnEnIS
virtual void setSdsTimeMap_ (const std::vector< std::size_t > &times_accum_index)
 
virtual double computeSimMetric_ (const Forecasts &forecasts, std::size_t sta_test_i, std::size_t sta_search_i, std::size_t flt_i, std::size_t time_test_i, std::size_t time_search_i, const std::vector< bool > &circulars)
 
virtual void allocateSds_ (const Forecasts &forecasts, const std::vector< std::size_t > &times_fixed_index, const std::vector< std::size_t > &times_accum_index={})
 
virtual void computeSds_ (const Forecasts &forecasts, const std::vector< std::size_t > &times_fixed_index, const std::vector< std::size_t > &times_accum_index={})
 
virtual void checkIndexRange_ (const Forecasts &forecasts, const std::vector< std::size_t > &fcsts_test_index, const std::vector< std::size_t > &fcsts_search_index) const
 
virtual void checkConsistency_ (const Forecasts &forecasts, const Observations &observations) const
 
template<std::size_t len>
void saveAnalogs_ (const SimsVec< len > &sims_arr, const Observations &observations, std::size_t station_i, std::size_t test_time_i, std::size_t flt_i)
 
template<std::size_t len>
void saveAnalogsTimeIndex_ (const SimsVec< len > &sims_arr, std::size_t station_i, std::size_t test_time_i, std::size_t flt_i)
 
template<std::size_t len>
void saveSims_ (const SimsVec< len > &sims_arr, std::size_t station_i, std::size_t test_time_i, std::size_t flt_i)
 
template<std::size_t len>
void saveSimsTimeIndex_ (const SimsVec< len > &sims_arr, std::size_t station_i, std::size_t test_time_i, std::size_t flt_i)
 

Static Protected Member Functions

static bool _simsSort_ (const std::array< double, 4 > &, const std::array< double, 4 > &)
 
- Static Protected Member Functions inherited from AnEnIS
static bool _simsSort_ (const std::array< double, 3 > &, const std::array< double, 3 > &)
 

Protected Attributes

std::size_t num_nearest_
 
double distance_
 
bool extend_obs_
 
bool save_sims_station_index_
 
bool exclude_closest_location_
 
Array4DPointer sims_station_index_
 
Functions::Matrix search_stations_index_
 
- Protected Attributes inherited from AnEnIS
std::size_t num_analogs_
 
std::size_t num_sims_
 
std::size_t obs_var_index_
 
std::size_t max_par_nan_
 
std::size_t max_flt_nan_
 
std::size_t flt_radius_
 
bool save_analogs_
 
bool save_analogs_time_index_
 
bool save_sims_
 
bool save_sims_time_index_
 
bool operation_
 
bool quick_sort_
 
bool prevent_search_future_
 
bool no_norm_
 
std::vector< double > weights_
 
Array4DPointer sds_
 
std::unordered_map< std::size_t, std::size_t > sds_time_index_map_
 
Array4DPointer sims_metric_
 
Array4DPointer sims_time_index_
 
Array4DPointer analogs_value_
 
Array4DPointer analogs_time_index_
 
Functions::Matrix obs_time_index_table_
 
bool use_AI_
 
- Protected Attributes inherited from AnEn
Verbose verbose_
 
Profiler profiler_
 

Friends

std::ostream & operator<< (std::ostream &, const AnEnSSE &)
 

Detailed Description

AnEnSSE is an implementation of the abstrct class AnEn for the search space extension algorithm.

Constructor & Destructor Documentation

◆ AnEnSSE() [1/3]

AnEnSSE::AnEnSSE ( )

◆ AnEnSSE() [2/3]

AnEnSSE::AnEnSSE ( const AnEnSSE orig)

◆ AnEnSSE() [3/3]

AnEnSSE::AnEnSSE ( const Config config)

◆ ~AnEnSSE()

AnEnSSE::~AnEnSSE ( )
virtual

Member Function Documentation

◆ _simsSort_()

bool AnEnSSE::_simsSort_ ( const std::array< double, 4 > &  ,
const std::array< double, 4 > &   
)
staticprotected

This is the function to sort the similarity vector based on the similarity metric from the array of length 4.

This function is static because it is called by the sorting algorithm

◆ allocateMemory_()

void AnEnSSE::allocateMemory_ ( const Forecasts forecasts,
const std::vector< std::size_t > &  fcsts_test_index,
const std::vector< std::size_t > &  fcsts_search_index 
)
overrideprotectedvirtual

Reimplemented from AnEnIS.

Reimplemented in AnEnSSEMS.

◆ checkNumberOfMembers_()

void AnEnSSE::checkNumberOfMembers_ ( std::size_t  num_search_times_index)
overrideprotectedvirtual

Reimplemented from AnEnIS.

◆ checkSave_()

void AnEnSSE::checkSave_ ( ) const
overrideprotectedvirtual

Reimplemented from AnEnIS.

◆ compute() [1/3]

void AnEnIS::compute ( const Forecasts forecasts,
const Observations observations,
const Times test_times,
const Times search_times 
)
overridevirtual

Computes the analog ensembles.

Parameters
forecastsForecasts
observationsObservations
test_timesTimes for test
search_timesTimes for search

Reimplemented from AnEnIS.

Reimplemented in AnEnSSEMS.

◆ compute() [2/3]

virtual void AnEnIS::compute ( const Forecasts forecasts,
const Observations observations,
std::vector< std::size_t > &  fcsts_test_index,
std::vector< std::size_t > &  fcsts_search_index 
)
overridevirtual

Computes the analog ensembles.

Parameters
fcsts_test_indexA vector of forecast test indices
fcsts_search_indexA vector of forecast search indices

Reimplemented from AnEnIS.

Reimplemented in AnEnSSEMS, and AnEnSSEMS.

◆ compute() [3/3]

void AnEnSSE::compute ( const Forecasts forecasts,
const Observations observations,
std::vector< std::size_t > &  fcsts_test_index,
std::vector< std::size_t > &  fcsts_search_index 
)
overridevirtual

Overloads AnEnIS::compute with test and search indices

A vector of arrays consisting of [similarity value, forecast time index, observation time index, station index]

This is used to store all similarity metrics from all search times for one test time together with indices.

Reimplemented from AnEnIS.

Reimplemented in AnEnSSEMS, AnEnSSEMS, and AnEnSSEMS.

◆ distance()

double AnEnSSE::distance ( ) const

◆ exclude_closest_location()

bool AnEnSSE::exclude_closest_location ( ) const

◆ extend_obs()

bool AnEnSSE::extend_obs ( ) const

◆ num_nearest()

size_t AnEnSSE::num_nearest ( ) const

◆ operator=()

AnEnSSE & AnEnSSE::operator= ( const AnEnSSE rhs)

◆ preprocess_()

void AnEnSSE::preprocess_ ( const Forecasts forecasts,
const Observations observations,
std::vector< std::size_t > &  fcsts_test_index,
std::vector< std::size_t > &  fcsts_search_index 
)
overrideprotectedvirtual

Reimplemented from AnEnIS.

◆ print()

void AnEnSSE::print ( std::ostream &  ) const
overridevirtual

Reimplemented from AnEnIS.

◆ save_sims_station_index()

bool AnEnSSE::save_sims_station_index ( ) const

◆ saveAnalogs_()

template<std::size_t len>
void AnEnSSE::saveAnalogs_ ( const SimsVec< len > &  sims_arr,
const Observations observations,
std::size_t  station_i,
std::size_t  test_time_i,
std::size_t  flt_i 
)
protected

◆ saveSimsStationIndex_()

template<std::size_t len>
void AnEnSSE::saveSimsStationIndex_ ( const SimsVec< len > &  sims_arr,
std::size_t  station_i,
std::size_t  test_time_i,
std::size_t  flt_i 
)
protected

◆ search_stations_index()

const Functions::Matrix & AnEnSSE::search_stations_index ( ) const

◆ setMembers_()

void AnEnSSE::setMembers_ ( const Config config)
overrideprotectedvirtual

Reimplemented from AnEnIS.

◆ sims_station_index()

const Array4DPointer & AnEnSSE::sims_station_index ( ) const

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  ,
const AnEnSSE  
)
friend

Member Data Documentation

◆ _INIT_ARR_VALUE

const array< double, 4 > AnEnSSE::_INIT_ARR_VALUE = {NAN, NAN, NAN, NAN}
static

This is the default value for similarity array

◆ _SIM_STATION_INDEX

const size_t AnEnSSE::_SIM_STATION_INDEX = 3
static

This variable defines the index of similarity station index in the similarity array.

◆ distance_

double AnEnSSE::distance_
protected

A distance threshold when finding nearest neighbors

◆ exclude_closest_location_

bool AnEnSSE::exclude_closest_location_
protected

Whether to exclude the current station from the search stations. This is helpful if users want to search through every other nearby stations rather than itself (e.g. the closest station).

◆ extend_obs_

bool AnEnSSE::extend_obs_
protected

Whether analog member observations should come from its current station or the searched station.

◆ num_nearest_

std::size_t AnEnSSE::num_nearest_
protected

The number of nearest neighbors to search

◆ save_sims_station_index_

bool AnEnSSE::save_sims_station_index_
protected

Whether to save the search station indices for each similarity

◆ search_stations_index_

Functions::Matrix AnEnSSE::search_stations_index_
protected

A table to record the search stations for each test station. Each row is a set of search station indices for a particular test station.

◆ sims_station_index_

Array4DPointer AnEnSSE::sims_station_index_
protected

The array to store search station indices.


The documentation for this class was generated from the following files: