Published
Edited
Apr 17, 2018
Insert cell
Insert cell
intervals = [0, 5, 10, 15, 20, 25, 30, 40, 200, 240, 260]
Insert cell
colors = ["ForestGreen", "DarkGreen", "Green", "LimeGreen", "Chartreuse", "GreenYellow", "Gold", "Tomato", "Orchid", "Navy", "LightSkyBlue"]
Insert cell
plot = {
const svg = d3.select(DOM.svg(width, height))
.style("width", "100%")
.style("height", "auto");
const countries = topojson.feature(topojsonData, topojsonData.objects.countries);
const basemapGroup = svg.append("g").attr("class", "base");
const bandsGroup = svg.append("g").attr("class", "bands");
const scaleGroup = svg.append("g").attr("class", "scale");
const bandsTemp = rastertools.isobands(tempData, geoTransform, intervals);
const colorScale = d3.scaleThreshold()
.domain(intervals)
.range(colors);
//return bandsTemp;
return ready(svg, countries, basemapGroup, bandsTemp, path, colorScale, intervals).node()
}

Insert cell
Insert cell

ready = function(svg, countries, basemapGroup, bandsTemp, path, colorScale, intervalsTemp){
basemapGroup.insert("path", ".map")
.datum(countries)
.attr("d", path)
.style("opacity", "0.4")
.style("fill", "#eee")
.style("stroke", "#999")
.style("stroke-width", "1px")
const states =
bandsTemp.features.forEach(function(d, i) {
svg.insert("path", ".streamline")
.datum(d)
.attr("d", path)
.style("fill", colorScale(intervalsTemp[i]))
.style("stroke", "None");
});

return svg
}
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell


Insert cell
path = d3.geoPath().projection(projection)
Insert cell
projection = d3.geoAzimuthalEqualArea()
.rotate([80, -40, 15])
.scale(800)
Insert cell
Insert cell
Insert cell
tiffData = d3.buffer("https://sample-data-anihpywxjw.now.sh/MRMS_MergedReflectivityQCComposite.latest.low.res.tif")
Insert cell
//https://otro-cpnooxboun.now.sh/
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rastertools = require("raster-marching-squares")
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