Public
Edited
Mar 24, 2023
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
data
Type Table, then Shift-Enter. Ctrl-space for more options.

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
minMWh = 0
Insert cell
Insert cell
stepsMWp = d3.range(9).reduce((bla, val, i, arr) => {
bla.push(
Math.round(((maxMWp - minMWp) / (arr.length + 1)) * (val + 1)) + minMWp
);
bla.push(
d3
.color(
d3.interpolateRgbBasis(["#FFFFFF", "#479EDB", "#204F75"])(
(val + 1) / (arr.length + 1)
)
)
.formatHex()
// d3.color(d3.interpolateYlOrBr((val + 1) / (arr.length + 1))).formatHex()
);
return bla;
}, [])
Insert cell
stepsMWh = d3.range(9).reduce((bla, val, i, arr) => {
bla.push(
Math.round(((maxMWh - minMWh) / (arr.length + 1)) * (val + 1)) + minMWh
);
bla.push(
d3
.color(
d3.interpolateRgbBasis(["#FFFFFF", "#E9C54B", "#47332A"])(
(val + 1) / (arr.length + 1)
)
)
.formatHex()
// d3.color(d3.interpolateYlOrBr((val + 1) / (arr.length + 1))).formatHex()
);
return bla;
}, [])
Insert cell
Insert cell
nuts3_gemeinden = d3.group(
await FileAttachment("gemeinden_nuts3@3.csv").csv({ typed: true }),
(g) => g.NUTS_CODE
)
Insert cell
Insert cell
geojson_nuts3 = {
const fc = topojson.feature(nuts3_topo, nuts3_topo.objects.NUTS250_N3);
fc.features.forEach((region, i) => {
// Gemeinden für NUTS 3 Region abrufen
const gemeinden = nuts3_gemeinden.get(region.properties.NUTS_CODE);
// Potentiale aggregieren
const gemeinde_daten = gemeinden.flatMap((g) =>
data.filter((r) => Number(r.AGS) == g.AGS)
);
fc.features[i].properties["Installierbare Leistung (MWp)"] = d3.sum(
gemeinde_daten.map((r) => r["Installierbare Leistung (MWp)"])
);
fc.features[i].properties["Stromerzeugungspotenzial (MWh)"] = d3.sum(
gemeinde_daten.map((r) => r["Stromerzeugungspotenzial (MWh)"])
);
fc.features[i].properties["Geeignete Flächen (ha)"] = d3.sum(
gemeinde_daten.map((r) => r["Geeignete Flächen (ha)"])
);
});
return fc;
}
Insert cell
total_TWh = _.round(energy_sums.totalEnergieMWh / (1000 * 1000), 2) //
Insert cell
perc_energie_verbrauch_d = _.round((total_TWh / 588.8) * 100, 2) // Gesamtproduktion Deutschland https://www.bmwk.de/Redaktion/DE/Dossier/strommarkt-der-zukunft.html#:~:text=In%20Deutschland%20wurden%20im%20Jahr,das%20sind%20588%20Milliarden%20kWh%20.
Insert cell
Insert cell
Insert cell
Insert cell
energy_tb = tb_gt_treshold.derive({
MWp: aq.escape((d) =>
calc_installierbare_leistung_MWp(d.streifen_flaeche_ha)
),
pvout: aq.escape((d) => Number(d.PVOUT_centroid)),
MWh: aq.escape((d) =>
calc_energie_pro_zeiteinheit_MWh(d.streifen_flaeche_ha, d.PVOUT_centroid)
),
...monate.reduce((arr, monat) => {
arr[monat.eng_key] = aq.escape((d) =>
calc_energie_pro_zeiteinheit_MWh(d.streifen_flaeche_ha, d[monat.eng_key])
);
return arr;
}, {})
})
Insert cell
tb_gt_treshold = tb
.filter(aq.escape((d) => d.streifen_flaeche_ha > min_size))
.filter(aq.escape((d) => (nat_ausschliessen.length ? !d.natura2000 : d)))
Insert cell
energy_sums = energy_tb
.rollup({
totalInstallierbarMWp: (d) => Math.round(op.sum(d.MWp)),
avgPVOUT: (d) => Math.round(op.average(d.pvout)),
totalEnergieMWh: (d) => Math.round(op.sum(d.MWh)),
PVOUT_01_centroid: (d) => Math.round(op.sum(d.PVOUT_01_centroid)),
PVOUT_02_centroid: (d) => Math.round(op.sum(d.PVOUT_02_centroid)),
PVOUT_03_centroid: (d) => Math.round(op.sum(d.PVOUT_03_centroid)),
PVOUT_04_centroid: (d) => Math.round(op.sum(d.PVOUT_04_centroid)),
PVOUT_05_centroid: (d) => Math.round(op.sum(d.PVOUT_05_centroid)),
PVOUT_06_centroid: (d) => Math.round(op.sum(d.PVOUT_06_centroid)),
PVOUT_07_centroid: (d) => Math.round(op.sum(d.PVOUT_07_centroid)),
PVOUT_08_centroid: (d) => Math.round(op.sum(d.PVOUT_08_centroid)),
PVOUT_09_centroid: (d) => Math.round(op.sum(d.PVOUT_09_centroid)),
PVOUT_10_centroid: (d) => Math.round(op.sum(d.PVOUT_10_centroid)),
PVOUT_11_centroid: (d) => Math.round(op.sum(d.PVOUT_11_centroid))
})
.object()
Insert cell
function calc_installierbare_leistung_MWp(ha) {
// Flächeninanspruchnahme berechnen
// const values = [
// (750 / 1000) * fia.fia_750,
// (2000 / 1000) * fia.fia_2000,
// (5000 / 1000) * fia.fia_5000,
// (20000 / 1000) * fia.fia_20000
// ];
// // Flächeninanspruchnahme auswählen, die der Schlaggröße am nächsten kommt
// const fias = [fia.fia_750, fia.fia_2000, fia.fia_5000, fia.fia_20000];
// const index = findClosestIndex(values, ha);
// const MWp = ha / fias[index];
const MWp = ha / fia_simple;
// wenn die installierbare Leistung negativ wird (zu kleine Fläche)
// wird eine installierbare Leistung von 0 angenommen
return MWp < 0 ? 0 : MWp;
}
Insert cell
function calc_energie_pro_zeiteinheit_MWh(ha, pvout) {
return calc_installierbare_leistung_MWp(ha) * Number(pvout);
}
Insert cell
monate = [
{ monat: "Januar", eng_key: "PVOUT_01_centroid" },
{ monat: "Februar", eng_key: "PVOUT_02_centroid" },
{ monat: "März", eng_key: "PVOUT_03_centroid" },
{ monat: "April", eng_key: "PVOUT_04_centroid" },
{ monat: "Mai", eng_key: "PVOUT_05_centroid" },
{ monat: "Juni", eng_key: "PVOUT_06_centroid" },
{ monat: "Juli", eng_key: "PVOUT_07_centroid" },
{ monat: "August", eng_key: "PVOUT_08_centroid" },
{ monat: "September", eng_key: "PVOUT_09_centroid" },
{ monat: "Oktober", eng_key: "PVOUT_10_centroid" },
{ monat: "Dezember", eng_key: "PVOUT_11_centroid" }
]
Insert cell
flaeche_autobahn_ha = Math.round(10349011869/ 10000)
Insert cell
flaeche_schienen_ha = Math.round(27679550581 / 10000)
Insert cell
Insert cell
Insert cell
Insert cell
total_area = Math.round(
tb
.rollup({
total: (d) => op.sum(d.streifen_flaeche_ha)
})
.object().total
)
Insert cell
total_area_filtered = Math.round(
tb_gt_treshold
.rollup({
total: (d) => op.sum(d.streifen_flaeche_ha)
})
.object().total
)
Insert cell
natura2000_area = total_area - total_area_no_natura2000
Insert cell
total_area_no_natura2000 = Math.round(
tb
.filter((d) => !d.natura2000)
.rollup({
total: (d) => op.sum(d.streifen_flaeche_ha)
})
.object().total
)
Insert cell
Insert cell
Insert cell
Insert cell
areas_per_crop = tb
.pivot("crop_type", { total: (d) => op.sum(d.streifen_flaeche_ha) })
.object()
Insert cell
tb = aq.fromArrow(table)
Insert cell
table = pq.readParquet(new Uint8Array(await data_source.arrayBuffer()))
Insert cell
Insert cell
naturschutz_pattern = render(
textures.lines().size(4).strokeWidth(1).stroke("white").background("#7DBB39")
)
Insert cell
naturschutz_pattern_png = rasterize(naturschutz_pattern)
Insert cell
Insert cell
data_source = FileAttachment("lf_an_autobahnen_bahnstrecken_inkl_daten_500.parquet")
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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more