Distortions between quadmesh and input points
See original GitHub issueHi 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:
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:
Can someone explain what’s going on here, and more importantly, how it can be corrected?
Thanks in advance, J.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Actually at the
k=-0.5
level this seems to work out pretty well:So I don’t think datashader is at fault here, seems like something either in your transforms or in plotly seems to be off.
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.