All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GeostatisticalModelSpherical.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/sa/core/GeostatisticalModelSpherical.cpp
22 
23  \brief This file contains a class that represents the geostatistical spherical model.
24 
25  \reference Adapted from TerraLib4.
26 */
27 
28 // Terralib Includes
30 
32 {
34 }
35 
37 {
38 }
39 
40 boost::numeric::ublas::matrix<double> te::sa::GeostatisticalModelSpherical::calculate(boost::numeric::ublas::matrix<double> matrix)
41 {
42  //get the number of lags used
43  std::size_t nLags = matrix.size1();
44 
45  //create the model matrix
46  boost::numeric::ublas::matrix<double> m(nLags, 2);
47 
48  //fill matrix
49  std::vector<double> sphericalValues;
50 
51  for(std::size_t t= 0; t < nLags; ++t)
52  {
53  if(matrix(t, 0) == 0.)
54  {
55  sphericalValues.push_back(m_nugget);
56  }
57  else
58  {
59  sphericalValues.push_back(m_nugget + (m_sill - m_nugget) * (1.5 * (abs(matrix(t, 0)) / m_range)) - 0.5 * (pow(abs(matrix(t, 0)) / m_range, 3)));
60  }
61  m(t, 0) = matrix(t, 0);
62  m(t, 1) = sphericalValues[t];
63  }
64 
65  return m;
66 }
The empirical variogram cannot be computed at every lag distance h and due to variation in the estima...
virtual boost::numeric::ublas::matrix< double > calculate(boost::numeric::ublas::matrix< double > matrix)
Function to calculate the geostatistical information from model.
This file contains a class that represents the geostatistical spherical model.
virtual ~GeostatisticalModelSpherical()
Virtual destructor.
te::sa::GeostatisticalModelType m_type
Attribute used to define the model type used.