Skip to content
Snippets Groups Projects
Commit 985bba47 authored by Jordi Inglada's avatar Jordi Inglada
Browse files

ENH: use external soil file

parent ad0ccd57
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,8 @@
#include "otbSpectralResponse.h"
#include "otbDataSpecP5B.h"
#include "otbSimulationStep2Base.h"
#include "otbSoilDataBase.h"
#include <string>
namespace otb
{
......@@ -100,6 +102,18 @@ class OTBSimulation_EXPORT SailModel : public SimulationStep2Base
itkSetMacro(PSI, double);
itkGetMacro(PSI, double);
/** Use an external soil file */
itkSetMacro(UseSoilFile, bool);
itkGetMacro(UseSoilFile, bool);
/** External soil file name */
itkSetMacro(SoilFileName, std::string);
itkGetMacro(SoilFileName, std::string);
/** Index of the soil in the external soil file */
itkSetMacro(SoilIndex, size_t);
itkGetMacro(SoilIndex, size_t);
/** Get the computed fcover */
itkGetMacro(FCoverView, double);
......@@ -139,7 +153,7 @@ class OTBSimulation_EXPORT SailModel : public SimulationStep2Base
/** Volscatt */
void Volscatt(const double tts, const double tto, const double psi, const double ttl, VectorType &result);
private:
private:
SailModel(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
......@@ -152,6 +166,10 @@ class OTBSimulation_EXPORT SailModel : public SimulationStep2Base
double m_TTO; //observer zenith angle
double m_PSI; //azimuth
double m_FCoverView; //fCover in the viewing direction
bool m_UseSoilFile; //use a soil file instead of DataSpecP5B
std::string m_SoilFileName; //the soil file to use
size_t m_SoilIndex; //which soil in the soil file
soildata::SoilDataBase m_SoilDataBase;
};
}// end namespace otb
......
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbSoilDataBase_h
#define otbSoilDataBase_h
#include <vector>
#include <unordered_map>
namespace otb
{
namespace soildata
{
//wavelength in nm
using WavelenghtType = unsigned int;
using SoilData = std::unordered_map<WavelenghtType, double>;
using SoilDataBase = std::vector<SoilData>;
void ParseSoilFile(std::string SoilFileName, SoilDataBase& db);
}
}
#endif /* otbSoilDataBase_h */
......@@ -53,6 +53,7 @@ otbSailReflVTest.cxx
otbSatelliteRSRNew.cxx
otbSailReflHTest.cxx
otbFilterFunctionValues.cxx
otbSoilDBTest.cxx
)
add_executable(otbSimulationTestDriver ${OTBSimulationTests})
......@@ -318,3 +319,5 @@ otb_add_test(NAME raTuFilterFunctionValuesTest COMMAND otbSimulationTestDriver
0.05 # user step
0.2 0.5 0.3 0.9 0.8 # vector
)
otb_add_test(NAME siTvSoilDataParseFile COMMAND otbSimulationTestDriver otbSoilDataBaseParseFile)
......@@ -50,4 +50,5 @@ void RegisterTests()
REGISTER_TEST(otbSailReflHTest);
REGISTER_TEST(otbFilterFunctionValuesSpectralResponseTest);
REGISTER_TEST(otbFilterFunctionValuesTest);
REGISTER_TEST(otbSoilDataBaseParseFile);
}
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "otbMacro.h"
#include "otbSoilDataBase.h"
#include <iostream>
int otbSoilDataBaseParseFile(int argc, char * argv[])
{
return EXIT_FAILURE;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment