Public
Edited
Mar 26, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// workbook = await FileAttachment("Laser-Report-2023-FOIA-DEC-Final.xlsx").xlsx();
Insert cell
// laserData = workbook.sheet(1, {headers: true}).map(d => {
// return {
// date: d3.utcDay(d['Incident Date']),
// time: d['Incident Time'],
// flight_id: d['FlightID'],
// aircraft: d.Aircraft,
// altitude: d.Altitude,
// airport: d.Airport,
// laser_color: d['Laser Color'] ? d['Laser Color'].toLowerCase().trim() : "Unk",
// city: d.City.trim(),
// state: d.State.trim(),
// injury: d.Injury ? d.Injury.trim().toLowerCase() === "no" ? "no" : d.Injury.trim().toLowerCase() === "yes" ? "yes" : "unknown" : "unknown"
// };
// });
Insert cell
faa_lasers = {
let data = [];
let workbook = await FileAttachment("Laser_Report_2018.xlsx").xlsx();
data = data.concat(workbook.sheet(0, {headers: true}));

workbook = await FileAttachment("Laser_Report_2019.xlsx").xlsx();
data = data.concat(workbook.sheet(0, {headers: true}));

workbook = await FileAttachment("Laser_Report_2020.xlsx").xlsx();
data = data.concat(workbook.sheet(0, {headers: true}));

workbook = await FileAttachment("Laser_Report_2021.xlsx").xlsx();
data = data.concat(workbook.sheet(0, {range: "A2:J", headers: true}));

workbook = await FileAttachment("Laser_Report_2022.xlsx").xlsx();
data = data.concat(workbook.sheet(0, {headers: true}));

workbook = await FileAttachment("Laser-Report-2023-FOIA-DEC-Final.xlsx").xlsx();
data = data.concat(workbook.sheet(1, {headers: true}));

data = data.filter(d => d.City && d.State && typeof(d.City) === "string");
data = data.map(d => {
return {
date: d3.utcDay(d['Incident Date']),
time: d['Incident Time'],
flight_id: d['Flight ID'] ? d['Flight ID'] : d['FlightID'],
aircraft: d.Aircraft,
altitude: d.Altitude,
airport: d.Airport,
laser_color: d['Laser Color'] ? d['Laser Color'].toLowerCase().trim() : "NULL",
city: d.City.trim(),
state: d.State.trim(),
injury: d.Injury ? d.Injury.trim().toLowerCase() === "no" ? "no" : d.Injury.trim().toLowerCase() === "yes" ? "yes" : "unknown" : "unknown"
};
});

data.map(d => {
d.state = d.state === "DC" ? "District of Columbia" : d.state === "VA" ? "Virginia" : d.state;
d.year = d.date.getUTCFullYear();
d.month = d.date.getUTCMonth();
d.day_of_year = d3.utcDay.count(d3.utcYear(d.date), d.date);
d.day_of_week = d3.utcDay.count(d3.utcSunday(d.date), d.date);
d.hour_of_day = Math.floor(d.time / 100);
d.date.getUTCMonth
});
return data;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more