question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Distortions between quadmesh and input points

See original GitHub issue

Hi all,

I’ve noticed when using canvas.quadmesh with an irregularly spaced grid of lat/lons (EPSG: 4326) to generate a Datashader image that there seems to be some distortion of the resulting mesh locations relative to the original input locations. I’ve provided an example script of what I’m referring to, along with the source data (NetCDF), here:

Script: https://github.com/jcfbeardsley/tastemp/blob/datashader/quadmesh.py Output: https://github.com/jcfbeardsley/tastemp/blob/datashader/quadmesh_demo.html

In this example, I’m plotting the original cell centre coordinates on a Mapbox plot using Plotly within Python. I realise I’m using the cell centres to form the bounding coordinates of the image (where in reality this should be the SW, SE, NE and NW cell corners for each location, but this doesn’t explain the discrepancy by approx 3 grid cells in the Y direction. Interestingly, the same distortion occurs if replacing quadmesh with a canvas.points render or a canvas.polygons render using GeoJSON of the original irregular grid cells.

The following shows the output Datashader image (displaced) overlaid with the original cell centres plotted (in the correct location) as scatter dots. The north-south discrepancy is obvious, by approx 2.5 to 3 grid cells:

image

image

To ensure this wasn’t an issue with the Plotly/Mapbox representation of the shading result, I’ve independently georeferenced the resulting datashader image to the same corners with the same result:

image

Can someone explain what’s going on here, and more importantly, how it can be corrected?

Thanks in advance, J.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
philippjfrcommented, Aug 18, 2020

Actually at the k=-0.5 level this seems to work out pretty well:

Screen Shot 2020-08-18 at 9 40 34 PM

Screen Shot 2020-08-18 at 9 46 56 PM

So I don’t think datashader is at fault here, seems like something either in your transforms or in plotly seems to be off.

0reactions
philippjfrcommented, Aug 18, 2020

For reference hvPlot is using GeoViews and Cartopy to do the projection from EPSG: 4326 to EPSG: 3857 under the hood and that’s where I think Plotly/Mapbox is messing things up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Voting for Distortion Points in Geometric Processing - arXiv
Given a closed triangular mesh, we generate candidate distortion points by executing a three-step procedure repeatedly: (1) randomly cut an ...
Read more >
Creating a proper quad-mesh in GMSH for an "I"-shaped ...
So far I've managed to make it quad only, but some elements are very distorted when they shouldn't be. Also, the total number...
Read more >
The input genus two quad-mesh. | Download Scientific Diagram
This work discovers the equivalence relation between quadrilateral meshes and meromorphic quartic differentials. Each quad-mesh induces a conformal ...
Read more >
Quadrangulation of Non-Rigid Objects using Deformation ...
Abstract. We present a novel method to generate quad meshes for non-rigid objects. Our method takes into account the geometry of.
Read more >
How to make the conformal quad mesh throughout the whole ...
I import a 3D geometry file from solidworks into ANSYS Workbench 18.1, ... the shorter part (in green color) has distorted quad element...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found