Public
Edited
Aug 4
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
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
// fst_data_pop = db.query(`
// select admin0_name
// , type
// , 2020 as year
// , case type
// when 'rural_pop' then rural_pop
// when 'urban_pop' then urban_pop
// end as population
// , case type
// when 'rural_pop' then (rural_pop / (rural_pop + urban_pop)) * 100
// when 'urban_pop' then (urban_pop / (rural_pop + urban_pop)) * 100
// end as percentage
// from ${dataTable.factsSummaryTable_population.name}
// cross join (values ('rural_pop'), ('urban_pop')) as types(type)
// where admin1_name is null
// order by admin0_name, type
// `)
Insert cell
// // poverty lines
// fst_data_pov = db.query(`
// -- poverty distribution
// select admin0_name
// , year
// , variable as type
// , value * 100 as percentage
// from ${dataTable.factsSummaryTable_poverty.name}
// where 1=1
// and admin1_name is null
// and "group" = 'poverty'
// `)
Insert cell
// fst_data_gdp = db.query(`
// -- gdp
// with base as (
// select admin0_name
// , year
// , sector
// , gdp_usd2015
// from ${dataTable.factsSummaryTable_gdp.name}
// where 1=1
// and year = (select max(year) from ${dataTable.factsSummaryTable_gdp.name} )
// and sector != 'total'
// ),
// totals as (
// select admin0_name
// , sum(gdp_usd2015) as total
// from base
// group by 1
// ),
// withPercent as (
// select gdp_usd2015 / total * 100 as percentage
// , *
// from base
// left join totals
// on totals.admin0_name = base.admin0_name
// )

// select admin0_name
// , year
// , sector
// , 'gdp_usd2015' as variable
// , gdp_usd2015 as gdp
// , percentage
// from withPercent
// `)
Insert cell
// fst_data_land = db.query(`
// -- land use
// with base as (
// select admin0_name
// , "group"
// , year
// , ha
// from ${dataTable.factsSummaryTable_land.name}
// where 1=1
// and Year = (select max(Year) from ${dataTable.factsSummaryTable_land.name} )
// and sub_group is null
// ),
// totals as (
// select admin0_name
// , sum(ha) as total
// from base
// group by 1
// ),
// withPercent as (
// select ha / total * 100 as percentage
// , *
// from base
// left join totals
// on totals.admin0_name = base.admin0_name
// )

// select admin0_name
// , year
// , "group"
// , ha
// , percentage
// from withPercent
// `)
Insert cell
// collection of data for selected country
// fst_plotData = {
// const _iAdmin0 = fst_selections.admin0.admin0_name;
// return {
// population: fst_data_pop.filter(d => d.admin0_name == _iAdmin0),
// poverty: fst_data_pov.filter(d => d.admin0_name == _iAdmin0),
// gdp: fst_data_gdp.filter(d => d.admin0_name == _iAdmin0),
// land: fst_data_land.filter(d => d.admin0_name == _iAdmin0),
// }
// }
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
// plc_plotData = {
// // const table = dataTable.projectionLineChart.name;
// const _admin0 = plc_selections.admin0.admin0_name
// const _iso3 = plc_selections.admin0.iso3;
// const _gaul0 = iso3ToGaul0[_iso3]
// const _gaul0_name = iso3ToGaul0Name[_iso3]
// const _admin1 = plc_selections.admin1.admin1_name;
// const _season = plc_selections.season.season;

// const query = await db2.query(`
// with base as (
// select *
// from ${await ts_data_url(ssp_tf_select.timeframe)}
// )
// select *
// from base
// where 1=1
// and scenario != 'historical'
// ${sqlWhereNull({field: "admin0_name", value: cleanAdminInput_SQL(_gaul0_name) })}
// ${sqlWhereNull({field: "admin1_name", value: cleanAdminInput_SQL(_admin1) })}
// ${sqlWhereNull({field: "season", value: _season})}
// order by year
// `);

// if (!_admin1 && disputed_area_weights.map((d) => d.claimant_gaul0).includes(_gaul0)) {
// return calculateWeightedClimateData(query, disputed_area_weights)
// }

// return query;
// }
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
// viewof ssp_tf_select = Inputs.form({
// scenario: Inputs.checkbox(plc_qScenarios, {
// label: _lang(
// nbText.sections.futureClimateProjections.inputs.checkboxScenario.label
// ),
// format: (x) => x.toUpperCase(),
// value: plc_qScenarios.filter((d) => ["ssp245", "ssp585"].includes(d))
// }),
// timeframe: Inputs.select(['2021-2040', '2041-2060', '2061-2080', '2081-2100'], {label: "Timeframe"})
// },
// {
// template: (inputs) => htl.html`<div style="display: flex; gap: 3em">
// ${Object.values(inputs)}
// </div>`
// }
// )
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
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

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