Line data Source code
1 : /*******************************************************************************
2 : * ALMA - Atacama Large Millimiter Array
3 : * (c) Instituto de Estructura de la Materia, 2009
4 : *
5 : * This library is free software; you can redistribute it and/or
6 : * modify it under the terms of the GNU Lesser General Public
7 : * License as published by the Free Software Foundation; either
8 : * version 2.1 of the License, or (at your option) any later version.
9 : *
10 : * This library is distributed in the hope that it will be useful,
11 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 : * Lesser General Public License for more details.
14 : *
15 : * You should have received a copy of the GNU Lesser General Public
16 : * License along with this library; if not, write to the Free Software
17 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 : *
19 : * "@(#) $Id: ATMRefractiveIndexProfile.cpp Exp $"
20 : *
21 : * who when what
22 : * -------- -------- ----------------------------------------------
23 : * pardo 24/03/09 created
24 : */
25 :
26 : #include "ATMRefractiveIndexProfile.h"
27 :
28 : #include <iostream>
29 : #include <math.h>
30 : #include <string>
31 : #include <vector>
32 :
33 :
34 :
35 : ATM_NAMESPACE_BEGIN
36 :
37 : // Constructors
38 :
39 0 : RefractiveIndexProfile::RefractiveIndexProfile(const Frequency &freq,
40 0 : const AtmProfile &atmProfile) :
41 0 : AtmProfile(atmProfile), SpectralGrid(freq)
42 : {
43 0 : mkRefractiveIndexProfile();
44 0 : }
45 :
46 864 : RefractiveIndexProfile::RefractiveIndexProfile(const SpectralGrid &spectralGrid,
47 864 : const AtmProfile &atmProfile) :
48 864 : AtmProfile(atmProfile), SpectralGrid(spectralGrid)
49 : {
50 864 : mkRefractiveIndexProfile();
51 864 : }
52 :
53 1112 : RefractiveIndexProfile::RefractiveIndexProfile(const RefractiveIndexProfile & a) : AtmProfile(a), SpectralGrid(a)
54 : {
55 : // std::cout<<"Enter RefractiveIndexProfile copy constructor version Fri May 20 00:59:47 CEST 2005"<<endl;
56 :
57 : // level AtmProfile
58 :
59 : // type_ = a.type_;
60 : // prLimit_ = a.prLimit_;
61 : /*
62 : v_hx_.reserve(a.v_hx_.size());
63 : v_px_.reserve(a.v_px_.size());
64 : v_tx_.reserve(a.v_tx_.size());
65 : for(unsigned int n=0; n<a.v_hx_.size(); n++){
66 : v_hx_.push_back(a.v_hx_[n]);
67 : v_px_.push_back(a.v_px_[n]);
68 : v_tx_.push_back(a.v_tx_[n]);
69 : }
70 : */
71 :
72 1112 : typeAtm_ = a.typeAtm_;
73 1112 : groundTemperature_ = a.groundTemperature_;
74 1112 : tropoLapseRate_ = a.tropoLapseRate_;
75 1112 : groundPressure_ = a.groundPressure_;
76 1112 : relativeHumidity_ = a.relativeHumidity_;
77 1112 : wvScaleHeight_ = a.wvScaleHeight_;
78 1112 : pressureStep_ = a.pressureStep_;
79 1112 : pressureStepFactor_ = a.pressureStepFactor_;
80 1112 : altitude_ = a.altitude_;
81 1112 : topAtmProfile_ = a.topAtmProfile_;
82 1112 : numLayer_ = a.numLayer_;
83 1112 : newBasicParam_ = a.newBasicParam_;
84 :
85 : // copy thresholds
86 1112 : altitudeThreshold_ = a.altitudeThreshold_;
87 1112 : groundPressureThreshold_ = a.groundPressureThreshold_;
88 1112 : groundTemperatureThreshold_ = a.groundTemperatureThreshold_;
89 1112 : tropoLapseRateThreshold_ = a.tropoLapseRateThreshold_;
90 1112 : relativeHumidityThreshold_ = a.relativeHumidityThreshold_;
91 1112 : wvScaleHeightThreshold_ = a.wvScaleHeightThreshold_;
92 :
93 1112 : v_layerThickness_.reserve(numLayer_);
94 1112 : v_layerTemperature_.reserve(numLayer_);
95 1112 : v_layerWaterVapor_.reserve(numLayer_);
96 1112 : v_layerCO_.reserve(numLayer_);
97 1112 : v_layerO3_.reserve(numLayer_);
98 1112 : v_layerN2O_.reserve(numLayer_);
99 1112 : v_layerNO2_.reserve(numLayer_);
100 1112 : v_layerSO2_.reserve(numLayer_);
101 :
102 :
103 24079 : for(unsigned int n = 0; n < numLayer_; n++) {
104 22967 : v_layerThickness_.push_back(a.v_layerThickness_[n]);
105 22967 : v_layerTemperature_.push_back(a.v_layerTemperature_[n]);
106 : //cout << "n=" << n << std::endl;
107 22967 : v_layerWaterVapor_.push_back(a.v_layerWaterVapor_[n]);
108 22967 : v_layerPressure_.push_back(a.v_layerPressure_[n]);
109 22967 : v_layerCO_.push_back(a.v_layerCO_[n]);
110 22967 : v_layerO3_.push_back(a.v_layerO3_[n]);
111 22967 : v_layerN2O_.push_back(a.v_layerN2O_[n]);
112 22967 : v_layerNO2_.push_back(a.v_layerNO2_[n]);
113 22967 : v_layerSO2_.push_back(a.v_layerSO2_[n]);
114 : }
115 :
116 : // level Spectral Grid
117 1112 : freqUnits_ = a.freqUnits_;
118 1112 : v_chanFreq_ = a.v_chanFreq_;
119 :
120 1112 : v_numChan_ = a.v_numChan_;
121 1112 : v_refChan_ = a.v_refChan_;
122 1112 : v_refFreq_ = a.v_refFreq_;
123 1112 : v_chanSep_ = a.v_chanSep_;
124 1112 : v_maxFreq_ = a.v_maxFreq_;
125 1112 : v_minFreq_ = a.v_minFreq_;
126 1112 : v_intermediateFrequency_ = a.v_intermediateFrequency_;
127 1112 : v_loFreq_ = a.v_loFreq_;
128 :
129 1112 : v_sidebandSide_ = a.v_sidebandSide_;
130 1112 : v_sidebandType_ = a.v_sidebandType_;
131 :
132 1112 : vv_assocSpwId_ = a.vv_assocSpwId_;
133 1112 : vv_assocNature_ = a.vv_assocNature_;
134 :
135 1112 : v_transfertId_ = a.v_transfertId_;
136 :
137 : // level Absorption Profile
138 1112 : vv_N_H2OLinesPtr_.reserve(a.v_chanFreq_.size());
139 1112 : vv_N_H2OContPtr_.reserve(a.v_chanFreq_.size());
140 1112 : vv_N_O2LinesPtr_.reserve(a.v_chanFreq_.size());
141 1112 : vv_N_DryContPtr_.reserve(a.v_chanFreq_.size());
142 1112 : vv_N_O3LinesPtr_.reserve(a.v_chanFreq_.size());
143 1112 : vv_N_COLinesPtr_.reserve(a.v_chanFreq_.size());
144 1112 : vv_N_N2OLinesPtr_.reserve(a.v_chanFreq_.size());
145 1112 : vv_N_NO2LinesPtr_.reserve(a.v_chanFreq_.size());
146 1112 : vv_N_SO2LinesPtr_.reserve(a.v_chanFreq_.size());
147 :
148 : std::vector<std::complex<double> >* v_N_H2OLinesPtr;
149 : std::vector<std::complex<double> >* v_N_H2OContPtr;
150 : std::vector<std::complex<double> >* v_N_O2LinesPtr;
151 : std::vector<std::complex<double> >* v_N_DryContPtr;
152 : std::vector<std::complex<double> >* v_N_O3LinesPtr;
153 : std::vector<std::complex<double> >* v_N_COLinesPtr;
154 : std::vector<std::complex<double> >* v_N_N2OLinesPtr;
155 : std::vector<std::complex<double> >* v_N_NO2LinesPtr;
156 : std::vector<std::complex<double> >* v_N_SO2LinesPtr;
157 :
158 511358 : for(unsigned int nc = 0; nc < v_chanFreq_.size(); nc++) {
159 :
160 510246 : v_N_H2OLinesPtr = new std::vector<std::complex<double> > ;
161 510246 : v_N_H2OLinesPtr->reserve(numLayer_);
162 510246 : v_N_H2OContPtr = new std::vector<std::complex<double> > ;
163 510246 : v_N_H2OContPtr->reserve(numLayer_);
164 510246 : v_N_O2LinesPtr = new std::vector<std::complex<double> > ;
165 510246 : v_N_O2LinesPtr->reserve(numLayer_);
166 510246 : v_N_DryContPtr = new std::vector<std::complex<double> > ;
167 510246 : v_N_DryContPtr->reserve(numLayer_);
168 510246 : v_N_O3LinesPtr = new std::vector<std::complex<double> > ;
169 510246 : v_N_O3LinesPtr->reserve(numLayer_);
170 510246 : v_N_COLinesPtr = new std::vector<std::complex<double> > ;
171 510246 : v_N_COLinesPtr->reserve(numLayer_);
172 510246 : v_N_N2OLinesPtr = new std::vector<std::complex<double> > ;
173 510246 : v_N_N2OLinesPtr->reserve(numLayer_);
174 510246 : v_N_NO2LinesPtr = new std::vector<std::complex<double> > ;
175 510246 : v_N_NO2LinesPtr->reserve(numLayer_);
176 510246 : v_N_SO2LinesPtr = new std::vector<std::complex<double> > ;
177 510246 : v_N_SO2LinesPtr->reserve(numLayer_);
178 :
179 12281294 : for(unsigned int n = 0; n < numLayer_; n++) {
180 :
181 : // std::cout << "numLayer_=" << nc << " " << n << std::endl; // COMMENTED OUT BY JUAN MAY/16/2005
182 :
183 11771048 : v_N_H2OLinesPtr->push_back(a.vv_N_H2OLinesPtr_[nc]->at(n));
184 11771048 : v_N_H2OContPtr->push_back(a.vv_N_H2OContPtr_[nc]->at(n));
185 11771048 : v_N_O2LinesPtr->push_back(a.vv_N_O2LinesPtr_[nc]->at(n));
186 11771048 : v_N_DryContPtr->push_back(a.vv_N_DryContPtr_[nc]->at(n));
187 11771048 : v_N_O3LinesPtr->push_back(a.vv_N_O3LinesPtr_[nc]->at(n));
188 11771048 : v_N_COLinesPtr->push_back(a.vv_N_COLinesPtr_[nc]->at(n));
189 11771048 : v_N_N2OLinesPtr->push_back(a.vv_N_N2OLinesPtr_[nc]->at(n));
190 11771048 : v_N_NO2LinesPtr->push_back(a.vv_N_NO2LinesPtr_[nc]->at(n));
191 11771048 : v_N_SO2LinesPtr->push_back(a.vv_N_SO2LinesPtr_[nc]->at(n));
192 :
193 : }
194 :
195 510246 : vv_N_H2OLinesPtr_.push_back(v_N_H2OLinesPtr);
196 510246 : vv_N_H2OContPtr_.push_back(v_N_H2OContPtr);
197 510246 : vv_N_O2LinesPtr_.push_back(v_N_O2LinesPtr);
198 510246 : vv_N_DryContPtr_.push_back(v_N_DryContPtr);
199 510246 : vv_N_O3LinesPtr_.push_back(v_N_O3LinesPtr);
200 510246 : vv_N_COLinesPtr_.push_back(v_N_COLinesPtr);
201 510246 : vv_N_N2OLinesPtr_.push_back(v_N_N2OLinesPtr);
202 510246 : vv_N_NO2LinesPtr_.push_back(v_N_NO2LinesPtr);
203 510246 : vv_N_SO2LinesPtr_.push_back(v_N_SO2LinesPtr);
204 :
205 : }
206 :
207 1112 : }
208 :
209 0 : RefractiveIndexProfile::RefractiveIndexProfile()
210 : {
211 0 : }
212 :
213 2795 : RefractiveIndexProfile::~RefractiveIndexProfile()
214 : {
215 1976 : rmRefractiveIndexProfile();
216 2795 : }
217 :
218 2019 : void RefractiveIndexProfile::rmRefractiveIndexProfile()
219 : {
220 : // for every frequency channel delete the pointer to the absorption profile
221 904623 : for(unsigned int nc = 0; nc < v_chanFreq_.size(); nc++) {
222 902604 : delete vv_N_H2OLinesPtr_[nc];
223 902604 : delete vv_N_H2OContPtr_[nc];
224 902604 : delete vv_N_O2LinesPtr_[nc];
225 902604 : delete vv_N_DryContPtr_[nc];
226 902604 : delete vv_N_O3LinesPtr_[nc];
227 902604 : delete vv_N_COLinesPtr_[nc];
228 902604 : delete vv_N_N2OLinesPtr_[nc];
229 902604 : delete vv_N_NO2LinesPtr_[nc];
230 902604 : delete vv_N_SO2LinesPtr_[nc];
231 : }
232 2019 : }
233 :
234 43 : bool RefractiveIndexProfile::updateRefractiveIndexProfile(const Length &altitude,
235 : const Pressure &groundPressure,
236 : const Temperature &groundTemperature,
237 : double tropoLapseRate,
238 : const Humidity &relativeHumidity,
239 : const Length &wvScaleHeight)
240 : {
241 :
242 43 : bool updated = false;
243 43 : bool mkNewAtmProfile = updateAtmProfile(altitude,
244 : groundPressure,
245 : groundTemperature,
246 : tropoLapseRate,
247 : relativeHumidity,
248 : wvScaleHeight);
249 43 : unsigned int numLayer = getNumLayer();
250 :
251 43 : if(vv_N_H2OLinesPtr_.size() < v_chanFreq_.size()) {
252 0 : mkNewAtmProfile = true;
253 0 : std::cout << " RefractiveIndexProfile: number of spectral windows has increased"
254 0 : << std::endl;
255 : }
256 43 : if(mkNewAtmProfile) {
257 43 : if(numLayer) {
258 43 : mkRefractiveIndexProfile();
259 43 : updated = true;
260 : } else {
261 0 : std::cout << " RefractiveIndexProfile: ERROR: getNumLayer() returns 0"
262 0 : << std::endl;
263 : }
264 : }
265 43 : return updated;
266 : }
267 :
268 : // NB: this interface is required because the sub-class .... overrides this method.
269 0 : bool RefractiveIndexProfile::setBasicAtmosphericParameters(const Length &altitude,
270 : const Pressure &groundPressure,
271 : const Temperature &groundTemperature,
272 : double tropoLapseRate,
273 : const Humidity &relativeHumidity,
274 : const Length &wvScaleHeight)
275 : {
276 0 : bool updated = updateRefractiveIndexProfile(altitude,
277 : groundPressure,
278 : groundTemperature,
279 : tropoLapseRate,
280 : relativeHumidity,
281 : wvScaleHeight);
282 0 : return updated;
283 : }
284 :
285 907 : void RefractiveIndexProfile::mkRefractiveIndexProfile()
286 : {
287 :
288 : // static const double abun_18o=0.0020439;
289 : // static const double abun_17o=0.0003750;
290 : // static const double abun_D=0.000298444;
291 : // static const double o2_mixing_ratio=0.2092;
292 : // static const double mmol_h2o=18.005059688; // 20*0.0020439+19*(0.0003750+2*0.000298444)+18*(1-0.0020439-0.0003750-2*0.000298444)
293 :
294 : // static bool first = true; // [-Wunused_but_set_variable]
295 :
296 : double abun_O3, abun_CO, abun_N2O, abun_NO2, abun_SO2;
297 : double wvt, wv;
298 : // double t; // [-Wunused_but_set_variable]
299 : double nu;
300 : // double nu2, nu_pi; // [-Wunused_but_set_variable]
301 : // double width;
302 : // unsigned int npoints;
303 907 : RefractiveIndex atm;
304 : // double sumAbsO3Lines1, sumAbsCOLines1, sumAbsN2OLines1, sumAbsNO2Lines1, sumAbsSO2Lines1;
305 :
306 :
307 : //TODO we will have to put numLayer_ and v_chanFreq_.size() const
308 : //we do not want to resize! ==> pas de setter pour SpectralGrid
309 :
310 : //cout << "vv_N_H2OLinesPtr_.size()=" << vv_N_H2OLinesPtr_.size() << std::endl;
311 907 : if(vv_N_H2OLinesPtr_.size() == 0) { // first time
312 864 : vv_N_H2OLinesPtr_.reserve(v_chanFreq_.size());
313 864 : vv_N_H2OContPtr_.reserve(v_chanFreq_.size());
314 864 : vv_N_O2LinesPtr_.reserve(v_chanFreq_.size());
315 864 : vv_N_DryContPtr_.reserve(v_chanFreq_.size());
316 864 : vv_N_O3LinesPtr_.reserve(v_chanFreq_.size());
317 864 : vv_N_COLinesPtr_.reserve(v_chanFreq_.size());
318 864 : vv_N_N2OLinesPtr_.reserve(v_chanFreq_.size());
319 864 : vv_N_NO2LinesPtr_.reserve(v_chanFreq_.size());
320 864 : vv_N_SO2LinesPtr_.reserve(v_chanFreq_.size());
321 : } else {
322 43 : if(vv_N_H2OLinesPtr_.size() == v_chanFreq_.size()) // there are new basic param
323 43 : rmRefractiveIndexProfile(); // delete all the layer profiles for all the frequencies
324 : }
325 :
326 : std::vector<std::complex<double> >* v_N_H2OLinesPtr;
327 : std::vector<std::complex<double> >* v_N_H2OContPtr;
328 : std::vector<std::complex<double> >* v_N_O2LinesPtr;
329 : std::vector<std::complex<double> >* v_N_DryContPtr;
330 : std::vector<std::complex<double> >* v_N_O3LinesPtr;
331 : std::vector<std::complex<double> >* v_N_COLinesPtr;
332 : std::vector<std::complex<double> >* v_N_N2OLinesPtr;
333 : std::vector<std::complex<double> >* v_N_NO2LinesPtr;
334 : std::vector<std::complex<double> >* v_N_SO2LinesPtr;
335 :
336 : // std::cout << "v_chanFreq_.size()=" << v_chanFreq_.size() << std::endl;
337 : // std::cout << "numLayer_=" << numLayer_ << std::endl;
338 : // std::cout << "v_chanFreq_[0]=" << v_chanFreq_[0] << std::endl;
339 : // check if new spectral windows have been added
340 : unsigned int ncmin;
341 : /* std::cout << "vv_N_H2OLinesPtr_.size()="<<vv_N_H2OLinesPtr_.size()<<endl; */
342 907 : ncmin = vv_N_H2OLinesPtr_.size(); // will be > 0 if spectral window(s) have been added
343 907 : if(newBasicParam_) ncmin = 0;
344 :
345 : // std::cout << "ncmin=" << ncmin << std::endl;
346 :
347 393265 : for(unsigned int nc = ncmin; nc < v_chanFreq_.size(); nc++) {
348 :
349 392358 : v_N_H2OLinesPtr = new std::vector<std::complex<double> > ;
350 392358 : v_N_H2OContPtr = new std::vector<std::complex<double> > ;
351 392358 : v_N_O2LinesPtr = new std::vector<std::complex<double> > ;
352 392358 : v_N_DryContPtr = new std::vector<std::complex<double> > ;
353 392358 : v_N_O3LinesPtr = new std::vector<std::complex<double> > ;
354 392358 : v_N_COLinesPtr = new std::vector<std::complex<double> > ;
355 392358 : v_N_N2OLinesPtr = new std::vector<std::complex<double> > ;
356 392358 : v_N_NO2LinesPtr = new std::vector<std::complex<double> > ;
357 392358 : v_N_SO2LinesPtr = new std::vector<std::complex<double> > ;
358 392358 : v_N_H2OLinesPtr->reserve(numLayer_);
359 392358 : v_N_H2OContPtr->reserve(numLayer_);
360 392358 : v_N_O2LinesPtr->reserve(numLayer_);
361 392358 : v_N_DryContPtr->reserve(numLayer_);
362 392358 : v_N_O3LinesPtr->reserve(numLayer_);
363 392358 : v_N_COLinesPtr->reserve(numLayer_);
364 392358 : v_N_N2OLinesPtr->reserve(numLayer_);
365 392358 : v_N_NO2LinesPtr->reserve(numLayer_);
366 392358 : v_N_SO2LinesPtr->reserve(numLayer_);
367 :
368 392358 : nu = 1.0E-9 * v_chanFreq_[nc]; // ATM uses GHz units
369 :
370 : // std::cout << "freq. points =" << v_chanFreq_.size() << std::endl;
371 :
372 : /* TO BE IMPLEMENTED IN NEXT RELEASE
373 :
374 : if (v_chanFreq_.size()>1){
375 : if(nc==0){
376 : width = fabs(v_chanFreq_[nc+1]-v_chanFreq_[nc])*1e-9; // width en GHz para ATM
377 : npoints=(unsigned int)round(width*100); // One point every 10 MHz
378 : }else{
379 : if(nc==v_chanFreq_.size()-1){
380 : width = fabs(v_chanFreq_[nc]-v_chanFreq_[nc-1])*1e-9; // width en GHz para ATM
381 : npoints=(unsigned int)round(width*100); // One point every 10 MHz
382 : }else{
383 : width = fabs((v_chanFreq_[nc+1]-v_chanFreq_[nc-1])/2.0)*1e-9; // width en GHz para ATM
384 : npoints=(unsigned int)round(width*100); // One point every 10 MHz
385 : }
386 : }
387 : }else{
388 : width = 0.001; // default width = 1 MHz = 0.001 GHz
389 : npoints=1;
390 : }
391 :
392 : if(npoints==0){npoints=1;}
393 :
394 : */
395 :
396 :
397 :
398 : // std::cout << "nc =" << nc << " nu=" << nu << " width=" << width << " GHz npoints=" << npoints << std::endl;
399 :
400 : // nu2 = nu * nu; // [-Wunused_but_set_variable]
401 : // nu_pi = nu / M_PI; // [-Wunused_but_set_variable]
402 :
403 8971214 : for(unsigned int j = 0; j < numLayer_; j++) {
404 :
405 8578856 : wv = v_layerWaterVapor_[j] * 1000.0; // se multiplica por 10**3 por cuestión de unidades en las rutinas fortran.
406 8578856 : wvt = wv * v_layerTemperature_[j] / 217.0; // v_layerWaterVapor_[j] está en kg/m**3
407 : // t = v_layerTemperature_[j] / 300.0; // [-Wunused_but_set_variable]
408 :
409 :
410 : // std::cout <<"ATMRefractiveIndexProfile: " << v_layerTemperature_[j] << " K " << v_layerPressure_[j] << " mb " << nu << " GHz " << std::endl;
411 : // std::cout <<"ATMRefractiveIndexProfile: O2" << atm.getRefractivity_o2(v_layerTemperature_[j],v_layerPressure_[j],wvt,nu) << std::endl;
412 : // std::cout << "ATMRefractiveIndexProfile: O2" << atm.getRefractivity_o2(v_layerTemperature_[j],v_layerPressure_[j],wvt,nu,width,npoints) << std::endl;
413 : // std::cout << "ATMRefractiveIndexProfile: H2O" << atm.getRefractivity_h2o(v_layerTemperature_[j],v_layerPressure_[j],wvt,nu) << std::endl;
414 : // std::cout << "ATMRefractiveIndexProfile: H2O" << atm.getRefractivity_h2o(v_layerTemperature_[j],v_layerPressure_[j],wvt,nu,width,npoints) << std::endl;
415 : // std::cout <<"ATMRefractiveIndexProfile: O3" << atm.getRefractivity_o3(v_layerTemperature_[j],v_layerPressure_[j],nu,v_layerO3_[j]) << std::endl;
416 : // std::cout << "ATMRefractiveIndexProfile: O3" << atm.getRefractivity_o3(v_layerTemperature_[j],v_layerPressure_[j],nu,width,npoints,v_layerO3_[j]) << std::endl;
417 : // std::cout <<"ATMRefractiveIndexProfile: CO" << atm.getSpecificRefractivity_co(v_layerTemperature_[j],v_layerPressure_[j],nu) << std::endl;
418 : // std::cout << "ATMRefractiveIndexProfile: CO" << atm.getSpecificRefractivity_co(v_layerTemperature_[j],v_layerPressure_[j],nu,width,npoints) << std::endl;
419 :
420 8578856 : v_N_O2LinesPtr->push_back(atm.getRefractivity_o2(v_layerTemperature_[j],
421 8578856 : v_layerPressure_[j],
422 : wvt,
423 8578856 : nu)); // ,width,npoints)); TO BE IMPLEMENTED IN NEXT RELEASE
424 :
425 : std::complex<double> cont_h2o =
426 8578856 : atm.getSpecificRefractivity_cnth2o(v_layerTemperature_[j],
427 8578856 : v_layerPressure_[j],
428 : wvt,
429 8578856 : nu); // ,width,npoints); TO BE IMPLEMENTED IN NEXT RELEASE
430 : std::complex<double> cont_dry =
431 8578856 : atm.getSpecificRefractivity_cntdry(v_layerTemperature_[j],
432 8578856 : v_layerPressure_[j],
433 : wvt,
434 8578856 : nu); // ,width,npoints); TO BE IMPLEMENTED IN NEXT RELEASE
435 :
436 8578856 : v_N_H2OContPtr->push_back(cont_h2o);
437 8578856 : v_N_DryContPtr->push_back(cont_dry);
438 :
439 8578856 : if(v_layerWaterVapor_[j] > 0) {
440 :
441 8578856 : v_N_H2OLinesPtr->push_back(atm.getRefractivity_h2o(v_layerTemperature_[j],
442 8578856 : v_layerPressure_[j],
443 : wvt,
444 8578856 : nu)); // ,width,npoints)); TO BE IMPLEMENTED IN NEXT RELEASE
445 : } else {
446 0 : v_N_H2OLinesPtr->push_back(0.0);
447 : }
448 :
449 : // if(v_layerO3_[j]<0.0||j==10){cout << "v_layerO3_[" << j << "]=" << v_layerO3_[j] << std::endl;}
450 :
451 8578856 : if(v_layerO3_[j] > 0) {
452 :
453 8578856 : abun_O3 = v_layerO3_[j] * 1E-6;
454 8578856 : v_N_O3LinesPtr->push_back(atm.getRefractivity_o3(v_layerTemperature_[j],
455 8578856 : v_layerPressure_[j],
456 : nu, // width,npoints, TO BE IMPLEMENTED IN NEXT RELEASE
457 8578856 : abun_O3 * 1e6));
458 : } else {
459 0 : v_N_O3LinesPtr->push_back(0.0);
460 : }
461 :
462 8578856 : if(v_layerCO_[j] > 0) {
463 8578856 : abun_CO = v_layerCO_[j] * 1E-6; // in cm^-3
464 8578856 : v_N_COLinesPtr->push_back(atm.getSpecificRefractivity_co(v_layerTemperature_[j],
465 8578856 : v_layerPressure_[j],
466 8578856 : nu) // ,width,npoints) TO BE IMPLEMENTED IN NEXT RELEASE
467 25736568 : * abun_CO * 1e6); // m^2 * m^-3 = m^-1
468 : } else {
469 0 : v_N_COLinesPtr->push_back(0.0);
470 : }
471 :
472 8578856 : if(v_layerN2O_[j] > 0) {
473 8578856 : abun_N2O = v_layerN2O_[j] * 1E-6;
474 8578856 : v_N_N2OLinesPtr->push_back(atm.getSpecificRefractivity_n2o(v_layerTemperature_[j],
475 8578856 : v_layerPressure_[j],
476 8578856 : nu) // ,width,npoints) TO BE IMPLEMENTED IN NEXT RELEASE
477 25736568 : * abun_N2O * 1e6); // m^2 * m^-3 = m^-1
478 : } else {
479 0 : v_N_N2OLinesPtr->push_back(0.0);
480 : }
481 :
482 8578856 : if(v_layerNO2_[j] > 0) {
483 8578856 : abun_NO2 = v_layerNO2_[j] * 1E-6;
484 8578856 : v_N_NO2LinesPtr->push_back(atm.getSpecificRefractivity_no2(v_layerTemperature_[j],
485 8578856 : v_layerPressure_[j],
486 8578856 : nu) // ,width,npoints) TO BE IMPLEMENTED IN NEXT RELEASE
487 25736568 : * abun_NO2 * 1e6); // m^2 * m^-3 = m^-1
488 : } else {
489 0 : v_N_NO2LinesPtr->push_back(0.0);
490 : }
491 :
492 8578856 : if(v_layerSO2_[j] > 0) {
493 8578856 : abun_SO2 = v_layerSO2_[j] * 1E-6;
494 8578856 : v_N_SO2LinesPtr->push_back(atm.getSpecificRefractivity_so2(v_layerTemperature_[j],
495 8578856 : v_layerPressure_[j],
496 8578856 : nu) // ,width,npoints) TO BE IMPLEMENTED IN NEXT RELEASE
497 25736568 : * abun_SO2 * 1e6); // m^2 * m^-3 = m^-1
498 : } else {
499 0 : v_N_SO2LinesPtr->push_back(0.0);
500 : }
501 : }
502 :
503 : // if(vv_N_H2OLinesPtr_.size() == 0) first = true; // [-Wunused_but_set_variable]
504 :
505 392358 : if(vv_N_H2OLinesPtr_.size() < v_chanFreq_.size()) {
506 367654 : vv_N_H2OLinesPtr_.push_back(v_N_H2OLinesPtr);
507 367654 : vv_N_H2OContPtr_.push_back(v_N_H2OContPtr);
508 367654 : vv_N_O2LinesPtr_.push_back(v_N_O2LinesPtr);
509 367654 : vv_N_DryContPtr_.push_back(v_N_DryContPtr);
510 367654 : vv_N_O3LinesPtr_.push_back(v_N_O3LinesPtr);
511 367654 : vv_N_COLinesPtr_.push_back(v_N_COLinesPtr);
512 367654 : vv_N_N2OLinesPtr_.push_back(v_N_N2OLinesPtr);
513 367654 : vv_N_NO2LinesPtr_.push_back(v_N_NO2LinesPtr);
514 367654 : vv_N_SO2LinesPtr_.push_back(v_N_SO2LinesPtr);
515 : } else {
516 24704 : vv_N_H2OLinesPtr_[nc] = v_N_H2OLinesPtr;
517 24704 : vv_N_H2OContPtr_[nc] = v_N_H2OContPtr;
518 24704 : vv_N_O2LinesPtr_[nc] = v_N_O2LinesPtr;
519 24704 : vv_N_DryContPtr_[nc] = v_N_DryContPtr;
520 24704 : vv_N_O3LinesPtr_[nc] = v_N_O3LinesPtr;
521 24704 : vv_N_COLinesPtr_[nc] = v_N_COLinesPtr;
522 24704 : vv_N_N2OLinesPtr_[nc] = v_N_N2OLinesPtr;
523 24704 : vv_N_NO2LinesPtr_[nc] = v_N_NO2LinesPtr;
524 24704 : vv_N_SO2LinesPtr_[nc] = v_N_SO2LinesPtr;
525 : }
526 :
527 : }
528 :
529 907 : newBasicParam_ = false;
530 : // first = false; // [-Wunused_but_set_variable]
531 907 : }
532 :
533 :
534 0 : Opacity RefractiveIndexProfile::getDryOpacityUpTo(unsigned int nc, Length refalti)
535 : {
536 0 : unsigned int ires; unsigned int numlayerold; Length alti; double fractionLast;
537 0 : Opacity opacityout0; Opacity opacityout1; Opacity zeroOp(0.0,Opacity::UnitNeper);
538 :
539 0 : if(refalti.get(Length::UnitKiloMeter) <= altitude_.get(Length::UnitKiloMeter)) {
540 0 : return zeroOp;
541 : }else{
542 0 : fractionLast = 1.0; numlayerold = numLayer_;
543 0 : opacityout0=getDryOpacity(nc); ires=numlayerold-1; alti=altitude_;
544 0 : for(unsigned int i=0; i<numLayer_; i++){
545 0 : if(alti.get(Length::UnitKiloMeter) < refalti.get(Length::UnitKiloMeter) && (alti.get(Length::UnitKiloMeter)+v_layerThickness_[i]/1000.0) >= refalti.get(Length::UnitKiloMeter))
546 0 : { ires=i; fractionLast = (refalti.get(Length::UnitMeter)-alti.get(Length::UnitMeter))/v_layerThickness_[i]; }
547 0 : alti = alti + Length(v_layerThickness_[i],Length::UnitMeter);
548 : }
549 0 : numLayer_ = ires;
550 0 : opacityout0=getDryOpacity(nc);
551 0 : numLayer_ = ires+1;
552 0 : opacityout1=getDryOpacity(nc);
553 0 : numLayer_ = numlayerold;
554 0 : return opacityout0+(opacityout1-opacityout0)*fractionLast;
555 : }
556 : }
557 7905121 : Opacity RefractiveIndexProfile::getDryOpacity(unsigned int nc)
558 : {
559 7905121 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
560 7905121 : double kv = 0;
561 219933813 : for(unsigned int j = 0; j < numLayer_; j++) {
562 424057384 : kv = kv + imag(vv_N_O2LinesPtr_[nc]->at(j) + vv_N_DryContPtr_[nc]->at(j)
563 424057384 : + vv_N_O3LinesPtr_[nc]->at(j) + vv_N_COLinesPtr_[nc]->at(j)
564 424057384 : + vv_N_N2OLinesPtr_[nc]->at(j) + vv_N_NO2LinesPtr_[nc]->at(j)
565 636086076 : + vv_N_SO2LinesPtr_[nc]->at(j)) * v_layerThickness_[j];
566 : }
567 7905121 : return Opacity(kv);
568 : }
569 :
570 :
571 0 : Opacity RefractiveIndexProfile::getAverageDryOpacity(unsigned int spwid)
572 : {
573 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
574 0 : Opacity totalaverage;
575 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
576 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
577 0 : totalaverage = totalaverage + getDryOpacity(spwid, nc);
578 : }
579 0 : totalaverage = totalaverage / getNumChan(spwid);
580 0 : return totalaverage;
581 : }
582 :
583 0 : Opacity RefractiveIndexProfile::getAverageO2LinesOpacity(unsigned int spwid)
584 : {
585 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
586 0 : Opacity totalaverage;
587 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
588 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
589 0 : totalaverage = totalaverage + getO2LinesOpacity(spwid, nc);
590 : }
591 0 : totalaverage = totalaverage / getNumChan(spwid);
592 0 : return totalaverage;
593 : }
594 :
595 0 : Opacity RefractiveIndexProfile::getAverageO3LinesOpacity(unsigned int spwid)
596 : {
597 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
598 0 : Opacity totalaverage;
599 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
600 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
601 : /* std::cout << " Freq = " << getChanFreq(spwid,nc).get(Frequency::UnitGigaHertz)
602 : << " O3 opacity = " << getO3LinesOpacity(spwid,nc).get(Opacity::UnitNeper)
603 : << " O3 pathlength = " << getO3LinesPathLength(spwid,nc).get(Length::Microns)
604 : << " O2 opacity = " << getO2LinesOpacity(spwid,nc).get(Opacity::UnitNeper)
605 : << " O2 pathlength = " << getO2LinesPathLength(spwid,nc).get(Length::Microns)
606 : << std::endl; */
607 0 : totalaverage = totalaverage + getO3LinesOpacity(spwid, nc);
608 : }
609 0 : totalaverage = totalaverage / getNumChan(spwid);
610 0 : return totalaverage;
611 : }
612 :
613 0 : Opacity RefractiveIndexProfile::getAverageN2OLinesOpacity(unsigned int spwid)
614 : {
615 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
616 0 : Opacity totalaverage;
617 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
618 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
619 0 : totalaverage = totalaverage + getN2OLinesOpacity(spwid, nc);
620 : }
621 0 : totalaverage = totalaverage / getNumChan(spwid);
622 0 : return totalaverage;
623 : }
624 :
625 0 : Opacity RefractiveIndexProfile::getAverageNO2LinesOpacity(unsigned int spwid)
626 : {
627 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
628 0 : Opacity totalaverage;
629 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
630 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
631 0 : totalaverage = totalaverage + getNO2LinesOpacity(spwid, nc);
632 : }
633 0 : totalaverage = totalaverage / getNumChan(spwid);
634 0 : return totalaverage;
635 : }
636 :
637 0 : Opacity RefractiveIndexProfile::getAverageSO2LinesOpacity(unsigned int spwid)
638 : {
639 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
640 0 : Opacity totalaverage;
641 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
642 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
643 0 : totalaverage = totalaverage + getSO2LinesOpacity(spwid, nc);
644 : }
645 0 : totalaverage = totalaverage / getNumChan(spwid);
646 0 : return totalaverage;
647 : }
648 :
649 :
650 :
651 :
652 0 : Opacity RefractiveIndexProfile::getAverageCOLinesOpacity(unsigned int spwid)
653 : {
654 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
655 0 : Opacity totalaverage;
656 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
657 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
658 0 : totalaverage = totalaverage + getCOLinesOpacity(spwid, nc);
659 : }
660 0 : totalaverage = totalaverage / getNumChan(spwid);
661 0 : return totalaverage;
662 : }
663 :
664 0 : Opacity RefractiveIndexProfile::getAverageDryContOpacity(unsigned int spwid)
665 : {
666 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
667 0 : Opacity totalaverage;
668 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
669 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
670 0 : totalaverage = totalaverage + getDryContOpacity(spwid, nc);
671 : }
672 0 : totalaverage = totalaverage / getNumChan(spwid);
673 0 : return totalaverage;
674 : }
675 :
676 0 : Opacity RefractiveIndexProfile::getDryContOpacity()
677 : {
678 0 : return getDryContOpacity(0);
679 : }
680 :
681 0 : Opacity RefractiveIndexProfile::getDryContOpacity(unsigned int nc)
682 : {
683 0 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
684 0 : double kv = 0;
685 0 : for(unsigned int j = 0; j < numLayer_; j++) {
686 0 : kv = kv + imag(vv_N_DryContPtr_[nc]->at(j)) * v_layerThickness_[j];
687 : }
688 0 : return Opacity(kv);
689 : }
690 :
691 0 : Opacity RefractiveIndexProfile::getDryContOpacity(unsigned int spwid,
692 : unsigned int nc)
693 : {
694 0 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
695 0 : return getDryContOpacity(v_transfertId_[spwid] + nc);
696 : }
697 :
698 0 : Opacity RefractiveIndexProfile::getO2LinesOpacity()
699 : {
700 0 : return getO2LinesOpacity(0);
701 : }
702 :
703 0 : Opacity RefractiveIndexProfile::getO2LinesOpacity(unsigned int nc)
704 : {
705 0 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
706 0 : double kv = 0;
707 0 : for(unsigned int j = 0; j < numLayer_; j++) {
708 0 : kv = kv + imag(vv_N_O2LinesPtr_[nc]->at(j)) * v_layerThickness_[j];
709 : }
710 0 : return Opacity(kv);
711 : }
712 :
713 0 : Opacity RefractiveIndexProfile::getO2LinesOpacity(unsigned int spwid,
714 : unsigned int nc)
715 : {
716 0 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
717 0 : return getO2LinesOpacity(v_transfertId_[spwid] + nc);
718 : }
719 :
720 0 : Opacity RefractiveIndexProfile::getCOLinesOpacity()
721 : {
722 0 : return getCOLinesOpacity(0);
723 : }
724 :
725 0 : Opacity RefractiveIndexProfile::getCOLinesOpacity(unsigned int nc)
726 : {
727 0 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
728 0 : double kv = 0;
729 0 : for(unsigned int j = 0; j < numLayer_; j++) {
730 0 : kv = kv + imag(vv_N_COLinesPtr_[nc]->at(j)) * v_layerThickness_[j];
731 : }
732 0 : return Opacity(kv);
733 : }
734 :
735 0 : Opacity RefractiveIndexProfile::getCOLinesOpacity(unsigned int spwid,
736 : unsigned int nc)
737 : {
738 0 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
739 0 : return getCOLinesOpacity(v_transfertId_[spwid] + nc);
740 : }
741 :
742 0 : Opacity RefractiveIndexProfile::getN2OLinesOpacity()
743 : {
744 0 : return getN2OLinesOpacity(0);
745 : }
746 :
747 0 : Opacity RefractiveIndexProfile::getNO2LinesOpacity()
748 : {
749 0 : return getNO2LinesOpacity(0);
750 : }
751 :
752 0 : Opacity RefractiveIndexProfile::getSO2LinesOpacity()
753 : {
754 0 : return getSO2LinesOpacity(0);
755 : }
756 :
757 0 : Opacity RefractiveIndexProfile::getN2OLinesOpacity(unsigned int nc)
758 : {
759 0 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
760 0 : double kv = 0;
761 0 : for(unsigned int j = 0; j < numLayer_; j++) {
762 0 : kv = kv + imag(vv_N_N2OLinesPtr_[nc]->at(j)) * v_layerThickness_[j];
763 : }
764 0 : return Opacity(kv);
765 : }
766 :
767 0 : Opacity RefractiveIndexProfile::getN2OLinesOpacity(unsigned int spwid,
768 : unsigned int nc)
769 : {
770 0 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
771 0 : return getN2OLinesOpacity(v_transfertId_[spwid] + nc);
772 : }
773 :
774 0 : Opacity RefractiveIndexProfile::getNO2LinesOpacity(unsigned int nc)
775 : {
776 0 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
777 0 : double kv = 0;
778 0 : for(unsigned int j = 0; j < numLayer_; j++) {
779 0 : kv = kv + imag(vv_N_NO2LinesPtr_[nc]->at(j)) * v_layerThickness_[j];
780 : }
781 0 : return Opacity(kv);
782 : }
783 :
784 0 : Opacity RefractiveIndexProfile::getNO2LinesOpacity(unsigned int spwid,
785 : unsigned int nc)
786 : {
787 0 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
788 0 : return getNO2LinesOpacity(v_transfertId_[spwid] + nc);
789 : }
790 :
791 :
792 0 : Opacity RefractiveIndexProfile::getSO2LinesOpacity(unsigned int nc)
793 : {
794 0 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
795 0 : double kv = 0;
796 0 : for(unsigned int j = 0; j < numLayer_; j++) {
797 0 : kv = kv + imag(vv_N_SO2LinesPtr_[nc]->at(j)) * v_layerThickness_[j];
798 : }
799 0 : return Opacity(kv);
800 : }
801 :
802 0 : Opacity RefractiveIndexProfile::getSO2LinesOpacity(unsigned int spwid,
803 : unsigned int nc)
804 : {
805 0 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
806 0 : return getSO2LinesOpacity(v_transfertId_[spwid] + nc);
807 : }
808 :
809 :
810 0 : Opacity RefractiveIndexProfile::getO3LinesOpacity()
811 : {
812 0 : return getO3LinesOpacity(0);
813 : }
814 :
815 0 : Opacity RefractiveIndexProfile::getO3LinesOpacity(unsigned int nc)
816 : {
817 0 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
818 0 : double kv = 0;
819 0 : for(unsigned int j = 0; j < numLayer_; j++) {
820 0 : kv = kv + imag(vv_N_O3LinesPtr_[nc]->at(j)) * v_layerThickness_[j];
821 : }
822 0 : return Opacity(kv);
823 : }
824 :
825 0 : Opacity RefractiveIndexProfile::getO3LinesOpacity(unsigned int spwid,
826 : unsigned int nc)
827 : {
828 0 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
829 0 : return getO3LinesOpacity(v_transfertId_[spwid] + nc);
830 : }
831 :
832 0 : Opacity RefractiveIndexProfile::getWetOpacity(const Length &integratedwatercolumn)
833 : {
834 : // std::cout << "1 integratedwatercolumn.get()=" << integratedwatercolumn.get() << std::endl;
835 : // std::cout << "2 getGroundWH2O().get()=" << getGroundWH2O().get() << std::endl;
836 : // std::cout << "3 getWetOpacity()=" << std::endl;
837 : // std::cout << "4 " << std::endl;
838 0 : return getWetOpacity(getGroundWH2O(),0)*(integratedwatercolumn.get()/getGroundWH2O().get());
839 :
840 : // 2010_SEP02: return getWetOpacity(integratedwatercolumn,0)*(integratedwatercolumn.get()/getGroundWH2O().get());
841 : }
842 :
843 11218 : Opacity RefractiveIndexProfile::getWetOpacity(const Length &integratedwatercolumn,
844 : unsigned int nc)
845 : {
846 11218 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
847 11218 : double kv = 0;
848 : /* std::cout<<"nc="<<nc<<endl; */
849 235578 : for(unsigned int j = 0; j < numLayer_; j++) {
850 224360 : kv = kv + imag(vv_N_H2OLinesPtr_[nc]->at(j) + vv_N_H2OContPtr_[nc]->at(j))
851 224360 : * v_layerThickness_[j];
852 :
853 : }
854 11218 : return Opacity(kv*(integratedwatercolumn.get()/getGroundWH2O().get()));
855 : }
856 :
857 11218 : Opacity RefractiveIndexProfile::getWetOpacity(const Length & integratedwatercolumn,
858 : unsigned int spwid,
859 : unsigned int nc)
860 : {
861 11218 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
862 11218 : return getWetOpacity(integratedwatercolumn,v_transfertId_[spwid] + nc);
863 : }
864 :
865 0 : Opacity RefractiveIndexProfile::getAverageWetOpacity(const Length &integratedwatercolumn,
866 : unsigned int spwid)
867 : {
868 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
869 0 : Opacity totalaverage;
870 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
871 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
872 0 : totalaverage = totalaverage + getWetOpacity(integratedwatercolumn, spwid, nc);
873 : }
874 0 : totalaverage = totalaverage / getNumChan(spwid);
875 0 : return totalaverage;
876 : }
877 :
878 0 : Opacity RefractiveIndexProfile::getH2OLinesOpacity(const Length &integratedwatercolumn)
879 : {
880 0 : return getH2OLinesOpacity(integratedwatercolumn,0);
881 : }
882 :
883 0 : Opacity RefractiveIndexProfile::getH2OLinesOpacity(const Length &integratedwatercolumn,
884 : unsigned int nc)
885 : {
886 0 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
887 0 : double kv = 0;
888 0 : for(unsigned int j = 0; j < numLayer_; j++) {
889 : /* std::cout <<"j="<<j<<" abs H2O Lines ="<<vv_N_H2OLinesPtr_[nc]->at(j) <<endl; */
890 0 : kv = kv + imag(vv_N_H2OLinesPtr_[nc]->at(j)) * v_layerThickness_[j];
891 : }
892 0 : return Opacity(kv*(integratedwatercolumn.get()/getGroundWH2O().get()));
893 : }
894 :
895 0 : Opacity RefractiveIndexProfile::getH2OLinesOpacity(const Length &integratedwatercolumn,
896 : unsigned int spwid,
897 : unsigned int nc)
898 : {
899 0 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
900 0 : return getH2OLinesOpacity(integratedwatercolumn,v_transfertId_[spwid] + nc);
901 : }
902 :
903 0 : Opacity RefractiveIndexProfile::getAverageH2OLinesOpacity(const Length &integratedwatercolumn,
904 : unsigned int spwid)
905 : {
906 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
907 0 : Opacity totalaverage;
908 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
909 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
910 0 : totalaverage = totalaverage + getH2OLinesOpacity(integratedwatercolumn,spwid, nc);
911 : }
912 0 : totalaverage = totalaverage / getNumChan(spwid);
913 0 : return totalaverage;
914 : }
915 :
916 :
917 0 : Opacity RefractiveIndexProfile::getH2OContOpacity(const Length &integratedwatercolumn)
918 : {
919 0 : return getH2OContOpacity(integratedwatercolumn,0);
920 : }
921 :
922 :
923 0 : Opacity RefractiveIndexProfile::getH2OContOpacity(const Length &integratedwatercolumn,
924 : unsigned int nc)
925 : {
926 0 : if(!chanIndexIsValid(nc)) return Opacity(-999.0);
927 0 : double kv = 0;
928 0 : for(unsigned int j = 0; j < numLayer_; j++) {
929 0 : kv = kv + imag(vv_N_H2OContPtr_[nc]->at(j)) * v_layerThickness_[j];
930 : }
931 0 : return Opacity(kv*(integratedwatercolumn.get()/getGroundWH2O().get()));
932 : }
933 :
934 :
935 0 : Opacity RefractiveIndexProfile::getH2OContOpacity(const Length &integratedwatercolumn,
936 : unsigned int spwid,
937 : unsigned int nc)
938 : {
939 0 : if(!spwidAndIndexAreValid(spwid, nc)) return Opacity(-999.0);
940 0 : return getH2OContOpacity(integratedwatercolumn,v_transfertId_[spwid] + nc);
941 : }
942 :
943 :
944 :
945 0 : Opacity RefractiveIndexProfile::getAverageH2OContOpacity(const Length &integratedwatercolumn,
946 : unsigned int spwid)
947 : {
948 0 : if(!spwidAndIndexAreValid(spwid, 0)) return Opacity(-999.0);
949 0 : Opacity totalaverage;
950 0 : totalaverage = Opacity(0.0, Opacity::UnitNeper);
951 0 : for(unsigned int nc = 0; nc < getNumChan(spwid); nc++) {
952 0 : totalaverage = totalaverage + getH2OContOpacity(integratedwatercolumn,spwid, nc);
953 : }
954 0 : totalaverage = totalaverage / getNumChan(spwid);
955 0 : return totalaverage;
956 : }
957 :
958 0 : Angle RefractiveIndexProfile::getDispersiveH2OPhaseDelay(const Length &integratedwatercolumn)
959 : {
960 0 : return getDispersiveH2OPhaseDelay(integratedwatercolumn,0);
961 : }
962 :
963 0 : Length RefractiveIndexProfile::getDispersiveH2OPathLength(const Length &integratedwatercolumn)
964 : {
965 0 : return getDispersiveH2OPathLength(integratedwatercolumn,0);
966 : }
967 :
968 0 : Angle RefractiveIndexProfile::getDispersiveH2OPhaseDelay(const Length &integratedwatercolumn,
969 : unsigned int nc)
970 : {
971 0 : if(!chanIndexIsValid(nc)) {
972 0 : return Angle(-999.0, Angle::UnitDegree);
973 : }
974 0 : double kv = 0;
975 0 : for(unsigned int j = 0; j < numLayer_; j++) {
976 0 : kv = kv + real(vv_N_H2OLinesPtr_[nc]->at(j)) * v_layerThickness_[j];
977 : }
978 0 : Angle aa(kv*(integratedwatercolumn.get()/getGroundWH2O().get())* 57.29578, Angle::UnitDegree);
979 0 : return aa;
980 : }
981 :
982 0 : Length RefractiveIndexProfile::getDispersiveH2OPathLength(const Length &integratedwatercolumn,
983 : unsigned int nc)
984 : {
985 0 : if(!chanIndexIsValid(nc)) {
986 0 : return Length(-999.0, Length::UnitMeter);
987 : }
988 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
989 0 : Length ll((wavelength / 360.0) * getDispersiveH2OPhaseDelay(integratedwatercolumn,nc).get(Angle::UnitDegree),
990 0 : Length::UnitMeter);
991 0 : return ll;
992 : }
993 :
994 0 : Angle RefractiveIndexProfile::getDispersiveH2OPhaseDelay(const Length &integratedwatercolumn,
995 : unsigned int spwid,
996 : unsigned int nc)
997 : {
998 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
999 0 : return Angle(-999.0, Angle::UnitDegree);
1000 : }
1001 0 : return getDispersiveH2OPhaseDelay(integratedwatercolumn,v_transfertId_[spwid] + nc);
1002 : }
1003 :
1004 0 : Angle RefractiveIndexProfile::getAverageDispersiveH2OPhaseDelay(const Length &integratedwatercolumn,
1005 : unsigned int spwid)
1006 : {
1007 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1008 0 : return Angle(-999.0, Angle::UnitDegree);
1009 : }
1010 0 : double av = 0.0;
1011 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1012 0 : av = av + getDispersiveH2OPhaseDelay(integratedwatercolumn,v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1013 : }
1014 0 : av = av / getNumChan(spwid);
1015 0 : Angle average(av, Angle::UnitDegree);
1016 0 : return average;
1017 : }
1018 :
1019 0 : Length RefractiveIndexProfile::getDispersiveH2OPathLength(const Length &integratedwatercolumn,
1020 : unsigned int spwid,
1021 : unsigned int nc)
1022 : {
1023 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1024 0 : return Length(-999.0, Length::UnitMeter);
1025 : }
1026 0 : return getDispersiveH2OPathLength(integratedwatercolumn,v_transfertId_[spwid] + nc);
1027 : }
1028 :
1029 0 : Length RefractiveIndexProfile::getAverageDispersiveH2OPathLength(const Length &integratedwatercolumn,
1030 : unsigned int spwid)
1031 : {
1032 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1033 0 : return Length(-999.0, Length::UnitMeter);
1034 : }
1035 0 : double av = 0.0;
1036 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1037 0 : av = av + getDispersiveH2OPathLength(integratedwatercolumn,v_transfertId_[spwid] + i).get(Length::UnitMilliMeter);
1038 : }
1039 0 : av = av / getNumChan(spwid);
1040 0 : Length average(av, Length::UnitMilliMeter);
1041 0 : return average;
1042 : }
1043 :
1044 0 : Angle RefractiveIndexProfile::getNonDispersiveDryPhaseDelay()
1045 : {
1046 0 : return getNonDispersiveDryPhaseDelay(0);
1047 : }
1048 :
1049 0 : Length RefractiveIndexProfile::getNonDispersiveDryPathLength()
1050 : {
1051 0 : return getNonDispersiveDryPathLength(0);
1052 : }
1053 :
1054 0 : Angle RefractiveIndexProfile::getDispersiveDryPhaseDelay()
1055 : {
1056 0 : return getDispersiveDryPhaseDelay(0);
1057 : }
1058 :
1059 0 : Length RefractiveIndexProfile::getDispersiveDryPathLength()
1060 : {
1061 0 : return getDispersiveDryPathLength(0);
1062 : }
1063 :
1064 0 : Angle RefractiveIndexProfile::getNonDispersiveDryPhaseDelay(unsigned int nc)
1065 : {
1066 0 : if(!chanIndexIsValid(nc)) {
1067 0 : return Angle(-999.0, Angle::UnitDegree);
1068 : }
1069 0 : double kv = 0;
1070 0 : for(unsigned int j = 0; j < numLayer_; j++) {
1071 0 : kv = kv + real(vv_N_DryContPtr_[nc]->at(j)) * v_layerThickness_[j];
1072 : }
1073 0 : Angle aa(kv * 57.29578, Angle::UnitDegree);
1074 0 : return aa;
1075 : }
1076 :
1077 0 : Angle RefractiveIndexProfile::getDispersiveDryPhaseDelay(unsigned int nc)
1078 : {
1079 : // std::cout << "getO2LinesPhaseDelay(" << nc << ")=" << getO2LinesPhaseDelay(nc).get(Angle::UnitDegree) << std::endl;
1080 : // std::cout << "getO3LinesPhaseDelay(" << nc << ")=" << getO3LinesPhaseDelay(nc).get(Angle::UnitDegree) << std::endl;
1081 : // std::cout << "getN2OLinesPhaseDelay(" << nc << ")=" << getN2OLinesPhaseDelay(nc).get(Angle::UnitDegree) << std::endl;
1082 : // std::cout << "getNO2LinesPhaseDelay(" << nc << ")=" << getNO2LinesPhaseDelay(nc).get(Angle::UnitDegree) << std::endl;
1083 : // std::cout << "getSO2LinesPhaseDelay(" << nc << ")=" << getSO2LinesPhaseDelay(nc).get(Angle::UnitDegree) << std::endl;
1084 : // std::cout << "getCOLinesPhaseDelay(" << nc << ")=" << getCOLinesPhaseDelay(nc).get(Angle::UnitDegree) << std::endl;
1085 0 : return getO2LinesPhaseDelay(nc) + getO3LinesPhaseDelay(nc)
1086 0 : + getN2OLinesPhaseDelay(nc) + getCOLinesPhaseDelay(nc)
1087 0 : + getNO2LinesPhaseDelay(nc) + getSO2LinesPhaseDelay(nc);
1088 : }
1089 :
1090 0 : Length RefractiveIndexProfile::getNonDispersiveDryPathLength(unsigned int nc)
1091 : {
1092 0 : if(!chanIndexIsValid(nc)) {
1093 0 : return Length(-999.0, Length::UnitMeter);
1094 : }
1095 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
1096 : Length
1097 0 : ll((wavelength / 360.0) * getNonDispersiveDryPhaseDelay(nc).get(Angle::UnitDegree),
1098 0 : Length::UnitMeter);
1099 0 : return ll;
1100 : }
1101 :
1102 0 : Angle RefractiveIndexProfile::getNonDispersiveDryPhaseDelay(unsigned int spwid,
1103 : unsigned int nc)
1104 : {
1105 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1106 0 : return Angle(-999.0, Angle::UnitDegree);
1107 : }
1108 0 : return getNonDispersiveDryPhaseDelay(v_transfertId_[spwid] + nc);
1109 : }
1110 :
1111 0 : Length RefractiveIndexProfile::getDispersiveDryPathLength(unsigned int nc)
1112 : {
1113 0 : if(!chanIndexIsValid(nc)) {
1114 0 : return Length(-999.0, Length::UnitMeter);
1115 : }
1116 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
1117 0 : Length ll((wavelength / 360.0) * getDispersiveDryPhaseDelay(nc).get(Angle::UnitDegree),
1118 0 : Length::UnitMeter);
1119 0 : return ll;
1120 : }
1121 :
1122 0 : Angle RefractiveIndexProfile::getDispersiveDryPhaseDelay(unsigned int spwid,
1123 : unsigned int nc)
1124 : {
1125 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1126 0 : return Angle(-999.0, Angle::UnitDegree);
1127 : }
1128 0 : return getDispersiveDryPhaseDelay(v_transfertId_[spwid] + nc);
1129 : }
1130 :
1131 0 : Angle RefractiveIndexProfile::getAverageNonDispersiveDryPhaseDelay(unsigned int spwid)
1132 : {
1133 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1134 0 : return Angle(-999.0, Angle::UnitDegree);
1135 : }
1136 0 : double av = 0.0;
1137 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1138 0 : av = av
1139 0 : + getNonDispersiveDryPhaseDelay(v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1140 : }
1141 0 : av = av / getNumChan(spwid);
1142 0 : Angle average(av, Angle::UnitDegree);
1143 0 : return average;
1144 : }
1145 :
1146 0 : Angle RefractiveIndexProfile::getAverageDispersiveDryPhaseDelay(unsigned int spwid)
1147 : {
1148 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1149 0 : return Angle(-999.0, Angle::UnitDegree);
1150 : }
1151 0 : double av = 0.0;
1152 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1153 0 : av = av + getDispersiveDryPhaseDelay(v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1154 : }
1155 0 : av = av / getNumChan(spwid);
1156 0 : Angle average(av, Angle::UnitDegree);
1157 0 : return average;
1158 : }
1159 :
1160 0 : Length RefractiveIndexProfile::getNonDispersiveDryPathLength(unsigned int spwid,
1161 : unsigned int nc)
1162 : {
1163 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1164 0 : return Length(-999.0, Length::UnitMeter);
1165 : }
1166 0 : return getNonDispersiveDryPathLength(v_transfertId_[spwid] + nc);
1167 : }
1168 :
1169 0 : Length RefractiveIndexProfile::getDispersiveDryPathLength(unsigned int spwid,
1170 : unsigned int nc)
1171 : {
1172 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1173 0 : return Length(-999.0, Length::UnitMeter);
1174 : }
1175 0 : return getDispersiveDryPathLength(v_transfertId_[spwid] + nc);
1176 : }
1177 :
1178 0 : Length RefractiveIndexProfile::getAverageNonDispersiveDryPathLength(unsigned int spwid)
1179 : {
1180 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1181 0 : return Length(-999.0, Length::UnitMeter);
1182 : }
1183 0 : double av = 0.0;
1184 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1185 0 : av = av
1186 0 : + getNonDispersiveDryPathLength(v_transfertId_[spwid] + i).get(Length::UnitMilliMeter);
1187 : }
1188 0 : av = av / getNumChan(spwid);
1189 0 : Length average(av, Length::UnitMilliMeter);
1190 0 : return average;
1191 : }
1192 :
1193 0 : Length RefractiveIndexProfile::getAverageDispersiveDryPathLength(unsigned int spwid)
1194 : {
1195 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1196 0 : return Length(-999.0, Length::UnitMeter);
1197 : }
1198 0 : double av = 0.0;
1199 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1200 0 : av = av + getDispersiveDryPathLength(v_transfertId_[spwid] + i).get(Length::UnitMilliMeter);
1201 : }
1202 :
1203 0 : av = av / getNumChan(spwid);
1204 0 : Length average(av, Length::UnitMilliMeter);
1205 0 : return average;
1206 : }
1207 :
1208 0 : Angle RefractiveIndexProfile::getO2LinesPhaseDelay()
1209 : {
1210 0 : return getO2LinesPhaseDelay(0);
1211 : }
1212 :
1213 0 : Length RefractiveIndexProfile::getO2LinesPathLength()
1214 : {
1215 0 : return getO2LinesPathLength(0);
1216 : }
1217 :
1218 0 : Angle RefractiveIndexProfile::getO2LinesPhaseDelay(unsigned int nc)
1219 : {
1220 0 : if(!chanIndexIsValid(nc)) {
1221 0 : return Angle(-999.0, Angle::UnitDegree);
1222 : }
1223 0 : double kv = 0;
1224 0 : for(unsigned int j = 0; j < numLayer_; j++) {
1225 0 : kv = kv + real(vv_N_O2LinesPtr_[nc]->at(j)) * v_layerThickness_[j];
1226 : }
1227 0 : Angle aa(kv * 57.29578, Angle::UnitDegree);
1228 0 : return aa;
1229 : }
1230 :
1231 0 : Length RefractiveIndexProfile::getO2LinesPathLength(unsigned int nc)
1232 : {
1233 0 : if(!chanIndexIsValid(nc)) {
1234 0 : return Length(-999.0, Length::UnitMeter);
1235 : }
1236 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
1237 0 : Length ll((wavelength / 360.0) * getO2LinesPhaseDelay(nc).get(Angle::UnitDegree), Length::UnitMeter);
1238 0 : return ll;
1239 : }
1240 :
1241 0 : Angle RefractiveIndexProfile::getO2LinesPhaseDelay(unsigned int spwid,
1242 : unsigned int nc)
1243 : {
1244 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1245 0 : return Angle(-999.0, Angle::UnitDegree);
1246 : }
1247 0 : return getO2LinesPhaseDelay(v_transfertId_[spwid] + nc);
1248 : }
1249 :
1250 0 : Angle RefractiveIndexProfile::getAverageO2LinesPhaseDelay(unsigned int spwid)
1251 : {
1252 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1253 0 : return Angle(-999.0, Angle::UnitDegree);
1254 : }
1255 0 : double av = 0.0;
1256 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1257 0 : av = av + getO2LinesPhaseDelay(v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1258 : }
1259 0 : av = av / getNumChan(spwid);
1260 0 : Angle average(av, Angle::UnitDegree);
1261 0 : return average;
1262 : }
1263 :
1264 0 : Length RefractiveIndexProfile::getO2LinesPathLength(unsigned int spwid,
1265 : unsigned int nc)
1266 : {
1267 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1268 0 : return Length(-999.0, Length::UnitMeter);
1269 : }
1270 0 : return getO2LinesPathLength(v_transfertId_[spwid] + nc);
1271 : }
1272 :
1273 0 : Length RefractiveIndexProfile::getAverageO2LinesPathLength(unsigned int spwid)
1274 : {
1275 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1276 0 : return Length(-999.0, Length::UnitMeter);
1277 : }
1278 0 : double av = 0.0;
1279 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1280 0 : av = av + getO2LinesPathLength(v_transfertId_[spwid] + i).get(Length::UnitMilliMeter);
1281 : }
1282 0 : av = av / getNumChan(spwid);
1283 0 : Length average(av, Length::UnitMilliMeter);
1284 0 : return average;
1285 : }
1286 :
1287 0 : Angle RefractiveIndexProfile::getO3LinesPhaseDelay()
1288 : {
1289 0 : return getO3LinesPhaseDelay(0);
1290 : }
1291 :
1292 0 : Length RefractiveIndexProfile::getO3LinesPathLength()
1293 : {
1294 0 : return getO3LinesPathLength(0);
1295 : }
1296 :
1297 0 : Angle RefractiveIndexProfile::getO3LinesPhaseDelay(unsigned int nc)
1298 : {
1299 0 : if(!chanIndexIsValid(nc)) {
1300 0 : return Angle(-999.0, Angle::UnitDegree);
1301 : }
1302 0 : double kv = 0;
1303 :
1304 : // if(nc=66){cout << "vv_N_O3LinesPtr_" << ".size()=" << vv_N_O3LinesPtr_.size() << std::endl;}
1305 :
1306 0 : for(unsigned int j = 0; j < numLayer_; j++) {
1307 : /* if(nc=66){
1308 : std::cout << "j=" << j << " vv_N_O3LinesPtr_[" << nc << "]->at(" << j << ")=" << vv_N_O3LinesPtr_[nc]->at(j) << std::endl;
1309 : } */
1310 0 : kv = kv + real(vv_N_O3LinesPtr_[nc]->at(j)) * v_layerThickness_[j];
1311 : }
1312 0 : Angle aa(kv * 57.29578, Angle::UnitDegree);
1313 0 : return aa;
1314 : }
1315 :
1316 0 : Length RefractiveIndexProfile::getO3LinesPathLength(unsigned int nc)
1317 : {
1318 0 : if(!chanIndexIsValid(nc)) {
1319 0 : return Length(-999.0, Length::UnitMeter);
1320 : }
1321 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
1322 0 : Length ll((wavelength / 360.0) * getO3LinesPhaseDelay(nc).get(Angle::UnitDegree), Length::UnitMeter);
1323 0 : return ll;
1324 : }
1325 :
1326 0 : Angle RefractiveIndexProfile::getO3LinesPhaseDelay(unsigned int spwid,
1327 : unsigned int nc)
1328 : {
1329 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1330 0 : return Angle(-999.0, Angle::UnitDegree);
1331 : }
1332 0 : return getO3LinesPhaseDelay(v_transfertId_[spwid] + nc);
1333 : }
1334 :
1335 0 : Angle RefractiveIndexProfile::getAverageO3LinesPhaseDelay(unsigned int spwid)
1336 : {
1337 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1338 0 : return Angle(-999.0, Angle::UnitDegree);
1339 : }
1340 0 : double av = 0.0;
1341 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1342 0 : av = av + getO3LinesPhaseDelay(v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1343 : }
1344 0 : av = av / getNumChan(spwid);
1345 0 : Angle average(av, Angle::UnitDegree);
1346 0 : return average;
1347 : }
1348 :
1349 0 : Length RefractiveIndexProfile::getO3LinesPathLength(unsigned int spwid,
1350 : unsigned int nc)
1351 : {
1352 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1353 0 : return Length(-999.0, Length::UnitMeter);
1354 : }
1355 0 : return getO3LinesPathLength(v_transfertId_[spwid] + nc);
1356 : }
1357 :
1358 0 : Length RefractiveIndexProfile::getAverageO3LinesPathLength(unsigned int spwid)
1359 : {
1360 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1361 0 : return Length(-999.0, Length::UnitMeter);
1362 : }
1363 0 : double av = 0.0;
1364 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1365 0 : av = av + getO3LinesPathLength(v_transfertId_[spwid] + i).get(Length::UnitMilliMeter);
1366 : }
1367 0 : av = av / getNumChan(spwid);
1368 0 : Length average(av, Length::UnitMilliMeter);
1369 0 : return average;
1370 : }
1371 :
1372 0 : Angle RefractiveIndexProfile::getCOLinesPhaseDelay()
1373 : {
1374 0 : return getCOLinesPhaseDelay(0);
1375 : }
1376 :
1377 0 : Length RefractiveIndexProfile::getCOLinesPathLength()
1378 : {
1379 0 : return getCOLinesPathLength(0);
1380 : }
1381 :
1382 0 : Angle RefractiveIndexProfile::getCOLinesPhaseDelay(unsigned int nc)
1383 : {
1384 0 : if(!chanIndexIsValid(nc)) {
1385 0 : return Angle(-999.0, Angle::UnitDegree);
1386 : }
1387 0 : double kv = 0;
1388 0 : for(unsigned int j = 0; j < numLayer_; j++) {
1389 0 : kv = kv + real(vv_N_COLinesPtr_[nc]->at(j)) * v_layerThickness_[j];
1390 : }
1391 0 : Angle aa(kv * 57.29578, Angle::UnitDegree);
1392 0 : return aa;
1393 : }
1394 :
1395 0 : Length RefractiveIndexProfile::getCOLinesPathLength(unsigned int nc)
1396 : {
1397 0 : if(!chanIndexIsValid(nc)) {
1398 0 : return Length(-999.0, Length::UnitMeter);
1399 : }
1400 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
1401 0 : Length ll((wavelength / 360.0) * getCOLinesPhaseDelay(nc).get(Angle::UnitDegree), Length::UnitMeter);
1402 0 : return ll;
1403 : }
1404 :
1405 0 : Angle RefractiveIndexProfile::getCOLinesPhaseDelay(unsigned int spwid,
1406 : unsigned int nc)
1407 : {
1408 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1409 0 : return Angle(-999.0, Angle::UnitDegree);
1410 : }
1411 0 : return getCOLinesPhaseDelay(v_transfertId_[spwid] + nc);
1412 : }
1413 :
1414 0 : Angle RefractiveIndexProfile::getAverageCOLinesPhaseDelay(unsigned int spwid)
1415 : {
1416 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1417 0 : return Angle(-999.0, Angle::UnitDegree);
1418 : }
1419 0 : double av = 0.0;
1420 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1421 0 : av = av + getCOLinesPhaseDelay(v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1422 : }
1423 0 : av = av / getNumChan(spwid);
1424 0 : Angle average(av, Angle::UnitDegree);
1425 0 : return average;
1426 : }
1427 :
1428 0 : Length RefractiveIndexProfile::getCOLinesPathLength(unsigned int spwid,
1429 : unsigned int nc)
1430 : {
1431 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1432 0 : return Length(-999.0, Length::UnitMeter);
1433 : }
1434 0 : return getCOLinesPathLength(v_transfertId_[spwid] + nc);
1435 : }
1436 :
1437 0 : Length RefractiveIndexProfile::getAverageCOLinesPathLength(unsigned int spwid)
1438 : {
1439 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1440 0 : return Length(-999.0, Length::UnitMeter);
1441 : }
1442 0 : double av = 0.0;
1443 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1444 0 : av = av + getCOLinesPathLength(v_transfertId_[spwid] + i).get(Length::UnitMilliMeter);
1445 : }
1446 0 : av = av / getNumChan(spwid);
1447 0 : Length average(av, Length::UnitMilliMeter);
1448 0 : return average;
1449 : }
1450 :
1451 0 : Angle RefractiveIndexProfile::getN2OLinesPhaseDelay()
1452 : {
1453 0 : return getN2OLinesPhaseDelay(0);
1454 : }
1455 :
1456 0 : Length RefractiveIndexProfile::getN2OLinesPathLength()
1457 : {
1458 0 : return getN2OLinesPathLength(0);
1459 : }
1460 :
1461 0 : Angle RefractiveIndexProfile::getN2OLinesPhaseDelay(unsigned int nc)
1462 : {
1463 0 : if(!chanIndexIsValid(nc)) {
1464 0 : return Angle(-999.0, Angle::UnitDegree);
1465 : }
1466 0 : double kv = 0;
1467 0 : for(unsigned int j = 0; j < numLayer_; j++) {
1468 0 : kv = kv + real(vv_N_N2OLinesPtr_[nc]->at(j)) * v_layerThickness_[j];
1469 : }
1470 0 : Angle aa(kv * 57.29578, Angle::UnitDegree);
1471 0 : return aa;
1472 : }
1473 :
1474 0 : Length RefractiveIndexProfile::getN2OLinesPathLength(unsigned int nc)
1475 : {
1476 0 : if(!chanIndexIsValid(nc)) {
1477 0 : return Length(-999.0, Length::UnitMeter);
1478 : }
1479 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
1480 0 : Length ll((wavelength / 360.0) * getN2OLinesPhaseDelay(nc).get(Angle::UnitDegree), Length::UnitMeter);
1481 0 : return ll;
1482 : }
1483 :
1484 0 : Angle RefractiveIndexProfile::getN2OLinesPhaseDelay(unsigned int spwid,
1485 : unsigned int nc)
1486 : {
1487 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1488 0 : return Angle(-999.0, Angle::UnitDegree);
1489 : }
1490 0 : return getN2OLinesPhaseDelay(v_transfertId_[spwid] + nc);
1491 : }
1492 :
1493 0 : Angle RefractiveIndexProfile::getAverageN2OLinesPhaseDelay(unsigned int spwid)
1494 : {
1495 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1496 0 : return Angle(-999.0, Angle::UnitDegree);
1497 : }
1498 0 : double av = 0.0;
1499 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1500 0 : av = av + getN2OLinesPhaseDelay(v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1501 : }
1502 0 : av = av / getNumChan(spwid);
1503 0 : Angle average(av, Angle::UnitDegree);
1504 0 : return average;
1505 : }
1506 :
1507 0 : Length RefractiveIndexProfile::getN2OLinesPathLength(unsigned int spwid,
1508 : unsigned int nc)
1509 : {
1510 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1511 0 : return Length(-999.0, Length::UnitMeter);
1512 : }
1513 0 : return getN2OLinesPathLength(v_transfertId_[spwid] + nc);
1514 : }
1515 :
1516 0 : Length RefractiveIndexProfile::getAverageN2OLinesPathLength(unsigned int spwid)
1517 : {
1518 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1519 0 : return Length(-999.0, Length::UnitMeter);
1520 : }
1521 0 : double av = 0.0;
1522 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1523 0 : av = av + getN2OLinesPathLength(v_transfertId_[spwid] + i).get(Length::UnitMilliMeter);
1524 : }
1525 0 : av = av / getNumChan(spwid);
1526 0 : Length average(av, Length::UnitMilliMeter);
1527 0 : return average;
1528 : }
1529 :
1530 :
1531 :
1532 :
1533 :
1534 :
1535 0 : Angle RefractiveIndexProfile::getNO2LinesPhaseDelay()
1536 : {
1537 0 : return getNO2LinesPhaseDelay(0);
1538 : }
1539 :
1540 0 : Length RefractiveIndexProfile::getNO2LinesPathLength()
1541 : {
1542 0 : return getNO2LinesPathLength(0);
1543 : }
1544 :
1545 0 : Angle RefractiveIndexProfile::getNO2LinesPhaseDelay(unsigned int nc)
1546 : {
1547 0 : if(!chanIndexIsValid(nc)) {
1548 0 : return Angle(-999.0, Angle::UnitDegree);
1549 : }
1550 0 : double kv = 0;
1551 0 : for(unsigned int j = 0; j < numLayer_; j++) {
1552 0 : kv = kv + real(vv_N_NO2LinesPtr_[nc]->at(j)) * v_layerThickness_[j];
1553 : }
1554 0 : Angle aa(kv * 57.29578, Angle::UnitDegree);
1555 0 : return aa;
1556 : }
1557 :
1558 0 : Length RefractiveIndexProfile::getNO2LinesPathLength(unsigned int nc)
1559 : {
1560 0 : if(!chanIndexIsValid(nc)) {
1561 0 : return Length(-999.0, Length::UnitMeter);
1562 : }
1563 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
1564 0 : Length ll((wavelength / 360.0) * getNO2LinesPhaseDelay(nc).get(Angle::UnitDegree), Length::UnitMeter);
1565 0 : return ll;
1566 : }
1567 :
1568 0 : Angle RefractiveIndexProfile::getNO2LinesPhaseDelay(unsigned int spwid,
1569 : unsigned int nc)
1570 : {
1571 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1572 0 : return Angle(-999.0, Angle::UnitDegree);
1573 : }
1574 0 : return getNO2LinesPhaseDelay(v_transfertId_[spwid] + nc);
1575 : }
1576 :
1577 0 : Angle RefractiveIndexProfile::getAverageNO2LinesPhaseDelay(unsigned int spwid)
1578 : {
1579 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1580 0 : return Angle(-999.0, Angle::UnitDegree);
1581 : }
1582 0 : double av = 0.0;
1583 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1584 0 : av = av + getNO2LinesPhaseDelay(v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1585 : }
1586 0 : av = av / getNumChan(spwid);
1587 0 : Angle average(av, Angle::UnitDegree);
1588 0 : return average;
1589 : }
1590 :
1591 0 : Length RefractiveIndexProfile::getNO2LinesPathLength(unsigned int spwid,
1592 : unsigned int nc)
1593 : {
1594 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1595 0 : return Length(-999.0, Length::UnitMeter);
1596 : }
1597 0 : return getNO2LinesPathLength(v_transfertId_[spwid] + nc);
1598 : }
1599 :
1600 0 : Length RefractiveIndexProfile::getAverageNO2LinesPathLength(unsigned int spwid)
1601 : {
1602 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1603 0 : return Length(-999.0, Length::UnitMeter);
1604 : }
1605 0 : double av = 0.0;
1606 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1607 0 : av = av + getNO2LinesPathLength(v_transfertId_[spwid] + i).get(Length::UnitMilliMeter);
1608 : }
1609 0 : av = av / getNumChan(spwid);
1610 0 : Length average(av, Length::UnitMilliMeter);
1611 0 : return average;
1612 : }
1613 :
1614 :
1615 :
1616 :
1617 :
1618 :
1619 :
1620 :
1621 0 : Angle RefractiveIndexProfile::getSO2LinesPhaseDelay()
1622 : {
1623 0 : return getSO2LinesPhaseDelay(0);
1624 : }
1625 :
1626 0 : Length RefractiveIndexProfile::getSO2LinesPathLength()
1627 : {
1628 0 : return getSO2LinesPathLength(0);
1629 : }
1630 :
1631 0 : Angle RefractiveIndexProfile::getSO2LinesPhaseDelay(unsigned int nc)
1632 : {
1633 0 : if(!chanIndexIsValid(nc)) {
1634 0 : return Angle(-999.0, Angle::UnitDegree);
1635 : }
1636 0 : double kv = 0;
1637 0 : for(unsigned int j = 0; j < numLayer_; j++) {
1638 0 : kv = kv + real(vv_N_SO2LinesPtr_[nc]->at(j)) * v_layerThickness_[j];
1639 : }
1640 0 : Angle aa(kv * 57.29578, Angle::UnitDegree);
1641 0 : return aa;
1642 : }
1643 :
1644 0 : Length RefractiveIndexProfile::getSO2LinesPathLength(unsigned int nc)
1645 : {
1646 0 : if(!chanIndexIsValid(nc)) {
1647 0 : return Length(-999.0, Length::UnitMeter);
1648 : }
1649 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
1650 0 : Length ll((wavelength / 360.0) * getSO2LinesPhaseDelay(nc).get(Angle::UnitDegree), Length::UnitMeter);
1651 0 : return ll;
1652 : }
1653 :
1654 0 : Angle RefractiveIndexProfile::getSO2LinesPhaseDelay(unsigned int spwid,
1655 : unsigned int nc)
1656 : {
1657 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1658 0 : return Angle(-999.0, Angle::UnitDegree);
1659 : }
1660 0 : return getSO2LinesPhaseDelay(v_transfertId_[spwid] + nc);
1661 : }
1662 :
1663 0 : Angle RefractiveIndexProfile::getAverageSO2LinesPhaseDelay(unsigned int spwid)
1664 : {
1665 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1666 0 : return Angle(-999.0, Angle::UnitDegree);
1667 : }
1668 0 : double av = 0.0;
1669 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1670 0 : av = av + getSO2LinesPhaseDelay(v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1671 : }
1672 0 : av = av / getNumChan(spwid);
1673 0 : Angle average(av, Angle::UnitDegree);
1674 0 : return average;
1675 : }
1676 :
1677 0 : Length RefractiveIndexProfile::getSO2LinesPathLength(unsigned int spwid,
1678 : unsigned int nc)
1679 : {
1680 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1681 0 : return Length(-999.0, Length::UnitMeter);
1682 : }
1683 0 : return getSO2LinesPathLength(v_transfertId_[spwid] + nc);
1684 : }
1685 :
1686 0 : Length RefractiveIndexProfile::getAverageSO2LinesPathLength(unsigned int spwid)
1687 : {
1688 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1689 0 : return Length(-999.0, Length::UnitMeter);
1690 : }
1691 0 : double av = 0.0;
1692 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1693 0 : av = av + getSO2LinesPathLength(v_transfertId_[spwid] + i).get(Length::UnitMilliMeter);
1694 : }
1695 0 : av = av / getNumChan(spwid);
1696 0 : Length average(av, Length::UnitMilliMeter);
1697 0 : return average;
1698 : }
1699 :
1700 :
1701 0 : Angle RefractiveIndexProfile::getNonDispersiveH2OPhaseDelay(const Length &integratedwatercolumn)
1702 : {
1703 0 : return getNonDispersiveH2OPhaseDelay(integratedwatercolumn,0);
1704 : }
1705 :
1706 0 : Length RefractiveIndexProfile::getNonDispersiveH2OPathLength(const Length &integratedwatercolumn)
1707 : {
1708 0 : return getNonDispersiveH2OPathLength(integratedwatercolumn,0);
1709 : }
1710 :
1711 0 : Angle RefractiveIndexProfile::getNonDispersiveH2OPhaseDelay(const Length &integratedwatercolumn,
1712 : unsigned int nc)
1713 : {
1714 0 : double kv = 0;
1715 0 : if(!chanIndexIsValid(nc)) {
1716 0 : return Angle(-999.0, Angle::UnitDegree);
1717 : }
1718 0 : for(unsigned int j = 0; j < numLayer_; j++) {
1719 0 : kv = kv + real(vv_N_H2OContPtr_[nc]->at(j)) * v_layerThickness_[j];
1720 : }
1721 0 : Angle aa(kv*(integratedwatercolumn.get()/getGroundWH2O().get())* 57.29578, Angle::UnitDegree);
1722 0 : return aa;
1723 : }
1724 :
1725 0 : Length RefractiveIndexProfile::getNonDispersiveH2OPathLength(const Length &integratedwatercolumn,
1726 : unsigned int nc)
1727 : {
1728 0 : if(!chanIndexIsValid(nc)) {
1729 0 : return Length(-999.0, Length::UnitMeter);
1730 : }
1731 0 : double wavelength = 299792458.0 / v_chanFreq_[nc]; // in m
1732 0 : Length ll((wavelength / 360.0) * getNonDispersiveH2OPhaseDelay(integratedwatercolumn,nc).get(Angle::UnitDegree),Length::UnitMeter);
1733 0 : return ll;
1734 : }
1735 :
1736 0 : Angle RefractiveIndexProfile::getNonDispersiveH2OPhaseDelay(const Length &integratedwatercolumn,
1737 : unsigned int spwid,
1738 : unsigned int nc)
1739 : {
1740 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1741 0 : return Angle(-999.0, Angle::UnitDegree);
1742 : }
1743 0 : return getNonDispersiveH2OPhaseDelay(integratedwatercolumn,v_transfertId_[spwid] + nc);
1744 : }
1745 :
1746 0 : Angle RefractiveIndexProfile::getAverageNonDispersiveH2OPhaseDelay(const Length &integratedwatercolumn,
1747 : unsigned int spwid)
1748 : {
1749 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1750 0 : return Angle(-999.0, Angle::UnitDegree);
1751 : }
1752 0 : double av = 0.0;
1753 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1754 0 : av = av
1755 0 : + getNonDispersiveH2OPhaseDelay(v_transfertId_[spwid] + i).get(Angle::UnitDegree);
1756 : }
1757 0 : av = av / getNumChan(spwid);
1758 0 : Angle average(av*(integratedwatercolumn.get()/getGroundWH2O().get()), Angle::UnitDegree);
1759 0 : return average;
1760 : }
1761 :
1762 0 : Length RefractiveIndexProfile::getNonDispersiveH2OPathLength(const Length &integratedwatercolumn,
1763 : unsigned int spwid,
1764 : unsigned int nc)
1765 : {
1766 0 : if(!spwidAndIndexAreValid(spwid, nc)) {
1767 0 : return Length(-999.0);
1768 : }
1769 0 : return getNonDispersiveH2OPathLength(integratedwatercolumn,v_transfertId_[spwid] + nc);
1770 : }
1771 :
1772 0 : Length RefractiveIndexProfile::getAverageNonDispersiveH2OPathLength(const Length &integratedwatercolumn,
1773 : unsigned int spwid)
1774 : {
1775 0 : if(!spwidAndIndexAreValid(spwid, 0)) {
1776 0 : return Length(-999.0);
1777 : }
1778 0 : double av = 0.0;
1779 0 : for(unsigned int i = 0; i < getNumChan(spwid); i++) {
1780 0 : av = av
1781 0 : + getNonDispersiveH2OPathLength(integratedwatercolumn,v_transfertId_[spwid] + i).get(Length::UnitMeter);
1782 : }
1783 0 : av = av / getNumChan(spwid);
1784 0 : Length average(av, Length::UnitMeter);
1785 0 : return average;
1786 : }
1787 :
1788 : // NB: the function chanIndexIsValid will be overrided by ....
1789 39657263 : bool RefractiveIndexProfile::chanIndexIsValid(unsigned int nc)
1790 : {
1791 39657263 : if(nc < vv_N_H2OLinesPtr_.size()) return true;
1792 0 : if(nc < v_chanFreq_.size()) {
1793 : std::cout
1794 0 : << " RefractiveIndexProfile: Requested index in a new spectral window ==> update profile"
1795 0 : << std::endl;
1796 0 : mkRefractiveIndexProfile();
1797 : // std::cout << "...and we return" << std::endl;
1798 0 : return true;
1799 : }
1800 0 : std::cout << " RefractiveIndexProfile: ERROR: Invalid channel frequency index"
1801 0 : << std::endl;
1802 0 : return false;
1803 : }
1804 :
1805 : // NB: the function spwidAndIndexAreValid will be overrided by ...
1806 15953118 : bool RefractiveIndexProfile::spwidAndIndexAreValid(unsigned int spwid,
1807 : unsigned int idx)
1808 : {
1809 :
1810 15953118 : if(spwid > getNumSpectralWindow() - 1) {
1811 : std::cout
1812 0 : << " RefractiveIndexProfile: ERROR: spectral window identifier out of range "
1813 0 : << std::endl;
1814 0 : return false;
1815 : }
1816 15953118 : if(idx > getNumChan(spwid) - 1) {
1817 0 : std::cout << " RefractiveIndexProfile: ERROR: channel index out of range "
1818 0 : << std::endl;
1819 0 : return false;
1820 : }
1821 15953118 : unsigned int nc = v_transfertId_[spwid] + idx;
1822 15953118 : bool valid = chanIndexIsValid(nc);
1823 15953118 : return valid;
1824 : }
1825 :
1826 0 : void RefractiveIndexProfile::updateNewSpectralWindows()
1827 : {
1828 0 : mkRefractiveIndexProfile();
1829 0 : }
1830 :
1831 : ATM_NAMESPACE_END
|