From 80a9d87ca0b0b35d34d548c4bff6a4fa752af742 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Thu, 24 Sep 2020 22:59:17 +0200 Subject: [PATCH] Improve robustness nx is 0 if the script is run on a triplet of shapefiles for interpolated eddies. --- Analysis/distribution_function.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Analysis/distribution_function.py b/Analysis/distribution_function.py index 9cbbcc09..00eb7a1d 100755 --- a/Analysis/distribution_function.py +++ b/Analysis/distribution_function.py @@ -10,10 +10,13 @@ def plot_distr_funct(x, label = None, ax = None): x.sort() nx = np.size(x) - if ax is None: ax = plt.gca() - ax.plot(x, (1 + np.arange(nx)) / nx, label = label) - print("minimum value:", x[0]) - print("maximum value:", x[-1]) + + if nx != 0: + if ax is None: ax = plt.gca() + ax.plot(x, (1 + np.arange(nx)) / nx, label = label) + print("minimum value:", x[0]) + print("maximum value:", x[-1]) + print("number of values:", nx, "\n") def read(): -- GitLab