1- """
2- Derived module from spodbase.py for classic spod.
3- """
1+ """Derived module from spodbase.py for classic spod."""
42
53# import standard python packages
64import os
97import matplotlib as mpl
108import matplotlib .pyplot as plt
119from matplotlib import animation
12- import matplotlib .gridspec as gridspec
13- from mpl_toolkits .axes_grid1 import make_axes_locatable
1410mpl .rc ('figure' , max_open_warning = 0 )
1511from os .path import splitext
16- import warnings
1712
1813# Current, parent and file paths
1914CWD = os .getcwd ()
@@ -55,7 +50,7 @@ def find_nearest_coords(coords, x, data_space_dim):
5550 coords = np .asarray (coords )
5651 if isinstance (x , list ):
5752 grid = np .array (np .meshgrid (* x ))
58- elif isinstance (x ,np .ndarray ) == data :
53+ elif isinstance (x ,np .ndarray ):
5954 if x .shape == data_space_dim :
6055 grid = x
6156 else :
@@ -108,7 +103,7 @@ def get_mode_from_file(filename):
108103 file at a given frequency.
109104 :rtype: numpy.ndarray
110105 """
111- basename , ext = splitext (filename )
106+ _ , ext = splitext (filename )
112107 if ext .lower () == '.npy' :
113108 m = np .load (filename )
114109 elif ext .lower () == '.mat' :
@@ -670,7 +665,6 @@ def plot_2D_mode_slice_vs_time(modes, freq_required, freq, vars_idx=[0],
670665 # axis management
671666 ax .set_xlim (np .nanmin (t )* 1.05 ,np .nanmax (t )* 1.05 )
672667 ax .set_ylim (np .nanmin (x2 )* 1.05 ,np .nanmax (x2 )* 1.05 )
673- xlim = ax .get_xlim ()
674668 ax_divider = make_axes_locatable (ax )
675669 cax = ax_divider .append_axes ("bottom" , size = "5%" , pad = 0.65 )
676670 plt .colorbar (ax_obj , cax = cax , orientation = "horizontal" )
@@ -1243,7 +1237,8 @@ def plot_data_tracers(X, coords_list, x=None, time_limits=[0,10],
12431237
12441238def generate_2D_data_video (X , time_limits = [0 ,10 ], vars_idx = None , sampling = 1 ,
12451239 x1 = None , x2 = None , coastlines = '' , figsize = (12 ,8 ), path = 'CWD' , filename = 'data_video.mp4' ):
1246- """Make movie of 2D data.
1240+ """
1241+ Make movie of 2D data.
12471242
12481243 :param numpy.ndarray X: 2D data to be plotted. \
12491244 First dimension must be time. Last dimension must be variable.
@@ -1283,10 +1278,6 @@ def generate_2D_data_video(X, time_limits=[0,10], vars_idx=None, sampling=1,
12831278 # filename
12841279 basename , ext = splitext (filename )
12851280
1286- # figure dimensions
1287- axes_ratio = (np .nanmax (x2 ) - np .nanmin (x2 )) \
1288- / (np .nanmax (x1 ) - np .nanmin (x1 ))
1289-
12901281 # check dimension axes and data
12911282 if x1 .shape [0 ] != X [0 ,:,:].shape [0 ] or \
12921283 x2 .shape [0 ] != X [0 ,:,:].shape [1 ]:
@@ -1304,8 +1295,8 @@ def generate_2D_data_video(X, time_limits=[0,10], vars_idx=None, sampling=1,
13041295 cst = True
13051296
13061297 # Generate movie
1307- vmin = np .nanmin (X )
1308- vmax = np .nanmax (X )
1298+ # vmin = np.nanmin(X)
1299+ # vmax = np.nanmax(X)
13091300 vmean = np .nanmean (X )
13101301 for i in vars_idx :
13111302 fig = plt .figure ()
0 commit comments