Comments (11)
Have you tried https://github.com/Fil/d3-tricontour instead?
from d3-contour.
I have tried it and it works quite well - I just read that marching squares is more efficient and the contouring is slightly better. Also, I'm porting some logic from matplotlib, which uses the marching squares contouring algorithm and does support curvilinear grids.
Comparing d3-tricontour
with d3-contour
I can see that creating contours with 100 steps takes 450 ms using tricontours vs 110ms with this library. That's a pretty substantial difference on the performance side.
from d3-contour.
There's no built-in support for curvilinear grids, so I guess it's just a matter of finding an efficient way to compute the projection back to the original coordinates system.
from d3-contour.
Okay thanks. Generally speaking, is it possible to calculate polygons using x/y values that correspond to value positions instead of numeric grid positions? (or in the case of matplotlib is the library just interpolating the result)
from d3-contour.
I've made this notebook with a projection that uses bilinear interpolation on the grid: https://observablehq.com/@recifs/contours-on-a-curvilinear-grid
If you want to share a dataset I'd be happy to try it.
from d3-contour.
My grid looks like this:
You can download data from this endpoint:
curl 'https://somisana.ac.za/graphql' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: https://somisana.ac.za' --data-binary '{"query":"{\n data(timeStep:120 runId:8 depth:0) {\n id,\n json\n }\n}"}' --compressed > data-issue-64.json
The endpoint may disappear/change/etc but if it's helpful you are welcome to use the image and data in an example. The format of the data is:
{
data: {
{
id: "...",
json: [
[lng, lat, temperature],
[lng, lat, temperature],
[lng, lat, temperature],
etc
]
}
}
}
(It's sea-surface temperature as output from a run of the Coastal and Regional Ocean Community model)
from d3-contour.
Thank you very much for the notebook example - I will have a chance to try it out either tomorrow or the week after next.
from d3-contour.
See https://observablehq.com/@recifs/contours-on-a-curvilinear-grid-geo for a geo version using your dataset. Remains to link this to a mapbox view, I guess.
from d3-contour.
Wow - that's really nice!
Currently I'm plotting the geojon directly onto the maplibre view (https://somisana.ac.za/explore/1). I hadn't considered using d3 plots on a mapview before. This plot currently uses the tricontour library. It's actually pretty close in terms of contouring:
The dataset is actually a cumulative effort of a number of different people including research funded by SAEON. Would you mind changing the description to reflect that? I'd like to get feedback from others involved in this before confirming, but would something along these lines be suitable?
============
Sea-surface temperature as output from a run of the Coastal and Regional Ocean Community model, configured by SAEON, for the Algoa Bay region.
Data made available by Zach Smith on behalf of the South African Sustainable Ocean Modelling Initiative; see this notebook for generated data.
============
from d3-contour.
from d3-contour.
I've confirmed with others that the blurb mentioned above is fine. Please can you update the notebook when you get a chance.
Thanks very much for your help.
from d3-contour.
Related Issues (20)
- Release d3-array v2 compatible version? HOT 2
- hole issue in contour HOT 5
- Arrows using elevation value for any point(x, y) in contour chart HOT 5
- GeoJSON Geometry which is generated by d3.contour displays wrong HOT 3
- output data has index which is not exist in input data HOT 2
- Feature request: contour labels HOT 2
- smoothing removes line segements HOT 1
- Buggy input check in density size setter.
- Improve slow computations for large images HOT 2
- Handle Null values in grid HOT 9
- Dependencies HOT 3
- Some contour polygon is reverse. HOT 5
- Support fractional bandwidths. HOT 2
- [feature]: cellSize(0.5) would work well in d3.contourDensity() HOT 1
- Sometimes the lowest threshold is missing
- Bug HOT 2
- Breaking change with contour-density thresholds starting from v3.0.2 HOT 2
- isobands?
- Donβt round the corners HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-contour.