/** \file Compute Mie scattering/attenuation using aerosol database. \author Tom Paul \version $Id$ \date 29 Jun 2005 */ #ifndef _atm_MeasuredDBMieModel_h_ #define _atm_MeasuredDBMieModel_h_ static const char CVSId_atm_MeasuredDBMieModel[] = "$Id$"; #include #include #include #include #include namespace utl { class TabulatedFunction; } namespace atm { class MeasuredDBMieModel : public atm::VMieModel { public: MeasuredDBMieModel(); virtual ~MeasuredDBMieModel() { } //! Compute scattering intensity at point at a particular angle and distance from track defined by two points /** This method computes scattered intensity (photons/area) at an angle and distance from a track. The track is defined by two points (1'st two arguments). The third and fourth argument give the angle and distance, respectively. The fifth argument specifies the wavelengths at which you wish to know the scattering. Optionally as an optimization, the fifth argument can be a precalculated AttenuationResult instead (cf. EvaluateMieAttenuation). If you use the latter form, make sure that start- and end-point match for both calculations. Note that this function is only valid for track segments which are short compared to the distance from the track to the evaluation point. */ atm::ScatteringResult EvaluateMieScattering(const utl::Point& xA, const utl::Point& xB, const double angle, const double distance, const std::vector& wLength) const; atm::ScatteringResult EvaluateMieScattering(const utl::Point& xA, const utl::Point& xB, const double angle, const double distance, const atm::AttenuationResult& mieAttenuation) const; atm::AttenuationResult EvaluateMieAttenuation(const utl::Point& xInit, const utl::Point& xFinal, const std::vector& wLength) const; double EvaluateMieScattering(const utl::Point& xA, const utl::Point& xB, const double angle, const double distance, double wLength) const; double EvaluateMieScattering(const utl::Point& xA, const utl::Point& xB, const double angle, const double distance, double wLength, const double mieAttenuation) const; double EvaluateMieAttenuation(const utl::Point& xInit, const utl::Point& xFinal, double wLength) const; double GetVerticalAerosolOpticalDepth(const unsigned int eyeId, const double altitude) const; double GetAttenuationLength(const utl::Point& p, const double wLength) const; //virtual utl::TabulatedFunctionErrors GetAttenuationLength(const utl::Point& p, //const std::vector& wLength) const = 0; double EvaluateScatteringAngle(const utl::Point& p, const double angle, const double wLength) const; /// Determine if the DB tables are full or if an update is needed bool HasData() const; /// Check for a zone in the DB (partial name match, case-insensitive) bool HasZone(const std::string& zoneName) const; /// Initialize model using an XML card void Init(); /// alter Model by nSigma standard deviations void SetUncertaintyBound(double nSigma) const; private: // returns true if some data got cached bool CheckForUpdates() const; // zone name for zone closest to specified point std::string GetZoneName(const utl::Point& pt) const; // zone name nearest to the specified eye std::string GetZoneName(const unsigned int eyeId) const; // check whether two points are in the same zone or not bool CrossesZone(const utl::Point& pt1, const utl::Point& p2) const; // set VAOD pointer according to user request fNSigma void ToggleVAODPtr() const; mutable utl::TimeStamp fCurrentTime; // containers for all zone names and positions typedef std::map ZonePosition; typedef std::pair ZonePoint; mutable ZonePosition fZonePositions; // tables with attenuation length vs. height for different zones typedef std::map ZoneFunction; mutable utl::ShadowPtr fAttVsHeightMap; mutable utl::ShadowPtr fAttLambdaVsHeightMap; mutable ZoneFunction* fVAODVsHeightMap; mutable utl::ShadowPtr fCentralVAODVsHeightMap; mutable utl::ShadowPtr fMinVAODVsHeightMap; mutable utl::ShadowPtr fMaxVAODVsHeightMap; // phase function parameters for a particular zone. Note that currently we // only support a single phase function slice. If phase function is // recorded as a function of altitude in the future, this will have to // be updated accordingly. // struct PFParameters { double f; double fErr; double g; double gErr; double fLambda; double fLambdaErr; double gLambda; double gLambdaErr; }; typedef std::map ZonePhaseFunction; mutable utl::ShadowPtr fPhaseFuncMap; mutable bool fDbIsEmptyNow; mutable double fNSigma; double fSystematicShift; // Members and functors to enable zone forcing and zone swapping enum ZoneParam { eLosLeones, eLosMorados, eLomaAmarilla, eCoihueco, eAll }; mutable ZoneParam fZoneParam; std::vector fSwapZones; class ZoneMatch : public std::binary_function { public: bool operator()(const ZonePoint& pt, const std::string& name) const; }; ZoneParam StringToZoneParam(const std::string& str) const; std::string ZoneParamToString(const ZoneParam& zone) const; REGISTER_MODEL(atm::VMieModel, "MeasuredDB", MeasuredDBMieModel); }; } // atm #endif // _atm_MeasuredDBMieModel_h_