ReFRACtor
level_1b_cache.h
Go to the documentation of this file.
1 #ifndef LEVEL_1B_CACHE_H
2 #define LEVEL_1B_CACHE_H
3 #include "level_1b.h"
4 #include <vector>
5 namespace FullPhysics {
6 /****************************************************************/
12 class Level1bCache: public Level1b {
13 public:
14  Level1bCache(const Level1b& L1_in);
15  virtual ~Level1bCache() {}
16  virtual void print(std::ostream& Os) const {Os << "Level1bCache";}
17  virtual int number_spectrometer() const { return (int) lat.size(); }
18  virtual DoubleWithUnit latitude(int i) const
19  {
21  return lat[i];
22  }
23 
24 //-----------------------------------------------------------------------
26 //-----------------------------------------------------------------------
27 
28  void set_latitude(int i, const DoubleWithUnit& V)
29  {
31  lat[i] = V;
32  }
33  virtual DoubleWithUnit longitude(int i) const
34  {
36  return lon[i];
37  }
38 
39 //-----------------------------------------------------------------------
41 //-----------------------------------------------------------------------
42 
43  void set_longitude(int i, const DoubleWithUnit& V)
44  {
46  lon[i] = V;
47  }
48  virtual DoubleWithUnit sounding_zenith(int i) const
49  {
51  return szen[i];
52  }
53 
54 //-----------------------------------------------------------------------
56 //-----------------------------------------------------------------------
57 
58  void set_sounding_zenith(int i, const DoubleWithUnit& V)
59  {
61  szen[i] = V;
62  }
63  virtual DoubleWithUnit sounding_azimuth(int i) const
64  {
66  return sazm[i];
67  }
68 
69 //-----------------------------------------------------------------------
71 //-----------------------------------------------------------------------
72 
73  void set_sounding_azimuth(int i, const DoubleWithUnit& V)
74  {
76  sazm[i] = V;
77  }
78  virtual DoubleWithUnit solar_zenith(int i) const
79  {
81  return solzen[i];
82  }
83 
84 //-----------------------------------------------------------------------
86 //-----------------------------------------------------------------------
87 
88  void set_solar_zenith(int i, const DoubleWithUnit& V)
89  {
91  solzen[i] = V;
92  }
93  virtual DoubleWithUnit solar_azimuth(int i) const
94  {
96  return solazm[i];
97  }
98 
99 //-----------------------------------------------------------------------
101 //-----------------------------------------------------------------------
102 
103  void set_solar_azimuth(int i, const DoubleWithUnit& V)
104  {
106  solazm[i] = V;
107  }
108  virtual DoubleWithUnit altitude(int i) const
109  {
111  return alt[i];
112  }
113 
114 //-----------------------------------------------------------------------
116 //-----------------------------------------------------------------------
117 
118  void set_altitude(int i, const DoubleWithUnit& V)
119  {
121  alt[i] = V;
122  }
123  virtual DoubleWithUnit relative_velocity(int i) const
124  {
126  return rvel[i];
127  }
128 
129 //-----------------------------------------------------------------------
131 //-----------------------------------------------------------------------
132 
133  void set_relative_velocity(int i, const DoubleWithUnit& V)
134  {
136  rvel[i] = V;
137  }
138  virtual blitz::Array<double, 1> stokes_coefficient(int i) const
139  {
141  return stk_coeff[i];
142  }
143 
144 //-----------------------------------------------------------------------
146 //-----------------------------------------------------------------------
147 
148  void set_stokes_coefficient(int i, const blitz::Array<double, 1>& V)
149  {
151  stk_coeff[i].reference(V.copy());
152  }
153 
155  {
157  return samp_grid[i];
158  }
159 
160 //-----------------------------------------------------------------------
162 //-----------------------------------------------------------------------
163 
164  void set_sample_grid(int i, const SpectralDomain& V)
165  {
167  samp_grid[i] = V;
168  }
169 
170  virtual Time time(int i) const
171  {
173  return tm[i];
174  }
175 
176 //-----------------------------------------------------------------------
178 //-----------------------------------------------------------------------
179 
180  void set_time(int i, const Time& V)
181  {
183  tm[i] = V;
184  }
185  virtual SpectralRange radiance(int i) const
186  {
188  return rad[i];
189  }
190 
191 //-----------------------------------------------------------------------
193 //-----------------------------------------------------------------------
194 
195  void set_radiance(int i, const SpectralRange& V)
196  {
198  rad[i] = V;
199  }
200 
201 //-----------------------------------------------------------------------
204 //-----------------------------------------------------------------------
205 
206  void set_radiance(int i, const SpectralRange& V,
207  const std::vector<int>& Plist)
208  {
210  if(V.data().rows() != (int) Plist.size())
211  throw Exception("Spectral Range is not the same size as Plist");
212  blitz::Array<double, 1> rnew = rad[i].data().copy();
213  blitz::Array<double, 1> unew = rad[i].uncertainty().copy();
214  for(int j = 0; j < (int) Plist.size(); ++j) {
215  rnew(Plist[j]) = V.data()(j);
216  unew(Plist[j]) = V.uncertainty()(j);
217  }
218  rad[i] = SpectralRange(rnew, V.units(), unew);
219  }
220 
221 private:
222  std::vector<DoubleWithUnit> lat, lon, szen, sazm, solzen, solazm, alt,
223  rvel;
224  std::vector<blitz::Array<double, 1> > stk_coeff;
225  std::vector<SpectralDomain> samp_grid;
226  std::vector<Time> tm;
227  std::vector<SpectralRange> rad;
228 };
229 }
230 #endif
#define range_check(V, Min, Max)
Range check.
Definition: fp_exception.h:140
void set_altitude(int i, const DoubleWithUnit &V)
Change value.
virtual DoubleWithUnit latitude(int i) const
Latitude.
void set_time(int i, const Time &V)
Change value.
For different instruments, it is more natural to either work with wavenumbers (e.g., GOSAT) or wavelength (e.g., OCO).
virtual SpectralRange radiance(int i) const
Radiance, for given spectral band.
virtual DoubleWithUnit longitude(int i) const
Longitude.
void set_sample_grid(int i, const SpectralDomain &V)
Change value.
This is the base of the exception hierarchy for Full Physics code.
Definition: fp_exception.h:16
Level1bCache(const Level1b &L1_in)
Constructor.
This is used to read a Level 1B file.
Definition: level_1b.h:15
SpectralDomain sample_grid(int i) const
Returns the sample grid (ie wavenumber, wavelength, etc) for the corresponding radiance values...
virtual DoubleWithUnit solar_azimuth(int i) const
Solar azimuth.
void set_stokes_coefficient(int i, const blitz::Array< double, 1 > &V)
Change value.
This is a Level1b implementation that just saves the data read from another Level1b object...
const Unit & units() const
Units of data.
const blitz::Array< double, 1 > & uncertainty() const
Uncertainty.
void set_radiance(int i, const SpectralRange &V)
Change value.
void set_solar_azimuth(int i, const DoubleWithUnit &V)
Change value.
We frequently have a double with units associated with it.
void set_radiance(int i, const SpectralRange &V, const std::vector< int > &Plist)
Change value, but only for a subset of pixels.
void set_sounding_zenith(int i, const DoubleWithUnit &V)
Change value.
We have a number of different spectrums that appear in different parts of the code.
void set_relative_velocity(int i, const DoubleWithUnit &V)
Change value.
virtual DoubleWithUnit altitude(int i) const
Altitude.
void set_longitude(int i, const DoubleWithUnit &V)
Change value.
virtual DoubleWithUnit sounding_azimuth(int i) const
Sounding azimuth.
virtual void print(std::ostream &Os) const
Print description of object.
This is a simple time class.
Definition: fp_time.h:29
void set_latitude(int i, const DoubleWithUnit &V)
Change value.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual int number_spectrometer() const
Number of spectrometers.
virtual DoubleWithUnit relative_velocity(int i) const
Relative velocity.
void set_sounding_azimuth(int i, const DoubleWithUnit &V)
Change value.
void set_solar_zenith(int i, const DoubleWithUnit &V)
Change value.
virtual Time time(int i) const
Time of sounding.
virtual DoubleWithUnit solar_zenith(int i) const
Solar zenith.
virtual blitz::Array< double, 1 > stokes_coefficient(int i) const
Return stokes coefficients.
const blitz::Array< double, 1 > & data() const
Underlying data.
virtual DoubleWithUnit sounding_zenith(int i) const
Sounding zenith.

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:09