pydda.cost_functions.grad_J

pydda.cost_functions.grad_J(winds, vrs, azs, els, wts, u_back, v_back, u_model, v_model, w_model, Co, Cm, Cx, Cy, Cz, Cb, Cv, Cmod, Ut, Vt, grid_shape, dx, dy, dz, z, rmsVr, weights, bg_weights, model_weights, upper_bc, print_out=False)[source]

Calculates the gradient of the cost function. This typically does not need to be called directly as get_dd_wind_field is a wrapper around this function and J_function. In order to add more terms to the cost function, modify this function and grad_J.

Parameters:

winds: 1-D float array

The wind field, flattened to 1-D for f_min

vrs: List of float arrays

List of radial velocities from each radar

azs: List of float arrays

List of azimuths from each radar

els: List of float arrays

List of elevations from each radar

wts: List of float arrays

Float array containing fall speed from radar.

u_back: 1D float array (number of vertical levels):

Background u wind

v_back: 1D float array (number of vertical levels):

Background u wind

u_model: list of 3D float arrays

U from each model integrated into the retrieval

v_model: list of 3D float arrays

V from each model integrated into the retrieval

w_model:

W from each model integrated into the retrieval

Co: float

Weighting coefficient for data constraint.

Cm: float

Weighting coefficient for mass continuity constraint.

Cx: float

Smoothing coefficient for x-direction

Cy: float

Smoothing coefficient for y-direction

Cz: float

Smoothing coefficient for z-direction

Cb: float

Coefficient for sounding constraint

Cv: float

Weight for cost function related to vertical vorticity equation.

Cmod: float

Coefficient for model constraint

Ut: float

Prescribed storm motion. This is only needed if Cv is not zero.

Vt: float

Prescribed storm motion. This is only needed if Cv is not zero.

grid_shape:

Shape of wind grid

dx:

Spacing of grid in x direction

dy:

Spacing of grid in y direction

dz:

Spacing of grid in z direction

z:

Grid vertical levels in m

rmsVr: float

The sum of squares of velocity/num_points. Use for normalization of data weighting coefficient

weights: n_radars by z_bins by y_bins x x_bins float array

Data weights for each pair of radars

bg_weights: z_bins by y_bins x x_bins float array

Data weights for sounding constraint

model_weights: n_models by z_bins by y_bins by x_bins float array

Data weights for each model.

upper_bc: bool

True to enforce w=0 at top of domain (impermeability condition), False to not enforce impermeability at top of domain

Returns:

grad: 1D float array

Gradient vector of cost function