pyart.map.map_to_grid

pyart.map.map_to_grid(radars, grid_shape, grid_limits, grid_origin=None, grid_origin_alt=None, grid_projection=None, fields=None, gatefilters=False, map_roi=True, weighting_function='Barnes2', toa=17000.0, copy_field_data=True, algorithm='kd_tree', leafsize=10.0, roi_func='dist_beam', constant_roi=None, z_factor=0.05, xy_factor=0.02, min_radius=500.0, h_factor=1.0, nb=1.5, bsp=1.0, **kwargs)[source]

Map one or more radars to a Cartesian grid.

Generate a Cartesian grid of points for the requested fields from the collected points from one or more radars. The field value for a grid point is found by interpolating from the collected points within a given radius of influence and weighting these nearby points according to their distance from the grid points. Collected points are filtered according to a number of criteria so that undesired points are not included in the interpolation.

Parameters
  • radars (Radar or tuple of Radar objects.) – Radar objects which will be mapped to the Cartesian grid.

  • grid_shape (3-tuple of floats) – Number of points in the grid (z, y, x).

  • grid_limits (3-tuple of 2-tuples) – Minimum and maximum grid location (inclusive) in meters for the z, y, x coordinates.

  • grid_origin ((float, float) or None) – Latitude and longitude of grid origin. None sets the origin to the location of the first radar.

  • grid_origin_alt (float or None) – Altitude of grid origin, in meters. None sets the origin to the location of the first radar.

  • grid_projection (dict) – Projection parameters defining the map projection used to transform the locations of the radar gates in geographic coordinate to Cartesian coodinates. None will use the default dictionary which uses a native azimutal equidistance projection. See pyart.core.Grid() for additional details on this parameter. The geographic coordinates of the radar gates are calculated using the projection defined for each radar. No transformation is used if a grid_origin and grid_origin_alt are None and a single radar is specified.

  • fields (list or None) – List of fields within the radar objects which will be mapped to the cartesian grid. None, the default, will map the fields which are present in all the radar objects.

  • gatefilters (GateFilter, tuple of GateFilter objects, optional) – Specify what gates from each radar will be included in the interpolation onto the grid. Only gates specified in each gatefilters will be included in the mapping to the grid. A single GateFilter can be used if a single Radar is being mapped. A value of False for a specific element or the entire parameter will apply no filtering of gates for a specific radar or all radars (the default). Similarily a value of None will create a GateFilter from the radar moments using any additional arguments by passing them to moment_based_gate_filter().

  • roi_func (str or function) – Radius of influence function. A functions which takes an z, y, x grid location, in meters, and returns a radius (in meters) within which all collected points will be included in the weighting for that grid points. Examples can be found in the example_roi_func_constant(), example_roi_func_dist(), and example_roi_func_dist_beam(). Alternatively the following strings can use to specify a built in radius of influence function:

    • constant: constant radius of influence.

    • dist: radius grows with the distance from each radar.

    • dist_beam: radius grows with the distance from each radar and parameter are based of virtual beam sizes.

    The parameters which control these functions are listed in the Other Parameters section below.

  • map_roi (bool) – True to include a radius of influence field in the returned dictionary under the ‘ROI’ key. This is the value of roi_func at all grid points.

  • weighting_function (‘Barnes’ or ‘Barnes2’ or ‘Cressman’ or ‘Nearest’) – Functions used to weight nearby collected points when interpolating a grid point.

  • toa (float) – Top of atmosphere in meters. Collected points above this height are not included in the interpolation.

Other Parameters
  • constant_roi (float) – Radius of influence parameter for the built in ‘constant’ function. This parameter is the constant radius in meter for all grid points. This parameter is used when roi_func is constant or constant_roi is not None. If constant_roi is not None, the constant roi_func is used automatically.

  • z_factor, xy_factor, min_radius (float) – Radius of influence parameters for the built in ‘dist’ function. The parameter correspond to the radius size increase, in meters, per meter increase in the z-dimension from the nearest radar, the same foreach meteter in the xy-distance from the nearest radar, and the minimum radius of influence in meters. These parameters are only used when roi_func is ‘dist’.

  • h_factor, nb, bsp, min_radius (float) – Radius of influence parameters for the built in ‘dist_beam’ function. The parameter correspond to the height scaling, virtual beam width, virtual beam spacing, and minimum radius of influence. These parameters are only used when roi_func is ‘dist_mean’.

  • copy_field_data (bool) – True to copy the data within the radar fields for faster gridding, the dtype for all fields in the grid will be float64. False will not copy the data which preserves the dtype of the fields in the grid, may use less memory but results in significantly slower gridding times. When False gates which are masked in a particular field but are not masked in the refl_field field will still be included in the interpolation. This can be prevented by setting this parameter to True or by gridding each field individually setting the refl_field parameter and the fields parameter to the field in question. It is recommended to set this parameter to True.

  • algorithm (‘kd_tree’.) – Algorithms to use for finding the nearest neighbors. ‘kd_tree’ is the only valid option.

  • leafsize (int) – Leaf size passed to the neighbor lookup tree. This can affect the speed of the construction and query, as well as the memory required to store the tree. The optimal value depends on the nature of the problem. This value should only effect the speed of the gridding, not the results.

Returns

grids (dict) – Dictionary of mapped fields. The keys of the dictionary are given by parameter fields. Each elements is a grid_size float64 array containing the interpolated grid for that field.

See also

grid_from_radars

Map to grid and return a Grid object.