diff --git a/post-process/PythonScripts/diag_growthrate b/post-process/PythonScripts/diag_growthrate index 61698e48c..fe323e365 100755 --- a/post-process/PythonScripts/diag_growthrate +++ b/post-process/PythonScripts/diag_growthrate @@ -51,18 +51,28 @@ if __name__ == '__main__': help='end time index') args = parser.parse_args() - data_structure_name = 'data_structure_XVx.yaml' - multid = False + data_structure_name = '' + geo = '' + if 'XVx' in str(args.data_dir): + data_structure_name = 'data_structure_XVx.yaml' + geo = 'XVx' - if 'XYVxVy' in str(args.data_dir): + elif 'XYVxVy' in str(args.data_dir): data_structure_name='data_structure_XYVxVy.yaml' - multid = True + geo= 'XYVxVy' + + else: + raise NotImplementedError(f"Geometry {args.data_dir} is not handled") # Load data ds = DiskStore(args.data_dir,data_structure=Path(data_structure_name)) - if not multid: + # Separate treatement depending on number of dimensions + if geo=='XVx': epot = ds['electrostatic_potential'] - epot = epot.isel(x=int(epot.sizes["x"] / 2)) + epot = epot.integrate('x') + if geo=='XYVxVy': + two_dim_epot = ds['electrostatic_potential'] + epot = two_dim_epot.integrate('x').integrate('y') epot = epot.isel(time=slice(args.start, args.end)) diff --git a/tests/check_growthrate_freq_2d_cart.py b/tests/check_growthrate_freq_2d_cart.py index 11f007f81..77efbeb4e 100644 --- a/tests/check_growthrate_freq_2d_cart.py +++ b/tests/check_growthrate_freq_2d_cart.py @@ -40,7 +40,7 @@ # Compute and plot the growth (or damping) rate (fitted_values, fit,growthrate_computed, valid_growthrate) = Ediag.compute_growthrate(mean_pot,args.growthrate) growthrate_outfile = Path(f'growthrate_t{epot.coords["time"].values[0]}'f'to{epot.coords["time"].values[-1]}.png') - Ediag.plot_growthrate(growthrate_outfile,mean_pot, fitted_values, fit, + Ediag.plot_growthrate(growthrate_outfile,abs(mean_pot), fitted_values, fit, growthrate_computed, args.growthrate) # Compute and plot the frequency