swirlspy.core package

Submodules

swirlspy.core.resample module

swirlspy.core.resample.grid_resample(da_src: DataArray, area_def_src: AreaDefinition, area_def_tgt: 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.

Parameters
  • 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.

Returns

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

Return type

xarray.DataArray

swirlspy.core.resample.to_wgs84(da: DataArray, area_def_src: 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.

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

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

Returns

renamed – Contains data labelled in longitude and latitude.

Return type

xarray.DataArray