Public
Edited
Jul 24, 2023
1 fork
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
size = width/2-4
Insert cell
Insert cell
Insert cell
all_data = {
const url = `https://prototipi.iit.cnr.it/drought_bulletin_api/spi/measures?year_range=${year1},${year2+1}&time_scale=${scale}&reverse_chronology=true`;
const headers = { 'Accept': 'application/x-msgpack' };
const measures = [];
const response = await fetch(url, { headers });
for await (const item of msgpack.decodeMultiStream(response.body)) {
measures.push(item);
}
return measures;
}
Insert cell
data1 = all_data.filter(d => d.year == year1 || d.year == year1+1 && d.month == 1)
Insert cell
data2 = all_data.filter(d => d.year == year2 || d.year == year2+1 && d.month == 1)
Insert cell
msgpack = require('@msgpack/msgpack')
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