pydda.cost_functions.J_function

pydda.cost_functions.J_function(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 total cost function. This typically does not need to be called directly as get_dd_wind_field is a wrapper around this function and grad_J. 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. The total size of the array will be a 1D array of 3*nx*ny*nz elements.

vrs: List of 3D float arrays

List of radial velocities from each radar. All arrays in list must have the same dimensions.

azs: List of 3D float arrays

List of azimuths from each radar. All arrays in list must have the same dimensions.

els: List of 3D float arrays

List of elevations from each radar. All arrays in list must have the same dimensions.

wts: List of 3D float arrays

Float array containing fall speeds from radar. All arrays in list must have the same dimensions.

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

Background u wind. This takes in a 1D float array of length nz, with each element corresponding to the u component of the wind at a given vertical level from the sounding.

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

Background v wind. This takes in a 1D float array of length nz, with each element corresponding to the v component of the wind at a given vertical level from the sounding.

u_model: list of 3D float arrays

U from each model integrated into the retrieval. The U from each model is given as a list of array of the same dimensions, with the U from the model interpolated on to the radar analysis grid.

v_model: list of 3D float arrays

V from each model integrated into the retrieval. The V from each model is given as a list of array of the same dimensions, with the V from the model interpolated on to the radar analysis grid.

w_model:

W from each model integrated into the retrieval. The W from each model is given as a list of array of the same dimensions, with the W from the model interpolated on to the radar analysis grid.

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 by x_bins float array

Data weights for each pair of radars. This is usually automatically determined by get_dd_wind_field.

bg_weights: z_bins by y_bins by 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

print_out: bool

Set to True to print out the value of the cost function.

Returns:

J: float

The value of the cost function