Support for TO outputs

class magic.TOMovie(file=None, iplot=True, cm='seismic', datadir='.', cut=0.5, levels=33, avg=True, precision=<class 'numpy.float32'>, lastvar=None, nvar='all')[source]

This class allows to read and display the TO_mov.TAG generated when l_TOmovie=.true. is True.

>>> # This will allow you to pick up one TO_mov files among the existing ones
>>> t = TOMovie()
>>> # Read TO_mov.N0m2, time-averaged it and display it with 65 contour levels
>>> t = TOMovie(file='TO_mov.N0m2', avg=True, levels=65, cm='seismic')
__add__(new)[source]

Built-in function to sum two TO movies

Note

So far this function only works for two TO movies with the same grid sizes. At some point, we might introduce grid extrapolation to allow any summation.

__init__(file=None, iplot=True, cm='seismic', datadir='.', cut=0.5, levels=33, avg=True, precision=<class 'numpy.float32'>, lastvar=None, nvar='all')[source]
Parameters
  • file (str) – the filename of the TO_mov file

  • nvar (int) – the number of frames of the movie file we want to plot starting from the last line

  • lastvar (int) – the index of the last timesteps to be read

  • cm (str) – the name of the color map

  • levels (int) – the number of contour levels

  • cut (float) – adjust the contour extrema to max(abs(data))*cut

  • iplot (bool) – a boolean to specify if one wants to plot or not the results

  • avg (bool) – time average of the different forces

  • precision (str) – precision of the input file, np.float32 for single precision, np.float64 for double precision

  • datadir (str) – working directory

plot(cut=0.8, levs=16, avg=True, cmap='RdYlBu_r')[source]

Plotting function

Parameters
  • cut (float) – adjust the contour extrema to max(abs(data))*cut

  • levs (int) – number of contour levels

  • avg (bool) – when set to True, quantities are time-averaged

  • cmap (str) – name of the colormap

class magic.MagicTOHemi(datadir='.', hemi='n', tag=None, precision=<class 'numpy.float32'>, iplot=False)[source]

This class can be used to read and display z-integrated quantities produced by the TO outputs. Those are basically the TO[s|n]hn.TAG files

>>> to = MagicTOHemi(hemi='n', iplot=True) # For the Northern hemisphere
__add__(new)[source]

This is an intrinsic ‘+’ method to stack to TO[n|s]hs.TAG files

Note

So far, this only works if the grid resolution does not change

__init__(datadir='.', hemi='n', tag=None, precision=<class 'numpy.float32'>, iplot=False)[source]
Parameters
  • datadir (str) – current working directory

  • hemi (str) – Northern or Southern hemisphere (‘n’ or ‘s’)

  • tag (str) – file suffix (tag), if not specified the most recent one in the current directory is chosen

  • precision (str) – single or double precision

  • iplot (bool) – display the output plot when set to True (default is True)

plot()[source]

Plotting function