Calculus
divergence_2d(var_x, var_y, lat, lon, lat_axis=-2, lon_axis=-1)
Calculate the 2D divergence of a vector field with the given x and y components.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var_x
|
ndarray
|
x component of the vector e.g. u for wind. Typical shape is |
required |
var_y
|
ndarray
|
y component of the vector e.g. v for wind. Typical shape is |
required |
lat
|
ndarray
|
|
required |
lon
|
ndarray
|
|
required |
lat_axis
|
int
|
Axis of var_x and var_y which corresponds to latitude. |
-2
|
lon_axis
|
int
|
Axis of var_x and var_y which corresponds to longitude. |
-1
|
Returns:
Type | Description |
---|---|
ndarray
|
Divergence of var with same shape as |
Source code in isca_tools/utils/calculus.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
grad_x(var, lat, lon, lat_axis=-2, lon_axis=-1)
Finds the gradient in the x direction of a scalar field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var
|
ndarray
|
Scalar field to find gradient of. Typical shape is |
required |
lat
|
ndarray
|
|
required |
lon
|
ndarray
|
|
required |
lat_axis
|
int
|
Axis of var_x and var_y which corresponds to latitude. |
-2
|
lon_axis
|
int
|
Axis of var_x and var_y which corresponds to longitude. |
-1
|
Returns:
Type | Description |
---|---|
ndarray
|
Gradient of |
Source code in isca_tools/utils/calculus.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
grad_y(var, lat, lat_axis=-2)
Finds the gradient in the y direction of a scalar field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var
|
ndarray
|
Scalar field to find gradient of. Typical shape is |
required |
lat
|
ndarray
|
|
required |
lat_axis
|
int
|
Axis of var_x and var_y which corresponds to latitude. |
-2
|
Returns:
Type | Description |
---|---|
ndarray
|
Gradient of |
Source code in isca_tools/utils/calculus.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|