112 "The two WF matrices have different number of rows." );
116 kx.
resize( ny2, nx1+nx2 );
117 kx_names.resize( nri1+nri2 );
118 kx_lengths.resize( nri1+nri2 );
119 kx_aux.
resize( nx1+nx2, 2 );
127 for ( iri=0; iri<nri1; iri++ )
129 kx_lengths[iri] = ktemp_lengths[iri];
130 kx_names[iri] = ktemp_names[iri];
141 for ( iri=0; iri<nri2; iri++ )
143 kx_names[nri1+iri] = k_names[iri];
144 kx_lengths[nri1+iri] = l;
254 throw logic_error(
"The retrieval grid must have a length > 1.");
255 for ( i0=1; i0<n0; i0++ )
257 if ( x0[i0-1] >= x0[i0] )
258 throw logic_error(
"The grids must be sorted with increasing values.");
260 for ( ip=1; ip<np; ip++ )
262 if ( xp[ip-1] >= xp[ip] )
263 throw logic_error(
"The grids must be sorted with increasing values.");
267 if ( !( (x0[0]>xp[np-1]) || (x0[n0-1]<xp[0]) ) )
272 for ( ; x0[i0] < xp[0]; i0++ ) {}
273 if ( x0[i0] < xp[1] )
276 for ( ; (i0<n0) && (x0[i0]<xp[1]); i0++ ) {}
281 for ( ip=1; ip<(np-1); ip++ )
284 for ( ; (i0<n0) && (x0[i0]<=xp[ip-1]); i0++ ) {}
285 if ( (i0<n0) && (x0[i0]<xp[ip+1]) )
288 for ( ; (i0<n0) && (x0[i0]<xp[ip+1]); i0++ ) {}
295 for ( ; (i0<n0) && (x0[i0]<=xp[np-2]); i0++ ) {}
296 if ( (i0<n0) && (x0[i0]<=xp[np-1]) )
299 for ( ; (i0<n0) && (x0[i0]<=xp[np-1]); i0++ ) {}
300 is(np-1,1) = (
Numeric) (i0 - 1);
344 const Index nw = i2-i1+1;
353 for ( i=0; i<nw; i++ )
354 w[i] = ( xp[1] - x0[i1+i] ) / ( xp[1] - xp[0] );
357 else if ( ip < (np-1) )
359 for ( i=0; i<nw; i++ )
361 if ( x0[i1+i] <= xp[ip] )
362 w[i] = ( x0[i1+i] - xp[ip-1] ) / ( xp[ip] - xp[ip-1] );
364 w[i] = ( xp[ip+1] - x0[i1+i] ) / ( xp[ip+1] - xp[ip] );
370 for ( i=0; i<nw; i++ )
371 w[i] = ( x0[i1+i] - xp[np-2] ) / ( xp [np-1] - xp[np-2] );
418 for ( iza=0; iza<nza; iza++ )
420 W[iza].resize(los.
p[iza].
nelem(), np);
425 out3 <<
" " << iza; cout.flush();
429 if ( los.
p[iza].
nelem() > 0 )
436 for ( ip=0; ip<np; ip++ )
487 const Index& start_index,
488 const Index& stop_index,
503 if ( ground && ((ground-1==stop_index) || (ground-1==start_index)) )
504 throw logic_error(
"The ground cannot be at one of the end points.");
507 k.
resize( nf, start_index+1 );
514 for ( iv=0; iv<nf; iv++ )
517 y[iv] = (y[iv]-s(iv,
q)*(1.0-tr(iv,
q)))/tr(iv,
q);
518 k(iv,
q) = (-lstep/2)*(y[iv]-s(iv,
q))*t[iv];
522 for (
q=stop_index+1;
q<start_index;
q++ )
525 if (
q != (ground-1) )
527 for ( iv=0; iv<nf; iv++ )
529 y[iv] = (y[iv]-s(iv,
q)*(1.0-tr(iv,
q)))/tr(iv,
q);
530 k(iv,
q) = (-lstep/2)*( 2*(y[iv]-s(iv,
q))*tr(iv,
q) +
531 s(iv,
q) - s(iv,
q-1) ) *t[iv];
538 out1 <<
"WARNING: The function absloswfs_1pass not tested for "
539 "ground reflections\n";
540 for ( iv=0; iv<nf; iv++ )
542 y[iv] = ( y[iv] - e_ground[iv]*y_ground[iv] -
543 s(iv,
q)*(1.0-tr(iv,
q))*(1-e_ground[iv]) ) /
544 ( tr(iv,
q) * (1-e_ground[iv]) );
545 k(iv,
q) = (-lstep/2)*( 2*(y[iv]-s(iv,
q))*tr(iv,
q)*(1-e_ground[iv])+
546 s(iv,
q)*(1-e_ground[iv]) +
547 e_ground[iv]*y_ground[iv] - s(iv,
q-1) ) * t[iv];
548 t[iv] *= tr(iv,
q) * (1-e_ground[iv]);
555 for ( iv=0; iv<nf; iv++ )
556 k(iv,
q) = (-lstep/2)*(y[iv]-s(iv,
q-1))*t[iv];
590 const Index& start_index,
609 k.
resize( nf, start_index+1 );
612 bl( t1q, start_index, start_index, tr, ground, e_ground );
616 for ( iv=0; iv<nf; iv++ )
621 y[iv] = ( y[iv] - s(iv,
q-1)*(1-tv1)*(1+t1q[iv]*tv1) ) / tv1;
622 k(iv,
q) = (-lstep/2)*( ( 2*yn[iv] + s(iv,
q-1)*(1-2*tv1) ) *
623 t1q[iv]*tv1 + y[iv] - s(iv,
q-1) )*tv1;
627 for (
q=start_index-1;
q>0;
q-- )
629 for ( iv=0; iv<nf; iv++ )
634 y[iv] = ( y[iv] - s(iv,
q-1)*(1-tv1)*(1+t1q[iv]*tv1) ) / tv1;
635 k(iv,
q) = (-lstep/2) * (
636 ( 4*(yn[iv]-s(iv,
q))*tv1*tv + 3*(s(iv,
q)-s(iv,
q-1))*tv1 +
637 2*s(iv,
q-1) ) * t1q[iv]*tv1 +
638 2*(y[iv]-s(iv,
q-1))*tv1 + s(iv,
q-1) - s(iv,
q) ) * tqn[iv];
640 yn[iv] = yn[iv]*tv + s(iv,
q)*(1-tv);
645 for ( iv=0; iv<nf; iv++ )
646 k(iv,0) = (-lstep/2)*( (2*yn[iv]*tv1+s(iv,0)*(1-2*tv1))*t1q[iv] +
647 y[iv] - s(iv,0) ) * tqn[iv];
686 const Index& start_index,
687 const Index& stop_index,
703 k.
resize( nf, start_index+1 );
710 rte_iterate( y0, start_index-1, stop_index, tr, s, nf );
714 bl( tr0, stop_index, stop_index, tr, ground, e_ground );
719 for ( iv=0; iv<nf; iv++ )
721 for (
q=0;
q<stop_index;
q++ )
728 ground, e_ground, y_ground );
729 for ( iv=0; iv<nf; iv++ )
731 for (
q=stop_index+1;
q<=start_index;
q++ )
732 k(iv,
q) = k2(iv,
q)*tr0[iv];
739 rte( yqq, stop_index-1, stop_index-1, tr, s,
Vector(nf,0.0),
740 ground, e_ground, y_ground );
744 for ( iv=0; iv<nf; iv++ )
746 tr0[iv] /= tr(iv,
q-1)*tr(iv,
q-1);
747 y0[iv] = ( y0[iv] - s(iv,
q)*(1-tr(iv,
q)) ) / tr(iv,
q);
748 k(iv,
q) = (-lstep/2)*( (3*(y0[iv]-s(iv,
q))*tr(iv,
q-1)*tr(iv,
q) +
749 2*(s(iv,
q)-s(iv,
q-1))*tr(iv,
q-1) + s(iv,
q-1) )*tr0[iv] +
750 yqq[iv] - s(iv,
q-1) )*tr(iv,
q-1);
780 planck( y_ground, f_mono, t_ground );
783 absloswfs.resize( nza );
786 out3 <<
" Zenith angle nr:\n ";
787 for (
Index i=0; i<nza; i++ )
791 out3 <<
" " << i; cout.flush();
794 if ( los.
p[i].
nelem() > 0 )
798 yp = y[
Range(iy0,nf)];
803 if ( los.
stop[i]==0 )
805 trans[i], source[i], los.
ground[i], e_ground, y_ground );
811 los.
l_step[i], trans[i], source[i], los.
ground[i], e_ground );
817 los.
stop[i], los.
l_step[i], trans[i], source[i],
818 los.
ground[i], e_ground, y_ground );
845 absloswfs.resize( nza );
848 out3 <<
" Zenith angle nr:\n ";
849 for (
Index i=0; i<nza; i++ )
853 out3 <<
" " << i; cout.flush();
855 np = los.
start[i] + 1;
857 absloswfs[i].resize( nf, np );
860 if ( los.
p[i].
nelem() > 0 )
864 if ( los.
stop[i]==0 )
868 for( row=0; row<nf; row++ )
870 absloswfs[i](row,0) = kw;
871 absloswfs[i](row,np-1) = kw;
872 for( col=1; col<np-1; col++ )
873 absloswfs[i](row,col) = kw2;
881 kw2 = los.
l_step[i] * 2.0;
882 for( row=0; row<nf; row++ )
884 absloswfs[i](row,0) = kw;
885 absloswfs[i](row,np-1) = kw;
886 for( col=1; col<np-1; col++ )
887 absloswfs[i](row,col) = kw2;
895 kw2 = los.
l_step[i] * 2.0;
896 for( row=0; row<nf; row++ )
898 absloswfs[i](row,0) = kw;
899 absloswfs[i](row,np-1) = kw / 2.0;
900 absloswfs[i](row,los.
stop[i]) = kw * 1.5;
901 for( col=1; col<los.
stop[i]; col++ )
902 absloswfs[i](row,col) = kw2;
903 for( col=los.
stop[i]+1; col<np-1; col++ )
904 absloswfs[i](row,col) = kw;
942 const Index& start_index,
943 const Index& stop_index,
953 if ( ground && ((ground-1==stop_index) || (ground-1==start_index)) )
954 throw logic_error(
"The ground cannot be at one of the end points.");
957 k.
resize( nf, start_index+1 );
964 for ( iv=0; iv<nf; iv++ )
965 k(iv,
q) = ( 1 - tr(iv,
q) ) / 2;
968 for (
q=stop_index+1;
q<start_index;
q++ )
973 for ( iv=0; iv<nf; iv++ )
975 k(iv,
q) = ( 1 - tr(iv,
q-1)*tr(iv,
q) ) * t[iv] / 2;
982 out1 <<
"WARNING: The function sourceloswfs_1pass not tested "
983 "for ground reflections\n";
985 for ( iv=0; iv<nf; iv++ )
987 k(iv,
q) = ( (1-tr(iv,
q))*(1-e_ground[iv])*tr(iv,
q-1) + 1 -
988 tr(iv,
q-1) ) * t[iv] / 2;
989 t[iv] *= tr(iv,
q)*(1-e_ground[iv]);
996 for ( iv=0; iv<nf; iv++ )
997 k(iv,
q) = ( 1 - tr(iv,
q-1) ) * t[iv] / 2;
1022 const Index& start_index,
1024 const Index& ground,
1034 bl( t1q, start_index, start_index, tr, ground, e_ground );
1037 k.
resize( nf, start_index+1 );
1041 for ( iv=0; iv<nf; iv++ )
1043 t1q[iv] /= tr(iv,
q-1) * tr(iv,
q-1);
1044 k(iv,
q) = ( (1-tr(iv,
q-1))*t1q[iv]*tr(iv,
q-1) + 1 - tr(iv,
q-1) )/2;
1048 for (
q=start_index-1;
q>0;
q-- )
1050 for ( iv=0; iv<nf; iv++ )
1052 t1q[iv] /= tr(iv,
q-1) * tr(iv,
q-1);
1053 k(iv,
q) = ( (1-tr(iv,
q-1)*tr(iv,
q))*t1q[iv]*tr(iv,
q-1)*
1054 tr(iv,
q) + (1-tr(iv,
q-1))*tr(iv,
q) + 1 - tr(iv,
q) ) * tqn[iv] / 2;
1055 tqn[iv] *= tr(iv,
q-1);
1060 for ( iv=0; iv<nf; iv++ )
1061 k(iv,0) = ( (1-tr(iv,0))*(1+t1q[iv]*tr(iv,0)) ) * tqn[iv] / 2;
1087 const Index& start_index,
1088 const Index& stop_index,
1090 const Index& ground,
1100 k.
resize( nf, start_index+1 );
1104 bl( tr0, stop_index, stop_index, tr, ground, e_ground );
1108 for ( iv=0; iv<nf; iv++ )
1110 for (
q=0;
q<stop_index;
q++ )
1117 for ( iv=0; iv<nf; iv++ )
1119 for (
q=stop_index+1;
q<=start_index;
q++ )
1120 k(iv,
q) = k2(iv,
q)*tr0[iv];
1127 for ( iv=0; iv<nf; iv++ )
1129 tr0[iv] /= tr(iv,
q-1)*tr(iv,
q-1);
1130 k(iv,
q) = ( (1-tr(iv,
q-1)*tr(iv,
q))*tr0[iv]*tr0[iv]*tr(iv,
q-1) + 1 -
1167 out3 <<
" Zenith angle nr: ";
1168 for (
Index i=0; i<nza; i++ )
1172 out3 <<
" " << i; cout.flush();
1175 if ( los.
p[i].
nelem() > 0 )
1180 if ( los.
stop[i]==0 )
1182 los.
ground[i], e_ground );
1187 los.
ground[i], e_ground );
1192 trans[i], los.
ground[i], e_ground );
1262 throw runtime_error(
1263 "Lengths of *wfs_tgs* and *abs_per_tg* do not match." );
1265 throw runtime_error(
1266 "The number of zenith angles is not the same in *los* and *absloswfs*." );
1270 const Index nv = abs_per_tg[0].nrows();
1300 k_names.resize(ntg);
1309 for ( itg=0; itg<ntg; itg++ )
1314 out2 <<
" Doing " << tags[tg][0].Name() <<
"\n";
1317 abs.resize( nv, np );
1318 interpp(
abs, p_abs, abs_per_tg[tg], k_grid );
1323 os <<
"Species: " << tags[tg][0].Name();
1324 k_names[itg] = os.str();
1328 for ( ip=0; ip<np; ip++ )
1329 k_aux(ip0+ip,0) = k_grid[ip];
1340 if ( unit ==
"frac" )
1342 for ( ip=0; ip<np; ip++ )
1343 k_aux(ip0+ip,1) = 1.0;
1345 else if ( unit ==
"vmr" )
1347 for ( ip=0; ip<np; ip++ )
1349 for ( iv=0; iv<nv; iv++ )
1350 abs(iv,ip) /= vmr[ip];
1351 k_aux(ip0+ip,1) = vmr[ip];
1354 else if ( unit ==
"nd" )
1360 for ( ip=0; ip<np; ip++ )
1362 for ( iv=0; iv<nv; iv++ )
1363 abs(iv,ip) /= nd[ip];
1364 k_aux(ip0+ip,1) = nd[ip];
1368 throw runtime_error(
1369 "Allowed species retrieval units are \"frac\", \"vmr\" and \"nd\".");
1375 out3 <<
" Zenith angle nr:\n ";
1376 for ( iza=0; iza<nza; iza++ )
1378 if ( ((iza+1)%20)==0 )
1380 out3 <<
" " << iza; cout.flush();
1383 if ( los.
p[iza].
nelem() > 0 )
1391 for ( ip=0; ip<np; ip++ )
1394 if ( is(ip,0) >= 0 )
1406 i1 = (
Index)is(ip,0);
1407 for ( iv=0; iv<nv; iv++ )
1409 for ( iw=i1; iw<=(
Index)is(ip,1); iw++ )
1410 a[iv] += absloswfs[iza](iv,iw) * w[iw-i1];
1411 k(iv0+iv,ip0+ip) = a[iv] *
abs(iv,ip);
1481 throw runtime_error(
1482 "The number of zenith angles is not the same in *los* and *absloswfs*." );
1484 "the matrices of absloswfs" );
1490 const Index npoints = order+1;
1494 if ( flow >= fhigh )
1495 throw runtime_error(
1496 "The lower frequency limit equals or is above the upper limit." );
1497 if ( flow < f_mono[0] )
1498 throw runtime_error(
1499 "The lower frequency limit is below all values of f_mono." );
1500 if ( fhigh > f_mono[nv-1] )
1501 throw runtime_error(
1502 "The upper frequency limit is above all values of f_mono." );
1510 else if ( lunit ==
"km" )
1513 throw runtime_error(
"Allowed length units are \"m\" and \"km\".");
1531 for( ilow=0; ilow<(nv-1) && f_mono[ilow] < flow; ilow++ )
1533 for( ihigh=ilow; ihigh<(nv-1) && f_mono[ihigh+1] <= fhigh; ihigh++ )
1545 throw runtime_error(
"The polynomial order must be >= 0.");
1548 k.
resize(nza*nv,npoints*np);
1550 k_names.resize(npoints);
1551 k_aux.
resize(npoints*np,2);
1555 nlinspace( fpoints, f_mono[ilow], f_mono[ihigh], npoints );
1559 fpoints[0] = ( f_mono[ilow] + f_mono[ihigh] ) / 2.0;
1572 out2 <<
" You have selected " << npoints <<
" off-set fit points.\n";
1573 out2 <<
" Length unit is " << lunit <<
"\n";
1574 for ( ipoint=0; ipoint<npoints; ipoint++ )
1576 out2 <<
" Doing point " << ipoint <<
"\n";
1581 os <<
"Continuum: " << fpoints[ipoint]/1e9 <<
" GHz, Point "
1582 << ipoint+1 <<
"/" << npoints;
1583 k_names[ipoint] = os.str();
1585 for ( ip=0; ip<np; ip++ )
1587 k_aux(ip0+ip,0) = k_grid[ip];
1588 k_aux(ip0+ip,1) = 0.0;
1595 for ( ip=0; ip<npoints; ip++ )
1599 for ( iv=ilow; iv<=ihigh; iv++ )
1600 b[iv] *= (f_mono[iv]-fpoints[ip]) / ( fpoints[ipoint]-fpoints[ip]);
1609 out3 <<
" Zenith angle nr:\n ";
1610 for ( iza=0; iza<nza; iza++ )
1612 if ( ((iza+1)%20)==0 )
1614 out3 <<
" " << iza; cout.flush();
1617 if ( los.
p[iza].
nelem() > 0 )
1625 for ( ip=0; ip<np; ip++ )
1628 if ( is(ip,0) >= 0 )
1640 i1 = (
Index)is(ip,0);
1641 for ( iv=ilow; iv<=ihigh; iv++ )
1643 for ( iw=i1; iw<=(
Index)is(ip,1); iw++ )
1644 a[iv] += absloswfs[iza](iv,iw) * w[iw-i1];
1645 k(iv0+iv,ip0+ip) = scfac * a[iv] * b[iv];
1765 k_names[0] =
"Temperature: no hydrostatic eq.";
1767 interpp( t, p_abs, t_abs, k_grid );
1768 for ( ip=0; ip<np; ip++ )
1770 k_aux(ip,0) = k_grid[ip];
1771 k_aux(ip,1) = t[ip];
1776 out2 <<
" Calculating absorption for t_abs + 1K\n";
1777 out2 <<
" ----- Messages from absCalc: -----\n";
1785 absCalc( abs1k, abs_dummy, tag_groups, f_mono, p_abs, dummy, n2_abs,
1786 h2o_abs, vmrs, lines_per_tg, lineshape, cont_description_names,
1787 cont_description_models, cont_description_parameters);
1789 abs_dummy.resize(0);
1791 out2 <<
" ----- Back from absCalc ----------\n";
1797 interpp( dabs_dt, p_abs, abs1k, k_grid );
1801 out2 <<
" Calculating source LOS WFs\n";
1805 out2 <<
" Calculating temperature at retrieval points\n";
1806 interpp( t, p_abs, t_abs, k_grid );
1814 out2 <<
" Calculating the weighting functions\n";
1815 out3 <<
" Zenith angle nr: ";
1816 for ( iza=0; iza<nza; iza++ )
1820 out3 <<
" " << iza; cout.flush();
1823 if ( los.
p[iza].
nelem() > 0 )
1831 for ( ip=0; ip<np; ip++ )
1834 if ( is(ip,0) >= 0 )
1851 planck( pl, f_mono, t[ip] );
1852 i1 = (
Index)is(ip,0);
1854 for ( iv=0; iv<nv; iv++ )
1856 for ( iw=i1; iw<=(
Index)is(ip,1); iw++ )
1858 a[iv] += sloswfs[iza](iv,iw) * w[iw-i1];
1859 b[iv] += absloswfs[iza](iv,iw) * w[iw-i1];
1862 k(iv0+iv,ip) = a[iv] * d/t[ip] / (exp(d)-1) * pl[iv] +
1863 b[iv] * dabs_dt(iv,ip);
1868 if ( !isfinite(k(iv0+iv,ip)) )
1870 if ( !finite(k(iv0+iv,ip)) )
1935 const Index& IndexPar,
1945 Index itg, iv, nr_line_total, iza, ip, nr_line;
1960 tag_index.resize(wfss_tgs.
nelem());
1965 for (itg_wfss=0; itg_wfss<wfss_tgs.
nelem(); ++itg_wfss)
1969 tag_index[itg_wfss] =n;
1975 if (tag_index.
nelem()==0)
1978 os <<
"No species has been set: "<<
"\n";
1979 throw runtime_error(os.str());
1983 for ( itg_wfss=0; itg_wfss<tag_index.
nelem(); ++itg_wfss )
1985 itg=tag_index[itg_wfss];
1986 nr_line_total+=lines_per_tg[itg].
nelem();
1989 kb.
resize(nza*nv,nr_line_total);
1991 kb_names.resize(nr_line_total);
1992 S_S.
resize(nr_line_total,2);
2001 for ( itg_wfss=0; itg_wfss<tag_index.
nelem(); ++itg_wfss )
2004 out2<<
"==================================: " <<
" \n";
2005 out2<<
"==Calculating weighting function for species==: " <<
" \n";
2006 out2<< wfss_tgs[itg_wfss]<<
"\n";
2007 itg=tag_index[itg_wfss];
2008 out2<<
"lines found: " <<lines_per_tg[itg].
nelem()<<
" \n";
2009 Index nr_line_dummy=0;
2010 if ( lines_per_tg[itg].nelem()>0)
2013 gamma.
resize(lines_per_tg[itg].nelem());
2015 for (
Index li=0; li<lines_per_tg[itg].
nelem(); ++li )
2018 dummy_lines_per_tg.resize( lines_per_tg.
nelem() );
2019 dummy_lines_per_tg[itg].resize(1);
2020 out3<<
"==Calculating weighting function for line==: " <<
" \n";
2021 out3<< lines_per_tg[itg][li]<<
"\n";
2022 dummy_lines_per_tg[itg][0] = lines_per_tg[itg][li];
2026 h2o_abs, vmrs, dummy_lines_per_tg,
2044 parameter = dummy_lines_per_tg[itg][0].I0();
2045 ER_dummy = dummy_lines_per_tg[itg][0].dI0();
2050 ER_dummy2[0] = ER_dummy*parameter;
2051 ER_dummy2[1] = ER_dummy*100;
2053 dummy = parameter +delta_s;
2054 dummy_lines_per_tg[itg][0].setI0(dummy);
2061 parameter=dummy_lines_per_tg[itg][0].F();
2062 ER_dummy = dummy_lines_per_tg[itg][0].dF();
2067 ER_dummy2[0] = ER_dummy;
2068 ER_dummy2[1] = ER_dummy;
2070 dummy = parameter +delta_s;
2071 dummy_lines_per_tg[itg][0].setF(dummy);
2078 parameter = dummy_lines_per_tg[itg][0].Agam();
2079 ER_dummy = dummy_lines_per_tg[itg][0].dAgam();
2084 ER_dummy2[0] = parameter*ER_dummy;
2085 ER_dummy2[1] = ER_dummy*100;
2087 dummy = parameter +delta_s;
2088 dummy = parameter + parameter *delta_s;
2089 dummy_lines_per_tg[itg][0].setAgam(dummy);
2096 parameter=dummy_lines_per_tg[itg][0].Sgam();
2097 ER_dummy = dummy_lines_per_tg[itg][0].dSgam();
2102 ER_dummy2[0] = parameter*ER_dummy;
2103 ER_dummy2[1] = ER_dummy*100;
2105 dummy = parameter +parameter*delta_s;
2106 dummy_lines_per_tg[itg][0].setSgam(dummy);
2113 parameter=dummy_lines_per_tg[itg][0].Nair();
2114 ER_dummy = dummy_lines_per_tg[itg][0].dNair();
2119 ER_dummy2[0] = parameter*ER_dummy;
2120 ER_dummy2[1] = ER_dummy*100;
2122 dummy = parameter + parameter*delta_s;
2123 dummy_lines_per_tg[itg][0].setNair(dummy);
2130 parameter=dummy_lines_per_tg[itg][0].Nself();
2131 ER_dummy = dummy_lines_per_tg[itg][0].dNself();
2136 ER_dummy2[0] = parameter*ER_dummy;
2137 ER_dummy2[1] = ER_dummy*100;
2139 dummy = parameter +parameter*delta_s;
2140 dummy_lines_per_tg[itg][0].setNself(dummy);
2148 parameter=dummy_lines_per_tg[itg][0].Psf();
2149 ER_dummy = dummy_lines_per_tg[itg][0].dPsf();
2151 if ((ER_dummy==-1)|| (parameter==0.0))
2154 {ER_dummy=ER_dummy*parameter;}
2156 ER_dummy2[0] = ER_dummy;
2157 ER_dummy2[1] = ER_dummy;
2158 dummy = parameter + delta_s ;
2159 dummy_lines_per_tg[itg][0].setPsf(dummy);
2165 os <<
"The sectroscopic parameter: " << StrPar<<
"\n"
2166 <<
"does not exists";
2167 throw runtime_error(os.str());
2173 tgs, f_mono, p_abs, t_abs, h2o_abs, vmrs,
2174 dummy_lines_per_tg, lineshape );
2176 abs_line_changed-=abs_line;
2177 dabs1=abs_line_changed;
2178 dabs1/=dummy-parameter;
2181 for ( iza=0; iza<nza; iza++ )
2185 out3 <<
" " << iza; cout.flush();
2187 if ( los.
p[iza].
nelem() > 0 )
2189 for ( iv=0; iv<nv; iv++ )
2191 for ( ip=0; ip<np; ip++ )
2193 kb(iv0+iv, nr_line)+= absweight[iza](iv,ip)*
dabs(ip, iv);
2198 if ( !isfinite(kb(iv0+iv, nr_line)) )
2200 if ( !finite(kb(iv0+iv, nr_line)) )
2202 kb(iv0+iv,nr_line) = 0.0;
2207 Numeric nr = dummy_lines_per_tg[itg][0].F() *1e-9;
2213 os <<tgs[itg]<<
"@" <<nr<<
"GHz"<<
" / "<<StrPar<<
": " << ER_dummy2[1] <<
"Hz";
2215 else if (IndexPar == 7)
2217 os <<tgs[itg]<<
"@" <<nr<<
"GHz"<<
" / "<<StrPar<<
": " << ER_dummy2[1] <<
"Hz/Pa";
2222 os <<tgs[itg]<<
"@" <<nr<<
"GHz"<<
" / "<<StrPar<<
": " << ER_dummy2[1]<<
"%";
2224 kb_names[nr_line]= os.str();
2286 const Index& kw_intens,
2287 const Index& kw_position,
2288 const Index& kw_agam,
2289 const Index& kw_sgam,
2290 const Index& kw_nair,
2291 const Index& kw_nself,
2292 const Index& kw_pSift)
2319 absweight.resize(nza);
2335 for ( iza=0; iza<nza; iza++ )
2337 absweight[iza].resize(absloswfs[iza].nrows(), W[iza].ncols());
2339 if ( los.
p[iza].
nelem() > 0 )
2341 mult(absweight[iza], absloswfs[iza], W[iza]);
2360 Index nr_line_total=0;
2363 tag_index.resize(wfss_tgs.
nelem());
2368 for (itg_wfss=0; itg_wfss<wfss_tgs.
nelem(); ++itg_wfss)
2372 tag_index[itg_wfss] =n;
2381 if (tag_index.
nelem()==0)
2384 os <<
"No species has been set: "<<
"\n";
2385 throw runtime_error(os.str());
2389 for ( itg_wfss=0; itg_wfss<tag_index.
nelem(); ++itg_wfss )
2391 itg=tag_index[itg_wfss];
2392 nr_line_total+=lines_per_tg[itg].
nelem();
2401 os <<
"No sectroscopic parameters have been set";
2402 throw runtime_error(os.str());
2404 if (nr_line_total == 0)
2407 os <<
" No line for which to calculate weighting function has been found. Catalog empty?";
2408 throw runtime_error(os.str());
2411 k.
resize(nza*nv, nr_line_total*ipar);
2413 k_names.resize(nr_line_total*ipar);
2414 S_S.
resize(nr_line_total*ipar,2);
2415 ER.
resize(nr_line_total,2);
2426 out1<<
"==================================: " <<
" \n";
2427 out1<<
" ******* Calculating Wfs for "<< StrPar<<
" ******\n";
2428 kb_spectro( kb, kb_names, kb_aux, ER, wfss_tgs, tgs,
2429 f_mono, p_abs, t_abs,
2430 h2o_abs, vmrs, lines_per_tg, lineshape, los, absweight,
2434 for (
Index iri=0; iri<kb_names.
nelem(); iri++)
2436 k_names[nr_line+iri]= kb_names[iri];
2439 nr_line+=kb.
ncols();
2446 out1 <<
" ******* Calculating Wfs for "<< StrPar<<
" ******\n";
2447 kb_spectro( kb, kb_names, kb_aux, ER, wfss_tgs, tgs,
2448 f_mono, p_abs, t_abs,
2449 h2o_abs, vmrs, lines_per_tg,
2450 lineshape, los, absweight, IndexPar, StrPar);
2453 for (
Index iri=0; iri<kb_names.
nelem(); iri++)
2455 k_names[nr_line+iri]= kb_names[iri];
2458 nr_line+=kb.
ncols();
2465 out1<<
" ******* Calculating Wfs for "<< StrPar<<
" ******\n";
2466 kb_spectro( kb, kb_names, kb_aux, ER, wfss_tgs,
2467 tgs, f_mono, p_abs, t_abs,
2468 h2o_abs, vmrs, lines_per_tg,
2469 lineshape, los, absweight, IndexPar, StrPar);
2472 for (
Index iri=0; iri<kb_names.
nelem(); iri++)
2474 k_names[nr_line+iri]= kb_names[iri];
2477 nr_line+=kb.
ncols();
2484 out1 <<
" ******* Calculating Wfs for "<< StrPar<<
" ******\n";
2485 kb_spectro( kb, kb_names, kb_aux, ER, wfss_tgs,
2486 tgs, f_mono, p_abs, t_abs,
2487 h2o_abs, vmrs, lines_per_tg,
2488 lineshape, los, absweight, IndexPar, StrPar);
2491 for (
Index iri=0; iri<kb_names.
nelem(); iri++)
2493 k_names[nr_line+iri]= kb_names[iri];
2496 nr_line+=kb.
ncols();
2503 out1 <<
" ******* Calculating Wfs for "<< StrPar<<
" ******\n";
2504 kb_spectro( kb, kb_names, kb_aux, ER, wfss_tgs,
2505 tgs, f_mono, p_abs, t_abs,
2506 h2o_abs, vmrs, lines_per_tg,
2507 lineshape, los, absweight, IndexPar, StrPar);
2510 for (
Index iri=0; iri<kb_names.
nelem(); iri++)
2512 k_names[nr_line+iri]= kb_names[iri];
2515 nr_line+=kb.
ncols();
2522 out1 <<
" ******* Calculating Wfs for "<< StrPar<<
" ******\n";
2523 kb_spectro( kb, kb_names, kb_aux, ER, wfss_tgs,
2524 tgs, f_mono, p_abs, t_abs,
2525 h2o_abs, vmrs, lines_per_tg, lineshape, los, absweight,
2529 for (
Index iri=0; iri<kb_names.
nelem(); iri++)
2531 k_names[nr_line+iri]= kb_names[iri];
2534 nr_line+=kb.
ncols();
2541 out1 <<
" ******* Calculating Wfs for "<< StrPar<<
" ******\n";
2542 kb_spectro( kb, kb_names, kb_aux, ER, wfss_tgs,
2543 tgs, f_mono, p_abs, t_abs,
2544 h2o_abs, vmrs, lines_per_tg, lineshape, los, absweight,
2548 for (
Index iri=0; iri<kb_names.
nelem(); iri++)
2550 k_names[nr_line+iri]= kb_names[iri];
2553 nr_line+=kb.
ncols();
2558 os <<
"No sectroscopic parameters have been set";
2559 throw runtime_error(os.str());
2590 String these_tags = tags[i];
2594 if ( n == these_tags.
npos )
2597 tag_def.push_back(these_tags);
2602 tag_def.push_back(these_tags.substr(0,n));
2603 these_tags.erase(0,n+1);
2615 while (
' ' == tag_def[s][0] ||
2616 '\t' == tag_def[s][0] ) tag_def[s].erase(0,1);
2618 OneTag this_tag(tag_def[s]);
2623 if ( wfs_tag_groups[i][0].Species() != this_tag.
Species() )
2624 throw runtime_error(
2625 "Tags in a tag group must belong to the same species.");
2627 wfs_tag_groups[i].push_back(this_tag);
2632 out3 <<
" Defined weighting function tag groups:";
2633 for (
Index i=0; i<wfs_tag_groups.
nelem(); ++i )
2635 out3 <<
"\n " << i <<
":";
2636 for (
Index s=0; s<wfs_tag_groups[i].
nelem(); ++s )
2638 out3 <<
" " << wfs_tag_groups[i][s].Name();
2666 String these_tags = tags[i];
2670 if ( n == these_tags.
npos )
2673 tag_def.push_back(these_tags);
2678 tag_def.push_back(these_tags.substr(0,n));
2679 these_tags.erase(0,n+1);
2691 while (
' ' == tag_def[s][0] ||
2692 '\t' == tag_def[s][0] ) tag_def[s].erase(0,1);
2694 OneTag this_tag(tag_def[s]);
2699 if ( wfss_tgs[i][0].Species() != this_tag.
Species() )
2700 throw runtime_error(
2701 "Tags in a tag group must belong to the same species.");
2703 wfss_tgs[i].push_back(this_tag);
2708 out3 <<
" Defined weighting function tag groups:";
2711 out3 <<
"\n " << i <<
":";
2712 for (
Index s=0; s<wfss_tgs[i].
nelem(); ++s )
2714 out3 <<
" " << wfss_tgs[i][s].Name();
2728 const Index& emission,
2740 if ( emission == 0 )
2743 absloswfs_rte ( absloswfs, los, source, trans, y, y_space, f_mono,
2744 e_ground, t_ground );
2749 Index irow, icol, ncol;
2751 for(
Index im=0; im<absloswfs.
nelem(); im++ )
2753 for( irow=0; irow<absloswfs[im].nrows(); irow++ )
2755 ncol = absloswfs[im].ncols();
2756 for( icol=0; icol<ncol; icol++ )
2758 w = absloswfs[im](irow,icol);
2764 absloswfs[im](irow,icol) = 0.0;
2797 for (
Index i=0; i<ntg; i++ )
2800 k_species( k, k_names, k_aux, los, absloswfs, p_abs, t_abs,
2801 wfs_tgs, abs_per_tg, vmrs, k_grid, tg_nr, unit );
2835 k_species( k, k_names, k_aux, los, absloswfs, p_abs, t_abs,
2836 wfs_tgs, abs_per_tg, vmrs, k_grid, tg_nr, unit );
2865 f1 =
first( f_mono );
2867 f2 =
last( f_mono );
2869 k_contabs( k, k_names, k_aux, los, absloswfs, f_mono, k_grid, order, f1, f2,
2896 const Index& emission,
2909 const Index& refr_lfac,
2910 const Vector& refr_index,
2911 const String& refr_model,
2918 const Index& kw_hse,
2919 const Index& kw_fast )
2933 throw runtime_error(
2934 "The number of zenith angles of *za* and *los* are different.");
2942 throw runtime_error(
2943 "The number of zenith angles of *los* and *trans* are different.");
2946 throw runtime_error(
2947 "The number of zenith angles is not the same in *los* and *absloswfs*.");
2952 throw runtime_error(
"Hydrostatic eq. must be considered generally"
2953 "when calculating WFs with hydrostatic eq.");
2958 if ( t_ground <= 0 )
2959 throw runtime_error(
2960 "There are intersections with the ground, but the ground\n"
2961 "temperature is set to be <=0 (are dummy values used?).");
2963 throw runtime_error(
2964 "There are intersections with the ground, but the frequency and\n"
2965 "ground emission vectors have different lengths (are dummy values\n"
2984 throw runtime_error(
2985 "Analytical expressions for temperature and no emission have not\n"
2986 "yet been implemented. Sorry!");
2989 p_abs, t_abs, n2_abs, h2o_abs, vmrs, lines_per_tg, lineshape, abs0, trans,
2990 e_ground, k_grid, cont_description_names, cont_description_parameters,
2991 cont_description_models);
3006 Vector z0(nabs), y0, t0(np);
3014 hseCalc( z0, p_abs, t_abs, h2o_abs, r_geoid, hse_local );
3015 hse_local[4] = hse[4];
3025 out1 <<
" Calculating absorption for t_abs + 1K \n";
3026 out2 <<
" ----- Messages from absCalc: --------\n";
3027 absCalc( abs1k, abs_dummy, tgs, f_mono, p_abs, t, n2_abs, h2o_abs, vmrs,
3028 lines_per_tg, lineshape, cont_description_names,
3029 cont_description_models, cont_description_parameters);
3032 out1 <<
" Calculating reference spectrum\n";
3033 out2 <<
" ----- Messages from losCalc: --------\n";
3036 losCalc( los, z_tan, z_plat, za, l_step, p_abs, z0, refr, refr_lfac,
3037 refr_index, z_ground, r_geoid );
3038 out2 <<
" -------------------------------------\n";
3039 out2 <<
" ----- Messages from sourceCalc: -----\n";
3041 sourceCalc( source, emission, los, p_abs, t_abs, f_mono );
3042 out2 <<
" -------------------------------------\n";
3043 out2 <<
" ----- Messages from transCalc: ------\n";
3045 out2 <<
" -------------------------------------\n";
3046 out2 <<
" ----- Messages from yRte: -----------\n";
3047 yCalc( y0, emission, los, f_mono, y_space, source, trans,
3048 e_ground, t_ground );
3049 out2 <<
" -------------------------------------\n";
3054 k_names[0] =
"Temperature: with hydrostatic eq.";
3056 interpp( t0, p_abs, t_abs, k_grid );
3057 for (
Index ip=0; ip<np; ip++ )
3059 k_aux(ip,0) = k_grid[ip];
3060 k_aux(ip,1) = t0[ip];
3072 Vector y, t(nabs), w, refr4t, z4t(nabs);
3075 for (
Index ip=0; ip<np; ip++ )
3077 out1 <<
" Doing altitude " << ip+1 <<
"/" << np <<
"\n";
3083 i1 =
Index( is(ip,0) );
3087 for ( iw=i1; iw<=
Index(is(ip,1)); iw++ )
3090 for ( iv=0; iv<nv; iv++ )
3091 abs(iv,iw) = (1-w[iw-i1])*abs0(iv,iw) + w[iw-i1]*abs1k(iv,iw);
3094 out2 <<
" ----- Doing new refractive index ----\n";
3095 refrCalc ( refr4t, p_abs, t, h2o_abs, refr, refr_model );
3096 out2 <<
" ----- Doing new hydrostatic eq. -----\n";
3098 hseCalc( z4t, p_abs, t, h2o_abs, r_geoid, hse );
3099 out2 <<
" ----- Messages from losCalc: --------\n";
3100 losCalc( los, z_tan, z_plat, za, l_step, p_abs, z4t, refr, refr_lfac,
3101 refr_index, z_ground, r_geoid );
3102 out2 <<
" -------------------------------------\n";
3103 out2 <<
" ----- Messages from sourceCalc: -----\n";
3105 sourceCalc( source, emission, los, p_abs, t, f_mono );
3106 out2 <<
" -------------------------------------\n";
3107 out2 <<
" ----- Messages from transCalc: ------\n";
3109 out2 <<
" -------------------------------------\n";
3110 out2 <<
" ----- Messages from yRte: -----------\n";
3111 yCalc( y, emission, los, f_mono, y_space, source, trans,
3112 e_ground, t_ground );
3113 out2 <<
" -------------------------------------\n";
3116 for ( iv=0; iv<nza*nv; iv++ )
3117 k(iv,ip) = y[iv] - y0[iv];
3133 Vector z0(nabs), y0, t0(np);
3141 hseCalc( z0, p_abs, t_abs, h2o_abs, r_geoid, hse_local );
3142 hse_local[4] = hse[4];
3145 out1 <<
" Calculating reference spectrum\n";
3146 out2 <<
" ----- Messages from losCalc: --------\n";
3149 losCalc( los, z_tan, z_plat, za, l_step, p_abs, z0, refr, refr_lfac,
3150 refr_index, z_ground, r_geoid );
3151 out2 <<
" -------------------------------------\n";
3152 out2 <<
" ----- Messages from sourceCalc: -----\n";
3154 sourceCalc( source, emission, los, p_abs, t_abs, f_mono );
3155 out2 <<
" -------------------------------------\n";
3156 out2 <<
" ----- Messages from transCalc: ------\n";
3158 out2 <<
" -------------------------------------\n";
3159 out2 <<
" ----- Messages from yRte: -----------\n";
3160 yCalc( y0, emission, los, f_mono, y_space, source, trans,
3161 e_ground, t_ground );
3162 out2 <<
" -------------------------------------\n";
3167 k_names[0] =
"Temperature: with hydrostatic eq.";
3169 interpp( t0, p_abs, t_abs, k_grid );
3170 for (
Index ip=0; ip<np; ip++ )
3172 k_aux(ip,0) = k_grid[ip];
3173 k_aux(ip,1) = t0[ip];
3187 Vector y, t(nabs), w, refr4t, z4t(nabs);
3190 for (
Index ip=0; ip<np; ip++ )
3192 out1 <<
" Doing altitude " << ip+1 <<
"/" << np <<
"\n";
3197 i1 =
Index( is(ip,0) );
3200 for ( iw=i1; iw<=
Index(is(ip,1)); iw++ )
3203 out2 <<
" ----- Messages from absCalc: --------\n";
3204 absCalc(
abs, abs_dummy, tgs, f_mono, p_abs, t, n2_abs, h2o_abs, vmrs,
3205 lines_per_tg, lineshape, cont_description_names,
3206 cont_description_models, cont_description_parameters);
3207 out2 <<
" ----- Doing new refractive index ----\n";
3208 refrCalc ( refr4t, p_abs, t, h2o_abs, refr, refr_model );
3209 out2 <<
" ----- Doing new hydrostatic eq. -----\n";
3211 hseCalc( z4t, p_abs, t, h2o_abs, r_geoid, hse );
3212 out2 <<
" ----- Messages from losCalc: --------\n";
3213 losCalc( los, z_tan, z_plat, za, l_step, p_abs, z4t, refr, refr_lfac,
3214 refr4t, z_ground, r_geoid );
3215 out2 <<
" -------------------------------------\n";
3216 out2 <<
" ----- Messages from sourceCalc: -----\n";
3218 sourceCalc( source, emission, los, p_abs, t, f_mono );
3219 out2 <<
" -------------------------------------\n";
3220 out2 <<
" ----- Messages from transCalc: ------\n";
3222 out2 <<
" -------------------------------------\n";
3223 out2 <<
" ----- Messages from yRte: -----------\n";
3224 yCalc( y, emission, los, f_mono, y_space, source, trans,
3225 e_ground, t_ground );
3226 out2 <<
" -------------------------------------\n";
3229 for ( iv=0; iv<nza*nv; iv++ )
3230 k(iv,ip) = y[iv] - y0[iv];
3257 const Index& emission,
3277 if ( t_ground <= 0 )
3278 throw runtime_error(
3279 "There are intersections with the ground, but the ground\n"
3280 "temperature is set to be <=0 (are dummy values used?).");
3282 throw runtime_error(
3283 "There are intersections with the ground, but the frequency and\n"
3284 "ground emission vectors have different lengths (are dummy values\n"
3295 if ( f_unit ==
"Hz" )
3297 else if ( f_unit ==
"kHz" )
3299 else if ( f_unit ==
"MHz" )
3302 throw runtime_error(
"Allowed frequency units are \"Hz\", \"kHz\" and "
3309 Numeric fdelta = scfac * delta;
3313 for(
Index ii=0; ii<nv; ii++ )
3314 { f_dist[ii] = f_mono[ii] + fdelta; }
3320 out2 <<
" ----- Messages from absCalc: --------\n";
3321 absCalc(
abs, abs_dummy, tgs, f_dist, p_abs, t_abs, n2_abs, h2o_abs, vmrs,
3322 lines_per_tg, lineshape, cont_description_names,
3323 cont_description_models, cont_description_parameters);
3325 out2 <<
" ----- Messages from sourceCalc: -----\n";
3326 sourceCalc( source, emission, los, p_abs, t_abs, f_mono );
3327 out2 <<
" -------------------------------------\n";
3328 out2 <<
" ----- Messages from transCalc: ------\n";
3330 out2 <<
" -------------------------------------\n";
3332 out2 <<
" ----- Messages from yRte: -----------\n";
3333 yCalc( y_new, emission, los, f_mono, y_space, source, trans,
3334 e_ground, t_ground );
3335 out2 <<
" -------------------------------------\n";
3342 for(
Index ii=0; ii<nv; ii++ )
3343 { k(ii,0) = ( y_new[ii] - y[ii] ) / delta; }
3345 k_names.resize( 1 );
3346 k_names[0] =
"Frequency: off-set";
3371 const Index& refr_lfac,
3372 const Vector& refr_index,
3376 const Index& emission,
3397 Vector za_new( za_pencil );
3403 out2 <<
" ----- Messages from losCalc: --------\n";
3406 losCalc( los, z_tan, z_plat, za_new, l_step, p_abs, z_abs, refr, refr_lfac,
3407 refr_index, z_ground, r_geoid );
3408 out2 <<
" -------------------------------------\n";
3411 out2 <<
" ----- Messages from sourceCalc: -----\n";
3412 sourceCalc( source, emission, los, p_abs, t_abs, f_mono );
3413 out2 <<
" -------------------------------------\n";
3414 out2 <<
" ----- Messages from transCalc: ------\n";
3416 out2 <<
" -------------------------------------\n";
3418 out2 <<
" ----- Messages from yRte: -----------\n";
3419 yCalc( y_new, emission, los, f_mono, y_space, source, trans,
3420 e_ground, t_ground );
3421 out2 <<
" -------------------------------------\n";
3429 for(
Index ii=0; ii<nv; ii++ )
3430 { k(ii,0) = ( y_new[ii] - y[ii] ) / delta; }
3435 k_names.resize( 1 );
3436 k_names[0] =
"Pointing: off-set";
3455 const Index& emission,
3462 const Index& single_e )
3468 throw runtime_error(
3469 "The number of zenith angles of *za* and *los* are different.");
3472 throw runtime_error(
3473 "The number of zenith angles of *los* and *trans* are different.");
3478 throw runtime_error(
3479 "The number of zenith angles of *los* and *source* are different.");
3481 "the source matrices (in source)");
3486 if ( t_ground <= 0 )
3487 throw runtime_error(
3488 "There are intersections with the ground, but the ground\n"
3489 "temperature is set to be <=0 (are dummy values used?).");
3491 throw runtime_error(
3492 "There are intersections with the ground, but the frequency and\n"
3493 "ground emission vectors have different lengths (are dummy values\n"
3499 for ( INDEX iv=1; iv<f_mono.
nelem(); iv++ )
3501 if ( e_ground[iv] != e_ground[0] )
3502 throw runtime_error(
3503 "A single ground emission value is assumed, but all values of\n"
3504 "*e_ground* are not the same.");
3517 Vector ksingle( nza*nv );
3526 Vector bground(nv), y_in(nv), tr(nv);
3528 for ( iza=0; iza<nza; iza++ )
3533 planck( bground, f_mono, t_ground );
3536 rte( y_in, los.
start[iza], los.
ground[iza]-1, trans[iza], source[iza],
3537 y_space, 0, e_ground, bground );
3543 for ( iv=0; iv<nv; iv++ )
3544 ksingle[iza*nv+iv] = ( bground[iv] - y_in[iv] ) * tr[iv];
3553 for ( iv=0; iv<nv; iv++ )
3555 a = 1 / ( 1 - e_ground[iv] );
3556 for ( iza=0; iza<nza; iza++ )
3557 ksingle[iza*nv+iv] = a;
3564 k_names.resize( 1 );
3565 k_names[0] =
"Ground emission (single)";
3572 k_aux(0,1) = e_ground[0];
3578 k_names.resize( 1 );
3579 k_names[0] =
"Ground emission";
3585 for ( iv=0; iv<nv; iv++ )
3587 for ( iza=0; iza<nza; iza++ )
3588 k(iza*nv+iv,iv) = ksingle[iza*nv+iv];
3590 k_aux(iv,1) = e_ground[iv];
3616 const Index nza = ny/nf;
3623 for ( j=0; j<nza; j++ )
3626 for ( i=0; i<nf; i++ )
3627 k(i0+i,0) = y[i0+i] - y0[i];
3630 k_names.resize( 1 );
3631 k_names[0] =
"Calibration: scaling";
3673 k_aux(0,1) = apriori;
3691 kx_names.resize( 0 );
3692 kx_lengths.resize( 0 );
3710 kxInit( kb, kb_names, kb_lengths, kb_aux );
3730 k_append( kx, kx_names, kx_lengths, kx_aux, k, k_names, k_aux );
3750 k_append( kb, kb_names, kb_lengths, kb_aux, k, k_names, k_aux );
3773 out2 <<
" Allocates memory for a weighting function matrix having:\n"
3774 <<
" " << ny <<
" frequency points\n"
3775 <<
" " << nx <<
" state variables\n"
3776 <<
" " << ni <<
" retrieval identities\n";
3779 kx_names.resize( ni );
3780 kx_lengths.resize( ni );
3783 for (
Index i=0; i<ni; i++ )
3805 kxAllocate( kb, kb_names, kb_lengths, kb_aux, y, y_name, ni, nx );
3831 if ( ny != k.
nrows() )
3832 throw runtime_error(
"The two WF matrices have different number of rows.");
3836 for( ni1=0; ni1<ni && kx_lengths[ni1]>0; ni1++ )
3837 nx1 += kx_lengths[ni1];
3839 throw runtime_error(
"All retrieval/error identity positions used.");
3842 if ( (ni1+ni2) > ni )
3845 os <<
"There is not room for so many retrieval/error identities.\n"
3846 << (ni1+ni2)-ni <<
" positions are missing";
3847 throw runtime_error(os.str());
3849 if ( (nx1+nx2) > nx )
3852 os <<
"The k-matrix does not fit in kx.\n"
3853 << (nx1+nx2)-nx <<
" columns are missing";
3854 throw runtime_error(os.str());
3857 out2 <<
" Putting k in kx as\n"
3858 <<
" identity " << ni1 <<
" - " << ni1+ni2-1 <<
"\n"
3859 <<
" column " << nx1 <<
" - " << nx1+nx2-1 <<
"\n";
3868 for (
Index iri=0; iri<ni2; iri++ )
3870 kx_names[ni1+iri] = k_names[iri];
3871 kx_lengths[ni1+iri] = l;
3892 kxPutInK( kb, kb_names, kb_lengths, kb_aux, k, k_names, k_aux );