00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00022 
00024 
00033 #if HAVE_CONFIG_H
00034 #include "config.h"
00035 #endif  
00036 
00038 
00040 
00041 #include "arts.h"
00042 #include "atm_funcs.h"
00043 #include "absorption.h"
00044 #include "math_funcs.h"
00045 #include "messages.h"
00046 #include "file.h"
00047 #include "auto_md.h"
00048 
00049 
00050 #ifdef HDF_SUPPORT
00051 
00052 
00054 
00056 
00058 
00068 void filename_batch(
00069               String&  filename,
00070         const String&  batchname,
00071         const String&  varname )
00072 {
00073   if ( "" == filename )
00074     filename = batchname+"."+varname+".ab";
00075 }
00076 
00077 
00078 
00080 
00093 void read_batchdata( 
00094               Matrix&   x, 
00095         const String&   batchname, 
00096         const String&   filename, 
00097         const String&   varname,
00098         const Index&   length,
00099         const Index&   n )
00100 {
00101   String fname = filename;
00102   filename_batch( fname, batchname, varname );
00103   MatrixReadBinary( x, "", fname );
00104   if ( x.nrows() != length )
00105   {
00106     ostringstream os;
00107     os << "The file " << fname << " contains data of length " << x.nrows() 
00108        << ", but a length of " << length << " is expected.\n";
00109       throw runtime_error(os.str());
00110   }
00111   if ( x.ncols() < n )
00112   {
00113     ostringstream os;
00114     os << "The file " << fname << " contains data for only " << x.ncols() 
00115        << " spectra when " << n << " spectra shall be calculated.\n";
00116       throw runtime_error(os.str());
00117   }    
00118   
00119   if ( x.ncols() > n )
00120   {
00121     Matrix dummy(x(Range(joker),Range(0,n))); 
00122                                               
00123                                               
00124                                               
00125                                               
00126                                               
00127                                               
00128     
00129     x.resize( x.nrows(), n );
00130     x = dummy;                  
00131                                 
00132                                 
00133   }
00134 }
00135 
00136 #endif // HDF_SUPPORT
00137 
00138 
00140 
00142 
00149 #ifdef HDF_SUPPORT
00150 void ybatchCalc(
00151                 
00152               Matrix&                     ybatch,
00153       
00154         const Vector&                     f_mono,
00155         const Vector&                     p_abs, 
00156         const Vector&                     t_abs,
00157         const Vector&                     n2_abs,
00158         const Vector&                     h2o_abs,
00159         const Matrix&                     vmrs,
00160         const ArrayOfArrayOfLineRecord&   lines_per_tag,
00161         const ArrayOfLineshapeSpec&       lineshape,
00162         const Vector&                     z_abs,
00163         const Numeric&                    z_plat,
00164         const Vector&                     za_pencil,
00165         const Numeric&                    l_step,
00166         const Index&                        refr,
00167         const Index&                        refr_lfac,
00168         const Vector&                     refr_index,
00169         const Numeric&                    z_ground,
00170         const Numeric&                    r_geoid,
00171         const Index&                        emission,
00172         const Vector&                     y_space,
00173         const Vector&                     e_ground,
00174         const Numeric&                    t_ground,
00175         const String&                     batchname,
00176         const TagGroups&                  tgs,
00177         const ArrayOfString&              cont_description_names,
00178         const ArrayOfVector&              cont_description_parameters,
00179         const ArrayOfString&              cont_description_models,
00180       
00181         const Index&                        ncalc,
00182         const Index&                        do_t,
00183         const String&                     t_file,
00184         const Index&                        do_z,
00185         const String&                     z_file,
00186         const ArrayOfString&              do_tags,
00187         const ArrayOfString&              tag_files,
00188         const Index&                        do_f,
00189         const String&                     f_file,
00190         const Index&                        do_za,
00191         const String&                     za_file )
00192 {
00193   const Index   np = p_abs.nelem();         
00194   
00195   const Index   ndo = do_tags.nelem();      
00196   ArrayOfIndex   tagindex;                  
00197    
00198   if ( ndo != tag_files.nelem() )
00199   {
00200     ostringstream os;
00201     os << "There is " << ndo << " tga groups and only " << tag_files.nelem() 
00202        << " tag_files, even if they are empty they should match.\n";
00203       throw runtime_error(os.str());
00204   }
00205 
00206   
00207   if ( ndo > 0 )
00208     get_tagindex_for_Strings( tagindex, tgs, do_tags );
00209 
00210   out2 << "  Reading data from files.\n";
00211 
00212   
00213   
00214   
00215   Vector t(t_abs);              
00216                                 
00217                                 
00218   Matrix Ts;
00219   if ( do_t )
00220     read_batchdata( Ts, batchname, t_file, "t_abs", np, ncalc );
00221 
00222   
00223   Vector z(z_abs);              
00224                                 
00225                                 
00226 
00227   Matrix Zs;
00228   if ( do_z )
00229     read_batchdata( Zs, batchname, z_file, "z_abs", np, ncalc );
00230   
00231   
00232   Vector f(f_mono);             
00233                                 
00234                                 
00235 
00236   Matrix f_oss;
00237   if ( do_f )
00238     read_batchdata( f_oss, batchname, f_file, "f_mono", 1, ncalc );
00239   
00240   
00241   Vector za(za_pencil);         
00242                                 
00243                                 
00244 
00245   Matrix za_oss;
00246   if ( do_za )
00247     read_batchdata( za_oss, batchname, za_file, "za_pencil", 1, ncalc );
00248   
00249   
00250   Matrix vs(vmrs);              
00251                                 
00252 
00253   Index itag;
00254   ArrayOfMatrix VMRs(ndo);
00255   extern const Array<SpeciesRecord> species_data; 
00256   for ( itag=0; itag<ndo; itag++ )
00257   {
00258     
00259     String molname = species_data[tgs[tagindex[itag]][0].Species()].Name();
00260     read_batchdata( VMRs[itag], batchname, tag_files[itag], molname, np, ncalc );
00261   }
00262 
00263 
00264 
00265   
00266          Matrix   abs;
00267   ArrayOfMatrix   abs_per_tag;
00268             Los   los;
00269   ArrayOfMatrix   trans, source;
00270          Vector   y, z_tan;
00271 
00272   out2 << "  Calculating spectra.\n";
00273 
00274   for ( Index i=0; i<Index(ncalc); i++ )
00275   {
00276     out2 << "  -------- Batch spectrum " << i << " --------\n";
00277     
00278     if ( do_t )
00279       {
00280         assert( t.nelem()==Ts.nrows() );
00281         t = Ts(Range(joker),i); 
00282                                 
00283       }
00284     if ( do_z )
00285       {
00286         assert( z.nelem()==Zs.nrows() );
00287         z = Zs(Range(joker),i); 
00288                                 
00289       }
00290     if ( do_f )
00291       {
00292         f = f_mono;             
00293         f += f_oss(0,i);        
00294       }
00295     if ( do_za )
00296       {
00297         za = za_pencil;         
00298         za += za_oss(0,i);      
00299       }
00300     for ( itag=0; itag<ndo; itag++ )
00301       {
00302         assert( vs.ncols()==VMRs[itag].nrows() );
00303         vs(tagindex[itag],Range(joker)) = VMRs[itag](Range(joker),i);
00304         
00305       }
00306 
00307 
00308     
00309     
00310     if ( (i==0) || do_t || ndo || do_f )
00311       absCalc( abs, abs_per_tag, tgs, f, p_abs, t, n2_abs, h2o_abs, vs, 
00312                lines_per_tag, lineshape, 
00313                cont_description_names, 
00314                cont_description_models,
00315                cont_description_parameters);
00316 
00317     if ( (i==0) || do_z || do_za )   
00318       losCalc( los, z_tan, z_plat, za, l_step, p_abs, z, refr, refr_lfac, 
00319                                                refr_index, z_ground, r_geoid );
00320     if ( (i==0) || do_t || do_z || do_f || do_za )   
00321       sourceCalc( source, emission, los, p_abs, t, f );
00322     transCalc( trans, los, p_abs, abs );
00323     yCalc ( y, emission, los, f, y_space, source, trans, e_ground, t_ground );
00324     
00325     
00326     if ( i == 0 )
00327       ybatch.resize( y.nelem(), ncalc );
00328 
00329     ybatch(Range(joker),i) = y; 
00330   }
00331   out2 << "  ------------------------------------\n";
00332 }
00333 #else
00334 void ybatchCalc(
00335                 
00336               Matrix&                     ,
00337       
00338         const Vector&                     ,
00339         const Vector&                     ,
00340         const Vector&                     ,
00341         const Vector&                     ,
00342         const Vector&                     ,
00343         const Matrix&                     ,
00344         const ArrayOfArrayOfLineRecord&   ,
00345         const ArrayOfLineshapeSpec&       ,
00346         const Vector&                     ,
00347         const Numeric&                    ,
00348         const Vector&                     ,
00349         const Numeric&                    ,
00350         const Index&                        ,
00351         const Index&                        ,
00352         const Vector&                     ,
00353         const Numeric&                    ,
00354         const Numeric&                    ,
00355         const Index&                        ,
00356         const Vector&                     ,
00357         const Vector&                     ,
00358         const Numeric&                    ,
00359         const String&                     ,
00360         const TagGroups&                  ,
00361         const ArrayOfString&              ,
00362         const ArrayOfVector&              ,
00363         const ArrayOfString&              ,
00364       
00365         const Index&                        ,
00366         const Index&                        ,
00367         const String&                     ,
00368         const Index&                        ,
00369         const String&                     ,
00370         const ArrayOfString&              ,
00371         const ArrayOfString&              ,
00372         const Index&                        ,
00373         const String&                     ,
00374         const Index&                        ,
00375         const String&                      )
00376 {
00377   throw runtime_error("This method is only available when arts is compiled with HDF support.");
00378 }
00379 #endif // HDF_SUPPORT
00380 
00381 void ybatchFromRadiosonde(
00382                           Matrix& ybatch,
00383                           ArrayOfMatrix& absbatch,
00384                           ArrayOfMatrix& jacbatch,
00385                           
00386                           const ArrayOfMatrix& radiosonde_data,
00387                           const Vector& f_mono,
00388                           const ArrayOfArrayOfLineRecord& lines_per_tg,
00389                           const ArrayOfLineshapeSpec& lineshape,
00390                           const Numeric& z_plat,
00391                           const Vector& za_pencil,
00392                           const Numeric& l_step,
00393                           const Index& refr,
00394                           const String& refr_model,
00395                           const Index& refr_lfac,
00396                           const Numeric& r_geoid,
00397                           const Index& emission,
00398                           const Vector& y_space,
00399                           const Vector& e_ground,
00400                           const TagGroups& tgs,
00401                           const ArrayOfString& cont_description_names,
00402                           const ArrayOfString& cont_description_models,
00403                           const ArrayOfVector& cont_description_parameters,
00404                           
00405                           const Index& fine_abs_grid,
00406                           const Index& interpolation_in_rh,
00407                           const Index& za_batch,
00408                           const Index& e_ground_batch,
00409                           const Index& calc_abs,
00410                           const Index& calc_jac)
00411 {
00412   
00413   check_if_bool(fine_abs_grid, "Finegrid keyword" );
00414   check_if_bool(interpolation_in_rh, "Interpolation in RH keyword" );
00415   check_if_bool(za_batch, "za_batch keyword" );
00416   check_if_bool(e_ground_batch, "e_ground_batch keyword" );
00417   check_if_bool(calc_abs, "calc_abs keyword" );
00418   check_if_bool(calc_jac, "calc_jac keyword" );
00419 
00420   
00421   Vector za_pencil_profile;
00422   Vector e_ground_profile;
00423 
00424   if (calc_abs) 
00425     {
00426       absbatch.resize( radiosonde_data.nelem() );
00427     }
00428   else
00429     {
00430       absbatch.resize( 1 );
00431       absbatch[0].resize( 1, 1 );
00432       absbatch[0] = -1.0;
00433     }
00434   
00435   if (calc_jac) 
00436     {
00437       jacbatch.resize( radiosonde_data.nelem() );
00438     }
00439   else
00440     {
00441       jacbatch.resize( 1 );
00442       jacbatch[0].resize( 1, 1 );
00443       jacbatch[0]  =  -1.0;
00444     }
00445 
00446   if (!za_batch)
00447     {
00448       
00449       ybatch.resize( f_mono.nelem()*za_pencil.nelem(), radiosonde_data.nelem() );
00450       ybatch = 0;
00451       za_pencil_profile.resize( za_pencil.nelem() );
00452       za_pencil_profile = za_pencil;
00453     }
00454   
00455   else
00456     {
00457       
00458       
00459       if ( radiosonde_data.nelem() != za_pencil.nelem() )
00460         {
00461           ostringstream os;
00462           os << "The number of Radiosonde profiles is " << radiosonde_data.nelem() << "\n" 
00463              << "The number of zenith angles given is " << za_pencil.nelem() << "\n"
00464              << "But these two are expected to be the same.\n";
00465           throw runtime_error(os.str());
00466         }
00467       
00468       
00469       ybatch.resize( f_mono.nelem(), radiosonde_data.nelem() );
00470       ybatch = 0;
00471       za_pencil_profile.resize(1);
00472 
00473     }
00474 
00475   if (e_ground_batch)
00476     {
00477       if ( radiosonde_data.nelem() != e_ground.nelem() )
00478         {
00479           ostringstream os;
00480           os << "The number of Radiosonde profiles is " << radiosonde_data.nelem() << "\n" 
00481              << "The number of emissivities given is  " << e_ground.nelem() << "\n"
00482              << "But these two are expected to be the same, when e_ground_per_profile = 1 .\n";
00483           throw runtime_error(os.str());
00484         }
00485     }
00486   else
00487     {
00488       e_ground_profile.resize( f_mono.nelem() );
00489       e_ground_profile  =  e_ground;
00490     }
00491   
00492   
00493   for ( Index i=0; i<radiosonde_data.nelem(); ++i )
00494     {
00495       const Matrix& rd = radiosonde_data[i];
00496       
00497       
00498       
00499       if (za_batch)
00500         {
00501           za_pencil_profile[0] = za_pencil[i];
00502         } 
00503     
00504       
00505       
00506       if (e_ground_batch)
00507         {
00508           e_ground_profile.resize( f_mono.nelem() );
00509           e_ground_profile  =  e_ground[i];
00510         }
00511       
00512       
00513       Numeric min_p = rd(rd.nrows() - 1, 0);
00514 
00515       
00516       if (min_p <= 10000.0)
00517         {
00518           Numeric t_ground, z_ground;
00519           Vector  p_abs, t_abs, z_abs, h2o_abs, n2_abs;
00520           Matrix  vmrs;
00521           
00522           
00523           
00524           if (!fine_abs_grid)
00525             {     
00526               
00527               p_abs.resize(rd.nrows());
00528               t_abs.resize(rd.nrows());
00529               z_abs.resize(rd.nrows());
00530               
00531               p_abs = rd(Range(joker),0);
00532               t_abs = rd(Range(joker),1);
00533               z_abs = rd(Range(joker),2);
00534             
00535               
00536               if (calc_abs)
00537                 {
00538                   absbatch[i].resize( f_mono.nelem(), p_abs.nelem() );
00539                   absbatch[i] = 0;
00540                 }
00541               
00542               
00543               vmrs.resize(3, rd.nrows());
00544               vmrs(0,Range(joker)) = rd(Range(joker),3);     
00545               vmrs(1,Range(joker)) = 0.209;                  
00546               vmrs(2,Range(joker)) = 0.782;                  
00547               
00548               
00549               
00550               h2o_abs.resize(rd.nrows());
00551               h2o_abs = vmrs(0,Range(joker));
00552               
00553               
00554               n2_abs.resize(rd.nrows());
00555               Vector n2_abs = vmrs(2,Range(joker));
00556               
00557               
00558               t_ground = t_abs[0];
00559               
00560               
00561               z_ground = z_abs[0];
00562               
00563             }
00564           
00565           
00566           else
00567             {
00568               
00569               Index n_rows = rd.nrows();
00570               
00571               
00572               Vector p_raw(n_rows + 1);
00573               Vector t_raw(n_rows + 1);
00574               Vector z_raw(n_rows + 1);
00575               
00576               
00577               
00578               
00579               
00580               p_raw[0] = 104000.0;
00581               t_raw[0] = rd(0,1);
00582               z_raw[0] = -99.0;
00583               
00584               p_raw[Range(1, n_rows)] = rd(Range(joker),0);
00585               t_raw[Range(1, n_rows)] = rd(Range(joker),1);
00586               z_raw[Range(1, n_rows)] = rd(Range(joker),2);
00587               
00588               
00589               VectorNLogSpace (p_abs,"p_abs", p_raw[0], 10000.0, 1001);
00590               
00591               t_abs.resize(p_abs.nelem());
00592               z_abs.resize(p_abs.nelem());
00593               
00594               
00595               interpp (t_abs, p_raw, t_raw, p_abs);
00596               interpp (z_abs, p_raw, z_raw, p_abs);
00597               
00598               
00599               Vector vmr_raw(n_rows + 1); 
00600               
00601               vmr_raw[0] = rd(0,3);
00602               vmr_raw[Range(1, n_rows)] = rd(Range(joker),3);   
00603               
00604               vmrs.resize(3, p_abs.nelem());
00605 
00606               
00607               
00608               if (interpolation_in_rh)
00609                 {
00610                   
00611                   
00612                   
00613                   
00614                   Vector sat_pres_raw(n_rows + 1);
00615                   Vector sat_pres_abs(p_abs.nelem());
00616                   Vector rh_raw(n_rows + 1);
00617                   Vector rh_abs(p_abs.nelem());
00618                   
00619                   assert( sat_pres_raw.nelem() == t_raw.nelem() );
00620                   assert( sat_pres_abs.nelem() == t_abs.nelem() );                  
00621                   
00622                   e_eq_water(sat_pres_raw, t_raw);
00623                   e_eq_water(sat_pres_abs, t_abs);
00624                   
00625                   
00626                   for ( Index j=0; j<rh_raw.nelem(); ++j )
00627                     {
00628                       rh_raw[j]  =  vmr_raw[j] / sat_pres_raw[j];
00629                     }
00630                   
00631                   
00632                   interpp (rh_abs, p_raw, rh_raw, p_abs);
00633                   
00634                   
00635                   for ( Index j=0; j<rh_abs.nelem(); ++j )
00636                     {
00637                       vmrs(0, j)  =  rh_abs[j] * sat_pres_abs[j];
00638                     }
00639                 }
00640               else
00641                 {
00642                   
00643                   interpp (vmrs(0, Range(joker)), p_raw, vmr_raw, p_abs);
00644                 }
00645               
00646               vmrs(1,Range(joker)) = 0.209;                     
00647               vmrs(2,Range(joker)) = 0.782;                     
00648               
00649               
00650               h2o_abs.resize(p_abs.nelem());
00651               h2o_abs = vmrs(0,Range(joker));
00652               
00653               
00654               n2_abs.resize(p_abs.nelem());
00655               n2_abs = vmrs(2,Range(joker));      
00656               
00657               
00658               t_ground = rd(0,1);
00659               
00660               
00661               z_ground = rd(0,2);
00662             }
00663           
00664           
00665           Matrix        abs;
00666           ArrayOfMatrix abs_per_tg;
00667           
00668           absCalc(
00669                   abs,
00670                   abs_per_tg,
00671                   
00672                   tgs,
00673                   f_mono,
00674                   p_abs,
00675                   t_abs,
00676                   n2_abs,
00677                   h2o_abs,
00678                   vmrs,
00679                   lines_per_tg,
00680                   lineshape,
00681                   cont_description_names,
00682                   cont_description_models,
00683                   cont_description_parameters);
00684 
00685           
00686           if (calc_abs)
00687             {
00688               absbatch[i] = abs;
00689             }
00690       
00691           
00692           Vector refr_index;
00693           refrCalc(
00694                    refr_index,
00695                    
00696                    p_abs,
00697                    t_abs,
00698                    h2o_abs,
00699                    refr,
00700                    refr_model);
00701           
00702           
00703           Los los;
00704           Vector z_tan;
00705           losCalc(
00706                   los,
00707                   z_tan,
00708                   
00709                   z_plat,
00710                   za_pencil_profile,
00711                   l_step,
00712                   p_abs,
00713                   z_abs,
00714                   refr,
00715                   refr_lfac,
00716                   refr_index,
00717                   z_ground,
00718                   r_geoid);
00719               
00720           
00721           ArrayOfMatrix source;
00722           sourceCalc(
00723                      source,
00724                      
00725                      emission,
00726                      los,
00727                      p_abs,
00728                      t_abs,
00729                      f_mono);
00730           
00731           
00732           ArrayOfMatrix trans;
00733           transCalc(
00734                     trans,
00735                     
00736                     los,
00737                     p_abs,
00738                     abs);
00739 
00740           
00741           Vector y;
00742           yCalc(
00743                 y,
00744                 
00745                 emission,
00746                 los,
00747                 f_mono,
00748                 y_space,
00749                 source,
00750                 trans,
00751                 e_ground_profile,
00752                 t_ground);
00753           
00754           
00755           if (calc_jac)
00756             {
00757               ArrayOfMatrix absloswfs;
00758               absloswfsCalc(
00759                             absloswfs,
00760                             
00761                             emission, 
00762                             los, 
00763                             source, 
00764                             trans, 
00765                             y, 
00766                             y_space, 
00767                             f_mono, 
00768                             e_ground_profile, 
00769                             t_ground);
00770               
00771               Vector k_grid = p_abs;
00772               
00773               TagGroups wfs_tgs( 1 );
00774               wfs_tgs = tgs[0];
00775                                           
00776               abs_per_tgReduce(
00777                                abs_per_tg,
00778                                
00779                                tgs, 
00780                                wfs_tgs);
00781               
00782               Matrix k;
00783               ArrayOfString k_names;
00784               Matrix k_aux;
00785               kSpecies(
00786                        k, 
00787                        k_names, 
00788                        k_aux,
00789                        
00790                        los, 
00791                        absloswfs, 
00792                        p_abs, 
00793                        t_abs, 
00794                        wfs_tgs, 
00795                        abs_per_tg, 
00796                        vmrs, 
00797                        k_grid,
00798                        
00799                        "frac");
00800               
00801               
00802               for ( Index ik=0; ik<k.ncols(); ik++ )
00803                 {
00804                   invrayjean( k(Range(joker),ik), f_mono, za_pencil_profile );
00805                 }
00806 
00807               jacbatch[i] = k;
00808             }
00809           
00810           
00811           yTB(y, f_mono, za_pencil_profile);
00812           
00813           
00814           ybatch(Range(joker),i) = y;
00815 
00816 
00817         }
00818       
00819       else
00820         {
00821           
00822           ybatch(Range(joker),i) = -1.0;
00823         }
00824     }
00825 }
00826 
00827 void ybatchFromRadiosondeGlobal(
00828                           Matrix& ybatch,
00829                           
00830                           const ArrayOfMatrix& radiosonde_data,
00831                           const Vector& f_mono,
00832                           const ArrayOfArrayOfLineRecord& lines_per_tg,
00833                           const ArrayOfLineshapeSpec& lineshape,
00834                           const Numeric& z_plat,
00835                           const Vector& za_pencil,
00836                           const Numeric& l_step,
00837                           const Index& refr,
00838                           const String& refr_model,
00839                           const Index& refr_lfac,
00840                           const Numeric& r_geoid,
00841                           const Index& emission,
00842                           const Vector& y_space,
00843                           const Vector& e_ground,
00844                           const TagGroups& tgs,
00845                           const ArrayOfString& cont_description_names,
00846                           const ArrayOfString& cont_description_models,
00847                           const ArrayOfVector& cont_description_parameters)
00848 {
00849   
00850   
00851   ybatch.resize( f_mono.nelem()*za_pencil.nelem(), radiosonde_data.nelem() );
00852   ybatch = 0;
00853 
00854   
00855   for ( Index i=0; i<radiosonde_data.nelem(); ++i )
00856     {
00857       const Matrix& rd = radiosonde_data[i];
00858 
00859       ConstVectorView p_raw = rd(Range(joker),0);
00860       ConstVectorView t_raw = rd(Range(joker),1);
00861       ConstVectorView z_raw = rd(Range(joker),2);
00862 
00863       Vector p_abs;
00864       
00865       VectorNLogSpace (p_abs,"p_abs",p_raw[0],p_raw[p_raw.nelem()-1],100);
00866       Vector t_abs( p_abs.nelem() );
00867       Vector z_abs( p_abs.nelem() );
00868                        
00869       interpp ( t_abs, p_raw, t_raw, p_abs );
00870       interpp ( z_abs, p_raw, z_raw, p_abs );        
00871       
00872       
00873       ConstVectorView h2o_raw = rd( Range(joker), 3 );
00874             
00875       Matrix vmrs( tgs.nelem(), p_abs.nelem() );
00876       interpp ( vmrs(0, Range( joker ) ), p_raw,h2o_raw, p_abs );
00877       vmrs( 1, Range( joker ) ) = 0.209;                  
00878       vmrs( 2, Range( joker ) ) = 0.782;                  
00879 
00880       
00881       Vector h2o_abs = vmrs( 0, Range( joker ) );
00882       
00883       
00884       Vector n2_abs  = vmrs( 2, Range( joker ) );
00885       
00886       
00887       Matrix        abs;
00888       ArrayOfMatrix abs_per_tg;
00889       
00890       absCalc(
00891              abs,
00892              abs_per_tg,
00893              
00894              tgs,
00895              f_mono,
00896              p_abs,
00897              t_abs,
00898              n2_abs,
00899              h2o_abs,
00900              vmrs,
00901              lines_per_tg,
00902              lineshape,
00903              cont_description_names,
00904              cont_description_models,
00905              cont_description_parameters);
00906 
00907       
00908       Numeric t_ground = t_raw[0];
00909 
00910       
00911       Numeric z_ground = z_raw[0];
00912       
00913       
00914       Vector refr_index;
00915       refrCalc(
00916                refr_index,
00917                
00918                p_abs,
00919                t_abs,
00920                h2o_abs,
00921                refr,
00922                refr_model);
00923 
00924 
00925       
00926       Los los;
00927       Vector z_tan;
00928       losCalc(
00929               los,
00930               z_tan,
00931               
00932               z_plat,
00933               za_pencil,
00934               l_step,
00935               p_abs,
00936               z_abs,
00937               refr,
00938               refr_lfac,
00939               refr_index,
00940               z_ground,
00941               r_geoid);
00942 
00943       
00944       ArrayOfMatrix source;
00945       sourceCalc(
00946                  source,
00947                  
00948                  emission,
00949                  los,
00950                  p_abs,
00951                  t_abs,
00952                  f_mono);
00953 
00954       
00955       ArrayOfMatrix trans;
00956       transCalc(
00957                 trans,
00958                 
00959                 los,
00960                 p_abs,
00961                 abs);
00962 
00963       
00964       Vector y;
00965       yCalc(
00966             y,
00967             
00968             emission,
00969             los,
00970             f_mono,
00971             y_space,
00972             source,
00973             trans,
00974             e_ground,
00975             t_ground);
00976 
00977       
00978       ybatch(Range(joker),i) = y;
00979     }
00980 }
00981