self.keys_fields is altered when plotting kzkhomega spectra
Calling sim.output.spatiotemporal_spectra.plot_kzkhomega()
on a new simulation yields the following error:
In [3]: sim.output.spatiotemporal_spectra.plot_kzkhomega()
Computing spectra...
load times series...
Getting times from rank 0... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
tmin= 0, tmax= 141.633, nit=55
keys: ['vx', 'vy', 'vz', 'b', 'Khd', 'Khr', 'Kp']
Rearranging... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:--
Rank 00000... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:--
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-3-650eecfaad36> in <module>
----> 1 sim.output.spatiotemporal_spectra.plot_kzkhomega()
~/Dev/fluidsim/fluidsim/base/output/spatiotemporal_spectra.py in plot_kzkhomega(self, key_field, tmin, tmax, dtype, equation, xmax, ymax, cmap, vmin, vmax)
829 if not path_file.exists():
830 if self.nb_dim == 3:
--> 831 self.save_spectra_kzkhomega(
832 tmin=tmin, tmax=tmax, dtype=dtype, save_urud=save_urud
833 )
~/Dev/fluidsim/fluidsim/base/output/spatiotemporal_spectra.py in save_spectra_kzkhomega(self, tmin, tmax, dtype, save_urud)
684 # compute spectra
685 print("Computing spectra...")
--> 686 spectra = self.compute_spectra(tmin=tmin, tmax=tmax, dtype=dtype)
687
688 # get kz, kh
~/Dev/fluidsim/fluidsim/base/output/spatiotemporal_spectra.py in compute_spectra(self, tmin, tmax, dtype)
629
630 # load time series as state_spect arrays + times
--> 631 series = self.load_time_series(tmin=tmin, tmax=tmax, dtype=dtype)
632
633 # compute spectra
~/Dev/fluidsim/fluidsim/base/output/spatiotemporal_spectra.py in load_time_series(self, keys, tmin, tmax, dtype)
565 for key in keys:
566 skey = key + "_Fourier"
--> 567 data = file[skey + "_loc"][:, its_file]
568
569 if self.nb_dim == 3:
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
~/miniconda3/lib/python3.8/site-packages/h5py/_hl/group.py in __getitem__(self, name)
286 raise ValueError("Invalid HDF5 object reference")
287 else:
--> 288 oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
289
290 otype = h5i.get_type(oid)
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/h5o.pyx in h5py.h5o.open()
KeyError: "Unable to open object (object 'Khd_Fourier_loc' doesn't exist)"
the problem comes from here, where keys_plot
is not a deep copy of self.keys_fields
: alteration to the former also change the later, breaking load_time_series
.