MeteoIODoc 20241221.207bde49
FilterKalman.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2019 Avalanche Warning Service Tyrol LWD-TIROL */
4/***********************************************************************************/
5/* This file is part of MeteoIO.
6 MeteoIO is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 MeteoIO is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef FILTERKALMAN_H
21#define FILTERKALMAN_H
22
26
27#include <string>
28#include <vector>
29
30namespace mio {
31
426 public:
427 FilterKalman(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& name, const Config& cfg);
428 virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
429 std::vector<MeteoData>& ovec);
430 private:
431 Matrix buildInitialStates(const std::vector<std::string>& xx_str, const std::vector<size_t>& meas_idx,
432 const std::vector<MeteoData>& ivec, const size_t& nr_observations) const;
433 size_t buildObservationsMatrix(const unsigned int& param, const std::vector<MeteoData>& ivec, const size_t& nx,
434 Matrix& zz, std::vector<size_t>& meas_idx) const;
435 Matrix buildControlSignal(const size_t& nx, const size_t& TT, const std::vector<MeteoData>& ivec) const;
436 Matrix parseMatrix(const std::string& line, const size_t& rows, const size_t& cols,
437 const std::string& block) const;
438 std::vector<std::string> parseSystemMatrix(const std::string& line, const size_t& rows) const;
439 Matrix buildSystemMatrix(const std::vector<std::string>& AA_str, const size_t& sz, const double& dt,
440 const std::vector<MeteoData>& ivec, const size_t& kk) const;
441 double substitute(const std::string& expr, const double& dt, const std::vector<MeteoData>& ivec, const size_t& kk) const;
442 Matrix extractInputMatrix(const std::vector<std::string>& vecParams, const std::vector<MeteoData>& mvec,
443 const size_t& kk) const;
444 void assertInputCovariances(const std::vector<MeteoData>& ivec, const size_t& nx, bool& has_RR_params,
445 bool& has_QQ_params) const;
446 Matrix bloatMatrix(const std::string& line, const size_t& rows, const size_t& cols, const std::string& block) const;
447 std::vector<double> buildTimeVector(const std::vector<MeteoData>& ivec) const;
448 bool checkNodata(const Matrix& ivec) const;
449 bool findFirstDatapoint(const std::vector<MeteoData>& ivec, const size_t& param, double& retval) const;
450 void parse_args(const std::vector< std::pair<std::string, std::string> >& vecArgs);
451 void cleanBrackets(std::string& iline) const;
452
453 std::string mat_in_xx, mat_in_AA, mat_in_HH, mat_in_PP, mat_in_QQ, mat_in_RR, mat_in_BB, mat_in_uu;
454 std::vector<std::string> meas_params; //parameter names of observations
455 std::vector<std::string> error_params; //output PP to these parameters
456 std::vector<std::string> QQ_params, RR_params; //input QQ and RR from these parameters
457
458 bool filter_all_params; //filter only the parameter the filter runs on or all the ones used?
459 bool out_error_stddev; //take the sqrt of error estimation
460
461 bool be_verbose; //output warnings/info?
462 std::string unrecognized_keys; //to warn about unknown ini keys
463};
464
465} //namespace
466
467#endif //FILTERKALMAN_H
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:79
A statistical filter for state likelihood estimation: the Kalman filter.
Definition: FilterKalman.h:425
FilterKalman(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const Config &cfg)
Definition: FilterKalman.cc:25
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)
The filtering routine as called by the processing toolchain.
Definition: FilterKalman.cc:44
This class implements the basic operations on matrices. Elements are access in matrix notation: that ...
Definition: Matrix.h:42
The base class for all filters that provides the interface and a few helper methods.
Definition: ProcessingBlock.h:67
Definition: Config.cc:31