/** \file Compute FD pixel cloud coverage using the Lidar/Cloudcam databases. \author Segev BenZvi \version $Id: LidarCloudDBModel.h 20705 2012-03-28 16:20:59Z javierg $ \date 15 Aug 2007 */ #ifndef _atm_LidarCloudDBModel_h_ #define _atm_LidarCloudDBModel_h_ static const char CVSId_atm_LidarCloudDBModel[] = "$Id: LidarCloudDBModel.h 20705 2012-03-28 16:20:59Z javierg $"; #include #include #include namespace atm { /** \class LidarCloudDBModel \brief Class for cloud coverage calculations. This model is a facade for low-level objects that are used to access cloud data from the lidar and cloud camera databases. The purpose of this class is to hide the details of the cloud database access code, which is dispersed between the LidarDB and fdet::Telescope classes, and give users the coverage status of a given fdet::Pixel. Specifically, it will determine whether or not a cloud lies along the line of sight between a fdet::Pixel and a particular utl::Point in the Atmosphere. The model differs slightly from other atmospheric models in that it does not generally throw exceptions when cloud data are not found. This is because there are several possible uses for cloud data, even if lidar and cloud camera results are not simultaneously available. The two data sets contain complementary information: the lidar DB contains accurate cloud heights but coarse coverage information, and the cloud DB contains accurate coverage information but no cloud heights. These data can be used together or separately. When the user queries the obscuration between a fdet::Pixel and a utl::Point in the Atmosphere, the following checks are performed:
  1. The minimum cloud base height around the telescope is checked. If the utl::Point is below this minimum height, the fdet::Pixel is treated as unobscured (a clear CloudResult is returned).
  2. If the utl::Point is above the minimum cloud base height, then the fdet::Pixel could be obscured. In this case, the cloud DB is checked and the coverage is returned (if there are data for this period).
By checking the coverage this way, expensive queries to the MySQL databases are minimized. Note that if there are no lidar data, the cloud coverage is still checked, though the absence of lidar data will be flagged within the CloudResult. In this way, clouds along the fdet::Pixel line of sight could be identified, although the clouds might be well above the altitudes of interest for a given event. Cloud cuts performed in the absence of lidar data, though still valid, should therefore be considered very conservative. \author Segev BenZvi \date 17 Jul 2007 \ingroup atm_models */ class LidarCloudDBModel : public atm::VCloudModel { public: LidarCloudDBModel(); virtual ~LidarCloudDBModel(); /// Evaluate coverage for a pixel with some Eye, Telescope, and Pixel ID. CloudResult EvaluateCloudCoverage(const unsigned int eyeId, const unsigned int telescopeId, const unsigned int pixelId, const utl::Point& x) const; bool HasData() const; void Init(); private: // Check for cached lidar data; return true if found. bool CheckForUpdates() const; // Get the LidarZone closest to the current Eye. std::string GetZoneName(const unsigned int eyeId) const; // Get the LidarZone closest to a point in the sky. std::string GetZoneName(const utl::Point& x) const; // Container for LidarZone cloud bases. mutable std::map< std::string, double >* fCloudHeightMap; // Container for LidarZone positions. mutable std::map< std::string, utl::Point > fZonePositions; mutable utl::TimeStamp fCurrentTime; mutable bool fLidarDbIsEmptyNow; REGISTER_MODEL(atm::VCloudModel, "LidarCloudDB", LidarCloudDBModel); }; } // atm #endif // _atm_LidarCloudDBModel_h_