%%
%% February 2012, plot_viz_jromag.m, revised from plot_viz.m in /aim3/emery/cetic_climatology
%% This program is written for plotting the TIEGCM dres vdrift data at 8 glons vs the vdrift
%%  model estimates from Scherliess and Fejer in ~emery/cetic/vdrift-model_jgr0499.f
%% BA Emery, Revised to read Dave Anderson's JRO mag 7-17LT data in /hao/polar1/aurora_d/jro_viz/mags
%%   copied over to aim3 in jicmag_viz_07325_08020 (missing several days in 6668 lines)
clear all; close all

loncutsE=[25,90,140,175,200,250,285,345]; % specify climatology longitudes to plot
 nday1 = 325;
 nday2 = 366+20;

xt24 = [0,24];
wx = 35;
wn = -45.;
ytot = [wn,wx];
zero = [0.,0.];
fsize = 12;

% #2 25 day numbers for Kp>=2 and Vsw>=500km/s: 07325-330, 345-6, 351-7, 08005-8, 14-19
ndahi = [325,326,327,328,329,330,345,346,351,352,353,354,355,356,357, 5,6,7,8,14,15,16,17,18,19]
% #1 25 daynumbers for Kp=<1 and Vsw=<450km/s: 07332-343, 349-350, 358-360, 362-4, 08001-4, 11
ndalo = [332,333,334,335,336,337,338,339,340,341,342,343,349,350,358,359,360,362,363,364, 1,2,3,4,11]

% read ASTRA TIME-GCM/AMIE outputs of ion drifts at Jicamarca (140-170km) and (218-577km)
filtimami = sprintf('/hao/aim3/emery/cetic_climatology/astra_amie_time/61day_jica_drifts.dat')
% 1464/24=61days
dattimami = dlmread(filtimami,'',2,0);

% Calc 12 days of ISR data
for nh=1:24
 utta(nh) = nh-1;
 wi400ta(nh) = 0.;
end
% ISR Viz data on days 07347-354 and 08017-26
for nd=347:354
 jd0 = (nd-325)*24;
 for nh=1:24
  wi400ta(nh) = wi400ta(nh) + dattimami(jd0+nh,9);
 end
end
for nd=17:20
 jd0 = (365+nd-325)*24;
 for nh=1:24
  wi400ta(nh) = wi400ta(nh) + dattimami(jd0+nh,9);
 end
end
for nh=1:24
 wi400ta(nh) = wi400ta(nh)/12.;
end

% Calc 61 days (48d mag data and 34d JULIA data) at 150km
for nh=1:24
 ui150ta(nh) = 0.;
 wi150ta(nh) = 0.;
end
for id=1:61
 jd0 = (id-1)*24;
  nd = id+324;
  if (nd>365)
   nd = nd - 365;
  end
 for nh=1:24
   wi150ta(nh) = wi150ta(nh) + dattimami(jd0+nh,6);
   ui150ta(nh) = ui150ta(nh) + dattimami(jd0+nh,4); 
 end
end
 for nh=1:24
   wi150ta(nh) = wi150ta(nh)/61.;
   ui150ta(nh) = ui150ta(nh)/61.; 
 end

% This goes with j=7 at Jicamarca

% open jro_071213-20_080117-26.txt ISR Viz data on days 07347-354 and 08017-26 (or 7 hi, 2 lo 3+6 none = 18 days)
% 4307 lines (or 2874 lines before 21 Jan 2008)
filviisr = sprintf('jro_071213-20_080117-26.txt')
datviisr = dlmread(filviisr,'',0,0);
pikisr = [3,3,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3]

% Zero out arrays for ISR accumulation in UT
for ilev=1:3
for iut = 1:24
 utp5(iut) = iut - 0.5;
 numltis(iut,ilev) = 0;
 vizisrav(iut,ilev) = 0.;
end
end 

