ocmw.core.geometry module
Basic geometry tools used in the OCMW processes.
pol2cart
|
Coordinate conversion: Polar to Cartesian |
cart2pol
|
Coordinate conversion: Cartesian to Polar |
pol2cmplx
|
Coordinate conversion: Polar to Complex |
cmplx2pol
|
Coordinate conversion: Complex to Polar |
cart2cmplx
|
Coordinate conversion: Cartesian to Complex |
cmplx2cart
|
Coordinate conversion: Complex to Cartesian |
rotateVectorField
|
Rotate a set of vector field data about the z axis of the coordinate system. |
unitVect
|
Get unit vector components parallel to the line join p1 and p1 |
circSign2D
|
Calculate the direction of circulation around a pair of edge vectors in the x-y plane. |
spatialCoverage
|
Base class for setting spatial coverage of data in lat/lon ranges. |
Basic geometry tools used in the OCMW processes.
-
class ocmw.core.geometry.spatialCoverage(lat_min, lat_max, lon_min, lon_max)[source]
Bases: object
Base class for setting spatial coverage of data in lat/lon ranges.
-
ocmw.core.geometry.pol2cart(r, theta)[source]
Coordinate conversion: Polar to Cartesian
- Parameters:
r (numpy.array, float) – radial distance
theta (numpy.array, float) – angle in degrees
- Returns:
x (numpy.array, float) – cartesian x coordinate
y (numpy.array, float) – cartesian y coordinate
-
ocmw.core.geometry.cart2pol(x, y)[source]
Coordinate conversion: Cartesian to Polar
- Parameters:
x (numpy.array, float) – cartesian x coordindate
y (numpy.array, float) – cartesian y coordinate
- Returns:
r (numpy.array, float) – polar cordinate radial distance
theta (numpy.array, float) – polar cordinate angle (in degrees)
-
ocmw.core.geometry.pol2cmplx(radii, angles, angularUnits=0)[source]
Coordinate conversion: Polar to Complex
- Parameters:
radii (numpy.array, float) – polar coordinate radial distances
angles (numpy.array, float) – polar cordinate angles
anglularUnits (int) – angular units flag (0 = degress [default], 1 = radians)
- Returns:
cmplx (numpy.array, complex) – complex numbers (x + jy)
-
ocmw.core.geometry.cmplx2pol(x, angularUnits=0)[source]
Coordinate conversion: Complex to Polar
- Parameters:
x (numpy.array, complex) – complex numbers (x + jy)
anglularUnits (int) – angular units flag (0 = degress [default], 1 = radians)
- Returns:
radii (numpy.array, float) – polar coordinate radial values
angles (numpy.array, float) – polar coordinate angle values
-
ocmw.core.geometry.cart2cmplx(x, y)[source]
Coordinate conversion: Cartesian to Complex
- Parameters:
x (numpy.array, float) – cartesian x-coordinate
y (numpy.array, float) – cartesian y coordinate
- Returns:
cmplx (numpy.array, complex) – complex numbers (x + jy)
-
ocmw.core.geometry.cmplx2cart(c)[source]
Coordinate conversion: Complex to Cartesian
- Parameters:
c (numpy.array, complex) – complex numbers (x + jy)
- Returns:
x (numpy.array, float) – cartesian x coordinate
y (numpy.array, float) – cartesian y cordinate
-
ocmw.core.geometry.rotateVectorField(U, V, W, Theta)[source]
Rotate a set of vector field data about the z axis of the coordinate
system.
- Parameters:
U (numpy.array, float) – array of vector field values along the x axis.
V (numpy.array, float) – array of vector field values along the y axis.
W (numpy.array, float) – array of vector field values along the z axis.
Theta (float) – rotation angle in degrees (including sign for rotation direction).
- Returns:
Ur (numpy.array, float) – array of vector field values along the x axis in rotated coordinates.
Vr (numpy.array, float) – array of vector field values along the y axis in rotated coordinates.
Wr (numpy.array, float) – array of vector field values along the z axis in rotated coordinates.
-
ocmw.core.geometry.unitVect(p1, p2)[source]
Get unit vector components parallel to the line join p1 and p1
- Parameters:
p1 (numpy.array,float) – vector containing cartesian coordinates of point p1.
p2 (numpy.array,float) – vector containing cartesian coordinates of point p1.
- Returns:
uVec (numpy.array, float) – vector containing cartesian coordinates of unit vector along (p1,p1).
-
ocmw.core.geometry.circSign2D(v1, v2)[source]
Calculate the direction of circulation around a pair of edge vectors in
the x-y plane.
- Parameters:
v1 (numpy.array,float) – components of edge vector v1 in cartesian coordinates.
v2 (numpy.array,float) – components of edge vector v2 in cartesian coordinates.
- Returns:
csgn (float) – sign of circulation direction (i.e. +/- 1).