-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakePlots.m
185 lines (159 loc) · 6.91 KB
/
MakePlots.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
function MakePlots(grid,wind,crops,water,city,forest,elev,comb,combW,gridR,latlim, lonlim)
%MakePlots generates plots for map layers
% Takes in the constituent map layers for this project and generates
% plots for illustration and the final presentation
% ------------------------------ Preliminary ------------------------------
cropRGB = [252 164 56]/255;
waterRGB = [52 128 235]/255;
cityRGB = [191 10 10]/255;
forestRGB = [45 145 44]/255;
elevRGB = [195 76 224]/255;
set(0,'DefaultFigureColor',[1 1 1])
states = shaperead('usastatehi','UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
% ------------------------------ Full US Map ------------------------------
FullFig = figure;
FullAx = usamap('conus');
set(FullAx, 'Visible', 'off')
geoshow(FullAx,grid,gridR,'displaytype', 'surface');
geoshow(FullAx, states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
% ------------------------ Wind Speed at 100 m Map ------------------------
WindFig = figure;
ax = usamap('conus');
set(ax, 'Visible', 'off')
geoshow(ax,wind,gridR,'displaytype', 'surface');
geoshow(ax, states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
colormap(parula)
caxis([3 10])
c = colorbar;
c.Label.String = 'Wind Speed (m/s)';
% ---------------------- Agricultural Development Map ---------------------
CropFig = figure;
ax = usamap('conus');
set(ax, 'Visible', 'off')
geoshow(ax,crops,gridR,'displaytype', 'surface');
geoshow(ax, states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
colormap([cropRGB])
% view(ax,0,25)
% set(CropFig,'units','inches','position',[0,0,20,10])
% imwrite(getframe(CropFig).cdata, 'cropsF.png', 'png', 'transparency', [1 1 1])
% --------------------------- Standing Water Map --------------------------
WaterFig = figure;
ax = usamap('conus');
set(ax, 'Visible', 'off')
geoshow(ax,water,gridR,'displaytype', 'surface');
geoshow(ax, states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
colormap([waterRGB])
% view(ax,0,25)
% set(WaterFig,'units','inches','position',[0,0,20,10])
% imwrite(getframe(WaterFig).cdata, 'waterF.png', 'png', 'transparency', [1 1 1])
% ------------------------- Urban Development Map -------------------------
CityFig = figure;
ax = usamap('conus');
set(ax, 'Visible', 'off')
geoshow(ax,city,gridR,'displaytype', 'surface');
geoshow(ax, states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
colormap([cityRGB])
% view(ax,0,25)
% set(CityFig,'units','inches','position',[0,0,20,10])
% imwrite(getframe(CityFig).cdata, 'cityF.png', 'png', 'transparency', [1 1 1])
% -------------------------- Forest Coverage Map --------------------------
ForestFig = figure;
ax = usamap('conus');
set(ax, 'Visible', 'off')
geoshow(ax,forest,gridR,'displaytype', 'surface');
geoshow(ax, states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
c = colorbar;
c.Label.String = 'Percent Vegetation';
colormap([forestRGB])
% view(ax,0,25)
% set(ForestFig,'units','inches','position',[0,0,20,10])
% imwrite(getframe(ForestFig).cdata, 'forest.png', 'png', 'transparency', [1 1 1])
% --------------------- Elevation Map and Gradient Map --------------------
ElevFig = figure;
ax = usamap('conus');
set(ax, 'Visible', 'off')
geoshow(ax,elev,gridR,'displaytype', 'surface');
geoshow(ax,states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
c = colorbar;
c.Label.String = 'Elevation (m)';
caxis([0 3000])
colormap([elevRGB])
% view(ax,0,25)
% set(ElevFig,'units','inches','position',[0,0,20,10])
% imwrite(getframe(ElevFig).cdata, 'elev.png', 'png', 'transparency', [1 1 1])
% --------------------------- Combined Layer Map --------------------------
CombFig = figure;
ax = usamap('conus');
set(ax, 'Visible', 'off')
geoshow(ax,comb,gridR,'displaytype', 'surface');
geoshow(ax, states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
colormap([forestRGB;elevRGB;waterRGB;cropRGB;cityRGB])
view(ax,0,25)
set(CombFig,'units','inches','position',[0,0,20,10])
imwrite(getframe(CombFig).cdata, 'combinedUnSC32.png', 'png', 'transparency', [1 1 1])
CombWFig = figure;
ax = usamap('conus');
set(ax, 'Visible', 'off')
geoshow(ax,combW,gridR,'displaytype', 'surface');
geoshow(ax, states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
colormap(parula)
set(CombWFig,'units','inches','position',[0,0,20,10])
caxis([3 10])
c = colorbar;
c.Label.String = 'Wind Speed (m/s)';
% ------------------------ Capacity Simulation Gifs -----------------------
% years = 2022:2080;
%
% for i = 1:length(years)
% caps(i) = Outputs.(sprintf('NewCap%4.0f',years(i))); % Extract capacity values
% end
%
% for i = 1:length(years)
% preds(i) = Outputs.(sprintf('PredCap%4.0f',years(i))); % Extract predicted capacity values
% end
%
% capanimation = interp1(2022:2080,caps,2022:0.1:2080, "makima","extrap");
% predanimation = interp1(2022:2080,preds,2022:0.1:2080, "makima","extrap");
%
% timeax = 2022:0.1:2080;
%
% figure;
% hold on
% ylim([0 50])
% xlim([2020 2080])
% ylabel('Annual New Capacity (GW)')
% set(gca,'FontSize',16)
% set(gca,'linewidth',2)
% set(gcf,'units','inches','position',[0,0,20,10])
% box on
% gif('capacity.gif')
%
% for i = 1:length(capanimation)
% plot(timeax(1:i),capanimation(1:i),'k','LineWidth',2)
% plot(timeax(1:i),predanimation(1:i),'r','LineWidth',2)
% legend('New Capacity','Predicted New Capacity','location','northwest')
% gif
% end
% ------------------------ Wind Farm Location Gifs ------------------------
% CombWFig = figure;
% ax = usamap('conus');
% set(ax, 'Visible', 'off')
% geoshow(ax,combW,gridR,'displaytype', 'surface');
% geoshow(ax, states, 'FaceColor', [1 1 1],'FaceAlpha',0,'LineWidth',1)
% colormap(parula)
% caxis([3 10])
% set(gca,'FontSize',16)
% hold on
% gif('farms.gif')
%
% for i = 1:length(years)
% title(sprintf('%4.0f',years(i)))
% points = Outputs.(sprintf('Coords%4.0f',years(i))); % Extract predicted capacity values
%
% for j = 1:size(points,1)
% scatterm(latvec(points(j,1)),lonvec(points(j,2)),'r','filled','markeredgecolor','none','sizedata',15)
% gif
% end
% clear points
% end
end