Public
Edited
Jun 19, 2022
1 fork
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
base = [
{"l":"rt","p":""},
{"l":"Socio-cultural","p":"rt"},
{"l":"Environmental","p":"rt"},
{"l":"Economic","p":"rt"},
{"l":"Political","p":"rt"},
{"l":"Co-creation of knowledge","p":"Socio-cultural","v":1},
{"l":"Social values","p":"Socio-cultural","v":1},
{"l":"Diets","p":"Socio-cultural","v":1},
{"l":"Recycling","p":"Environmental","v":1},
{"l":"Input reduction","p":"Environmental","v":1},
{"l":"Soil health","p":"Environmental","v":1},
{"l":"Animal health","p":"Environmental","v":1},
{"l":"Biodiversity","p":"Environmental","v":1},
{"l":"Synergy","p":"Environmental","v":1},
{"l":"Economic diversification","p":"Economic","v":1},
{"l":"Fairness","p":"Economic","v":1},
{"l":"Connectivity","p":"Economic","v":1},
{"l":"Land and resource governance","p":"Political","v":1},
{"l":"Participation","p":"Political","v":1},
{"l":"Decentralisation","p":"Political","v":1}
]
Insert cell
Insert cell
meta = [
{"l":"Socio-cultural","m":[""]},
{"l":"Environmental","m":[""]},
{"l":"Political","m":[""]},
{"l":"Economic","m":[""]},
{"l":"Co-creation of knowledge",
"m":["High: Emphasizes support to local innovation and farmer-to-farmer knowledge exchange",
"Mid-high: Emphasizes co-learning and the combination of local and global scientific knowledge",
"Mid-low: Emphasizes widespread dissemination of innovations from participatory research",
"Low: Emphasizes widespread dissemination of innovation from state and privately-funded formal research"]},
{"l":"Social values",
"m":["High: Emphasis on labour intensification, fairness and dignity of work for all",
"Mid-high: Emphasis on labour productivity while retaining smallholder farming",
"Mid-low: Neutral on intensification dimensions",
"Low: Emphasis on capital intensification"]},
{"l":"Diets",
"m":["High:",
"Mid-high:",
"Mid-low:",
"Low:"]},
{"l":"Recycling",
"m":["High: Eliminate external inputs, rely on only natural processes and have closed resource cycles",
"Mid-high: Minimize purchased inputs, favour natural processes and try to close resource cycles",
"Mid-low: Deliberately use purchased inputs to make efficient use of natural processes and resource cycles",
"Low: Use purchased inputs to intensify production per unit land while keeping leakage to a minimum"]},
{"l":"Input reduction",
"m":["High:",
"Mid-high:",
"Mid-low:",
"Low:"]},
{"l":"Soil health",
"m":["High:",
"Mid-high:",
"Mid-low:",
"Low:"]},
{"l":"Animal health",
"m":["High:",
"Mid-high:",
"Mid-low:",
"Low:"]},
{"l":"Biodiversity",
"m":["High: Deliberate management of biological diversity and interactions among components within production systems to enhance complementarity and achieve synergy, including between production and conservation objectives across field, farm and landscape scales (land sharing)",
"Mid-high: Manage interactions among selected components within production systems without trying to maintain diversity beyond that necessary for production",
"Mid-low: Neutral with respect to integrating or segregating components within production systems",
"Low: Intensify production on higher potential land thereby leaving other land for meeting conservation objectives (land sparing)"]},
{"l":"Synergy",
"m":["High:",
"Mid-high:",
"Mid-low:",
"Low:"]},
{"l":"Economic diversification",
"m":["High: Strive for greater economic diversity of production systems",
"Mid-high: Manage economic diversity of production systems around functional thresholds to maintain ecosystem services and economic resilience",
"Mid-low: Neutral with respect to diversification or specialization",
"Low: Specialize in a few components within production systems to simplify management and supply market requirements"]},
{"l":"Fairness",
"m":["High:",
"Mid-high:",
"Mid-low:",
"Low:"]},
{"l":"Connectivity",
"m":["High: Emphasis on local markets, connectivity of producers and consumers, circular economy",
"Mid-high: Blended market approach combining access to national markets where appropriate with stimulating function of local markets",
"Mid-low: Neutral with respect to marketing or value chain structure",
"Low: Emphasis on efficiency of large markets and global value chains"]},
{"l":"Land and resource governance",
"m":["High: Starts by asserting basic rights and works on from that to how food systems should be transformed; strives for greater agency – i.e. participation of civil society in decision-making about how food is produced, processed, stored, transported and consumed",
"Mid-high: Acknowledges that rights, including rights to accurate information, are an important part of food system transformation and includes consideration of them",
"Mid-low: Neutral regarding rights",
"Low: Does not explicitly recognize rights as fundamental to food security and nutrition; participation is shaped through market forces"]},

{"l":"Participation",
"m":["High:",
"Mid-high:",
"Mid-low:",
"Low:"]},

{"l":"Decentralisation",
"m":["High:",
"Mid-high:",
"Mid-low:",
"Low:"]}
]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//return nth node at depth d from flattened hdata
function picknode(hdata, d, n){
let c=0;
let i=0;
while(true){
if(i>=hdata.length){
return null;
}
if (hdata[i].depth==d){
if(c==n){
return hdata[i];
}else{
c++;
}
}
i++;
}
return hdata[i];
}
Insert cell
Insert cell
function addcolors(hdata, colorfunc){
let c = 0;
let i = 0;
while (true){
if (i>=hdata.length || hdata[i].depth>1){
break;
}
if (hdata[i].depth==1){
if (hdata[i].id=="empty"){
hdata[i].color = "white";
for (let j=0;j<hdata[i].children.length;j++){
hdata[i].children[j].color = "white";
}
}else{
hdata[i].color = colorfunc(i);
for (let j=0;j<hdata[i].children.length;j++){
hdata[i].children[j].color = colorfunc(c);
}
}
c++;
}
i++;
}
}
Insert cell
Insert cell
Insert cell
// Inflate raw data
function inflate_rdata(rdata, n){
//add n nodes at depth 2 to raw data
const empty = [emptycats("empty","rt",0)].concat(d3.range(n).map(d=>emptycats(""+d, "empty",1)));
//data.concat(empty);
return rdata.concat(empty);
}
Insert cell
// Deflate hierarchical data
// Kill n d2 nodes; if dimensions increased, restratify data and inflate if necessary
function deflate_hdata(hdata, n){
//** Restrict for now to depth 2 nodes **
// determine number of nodes at depth 2 in hdata
const c = countdnodes(hdata, 2);
//depth 2 nodes to cut
const cut = Math.min(n, c);
for (let i=0; i<cut; i++){
killdnode(hdata, 2);
}
// strip out depth 1 nodes with no children
let p = hdata.find(d=>d.depth==1 && d.children.length==0);
while (p != undefined){
pop0( p.parent.children );
p = hdata.find(d=>d.depth==1 && d.children.length==0);
}
return hdata;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function polygon(p, r){
//first construct the hex point set
const polypoints = Array.from(
{length:p+1}, (_,i)=>[(2*Math.PI/p)*(-i), r]
)
return d3.lineRadial()(polypoints)
}

Insert cell
//employ global vars: step, attr
function scoreline(a, wrap){
var wrap = (typeof wrap !== 'undefined') ? wrap : false;
//recv array of scores, a
const p = scoreplot(a);
if(wrap){
p.push(p[0])
}
//return p;
return d3.lineRadial()(p)
}
Insert cell
function scoreplot(a){
// offset
const offset = 2*Math.PI/a.length;
return Array.from(
{length:a.length}, (_,i)=>[(2*Math.PI/a.length)*(i)+offset, step*a[i]]
)
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//offset = 2*Math.PI/(2*dims)
Insert cell
Insert cell
width
Insert cell
require("d3")
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