-
Notifications
You must be signed in to change notification settings - Fork 2
/
get_supporting_data.m
44 lines (40 loc) · 1.58 KB
/
get_supporting_data.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
HM_load_package;
% *************************************************************************
% Download and unzip file
% *************************************************************************
tic;
load('chan_et_al_2019_directories.mat','dir_data')
dir_now = pwd;
cd(dir_data)
if exist('Supporting_Data.tar.gz', 'file') ~= 2,
disp(['downloading data ...'])
url= ['https://dataverse.harvard.edu/api/access/datafile/3424402'];
filename = 'Supporting_Data.tar.gz';
websave(filename,url);
!tar -zxvf Supporting_Data.tar.gz
cd(dir_now)
disp(['Downloading data takes ',num2str(toc,'%6.0f'),' seconds'])
end
% *************************************************************************
% Move supporting data
%% *************************************************************************
dir_from = [dir_data,'Supporting_Data/']; % TODO
% change to name of untarred folder
dir_to = [dir_data,'ICOADSb/HM_SST_Bucket/'];
file = 'Stats_HM_SST_Bucket_deck_level_1.mat';
if exist([dir_to,file], 'file') == 2,
disp('File ''Stats_HM_SST_Bucket_deck_level_1.mat'' exists. Skip ...')
else
try
movefile([dir_from,file],[dir_to,file]);
disp(['Moving ''Stats_HM_SST_Bucket_deck_level_1.mat''...'])
catch
disp(['Error in moving ''Stats_HM_SST_Bucket_deck_level_1.mat'''])
end
end
disp(' ')
disp(['Moving all other supporting data to their target directories...'])
cd(dir_data)
! mv -f Supporting_Data/ICOADS_Mis/* ICOADS3/ICOADS_Mis/
! mv -f Supporting_Data/Miscellaneous/* ICOADSb/Miscellaneous/
cd(dir_now)