This repository has been archived by the owner on Jan 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_SOM_ivt.m
93 lines (79 loc) · 2.93 KB
/
plot_SOM_ivt.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The purpose of this program is to create composites for the 2x2 SOM runs.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Housekeeping
clear all
close all
% Setup
expID = 'WRF_gfdl_25km';
SOMexpID = 'ONDJFM';
num_rows = 3;
num_cols = 3;
runID = strcat(num2str(num_rows),'x',num2str(num_cols),'.',SOMexpID,'.',expID);
% WRF input data
dirIN = 'SOMcomposites/';
% Output directory for plots
dirOUT = '/home/dswales/Projects/NA-CORDEX/plots/SOMs/';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plotting stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Colortables
dirC = '/home/dswales/tools/MATLAB/colortables/';
file1 = strcat(dirC,'ctable.70.CB-RdBu.txt');
file2 = strcat(dirC,'ctable.52.CB-GnBu.txt');
file3 = strcat(dirC,'ctable.58.CB-PuBuGn.txt');
file4 = strcat(dirC,'ctable.65.CB-YlOrBr.txt');
cmap = textread(file1);
cmap2 = textread(file2);
cmap2(1:5,:)=1; %Make precip under 2.5mm white
cmap3 = textread(file3);
cmap4 = textread(file4);
% Composite plot domain
minLat = 20;
maxLat = 55;
minLon = 220;
maxLon = 260;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Read in WRF data.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
file = strcat(dirIN,'comp.',runID,'.nc');
lon = ncread(file,'lon');
lat = ncread(file,'lat');
bmu = ncread(file,'BMU');
ivt = ncread(file,'IVT');
precip = ncread(file,'precip');
precip_anom = ncread(file,'precip_anom');
ivt_anom = ncread(file,'IVT_anom');
pat_freq = ncread(file,'pfreq');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make Plots
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Standardized IVT anomaly.
varName = 'IVTanom';
varRange = [-2,2];
dVar = 0.1;
varLName = 'Standardized IVT Anomaly';
plot_SOMcomposites(double(ivt_anom), double(lon), double(lat), pat_freq, varRange(1), varRange(2), dVar, minLon, minLat,...
maxLon, maxLat, cmap, num_rows, num_cols, varLName)
saveas(1,strcat(dirOUT, 'SOM.', runID, varName, '.jpg'), 'jpg')
close all
% IVT
varName = 'IVT';
varRange = [10,200];
dVar = 5.;
varLName = 'IVT';
plot_SOMcomposites(double(ivt), double(lon), double(lat), pat_freq, varRange(1), varRange(2), dVar, minLon, minLat,...
maxLon, maxLat, cmap2, num_rows, num_cols, varLName)
saveas(1,strcat(dirOUT, 'SOM.', runID, varName, '.jpg'), 'jpg')
close all
% Precipitation
varName = 'Precip';
varRange = [0,20];
dVar = 1;
varLName = 'Precipitation';
plot_SOMcomposites(double(precip), double(lon), double(lat), pat_freq, varRange(1), varRange(2), dVar, minLon, minLat,...
maxLon, maxLat, cmap2, num_rows, num_cols, varLName)
saveas(1,strcat(dirOUT, 'SOM.', runID, varName, '.jpg'), 'jpg')
close all