swirlspy.core package


swirlspy.core.resample module

swirlspy.core.resample.grid_resample(da_src: xarray.core.dataarray.DataArray, area_def_src: pyresample.geometry.AreaDefinition, area_def_tgt: pyresample.geometry.AreaDefinition, method='quick', coord_label=['x', 'y'], radius_of_influence=50000, fill_value=None, nprocs=1, segments=None)

Reprojects data in an xarray.DataArray to another projection system. Returns an xarray.DataArray with metadata associated with the new projection system.

  • da_src (xarray.DataArray) – Contains data and metadata associated with the current projection system. Dimensions of data must be (‘y’, ‘x’) or (‘channel’, ‘y’, ‘x’). ‘y’ coordinates must be in descending order.

  • area_def_src (pyresample.AreaDefinition) – The area definition of the current projection system.

  • area_def_tgt (pyresample.AreaDefinition) – The area definition of the target projection system.

  • method (str) – The resampling method, based on the methods of pyresample.image. Options are ‘quick’, using an approximate but faster nearest neighbour method, and ‘kd_tree’, using an accurate kd_tree method.

  • coord_label (list of strings) – [x_label, y_label]. Defaults to [‘x’, ‘y’].

  • radius_of_influence (int) – Cut off radius in meters when considering neighbouring pixels.

  • fill_value (int) – Fill value for undefined pixels. Default is None, where they will be masked out.

  • nprocs (int) – Number of precessor cores to use. Defaults to 1.

  • segments (int) – Number of segments to split resampling in. Defaults None, where auto-estimation will be done.


da_tgt – Contains data reprojected to the target projection system and associated metadata

Return type


swirlspy.core.resample.to_wgs84(da: xarray.core.dataarray.DataArray, area_def_src: pyresample.geometry.AreaDefinition)

Converts xarray.DataArray coordinates from projection coordinates in metres to geodetic coordinates in degrees. This function merely converts the coordinates of the data points.

  • da (xarray.DataArray) – Contains data labelled in projection coordinates.

  • area_def_src (pyresample.geometry.AreaDefinition) – The area definition of the grid.


renamed – Contains data labelled in longitude and latitude.

Return type