VAPoR  0.1
Functions
vapor_utils Namespace Reference

Functions

def mag3d (a1, a2, a3)
 
def mag2d (a1, a2)
 
def deriv_findiff2 (a, dir, dx)
 
def deriv_findiff4 (a, dir, dx)
 
def deriv_findiff
 
def deriv_var_findiff2 (a, var, dir)
 
def deriv_var_findiff4 (a, var, dir)
 
def deriv_var_findiff
 
def curl_findiff
 
def div_findiff
 
def grad_findiff
 
def interp3d (A, PR, val)
 
def vector_rotate (angleRad, latDeg, u, v)
 

Detailed Description

The vapor_utils module contains:
mag3d - calculate magnitude of 3-vector
mag2d - calculate magnitude of 2-vector
deriv_findiff - calculate derivative using 6th order finite differences
curl_findiff - calculate curl using 6th order finite differences
div_findiff - calculate divergence using 6 order finite differences
grad_findiff - calculate gradient using 6th order finite differences.
deriv_var_findiff - calculate a derivative of one 3D 
variable with respect to another variable.
interp3d - interpolate a 3D variable to a vertical level surface of another variable.
vector_rotate - rotate and scale vector field for lat-lon grid. 

Function Documentation

def vapor_utils.curl_findiff (   A,
  B,
  C,
  order = 6 
)
Operator that calculates the curl of a vector field 
using 6th order finite differences, on a regular Cartesian grid.
Calling sequence:  curlfield = curl_findiff(A,B,C,order)
Where:
A,B,C are three 3-dimensional float32 arrays that define a
vector field.  
order is the accuracy order (6,4, or 2)
curlfield is a 3-tuple of 3-dimensional float32 arrays that is 
returned by this operator.

Definition at line 449 of file vapor_utils.py.

References deriv_findiff(), and vapor.MapVoxToUser().

def vapor_utils.deriv_findiff (   a,
  dir,
  dx,
  order = 6 
)
Function that calculates first-order derivatives 
using sixth order finite differences in regular Cartesian grids.
Calling sequence: deriv = deriv_findiff(ary,dir,delta, order=6)
ary is a 3-dimensional float32 numpy array
dir is 1, 2, or 3 (for X, Y, or Z directions in user coordinates)
delta is the grid spacing in the direction dir.
order is the accuracy order (one of 6,4,2)
Returned array 'deriv' is the derivative of ary in the 
specified direction dir. 

Definition at line 151 of file vapor_utils.py.

References deriv_findiff2(), and deriv_findiff4().

Referenced by curl_findiff(), div_findiff(), grad_findiff(), vapor_wrf.wrf_curl_findiff(), and vapor_wrf.wrf_deriv_findiff().

def vapor_utils.deriv_findiff2 (   a,
  dir,
  dx 
)
Function that calculates first-order derivatives 
using 2nd order finite differences in regular Cartesian grids.

Definition at line 32 of file vapor_utils.py.

Referenced by deriv_findiff().

def vapor_utils.deriv_findiff4 (   a,
  dir,
  dx 
)
Function that calculates first-order derivatives 
using 4th order finite differences in regular Cartesian grids.

Definition at line 91 of file vapor_utils.py.

Referenced by deriv_findiff().

def vapor_utils.deriv_var_findiff (   a,
  var,
  dir,
  order = 6 
)
Function that calculates first-order derivatives of a     variable 
with respect to another variable 'var' 
using sixth order finite differences in regular Cartesian grids.
The variable var should be increasing or decreasing in the
specified coordinate. 
Calling sequence: aprime = deriv_var_findiff(a,var,dir,order)
a and var are 3-dimensional float32 numpy arrays
dir is 1, 2, or 3 (for X, Y, or Z directions in user coords.
order is the accuracy order, one of (2,4 or 6)
Note that these correspond to Z,Y,X directions in python coords.

Returned array 'aprime' is the derivative of a wrt var. 

Definition at line 359 of file vapor_utils.py.

References deriv_var_findiff2(), and deriv_var_findiff4().

Referenced by vapor_wrf.PV(), vapor_wrf.wrf_curl_findiff(), and vapor_wrf.wrf_deriv_findiff().

def vapor_utils.deriv_var_findiff2 (   a,
  var,
  dir 
)
Function that calculates first-order derivatives 
using 2nd order finite differences in regular Cartesian grids.

Definition at line 237 of file vapor_utils.py.

Referenced by deriv_var_findiff().

def vapor_utils.deriv_var_findiff4 (   a,
  var,
  dir 
)
Function that calculates first-order derivatives of a     variable 
with respect to another variable 'var' 
using 4th order finite differences in regular Cartesian grids.

Definition at line 298 of file vapor_utils.py.

Referenced by deriv_var_findiff().

def vapor_utils.div_findiff (   A,
  B,
  C,
  order = 6 
)
Operator that calculates the divergence of a vector field
using 6th order finite differences.
Calling sequence:  DIV = div_findiff(A,B,C)
Where:
A, B, and C are 3-dimensional float32 arrays defining a vector field.
order is the accuracy order, one of (6,4, or 2)
Resulting DIV is a 3-dimensional float3d array consisting of
the divergence of the triple (A,B,C).

Definition at line 483 of file vapor_utils.py.

References deriv_findiff(), and vapor.MapVoxToUser().

def vapor_utils.grad_findiff (   A,
  order = 6 
)
Operator that calculates the gradient of a scalar field 
using 6th order finite differences.
Calling sequence:  GRD = grad_findiff(A)
Where:
A is a float32 array defining a scalar field.
order is the accuracy order, one of (6,4,or 2)
Result GRD is a triple of 3 3-dimensional float3d arrays consisting of
the gradient of A.

Definition at line 503 of file vapor_utils.py.

References deriv_findiff(), and vapor.MapVoxToUser().

def vapor_utils.interp3d (   A,
  PR,
  val 
)

Definition at line 532 of file vapor_utils.py.

Referenced by vapor_wrf.SHEAR().

def vapor_utils.mag2d (   a1,
  a2 
)
Calculate the magnitude of a 2-vector.
Calling sequence: MAG = mag2d(A,B)
Where:  A, and B are float32 numpy arrays.
Result MAG is a float32 numpy array containing the square root
of the sum of the squares of A and B.

Definition at line 23 of file vapor_utils.py.

def vapor_utils.mag3d (   a1,
  a2,
  a3 
)
Calculate the magnitude of a 3-vector.
Calling sequence: MAG = mag3d(A,B,C)
Where:  A, B, and C are float32 numpy arrays.
Result MAG is a float32 numpy array containing the square root
of the sum of the squares of A, B, and C.

Definition at line 14 of file vapor_utils.py.

def vapor_utils.vector_rotate (   angleRad,
  latDeg,
  u,
  v 
)
Rotate and scale vectors u,v for integration on
lon-lat grid.
Calling sequence: 
rotfield=vector_rotate(angleRad, latDeg, u,v)
Where:  
angleRad: 2D var, rotation from East in radians
latDeg: 2D var, latitude in degrees
u,v: 3D vars, x,y components of a vector field
rotfield is a 2-tuple of 3-dimensional float32 arrays,
representing rotation of u,v, returned by this operator.

Definition at line 554 of file vapor_utils.py.