Skip to content

Warnings when plotting from a single file in directory

When a single state_phys file is the only file in a directory, it can be loaded with load_sim_for_plot, but the output.phys_fields.plot function displays a lot of warnings when called:

In [1]: from fluidsim import load_sim_for_plot

In [2]: sim = load_sim_for_plot()
load params from file
/.fsnet/project/watu/2019/19INTSIM/sim_data/waves_coriolis/test/state_phys_t0015800.015.nc
Loading params from file
/.fsnet/project/watu/2019/19INTSIM/sim_data/waves_coriolis/test/state_phys_t0015800.015.nc


*************************************
Program fluidsim
sim:                <class 'fluidsim.solvers.ns3d.strat.solver.Simul'>
sim.oper:           <class 'fluidsim.operators.operators3d.OperatorsPseudoSpectral3D'>
sim.output:         <class 'fluidsim.solvers.ns3d.strat.output.Output'>
sim.state:          <class 'fluidsim.solvers.ns3d.strat.state.StateNS3DStrat'>
sim.time_stepping:  <class 'fluidsim.solvers.ns3d.time_stepping.TimeSteppingPseudoSpectralNS3D'>
sim.init_fields:    <class 'fluidsim.solvers.ns3d.init_fields.InitFieldsNS3D'>
sim.forcing:        <class 'fluidsim.solvers.ns3d.forcing.ForcingNS3D'>

solver ns3d.strat, RK4 and sequential,
type fft: fluidfft.fft3d.with_pyfftw
nx =      4 ; ny =      4 ; nz =      4
Lx = 12 ; Ly = 12 ; Lz = 2
path_run =
/.fsnet/project/watu/2019/19INTSIM/sim_data/waves_coriolis/test
init_fields.type: constant

Initialization outputs:
sim.output.phys_fields:       <class 'fluidsim.base.output.phys_fields3d.PhysFieldsBase3D'>
sim.output.spatial_means:     <class 'fluidsim.solvers.ns3d.strat.output.spatial_means.SpatialMeansNS3DStrat'>
sim.output.spectra:           <class 'fluidsim.solvers.ns3d.strat.output.spectra.SpectraNS3DStrat'>
sim.output.spect_energy_budg: <class 'fluidsim.solvers.ns3d.strat.output.spect_energy_budget.SpectralEnergyBudgetNS3DStrat'>

Memory usage at the end of init. (equiv. seq.): 160.23046875 Mo
Size of state_spect (equiv. seq.): 0.003072 Mo

In [3]: sim.output.phys_fields.plot('vz',equation='z=1.5')
/.fsnet/data/legi/calcul9/home/reneuve3ja/Dev/fluidsim/fluidsim/base/output/phys_fields.py:365: RuntimeWarning: divide by zero encountered in double_scalars
  weight0 = 1 - np.abs(time - self.times[idx0]) / dt_save
/.fsnet/data/legi/calcul9/home/reneuve3ja/Dev/fluidsim/fluidsim/base/output/phys_fields.py:366: RuntimeWarning: divide by zero encountered in double_scalars
  weight1 = 1 - np.abs(time - self.times[idx1]) / dt_save
/.fsnet/data/legi/calcul9/home/reneuve3ja/Dev/fluidsim/fluidsim/base/output/phys_fields3d.py:486: RuntimeWarning: invalid value encountered in true_divide
  vecx_c / vmax,
/.fsnet/data/legi/calcul9/home/reneuve3ja/Dev/fluidsim/fluidsim/base/output/phys_fields3d.py:487: RuntimeWarning: invalid value encountered in true_divide
  vecy_c / vmax,
/home/users/reneuve3ja/miniconda3/lib/python3.8/site-packages/matplotlib/quiver.py:678: RuntimeWarning: Mean of empty slice.
  amean = a[~self.Umask].mean()
/home/users/reneuve3ja/miniconda3/lib/python3.8/site-packages/numpy/core/_methods.py:161: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
/home/users/reneuve3ja/miniconda3/lib/python3.8/site-packages/matplotlib/quiver.py:748: RuntimeWarning: invalid value encountered in less
  short = np.repeat(length < minsh, 8, axis=1)
/home/users/reneuve3ja/miniconda3/lib/python3.8/site-packages/matplotlib/quiver.py:762: RuntimeWarning: invalid value encountered in less
  tooshort = length < self.minlength

Here the physical field vz is plotted correctly as a contourf, but the quiver of the velocity field is not superimposed over it. Similarly, all velocity components can be plotted as contourf, but the quiver never works.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information