# pyresample.ewa.ewa module

EWA algorithms operating on numpy arrays.

pyresample.ewa.ewa.fornav(cols, rows, area_def, data_in, rows_per_scan=None, fill=None, out=None, weight_count=10000, weight_min=0.01, weight_distance_max=1.0, weight_delta_max=10.0, weight_sum_min=-1.0, maximum_weight_mode=False)

  Remap data in to output grid using elliptical weighted averaging.

  This algorithm works under the assumption that the data is observed one scan line at a time. However, good results can still be achieved for non-scan based data is provided if rows_per_scan is set to the number of rows in the entire swath or by setting it to None.

  Parameters:

    - cols (numpy array) – Column location for each input swath pixel (from ll2cr)

    - rows (numpy array) – Row location for each input swath pixel (from ll2cr)

    - area_def (pyresample.geometry.AreaDefinition) – Grid definition to be mapped to

    - data_in (numpy array or tuple of numpy arrays) – Swath data to be remapped to output grid

    - rows_per_scan (int or None, optional) – Number of data rows for every observed scanline. If None then the entire swath is treated as one large scanline.

    - fill (float/int or None, optional) – If data_in is made of numpy arrays then this represents the fill value used to mark invalid data pixels. This value will also be used in the output array(s). If None, then np.nan will be used for float arrays and -999 will be used for integer arrays.

    - out (numpy array or tuple of numpy arrays, optional) – Specify a numpy array to be written to for each input array. This can be used as an optimization by providing np.memmap arrays or other array-like objects.

    - weight_count (int, optional) – number of elements to create in the gaussian weight table. Default is 10000. Must be at least 2

    - weight_min (float, optional) – the minimum value to store in the last position of the weight table. Default is 0.01, which, with a weight_distance_max of 1.0 produces a weight of 0.01 at a grid cell distance of 1.0. Must be greater than 0.

    - weight_distance_max (float, optional) – distance in grid cell units at which to apply a weight of weight_min. Default is 1.0. Must be greater than 0.

    - weight_delta_max (float, optional) – maximum distance in grid cells in each grid dimension over which to distribute a single swath cell. Default is 10.0.

    - weight_sum_min (float, optional) – minimum weight sum value. Cells whose weight sums are less than weight_sum_min are set to the grid fill value. Default is EPSILON.

    - maximum_weight_mode (bool, optional) – If False (default), a weighted average of all swath cells that map to a particular grid cell is used. If True, the swath cell having the maximum weight of all swath cells that map to a particular grid cell is used. This option should be used for coded/category data, i.e. snow cover.

  Returns:

    (valid grid points, output arrays) – The valid_grid_points tuple holds the number of output grid pixels that were written with valid data. The second element in the tuple is a tuple of output grid numpy arrays for each input array. If there was only one input array provided then the returned tuple is simply the singe points integer and single output grid array.

  Return type:

    tuple of integer tuples and numpy array tuples

pyresample.ewa.ewa.ll2cr(swath_def, area_def, fill=nan, copy=True)

  Map input swath pixels to output grid column and rows.

  Parameters:

    - swath_def (pyresample.geometry.SwathDefinition) – Navigation definition for swath data to remap

    - area_def (pyresample.geometry.AreaDefinition) – Grid definition to be mapped to

    - fill (float, optional) – Fill value used in longitude and latitude arrays

    - copy (bool, optional) – Create a copy of the longitude and latitude arrays (default: True)

  Returns:

    - (swath_points_in_grid, cols, rows) (tuple of integer, numpy array, numpy array) – Number of points from the input swath overlapping the destination area and the column and row arrays to pass to fornav.

    - .. note:: – ll2cr uses the pyproj library which is limited to 64-bit float navigation arrays in order to not do additional copying or casting of data types.