Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions nlmod/plot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
get_extent,
get_extent_gdf,
modelgrid_from_ds,
get_delr,
get_delc,
)
from ..read import geotop, rws
from .dcs import DatasetCrossSection
Expand Down Expand Up @@ -250,15 +252,26 @@ def data_array(da, ds=None, ax=None, rotated=False, edgecolor=None, **kwargs):
ax.axis(extent)
return pc
else:
x = da.x
y = da.y
if ds is None:
x = da.x
y = da.y
shading = "nearest"
else:
x = ds["x"].values
dx = get_delr(ds)
x = np.hstack((x - dx / 2, x[-1] + dx[-1] / 2))

y = ds["y"].values
dy = get_delc(ds)
y = np.hstack((y + dy / 2, y[-1] - dy[-1] / 2))
shading = "flat"
if rotated:
if ds is None:
raise (ValueError("Supply model dataset (ds) for grid information"))
if "angrot" in ds.attrs and ds.attrs["angrot"] != 0.0:
affine = get_affine_mod_to_world(ds)
x, y = affine * np.meshgrid(x, y)
return ax.pcolormesh(x, y, da, shading="nearest", edgecolor=edgecolor, **kwargs)
return ax.pcolormesh(x, y, da, shading=shading, edgecolor=edgecolor, **kwargs)


def geotop_lithok_in_cross_section(
Expand Down