-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCAWCRvsCICE.m
133 lines (120 loc) · 4.34 KB
/
CAWCRvsCICE.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
%% A comparison between CAWCR data and CICE wave output
clc
clear
close
addpath functions
filename = 'cases/ocntest/history/iceh.2009-01-01.nc';%'grid/gridded_ww3.glob_24m.200501.nc';
%filename = 'DATA/CESM/MONTHLY/ocean_forcing_clim_2D_gx1.20210330.nc';
grid = 'gx1';
[lat,lon,row] = grid_read(grid);
%data = ncread(filename, 'sst');
cice_data = data_format(filename,'wave_sig_ht');
cawcr_filename = '/Users/a1724548/GitHub/cice-dirs/input/CICE_data/forcing/gx1/CAWCR/MONTHLY/2005/ww3_200501.nc';
dirdata = ncread(cawcr_filename,'dir');
latitude = [-90,90];
longitude = [-180,180];
dirdata = rearrange_matrix(dirdata,row,2);
% fixing data
[m, ~] = size(lon);
lon = [lon; lon(end,:) + 360/m];
lat = [lat; lat(end,:)];
dir_out = [dirdata; dirdata(end,:)];
cawcr_data = dir_out(:,:,1);
figure(1)
w = worldmap('world');
axesm eqaazim; %, eqaazim eqdazim vperspec, eqdazim flips the x-axis, and y-axis to eqaazim. cassini
setm(w, 'Origin', [-90 0 0]);
setm(w, 'maplatlimit', [-90,-30]);
setm(w, 'maplonlimit', [-180,180]);
setm(w, 'meridianlabel', 'on')
setm(w, 'parallellabel', 'off')
setm(w, 'mlabellocation', 30);
setm(w, 'plabellocation', 10);
setm(w, 'mlabelparallel', -45);
setm(w, 'grid', 'on');
%setm(w, 'frame', 'on');
setm(w, 'labelrotation', 'on')
pcolorm(lat,lon,cice_data)
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(w, land, 'FaceColor', [0.5 0.7 0.5])
colorbar
title('CICE data')
idx1 = cawcr_data > 90;
idx2 = cawcr_data < 270;
idx = logical(idx1.*idx2);
figure(2)
w = worldmap('world');
axesm eqaazim; %, eqaazim eqdazim vperspec, eqdazim flips the x-axis, and y-axis to eqaazim. cassini
setm(w, 'Origin', [-90 0 0]);
setm(w, 'maplatlimit', [-90,-30]);
setm(w, 'maplonlimit', [-180,180]);
setm(w, 'meridianlabel', 'on')
setm(w, 'parallellabel', 'off')
setm(w, 'mlabellocation', 30);
setm(w, 'plabellocation', 10);
setm(w, 'mlabelparallel', -45);
setm(w, 'grid', 'on');
%setm(w, 'frame', 'on');
setm(w, 'labelrotation', 'on')
pcolorm(lat,lon,idx1.*idx2)
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(w, land, 'FaceColor', [0.5 0.7 0.5])
colorbar
title('CAWCR indicator function')
figure(3)
w = worldmap('world');
axesm eqaazim; %, eqaazim eqdazim vperspec, eqdazim flips the x-axis, and y-axis to eqaazim. cassini
setm(w, 'Origin', [-90 0 0]);
setm(w, 'maplatlimit', [-90,-30]);
setm(w, 'maplonlimit', [-180,180]);
setm(w, 'meridianlabel', 'on')
setm(w, 'parallellabel', 'off')
setm(w, 'mlabellocation', 30);
setm(w, 'plabellocation', 10);
setm(w, 'mlabelparallel', -45);
setm(w, 'grid', 'on');
%setm(w, 'frame', 'on');
setm(w, 'labelrotation', 'on')
pcolorm(lat,lon,cawcr_data.*idx)
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(w, land, 'FaceColor', [0.5 0.7 0.5])
colorbar
title('CAWCR * indicator')
figure(4)
w = worldmap('world');
axesm eqaazim; %, eqaazim eqdazim vperspec, eqdazim flips the x-axis, and y-axis to eqaazim. cassini
setm(w, 'Origin', [-90 0 0]);
setm(w, 'maplatlimit', [-90,-30]);
setm(w, 'maplonlimit', [-180,180]);
setm(w, 'meridianlabel', 'on')
setm(w, 'parallellabel', 'off')
setm(w, 'mlabellocation', 30);
setm(w, 'plabellocation', 10);
setm(w, 'mlabelparallel', -45);
setm(w, 'grid', 'on');
%setm(w, 'frame', 'on');
setm(w, 'labelrotation', 'on')
pcolorm(lat,lon,cawcr_data.*cice_data)
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(w, land, 'FaceColor', [0.5 0.7 0.5])
colorbar
title('CAWCR * CICE')
figure(5)
w = worldmap('world');
axesm eqaazim; %, eqaazim eqdazim vperspec, eqdazim flips the x-axis, and y-axis to eqaazim. cassini
setm(w, 'Origin', [-90 0 0]);
setm(w, 'maplatlimit', [-90,-30]);
setm(w, 'maplonlimit', [-180,180]);
setm(w, 'meridianlabel', 'on')
setm(w, 'parallellabel', 'off')
setm(w, 'mlabellocation', 30);
setm(w, 'plabellocation', 10);
setm(w, 'mlabelparallel', -45);
setm(w, 'grid', 'on');
%setm(w, 'frame', 'on');
setm(w, 'labelrotation', 'on')
pcolorm(lat,lon,cawcr_data.*cice_data.*idx)
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(w, land, 'FaceColor', [0.5 0.7 0.5])
colorbar
title('CAWCR * CICE * indicator')