-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_coarse_fine_cell_locations.m
61 lines (41 loc) · 1.55 KB
/
plot_coarse_fine_cell_locations.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
pts = matfile('/Volumes/WDPassport/DATA/WRF/Downscaled/coarse_fine_cell_locations.mat');
lonc=pts.lonc;
latc=pts.latc;
lonf=pts.lonf;
latf=pts.latf;
latlim = [31 49.5];
lonlim = [-125 -104];
states = shaperead('usastatehi', 'UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
lat = [states.Lat];
lon = [states.Lon];
% check that points are inside US
infine = inpoly2([lonf,latf],[lon',lat']);
inc = inpoly2([lonc,latc],[lon',lat']);
% texas
tlon = states(12).Lon;
tlat = states(12).Lat;
intexf = inpoly2([lonf,latf],[tlon',tlat']);
intexc = inpoly2([lonc,latc],[tlon',tlat']);
% exclude texas too
inc(intexc==1) = 0;
infine(intexf==1) = 0;
figure(1);clf; fig = gcf; fig.PaperUnits = 'inches';
fig.PaperPosition = [0 0 12 12];
ax1 = usamap(latlim, lonlim);
plotm(latf(infine),lonf(infine),'.','MarkerSize',.00001);
plotm(lat,lon,'k','linewidth',1.6);
gridm off
print('/Volumes/WDPassport/DATA/WRF/Downscaled/fine_cell_coverage.png','-dpng','-r400');
figure(2);clf; fig = gcf; fig.PaperUnits = 'inches';
fig.PaperPosition = [0 0 12 12];
ax1 = usamap(latlim, lonlim);
plotm(latc(inc),lonc(inc),'.','MarkerSize',.6);
plotm(lat,lon,'k','linewidth',1.6);
gridm off
print('/Volumes/WDPassport/DATA/WRF/Downscaled/coarse_cell_coverage.png','-dpng','-r400');
% What percent of domain is covered by fine vs. coarse?
finearea = (sum(infine).*210*210)/1000/1000; % km2
coarsearea = (sum(inc).*1050*1050)/1000/1000; % km2
totalarea = finearea+coarsearea;
finepercent = (finearea/totalarea)*100
coarsepercent = (coarsearea/totalarea)*100