-
Notifications
You must be signed in to change notification settings - Fork 0
/
RUN_2_GSHHG.m
68 lines (55 loc) · 2.5 KB
/
RUN_2_GSHHG.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
% Copyright 2018 - 2021, MIT Lincoln Laboratory
% SPDX-License-Identifier: BSD-2-Clause
%% INPUTS
iso_3166_2 = {'US-MA','US-MS','US-NC','US-ND','US-NH','US-NY','US-PR','US-RI','US-TX','US-VA'}; % dev cases
% GSHHG variables
lvl = '1'; % Shoreline data are distributed in 6 levels
res = 'f'; % All data sets come in 5 different resolutions
% UAS variables
airspeed_kt = 50;
climbRate_fps = floor(1000 / 60);
descendRate_fps = ceil(-1000/60);
alt_ft_agl = [250];
% Feature parameters
maxSpacing_ft = 50;
%% Iterate over iso_3166_2
for i=1:1:numel(iso_3166_2)
% Define default DEMs and output directory
[dem, demDir, demBackup, demDirBackup, outDirBase, Tdof] = RunHelper_2(iso_3166_2{i});
% Load and parse feature data
[S, ~, airspace] = LoadParseGSHHG(iso_3166_2{i},'lvl',lvl,'res',res);
if isempty(S)
fprintf('No features for %s...CONTINUE\n',iso_3166_2{i});
continue
end
% No filter
l = true(size(S,1),1);
% Filter to include airspace near features of interest
% We do this because looking up airspace is slow
buff_deg = nm2deg(1);
bbox = [min(cellfun(@min,S.LON_deg(l)))-buff_deg, min(cellfun(@min,S.LAT_deg(l)))-buff_deg; max(cellfun(@max,S.LON_deg(l)))+buff_deg, max(cellfun(@max,S.LAT_deg(l)))+buff_deg];
[~, ~, inAirK] = filterboundingbox(airspace.LAT_deg,airspace.LON_deg,bbox);
% Filter DOF obstacles and create S_obstacle
[~, ~, inDofK] = filterboundingbox(Tdof.lat_deg,Tdof.lon_deg,bbox);
S_obstacle = table(Tdof.lat_acc_deg(inDofK),Tdof.lon_acc_deg(inDofK),Tdof.alt_ft_msl(inDofK) - Tdof.alt_ft_agl(inDofK),Tdof.alt_ft_msl(inDofK),'VariableNames',{'LAT_deg','LON_deg','FLOOR_ft_msl','CEILING_ft_msl'});
% Display status
fprintf('%i trajectories, %i potential airspace classes when i=%i, k=%i\n',sum(l),sum(inAirK),i,k);
% Generate closed spaced waypoints trajectories
outDir = [outDirBase filesep 'gshhg_gshhs_res' res '_lvl' lvl '_spacing' num2str(maxSpacing_ft)];
GenerateTracks(S(l,1:3),...
outDir,...
airspace(inAirK,:),...
'trackMode','holdalt',...
'maxSpacing_ft',maxSpacing_ft,...
'alt_tol_ft',25,...
'dem',dem,...
'demDir',demDir,...
'demBackup',demBackup,...
'demDirBackup',demDirBackup,...
'airspeed_kt',airspeed_kt,...
'climbRate_fps',climbRate_fps,...
'descendRate_fps',descendRate_fps,...
'alt_ft_agl',alt_ft_agl,...
'S_obstacle',S_obstacle,...
'isCheckObstacle',true);
end