-
Notifications
You must be signed in to change notification settings - Fork 2
/
rotateTau.m
78 lines (59 loc) · 2.12 KB
/
rotateTau.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
%
% rotate taux and tauy into taue and taun
%
% clean up workspace
clear all
close all
% add paths
addpath ~/matlabfiles/
addpath ~/gcmfaces/
% set file locations
myflocs = {...
'/data/expose/orchestra/experiments/run_ad_orch_satl.heat/',...
};
gloc = '/data/expose/labrador/grid/';
% load grid
gcmfaces_global;
grid_load(gloc,5,'compact');
% ad scaling
adt_scaling = 1.0;
for nexp=1:length(myflocs)
% list of its
load(strcat(myflocs{nexp},'its.txt'))
for niter=1:length(its)
% progress counter
disp(strcat('---',' nexp=',int2str(nexp),' --- niter=',...
int2str(niter),' of ',int2str(length(its))))
% if exists, skip iteration
fname_test = strcat(myflocs{nexp},'ADJtaue.',sprintf('%010d',its(niter)),'.meta');
if exist(fname_test,'file')~=2
% load taux and tauy
taux = adt_scaling.*rdmds2gcmfaces(strcat(myflocs{nexp},...
'ADJtaux'),its(niter));
tauy = adt_scaling.*rdmds2gcmfaces(strcat(myflocs{nexp},...
'ADJtauy'),its(niter));
% rotate
[taue,taun] = calc_UEVNfromUXVY(taux,tauy);
% write out (taue)
fname_dat = strcat(myflocs{nexp},'ADJtaue.',sprintf('%010d',its(niter)),'.data');
fname_met = strcat(myflocs{nexp},'ADJtaue.',sprintf('%010d',its(niter)),'.meta');
write2file(fname_dat,convert2gcmfaces(taue))
mname = strcat(myflocs{nexp},'ADJtaux.',sprintf('%010d',its(niter)),'.meta');
status = unix(['cp ',mname,' ',fname_met]);
if status~=0
warning('problem with copying meta file')
end
% write out (taun)
fname_dat = strcat(myflocs{nexp},'ADJtaun.',sprintf('%010d',its(niter)),'.data');
fname_met = strcat(myflocs{nexp},'ADJtaun.',sprintf('%010d',its(niter)),'.meta');
write2file(fname_dat,convert2gcmfaces(taun))
mname = strcat(myflocs{nexp},'ADJtauy.',sprintf('%010d',its(niter)),'.meta');
status = unix(['cp ',mname,' ',fname_met]);
if status~=0
warning('problem with copying meta file')
end
else
disp('-------- file aleady exists, skip it ----------')
end
end
end