VZone.h
Go to the documentation of this file.
1 #ifndef _atm_VZone_h_
2 #define _atm_VZone_h_
3 
4 #include <det/Detector.h>
5 #include <utl/ErrorLogger.h>
6 #include <utl/AugerException.h>
7 
8 #include <string>
9 #include <vector>
10 
11 
12 namespace atm {
13 
28  class VZone {
29 
30  public:
32  const std::string& GetName() const { return fName; }
33 
35  double GetNorthing() const { return fNorthing; }
36 
38  double GetEasting() const { return fEasting; }
39 
40  protected:
41  VZone(const std::string& zoneId, const std::string& name,
42  const double northing, const double easting) :
43  fZoneIdString(zoneId),
44  fName(name),
45  fNorthing(northing),
46  fEasting(easting)
47  { }
48 
49  virtual ~VZone() { }
50 
51  std::string fZoneIdString;
52  std::string fName;
53  double fNorthing;
54  double fEasting;
55 
56  // Cache the slices in this zone (fills data on zone slice boundaries and
57 
58  template<typename Slice>
59  void
60  CacheSlices(std::vector<const Slice*>*& slices, // vector of zone slices to be filled in by this method
61  const std::string& database, // eg. aerosol, molecular, lidar
62  const std::string& property, // eg. attenuation, phase_func, molecular, VAOD from lidar
63  const std::string& zone, // id for the wanted aerosol, molecular, lidar zone slices
64  const det::VManager& manager) // specify which manager (or manager register) to use
65  const
66  {
67  if (slices)
68  return;
69  slices = new std::vector<const Slice*>;
70 
71  std::vector<std::string> propertyIdVec;
72  const std::string propertyId = property + "_id";
73  const det::VManager::IndexMap zoneSelect({ { database + "_zone_id", zone } });
74  const auto stat = manager.GetData(propertyIdVec, property, propertyId, zoneSelect);
75 
76  if (stat == det::VManager::eNotFound) {
77  std::ostringstream err;
78  err << "Did not find requested data, "
79  "header table: " << database << ", "
80  "slice table name: " << property << ", "
81  "zoneId: " << zone;
82  ERROR(err);
83  throw utl::NonExistentComponentException(err.str());
84  }
85 
86  for (const auto& pId : propertyIdVec) {
87  std::string zoneSlicesId;
88  const det::VManager::IndexMap idSelect({ { propertyId, pId } });
89  manager.GetData(zoneSlicesId, property, "zone_slices_id", idSelect);
90 
91  const det::VManager::IndexMap zoneSlicesSelect({ { "zone_slices_id", zoneSlicesId } });
92 
93  double minHeight = 0;
94  manager.GetData(minHeight, "zone_slices", "min_height", zoneSlicesSelect);
95 
96  double maxHeight = 0;
97  manager.GetData(maxHeight, "zone_slices", "max_height", zoneSlicesSelect);
98 
99  slices->push_back(new Slice(database, zoneSlicesId, zone, minHeight, maxHeight));
100  }
101  }
102 
103  };
104 
105 }
106 
107 
108 #endif
virtual ~VZone()
Definition: VZone.h:49
const std::string & GetName() const
Zone name.
Definition: VZone.h:32
Base class for exceptions trying to access non-existing components.
double fNorthing
Definition: VZone.h:53
Interface for detector managers.
Definition: VManager.h:115
virtual Status GetData(double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
Base class for Aerosol, Molecula, Overall Quality and Lidar atmosphere zones.
Definition: VZone.h:28
VZone(const std::string &zoneId, const std::string &name, const double northing, const double easting)
Definition: VZone.h:41
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
double GetNorthing() const
Northing for the zone.
Definition: VZone.h:35
double fEasting
Definition: VZone.h:54
std::string fName
Definition: VZone.h:52
double GetEasting() const
Easting for the zone.
Definition: VZone.h:38
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
std::string fZoneIdString
Definition: VZone.h:51
void CacheSlices(std::vector< const Slice * > *&slices, const std::string &database, const std::string &property, const std::string &zone, const det::VManager &manager) const
Definition: VZone.h:60

, generated on Tue Sep 26 2023.