OTB  10.0.0
Orfeo Toolbox
otbAeronetFileReader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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
This class is a data structure designed to store Aeronet data extracted from a aeronet file.
Base exception class for Aeronet problems during reading.
AeronetFileReaderException(const std::string &file, unsigned int line, const char *message="Error in Radiometry IO", const char *loc="Unknown")
AeronetFileReaderException(const char *file, unsigned int line, const char *message="Error in Radiometry IO", const char *loc="Unknown")
This class reads a Aeronet data from an Aeronet file.
itk::SmartPointer< const Self > ConstPointer
void GetStatistics(const VectorDouble &vec, double &mean, double &stddev) const
std::vector< VectorString > MatrixString
void GenerateData() override
~AeronetFileReader() override
std::vector< std::string > VectorString
void ParseValidLine(const double &ref_date, const VectorString &line, const double &epsilon, VectorDouble &water, VectorDouble &angst, VectorDouble &tau_day, VectorDouble &solarZenithAngle) const
itk::ProcessObject Superclass
VectorString ParseLine(const std::string &line) const
virtual AeronetData * GetOutput(void)
std::vector< double > VectorDouble
itk::SmartPointer< Self > Pointer
void PrintSelf(std::ostream &os, itk::Indent indent) const override
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.