mitgcm
Analysis of MITgcm output using python
Functions
mitgcm.visualisation Namespace Reference

Visualisation functions. More...

Functions

def LIC2_sparse
 Line integral convolution with a sparse noise field. More...
 
def LIC2_sparse_animate
 Line integral convolution with a sparse noise field. More...
 
def create_cmap_vary_alpha
 Create a colour map with variable alpha. More...
 

Detailed Description

Visualisation functions.

Each function has a detailed docstring.

Function Documentation

def mitgcm.visualisation.create_cmap_vary_alpha (   colour = 'white')

Create a colour map with variable alpha.

This can be used to sketch out particles as they move.

The only input variable 'coour' defines the colour that is used to create the colour map. It can be any colour code that matplotlib recognises: single letter codes, hex colour string, a standard colour name, or a string representation of a float (e.g. '0.4') for gray on a 0-1 scale.

Definition at line 285 of file visualisation.py.

def mitgcm.visualisation.LIC2_sparse (   u,
  v,
  points,
  grid_object,
  trace_length,
  kernel = 'anisotropic_linear',
  delta_t = 3600. 
)

Line integral convolution with a sparse noise field.

This produces discrete points that flow around the visualisation.

LIC is a method for visualising flow fields.


Parameters

  • kernel - the convolution kernel. Options are:
    • 'box'
    • 'anisotropic_linear'

Example call

1 output = LIC2_sparse(m.zonal_velocity['UVEL'][3,:,:],m.meridional_velocity['VVEL'][3,:,:],
2  5000,m.grid,15*86400,kernel='anisotropic_linear',delta_t=10*3600)
3 
4 white_var_alpha = mitgcm.visualisation.create_cmap_vary_alpha(colour='k')

Then plot with

1 plt.pcolormesh(m.grid['X'][:],m.grid['Yp1'][:],m.meridional_velocity['VVEL'][level,:,:],cmap='winter',vmin=-1,vmax=1)
2 plt.colorbar()
3 for i in xrange(output.shape[1]):
4  plt.scatter(output[0,i,:],output[1,i,:],
5  c=output[2,i,:],cmap=white_var_alpha,lw=0,vmin=0,vmax=1,s=4)

Definition at line 20 of file visualisation.py.

def mitgcm.visualisation.LIC2_sparse_animate (   u,
  v,
  nparticles,
  grid_object,
  animation_length,
  trace_length,
  kernel = 'anisotropic_linear',
  delta_t = 3600. 
)

Line integral convolution with a sparse noise field.

The sparse noise field produces discrete points that travel around with the flow field.

This function produces data that can be used to animate a static flow field.

LIC is a method for visualising flow fields.

returns:

  • output_matrix = [Variables (this axis has three values: x,y,intensity_ramp),trace_number ,time]
  • intensity = vector containing the convolved kernel and noise field

Parameters

  • kernel - the convolution kernel. Options are:
    • 'box' - same intensity for the entire trace
    • 'anisotropic_linear' - intensity ramps up over the trace

Example call

1 output,intensity = LIC2_sparse_animate(m.zonal_velocity['UVEL'][1,:,:],
2  m.meridional_velocity['VVEL'][1,:,:],
3  15,m.grid,
4  300*86400,60*86400,
5  kernel='anisotropic_linear',delta_t=4*3600)
6 white_var_alpha = mitgcm.visualisation.create_cmap_vary_alpha(colour='k')

and then plot with

1 trace_length= len(intensity)
2 
3 for t0 in xrange(output.shape[2]-len(intensity)):
4  for i in xrange(output.shape[0]):
5  plt.scatter(output[i,0,t0:t0+trace_length],output[i,1,t0:t0+trace_length],
6  c = intensity,cmap='winter',lw=0,vmin=0,vmax=1,s=20)
7 
8  filename = '../OLIC animation{:04g}.png'.format(t0)
9  plt.savefig(filename)
10  plt.clf()

Definition at line 120 of file visualisation.py.

Here is the call graph for this function: