Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 27, 2023
1 parent dcc137d commit 356d245
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions xpublish_wms/wms/get_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import cachey
import cartopy.crs as ccrs
import cf_xarray # noqa
import datashader as dsh
import datashader.transfer_functions as tf
import datashader.utils as dshu
import matplotlib.cm as cm
import numpy as np
import pandas as pd
Expand All @@ -16,11 +19,6 @@
from rasterio.transform import from_bounds
from scipy.spatial import Delaunay

import pandas as pd
import datashader as dsh
import datashader.transfer_functions as tf
import datashader.utils as dshu

from xpublish_wms.grid import GridType
from xpublish_wms.utils import to_lnglat, to_mercator

Expand Down Expand Up @@ -377,16 +375,18 @@ def render_sgrid(
}
x_sel, y_sel = to_mercator.transform(x_sel, y_sel)

verts = pd.DataFrame(np.stack((x_sel, y_sel, data_sel)).T, columns=['x', 'y', 'z'])
triang = Delaunay(verts[['x','y']].values)
tris = pd.DataFrame(triang.simplices, columns=['v0', 'v1', 'v2'])
mesh = dshu.mesh(verts,tris)
verts = pd.DataFrame(
np.stack((x_sel, y_sel, data_sel)).T, columns=["x", "y", "z"],
)
triang = Delaunay(verts[["x", "y"]].values)
tris = pd.DataFrame(triang.simplices, columns=["v0", "v1", "v2"])
mesh = dshu.mesh(verts, tris)

cvs = dsh.Canvas(
plot_height=self.height,
plot_width=self.width,
x_range=(self.bbox[0], self.bbox[2]),
y_range=(self.bbox[1], self.bbox[3])
y_range=(self.bbox[1], self.bbox[3]),
)

if not self.autoscale:
Expand All @@ -395,10 +395,10 @@ def render_sgrid(
vmin, vmax = [None, None]

im = tf.shade(
cvs.trimesh(verts, tris, mesh=mesh, interp=True),
cvs.trimesh(verts, tris, mesh=mesh, interp=True),
cmap=cm.get_cmap(self.palettename),
how='linear',
span=(vmin,vmax),
how="linear",
span=(vmin, vmax),
).to_pil()
im.save(buffer, format="PNG")

Expand Down

0 comments on commit 356d245

Please sign in to comment.