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.classified.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

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