ndap = 347;
n = 0;
nd = 1;
for i=1:2874
 nda = datviisr(i,1);
 if (nda==ndap)
  n = n + 1;
 else
  n = 1;
  nd = nd + 1;
 end
 ilev = pikisr(nd);
  iut = fix(datviisr(i,4)*0.01) + 1;
  numltis(iut,ilev) = numltis(iut,ilev) + 1;
  vizisr(iut,ilev,numltis(iut,ilev)) = datviisr(i,7);
  erzisr(iut,ilev,numltis(iut,ilev)) = datviisr(i,8);
  vizisrav(iut,ilev) = vizisrav(iut,ilev) + datviisr(i,7);
  if (ilev<3)
  numltis(iut,3) = numltis(iut,3) + 1;
  vizisr(iut,3,numltis(iut,3)) = datviisr(i,7);
  erzisr(iut,3,numltis(iut,3)) = datviisr(i,8);
  vizisrav(iut,3) = vizisrav(iut,3) + datviisr(i,7);
  end
 ndap = nda;
end	% i=1:2874
% Find average
for ilev=1:3
for iut=1:24
 if (numltis(iut,ilev)>0)
  vizisrav(iut,ilev) = vizisrav(iut,ilev)/numltis(iut,ilev);
 end
end	% iut=1:24
end	% ilev=1:3


% open daytime jul_07305_08013.txt (start reading line 758-2885 or 2128 lines of data)
%  on days 326-331, 333-338, 355-362, 364-365+001-009, 011-013 (or 12 hi, 16 lo, 6 none = 34days)
%  Have no missing Viz, but can have missing ViE (none on 319(NA),326h,327h,328h,330h,331,7h,9=8 days, 7used days, 5 hi days)
filvi150 = sprintf('jul_07305_08013.txt')
datvi150 = dlmread(filvi150,'',757,0);
pik150 = [2,2,2,2,2,3,1,1,1,1,1,1,2,2,2,1,1,1,3,1,1,3,1,1,1,1,2,2,2,2,3,1,3,3]

% Zero out arrays for JULIA accumulation in UT
for ilev=1:3
for iut = 1:24
 utp5(iut) = iut - 0.5;
 numltz(iut,ilev) = 0;
 viz150av(iut,ilev) = 0.;
 numlte(iut,ilev) = 0;
 vie150av(iut,ilev) = 0.;
end
end 
% Zero out arrays for JULIA daily accumulation from 11-22UT
for nd=1:61
 jul1122(nd) = 0;
 nm1122(nd) = 0;
 jul1117(nd) = 0;
 nm1117(nd) = 0;
 jul1722(nd) = 0;
 nm1722(nd) = 0;
end
% Name Viz output file for daily means (from 1100-2159UT - 11 hours every day) 
outjul=sprintf('julia_viz1121_07325_08020.dat')
OUTJ = fopen(outjul,'w');

ndap = 326;
n = 0;
nd = 1;
for i=1:2128
 nda = datvi150(i,1);
 if (nda==ndap)
  n = n + 1;
 else
