pydda.cost_functions.calculate_mass_continuity_gradient#

pydda.cost_functions.calculate_mass_continuity_gradient(u, v, w, z, dx, dy, dz, coeff=1500.0, anel=1, upper_bc=1, upper_bc_mask=None, lower_bc=1, fluid=None)[source]#

Calculates the gradient of mass continuity cost function. This is done by taking the negative gradient of the divergence of the wind field. All grids must have the same grid specification. :Parameters: * u (Float array) – Float array with u component of wind field

  • v (Float array) – Float array with v component of wind field

  • w (Float array) – Float array with w component of wind field

  • z (Float array (1D)) – 1D Float array with heights of grid

  • dx (float) – Grid spacing in x direction.

  • dy (float) – Grid spacing in y direction.

  • dz (float) – Grid spacing in z direction.

  • coeff (float) – Constant controlling contribution of mass continuity to cost function

  • anel (int) – = 1 use anelastic approximation, 0=don’t

  • upper_bc (int) – Upper boundary (impermeability) condition. 0 disables it, 1 enforces w = 0 at the top of the domain, and 2 enforces w = 0 above the echo top as given by upper_bc_mask. The legacy booleans True and False are equivalent to 1 and 0.

  • upper_bc_mask (3D bool array or None) – The grid points at which w is held fixed when upper_bc is 2, as returned by pydda.cost_functions.calculate_echo_top_mask().

  • lower_bc (int) – Lower boundary (impermeability) condition. 1 enforces w = 0 on the bottom plane of the domain, which assumes flat ground there. 0 disables it, which is what the terrain boundary condition needs, since over terrain the bottom plane is underground in some columns and free air in others. The legacy booleans True and False are equivalent to 1 and 0.

  • fluid (3D bool array or None) – Mask of grid points above the terrain surface. See calculate_mass_continuity().

Returns:

y (float array) – value of gradient of mass continuity cost function