NASA Logo
Ocean Color Science Software

ocssw V2022
get_geospatial.hpp
Go to the documentation of this file.
1 #ifndef GEO_SPATIAL_H
2 #define GEO_SPATIAL_H
3 
4 #include <iostream>
5 #include <string>
6 #include <netcdf>
7 #include <vector>
8 #include <unordered_map>
9 #include <cmath>
10 
12 private:
13  std::unordered_map<std::string, std::vector<float>> scan_line_vars;
14  std::vector<std::string> possible_sozlen_names = {"solzen", "solar_zenith_angle", "solz", "Solar Zenith Angle",
15  "csol_z", "Center Solar Zenith Angle", "center_solar_zenith_angle"};
16  float min_lon = NAN;
17  float max_lon = NAN;
18  std::string geospatial_bounds_wkt{};
19  std::string platform{};
20  std::string instrument{};
21  std::string day_night_flag{};
22  std::string time_coverage_start{};
23  std::vector<float> gringpointlatitude{}, gringpointlongitude{};
24  std::vector<float> lat, lon;
25 
26  void get_lat_lon(const netCDF::NcFile &nc_file);
27 
28  size_t number_of_lines{}, pixels_per_line{};
29  std::string geospatial_lon_min;
30 
31  std::string get_day_night_flag(const netCDF::NcFile &nc_file);
32 
33 public:
35 
36  explicit Geospatialbounds(const std::string &path_nc);
37 
38  explicit Geospatialbounds(const netCDF::NcFile &nc);
39 
40  const float *get_elat();
41 
42  const float *get_slat();
43 
44  const std::unordered_map<std::string, std::vector<float>> &get_bounds();
45 
46  std::pair<std::vector<float>, std::vector<float>> get_gring();
47 
49 
50  float get_min_lon();
51 
52  float get_max_lon();
53 
54  const std::string &get_platform() const {
55  return platform;
56  };
57 
58  const std::string &get_instrument() const {
59  return instrument;
60  };
61 
63  return day_night_flag;
64  };
65 
67  return time_coverage_start;
68  };
69 
70  static void allocate_var(std::vector<float> &, const netCDF::NcVar &var);
71 
72  static void allocate_attr(std::vector<float> &, const netCDF::NcAtt &att);
73 
74  static std::pair<std::vector<float>, std::vector<float>> calc_gring(const std::vector<float> &,
75  const std::vector<float> &,
76  const std::vector<float> &,
77  const std::vector<float> &,
78  const std::vector<float> &);
79 
80  static std::string calc_gring(const std::pair<std::vector<float>, std::vector<float>> &);
81 
82  static void calc_scan_line(const std::vector<float> &, const std::vector<float> &, size_t, size_t,
83  std::unordered_map<std::string, std::vector<float>> &);
84 };
85 
86 #endif
const std::string & get_platform() const
static void calc_scan_line(const std::vector< float > &, const std::vector< float > &, size_t, size_t, std::unordered_map< std::string, std::vector< float >> &)
static void allocate_var(std::vector< float > &, const netCDF::NcVar &var)
std::string get_bounds_wkt()
const std::string & get_time_coverage_start() const
@ string
const float * get_elat()
const std::string & get_instrument() const
const std::string & get_day_night_flag() const
const std::unordered_map< std::string, std::vector< float > > & get_bounds()
const float * get_slat()
static void allocate_attr(std::vector< float > &, const netCDF::NcAtt &att)
std::pair< std::vector< float >, std::vector< float > > get_gring()
static std::pair< std::vector< float >, std::vector< float > > calc_gring(const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &)