Skip to content

Commit 0a5d2e0

Browse files
committed
v1.7.4
1 parent 8d44ca8 commit 0a5d2e0

27 files changed

+23
-4041
lines changed

CODE/conf_points.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
if fl == 0; return; end
259259

260260
fid = fopen(fullfile(pth,fl));
261-
data = textscan(fid, '%s %.03f %.03f');
261+
data = textscan(fid, '%s %.04f %.04f');
262262
fclose(fid);
263263
set(cdp.points_table, 'Data', [data{1}, num2cell(data{2}), num2cell(data{3})]);
264264

CODE/dwind/process_wind.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ function process_wind(varargin)
157157
stor(i).HGT = ncread(fullfile(in_path, fl(i).name), 'z')/9.80665;
158158
stor(i).UWND = ncread(fullfile(in_path, fl(i).name), 'u');
159159
stor(i).VWND = ncread(fullfile(in_path, fl(i).name), 'v');
160-
stor(i).time = double(ncread(fullfile(in_path, fl(i).name), 'time'))/24 + datenum(1900,1,1,0,0,0);
160+
%stor(i).time = double(ncread(fullfile(in_path, fl(i).name), 'time'))/24 + datenum(1900,1,1,0,0,0);
161+
stor(i).time = datetime(double(ncread(fullfile(in_path, fl(i).name), 'time')),'ConvertFrom','epochtime','TicksPerSecond',1);
161162
end
162163

163164
% Do some tests to see if the timestamp is correct
@@ -212,6 +213,10 @@ function process_wind(varargin)
212213

213214
stor_data(iL,:,tI) = [z, speed, angle]; % Convert vectors to wind speed and direction and fill the storage matrix
214215
end
216+
% if sum(sum(isnan(stor_data(:,:,tI)))) > 0
217+
% disp(time(iT));
218+
% disp(iT);
219+
% end
215220
dlmwrite(fullfile(out_path, [num2str(tI, '%05i'), '.gen']), sortrows(stor_data(:,:,tI),1), 'delimiter', '\t', 'precision', 5); % Write the wind file
216221
tI = tI+1;
217222
end

CODE/plot_hazCurves.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function plot_hazCurves(varargin)
7777
ylabel('Exceedance probability (%)');
7878
set(gca, 'YScale', 'Log', 'XScale', 'Log', 'Box', 'on');
7979
xlim([10^(-prefs.files.nbDigits), 10^(ceil(log10(maxtmp)))]);
80-
ylim([.001 100]);
80+
ylim([.1 100]);
8181
legend(leg,'Interpreter', 'none', 'Location', 'southwest');
8282
hold off
8383

CODE/runT2.m

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -63,69 +63,9 @@
6363

6464
mod_pth = [pwd, filesep, 'MODEL', filesep, 'forward_src', filesep];
6565

