00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00033 #include "arts.h"
00034 #include <map>
00035 #include <cfloat>
00036 #include <algorithm>
00037 #include <cmath>
00038 #include "absorption.h"
00039 #include "math_funcs.h"
00040 #include "messages.h"
00041 #include "logic.h"
00042
00043
00045 std::map<String, Index> SpeciesMap;
00046
00047
00048
00049
00050
00051 Numeric IsotopeRecord::CalculatePartitionFctAtTemp( Numeric
00052 temperature ) const
00053 {
00054 Numeric result = 0.;
00055 Numeric exponent = 1.;
00056
00057 ArrayOfNumeric::const_iterator it;
00058
00059 for (it=mqcoeff.begin(); it != mqcoeff.end(); it++)
00060 {
00061 result += *it * exponent;
00062 exponent *= temperature;
00063 }
00064 return result;
00065 }
00066
00070 void define_species_map()
00071 {
00072 extern const Array<SpeciesRecord> species_data;
00073 extern std::map<String, Index> SpeciesMap;
00074
00075 for ( Index i=0 ; i<species_data.nelem() ; ++i)
00076 {
00077 SpeciesMap[species_data[i].Name()] = i;
00078 }
00079 }
00080
00081 ostream& operator << (ostream& os, const LineRecord& lr)
00082 {
00083
00084
00085 int precision;
00086 #ifdef USE_FLOAT
00087 precision = FLT_DIG;
00088 #else
00089 #ifdef USE_DOUBLE
00090 precision = DBL_DIG;
00091 #else
00092 #error Numeric must be double or float
00093 #endif
00094 #endif
00095
00096 os << "@"
00097 << " " << lr.Name ()
00098 << " "
00099 << setprecision(precision)
00100 << lr.F ()
00101 << " " << lr.Psf ()
00102 << " " << lr.I0 ()
00103 << " " << lr.Ti0 ()
00104 << " " << lr.Elow ()
00105 << " " << lr.Agam ()
00106 << " " << lr.Sgam ()
00107 << " " << lr.Nair ()
00108 << " " << lr.Nself ()
00109 << " " << lr.Tgam ()
00110 << " " << lr.Naux ()
00111 << " " << lr.dF ()
00112 << " " << lr.dI0 ()
00113 << " " << lr.dAgam ()
00114 << " " << lr.dSgam ()
00115 << " " << lr.dNair ()
00116 << " " << lr.dNself()
00117 << " " << lr.dPsf ();
00118
00119
00120 for ( Index i=0; i<lr.Naux(); ++i )
00121 os << " " << lr.Aux()[i];
00122
00123 return os;
00124 }
00125
00126
00135 template<class T>
00136 void extract(T& x,
00137 String& line,
00138 Index n)
00139 {
00140
00141
00142 x = T(0);
00143
00144
00145
00146
00147 istringstream item( line.substr(0,n) );
00148
00149
00150
00151
00152
00153
00154 line.erase(0,n);
00155
00156
00157
00158 item >> x;
00159 }
00160
00164 String LineRecord::Name() const {
00165
00166 extern const Array<SpeciesRecord> species_data;
00167 const SpeciesRecord& sr = species_data[mspecies];
00168 return sr.Name() + "-" + sr.Isotope()[misotope].Name();
00169 }
00170
00171
00181 const SpeciesRecord& LineRecord::SpeciesData() const {
00182
00183 extern const Array<SpeciesRecord> species_data;
00184 return species_data[mspecies];
00185 }
00186
00187
00199 const IsotopeRecord& LineRecord::IsotopeData() const {
00200
00201 extern const Array<SpeciesRecord> species_data;
00202 return species_data[mspecies].Isotope()[misotope];
00203 }
00204
00205
00206
00207
00208
00209
00210
00211
00212 bool LineRecord::ReadFromHitranStream(istream& is)
00213 {
00214
00215 extern const Array<SpeciesRecord> species_data;
00216
00217
00218
00219
00220 const Index missing = species_data.nelem() + 100;
00221
00222
00223
00224
00225
00226
00227 static Array< Index > hspec(100);
00228
00229
00230
00231 static Array< ArrayOfIndex > hiso(100);
00232
00233
00234 static bool hinit = false;
00235
00236
00237
00238 static ArrayOfIndex warned_missing;
00239
00240 if ( !hinit )
00241 {
00242
00243
00244 hspec = missing;
00245
00246 for ( Index i=0; i<species_data.nelem(); ++i )
00247 {
00248 const SpeciesRecord& sr = species_data[i];
00249
00250
00251
00252
00253 if ( 0 < sr.Isotope()[0].HitranTag() )
00254 {
00255
00256
00257
00258
00259
00260
00261
00262 Index mo = sr.Isotope()[0].HitranTag() / 10;
00263
00264 hspec[mo] = i;
00265
00266
00267 Index n_iso = sr.Isotope().nelem();
00268 ArrayOfIndex iso_tags;
00269 iso_tags.resize(n_iso);
00270 for ( Index j=0; j<n_iso; ++j )
00271 {
00272 iso_tags[j] = sr.Isotope()[j].HitranTag();
00273 }
00274
00275
00276
00277
00278
00279
00280
00281
00282 hiso[mo].resize( max(iso_tags)%10 + 1 );
00283 hiso[mo] = missing;
00284
00285
00286
00287 for ( Index j=0; j<n_iso; ++j )
00288 {
00289 if ( 0 < iso_tags[j] )
00290 {
00291
00292
00293 hiso[mo][iso_tags[j] % 10] = j;
00294 }
00295 }
00296 }
00297 }
00298
00299
00300
00301 out3 << " HITRAN index table:\n";
00302 for ( Index i=0; i<hspec.nelem(); ++i )
00303 {
00304 if ( missing != hspec[i] )
00305 {
00306
00307
00308
00309 out3 << " mo = " << i << " Species = "
00310 << setw(10) << setiosflags(ios::left)
00311 << species_data[hspec[i]].Name().c_str()
00312 << "iso = ";
00313 for ( Index j=1; j<hiso[i].nelem(); ++j )
00314 {
00315 if ( missing==hiso[i][j] )
00316 out3 << " " << "m";
00317 else
00318 out3 << " " << species_data[hspec[i]].Isotope()[hiso[i][j]].Name();
00319 }
00320 out3 << "\n";
00321 }
00322 }
00323
00324 hinit = true;
00325 }
00326
00327
00328
00329
00330
00331 String line;
00332
00333
00334 Index mo;
00335
00336
00337 bool comment = true;
00338
00339 while (comment)
00340 {
00341
00342 if (is.eof()) return true;
00343
00344
00345 if (!is) throw runtime_error ("Stream bad.");
00346
00347
00348 getline(is,line);
00349
00350
00351
00352
00353
00354 if (line.nelem() == 0 && is.eof()) return true;
00355
00356
00357
00358 if (line[line.nelem () - 1] == 13)
00359 {
00360 line.erase (line.nelem () - 1, 1);
00361 }
00362
00363
00364
00365
00366
00367 mo = 0;
00368
00369
00370 extract(mo,line,2);
00371
00372
00373
00374 if ( 0 != mo )
00375 {
00376
00377 if ( missing != hspec[mo] )
00378 {
00379 comment = false;
00380
00381
00382
00383 Index nChar = line.nelem() + 2;
00384 if ( nChar != 100 )
00385 {
00386 ostringstream os;
00387 os << "Invalid HITRAN 1986-2001 line data record with " << nChar <<
00388 " characters (expected: 100)." << endl << line << " n: " << line.nelem ();
00389 throw runtime_error(os.str());
00390 }
00391
00392 }
00393 else
00394 {
00395
00396
00397 if ( 0 == std::count(warned_missing.begin(),
00398 warned_missing.end(),
00399 mo) )
00400 {
00401 out0 << "Error: HITRAN mo = " << mo << " is not "
00402 << "known to ARTS.\n";
00403 warned_missing.push_back(mo);
00404 arts_exit();
00405
00406
00407
00408 }
00409 }
00410 }
00411 }
00412
00413
00414
00415
00416 mspecies = hspec[mo];
00417
00418
00419 Index iso;
00420 extract(iso,line,1);
00421
00422
00423
00424
00425
00426
00427
00428 misotope = missing;
00429 if ( iso < hiso[mo].nelem() )
00430 if ( missing != hiso[mo][iso] )
00431 misotope = hiso[mo][iso];
00432
00433
00434 if (missing == misotope)
00435 {
00436 ostringstream os;
00437 os << "Species: " << species_data[mspecies].Name()
00438 << ", isotope iso = " << iso
00439 << " is unknown.";
00440 throw runtime_error(os.str());
00441 }
00442
00443
00444
00445 {
00446
00447 Numeric v;
00448
00449 extern const Numeric SPEED_OF_LIGHT;
00450
00451
00452
00453 const Numeric w2Hz = SPEED_OF_LIGHT * 100.;
00454
00455
00456 extract(v,line,12);
00457
00458
00459 mf = v * w2Hz;
00460
00461 }
00462
00463
00464 {
00465 extern const Numeric SPEED_OF_LIGHT;
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477 const Numeric hi2arts = 1e-2 * SPEED_OF_LIGHT;
00478
00479 Numeric s;
00480
00481
00482 extract(s,line,10);
00483
00484 mi0 = s * hi2arts;
00485
00486 mi0 /= species_data[mspecies].Isotope()[misotope].Abundance();
00487 }
00488
00489
00490 {
00491 Numeric r;
00492 extract(r,line,10);
00493 }
00494
00495
00496
00497 {
00498
00499
00500 Numeric gam;
00501
00502
00503 extern const Numeric ATM2PA;
00504
00505 extern const Numeric SPEED_OF_LIGHT;
00506
00507
00508 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
00509
00510 const Numeric hi2arts = w2Hz / ATM2PA;
00511
00512
00513 extract(gam,line,5);
00514
00515
00516 magam = gam * hi2arts;
00517
00518
00519 extract(gam,line,5);
00520
00521
00522 msgam = gam * hi2arts;
00523
00524
00525 if (0==msgam)
00526 msgam = magam;
00527
00528
00529 }
00530
00531
00532
00533 {
00534
00535
00536
00537
00538 extract(melow,line,10);
00539
00540
00541 melow = wavenumber_to_joule(melow);
00542 }
00543
00544
00545
00546 {
00547
00548 extract(mnair,line,4);
00549
00550
00551 mnself = mnair;
00552
00553 }
00554
00555
00556
00557 {
00558
00559
00560 Numeric d;
00561
00562
00563 extern const Numeric ATM2PA;
00564
00565 extern const Numeric SPEED_OF_LIGHT;
00566
00567
00568 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
00569
00570 const Numeric hi2arts = w2Hz / ATM2PA;
00571
00572
00573 extract(d,line,8);
00574
00575
00576 mpsf = d * hi2arts;
00577 }
00578
00579
00580
00581
00582 {
00583 Index eu;
00584 extract(eu,line,3);
00585 }
00586
00587
00588 {
00589 Index el;
00590 extract(el,line,3);
00591 }
00592
00593
00594 {
00595 Index eul;
00596 extract(eul,line,9);
00597 }
00598
00599
00600 {
00601 Index ell;
00602 extract(ell,line,9);
00603 }
00604
00605
00606 {
00607 Index df;
00608
00609 extract(df,line,1);
00610
00611 convHitranIERF(mdf,df);
00612 }
00613
00614
00615 {
00616 Index di0;
00617
00618 extract(di0,line,1);
00619 convHitranIERSH(mdi0,di0);
00620 }
00621
00622
00623 {
00624 Index dgam;
00625
00626 extract(dgam,line,1);
00627
00628 convHitranIERSH(mdagam,dgam);
00629
00630
00631
00632 }
00633
00634
00635
00636 mdpsf =-1;
00637
00638
00639
00640
00641
00642
00643
00644 mti0 = 296.0;
00645
00646
00647
00648 mtgam = 296.0;
00649
00650
00651 return false;
00652 }
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662 bool LineRecord::ReadFromHitran2004Stream(istream& is)
00663 {
00664
00665 extern const Array<SpeciesRecord> species_data;
00666
00667
00668
00669
00670 const Index missing = species_data.nelem() + 100;
00671
00672
00673
00674
00675
00676
00677 static Array< Index > hspec(100);
00678
00679
00680
00681 static Array< ArrayOfIndex > hiso(100);
00682
00683
00684 static bool hinit = false;
00685
00686
00687
00688 static ArrayOfIndex warned_missing;
00689
00690 if ( !hinit )
00691 {
00692
00693
00694 hspec = missing;
00695
00696 for ( Index i=0; i<species_data.nelem(); ++i )
00697 {
00698 const SpeciesRecord& sr = species_data[i];
00699
00700
00701
00702
00703 if ( 0 < sr.Isotope()[0].HitranTag() )
00704 {
00705
00706
00707
00708
00709
00710
00711
00712 Index mo = sr.Isotope()[0].HitranTag() / 10;
00713
00714 hspec[mo] = i;
00715
00716
00717 Index n_iso = sr.Isotope().nelem();
00718 ArrayOfIndex iso_tags;
00719 iso_tags.resize(n_iso);
00720 for ( Index j=0; j<n_iso; ++j )
00721 {
00722 iso_tags[j] = sr.Isotope()[j].HitranTag();
00723 }
00724
00725
00726
00727
00728
00729
00730
00731
00732 hiso[mo].resize( max(iso_tags)%10 + 1 );
00733 hiso[mo] = missing;
00734
00735
00736
00737 for ( Index j=0; j<n_iso; ++j )
00738 {
00739 if ( 0 < iso_tags[j] )
00740 {
00741
00742
00743 hiso[mo][iso_tags[j] % 10] = j;
00744 }
00745 }
00746 }
00747 }
00748
00749
00750
00751 out3 << " HITRAN index table:\n";
00752 for ( Index i=0; i<hspec.nelem(); ++i )
00753 {
00754 if ( missing != hspec[i] )
00755 {
00756
00757
00758
00759 out3 << " mo = " << i << " Species = "
00760 << setw(10) << setiosflags(ios::left)
00761 << species_data[hspec[i]].Name().c_str()
00762 << "iso = ";
00763 for ( Index j=1; j<hiso[i].nelem(); ++j )
00764 {
00765 if ( missing==hiso[i][j] )
00766 out3 << " " << "m";
00767 else
00768 out3 << " " << species_data[hspec[i]].Isotope()[hiso[i][j]].Name();
00769 }
00770 out3 << "\n";
00771 }
00772 }
00773
00774 hinit = true;
00775 }
00776
00777
00778
00779
00780
00781 String line;
00782
00783
00784 Index mo;
00785
00786
00787 bool comment = true;
00788
00789 while (comment)
00790 {
00791
00792 if (is.eof()) return true;
00793
00794
00795 if (!is) throw runtime_error ("Stream bad.");
00796
00797
00798 getline(is,line);
00799
00800
00801
00802
00803
00804 if (line.nelem() == 0 && is.eof()) return true;
00805
00806
00807
00808 if (line[line.nelem () - 1] == 13)
00809 {
00810 line.erase (line.nelem () - 1, 1);
00811 }
00812
00813
00814
00815
00816
00817 mo = 0;
00818
00819
00820 extract(mo,line,2);
00821
00822
00823
00824 if ( 0 != mo )
00825 {
00826
00827 if ( missing != hspec[mo] )
00828 {
00829 comment = false;
00830
00831
00832
00833 Index nChar = line.nelem() + 2;
00834 if ( nChar != 160 )
00835 {
00836 ostringstream os;
00837 os << "Invalid HITRAN 2004 line data record with " << nChar <<
00838 " characters (expected: 160).";
00839 throw runtime_error(os.str());
00840 }
00841
00842 }
00843 else
00844 {
00845
00846
00847 if ( 0 == std::count(warned_missing.begin(),
00848 warned_missing.end(),
00849 mo) )
00850 {
00851 out1 << "Warning: HITRAN molecule number mo = " << mo << " is not "
00852 << "known to ARTS.\n";
00853 warned_missing.push_back(mo);
00854 }
00855 }
00856 }
00857 }
00858
00859
00860
00861
00862 mspecies = hspec[mo];
00863
00864
00865 Index iso;
00866 extract(iso,line,1);
00867
00868
00869
00870
00871
00872
00873
00874 misotope = missing;
00875 if ( iso < hiso[mo].nelem() )
00876 if ( missing != hiso[mo][iso] )
00877 misotope = hiso[mo][iso];
00878
00879
00880 if (missing == misotope)
00881 {
00882 ostringstream os;
00883 os << "Species: " << species_data[mspecies].Name()
00884 << ", isotope iso = " << iso
00885 << " is unknown.";
00886 throw runtime_error(os.str());
00887 }
00888
00889
00890
00891 {
00892
00893 Numeric v;
00894
00895 extern const Numeric SPEED_OF_LIGHT;
00896
00897
00898
00899 const Numeric w2Hz = SPEED_OF_LIGHT * 100.;
00900
00901
00902 extract(v,line,12);
00903
00904
00905 mf = v * w2Hz;
00906
00907 }
00908
00909
00910 {
00911 extern const Numeric SPEED_OF_LIGHT;
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923 const Numeric hi2arts = 1e-2 * SPEED_OF_LIGHT;
00924
00925 Numeric s;
00926
00927
00928 extract(s,line,10);
00929
00930 mi0 = s * hi2arts;
00931
00932 mi0 /= species_data[mspecies].Isotope()[misotope].Abundance();
00933 }
00934
00935
00936 {
00937 Numeric r;
00938 extract(r,line,10);
00939 }
00940
00941
00942
00943 {
00944
00945
00946 Numeric gam;
00947
00948
00949 extern const Numeric ATM2PA;
00950
00951 extern const Numeric SPEED_OF_LIGHT;
00952
00953
00954 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
00955
00956 const Numeric hi2arts = w2Hz / ATM2PA;
00957
00958
00959 extract(gam,line,5);
00960
00961
00962 magam = gam * hi2arts;
00963
00964
00965 extract(gam,line,5);
00966
00967
00968 msgam = gam * hi2arts;
00969
00970
00971 if (0==msgam)
00972 msgam = magam;
00973
00974
00975 }
00976
00977
00978
00979 {
00980
00981
00982
00983
00984 extract(melow,line,10);
00985
00986
00987 melow = wavenumber_to_joule(melow);
00988 }
00989
00990
00991
00992 {
00993
00994 extract(mnair,line,4);
00995
00996
00997 mnself = mnair;
00998
00999 }
01000
01001
01002
01003 {
01004
01005
01006 Numeric d;
01007
01008
01009 extern const Numeric ATM2PA;
01010
01011 extern const Numeric SPEED_OF_LIGHT;
01012
01013
01014 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
01015
01016 const Numeric hi2arts = w2Hz / ATM2PA;
01017
01018
01019 extract(d,line,8);
01020
01021
01022 mpsf = d * hi2arts;
01023 }
01024
01025
01026
01027
01028 {
01029 Index eu;
01030 extract(eu,line,15);
01031 }
01032
01033
01034 {
01035 Index el;
01036 extract(el,line,15);
01037 }
01038
01039
01040 {
01041 Index eul;
01042 extract(eul,line,15);
01043 }
01044
01045
01046 {
01047 Index ell;
01048 extract(ell,line,15);
01049 }
01050
01051
01052 {
01053 Index df;
01054
01055 extract(df,line,1);
01056
01057 convHitranIERF(mdf,df);
01058 }
01059
01060
01061 {
01062 Index di0;
01063
01064 extract(di0,line,1);
01065
01066 convHitranIERSH(mdi0,di0);
01067 }
01068
01069
01070 {
01071 Index dagam;
01072
01073 extract(dagam,line,1);
01074
01075 convHitranIERSH(mdagam,dagam);
01076 }
01077
01078
01079 {
01080 Index dsgam;
01081
01082 extract(dsgam,line,1);
01083
01084 convHitranIERSH(mdsgam,dsgam);
01085 }
01086
01087
01088 {
01089 Index dnair;
01090
01091 extract(dnair,line,1);
01092
01093 convHitranIERSH(mdnair,dnair);
01094 }
01095
01096
01097
01098 mdnself =-1;
01099
01100
01101 {
01102 Index dpsf;
01103
01104 extract(dpsf,line,1);
01105
01106 convHitranIERF(mdpsf,dpsf);
01107
01108 mdpsf = mdpsf / mf;
01109 }
01110
01111
01112
01113
01114
01115
01116
01117 mti0 = 296.0;
01118
01119
01120
01121 mtgam = 296.0;
01122
01123
01124 return false;
01125 }
01126
01127
01128 bool LineRecord::ReadFromMytran2Stream(istream& is)
01129 {
01130
01131 extern const Array<SpeciesRecord> species_data;
01132
01133
01134
01135
01136 const Index missing = species_data.nelem() + 100;
01137
01138
01139
01140
01141
01142
01143
01144 static Array< Index > hspec(100,missing);
01145
01146
01147
01148 static Array< ArrayOfIndex > hiso(100);
01149
01150
01151 static bool hinit = false;
01152
01153
01154
01155 static ArrayOfIndex warned_missing;
01156
01157 if ( !hinit )
01158 {
01159 for ( Index i=0; i<species_data.nelem(); ++i )
01160 {
01161 const SpeciesRecord& sr = species_data[i];
01162
01163
01164
01165
01166 if ( 0 < sr.Isotope()[0].MytranTag() )
01167 {
01168
01169
01170
01171
01172
01173
01174
01175 Index mo = sr.Isotope()[0].MytranTag() / 10;
01176
01177 hspec[mo] = i;
01178
01179
01180 Index n_iso = sr.Isotope().nelem();
01181 ArrayOfIndex iso_tags;
01182 iso_tags.resize(n_iso);
01183 for ( Index j=0; j<n_iso; ++j )
01184 {
01185 iso_tags[j] = sr.Isotope()[j].MytranTag();
01186 }
01187
01188
01189
01190
01191
01192
01193
01194
01195 hiso[mo].resize( max(iso_tags)%10 + 1 );
01196 hiso[mo] = missing;
01197
01198
01199 for ( Index j=0; j<n_iso; ++j )
01200 {
01201 if ( 0 < iso_tags[j] )
01202 {
01203
01204
01205
01206 hiso[mo][iso_tags[j] % 10] = j;
01207 }
01208 }
01209 }
01210 }
01211
01212
01213
01214
01215
01216 out3 << " MYTRAN index table:\n";
01217 for ( Index i=0; i<hspec.nelem(); ++i )
01218 {
01219 if ( missing != hspec[i] )
01220 {
01221
01222
01223
01224 out3 << " mo = " << i << " Species = "
01225 << setw(10) << setiosflags(ios::left)
01226 << species_data[hspec[i]].Name().c_str()
01227 << "iso = ";
01228 for ( Index j=1; j<hiso[i].nelem(); ++j )
01229 {
01230 if ( missing==hiso[i][j] )
01231 out3 << " " << "m";
01232 else
01233 out3 << " " << species_data[hspec[i]].Isotope()[hiso[i][j]].Name();
01234 }
01235 out3 << "\n";
01236 }
01237 }
01238
01239 hinit = true;
01240 }
01241
01242
01243
01244
01245
01246 String line;
01247
01248
01249 Index mo;
01250
01251
01252 bool comment = true;
01253
01254 while (comment)
01255 {
01256
01257 if (is.eof()) return true;
01258
01259
01260 if (!is) throw runtime_error ("Stream bad.");
01261
01262
01263 getline(is,line);
01264
01265
01266
01267
01268
01269 if (line.nelem() == 0 && is.eof()) return true;
01270
01271
01272
01273
01274
01275 mo = 0;
01276
01277
01278 extract(mo,line,2);
01279
01280
01281
01282 if ( 0 != mo )
01283 {
01284
01285
01286 if ( missing != hspec[mo] ) comment = false ;
01287 else
01288 {
01289
01290
01291 if ( 0 == std::count(warned_missing.begin(),
01292 warned_missing.end(),
01293 mo) )
01294 {
01295 out0 << "Error: MYTRAN mo = " << mo << " is not "
01296 << "known to ARTS.\n";
01297 warned_missing.push_back(mo);
01298 arts_exit();
01299
01300
01301
01302 }
01303 }
01304 }
01305 }
01306
01307
01308
01309
01310 mspecies = hspec[mo];
01311
01312
01313 Index iso;
01314 extract(iso,line,1);
01315
01316
01317
01318
01319
01320
01321
01322 misotope = missing;
01323 if ( iso < hiso[mo].nelem() )
01324 if ( missing != hiso[mo][iso] )
01325 misotope = hiso[mo][iso];
01326
01327
01328 if (missing == misotope)
01329 {
01330 ostringstream os;
01331 os << "Species: " << species_data[mspecies].Name()
01332 << ", isotope iso = " << iso
01333 << " is unknown.";
01334 throw runtime_error(os.str());
01335 }
01336
01337
01338
01339 {
01340
01341 Numeric v;
01342
01343
01344 extract(v,line,13);
01345
01346
01347 mf = v * 1E6;
01348
01349 }
01350
01351
01352 {
01353
01354 Numeric df;
01355 extract(df,line,8);
01356
01357 mdf = df * 1E6;
01358 }
01359
01360
01361 {
01362 extern const Numeric SPEED_OF_LIGHT;
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373 const Numeric hi2arts = 1e-2 * SPEED_OF_LIGHT;
01374
01375 Numeric s;
01376
01377
01378 extract(s,line,10);
01379
01380
01381 mi0 = s * hi2arts;
01382 }
01383
01384
01385
01386 {
01387
01388
01389 Numeric gam;
01390
01391
01392 extern const Numeric TORR2PA;
01393
01394
01395 extract(gam,line,5);
01396
01397
01398 magam = gam * 1E6 / TORR2PA;
01399
01400
01401 extract(gam,line,5);
01402
01403
01404 msgam = gam * 1E6 / TORR2PA;
01405
01406
01407 }
01408
01409
01410
01411 {
01412
01413
01414
01415
01416 extract(melow,line,10);
01417
01418
01419 melow = wavenumber_to_joule(melow);
01420 }
01421
01422
01423
01424 {
01425
01426 extract(mnair,line,4);
01427
01428
01429 extract(mnself,line,4);
01430
01431 }
01432
01433
01434
01435 {
01436
01437 extract(mtgam,line,7);
01438 }
01439
01440
01441
01442 {
01443
01444 Numeric d;
01445
01446
01447 extern const Numeric TORR2PA;
01448
01449
01450 extract(d,line,9);
01451
01452
01453 mpsf = d * 1E6 / TORR2PA;
01454 }
01455
01456
01457
01458
01459 {
01460 Index eu;
01461 extract(eu,line,3);
01462 }
01463
01464
01465 {
01466 Index el;
01467 extract(el,line,3);
01468 }
01469
01470
01471 {
01472 Index eul;
01473 extract(eul,line,9);
01474 }
01475
01476
01477 {
01478 Index ell;
01479 extract(ell,line,9);
01480 }
01481
01482 {
01483 Index di0;
01484
01485 extract(di0,line,1);
01486
01487 convMytranIER(mdi0,di0);
01488 }
01489
01490
01491 {
01492 Index dgam;
01493
01494 extract(dgam,line,1);
01495
01496 convMytranIER(mdagam,dgam);
01497 }
01498
01499
01500 {
01501 Index dnair;
01502
01503 extract(dnair,line,1);
01504
01505 convMytranIER(mdnair,dnair);
01506 }
01507
01508
01509
01510
01511
01512
01513
01514
01515 mti0 = 296.0;
01516
01517
01518
01519
01520
01521
01522
01523 return false;
01524 }
01525
01526
01527 bool LineRecord::ReadFromJplStream(istream& is)
01528 {
01529
01530 extern const Array<SpeciesRecord> species_data;
01531
01532
01533
01534
01535
01536 static map<Index, SpecIsoMap> JplMap;
01537
01538
01539 static bool hinit = false;
01540
01541 if ( !hinit )
01542 {
01543
01544 out3 << " JPL index table:\n";
01545
01546 for ( Index i=0; i<species_data.nelem(); ++i )
01547 {
01548 const SpeciesRecord& sr = species_data[i];
01549
01550
01551 for ( Index j=0; j<sr.Isotope().nelem(); ++j)
01552 {
01553
01554 for (Index k=0; k<sr.Isotope()[j].JplTags().nelem(); ++k)
01555 {
01556
01557 SpecIsoMap indicies(i,j);
01558
01559 JplMap[sr.Isotope()[j].JplTags()[k]] = indicies;
01560
01561
01562
01563
01564
01565 const Index& i1 = JplMap[sr.Isotope()[j].JplTags()[k]].Speciesindex();
01566 const Index& i2 = JplMap[sr.Isotope()[j].JplTags()[k]].Isotopeindex();
01567
01568 out3 << " JPL TAG = " << sr.Isotope()[j].JplTags()[k] << " Species = "
01569 << setw(10) << setiosflags(ios::left)
01570 << species_data[i1].Name().c_str()
01571 << "iso = "
01572 << species_data[i1].Isotope()[i2].Name().c_str()
01573 << "\n";
01574 }
01575
01576 }
01577 }
01578 hinit = true;
01579 }
01580
01581
01582
01583
01584
01585 String line;
01586
01587
01588
01589 bool comment = true;
01590
01591 while (comment)
01592 {
01593
01594 if (is.eof()) return true;
01595
01596
01597 if (!is) throw runtime_error ("Stream bad.");
01598
01599
01600 getline(is,line);
01601
01602
01603
01604
01605
01606 if (line.nelem() == 0 && is.eof()) return true;
01607
01608
01609
01610
01611
01612
01613
01614
01615 Numeric v = 0.0;
01616
01617
01618 extract(v,line,13);
01619
01620
01621 if (v != 0.0)
01622 {
01623
01624 mf = v * 1E6;
01625
01626 comment = false;
01627 }
01628 }
01629
01630
01631 {
01632 Numeric df;
01633 extract(df,line,8);
01634
01635 mdf = df * 1E6;
01636 }
01637
01638
01639 {
01640
01641
01642
01643
01644
01645
01646
01647
01648 Numeric s;
01649
01650
01651 extract(s,line,8);
01652
01653
01654 s = pow((Numeric)10.,s);
01655
01656
01657 mi0 = s / 1E12;
01658 }
01659
01660
01661 {
01662 Index dr;
01663
01664
01665 extract(dr,line,2);
01666 }
01667
01668
01669 {
01670
01671
01672
01673
01674 extract(melow,line,10);
01675
01676
01677 melow = wavenumber_to_joule(melow);
01678 }
01679
01680
01681 {
01682 Index gup;
01683
01684
01685 extract(gup,line,3);
01686 }
01687
01688
01689 Index tag;
01690 {
01691
01692 extract(tag,line,7);
01693
01694
01695 tag = tag > 0 ? tag : -tag;
01696 }
01697
01698
01699
01700
01701 const map<Index, SpecIsoMap>::const_iterator i = JplMap.find(tag);
01702 if ( i == JplMap.end() )
01703 {
01704 ostringstream os;
01705 os << "JPL Tag: " << tag << " is unknown.";
01706 throw runtime_error(os.str());
01707 }
01708
01709 SpecIsoMap id = i->second;
01710
01711
01712
01713 mspecies = id.Speciesindex();
01714
01715
01716 misotope = id.Isotopeindex();
01717
01718
01719
01720
01721
01722
01723
01724 {
01725
01726 magam = 2.5E4;
01727
01728
01729 msgam = magam;
01730 }
01731
01732
01733
01734
01735
01736
01737
01738 {
01739 mnair = 0.75;
01740 mnself = 0.0;
01741 }
01742
01743
01744
01745
01746
01747 {
01748 mtgam = 300.0;
01749 }
01750
01751
01752
01753 {
01754 mpsf = 0.0;
01755 }
01756
01757
01758
01759
01760
01761
01762
01763
01764 mti0 = 300.0;
01765
01766
01767 return false;
01768 }
01769
01770
01771 bool LineRecord::ReadFromArtsStream(istream& is)
01772 {
01773
01774 extern const Array<SpeciesRecord> species_data;
01775
01776
01777
01778
01779 static map<String, SpecIsoMap> ArtsMap;
01780
01781
01782 static bool hinit = false;
01783
01784 if ( !hinit )
01785 {
01786
01787 out3 << " ARTS index table:\n";
01788
01789 for ( Index i=0; i<species_data.nelem(); ++i )
01790 {
01791 const SpeciesRecord& sr = species_data[i];
01792
01793
01794 for ( Index j=0; j<sr.Isotope().nelem(); ++j)
01795 {
01796
01797 SpecIsoMap indicies(i,j);
01798 String buf = sr.Name()+"-"+sr.Isotope()[j].Name();
01799
01800 ArtsMap[buf] = indicies;
01801
01802
01803
01804
01805
01806 const Index& i1 = ArtsMap[buf].Speciesindex();
01807 const Index& i2 = ArtsMap[buf].Isotopeindex();
01808
01809 out3 << " Arts Identifier = " << buf << " Species = "
01810 << setw(10) << setiosflags(ios::left)
01811 << species_data[i1].Name().c_str()
01812 << "iso = "
01813 << species_data[i1].Isotope()[i2].Name().c_str()
01814 << "\n";
01815
01816 }
01817 }
01818 hinit = true;
01819 }
01820
01821
01822
01823
01824
01825 String line;
01826
01827
01828 bool comment = true;
01829
01830 while (comment)
01831 {
01832
01833 if (is.eof()) return true;
01834
01835
01836 if (!is) throw runtime_error ("Stream bad.");
01837
01838
01839 getline(is,line);
01840
01841
01842
01843
01844
01845 if (line.nelem() == 0 && is.eof()) return true;
01846
01847
01848 char c;
01849 extract(c,line,1);
01850
01851
01852 if (c == '@')
01853 {
01854 comment = false;
01855 }
01856 }
01857
01858
01859
01860 istringstream icecream(line);
01861
01862 String artsid;
01863 icecream >> artsid;
01864
01865 if (artsid.length() != 0)
01866 {
01867
01868
01869
01870 const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artsid);
01871 if ( i == ArtsMap.end() )
01872 {
01873 ostringstream os;
01874 os << "ARTS Tag: " << artsid << " is unknown.";
01875 throw runtime_error(os.str());
01876 }
01877
01878 SpecIsoMap id = i->second;
01879
01880
01881
01882 mspecies = id.Speciesindex();
01883
01884
01885 misotope = id.Isotopeindex();
01886
01887
01888
01889 icecream >> mf;
01890
01891
01892
01893 icecream >> mpsf;
01894
01895
01896 icecream >> mi0;
01897
01898
01899
01900 icecream >> mti0;
01901
01902
01903
01904 icecream >> melow;
01905
01906
01907
01908 icecream >> magam;
01909 icecream >> msgam;
01910
01911
01912 icecream >> mnair;
01913 icecream >> mnself;
01914
01915
01916
01917 icecream >> mtgam;
01918
01919
01920 Index naux;
01921 icecream >> naux;
01922
01923
01924 maux.resize(naux);
01925
01926 for (Index j = 0; j<naux; j++)
01927 {
01928 icecream >> maux[j];
01929
01930 }
01931
01932
01933 try
01934 {
01935 icecream >> mdf;
01936 icecream >> mdi0;
01937 icecream >> mdagam;
01938 icecream >> mdsgam;
01939 icecream >> mdnair;
01940 icecream >> mdnself;
01941 icecream >> mdpsf;
01942 }
01943 catch (runtime_error)
01944 {
01945
01946
01947
01948 mdf = -1;
01949 mdi0 = -1;
01950 mdagam = -1;
01951 mdsgam = -1;
01952 mdnair = -1;
01953 mdnself = -1;
01954 mdpsf = -1;
01955 }
01956 }
01957
01958
01959 return false;
01960 }
01961
01996 void xsec_species( MatrixView xsec,
01997 ConstVectorView f_grid,
01998 ConstVectorView abs_p,
01999 ConstVectorView abs_t,
02000 ConstVectorView abs_h2o_orig,
02001 ConstVectorView vmr,
02002 const ArrayOfLineRecord& abs_lines,
02003 const Index ind_ls,
02004 const Index ind_lsn,
02005 const Numeric cutoff)
02006 {
02007
02008 extern const Array<LineshapeRecord> lineshape_data;
02009 extern const Array<LineshapeNormRecord> lineshape_norm_data;
02010
02011
02012 extern const Numeric SPEED_OF_LIGHT;
02013
02014
02015 extern const Numeric BOLTZMAN_CONST;
02016
02017
02018 extern const Numeric AVOGADROS_NUMB;
02019
02020
02021 extern const Numeric PLANCK_CONST;
02022
02023
02024
02025
02026
02027 const Numeric doppler_const = sqrt( 2.0 * BOLTZMAN_CONST *
02028 AVOGADROS_NUMB) / SPEED_OF_LIGHT;
02029
02030
02031 Index nf = f_grid.nelem();
02032 Index nl = abs_lines.nelem();
02033
02034
02035 Index np = abs_p.nelem();
02036
02037
02038
02039
02040
02041 Vector ls(nf+1);
02042 Vector fac(nf+1);
02043
02044 bool cut = (cutoff != -1) ? true : false;
02045
02046
02047
02048 if (cut)
02049 {
02050 if ( ! is_sorted( f_grid ) )
02051 {
02052 ostringstream os;
02053 os << "If you use a lineshape function with cutoff, your\n"
02054 << "frequency grid *f_grid* must be sorted.\n"
02055 << "(Duplicate values are allowed.)";
02056 throw runtime_error(os.str());
02057 }
02058 }
02059
02060
02061 bool negative = false;
02062
02063 for (Index i = 0; !negative && i < abs_t.nelem (); i++)
02064 {
02065 if (abs_t[i] < 0.)
02066 negative = true;
02067 }
02068
02069 if (negative)
02070 {
02071 ostringstream os;
02072 os << "abs_t contains at least one negative temperature value.\n"
02073 << "This is not allowed.";
02074 throw runtime_error(os.str());
02075 }
02076
02077
02078
02079
02080 Vector f_local( nf + 1 );
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091 Index ii = (nf+1 < 10) ? 10 : nf+1;
02092 Vector aux(ii);
02093
02094
02095
02096
02097
02098 if ( abs_t.nelem() != np )
02099 {
02100 ostringstream os;
02101 os << "Variable abs_t must have the same dimension as abs_p.\n"
02102 << "abs_t.nelem() = " << abs_t.nelem() << '\n'
02103 << "abs_p.nelem() = " << np;
02104 throw runtime_error(os.str());
02105 }
02106
02107 if ( vmr.nelem() != np )
02108 {
02109 ostringstream os;
02110 os << "Variable vmr must have the same dimension as abs_p.\n"
02111 << "vmr.nelem() = " << vmr.nelem() << '\n'
02112 << "abs_p.nelem() = " << np;
02113 throw runtime_error(os.str());
02114 }
02115
02116
02117
02118
02119
02120
02121
02122 Vector abs_h2o(np);
02123 if ( abs_h2o_orig.nelem() == np )
02124 {
02125 abs_h2o = abs_h2o_orig;
02126 }
02127 else
02128 {
02129 if ( ( 1 == abs_h2o_orig.nelem()) &&
02130 ( -.99 > abs_h2o_orig[0]) )
02131 {
02132
02133
02134
02135 abs_h2o = -1;
02136 }
02137 else
02138 {
02139 ostringstream os;
02140 os << "Variable abs_h2o must have default value -1 or the\n"
02141 << "same dimension as abs_p.\n"
02142 << "abs_h2o.nelem() = " << abs_h2o.nelem() << '\n'
02143 << "abs_p.nelem() = " << np;
02144 throw runtime_error(os.str());
02145 }
02146 }
02147
02148
02149
02150 if ( xsec.nrows() != nf || xsec.ncols() != np )
02151 {
02152 ostringstream os;
02153 os << "Variable xsec must have dimensions [f_grid.nelem(),abs_p.nelem()].\n"
02154 << "[xsec.nrows(),xsec.ncols()] = [" << xsec.nrows()
02155 << ", " << xsec.ncols() << "]\n"
02156 << "f_grid.nelem() = " << nf << '\n'
02157 << "abs_p.nelem() = " << np;
02158 throw runtime_error(os.str());
02159 }
02160
02161
02162
02163 #pragma omp parallel private(ls, fac, f_local, aux)
02164 #pragma omp for
02165 for ( Index i=0; i<np; ++i )
02166 {
02167
02168
02169
02170
02171
02172 ls.resize(nf+1);
02173 fac.resize(nf+1);
02174 f_local.resize(nf+1);
02175 aux.resize(ii);
02176
02177
02178
02179 try
02180 {
02181
02182
02183
02184 Numeric p_i = abs_p[i];
02185 Numeric t_i = abs_t[i];
02186
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196
02197 const Numeric p_partial = p_i * vmr[i];
02198
02199
02200
02201 for ( Index l=0; l< nl; ++l )
02202 {
02203
02204
02205
02206
02207 f_local[Range(0,nf)] = f_grid;
02208
02209
02210
02211 Index nfl = nf;
02212
02213
02214
02215 Index nfls = nf;
02216
02217
02218 Numeric base=0.0;
02219
02220
02221
02222 LineRecord l_l = abs_lines[l];
02223
02224 Numeric F0 = l_l.F();
02225
02226
02227
02228
02229
02230 Numeric intensity = l_l.I0();
02231
02232
02233 Numeric e_lower = l_l.Elow();
02234
02235
02236 Numeric e_upper = e_lower + F0 * PLANCK_CONST;
02237
02238
02239
02240
02241
02242
02243
02244 Numeric part_fct_ratio =
02245 l_l.IsotopeData().CalculatePartitionFctRatio( l_l.Ti0(),
02246 t_i );
02247
02248
02249 Numeric nom = exp(- e_lower / ( BOLTZMAN_CONST * t_i ) ) -
02250 exp(- e_upper / ( BOLTZMAN_CONST * t_i ) );
02251
02252 Numeric denom = exp(- e_lower / ( BOLTZMAN_CONST * l_l.Ti0() ) ) -
02253 exp(- e_upper / ( BOLTZMAN_CONST * l_l.Ti0() ) );
02254
02255
02256
02257
02258
02259 intensity *= part_fct_ratio * nom / denom;
02260
02261 if (lineshape_norm_data[ind_lsn].Name() == "quadratic")
02262 {
02263
02264
02265
02266
02267
02268
02269 Numeric mafac = (PLANCK_CONST * F0) / (2.000e0 * BOLTZMAN_CONST
02270 * t_i);
02271 intensity = intensity * mafac / sinh(mafac);
02272 }
02273
02274
02275
02276
02277 const Numeric theta = l_l.Tgam() / t_i;
02278 const Numeric theta_Nair = pow(theta, l_l.Nair());
02279
02280 Numeric gamma
02281 = l_l.Agam() * theta_Nair * (p_i - p_partial)
02282 + l_l.Sgam() * pow(theta, l_l.Nself()) * p_partial;
02283
02284
02285
02286 Numeric sigma = F0 * doppler_const *
02287 sqrt( t_i / l_l.IsotopeData().Mass());
02288
02289
02290
02291
02292
02293 F0 += l_l.Psf() * p_i *
02294 std::pow( theta , (Numeric).25 + (Numeric)1.5*l_l.Nair() );
02295
02296
02297
02298
02299
02300
02301
02302
02303
02304
02305
02306
02307 aux[0] = theta;
02308 aux[1] = theta_Nair;
02309 aux[2] = p_i;
02310 aux[3] = vmr[i];
02311 aux[4] = abs_h2o[i];
02312 aux[5] = l_l.Agam();
02313 aux[6] = l_l.Nair();
02314
02315 if (l_l.Naux() > 1)
02316 {
02317 aux[7] = l_l.Aux()[0];
02318 aux[8] = l_l.Aux()[1];
02319
02320 }
02321 else
02322 {
02323 aux[7] = 0.0;
02324 aux[8] = 0.0;
02325 }
02326
02327
02328
02329
02330 Index i_f_min = 0;
02331 Index i_f_max = nf-1;
02332
02333
02334 if ( cut )
02335 {
02336
02337
02338
02339
02340
02341 while ( i_f_min < nf && (F0 - cutoff) > f_grid[i_f_min] )
02342 {
02343
02344 ++i_f_min;
02345 }
02346
02347
02348
02349
02350
02351
02352
02353 while ( i_f_max >= 0 && (F0 + cutoff) < f_grid[i_f_max] )
02354 {
02355
02356 --i_f_max;
02357 }
02358
02359
02360 ++i_f_max;
02361 f_local[i_f_max] = F0 + cutoff;
02362
02363
02364 nfls = i_f_max - i_f_min + 1;
02365
02366
02367
02368
02369 nfl = nfls -1;
02370 }
02371 else
02372 {
02373
02374 }
02375
02376
02377
02378
02379
02380
02381
02382 if ( nfl > 0 )
02383 {
02384
02385
02386
02387
02388
02389
02390 lineshape_data[ind_ls].Function()(ls,
02391 aux,F0,gamma,sigma,
02392 f_local[Range(i_f_min,nfls)],
02393 nfls);
02394
02395
02396 lineshape_norm_data[ind_lsn].Function()(fac,F0,
02397 f_local[Range(i_f_min,nfls)],
02398 t_i,nfls);
02399
02400
02401
02402 VectorView this_xsec = xsec(Range(i_f_min,nfl),i);
02403
02404
02405 VectorView this_ls = ls[Range(0,nfl)];
02406 VectorView this_fac = fac[Range(0,nfl)];
02407
02408
02409 if ( cut )
02410 {
02411
02412
02413 base = ls[nfls-1];
02414
02415
02416
02417 this_ls -= base;
02418 }
02419
02420
02421 {
02422
02423
02424
02425
02426
02427
02428
02429
02430
02431
02432
02433 const Numeric factors = intensity * l_l.IsotopeData().Abundance();
02434
02435
02436
02437
02438
02439
02440
02441
02442
02443
02444 this_ls *= this_fac;
02445 this_ls *= factors;
02446 this_xsec += this_ls;
02447 }
02448 }
02449 }
02450 }
02451 catch (runtime_error e)
02452 {
02453 exit_or_rethrow(e.what());
02454 }
02455 }
02456 }
02457
02458
02459
02460
02461
02462
02463
02464
02465
02467
02482 void refr_index_BoudourisDryAir (
02483 Vector& refr_index,
02484 ConstVectorView abs_p,
02485 ConstVectorView abs_t )
02486 {
02487 const Index n = abs_p.nelem();
02488 refr_index.resize( n );
02489
02490 assert ( n == abs_t.nelem() );
02491
02492
02493 for ( Index i=0; i<n; i++ )
02494 refr_index[i] = 1.0 + 77.593e-8 * abs_p[i] / abs_t[i];
02495 }
02496
02497
02498
02500
02514 void refr_index_Boudouris (
02515 Vector& refr_index,
02516 ConstVectorView abs_p,
02517 ConstVectorView abs_t,
02518 ConstVectorView abs_h2o )
02519 {
02520 const Index n = abs_p.nelem();
02521 refr_index.resize( n );
02522
02523 assert ( n == abs_t.nelem() );
02524 assert ( n == abs_h2o.nelem() );
02525
02526 Numeric e;
02527 Numeric p;
02528
02529 for ( Index i=0; i<n; i++ )
02530 {
02531 e = abs_p[i] * abs_h2o[i];
02532 p = abs_p[i] - e;
02533
02534 refr_index[i] = 1.0 + 77.593e-8 * p / abs_t[i] +
02535 72e-8 * e / abs_t[i] +
02536 3.754e-3 * e / (abs_t[i]*abs_t[i]);
02537 }
02538 }
02539
02551 Numeric wavenumber_to_joule(Numeric e)
02552 {
02553
02554 extern const Numeric PLANCK_CONST;
02555
02556
02557 extern const Numeric SPEED_OF_LIGHT;
02558
02559
02560 const Numeric lower_energy_const = PLANCK_CONST * SPEED_OF_LIGHT * 1E2;
02561
02562 return e*lower_energy_const;
02563 }
02564
02565
02566
02567
02568
02569
02570
02571
02572
02573 void convHitranIERF(
02574 Numeric& mdf,
02575 const Index& df
02576 )
02577 {
02578 switch ( df )
02579 {
02580 case 0:
02581 {
02582 mdf = -1;
02583 break;
02584 }
02585 case 1:
02586 {
02587 mdf = 30*1E9;
02588 break;
02589 }
02590 case 2:
02591 {
02592 mdf = 3*1E9;
02593 break;
02594 }
02595 case 3:
02596 {
02597 mdf = 300*1E6;
02598 break;
02599 }
02600 case 4:
02601 {
02602 mdf = 30*1E6;
02603 break;
02604 }
02605 case 5:
02606 {
02607 mdf = 3*1E6;
02608 break;
02609 }
02610 case 6:
02611 {
02612 mdf = 0.3*1E6;
02613 break;
02614 }
02615 }
02616 }
02617
02618
02619
02620 void convHitranIERSH(
02621 Numeric& mdh,
02622 const Index& dh
02623 )
02624 {
02625 switch ( dh )
02626 {
02627 case 0:
02628 {
02629 mdh = -1;
02630 break;
02631 }
02632 case 1:
02633 {
02634 mdh = -1;
02635 break;
02636 }
02637 case 2:
02638 {
02639 mdh = -1;
02640 break;
02641 }
02642 case 3:
02643 {
02644 mdh = 30;
02645 break;
02646 }
02647 case 4:
02648 {
02649 mdh = 20;
02650 break;
02651 }
02652 case 5:
02653 {
02654 mdh = 10;
02655 break;
02656 }
02657 case 6:
02658 {
02659 mdh =5;
02660 break;
02661 }
02662 case 7:
02663 {
02664 mdh =2;
02665 break;
02666 }
02667 case 8:
02668 {
02669 mdh =1;
02670 break;
02671 }
02672 }
02673 mdh=mdh/100;
02674 }
02675
02676
02677
02678
02679 void convMytranIER(
02680 Numeric& mdh,
02681 const Index & dh
02682 )
02683 {
02684 switch ( dh )
02685 {
02686 case 0:
02687 {
02688 mdh = 200;
02689 break;
02690 }
02691 case 1:
02692 {
02693 mdh = 100;
02694 break;
02695 }
02696 case 2:
02697 {
02698 mdh = 50;
02699 break;
02700 }
02701 case 3:
02702 {
02703 mdh = 30;
02704 break;
02705 }
02706 case 4:
02707 {
02708 mdh = 20;
02709 break;
02710 }
02711 case 5:
02712 {
02713 mdh = 10;
02714 break;
02715 }
02716 case 6:
02717 {
02718 mdh =5;
02719 break;
02720 }
02721 case 7:
02722 {
02723 mdh = 2;
02724 break;
02725 }
02726 case 8:
02727 {
02728 mdh = 1;
02729 break;
02730 }
02731 case 9:
02732 {
02733 mdh = 0.5;
02734 break;
02735 }
02736 }
02737 mdh=mdh/100;
02738 }
02739
02740 ostream& operator<< (ostream &os, const LineshapeSpec &)
02741 {
02742 os << "LineshapeSpec: Output operator not implemented";
02743 return os;
02744 }
02745