-
Notifications
You must be signed in to change notification settings - Fork 2
/
Edit_River_Input_File.m
156 lines (133 loc) · 6.07 KB
/
Edit_River_Input_File.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
function varargout = Edit_River_Input_File(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Edit_River_Input_File_OpeningFcn, ...
'gui_OutputFcn', @Edit_River_Input_File_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
function Edit_River_Input_File_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
%RiverInputFile_CellEditCallback(hObject, eventdata, handles)
guidata(hObject, handles);
function pannel_CreateFcn(hObject, eventdata, handles)
function Riverinput_filename_Callback(hObject, eventdata, handles)
function Riverinput_filename_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function loadfromfile_Callback(hObject, eventdata, handles)
%%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
[FileName,PathName]=uigetfile({'*.xlsx','xlsx files (*.xlsx)'; ...
'*.xls','xls-files (*.xls)'; '*.*', 'All Files (*.*)'}, ...
'Select Excel file to import','MultiSelect', 'on');
strFilename=fullfile(PathName,FileName);
if PathName==0 %if the user pressed cancelled, then we exit this callback
return
else
if FileName~=0
set(handles.Riverinput_filename,'string',fullfile(FileName));
Riverinputfile=importdata(strFilename);handles.userdata.Riverinputfile=...
Riverinputfile.data;
% Load River input file
RinFile=handles.userdata.Riverinputfile;
set(handles.RiverInputFile,'Data',RinFile);
% end of load river input file
end
end
guidata(hObject, handles);% Update handles structure
Riverin_DataPlot(hObject, eventdata, handles)
function Riverin_DataPlot(hObject, eventdata, handles)
%% DepthPlot Riverin data
RinFile=handles.userdata.Riverinputfile;
%calculate cumulative distance as the middle of the cell
x=RinFile(:,2);
x=(x+[0; x(1:end-1)])/2;
set(handles.DepthPlot,'Visible','on');
plot(handles.DepthPlot,x,RinFile(:,4),'LineWidth',1.5,'Color',...
[0 0 0]);
ylabel(handles.DepthPlot,'H [m]','FontWeight','bold','FontSize',10);
box(handles.DepthPlot,'on');
axis(handles.DepthPlot,[0 max(RinFile(:,2)) 0 max(RinFile(:,4))*1.5]);
%==========================================================================
%% QPlot Riverin data
set(handles.QPlot,'Visible','on');
plot(handles.QPlot,x,RinFile(:,5),'LineWidth',1.5,'Color',...
[0 0 0]);
ylabel(handles.QPlot,{'Q [cms]'},'FontWeight','bold','FontSize',10);
box(handles.QPlot,'on');
axis(handles.QPlot,[0 max(RinFile(:,2)) 0 max(RinFile(:,5))*1.5]);
%==========================================================================
%% VmagPlot Riverin data
set(handles.VmagPlot,'Visible','on');
plot(handles.VmagPlot,x,RinFile(:,6),'LineWidth',1.5,'Color',...
[0 0 0]);
ylabel(handles.VmagPlot,{'Vmag [m/s]'},'FontWeight','bold','FontSize',10);
box(handles.VmagPlot,'on');
axis(handles.VmagPlot,[0 max(RinFile(:,2)) 0 max(RinFile(:,6))*1.5]);
%==========================================================================
%% VvertPlot Riverin data
set(handles.VvertPlot,'Visible','on');
plot(handles.VvertPlot,x,RinFile(:,7),'LineWidth',1.5,'Color',...
[0 0 0]);
ylabel(handles.VvertPlot,{'Vz [m/s]'},'FontWeight','bold','FontSize',10);
box(handles.VvertPlot,'on');
if max(RinFile(:,7))~=0
axis(handles.VvertPlot,[0 max(RinFile(:,2)) min(RinFile(:,7))*1.5 max(RinFile(:,7))*1.5]);
else
xlim(handles.VvertPlot,[0 max(RinFile(:,2))]);
end
%==========================================================================
%% UstarPlot Riverin data
set(handles.UstarPlot,'Visible','on');
plot(handles.UstarPlot,x,RinFile(:,8),'LineWidth',1.5,'Color',...
[0 0 0]);
ylabel(handles.UstarPlot,{'u_* [m/s]'},'FontWeight','bold','FontSize',10);
xlabel(handles.UstarPlot,{'Cumulative distance [Km]'},'FontWeight','bold',...
'FontSize',10);
box(handles.UstarPlot,'on');
axis(handles.UstarPlot,[0 max(RinFile(:,2)) 0 max(RinFile(:,8))*1.5]);
%==========================================================================
%% TempPlot Riverin data
set(handles.TempPlot,'Visible','on');
plot(handles.TempPlot,x,RinFile(:,9),'LineWidth',1.5,'Color',...
[0 0 0]);
ylabel(handles.TempPlot,{'T [^oC]'},'FontWeight','bold','FontSize',10);
xlabel(handles.TempPlot,{'Cumulative distance [Km]'},'FontWeight','bold',...
'FontSize',10);
box(handles.TempPlot,'on');
axis(handles.TempPlot,[0 max(RinFile(:,2)) 0 max(RinFile(:,9))*1.5]);
%==========================================================================
function RiverInputFile_CellEditCallback(hObject, eventdata, handles)
handles.userdata.Riverinputfile=get(handles.RiverInputFile,'Data');
Riverin_DataPlot(hObject, eventdata, handles)
guidata(hObject, handles);% Update handles structure
function RiverInputFile_CellSelectionCallback(hObject, eventdata, handles)
function varargout = Edit_River_Input_File_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function Close_Callback(hObject, eventdata, handles)
Riverinputfile=handles.userdata.Riverinputfile;
CumlDistance=Riverinputfile(:,2); %Km
Depth=Riverinputfile(:,4); %m
Q=Riverinputfile(:,5); %m3/s
Vmag=Riverinputfile(:,6); %m/s
Vvert=Riverinputfile(:,7); %m/s
Ustar=Riverinputfile(:,8); %m/s
Temp=Riverinputfile(:,9); %m2s
Width=Q./(Vmag.*Depth);
save './Temp/temp_variables.mat'...
'CumlDistance' 'Depth' 'Q' 'Vmag' 'Vvert' 'Ustar' 'Temp' 'Width'
close;
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::%
%% <<<<<<<<<<<<<<<<<<<<<<<<< END OF FUNCTION >>>>>>>>>>>>>>>>>>>>>>>>>>>>%%
%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::%