27 double *radiance_direct,
29 bool *use_pseudo_spherical,
31 double *planet_radius,
34 double *refrac_ind_par,
38 bool *linearize_atmos_par,
39 bool *get_atmos_jacobian,
43 double *l_radiance_direct,
49 double *user_radiance_direct,
50 double *l_user_radiance_direct);
52 void rad_init(
double **tau_in_c,
double **l_tau_ind,
int *maxlay,
int *maxatm);
53 void rad_cleanup(
double *tau_in_c,
double *l_tau_ind,
int *numpar,
int *numlay );
67 const blitz::Array<double, 1>& Sza)
72 Array<double, 2> stokes_coef_v(sza.rows(), number_stokes());
74 stokes_coef_v(Range::all(), 0) = 1.0;
83 double *tau_ind, *l_tau_ind;
85 rad_init(&tau_ind,&l_tau_ind,&maxlay,&maxatm);
86 tau_in.reference(Array<double, 1>(tau_ind, shape(maxlay), neverDeleteData,
87 ColumnMajorArray<1>()));
89 l_tau_in.reference(Array<double, 2>(l_tau_ind, shape(maxatm, maxlay),
91 ColumnMajorArray<2>()));
92 atm->add_observer(*
this);
101 int numpar = l_tau_in.extent(firstDim);
102 int numlay = l_tau_in.extent(secondDim);
103 rad_cleanup(tau_in.dataFirst(), l_tau_in.dataFirst(), &numpar, &numlay);
108 return stokes_and_maybe_jacobian(Wn, Spec_index, Iv).
value();
114 return stokes_and_maybe_jacobian(Wn, Spec_index, Iv);
120 firstIndex i1; secondIndex i2; thirdIndex i3;
121 Range rlay(0,
atm->number_layer() - 1);
122 Range ra(Range::all());
124 Array<double, 3> jac_iv(0,0,0);
127 od.
reference(
atm->optical_depth_wrt_iv(Wn, Spec_index, Iv));
131 od.
reference(
atm->optical_depth_wrt_iv(Wn, Spec_index));
137 Array<double, 1> jac(jac_iv.depth());
140 tau_in(rlay) = od.
value();
143 Range rjac(0, natm_jac - 1);
144 l_tau_in(rlay, rjac) = where(od.
value()(i1) != 0,
147 int numlay =
atm->number_layer();
151 double radiance_direct = 0;
153 bool dim_reset =
true;
154 bool use_pseudo_spherical =
true;
155 bool new_scene_geo =
true;
159 blitz::Array<double, 1> zlev = temp_zlev.
value();
160 bool use_refraction =
false;
164 double refrac_ind_par = 0.000288;
167 blitz::Array<int, 1> refrac_lay_grid(numlay);
168 refrac_lay_grid = 10;
171 blitz::Array<double, 1> plev(numlay+1);
172 blitz::Array<double, 1> tlev(numlay+1);
173 int numpar = natm_jac;
175 bool linearize_atmos_par = numpar > 0;
176 blitz::Array<bool, 2> get_atmos_jacobian(numpar,numlay);
177 get_atmos_jacobian = linearize_atmos_par;
178 bool l_dim_reset =
true;
179 blitz::Array<double, 2> l_radiance_direct(numpar,numlay, blitz::ColumnMajorArray<2>());
181 bool get_user_rad =
false;
184 blitz::Array<int, 1> user_layer(n_user_rad);
185 blitz::Array<double, 1> user_tau(n_user_rad);
186 blitz::Array<double, 2> l_user_tau(numpar,n_user_rad);
187 blitz::Array<double, 1> user_radiance_direct(n_user_rad);
188 blitz::Array<double, 3> l_user_radiance_direct(numpar,numlay,n_user_rad);
196 &use_pseudo_spherical,
202 refrac_lay_grid.dataFirst(),
205 &linearize_atmos_par,
206 get_atmos_jacobian.data(),
208 l_tau_in.dataFirst(),
210 l_radiance_direct.dataFirst(),
213 user_layer.dataFirst(),
214 user_tau.dataFirst(),
215 l_user_tau.dataFirst(),
216 user_radiance_direct.dataFirst(),
217 l_user_radiance_direct.dataFirst());
219 radiance_direct *= SOLID_ANGLE;
220 l_radiance_direct = l_radiance_direct * SOLID_ANGLE;
221 for(
int i = 0; i < jac.rows(); ++i) {
223 for(
int m = 0;
m < jac_iv.rows(); ++
m)
224 for(
int n = 0; n < jac_iv.cols(); ++n) {
226 val += l_radiance_direct(n,
m) * jac_iv(
m, n, i);
244 Os <<
"RadiantDriver";
#define range_check(V, Min, Max)
Range check.
void rad_cleanup(double *tau_in_c, double *l_tau_ind, int *numpar, int *numlay)
virtual ArrayAd< double, 1 > stokes_and_jacobian_single_wn(double Wn, int Spec_index, const ArrayAd< double, 2 > &Iv) const
Calculate stokes vector and Jacobian for the given wavenumber.
virtual int number_spectrometer() const
Number of spectrometer we have.
void rad_init(double **tau_in_c, double **l_tau_ind, int *maxlay, int *maxatm)
boost::shared_ptr< RtAtmosphere > atm
This class maintains the stokes coefficient portion of the state.
void rad_direct(int *numlay, double *fsun, double *mu0, double *tau, double *radiance_direct, bool *dim_reset, bool *use_pseudo_spherical, bool *new_scene_geo, double *planet_radius, double *zlev, bool *use_refraction, double *refrac_ind_par, int *refrac_lay_grid, double *plev, double *tlev, bool *linearize_atmos_par, bool *get_atmos_jacobian, int *numpar, double *l_tau, bool *l_dim_reset, double *l_radiance_direct, bool *get_user_rad, int *n_user_rad, int *user_layer, double *user_tau, double *l_user_tau, double *user_radiance_direct, double *l_user_radiance_direct)
const DoubleWithUnit wgs84_a(6378137.0000, units::m)
Equatorial radius.
const blitz::Array< T, D+1 > jacobian() const
virtual blitz::Array< double, 1 > stokes_single_wn(double Wn, int Spec_index, const ArrayAd< double, 2 > &Iv) const
Calculate stokes vector for the given wavenumber.
const blitz::Array< T, D > & value() const
virtual void print(std::ostream &Os) const
Print to a stream.
const Unit m("m", 1.0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
int number_variable() const
DoubleWithUnit convert(const Unit &R) const
Convert to the given units.
void reference(const ArrayAd< T, D > &V)
virtual ~RadiantDriver()
Destructor.
boost::shared_ptr< StokesCoefficient > stokes_coef
Object to go from stokes vector to reflectance.
const Unit km("km", 1e3 *m)