Closed jcfbeardsley closed 4 years ago
Thanks for the issue. Is there any way to get access to the dataset so I can reproduce it?
Thanks for the issue. Is there any way to get access to the dataset so I can reproduce it?
Sure thing, the original data is available at https://github.com/jcfbeardsley/tastemp/blob/datashader/temp.nc (or you can just pull the entire https://github.com/jcfbeardsley/tastemp/tree/datashader repo). For context, the dataset represents ocean temperature at the surface, so the grid cell centres are expected to be overlaying the ocean neatly around the coastline.
Here's what I get when I plot it with hvPlot:
This differs from your output a fair bit but I'm not sure it's any more correct. I'll keep looking from here.
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.
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 acanvas.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.