NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/DPWavesProc/trunk/DPWavesProc/test_code/specmultiplot_compare.m

Revision 228 (checked in by gdusek, 15 years ago)

--

Line 
1 function [Winfo]=specmultiplot_compare(dateinfo1,dateinfo2,timestep);
2 %where dateinfo1 and 2 are the strings of the first and last date extension
3 %of the pressure,range,etc files and timestep is the time in hours between
4 %each burst
5
6 %This function takes the pressure, range, orbit and sysinfo files created
7 %in python and outputs a Winfo data structure with the sig wave height,
8 %peak period, direction of peak period and dominant dir.  It also generates
9 %polar plots and 2d freq and directional plots of a variety of different
10 %estimation methods, resolutions and the wavesmon output.
11
12
13 %first set up the time vector going from dateinfo1 to dateinfo2
14 Winfo.time=[];
15
16 date1=datevec(dateinfo1, 'yymmddHHMM');
17 date2=datevec(dateinfo2,'yymmddHHMM');
18
19 if date1 == date2
20     Winfo.time=[datenum(date1)];
21 else
22     Winfo.time=[datenum(date1)];
23     newdate=date1;
24     while datenum(newdate) ~= datenum(date2)
25         newdate=newdate+[0 0 0 timestep 0 0];
26         Winfo.time=[horzcat(Winfo.time,datenum(newdate))];
27     end
28 end
29            
30      
31 %set up time, which is Winfo.time as date str in the yymmddHHMM format
32 time=datestr(Winfo.time, 'yymmddHHMM');
33
34 %set up data structure for wave info
35 Winfo.setup={'EMEP UVW','IMLM UVW','EMEP range','IMLM range','EMEP radial','IMLM radial','wavesmon'}';
36 Winfo.hsig=[];
37 Winfo.hconf=[];
38 Winfo.peakP=[];
39 Winfo.dirP=[];
40 Winfo.Ddir=[];
41 Winfo.Spectrum.EMEPuvw=[];
42 Winfo.Spectrum.IMLMuvw=[];
43 Winfo.Spectrum.EMEPrange=[];
44 Winfo.Spectrum.IMLMrange=[];
45 Winfo.Spectrum.EMEPradial=[];
46 Winfo.Spectrum.IMLMradial=[];
47 Winfo.Spectrum.wavesmon=[];
48
49 %Load the data and run the script
50 for i=1:length(time(:,1))
51     dateinfo=time(i,:);
52
53     pressure=strcat('pressure_',dateinfo,'.txt');
54     range=strcat('range_',dateinfo,'.txt');
55     orbit=strcat('orbit_',dateinfo,'.txt');
56     sysinfo=strcat('sysinfo_',dateinfo,'.txt');
57     spec=strcat('DSpec',dateinfo,'.txt');
58
59     pressure=load(pressure);
60     range=load(range);
61     orbit=load(orbit);
62     sysinfo=load(sysinfo);
63     spec=load(spec);
64
65     %set up data with uvw and pressure, freq at 0.01 and dir at 2
66     [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,1);
67
68     %run diwasp to generate this spectrum
69     [E_uvw_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
70
71     %now for IMLM
72     EP.method='IMLM';
73     EP.iter=3;
74     [I_uvw_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
75
76     %set up data with ranges, freq and dir at default
77     [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,2);
78
79     % run diwasp to generate this spectrum with EMEP
80     [E_range_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
81
82     %now with IMLM
83     EP.method='IMLM';
84     EP.iter=3;
85     [I_range_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
86
87     %set up data with radial velocities, freq and dir at default
88     [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,3);
89
90     % run diwasp to generate this spectrum with EMEP
91     [E_radial_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
92
93     %now with IMLM
94     EP.method='IMLM';
95     EP.iter=3;
96     [I_radial_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
97
98     %Use waveplot to plot the polar, freq and dir plots of the spectra
99
100     [E_UVW_WI,I_UVW_WI,E_range_WI,I_range_WI,wmon_WI,fig1,fig2]=waveplot_compare(E_uvw_F01_D2,I_uvw_F01_D2,E_range_F01_D2,I_range_F01_D2,spec,sysinfo);
101    
102     saveas(fig1,['polar1_' dateinfo '.fig']);
103     saveas(fig2,['dirfreq1_' dateinfo '.fig']);
104    
105     [E_radial_WI,I_radial_WI,fig5,fig6]=radialwaveplot(E_radial_F01_D2,I_radial_F01_D2,spec,sysinfo);
106
107     saveas(fig5,['polar3_' dateinfo '.fig']);
108     saveas(fig6,['dirfreq3_' dateinfo '.fig']);
109    
110     close all;
111    
112     %Make sure wavesmon spectrum is formatted right before outputting, change to m^2/Hz/deg
113     wmon.S=spec/(360*1000*1000);
114    
115     %Fill up the Winfo data structure
116
117     hsig=[vertcat(E_UVW_WI.hsig,I_UVW_WI.hsig,E_range_WI.hsig,I_range_WI.hsig,E_radial_WI.hsig,I_radial_WI.hsig,wmon_WI.hsig)];
118     hconf=[vertcat(E_UVW_WI.hconf,I_UVW_WI.hconf,E_range_WI.hconf,I_range_WI.hconf,E_radial_WI.hconf,I_radial_WI.hconf,[NaN NaN])];
119     peakP=[vertcat(E_UVW_WI.tp,I_UVW_WI.tp,E_range_WI.tp,I_range_WI.tp,E_radial_WI.tp,I_radial_WI.tp,wmon_WI.tp)];
120     dirP=[vertcat(E_UVW_WI.dtp,I_UVW_WI.dtp,E_range_WI.dtp,I_range_WI.dtp,E_radial_WI.dtp,I_radial_WI.dtp,wmon_WI.dtp)];
121     Ddir=[vertcat(E_UVW_WI.dp,I_UVW_WI.dp,E_range_WI.dp,I_range_WI.dp,E_radial_WI.dp,I_radial_WI.dp,wmon_WI.dp)];
122    
123    
124     Winfo.hsig=[horzcat(Winfo.hsig,hsig)];
125     Winfo.hconf=[horzcat(Winfo.hconf,hconf)];
126     Winfo.peakP=[horzcat(Winfo.peakP,peakP)];
127     Winfo.dirP=[horzcat(Winfo.dirP,dirP)];
128     Winfo.Ddir=[horzcat(Winfo.Ddir,Ddir)];
129     Winfo.Spectrum.EMEPuvw=[cat(3,Winfo.Spectrum.EMEPuvw,E_uvw_F01_D2.S)];
130     Winfo.Spectrum.IMLMuvw=[cat(3,Winfo.Spectrum.IMLMuvw,I_uvw_F01_D2.S)];
131     Winfo.Spectrum.EMEPrange=[cat(3,Winfo.Spectrum.EMEPrange,E_range_F01_D2.S)];
132     Winfo.Spectrum.IMLMrange=[cat(3,Winfo.Spectrum.IMLMrange,I_range_F01_D2.S)];
133     Winfo.Spectrum.EMEPradial=[cat(3,Winfo.Spectrum.EMEPradial,E_radial_F01_D2.S)];
134     Winfo.Spectrum.IMLMradial=[cat(3,Winfo.Spectrum.IMLMradial,I_radial_F01_D2.S)];
135     Winfo.Spectrum.wavesmon=[cat(3,Winfo.Spectrum.wavesmon,wmon.S)];
136    
137 end
138
139 %now create the time series plots of the wave info
140 [fig_sigh,fig_pp,fig_dp,fig_dd]=Winfo_plot_compare(Winfo);
141
142 saveas(fig_sigh,['sigh_' dateinfo '.fig']);
143 saveas(fig_pp,['peakp_' dateinfo '.fig']);
144 saveas(fig_dp,['dirpeak_' dateinfo '.fig']);
145 saveas(fig_dd,['domdir_' dateinfo '.fig']);
146
147 close all;
148
149
150
151
Note: See TracBrowser for help on using the browser.