% Calculate average from 11-22UT
  jul1122(nd) = jul1122(nd)/nm1122(nd);
  jul1117(nd) = jul1117(nd)/nm1117(nd);
  jul1722(nd) = jul1722(nd)/nm1722(nd);
  fprintf(OUTJ,'%4.4d %3.3d %6.2f %3.3d %6.2f %3.3d %6.2f %3.3d \n',datvi150(i-1,2),ndap,jul1117(nd),nm1117(nd),jul1722(nd),nm1722(nd),jul1122(nd),nm1122(nd));
  n = 1;
  nd = nd + 1;
 end
 ilev = pik150(nd);
  iut = fix(datvi150(i,4)*0.01) + 1;
  numltz(iut,ilev) = numltz(iut,ilev) + 1;
  viz150(iut,ilev,numltz(iut,ilev)) = datvi150(i,7);
  erz150(iut,ilev,numltz(iut,ilev)) = datvi150(i,8);
  viz150av(iut,ilev) = viz150av(iut,ilev) + datvi150(i,7);
  if (ilev<3)
  numltz(iut,3) = numltz(iut,3) + 1;
  viz150(iut,3,numltz(iut,3)) = datvi150(i,7);
  erz150(iut,3,numltz(iut,3)) = datvi150(i,8);
  viz150av(iut,3) = viz150av(iut,3) + datvi150(i,7);
  end
  if (datvi150(i,10)>-3276.)
   numlte(iut,ilev) = numlte(iut,ilev) + 1;
   vie150(iut,ilev,numlte(iut,ilev)) = datvi150(i,10);
   ere150(iut,ilev,numlte(iut,ilev)) = datvi150(i,11);
   vie150av(iut,ilev) = vie150av(iut,ilev) + datvi150(i,10);
   if (ilev<3)
    numlte(iut,3) = numlte(iut,3) + 1;
    vie150(iut,3,numlte(iut,3)) = datvi150(i,10);
    ere150(iut,3,numlte(iut,3)) = datvi150(i,11);
    vie150av(iut,3) = vie150av(iut,3) + datvi150(i,10);
   end
  end
% Accumulate average from 11-22UT
   if datvi150(i,4)*0.01>=11.0 & datvi150(i,4)*0.01<22.0
    nm1122(nd) = nm1122(nd) + 1;
    jul1122(nd) = jul1122(nd) + datvi150(i,7);
    if (datvi150(i,4)*0.01<=17.0)
     nm1117(nd) = nm1117(nd) + 1;
     jul1117(nd) = jul1117(nd) + datvi150(i,7);
    else
     nm1722(nd) = nm1722(nd) + 1;
     jul1722(nd) = jul1722(nd) + datvi150(i,7);
    end
   end
 ndap = nda;
end	% i=1:2128
% Calculate average from 11-22UT
  jul1122(nd) = jul1122(nd)/nm1122(nd);
  jul1117(nd) = jul1117(nd)/nm1117(nd);
  jul1722(nd) = jul1722(nd)/nm1722(nd);
  fprintf(OUTJ,'%4.4d %3.3d %6.2f %3.3d %6.2f %3.3d %6.2f %3.3d \n',datvi150(i-1,2),ndap,jul1117(nd),nm1117(nd),jul1722(nd),nm1722(nd),jul1122(nd),nm1122(nd));
% Find average
for ilev=1:3
for iut=1:24
 if (numltz(iut,ilev)>0)
  viz150av(iut,ilev) = viz150av(iut,ilev)/numltz(iut,ilev);
 end
 if (numlte(iut,ilev)>0)
  vie150av(iut,ilev) = vie150av(iut,ilev)/numlte(iut,ilev);
 end
end	% iut=1:24
end	% ilev=1:3


% open 6668 line magnetometer data from Jicamarca and sort in daynumber (daynum year uth danfrac vizm/s)
% 07325_08020 vimag contains daynumbers:  325-328, 331-342, 344-351, 353-361, 364-365, 1-4, 6-9, 11-15 or 17 hi and 22 low days with 9 days skipped (missing 13 days of 61 total)
filvimag = sprintf('jicmag_viz_07325_08020')
datvimag = dlmread(filvimag,'',0,0);
pickda = [2,2,2,2,3,1,1,1,1,1,1,1,1,1,1,1,3,2,2,3,3,1,1,2,2,2,2,2,2,1,1,1,3,1,3,1,1,1,1,2,2,2,3,1,3,3,2,2]

% Zero out arrays for jicmag accumulation in UT
for ilev=1:3
for iut = 1:24
 utp5(iut) = iut - 0.5;
 numlt(iut,ilev) = 0;
 viave(iut,ilev) = 0.;
end
end 
% Zero out arrays for jicmag daily accumulation from 11-22UT
for nd=1:61
 viz1121(nd) = 0;
 num1121(nd) = 0;
 viz1116(nd) = 0;
 num1116(nd) = 0;
 viz1722(nd) = 0;
 num1722(nd) = 0;
