-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Marc Brittain <[email protected]> Co-Authored-By: Christine Serres <[email protected]>
- Loading branch information
Showing
29 changed files
with
1,427 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
BSD 2-Clause License | ||
|
||
Copyright (c) 2018, 2019, 2020 Massachusetts Institute of Technology | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
# Copyright 2018 - 2020, MIT Lincoln Laboratory | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
# This run script allows users to run execQuery_2.sh in serial but querying the user once for the OpenSky username and password | ||
|
||
# Query user for OpenSky Network username | ||
printf "OpenSky Username: " | ||
IFS= read -r OSNUSER | ||
|
||
# Query user for OpenSky Network password | ||
# https://stackoverflow.com/a/2654048/363829 | ||
# https://stackoverflow.com/a/3980713/363829 | ||
stty_orig=$(stty -g) # save original terminal setting. | ||
stty -echo # turn-off echoing. | ||
printf "OpenSky Network Password: " | ||
IFS= read -r PASSWORD | ||
stty "$stty_orig" # restore terminal setting. | ||
|
||
#### After this line, list the execQuery_2 commands you want to run and use $OSNUSER and $PASSWORD as inputs | ||
#### The next line is a notional example: | ||
# ./execQuery_2.sh output/queries.txt output/2020-01-01/ $OSNUSER $PASSWORD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
# Copyright 2018 - 2020, MIT Lincoln Laboratory | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
# RUN_format_3.sh | ||
# | ||
# $1 : Parent directory of .txt logs | ||
|
||
# Parent directory of logs of OpenSky Impala shell in .txt format (see Step 2) | ||
if [ -z "$1" ]; then | ||
printf "Name of Parent directory of logs of OpenSky Impala shell in .txt format:" | ||
IFS= read -r INDIR | ||
else | ||
INDIR=$1 | ||
fi | ||
echo "input directory = $INDIR" | ||
|
||
# Find directory names | ||
# https://askubuntu.com/a/444554/244714 | ||
find "$(cd $INDIR ; pwd)" -mindepth 1 -maxdepth 1 -type d> output/3_dirArchiveDepth1.txt | ||
find "$(cd $INDIR ; pwd)" -mindepth 2 -maxdepth 2 -type d> output/3_dirArchiveDepth2.txt | ||
|
||
# Create counter | ||
count=1 | ||
|
||
# Find files in each directory | ||
while read d; do | ||
find $d -name '*.txt' -print >> output/3_files.txt | ||
|
||
#Advance counter | ||
count=$(( $count + 1 )) | ||
done < output/3_dirArchiveDepth2.txt | ||
|
||
# Timer and Counter | ||
SECONDS=0 | ||
count=1 | ||
|
||
# Serial | ||
while read d; do | ||
# Timer | ||
SECONDS=0 | ||
|
||
# Call script to format from .txt to .csv | ||
bash formatLogs_3.sh $d | ||
|
||
# Record status to file and display to screen | ||
echo $SECONDS >> output/3_seconds.txt | ||
echo "i=$count, time=$SECONDS" | ||
|
||
# Advance counter | ||
count=$(( $count + 1 )) | ||
done < output/3_files.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
% Copyright 2018 - 2020, MIT Lincoln Laboratory | ||
% SPDX-License-Identifier: BSD-2-Clause | ||
%% Inputs | ||
% Airspace file created in em-core | ||
fileAirspace = [getenv('AEM_DIR_CORE') filesep 'output' filesep 'airspace-B-C-D-E-03-Aug-2020' '.mat']; | ||
|
||
% Boundaries / bounding boxes | ||
rad_nm = 8; | ||
areaThres_nm = 1000; % 30 square miles | ||
classInclude = {'B','C','D'}; | ||
|
||
% Altitude | ||
minAGL_ft = 0; | ||
maxAGL_ft = 5100; | ||
maxMSL_ft = 12500; | ||
|
||
% Misc | ||
rngSeed = 42; | ||
isPlotBoundary = false; | ||
isPlotFinal = true; | ||
|
||
% Start Time | ||
sY = 2019; % Start Year | ||
sM = 11; % Start Month | ||
sD = 1; % Start Day | ||
sH = 5; % Start Hour | ||
sMI = 0; % Start Minutecd | ||
sS = 0; % Start Second | ||
|
||
% End Time | ||
timeEnd = 2019; | ||
eY = sY; % End Year | ||
eM = sM; % End Month | ||
eD = sD; % End Day | ||
eH = 23; % End Hour | ||
eMI = 0; % End Minute | ||
eS = 0; % End Second | ||
|
||
% Number of days to iterate over | ||
nDays = 14; | ||
|
||
% Time step for queries | ||
timeStep = hours(eH-sH); | ||
|
||
% Set this to false if you don't want parfor to automatically run | ||
ps = parallel.Settings; | ||
ps.Pool.AutoCreate = false; | ||
|
||
%% Iterate over time range and create queries | ||
for i=0:1:nDays-1 | ||
% Create ith start and end times | ||
% Time zones will be set locally | ||
timeStart = datetime(sY,sM,sD,sH,sMI,sS) + days(i); | ||
timeEnd = datetime(eY,eM,eD,eH,eMI,eS) + days(i); | ||
|
||
% Create string with relevant information | ||
outInfo = [[classInclude{:}] '_area' num2str(areaThres_nm) '_r' num2str(rad_nm) '_minAGL' num2str(minAGL_ft) '_maxAGL' num2str(maxAGL_ft) '_maxMSL' num2str(maxMSL_ft)]; | ||
|
||
% Create output directories | ||
outDirQuery = ['output']; | ||
outDirParent = [getenv('AEM_DIR_OPENSKY') filesep 'data' filesep outInfo filesep datestr(timeStart,'yyyy-mm-dd')]; | ||
|
||
% Create output file based on inputs | ||
outName = ['queries_' outInfo '_' datestr(timeStart,'yyyy-mm-dd') '_' '.txt']; | ||
outFile = [outDirQuery filesep outName]; | ||
|
||
% Create queries and write to file | ||
% Because this for loop only iterates over time, we don't need to | ||
% calculate the bounding boxes everytime | ||
if i==0 | ||
[queries, groups, boxLat_deg, boxLon_deg, minAlt_m_msl, maxAlt_m_msl] = generateQueries_1(fileAirspace,... | ||
'outFile',outFile,'isWrite',true,... | ||
'rad_nm',rad_nm,'areaThres_nm',areaThres_nm,'classInclude',classInclude,... | ||
'minAGL_ft',minAGL_ft,'maxAGL_ft',maxAGL_ft,'maxMSL_ft',maxMSL_ft,... | ||
'timeStart',timeStart,'timeEnd',timeEnd,'timeStep',timeStep,... | ||
'rngSeed',rngSeed,'isRandomize',true,... | ||
'isPlotBoundary',isPlotBoundary,'isPlotFinal',isPlotFinal); | ||
else | ||
[queries, groups,~,~,~,~] = generateQueries_1(fileAirspace,... | ||
'boxLat_deg',boxLat_deg,'boxLon_deg',boxLon_deg,... | ||
'minAlt_m_msl',minAlt_m_msl,'maxAlt_m_msl',maxAlt_m_msl,... | ||
'outFile',outFile,'isWrite',true,... | ||
'rad_nm',rad_nm,'areaThres_nm',areaThres_nm,'classInclude',classInclude,... | ||
'minAGL_ft',minAGL_ft,'maxAGL_ft',maxAGL_ft,'maxMSL_ft',maxMSL_ft,... | ||
'timeStart',timeStart,'timeEnd',timeEnd,'timeStep',timeStep,... | ||
'isRandomize',false,... | ||
'isPlotBoundary',false,'isPlotFinal',false); | ||
end | ||
|
||
% Create parent directory | ||
mkdir(outDirParent); | ||
|
||
% Create subdirectories for each group | ||
arrayfun(@(x)(mkdir([outDirParent filesep num2str(x)])),unique(groups)); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SPDXVersion: SPDX-2.1 | ||
PackageName: em-download-opensky | ||
PackageOriginator: MIT Lincoln Laboratory | ||
PackageHomePage: https://github.com/Airspace-Encounter-Models/em-download-opensky | ||
PackageLicenseDeclared: BSD-2-Clause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function [polygon1 polygon2]=DIVIDEX(polygon,X) | ||
polygon1=[]; | ||
polygon2=[]; | ||
if not(isempty(polygon)) | ||
m=length(polygon.x); | ||
c1=0; | ||
c2=0; | ||
|
||
for i=1:1:m | ||
|
||
j=i+1; | ||
if i==m | ||
j=1; | ||
end | ||
if polygon.x(i)<=X | ||
c1=c1+1; | ||
polygon1.x(c1)=polygon.x(i); | ||
polygon1.y(c1)=polygon.y(i); | ||
end | ||
if polygon.x(i)>=X | ||
c2=c2+1; | ||
polygon2.x(c2)=polygon.x(i); | ||
polygon2.y(c2)=polygon.y(i); | ||
end | ||
|
||
if (polygon.x(i)>X && polygon.x(j)<X) || (polygon.x(i)<X && polygon.x(j)>X) | ||
c1=c1+1; | ||
polygon1.x(c1)=X; | ||
polygon1.y(c1)=polygon.y(j)+(polygon.y(i)-polygon.y(j))/(polygon.x(i)-polygon.x(j))*(X-polygon.x(j)); | ||
c2=c2+1; | ||
polygon2.x(c2)=X; | ||
polygon2.y(c2)=polygon.y(j)+(polygon.y(i)-polygon.y(j))/(polygon.x(i)-polygon.x(j))*(X-polygon.x(j)); | ||
end | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function PXY=DIVIDEXY(polygon,NX,NY) | ||
% Ayad Al-Rumaithi (2020). Divide Polygon (https://www.mathworks.com/matlabcentral/fileexchange/71635-divide-polygon), MATLAB Central File Exchange. Retrieved September 15, 2020. | ||
%Input | ||
%polygon: a structure consist of polygon.x (vector of x-coordinates) and polygon.y (vector of y-coordinates) | ||
%NX: Number of divisions in x direction | ||
%NY: Number of divisions in y direction | ||
|
||
%Output | ||
%PXY: a cell array where PX{i,j}.x and PX{i,j} are vectors of x and y coordinates of new polygon in (i,j) grid position | ||
|
||
DX=(max(polygon.x)-min(polygon.x))/NX; | ||
DY=(max(polygon.y)-min(polygon.y))/NY; | ||
|
||
i=0; | ||
P=polygon; | ||
for X=min(polygon.x)+DX:DX:max(polygon.x)-DX | ||
i=i+1; | ||
[PX{i}, P]=DIVIDEX(P,X); | ||
|
||
end | ||
|
||
PX{NX}=P; | ||
|
||
|
||
for i=1:1:NX | ||
j=0; | ||
for Y=min(polygon.y)+DY:DY:max(polygon.y)-DY | ||
j=j+1; | ||
[PXY{i,j}, PX{i}]=DIVIDEY(PX{i},Y); | ||
end | ||
|
||
PXY{i,NY}=PX{i}; | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function [polygon1 polygon2]=DIVIDEY(polygon,Y) | ||
polygon1=[]; | ||
polygon2=[]; | ||
if not(isempty(polygon)) | ||
m=length(polygon.y); | ||
c1=0; | ||
c2=0; | ||
|
||
for i=1:1:m | ||
|
||
j=i+1; | ||
if i==m | ||
j=1; | ||
end | ||
if polygon.y(i)<=Y | ||
c1=c1+1; | ||
polygon1.x(c1)=polygon.x(i); | ||
polygon1.y(c1)=polygon.y(i); | ||
end | ||
if polygon.y(i)>=Y | ||
c2=c2+1; | ||
polygon2.x(c2)=polygon.x(i); | ||
polygon2.y(c2)=polygon.y(i); | ||
end | ||
|
||
if (polygon.y(i)>Y && polygon.y(j)<Y) || (polygon.y(i)<Y && polygon.y(j)>Y) | ||
c1=c1+1; | ||
polygon1.x(c1)=polygon.x(j)+(polygon.x(i)-polygon.x(j))/(polygon.y(i)-polygon.y(j))*(Y-polygon.y(j)); | ||
polygon1.y(c1)=Y; | ||
c2=c2+1; | ||
polygon2.x(c2)=polygon.x(j)+(polygon.x(i)-polygon.x(j))/(polygon.y(i)-polygon.y(j))*(Y-polygon.y(j)); | ||
polygon2.y(c2)=Y; | ||
end | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
polygon.x=[0 4 7 5 1]; %Polygon x-coordinates | ||
polygon.y=[0 -2 0 10 8]; %Polygon y-coordinates | ||
NX=5; %Number of divisions in x direction | ||
NY=3; %Number of divisions in y direction | ||
|
||
PXY=DIVIDEXY(polygon,NX,NY); %Divide Polygon to smaller polygons set by grid | ||
|
||
subplot(1,2,1); %Plot original Polygon | ||
for i=0:1:NX | ||
plot([i/NX*(max(polygon.x)-min(polygon.x))+min(polygon.x) i/NX*(max(polygon.x)-min(polygon.x))+min(polygon.x)],[min(polygon.y) max(polygon.y)],'g'); | ||
hold on | ||
end | ||
for i=0:1:NY | ||
plot([min(polygon.x) max(polygon.x)],[i/NY*(max(polygon.y)-min(polygon.y))+min(polygon.y) i/NY*(max(polygon.y)-min(polygon.y))+min(polygon.y)],'g'); | ||
hold on | ||
end | ||
plot([polygon.x polygon.x(1)],[polygon.y polygon.y(1)],'b*-'); | ||
hold off | ||
daspect([1 1 1]); | ||
|
||
subplot(1,2,2); %Plot smaller polygons set by grid | ||
for i=1:1:NX | ||
for j=1:1:NY | ||
if not(isempty(PXY{i,j})) | ||
plot([PXY{i,j}.x PXY{i,j}.x(1)],[PXY{i,j}.y PXY{i,j}.y(1)],'ro-'); | ||
end | ||
hold on | ||
end | ||
end | ||
hold off | ||
daspect([1 1 1]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Divide Polygon | ||
|
||
| Code | Description | Software Source | License Source | Git Submodule? | | ||
| :-------------| :-- |:-------------| :-----| :--- | | ||
DIVIDEXY | Divide polygon into smaller polygons set by grid| [File Exchange](https://www.mathworks.com/matlabcentral/fileexchange/71635-divide-polygon) | [BSD-3 Clause](https://www.mathworks.com/matlabcentral/fileexchange/71635-divide-polygon#license_modal) | No | ||
|
||
## Distribution Statement | ||
|
||
DISTRIBUTION STATEMENT A. Approved for public release. Distribution is unlimited. | ||
|
||
© 2018, 2019, 2020 Massachusetts Institute of Technology. | ||
|
||
This material is based upon work supported by the Federal Aviation Administration under Air Force Contract No. FA8702-15-D-0001. | ||
|
||
Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS Part 252.227-7013 or 7014 (Feb 2014). Notwithstanding any copyright notice, U.S. Government rights in this work are defined by DFARS 252.227-7013 or DFARS 252.227-7014 as detailed above. Use of this work other than as specifically authorized by the U.S. Government may violate any copyrights that exist in this work. | ||
|
||
Any opinions, findings, conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Federal Aviation Administration. | ||
|
||
This document is derived from work done for the FAA (and possibly others), it is not the direct product of work done for the FAA. The information provided herein may include content supplied by third parties. Although the data and information contained herein has been produced or processed from sources believed to be reliable, the Federal Aviation Administration makes no warranty, expressed or implied, regarding the accuracy, adequacy, completeness, legality, reliability or usefulness of any information, conclusions or recommendations provided herein. Distribution of the information contained herein does not constitute an endorsement or warranty of the data or information provided herein by the Federal Aviation Administration or the U.S. Department of Transportation. Neither the Federal Aviation Administration nor the U.S. Department of Transportation shall be held liable for any improper or incorrect use of the information contained herein and assumes no responsibility for anyone’s use of the information. The Federal Aviation Administration and U.S. Department of Transportation shall not be liable for any claim for any loss, harm, or other damages arising from access to or use of data or information, including without limitation any direct, indirect, incidental, exemplary, special or consequential damages, even if advised of the possibility of such damages. The Federal Aviation Administration shall not be liable to anyone for any decision made or action taken, or not taken, in reliance on the information contained herein. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Copyright (c) 2019, Ayad Al-Rumaithi | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution | ||
* Neither the name of University of Baghdad nor the names of its | ||
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.