From 12012c694a73731606451286b0c50543b963f46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Mon, 12 Jun 2023 17:10:13 +0200 Subject: [PATCH] plot: minor fixes for latlon --- src/gstools/covmodel/plot.py | 16 ++++++++-------- src/gstools/field/plot.py | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gstools/covmodel/plot.py b/src/gstools/covmodel/plot.py index fa526612..168dc1b4 100644 --- a/src/gstools/covmodel/plot.py +++ b/src/gstools/covmodel/plot.py @@ -52,12 +52,12 @@ # plotting routines ####################################################### -def _plot_spatial(dim, pos, field, fig, ax, latlon, **kwargs): +def _plot_spatial(dim, pos, field, fig, ax, time, **kwargs): from gstools.field.plot import plot_1d, plot_nd if dim == 1: return plot_1d(pos, field, fig, ax, **kwargs) - return plot_nd(pos, field, "structured", fig, ax, latlon, **kwargs) + return plot_nd(pos, field, "structured", fig, ax, time=time, **kwargs) def plot_vario_spatial( @@ -70,7 +70,7 @@ def plot_vario_spatial( pos = [x_s] * model.dim shp = tuple(len(p) for p in pos) fld = model.vario_spatial(generate_grid(pos)).reshape(shp) - return _plot_spatial(model.dim, pos, fld, fig, ax, model.latlon, **kwargs) + return _plot_spatial(model.dim, pos, fld, fig, ax, model.time, **kwargs) def plot_cov_spatial( @@ -83,7 +83,7 @@ def plot_cov_spatial( pos = [x_s] * model.dim shp = tuple(len(p) for p in pos) fld = model.cov_spatial(generate_grid(pos)).reshape(shp) - return _plot_spatial(model.dim, pos, fld, fig, ax, model.latlon, **kwargs) + return _plot_spatial(model.dim, pos, fld, fig, ax, model.time, **kwargs) def plot_cor_spatial( @@ -96,7 +96,7 @@ def plot_cor_spatial( pos = [x_s] * model.dim shp = tuple(len(p) for p in pos) fld = model.cor_spatial(generate_grid(pos)).reshape(shp) - return _plot_spatial(model.dim, pos, fld, fig, ax, model.latlon, **kwargs) + return _plot_spatial(model.dim, pos, fld, fig, ax, model.time, **kwargs) def plot_variogram( @@ -150,7 +150,7 @@ def plot_vario_yadrenko( """Plot Yadrenko variogram of a given CovModel.""" fig, ax = get_fig_ax(fig, ax) if x_max is None: - x_max = 3 * model.len_scale + x_max = min(3 * model.len_scale, model.geo_scale * np.pi) x_s = np.linspace(x_min, x_max) kwargs.setdefault("label", f"{model.name} Yadrenko variogram") ax.plot(x_s, model.vario_yadrenko(x_s), **kwargs) @@ -165,7 +165,7 @@ def plot_cov_yadrenko( """Plot Yadrenko covariance of a given CovModel.""" fig, ax = get_fig_ax(fig, ax) if x_max is None: - x_max = 3 * model.len_scale + x_max = min(3 * model.len_scale, model.geo_scale * np.pi) x_s = np.linspace(x_min, x_max) kwargs.setdefault("label", f"{model.name} Yadrenko covariance") ax.plot(x_s, model.cov_yadrenko(x_s), **kwargs) @@ -180,7 +180,7 @@ def plot_cor_yadrenko( """Plot Yadrenko correlation function of a given CovModel.""" fig, ax = get_fig_ax(fig, ax) if x_max is None: - x_max = 3 * model.len_scale + x_max = min(3 * model.len_scale, model.geo_scale * np.pi) x_s = np.linspace(x_min, x_max) kwargs.setdefault("label", f"{model.name} Yadrenko correlation") ax.plot(x_s, model.cor_yadrenko(x_s), **kwargs) diff --git a/src/gstools/field/plot.py b/src/gstools/field/plot.py index f6242535..38d744ff 100644 --- a/src/gstools/field/plot.py +++ b/src/gstools/field/plot.py @@ -349,9 +349,9 @@ def _ax_names(dim, latlon=False, time=False, ax_names=None): return ax_names[:dim] if dim == 2 + t_fac and latlon: return ["lon", "lat"] + t_fac * ["time"] - if dim <= 3: + if dim - t_fac <= 3: return ( - ["$x$", "$y$", "$z$"][:dim] + ["$x$", "$y$", "$z$"][: dim - t_fac] + t_fac * ["time"] + (dim == 1) * ["field"] )