end

% Name Viz output file for daily means (from 1100-2159UT - 13 hours every day) 
outglob=sprintf('jicmag_viz1121_07325_08020.dat')
OUTG = fopen(outglob,'w');

ndap = 325;
n = 0;
nd = 1;
for i=1:6668
 nda = datvimag(i,1);
 if (nda==ndap)
  n = n + 1;
 else
% Calculate average from 11-22UT
  viz1121(nd) = viz1121(nd)/num1121(nd);
  viz1116(nd) = viz1116(nd)/num1116(nd);
  viz1722(nd) = viz1722(nd)/num1722(nd);
  fprintf(OUTG,'%4.4d %3.3d %6.2f %3.3d %6.2f %3.3d %6.2f %3.3d \n',datvimag(i-1,2),ndap,viz1116(nd),num1116(nd),viz1722(nd),num1722(nd),viz1121(nd),num1121(nd));
  n = 1;
  nd = nd + 1;
 end
 ilev = pickda(nd);
  iut = fix(datvimag(i,3)) + 1;
  numlt(iut,ilev) = numlt(iut,ilev) + 1;
  vimag(iut,ilev,numlt(iut,ilev)) = datvimag(i,5);
  viave(iut,ilev) = viave(iut,ilev) + datvimag(i,5);
  if (ilev<3)
   numlt(iut,3) = numlt(iut,3) + 1;
   vimag(iut,3,numlt(iut,3)) = datvimag(i,5);
   viave(iut,3) = viave(iut,3) + datvimag(i,5);
  end
% Accumulate average from 11-22UT
   if datvimag(i,3)>=11.0 & datvimag(i,3)<22.0
    num1121(nd) = num1121(nd) + 1;
    viz1121(nd) = viz1121(nd) + datvimag(i,5);
    if (datvimag(i,3)<=17.0)
     num1116(nd) = num1116(nd) + 1;
     viz1116(nd) = viz1116(nd) + datvimag(i,5);
    else
     num1722(nd) = num1722(nd) + 1;
     viz1722(nd) = viz1722(nd) + datvimag(i,5);
    end
   end
 ndap = nda;
end	% i=1:6668
% Calculate average from 11-22UT
  viz1121(nd) = viz1121(nd)/num1121(nd);
  viz1116(nd) = viz1116(nd)/num1116(nd);
  viz1722(nd) = viz1722(nd)/num1722(nd);
  fprintf(OUTG,'%4.4d %3.3d %6.2f %3.3d %6.2f %3.3d %6.2f %3.3d \n',datvimag(i-1,2),ndap,viz1116(nd),num1116(nd),viz1722(nd),num1722(nd),viz1121(nd),num1121(nd));
% Find average
for ilev=1:3
for iut=1:24
 if (numlt(iut,ilev)>0)
  viave(iut,ilev) = viave(iut,ilev)/numlt(iut,ilev);
 end
end	% iut=1:24
end	% ilev=1:2

figure
% position [left bottom width height]
% Set size to be 8.5x11 inchesJi
set(gcf,'position',[142    99   647   822])
H = gcf;
clf

for j=1:8
% Open file with Scherliess quiet-time drift model for 285 glon 70 f10.7 flux
%   run from vdrift-model_jgr0499.f and located in file wijro_07355_70fx_drift
filwiq = sprintf('/home/emery/cetic/vdrift_07355_70fx_%3.3d',loncutsE(j))
datwiq = dlmread(filwiq,'',1,0);

% Assign ii of geomagnetic equator (+10,+10,+7.5,+0,+0,-5,-12.5,+10) of 36 5deg bins
if j<3 | j==8
imag = 21;
end
if j==3
imag = 20;
end
if j==5 | j==5
imag = 19;
end
if j==6
imag = 17;
end
if j==7;
imag = 16;
% TEST SINCE UiE ALL NEG at -12.5S???? about 15m/s closer to zero, but still all neg imag=16-23
%imag = 23;
end
ut0 = (360.-loncutsE(j))/15. + 0.49;
n0 = fix(ut0);
utnoon = 24.-loncutsE(j)/15.+12.;
if utnoon>23.9
 utnoon = utnoon - 24.;
