openModeller
Version 1.4.0
|
#include <aquamaps.hh>
Public Member Functions | |
AquaMaps () | |
~AquaMaps () | |
int | initialize () |
int | iterate () |
int | getConvergence (Scalar *const val) const |
float | getProgress () const |
int | done () const |
Scalar | getValue (const Sample &x) const |
Protected Member Functions | |
virtual void | _getConfiguration (ConfigurationPtr &) const |
virtual void | _setConfiguration (const ConstConfigurationPtr &) |
Private Member Functions | |
int | _getAndCheckParameter (std::string const &name, int *value) |
void | _calculateEnvelopes (const OccurrencesPtr &) |
void | _percentile (Scalar *result, int n, double percent, std::vector< ScalarVector > *matrix, int layerIndex) |
void | _readSpeciesData (const char *species) |
bool | _hasExpertRange (sqlite3_stmt *stmt, int varIndex) |
void | _adjustInterquartile (int layerIndex, Scalar adjmin, Scalar adjmax) |
void | _ensureEnvelopeSize (int layerIndex) |
void | _logEnvelope () |
int | _getRelatedIndex (int index) |
Private Attributes | |
int * | _use_layer |
Sample | _lower_limit |
Sample | _upper_limit |
Sample | _inner_size |
Sample | _minimum |
Sample | _maximum |
Sample | _pref_minimum |
Sample | _pref_maximum |
int | _pelagic |
int | _use_surface_layers |
bool * | _has_expert_range |
float | _progress |
AquaMaps Algorithm
Definition at line 183 of file aquamaps.hh.
Definition at line 235 of file aquamaps.cpp.
Definition at line 255 of file aquamaps.cpp.
References _has_expert_range, and _use_layer.
void AquaMaps::_adjustInterquartile | ( | int | layerIndex, |
Scalar | adjmin, | ||
Scalar | adjmax | ||
) | [private] |
Make the interquartile adjusting
Definition at line 882 of file aquamaps.cpp.
References _getRelatedIndex(), _lower_limit, _maximum, _minimum, and _upper_limit.
Referenced by _calculateEnvelopes().
void AquaMaps::_calculateEnvelopes | ( | const OccurrencesPtr & | occs | ) | [private] |
Calculate the envelopes
Definition at line 423 of file aquamaps.cpp.
References _adjustInterquartile(), _ensureEnvelopeSize(), _has_expert_range, _lower_limit, _maximum, _minimum, _percentile(), _pref_maximum, _pref_minimum, _progress, _readSpeciesData(), _upper_limit, _use_surface_layers, BOTTOM_LOWER_LIMIT, BOTTOM_UPPER_LIMIT, Log::debug(), DEPTH_LIMIT, Log::info(), Log::instance(), MAXDEPTH, MINDEPTH, SALINITY, Sample::size(), and TEMPERATURE.
Referenced by iterate().
void AquaMaps::_ensureEnvelopeSize | ( | int | layerIndex | ) | [private] |
Ensure that the envelope has a minimum size
Definition at line 899 of file aquamaps.cpp.
References _getRelatedIndex(), _inner_size, _lower_limit, _maximum, _minimum, _pref_maximum, _pref_minimum, and _upper_limit.
Referenced by _calculateEnvelopes().
int AquaMaps::_getAndCheckParameter | ( | std::string const & | name, |
int * | value | ||
) | [private] |
Get a Boolean parameter and check its value.
name | Parameter name. |
value | Parameter value. |
Definition at line 401 of file aquamaps.cpp.
References Log::error(), AlgorithmImpl::getParameter(), and Log::instance().
Referenced by initialize().
void AquaMaps::_getConfiguration | ( | ConfigurationPtr & | config | ) | const [protected, virtual] |
Reimplemented from AlgorithmImpl.
Definition at line 1111 of file aquamaps.cpp.
References _maximum, _minimum, _pelagic, _pref_maximum, _pref_minimum, _use_layer, _use_surface_layers, and done().
int AquaMaps::_getRelatedIndex | ( | int | index | ) | [private] |
Return the 0-6 index from the constants defined in this header related to the 0-8 index from the complete set of layers.
Definition at line 1187 of file aquamaps.cpp.
Referenced by _adjustInterquartile(), and _ensureEnvelopeSize().
bool AquaMaps::_hasExpertRange | ( | sqlite3_stmt * | stmt, |
int | varIndex | ||
) | [private] |
Fetch expert range data for a specific variable
Definition at line 804 of file aquamaps.cpp.
References _maximum, _minimum, _pref_maximum, _pref_minimum, DISTANCE_TO_LAND, ICE_CONCENTRATION, PRIMARY_PRODUCTION, SALINITY, and TEMPERATURE.
Referenced by _readSpeciesData().
void AquaMaps::_logEnvelope | ( | ) | [private] |
Log the bioclimatic envelopes information.
Definition at line 1171 of file aquamaps.cpp.
References _maximum, _minimum, _pref_maximum, _pref_minimum, Log::info(), Log::instance(), and Sample::size().
void AquaMaps::_percentile | ( | Scalar * | result, |
int | n, | ||
double | percent, | ||
std::vector< ScalarVector > * | matrix, | ||
int | layerIndex | ||
) | [private] |
Calculate a percentile
Definition at line 642 of file aquamaps.cpp.
Referenced by _calculateEnvelopes().
void AquaMaps::_readSpeciesData | ( | const char * | species | ) | [private] |
Read species data from expert database
Definition at line 671 of file aquamaps.cpp.
References _has_expert_range, _hasExpertRange(), _maximum, _minimum, _pelagic, _pref_maximum, _pref_minimum, Log::debug(), ICE_CONCENTRATION, Log::info(), Log::instance(), MAXDEPTH, MINDEPTH, NAME, omDataPath(), TEMPERATURE, and Log::warn().
Referenced by _calculateEnvelopes().
void AquaMaps::_setConfiguration | ( | const ConstConfigurationPtr & | config | ) | [protected, virtual] |
Reimplemented from AlgorithmImpl.
Definition at line 1132 of file aquamaps.cpp.
References _maximum, _minimum, _pelagic, _pref_maximum, _pref_minimum, _progress, _use_layer, _use_surface_layers, Log::error(), AttributeNotFound::getName(), and Log::instance().
int AquaMaps::done | ( | ) | const [virtual] |
Return != 0 if algorithm finished.
Reimplemented from AlgorithmImpl.
Definition at line 391 of file aquamaps.cpp.
References _progress.
Referenced by _getConfiguration().
int AquaMaps::getConvergence | ( | Scalar *const | val | ) | const [virtual] |
Returns the algorithm's convergence value at the moment
Reimplemented from AlgorithmImpl.
Definition at line 372 of file aquamaps.cpp.
float AquaMaps::getProgress | ( | ) | const [virtual] |
Returns progress so far (between 0.0 and 1.0)
Reimplemented from AlgorithmImpl.
Definition at line 382 of file aquamaps.cpp.
References _progress.
Scalar AquaMaps::getValue | ( | const Sample & | x | ) | const [virtual] |
The algorithm must return the occurrence probability at the given environment conditions.
x | Environmental conditions. |
Implements AlgorithmImpl.
Definition at line 959 of file aquamaps.cpp.
References _maximum, _minimum, _pelagic, _pref_maximum, _pref_minimum, _use_layer, _use_surface_layers, MAXDEPTH, MINDEPTH, SALINITY, Sample::size(), and TEMPERATURE.
int AquaMaps::initialize | ( | ) | [virtual] |
Initiate a new training.
Implements AlgorithmImpl.
Definition at line 271 of file aquamaps.cpp.
References _getAndCheckParameter(), _has_expert_range, AlgorithmImpl::_samp, _use_layer, _use_surface_layers, DISTANCE_TO_LAND, Log::error(), AlgorithmImpl::getParameter(), ICE_CONCENTRATION, Log::info(), Log::instance(), MAXDEPTH, MINDEPTH, PARAM_USE_DEPTH_RANGE, PARAM_USE_DISTANCE_TO_LAND, PARAM_USE_ICE_CONCENTRATION, PARAM_USE_PRIMARY_PRODUCTION, PARAM_USE_SALINITY, PARAM_USE_SURFACE_LAYERS, PARAM_USE_TEMPERATURE, PRIMARY_PRODUCTION, SALINITY, and TEMPERATURE.
int AquaMaps::iterate | ( | ) | [virtual] |
One step further on the training. Return 0 if something wrong happened.
Reimplemented from AlgorithmImpl.
Definition at line 359 of file aquamaps.cpp.
References _calculateEnvelopes(), AlgorithmImpl::_samp, Log::info(), and Log::instance().
bool* AquaMaps::_has_expert_range [private] |
Indicates if the variable has an expert range in the local database.
Definition at line 277 of file aquamaps.hh.
Referenced by _calculateEnvelopes(), _readSpeciesData(), initialize(), and ~AquaMaps().
Sample AquaMaps::_inner_size [private] |
Recommended values for the inner envelope sizes
Definition at line 252 of file aquamaps.hh.
Referenced by _ensureEnvelopeSize().
Sample AquaMaps::_lower_limit [private] |
Lower limit for each variable
Definition at line 246 of file aquamaps.hh.
Referenced by _adjustInterquartile(), _calculateEnvelopes(), and _ensureEnvelopeSize().
Sample AquaMaps::_maximum [private] |
Maximum value for each variable.
Definition at line 258 of file aquamaps.hh.
Referenced by _adjustInterquartile(), _calculateEnvelopes(), _ensureEnvelopeSize(), _getConfiguration(), _hasExpertRange(), _logEnvelope(), _readSpeciesData(), _setConfiguration(), and getValue().
Sample AquaMaps::_minimum [private] |
Minimum value for each variable.
Definition at line 255 of file aquamaps.hh.
Referenced by _adjustInterquartile(), _calculateEnvelopes(), _ensureEnvelopeSize(), _getConfiguration(), _hasExpertRange(), _logEnvelope(), _readSpeciesData(), _setConfiguration(), and getValue().
int AquaMaps::_pelagic [private] |
Indicates if the species is pelagic or not (-1 indicates no data). Note: pelagic means "belonging to the upper layers of the open sea" (poetic, huh?).
Definition at line 269 of file aquamaps.hh.
Referenced by _getConfiguration(), _readSpeciesData(), _setConfiguration(), and getValue().
Sample AquaMaps::_pref_maximum [private] |
Prefered maximum for each variable.
Definition at line 264 of file aquamaps.hh.
Referenced by _calculateEnvelopes(), _ensureEnvelopeSize(), _getConfiguration(), _hasExpertRange(), _logEnvelope(), _readSpeciesData(), _setConfiguration(), and getValue().
Sample AquaMaps::_pref_minimum [private] |
Prefered minimum for each variable.
Definition at line 261 of file aquamaps.hh.
Referenced by _calculateEnvelopes(), _ensureEnvelopeSize(), _getConfiguration(), _hasExpertRange(), _logEnvelope(), _readSpeciesData(), _setConfiguration(), and getValue().
float AquaMaps::_progress [private] |
Indication of progress during model creation.
Definition at line 280 of file aquamaps.hh.
Referenced by _calculateEnvelopes(), _setConfiguration(), done(), and getProgress().
Sample AquaMaps::_upper_limit [private] |
Upper limit for each variable
Definition at line 249 of file aquamaps.hh.
Referenced by _adjustInterquartile(), _calculateEnvelopes(), and _ensureEnvelopeSize().
int* AquaMaps::_use_layer [private] |
Indicates if the respective layer should be used or not when calculating probabilities
Definition at line 243 of file aquamaps.hh.
Referenced by _getConfiguration(), _setConfiguration(), getValue(), initialize(), and ~AquaMaps().
int AquaMaps::_use_surface_layers [private] |
Indicates if surface layers should be used for temperature and salinity (-1 means that aquamaps should try to find out by using depth ranges specified in its internal database).
Definition at line 274 of file aquamaps.hh.
Referenced by _calculateEnvelopes(), _getConfiguration(), _setConfiguration(), getValue(), and initialize().