NASA Logo
Ocean Color Science Software

ocssw V2022
RuntimeAttributes.hpp
Go to the documentation of this file.
1 #ifndef RUNTIMEATTRIBUTES
2 #define RUNTIMEATTRIBUTES
3 #include <focs/DataProvider.hpp>
4 #include <focs/Product.hpp>
5 #include <functional>
6 #include <optional>
7 #include <stack>
8 namespace focs {
9 
11  protected:
12  std::unordered_map<std::string, focs::BaseVariable *> available_products;
16  std::vector<std::string> needed_products{};
18  void check_needs();
19 
20  public:
22  RuntimeAttribute() = default;
24  DataProviderConfiguration &configuration);
25  const std::string &get_name() const { return _run_time_name; };
26  const std::string &get_grp_name() const { return _group_name; };
27  std::unique_ptr<RuntimeAttribute> init_attribute(
28  const std::string &name, DataProviderConfiguration &configuration);
29  virtual ~RuntimeAttribute() = default;
30 };
31 
33  private:
34  std::vector<float> gringpointlatitude{};
35  std::vector<float> gringpointlongitude{};
36  std::vector<int32_t> gringpointsequence{};
37  std::vector<std::vector<float>> geobox{};
38  std::string geospatial_bounds; // wkt format
39  std::optional<float> last_lat;
40  size_t geobox_cnt{0};
41  float geo_box_lat_lim{20.0f};
42  void set_gring();
43 
44  public:
45  GroundControlPoints() = default;
47  void geo_box(TileParameters& tile);
51  void set_geobounds();
52 };
53 
55  private:
56  // enum daytime { DAY = 'Day', NIGHT = 'Night', MIXED = 'Mixed', UNKNOWN =
57  // 'Unknown' };
58  std::string state{"Unknown"};
59  float solzen_night = 90;
60  std::string get_daytime(float solzen) {
61  if (solzen > solzen_night)
62  return "Night";
63  else
64  return "Day";
65  }
66 
67  public:
68  DayNightAttribute() = default;
70  void scan_solzen();
71  void set_flag() { a_value_ = state; }
72 
73  // {"Day", "Night", "Mixed", "Unknown"};
74 };
75 
77  private:
78  float min_lat{90.0f}, max_lat{-90.0f}, min_lon{180.f}, max_lon{-180.0f};
79  std::unordered_map<std::string, float> geospatial_bounds{};
80  template <typename T>
81  std::pair<T, T> find_min_max(const std::vector<T> &vec) {
82  T max_ = *std::max_element(vec.begin(), vec.end());
83  T min_ = *std::min_element(vec.begin(), vec.end());
84  return {max_, min_};
85  }
86 
87  public:
88  GeoSpatialBounds() = default;
90  void scan_lat_lon();
91  void set_file_attrs(std::function<void(focs::Attribute)> set_attrs);
92 };
93 } // namespace focs
94 
95 #endif
void set_file_attrs(std::function< void(focs::Attribute)> set_attrs)
@ string
void geo_box(TileParameters &tile)
virtual ~RuntimeAttribute()=default
const std::string & name() const
Definition: Product.hpp:198
std::vector< std::string > needed_products
const std::string & get_name() const
std::unique_ptr< RuntimeAttribute > init_attribute(const std::string &name, DataProviderConfiguration &configuration)
const std::string & get_grp_name() const
std::unordered_map< std::string, focs::BaseVariable * > available_products