end
xnoon = [utnoon,utnoon];

% 3 Mar 2012:  NOTE:  hib,lob worse at Jicamarca than hi,lo from 14 Dec (before last GCMc!)
Dnam = sprintf('/hao/aim3/emery/cetic_climatology/long_%3.3d_07325_08020_2_TIE-GCM_alld.dat',loncutsE(j))
% ut_beg glat glon1 glon2 tecmed tecmean tecstd nmf2med,mean,std hmf2med,mean,std numdaystec,hmf2 (max 61) wimed wimean wistd
Din = fopen(Dnam,'r');
Dhinam = sprintf('/hao/aim3/emery/cetic_climatology/long_%3.3d_07325_08020_2_TIE-GCM_hid.dat',loncutsE(j))
Dlonam = sprintf('/hao/aim3/emery/cetic_climatology/long_%3.3d_07325_08020_2_TIE-GCM_lod.dat',loncutsE(j))
Dhiin = fopen(Dhinam,'r');
Dloin = fopen(Dlonam,'r');

for n=1:24
 nlt = n-n0;
 if nlt<1
   nlt = nlt + 24;
 end
 ut24(n) = n-0.5;
 quietmod(n) = 0.5*(datwiq(nlt,2)+datwiq(nlt+1,2));
for ii=1:36
 linemod = fgetl(Din);
 inmod = sscanf(linemod,'%f');
 linemodhi = fgetl(Dhiin);
 inmodhi = sscanf(linemodhi,'%f');
 linemodlo = fgetl(Dloin);
 inmodlo = sscanf(linemodlo,'%f');
 if ii==imag
  wimed(n) = inmod(16);
  wimedhi(n) = inmodhi(16);
  wimedlo(n) = inmodlo(16);
  wilomed(n) = inmod(19);
  wilomedhi(n) = inmodhi(19);
  wilomedlo(n) = inmodlo(19);
  uilomed(n) = inmod(22);
  uilomedhi(n) = inmodhi(22);
  uilomedlo(n) = inmodlo(22);
 end
end	% ii=1:36
if (j==7)
 qmodjic(n) = quietmod(n);
%  Save 140-170km average for 1130-2330 UT (n=12-24)
if (n<12)
 wimedjic(n) = wimed(n);
 wimedjichi(n) = wimedhi(n);
 wimedjiclo(n) = wimedlo(n);
else
 wimedjic(n) = wilomed(n);
 wimedjichi(n) = wilomedhi(n);
 wimedjiclo(n) = wilomedlo(n);
end
 uimedjic(n) = uilomed(n);
 uimedjichi(n) = uilomedhi(n);
 uimedjiclo(n) = uilomedlo(n);
end
end	% n=1:24

%% Make plots
dark_green = [0 0.5 0];
            subplot(4,2,j)
hold on;
title(['TIEGCM-WT Magnetic Equator Viz (m/s) LON=',num2str(loncutsE(j))]);
plot (ut24,wimed,'k');
plot (ut24,wimedhi,'r');
plot (ut24,wimedlo,'b');
plot (ut24,quietmod,'--g');
plot(xt24,zero,'--k');
plot(xnoon,ytot,':k');
text(utnoon-0.5,wx-4.,'noon','Color','k','FontSize',fsize,'FontWeight','bold');
text(1.,wn+4.,'Kp>=2','Color','r','FontSize',fsize,'FontWeight','bold');
text(8.,wn+4.,'Kp<=1','Color','b','FontSize',fsize,'FontWeight','bold');
text(16.,wn+4.,'--Q model','Color','g','FontSize',fsize,'FontWeight','bold');
if (j==7)
 text (0.5,wx-5.,'Jicamarca','Color','k','FontSize',fsize,'FontWeight','bold');
