-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprepareNCs.m
58 lines (55 loc) · 2.55 KB
/
prepareNCs.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
clear
close all
% Setting {{{
glacier = 'Thule';
projPath = './';
%folderList = {'../Thule/Models/20230705_EXP3_res_5000/', '../Thule/Models/20240722_EXP4_res_5000/'};
%outputFolder = './Results/5kmResults/';
folderList = {'../Thule/Models/20230714_EXP3_res_2500//', '../Thule/Models/20240722_EXP4_res_2500/'};
outputFolder = './Results/2_5kmResults_extrap/';
steps = [1];
authorList = 'Gong Cheng([email protected]), Helene Seroussi, Mathieu Morlighem';
%}}}
% Loading models {{{
stepName = 'Transient';
Ndata = length(folderList);
parfor i = 1:Ndata
org{i}=organizer('repository', [projPath, folderList{i}], 'prefix', ['Model_' glacier '_'], 'steps', steps);
if perform(org{i}, 'Transient')
disp(['---- Loading the model from ', folderList{i}]);
mdList{i} = loadmodel(org{i}, [stepName]);
end
end
%}}}
% copy EXP3 final results to EXP4 model if needed {{{
if ~isfield(mdList{2}.results, 'InitialSolution')
mdList{2}.results.InitialSolution.GroundedArea = mdList{1}.results.TransientSolution(end).GroundedArea;
mdList{2}.results.InitialSolution.FloatingArea = mdList{1}.results.TransientSolution(end).FloatingArea;
mdList{2}.results.InitialSolution.IceVolume = mdList{1}.results.TransientSolution(end).IceVolume;
mdList{2}.results.InitialSolution.IceVolumeAboveFloatation = mdList{1}.results.TransientSolution(end).IceVolumeAboveFloatation;
mdList{2}.results.InitialSolution.IcefrontMassFluxLevelset = mdList{1}.results.TransientSolution(end).IcefrontMassFluxLevelset;
mdList{2}.results.InitialSolution.GroundinglineMassFlux = mdList{1}.results.TransientSolution(end).GroundinglineMassFlux;
savemodel(org{2}, mdList{2});
end
%}}}
% Generate profiles if not exist {{{
profilefolder = './Profiles/';
cprofilename = [profilefolder, '/Caprona_Profiles.csv'];
hprofilename = [profilefolder, '/Halbrane_Profiles.csv'];
if (~exist(cprofilename, 'file') | (~exist(hprofilename, 'file')) )
createProfiles('EXP4', profilefolder)
end
profilefolder = './Profiles/finer/';
cprofilename = [profilefolder, '/Caprona_Profiles.csv'];
hprofilename = [profilefolder, '/Halbrane_Profiles.csv'];
if ~exist(profilefolder, 'dir')
mkdir(profilefolder)
end
if (~exist(cprofilename, 'file') | (~exist(hprofilename, 'file')) )
createProfiles('EXP4', profilefolder, 1000)
end
%}}}
% Create NetCDF {{{
results3 = ModelToNetCDF(mdList{1}, 'directoryname', outputFolder, 'EXP', 3, 'author', authorList, 'institution', 'Dartmouth', 'flowequation', 'SSA');
results4 = ModelToNetCDF(mdList{2}, 'directoryname', outputFolder, 'EXP', 4, 'author', authorList, 'institution', 'Dartmouth', 'flowequation', 'SSA');
% }}}