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

TEST: use external soil file in Sail

parent 7da18a6f
No related branches found
No related tags found
No related merge requests found
......@@ -338,3 +338,27 @@ otb_add_test(NAME siTvSoilDataParseFile COMMAND otbSimulationTestDriver otbSoilD
133
6.0800000e-001
)
otb_add_test(NAME siTvSailReflHSoilTest COMMAND otbSimulationTestDriver
--compare-ascii ${EPSILON_3} ${BASELINE_FILES}/Simulation/siTvSailReflHTest.txt
${TEMP}/siTvSailReflHTest.txt
otbSailReflHTest
30.0 #cab
10.0 #car
0.0 #CBrown
0.015 #Cw
0.009 #Cm
1.2 #N
2 #LAI
50 #Angl
1 #PSoil
70 #Skyl
0.2 #HSpot
30 #TTS
0 #TTO
0 #PSI
${TEMP}/siTvSailReflSoilHTest.txt
${INPUTDATA}/Radiometry/Soils/sols_avignon_1990.txt
20 # soil index
1000 #wlfactor
)
......@@ -29,11 +29,11 @@
int otbSailReflHTest(int argc, char * argv[])
{
if(argc != 16)
{
std::cout<<"Wrong number of arguments !"<<std::endl;
return EXIT_FAILURE;
}
if(argc < 16 || argc > 19)
{
std::cout<<"Wrong number of arguments !"<<std::endl;
return EXIT_FAILURE;
}
double Cab=static_cast<double>(atof(argv[1]));
double Car=static_cast<double>(atof(argv[2]));
......@@ -50,6 +50,17 @@ int otbSailReflHTest(int argc, char * argv[])
double TTO=static_cast<double>(atof(argv[13]));
double PSI=static_cast<double>(atof(argv[14]));
char * OutputName = argv[15];
std::string SoilFileName{};
size_t SoilIndex{0};
double WlFactor{1000};
bool UseSoilFile = false;
if(argc == 19)
{
UseSoilFile = true;
SoilFileName = argv[16];
SoilIndex = static_cast<size_t>(atoi(argv[17]));
WlFactor = static_cast<double>(atof(argv[18]));
}
typedef otb::ProspectModel ProspectType;
......@@ -81,13 +92,18 @@ int otbSailReflHTest(int argc, char * argv[])
sail->SetPSI(PSI);
sail->SetReflectance(prospect->GetReflectance());
sail->SetTransmittance(prospect->GetTransmittance());
if(UseSoilFile)
{
std::cout << "Using soil file " << SoilFileName << '\n';
sail->UseExternalSoilFile(SoilFileName, SoilIndex, WlFactor);
}
sail->Update();
std::ofstream outputFile(OutputName, std::ios::out);
for(unsigned int i=0; i<sail->GetHemisphericalReflectance()->Size(); ++i)
{
outputFile<<sail->GetHemisphericalReflectance()->GetResponse()[i].second<<std::endl;
}
{
outputFile<<sail->GetHemisphericalReflectance()->GetResponse()[i].second<<std::endl;
}
return EXIT_SUCCESS;
......
......@@ -69,3 +69,4 @@ int otbSoilDataBaseParseFile(int argc, char * argv[])
return EXIT_SUCCESS;
}
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