% plot(utp5,viave(:,1),'--c');
% plot(utp5,viave(:,2),'--m');
end
ylabel('Wi (m/s)','FontSize',fsize);
xlabel('UT(h)','FontSize',fsize);
set (gca,'xlim',[0,24],'ylim',[wn,wx],'xtick',([0:2:24]),'FontSize',fsize,'box','on');


end	% for j=1:8

hold off;

j=7;
utnoon = 24.-loncutsE(j)/15.+12.;
if utnoon>23.9
 utnoon = utnoon - 24.;
end
xnoon = [utnoon,utnoon];
wn = -29.;

% Delete the zeros from the dayside only data
nt = 0;
for it=1:24
if (numltz(it,1)>0)
 nt = nt + 1;
 ut1jul(nt) = utp5(it);
 viz1jul(nt) = viz150av(it,1);
end
end
nt = 0;
for it=1:24
if (numltz(it,2)>0)
 nt = nt + 1;
 ut2jul(nt) = utp5(it);
 viz2jul(nt) = viz150av(it,2);
end
end
nt = 0;
for it=1:24
if (numltz(it,3)>0)
 nt = nt + 1;
 ut3jul(nt) = utp5(it);
 viz3jul(nt) = viz150av(it,3);
end
end
% Skip values at 0030 and 0130 for mags so looks better on plot (why 0 at 1030?)
nt = 0;
for it=12:24
if (numlt(it,1)>0)
 nt = nt + 1;
 ut1mag(nt) = utp5(it);
 viz1mag(nt) = viave(it,1);
end
end
nt = 0;
for it=12:24
if (numlt(it,2)>0)
 nt = nt + 1;
 ut2mag(nt) = utp5(it);
 viz2mag(nt) = viave(it,2);
end
end
nt = 0;
for it=12:24
if (numlt(it,3)>0)
 nt = nt + 1;
 ut3mag(nt) = utp5(it);
 viz3mag(nt) = viave(it,3);
end
end

figure
% position [left bottom width height]
clf
hold on;
title(['Magnetic Equator Viz (m/s) LON=',num2str(loncutsE(j))],'FontSize',fsize,'FontWeight','bold');
plot (ut24,wimedjic,'k');
plot (ut24,wimedjichi,'r');
plot (ut24,wimedjiclo,'b');
plot (ut24,qmodjic,'--g');
plot(utta,wi400ta,'Color',dark_green);
plot(xt24,zero,'--k');
plot(xnoon,ytot,':k');
text(utnoon-0.5,wx-4.,'noon','Color','k','FontSize',fsize,'FontWeight','bold');
text(19.,wn+8.,'--Q model','Color','g','FontSize',fsize,'FontWeight','bold');
text(13.,wn+4.,'all Kp (61d)','Color','k','FontSize',fsize,'FontWeight','bold');
text(7.,wn+4.,'Kp>=2 (25d)','Color','r','FontSize',fsize,'FontWeight','bold');
text(1.,wn+4.,'Kp<=1 (25d)','Color','b','FontSize',fsize,'FontWeight','bold');
 text (0.5,wx-5.,'Jicamarca','Color','k','FontSize',fsize,'FontWeight','bold');