66-
% On PCs, add the Cygwin folder to the PATH environment
67-
% Added 08-2018
68-
% Noticed a problem with the definition of the cygwin path when not
69-
% installed in c:\cygwin
66+
% 2025-04-23: Removed the CYGWIN dependency for WSL. Running CYGWIN
67+
% requires TephraProb < 1.7.4
7068
if ispc
71-
% path1 = getenv('PATH');
72-
73-
% % Retrieve architecture
74-
% if strcmp(computer('arch'), 'win64')
75-
% pathC = 'C:\cygwin64\bin';
76-
% elseif strcmp(computer('arch'), 'win32')
77-
% pathC = 'C:\cygwin\bin';
78-
% end
79-
80-
% % Check if path exists
81-
% if ~exist(pathC, 'dir') == 7
82-
% % Check if the path to cygwin has already been saved
83-
% if exist('CODE/VAR/cygwin.mat', file)
84-
% load('CODE/VAR/cygwin.mat', 'pathC');
85-
86-
% % If not, retrieve it
87-
% else
88-
% choice = questdlg('Did you already install CYGWIN?', ...
89-
% 'CYGWIN', ...
90-
% 'Yes','No','Yes');
91-
% % Handle response
92-
% switch choice
93-
% case 'Yes'
94-
% sprintf('Select the cygwin\bin directory\n');
95-
% pathC = uigetdir('C:\', 'Select the cygwin\bin directory');
96-
% save('CODE/VAR/cygwin.mat', 'pathC');
97-
% case 'No'
98-
% url('https://cygwin.com/install.html');
99-
% return
100-
% end
101-
% end
102-
% end
103-
104-
% % Check if the cygwin path is already in the environment
105-
% if isempty(strfind(path1,pathC))
106-
% setenv('PATH', [path1,';',pathC,';']);
107-
% end
108-
109-
% if ~exist([pwd, filesep, 'MODEL', filesep, 'tephra2-2012.exe'], 'file')
110-
% warning('You need to manually compile Tephra2 on Cygwin!')
111-
% fprintf('\t1. Open the Cygwin terminal\n')
112-
% fprintf('\t2. Navigate to TephraProb\\MODEL\\ and type: \n')
113-
% fprintf('\t\t make clean\n')
114-
% fprintf('\t3. Then, type:\n')
115-
% fprintf('\t\t make\n')
116-
% fprintf('\t4. Once finished, type:\n')
117-
% fprintf('\t\t chmod 755 tephra2-2012.exe\n')
118-
% fprintf('\t5. To test the compilation, type:\n')
119-
% fprintf('\t\t ./tephra2-2012.exe\n')
120-
% fprintf('\tYou should see:\n')
121-
% fprintf('\t\t Missing comand line arguments,\n')
122-
% fprintf('\t\t USAGE: <program name> <config file> <points file> <wind file> <file of grain sizes>')
123-
% return
124-
% else
125-
% cd(pth);
126-
% runit(project.run_pth,project.par,project.cores,pathC); % Runs model
127-
% end
128-
12969

13070
pathC = [];
13171
% Compiles the model and runs it
@@ -150,8 +90,8 @@
15090
% Compiles the model and runs it
15191
disp('Compiling Tephra2...')
15292
cd(mod_pth); % Navigates to the makefile
153-
system('make clean');
154-
[stat, cmd_out] = system('make'); % Compiles TEPHRA2
93+
system('wsl make clean');
94+
[stat, cmd_out] = system('wsl make'); % Compiles TEPHRA2
15595

15696
if stat == 0 % If compilation ok
15797
disp('Compiling done!')
@@ -283,24 +223,18 @@ function runit(run_pth, par, cores, pathC)
283223
function line_out = check_line(tline,pathC)
284224

285225
% Some housekeeping tasks if run on windows
226+
% Starting 1.7.4, using WSL
286227
if ispc
287-
% if strcmp(computer('arch'), 'win64') % Cygwin 64 bits
288-
% pathC = 'C:\cygwin64\bin\bash';
289-
% elseif strcmp(computer('arch'), 'win32') % Cygwin 32 bits
290-
% pathC = 'C:\cygwin\bin\bash';
291-
% end
292-
293-
% Added 08-2018: Propagating the custom cygwin directory
294-
pathC = fullfile(pathC, 'bash');
295228

296229
pth_tmp = pwd; % Retrieve path
297230
pth_tmp(regexp(pth_tmp, '\')) = '/';
298231
pth_tmp(regexp(pth_tmp, ':')) = [];
299-
232+
drive = lower(pth_tmp(1));
233+
pth_tmp = [drive, pth_tmp(2:end)];
300234
% Split the command line and add the cygdrive path
301235
tline_split = strsplit(tline, ' ');
302236
for i = [2,3,4,5,7]
303-
tline_split{i} = regexprep(['/cygdrive/', pth_tmp, '/', tline_split{i}],'\s+','');
237+
tline_split{i} = regexprep(['/mnt/', pth_tmp, '/', tline_split{i}],'\s+','');
304238
end
305239

306240
% Concatanates final command line for cygwin
@@ -309,8 +243,8 @@ function runit(run_pth, par, cores, pathC)
309243
tline(s:e) = [];
310244
tline = strrep(tline, '\', '/');
311245

312-
% line_out = [pathC, ' --login -c "/cygdrive/', pth_tmp, '/MODEL/./tephra2-2012.exe ', tline, '"'];
313-
line_out = ['wsl ', tline];
246+
%line_out = [pathC, ' --login -c "/cygdrive/', pth_tmp, '/MODEL/./tephra2-2012.exe ', tline, '"'];
247+
line_out = ['wsl bash -c "./MODEL/tephra2-2012 ', tline, '"'];
314248
else
315249
line_out = tline;
316250
end

0 commit comments

Comments
 (0)