pydda.retrieval.get_dd_wind_field#

pydda.retrieval.get_dd_wind_field(Grids, u_init=None, v_init=None, w_init=None, engine='scipy', **kwargs)[source]#

This function takes in a list of Py-ART Grid objects and derives a wind field. Every Py-ART Grid in Grids must have the same grid specification.

In order for the model data constraint to be used, the model data must be added as a field to at least one of the grids in Grids. This involves interpolating the model data to the Grids’ coordinates. There are helper functions for this for WRF and HRRR data in pydda.constraints():

make_constraint_from_wrf()

add_hrrr_constraint_to_grid()

Parameters:
  • Grids (list of Py-ART/DDA Grids) – The list of Py-ART or PyDDA grids to take in corresponding to each radar. All grids must have the same shape, x coordinates, y coordinates and z coordinates.

  • u_init (3D ndarray) – The intial guess for the zonal wind field, input as a 3D array with the same shape as the fields in Grids. If this is None, PyDDA will use the u field in the first Grid as the initalization.

  • v_init (3D ndarray) – The intial guess for the meridional wind field, input as a 3D array with the same shape as the fields in Grids. If this is None, PyDDA will use the v field in the first Grid as the initalization.

  • w_init (3D ndarray) – The intial guess for the vertical wind field, input as a 3D array with the same shape as the fields in Grids. If this is None, PyDDA will use the w field in the first Grid as the initalization.

  • engine (str (one of “scipy”, “tensorflow”, “jax”)) – Setting this flag will use the solver based off of SciPy, TensorFlow, or Jax. Using Tensorflow or Jax expands PyDDA’s capabiability to take advantage of GPU-based systems. In addition, these two implementations use automatic differentation to calculate the gradient of the cost function in order to optimize the gradient calculation. TensorFlow 2.6 and tensorflow-probability are required for the TensorFlow-basedengine. The latest version of Jax is required for the Jax-based engine.

  • points (None or list of dicts) – Point observations as returned by pydda.constraints.get_iem_obs(). Set to None to disable.

  • vel_name (string) – Name of radial velocity field. Setting to None will have PyDDA attempt to automatically detect the velocity field name.

  • refl_field (string) – Name of reflectivity field. Setting to None will have PyDDA attempt to automatically detect the reflectivity field name.

  • u_back (1D array) – Background zonal wind field from a sounding as a function of height. This should be given in the sounding’s vertical coordinates.

  • v_back (1D array) – Background meridional wind field from a sounding as a function of height. This should be given in the sounding’s vertical coordinates.

  • z_back (1D array) – Heights corresponding to background wind field levels in meters. This is given in the sounding’s original coordinates.

  • frz (float) – Freezing level used for fall speed calculation in meters.

  • Co (float) – Weight for cost function related to observed radial velocities.

  • Cm (float) – Weight for cost function related to the mass continuity equation.

  • Cx (float) – Weight for cost function related to smoothness in x direction

  • Cy (float) – Weight for cost function related to smoothness in y direction

  • Cz (float) – Weight for cost function related to smoothness in z direction

  • Cv (float) – Weight for cost function related to vertical vorticity equation.

  • Cmod (float) – Weight for cost function related to custom constraints.

  • Cpoint (float) – Weight for cost function related to point observations.

  • weights_obs (list of floating point arrays or None) – List of weights for each point in grid from each radar in Grids. Set to None to let PyDDA determine this automatically.

  • weights_model (list of floating point arrays or None) – List of weights for each point in grid from each custom field in model_fields. Set to None to let PyDDA determine this automatically.

  • weights_bg (list of floating point arrays or None) – List of weights for each point in grid from the sounding. Set to None to let PyDDA determine this automatically.

  • Ut (float) – Prescribed storm motion in zonal direction. This is only needed if Cv is not zero.

  • Vt (float) – Prescribed storm motion in meridional direction. This is only needed if Cv is not zero.

  • filter_winds (bool) – If this is True, PyDDA will run a low pass filter on the retrieved wind field. Set to False to disable the low pass filter.

  • mask_outside_opt (bool) – If set to true, wind values outside the multiple doppler lobes will be masked, i.e. if less than 2 radars provide coverage for a given point.

  • max_iterations (int) – The maximum number of iterations to run the optimization loop for.

  • mask_w_outside_opt (bool) – If set to true, vertical winds outside the multiple doppler lobes will be masked, i.e. if less than 2 radars provide coverage for a given point.

  • filter_window (int) – Window size to use for the low pass filter. A larger window will increase the number of points factored into the polynomial fit for the filter, and hence will increase the smoothness.

  • filter_order (int) – The order of the polynomial to use for the low pass filter. Higher order polynomials allow for the retention of smaller scale features but may also not remove enough noise.

  • min_bca (float) – Minimum beam crossing angle in degrees between two radars. 30.0 is the typical value used in many publications.

  • max_bca (float) – Minimum beam crossing angle in degrees between two radars. 150.0 is the typical value used in many publications.

  • upper_bc (bool) – Set this to true to enforce w = 0 at the top of the atmosphere. This is commonly called the impermeability condition.

  • model_fields (list of strings) – The list of fields in the first grid in Grids that contain the custom data interpolated to the Grid’s grid specification. Helper functions to create such gridded fields for HRRR and NetCDF WRF data exist in ::pydda.constraints::. PyDDA will look for fields named U_(model field name), V_(model field name), and W_(model field name). For example, if you have U_hrrr, V_hrrr, and W_hrrr, then specify [“hrrr”] into model_fields.

  • output_cost_functions (bool) – Set to True to output the value of each cost function every 10 iterations.

  • roi (float) – Radius of influence for the point observations. The point observation will not hold any weight outside this radius.

  • parallel_iterations (int) – The number of iterations to run in parallel in the optimization loop. This is only for the TensorFlow-based engine.

  • wind_tol (float) – Stop iterations after maximum change in winds is less than this value.

  • tolerance (float) – Tolerance for L2 norm of gradient before stopping.

  • max_wind_magnitude (float) – Constrain the optimization to have \(|u|, :math:`|w|\), and \(|w| < x\) m/s.

Returns:

  • new_grid_list (list) – A list of Py-ART grids containing the derived wind fields. These fields are displayable by the visualization module.

  • parameters (struct) – The parameters used in the generation of the Multi-Doppler wind field.