text(1.,wx-10.,'Mag--,JULIA-.(140-170km),ISR..(218-577km) Viz','Color','k','FontSize',fsize,'FontWeight','bold');
text(17.,wx-15.,'all Kp (48,34,12d)','Color','k','FontSize',fsize,'FontWeight','bold'); 
text(9.,wx-15.,'Kp>=2 (17,12,7d)','Color','m','FontSize',fsize,'FontWeight','bold'); 
text(1.,wx-15.,'Kp<=1 (22,16,2d)','Color','c','FontSize',fsize,'FontWeight','bold'); 
text(19.,wn+4.,'TIEGCM-WT','Color','k','FontSize',fsize,'FontWeight','bold');
text(8.,wn+8.,'12-d TIMEGCM-AMIE','Color',dark_green,'FontSize',fsize,'FontWeight','bold');
%plot(utp5,viave(:,1),'--c');
% plot(utp5,viave(:,2),'--m');
% plot(utp5,viave(:,3),'--k');
%plot(utp5,viz150av(:,1),'-.c');
% plot(utp5,viz150av(:,2),'-.m');
% plot(utp5,viz150av(:,3),'-.k');
 plot(ut1mag,viz1mag,'--c');
 plot(ut2mag,viz2mag,'--m');
 plot(ut3mag,viz3mag,'--k');
 plot(ut1jul,viz1jul,'-.c');
 plot(ut2jul,viz2jul,'-.m');
 plot(ut3jul,viz3jul,'-.k');
plot(utp5,vizisrav(:,1),':c');
 plot(utp5,vizisrav(:,2),':m');
 plot(utp5,vizisrav(:,3),':k');
ylabel('Wi (m/s)','FontSize',fsize,'FontWeight','bold');
xlabel('UT(h)','FontSize',fsize,'FontWeight','bold');
set (gca,'xlim',[0,24],'ylim',[wn,wx],'xtick',([0:2:24]),'FontSize',fsize,'box','on');

hold off

% Plot ViE from JULIA

nt = 0;
for it=1:24
if (numlte(it,1)>0)
 nt = nt + 1;
 ut1(nt) = utp5(it);
 vie1(nt) = vie150av(it,1);
end
end
nt = 0;
for it=1:24
if (numlte(it,2)>0)
 nt = nt + 1;
 ut2(nt) = utp5(it);
 vie2(nt) = vie150av(it,2);
end
end
nt = 0;
for it=1:24
if (numlte(it,3)>0)
 nt = nt + 1;
 ut3(nt) = utp5(it);
 vie3(nt) = vie150av(it,3);
end
end

figure
wx = 60;
wn = -100.;
ytot = [wn,wx];
wt1 = wn + (wx-wn)*0.95;
wt2 = wn + (wx-wn)*0.90;
wt3 = wn + (wx-wn)*0.85;
% position [left bottom width height]
clf
hold on;
title(['Model ExB and JULIA (--) at Jicamarca'],'FontSize',fsize,'FontWeight','bold');
plot (ut24,uimedjic,'k');
plot (ut24,uimedjichi,'r');
plot (ut24,uimedjiclo,'b');
plot (utta,ui150ta,'Color',dark_green);
plot(xt24,zero,'--k');
plot(xnoon,ytot,':k');
text(utnoon-0.5,wt1,'noon','Color','k','FontSize',fsize,'FontWeight','bold');
%plot(utp5,vie150av(:,1),'-.c');
% plot(utp5,vie150av(:,2),'-.m');
% plot(utp5,vie150av(:,3),'-.k');
 plot(ut1,vie1,'-.c');
 plot(ut2,vie2,'-.m');
 plot(ut3,vie3,'-.k');
text(11.,wt1,'all Kp (27d)','Color','k','FontSize',fsize,'FontWeight','bold'); 
text(6.,wt1,'Kp>=2 (7d)','Color','m','FontSize',fsize,'FontWeight','bold'); 
text(0.5,wt1,'Kp<=1 (16d)','Color','c','FontSize',fsize,'FontWeight','bold'); 
text(4.,wn+10.,'TIEGCM-WT','Color','k','FontSize',fsize,'FontWeight','bold');
text(0.5,wx-20.,'61d TIMEGCM-AMIE','Color',dark_green,'FontSize',fsize,'FontWeight','bold');
ylabel('ViE (m/s) 140-170km','FontSize',fsize,'FontWeight','bold');
xlabel('UT(h)','FontSize',fsize,'FontWeight','bold');
set (gca,'xlim',[0,24],'ylim',[wn,wx],'xtick',([0:2:24]),'FontSize',fsize,'box','on');

hold off
