OTB  9.0.0
Orfeo Toolbox
otbAeronetFileReader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbAeronetFileReader_h
22 #define otbAeronetFileReader_h
23 
24 #include <string>
25 #include <vector>
26 
27 #include "OTBOpticalCalibrationExport.h"
28 
29 #include "itkProcessObject.h"
30 
31 namespace otb
32 {
33 
34 class AeronetData;
35 
41 class OTBOpticalCalibration_EXPORT AeronetFileReaderException : public itk::ExceptionObject
42 {
43 public:
45  itkTypeMacro(AeronetFileReaderException, ExceptionObject);
46 
48  AeronetFileReaderException(const char* file, unsigned int line, const char* message = "Error in Radiometry IO", const char* loc = "Unknown")
49  : ExceptionObject(file, line, message, loc)
50  {
51  }
52 
54  AeronetFileReaderException(const std::string& file, unsigned int line, const char* message = "Error in Radiometry IO", const char* loc = "Unknown")
55  : ExceptionObject(file, line, message, loc)
56  {
57  }
58 };
60 
81 class OTBOpticalCalibration_EXPORT AeronetFileReader : public itk::ProcessObject
82 {
83 public:
84 
87  typedef itk::ProcessObject Superclass;
88  typedef itk::SmartPointer<Self> Pointer;
89  typedef itk::SmartPointer<const Self> ConstPointer;
90 
92  itkNewMacro(Self);
93 
95  itkTypeMacro(AeronetFileReader, itk::ProcessObject);
96 
98  virtual AeronetData* GetOutput(void);
99 
101  itkSetStringMacro(FileName);
102 
104  itkGetStringMacro(FileName);
105 
107  itkSetMacro(Day, int);
108  itkGetMacro(Day, int);
110 
112  itkSetMacro(Month, int);
113  itkGetMacro(Month, int);
115 
117  itkSetMacro(Year, int);
118  itkGetMacro(Year, int);
120 
122  itkSetMacro(Hour, int);
123  itkGetMacro(Hour, int);
125 
127  itkSetMacro(Minute, int);
128  itkGetMacro(Minute, int);
130 
132  itkSetMacro(Epsilon, double);
133  itkGetMacro(Epsilon, double);
135 
136 protected:
139 
141  ~AeronetFileReader() override;
142 
144  void GenerateData() override;
145 
147  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
148 
149 private:
151  typedef std::vector<std::string> VectorString;
152  typedef std::vector<double> VectorDouble;
153  typedef std::vector<VectorString> MatrixString;
154 
156  VectorString ParseLine(const std::string& line) const;
157 
161  void ParseValidLine(const double& ref_date, const VectorString& line, const double& epsilon, VectorDouble& water, VectorDouble& angst, VectorDouble& tau_day,
162  VectorDouble& solarZenithAngle) const;
163 
167  void GetStatistics(const VectorDouble& vec, double& mean, double& stddev) const;
168 
170  std::string m_FileName;
171 
173  int m_Day;
174 
176  int m_Month;
177 
179  int m_Year;
180 
182  int m_Hour;
183 
185  int m_Minute;
186 
188  double m_Epsilon;
189 };
190 }
191 
192 #endif
otb::AeronetFileReader::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbAeronetFileReader.h:89
otb::AeronetFileReader::VectorDouble
std::vector< double > VectorDouble
Definition: otbAeronetFileReader.h:152
otb::mean
Definition: otbParserXPlugins.h:261
otb::AeronetFileReader
This class reads a Aeronet data from an Aeronet file.
Definition: otbAeronetFileReader.h:81
otb::AeronetFileReader::Superclass
itk::ProcessObject Superclass
Definition: otbAeronetFileReader.h:87
otb::AeronetFileReader::m_FileName
std::string m_FileName
Definition: otbAeronetFileReader.h:170
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::AeronetFileReader::m_Month
int m_Month
Definition: otbAeronetFileReader.h:176
otb::AeronetFileReader::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbAeronetFileReader.h:88
otb::AeronetFileReader::Self
AeronetFileReader Self
Definition: otbAeronetFileReader.h:86
otb::AeronetFileReaderException::AeronetFileReaderException
AeronetFileReaderException(const std::string &file, unsigned int line, const char *message="Error in Radiometry IO", const char *loc="Unknown")
Definition: otbAeronetFileReader.h:54
otb::AeronetFileReaderException
Base exception class for Aeronet problems during reading.
Definition: otbAeronetFileReader.h:41
otb::AeronetData
This class is a data structure designed to store Aeronet data extracted from a aeronet file.
Definition: otbAeronetData.h:41
otb::AeronetFileReader::m_Minute
int m_Minute
Definition: otbAeronetFileReader.h:185
otb::AeronetFileReader::m_Hour
int m_Hour
Definition: otbAeronetFileReader.h:182
otb::AeronetFileReader::m_Day
int m_Day
Definition: otbAeronetFileReader.h:173
otb::AeronetFileReaderException::AeronetFileReaderException
AeronetFileReaderException(const char *file, unsigned int line, const char *message="Error in Radiometry IO", const char *loc="Unknown")
Definition: otbAeronetFileReader.h:48
otb::AeronetFileReader::MatrixString
std::vector< VectorString > MatrixString
Definition: otbAeronetFileReader.h:153
otb::AeronetFileReader::VectorString
std::vector< std::string > VectorString
Definition: otbAeronetFileReader.h:151
otb::AeronetFileReader::m_Epsilon
double m_Epsilon
Definition: otbAeronetFileReader.h:188
otb::AeronetFileReader::m_Year
int m_Year
Definition: otbAeronetFileReader.h:179