ogstools.meshplotlib.levels module#
Utilities to create nicely spaced levels.
- ogstools.meshplotlib.levels.nice_num(val)[source]#
Return the closest number of the form 10**x * {1,2,4,5}.
Fractions containing only these number are ensured to have terminating decimal representations.
- Parameters:
val (float) –
- Return type:
float
- ogstools.meshplotlib.levels.nice_range(lower, upper, n_ticks)[source]#
Return an array in the interval (lower, upper) with terminating decimals.
The length of the arrays will be close to n_ticks.
- Parameters:
lower (float) –
upper (float) –
n_ticks (float) –
- Return type:
ndarray
- ogstools.meshplotlib.levels.adaptive_rounding(vals, precision)[source]#
Return the given values rounded to significant digits.
The significant digits are based of the median decimal exponent and the given precision.
- Parameters:
vals (ndarray) –
precision (int) –
- Return type:
ndarray
- ogstools.meshplotlib.levels.compute_levels(lower, upper, n_ticks)[source]#
Return an array in the interval [lower, upper] with terminating decimals.
The length of the arrays will be close to n_ticks. At the boundaries the tickspacing may differ from the remaining array.
- Parameters:
lower (float) –
upper (float) –
n_ticks (int) –
- Return type:
ndarray