
function es = sea_emis(wflag)

%
% function es = sea_emis(wflag)
%
% return calculated sea water emissivity values.
% data file from Fred Wu on 6-10-98.
%
% Inputs: 
%   wflag: flag to write a formated emissivity file
%          = 0, no. defaults to 0.
%          = 1, kCARTA format
%          = 2, LBLRTM format
%
% Outputs: emissivity for specular and 6 wind speeds and 11 viewing angles
%  organized in a structure of es.ws**.a## where **==the wind speed and 
%  ##==the viewing angle.
% es.wn and es.wl are the wavenumbers and wavelengths
%
% Also makes a sample plot of some of the data.
%

if nargin==0;wflag=0;end

%
% In the following data statements, "SPECULAR" in the original data file 
% has been replaced with "-999"
% 

xx=[
% NORMALIZATION FACTOR [EQ.(20)]
%   WIND      0    10    20    30    40    50    60    70    75    80    85
% -999      00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000
%     0     00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00183
%     1     00000 00000 00000 00000 00000 00000 00000 00000 00000 00031 02833
%     3     00000 00000 00000 00000 00000 00000 00000 00000 00028 00700 10737
%     5     00000 00000 00000 00000 00000 00000 00000 00011 00194 02106 18505
%    10     00000 00000 00000 00000 00000 00000 00002 00214 01337 06781 35424
%    15     00000 00000 00000 00000 00000 00000 00019 00741 03106 11742 49684

% SEA WATER EMISSIVITY AT  3.5 MICRON (REFRACTIVE INDEX=1.406-.0094i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     97151 97150 97129 97022 96657 95596 92693 84831 76717 63130 40054
     0     97151 97149 97126 97016 96643 95566 92638 84800 76844 63932 44332
     1     97151 97148 97122 97004 96617 95514 92547 84766 77115 65445 50159
     3     97150 97146 97113 96982 96566 95410 92376 84777 77845 68402 57403
     5     97149 97143 97104 96958 96514 95307 92222 84889 78695 70827 61994
    10     97144 97132 97077 96895 96381 95059 91917 85437 80683 75087 68926
    15     97136 97119 97047 96828 96246 94829 91729 86086 82264 77879 73043
%
% SEA WATER EMISSIVITY AT  3.6 MICRON (REFRACTIVE INDEX=1.391-.0052i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     97325 97324 97304 97201 96847 95813 92963 85182 77100 63509 40336
     0     97325 97324 97302 97194 96833 95783 92908 85149 77223 64307 44631
     1     97325 97323 97297 97184 96808 95731 92817 85110 77487 65814 50479
     3     97324 97320 97289 97161 96758 95628 92646 85113 78205 68765 57743
     5     97323 97317 97280 97138 96707 95527 92490 85218 79046 71184 62340
    10     97318 97307 97254 97077 96576 95281 92182 85752 81017 75432 69273
    15     97310 97295 97224 97012 96444 95052 91991 86390 82586 78213 73385
%
% SEA WATER EMISSIVITY AT  3.7 MICRON (REFRACTIVE INDEX=1.380-.0036i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     97451 97449 97430 97329 96984 95970 93162 85446 77392 63800 40556
     0     97451 97449 97427 97323 96970 95940 93107 85410 77511 64594 44863
     1     97450 97448 97423 97313 96946 95889 93016 85369 77769 66097 50726
     3     97450 97445 97415 97291 96896 95788 92844 85365 78478 69042 58004
     5     97449 97443 97406 97268 96846 95687 92688 85465 79311 71456 62606
    10     97444 97433 97381 97208 96718 95443 92378 85987 81269 75693 69538
    15     97436 97421 97352 97144 96587 95215 92185 86617 82827 78466 73644
%
% SEA WATER EMISSIVITY AT  3.8 MICRON (REFRACTIVE INDEX=1.370-.0034i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     97563 97561 97542 97444 97107 96112 93344 85691 77666 64076 40765
     0     97562 97561 97540 97438 97093 96083 93289 85654 77781 64866 45084
     1     97562 97560 97536 97428 97069 96032 93198 85609 78033 66364 50962
     3     97562 97558 97528 97407 97021 95932 93026 85599 78733 69302 58251
     5     97561 97555 97519 97385 96971 95832 92869 85694 79559 71712 62856
    10     97556 97546 97495 97326 96845 95589 92557 86205 81503 75938 69787
    15     97548 97533 97466 97263 96715 95363 92362 86827 83052 78702 73888

% SEA WATER EMISSIVITY AT  3.9 MICRON (REFRACTIVE INDEX=1.363-.0038i)
%  WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     97640 97639 97620 97524 97192 96211 93472 85866 77862 64276 40919
     0     97640 97638 97618 97518 97178 96182 93417 85827 77975 65063 45245
     1     97640 97637 97614 97508 97155 96132 93326 85780 78223 66558 51133
     3     97639 97635 97606 97487 97107 96032 93154 85766 78916 69491 58430
     5     97638 97632 97597 97465 97058 95933 92997 85857 79736 71896 63038
    10     97633 97623 97573 97407 96933 95692 92683 86361 81671 76114 69967
    15     97626 97611 97545 97345 96805 95467 92486 86977 83212 78871 74062

% SEA WATER EMISSIVITY AT  4.0 MICRON (REFRACTIVE INDEX=1.357-.0046i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     97706 97704 97686 97591 97264 96296 93583 86018 78034 64452 41055
     0     97705 97704 97684 97586 97251 96267 93528 85978 78145 65237 45387
     1     97705 97703 97680 97576 97228 96217 93437 85929 78389 66727 51284
     3     97705 97701 97672 97555 97180 96118 93264 85911 79076 69655 58588
     5     97704 97698 97664 97533 97132 96019 93106 85999 79891 72057 63197
    10     97699 97689 97640 97476 97008 95779 92792 86496 81816 76268 70124
    15     97692 97677 97613 97415 96881 95555 92594 87106 83352 79018 74215

% SEA WATER EMISSIVITY AT  4.1 MICRON (REFRACTIVE INDEX=1.352-.0056i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     97760 97759 97740 97647 97324 96366 93675 86146 78180 64602 41171
     0     97760 97758 97738 97641 97311 96337 93620 86105 78288 65384 45509
     1     97759 97757 97735 97631 97288 96288 93529 86055 78530 66871 51412
     3     97759 97755 97727 97611 97241 96189 93356 86034 79211 69795 58722
     5     97758 97752 97718 97590 97193 96091 93198 86118 80022 72194 63333
    10     97753 97743 97695 97533 97070 95852 92883 86609 81940 76398 70257
    15     97746 97732 97668 97473 96944 95628 92683 87215 83469 79143 74345

% SEA WATER EMISSIVITY AT  8.0 MICRON (REFRACTIVE INDEX=1.297-.0343i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     98306 98305 98290 98211 97935 97095 94663 87581 79851 66364 42574
     0     98306 98305 98288 98206 97923 97069 94609 87529 79935 67113 46969
     1     98306 98304 98285 98198 97903 97023 94518 87459 80137 68556 52944
     3     98306 98302 98279 98180 97861 96931 94345 87401 80751 71420 60304
     5     98305 98300 98272 98162 97818 96839 94186 87450 81509 73772 64917
    10     98301 98293 98251 98113 97707 96613 93862 87870 83328 77883 71797
    15     98295 98283 98228 98059 97592 96399 93651 88421 84787 80555 75828

% SEA WATER EMISSIVITY AT  8.4 MICRON (REFRACTIVE INDEX=1.287-.0361i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     98401 98400 98385 98309 98042 97227 94849 87868 80195 66738 42881
     0     98401 98399 98383 98305 98030 97200 94795 87813 80273 67479 47286
     1     98401 98399 98380 98296 98010 97155 94705 87739 80466 68911 53274
     3     98400 98397 98374 98279 97970 97065 94532 87673 81066 71760 60641
     5     98399 98395 98367 98261 97928 96975 94373 87715 81811 74099 65251
    10     98396 98388 98348 98214 97820 96752 94048 88119 83608 78187 72117
    15     98390 98378 98325 98162 97707 96540 93834 88658 85050 80842 76133

% SEA WATER EMISSIVITY AT  8.8 MICRON (REFRACTIVE INDEX=1.275-.0385i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     98511 98510 98496 98423 98167 97381 95072 88218 80619 67205 43269
     0     98511 98509 98494 98419 98156 97356 95018 88160 80691 67935 47685
     1     98510 98509 98491 98411 98137 97312 94929 88081 80873 69353 53688
     3     98510 98507 98485 98395 98098 97224 94757 88005 81453 72181 61061
     5     98509 98505 98479 98378 98057 97135 94597 88038 82183 74505 65668
    10     98506 98498 98460 98331 97952 96916 94271 88423 83951 78562 72514
    15     98500 98489 98439 98281 97843 96707 94055 88947 85373 81195 76509

% SEA WATER EMISSIVITY AT  9.2 MICRON (REFRACTIVE INDEX=1.262-.0405i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     98627 98626 98613 98544 98300 97548 95316 88611 81102 67743 43723
     0     98627 98626 98611 98540 98290 97523 95263 88550 81166 68460 48151
     1     98627 98625 98609 98532 98271 97481 95174 88466 81335 69861 54169
     3     98626 98623 98603 98517 98234 97395 95003 88379 81893 72664 61546
     5     98625 98621 98597 98500 98195 97308 94844 88401 82605 74968 66147
    10     98622 98615 98579 98456 98093 97093 94516 88764 84339 78989 72968
    15     98617 98607 98558 98408 97987 96888 94298 89270 85737 81594 76939

% SEA WATER EMISSIVITY AT  9.6 MICRON (REFRACTIVE INDEX=1.247-.0444i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     98753 98752 98740 98676 98446 97732 95591 89063 81665 68378 44265
     0     98753 98752 98739 98672 98436 97708 95539 88999 81719 69080 48705
     1     98753 98751 98736 98665 98418 97667 95451 88908 81873 70458 54738
     3     98753 98750 98731 98650 98383 97584 95281 88808 82404 73229 62119
     5     98752 98748 98725 98634 98345 97500 95122 88819 83094 75510 66710
    10     98749 98742 98708 98593 98248 97290 94794 89155 84788 79486 73499
    15     98744 98734 98689 98547 98146 97089 94572 89641 86156 82058 77439

% SEA WATER EMISSIVITY AT 10.0 MICRON (REFRACTIVE INDEX=1.227-.0498i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     98912 98911 98900 98841 98630 97969 95954 89678 82444 69272 45040
     0     98912 98911 98898 98837 98621 97946 95902 89609 82484 69949 49494
     1     98911 98910 98896 98831 98605 97907 95815 89510 82617 71295 55546
     3     98911 98909 98891 98817 98571 97827 95648 89393 83109 74019 62927
     5     98910 98907 98886 98803 98537 97747 95490 89386 83768 76264 67501
    10     98908 98902 98871 98765 98445 97546 95161 89685 85402 80173 74238
    15     98903 98894 98853 98722 98348 97350 94936 90143 86729 82696 78133

% SEA WATER EMISSIVITY AT 10.5 MICRON (REFRACTIVE INDEX=1.194-.0642i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     99133 99133 99123 99073 98891 98309 96488 90615 83650 70681 46287
     0     99133 99132 99122 99070 98883 98288 96438 90538 83669 71319 50757
     1     99133 99132 99120 99064 98868 98252 96354 90427 83767 72610 56832
     3     99133 99131 99116 99053 98838 98178 96190 90283 84198 75254 64203
     5     99132 99129 99111 99040 98807 98104 96035 90250 84806 77439 68746
    10     99130 99125 99098 99006 98725 97915 95706 90492 86346 81237 75393
    15     99126 99118 99083 98969 98637 97730 95477 90904 87605 83680 79210

% SEA WATER EMISSIVITY AT 11.0 MICRON (REFRACTIVE INDEX=1.162-.0938i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     99252 99251 99242 99196 99027 98477 96725 90960 84043 71080 46591
     0     99252 99251 99241 99193 99019 98456 96675 90881 84056 71712 51077
     1     99252 99251 99240 99188 99005 98421 96591 90763 84145 72995 57173
     3     99251 99249 99236 99177 98977 98350 96426 90609 84561 75629 64560
     5     99251 99248 99232 99165 98947 98277 96270 90568 85156 77805 69107
    10     99249 99244 99219 99134 98868 98091 95938 90791 86674 81584 75749
    15     99245 99238 99205 99098 98783 97908 95705 91190 87916 84012 79555

% SEA WATER EMISSIVITY AT 11.5 MICRON (REFRACTIVE INDEX=1.134-.1375i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     99194 99193 99183 99131 98938 98312 96326 89946 82530 69089 44661
     0     99194 99193 99182 99128 98929 98289 96272 89873 82576 69797 49162
     1     99194 99193 99180 99122 98914 98249 96180 89769 82718 71188 55275
     3     99193 99191 99176 99109 98881 98168 96004 89646 83232 73980 62745
     5     99193 99190 99171 99096 98847 98086 95838 89637 83910 76274 67386
    10     99190 99185 99157 99060 98758 97880 95493 89937 85580 80261 74232
    15     99187 99178 99141 99019 98662 97680 95257 90399 86930 82830 78193

% SEA WATER EMISSIVITY AT 12.0 MICRON (REFRACTIVE INDEX=1.118-.1900i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     98894 98893 98879 98807 98541 97694 95120 87450 79163 65064 41082
     0     98894 98893 98878 98802 98529 97665 95059 87400 79277 65895 45539
     1     98894 98892 98875 98794 98508 97615 94957 87337 79531 67460 51595
     3     98893 98890 98869 98776 98464 97514 94765 87298 80241 70507 59113
     5     98892 98888 98862 98758 98420 97412 94589 87372 81080 72995 63866
    10     98889 98881 98843 98709 98303 97164 94237 87852 83052 77341 71011
    15     98884 98872 98820 98655 98180 96930 94010 88455 84616 80168 75227

% SEA WATER EMISSIVITY AT 12.5 MICRON (REFRACTIVE INDEX=1.129-.2490i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     98288 98287 98267 98161 97784 96632 93359 84472 75543 61149 37906
     0     98288 98287 98265 98154 97768 96597 93296 84453 75721 62064 42250
     1     98288 98286 98260 98143 97740 96536 93192 84442 76077 63744 48163
     3     98288 98283 98252 98119 97682 96415 92999 84503 76961 66957 55602
     5     98286 98280 98242 98093 97624 96295 92827 84668 77942 69577 60376
    10     98281 98270 98215 98026 97474 96010 92496 85340 80180 74187 67677
    15     98273 98257 98183 97953 97321 95749 92299 86091 81938 77218 72065

% SEA WATER EMISSIVITY AT 13.0 MICRON (REFRACTIVE INDEX=1.150-.2950i)
%   WIND      0    10    20    30    40    50    60    70    75    80    85
  -999     97674 97673 97647 97514 97051 95687 91990 82499 73329 58928 36227
     0     97674 97672 97644 97506 97032 95648 91928 82499 73538 59873 40479
     1     97674 97671 97639 97492 97000 95582 91827 82519 73943 61591 46275
     3     97673 97668 97628 97463 96933 95451 91641 82638 74910 64856 53613
     5     97672 97664 97616 97432 96866 95324 91478 82856 75957 67519 58358
    10     97665 97651 97582 97352 96696 95022 91172 83634 78321 72226 65677
    15     97655 97635 97544 97266 96525 94750 91001 84465 80172 75343 70118];

%wavelengths and wavenumbers
wl = flipud([3.5 3.6 3.7 3.8 3.9 4.0 4.1 8.0 8.4 8.8 9.2 9.6 10 10.5 11 11.5 12 12.5 13]');
wn = 1e4./wl;

wind_speed = xx(:,1);
angle = [0 10 20 30 40 50 60 70 75 80 85]';
emis = xx(:,2:12)/1e5;

es.specular.a00=flipud(emis(find(wind_speed==-999),find(angle==00)));
es.specular.a10=flipud(emis(find(wind_speed==-999),find(angle==10)));
es.specular.a20=flipud(emis(find(wind_speed==-999),find(angle==20)));
es.specular.a30=flipud(emis(find(wind_speed==-999),find(angle==30)));
es.specular.a40=flipud(emis(find(wind_speed==-999),find(angle==40)));
es.specular.a50=flipud(emis(find(wind_speed==-999),find(angle==50)));
es.specular.a60=flipud(emis(find(wind_speed==-999),find(angle==60)));
es.specular.a70=flipud(emis(find(wind_speed==-999),find(angle==70)));
es.specular.a75=flipud(emis(find(wind_speed==-999),find(angle==75)));
es.specular.a80=flipud(emis(find(wind_speed==-999),find(angle==80)));
es.specular.a85=flipud(emis(find(wind_speed==-999),find(angle==85)));

es.ws00.a00=flipud(emis(find(wind_speed==00),find(angle==00)));
es.ws00.a10=flipud(emis(find(wind_speed==00),find(angle==10)));
es.ws00.a20=flipud(emis(find(wind_speed==00),find(angle==20)));
es.ws00.a30=flipud(emis(find(wind_speed==00),find(angle==30)));
es.ws00.a40=flipud(emis(find(wind_speed==00),find(angle==40)));
es.ws00.a50=flipud(emis(find(wind_speed==00),find(angle==50)));
es.ws00.a60=flipud(emis(find(wind_speed==00),find(angle==60)));
es.ws00.a70=flipud(emis(find(wind_speed==00),find(angle==70)));
es.ws00.a75=flipud(emis(find(wind_speed==00),find(angle==75)));
es.ws00.a80=flipud(emis(find(wind_speed==00),find(angle==80)));
es.ws00.a85=flipud(emis(find(wind_speed==00),find(angle==85)));

es.ws01.a00=flipud(emis(find(wind_speed==01),find(angle==00)));
es.ws01.a10=flipud(emis(find(wind_speed==01),find(angle==10)));
es.ws01.a20=flipud(emis(find(wind_speed==01),find(angle==20)));
es.ws01.a30=flipud(emis(find(wind_speed==01),find(angle==30)));
es.ws01.a40=flipud(emis(find(wind_speed==01),find(angle==40)));
es.ws01.a50=flipud(emis(find(wind_speed==01),find(angle==50)));
es.ws01.a60=flipud(emis(find(wind_speed==01),find(angle==60)));
es.ws01.a70=flipud(emis(find(wind_speed==01),find(angle==70)));
es.ws01.a75=flipud(emis(find(wind_speed==01),find(angle==75)));
es.ws01.a80=flipud(emis(find(wind_speed==01),find(angle==80)));
es.ws01.a85=flipud(emis(find(wind_speed==01),find(angle==85)));

es.ws03.a00=flipud(emis(find(wind_speed==03),find(angle==00)));
es.ws03.a10=flipud(emis(find(wind_speed==03),find(angle==10)));
es.ws03.a20=flipud(emis(find(wind_speed==03),find(angle==20)));
es.ws03.a30=flipud(emis(find(wind_speed==03),find(angle==30)));
es.ws03.a40=flipud(emis(find(wind_speed==03),find(angle==40)));
es.ws03.a50=flipud(emis(find(wind_speed==03),find(angle==50)));
es.ws03.a60=flipud(emis(find(wind_speed==03),find(angle==60)));
es.ws03.a70=flipud(emis(find(wind_speed==03),find(angle==70)));
es.ws03.a75=flipud(emis(find(wind_speed==03),find(angle==75)));
es.ws03.a80=flipud(emis(find(wind_speed==03),find(angle==80)));
es.ws03.a85=flipud(emis(find(wind_speed==03),find(angle==85)));

es.ws05.a00=flipud(emis(find(wind_speed==05),find(angle==00)));
es.ws05.a10=flipud(emis(find(wind_speed==05),find(angle==10)));
es.ws05.a20=flipud(emis(find(wind_speed==05),find(angle==20)));
es.ws05.a30=flipud(emis(find(wind_speed==05),find(angle==30)));
es.ws05.a40=flipud(emis(find(wind_speed==05),find(angle==40)));
es.ws05.a50=flipud(emis(find(wind_speed==05),find(angle==50)));
es.ws05.a60=flipud(emis(find(wind_speed==05),find(angle==60)));
es.ws05.a70=flipud(emis(find(wind_speed==05),find(angle==70)));
es.ws05.a75=flipud(emis(find(wind_speed==05),find(angle==75)));
es.ws05.a80=flipud(emis(find(wind_speed==05),find(angle==80)));
es.ws05.a85=flipud(emis(find(wind_speed==05),find(angle==85)));

es.ws10.a00=flipud(emis(find(wind_speed==10),find(angle==00)));
es.ws10.a10=flipud(emis(find(wind_speed==10),find(angle==10)));
es.ws10.a20=flipud(emis(find(wind_speed==10),find(angle==20)));
es.ws10.a30=flipud(emis(find(wind_speed==10),find(angle==30)));
es.ws10.a40=flipud(emis(find(wind_speed==10),find(angle==40)));
es.ws10.a50=flipud(emis(find(wind_speed==10),find(angle==50)));
es.ws10.a60=flipud(emis(find(wind_speed==10),find(angle==60)));
es.ws10.a70=flipud(emis(find(wind_speed==10),find(angle==70)));
es.ws10.a75=flipud(emis(find(wind_speed==10),find(angle==75)));
es.ws10.a80=flipud(emis(find(wind_speed==10),find(angle==80)));
es.ws10.a85=flipud(emis(find(wind_speed==10),find(angle==85)));

es.ws15.a00=flipud(emis(find(wind_speed==15),find(angle==00)));
es.ws15.a10=flipud(emis(find(wind_speed==15),find(angle==10)));
es.ws15.a20=flipud(emis(find(wind_speed==15),find(angle==20)));
es.ws15.a30=flipud(emis(find(wind_speed==15),find(angle==30)));
es.ws15.a40=flipud(emis(find(wind_speed==15),find(angle==40)));
es.ws15.a50=flipud(emis(find(wind_speed==15),find(angle==50)));
es.ws15.a60=flipud(emis(find(wind_speed==15),find(angle==60)));
es.ws15.a70=flipud(emis(find(wind_speed==15),find(angle==70)));
es.ws15.a75=flipud(emis(find(wind_speed==15),find(angle==75)));
es.ws15.a80=flipud(emis(find(wind_speed==15),find(angle==80)));
es.ws15.a85=flipud(emis(find(wind_speed==15),find(angle==85)));

es.wn = wn;
es.wl = wl;
es.wind_speed = wind_speed(1:7);
es.angle = angle;

if wflag ~= 1.5 & wflag ~= 2.5
clf
subplot(211)
plot(es.wn,es.ws00.a00,'rd-')
hold
title('wind speed = 0, angles=0,10,20,30,40,50,60,70,75,80,85^o')
plot(es.wn,es.ws00.a10,'gd-')
plot(es.wn,es.ws00.a20,'bd-')
plot(es.wn,es.ws00.a30,'yd-')
plot(es.wn,es.ws00.a40,'cd-')
plot(es.wn,es.ws00.a50,'md-')
plot(es.wn,es.ws00.a60,'kd-')
plot(es.wn,es.ws00.a70,'rd-')
plot(es.wn,es.ws00.a75,'gd-')
plot(es.wn,es.ws00.a80,'bd-')
plot(es.wn,es.ws00.a85,'yd-')
grid
subplot(212)
plot(es.wn,es.ws00.a00,'rd-')
hold
title('angle=0^o, wind speed = 0, 1, 3, 5, 10, 15')
plot(es.wn,es.ws01.a00,'gd-')
plot(es.wn,es.ws03.a00,'bd-')
plot(es.wn,es.ws05.a00,'cd-')
plot(es.wn,es.ws10.a00,'md-')
plot(es.wn,es.ws15.a00,'kd-')
grid
end

% produce kCARTA format emissivity file
if wflag==1
 
 disp('write kCARTA emissivity file: select angle and wind speed and then "ok"')
 figure('Units','norm','Position',[.4 .4 .2 .2],'Tag','nf1');
 
 uicontrol('Style','Popupmenu',...
            'String','00|10|20|30|40|50|60|70|75|80|85',...
            'Units','norm','Position',[.1 .4 .35 .2],'Tag','whichangle');
 uicontrol('Style','Text',...
            'String','Viewing Angle (degrees) :',...
            'Units','norm','Position',[.1 .6 .35 .2]);
 uicontrol('Style','Popupmenu',...
            'String','00|01|03|05|10|15',...
            'Units','norm','Position',[.55 .4 .35 .2],'Tag','whichwspeed');
 uicontrol('Style','Text',...
            'String','Wind Speed :',...
            'Units','norm','Position',[.55 .6 .35 .2]);
 uicontrol('Style','PushButton',...
            'String','OK',...
            'Units','norm','Position',[.4 .1 .2 .2],'Tag','ok',...
            'Callback','sea_emis(1.5);');

% produce LBLRTM format emissivity file
elseif wflag == 2

 disp('write LBLRTM emissivity file: select angle and wind speed and then "ok"')
 figure('Units','norm','Position',[.4 .4 .2 .2],'Tag','nf1');
 
 uicontrol('Style','Popupmenu',...
            'String','00|10|20|30|40|50|60|70|75|80|85',...
            'Units','norm','Position',[.1 .4 .35 .2],'Tag','whichangle');
 uicontrol('Style','Text',...
            'String','Viewing Angle (degrees) :',...
            'Units','norm','Position',[.1 .6 .35 .2]);
 uicontrol('Style','Popupmenu',...
            'String','00|01|03|05|10|15',...
            'Units','norm','Position',[.55 .4 .35 .2],'Tag','whichwspeed');
 uicontrol('Style','Text',...
            'String','Wind Speed :',...
            'Units','norm','Position',[.55 .6 .35 .2]);
 uicontrol('Style','PushButton',...
            'String','OK',...
            'Units','norm','Position',[.4 .1 .2 .2],'Tag','ok',...
            'Callback','sea_emis(2.5);');
end

if wflag == 1.5

 angles = get(findobj(gcf,'Tag','whichangle'),'String');
 angstring = angles(get(findobj(gcf,'Tag','whichangle'),'Value'),:);
 speeds = get(findobj(gcf,'Tag','whichwspeed'),'String');
 wsstring = speeds(get(findobj(gcf,'Tag','whichwspeed'),'Value'),:);
 close(findobj('Tag','nf1'));

 eval(['emis = es.ws' wsstring '.a' angstring ';'])

 fid = fopen('emissivity.asc','w');
 fprintf(fid,'%3i\n',length(es.wn));
 for i = 1:length(es.wn)
   fprintf(fid,'%12.5f %12.8f \n',es.wn(i),emis(i));
 end
 fclose(fid);
 disp('file "emissivity.asc" written')
 disp(' ')
end


if wflag == 2.5

 angles = get(findobj(gcf,'Tag','whichangle'),'String');
 angstring = angles(get(findobj(gcf,'Tag','whichangle'),'Value'),:);
 speeds = get(findobj(gcf,'Tag','whichwspeed'),'String');
 wsstring = speeds(get(findobj(gcf,'Tag','whichwspeed'),'Value'),:);
 close(findobj('Tag','nf1'));

 eval(['emis = es.ws' wsstring '.a' angstring ';'])

 % interpolate to a fixed dv wavenumber grid
 V = (380:10:3100)';
 NLIM = length(V);
 DV = mean(diff(V));
 V1 = min(V);
 V2 = max(V);
 EMIS = ones(NLIM,1);
 % interpolate where there is data
 ind=find(V >= min(es.wn) & V <= max(es.wn));
 EMIS(ind) = interp1(es.wn,emis,V(ind));
 % on low wavenumber end, extrapolate linearly from minimum data wavenumber to 600 1/cm
 ind=find(V >= 600 & V <= es.wn(1));
 EMIS(ind) = (emis(1)-emis(2))/(es.wn(1)-es.wn(2)) * (V(ind)-es.wn(1)) + emis(1);
 % between minimum wavenumber and 600, set to 1
 % on high wavenumber end, extrapolate linearly from maximum data wavenumber
 n = length(emis);
 ind=find(V >= es.wn(n));
 EMIS(ind) = (emis(n)-emis(n-1))/(es.wn(n)-es.wn(n-1)) * (V(ind)-es.wn(n)) + emis(n);

 fid = fopen('EMISSION','w');
 fprintf(fid,'%10.3f%10.3f%10.3f%10i\n',V1,V2,DV,NLIM);
 for i = 1:NLIM
   fprintf(fid,'%10.3f\n',EMIS(i));
 end
 fclose(fid);
 disp('file "EMISSION" written')
 disp(' ')
end




%
% REVISION INFORMATION (RCS Keyword):
%   $Id: sea_emis.m,v 1.1 2001/04/19 11:33:10 davet Exp $
%
%REVISION INFORMATION (RCS Keyword variable)
%------------------------------------------------------------------------------
rcs_id =  '$Id: sea_emis.m,v 1.1 2001/04/19 11:33:10 davet Exp $' ;

%------------------------------------------------------------------------------
%
% EXPANDED REVISION INFORMATION (RCS Keywords):
%
%   $Id: sea_emis.m,v 1.1 2001/04/19 11:33:10 davet Exp $
%   $Author: davet $
%   $Log: sea_emis.m,v $
%   Revision 1.1  2001/04/19 11:33:10  davet
%   *** empty log message ***
%
%   $Locker:  $ 
%
%------------------------------------------------------------------------------
