Public
Edited
Jan 16, 2024
1 star
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
station_data = fetch("https://data.rcc-acis.org/StnMeta?state=MN,WI,ND&output=json&sdate=2023-01-01&edate=por").then((response) => response.json()).then((data => data.meta)).then(data => data.sort((a, b) => {
let nameA = a.name.toUpperCase(); // convert name to uppercase for consistent comparison
let nameB = b.name.toUpperCase(); // convert name to uppercase for consistent comparison
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}

// names must be equal
return 0;
}));


Insert cell
elements_data_explorer = [
["Maximum temperature (°F)", "maxt"],
["Minimum temperature (°F)", "mint"],
["Average temperature (°F)", "avgt"],
["Precipitation (inches)", "pcpn"],
["Snowfall (inches)","snow"],
["Snow depth (inches)", "snwd"],
["Total snowfall (inches)", "total_snow"]
]
Insert cell
Insert cell
single_station_params = ({
sid: selected_station[0].sids[0],
sdate: (start_date === null) ? "por" : start_date.toISOString().split('T')[0],
edate: (end_date === null) ? "por" : end_date.toISOString().split('T')[0],
elems: elems,
meta: "name,uid,ll,elev,valid_daterange,sids",
output: "json"
})

Insert cell
Insert cell
Insert cell
data = fetch(
`https://data.rcc-acis.org/StnData?params=${JSON.stringify(
single_station_params
)}`
) .then((response) => response.json())
.then(data => data.data.map(item => {
let record = { date: item[0] };
selected_measurement.forEach((measurement, index) => {
record[measurement] = item[index + 1];
});
return record;
}));

// data = fetch(
// `https://data.rcc-acis.org/StnData?params=${JSON.stringify(
// single_station_params
// )}`
// ).then((response) => response.json())
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