swirlspy.core package

Submodules

swirlspy.core.resample module

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

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

swirlspy.core.runner module

Usage:
Crontabbed program to click start other SWIRLS program by searching whether input file of the current timestamp exists. format in crontab: path/runner.py initial_sleep inter_sleep file_loop_times path/clickstart_program path file_format time_format
Input:
initial_sleep(int) - Initial sleep before searching for file.(seconds) inter_sleep(int) - Sleep between each time of file searching if file not yet exist.(seconds) file_loop_times(int) - Maximum time of finding input file. clickstart_program - Path and name of program to be clickstarted. path - Path of input data file_format(str) - Initials of input file e.g.TMS/TCR time_format(str) - String of time format in input file e.g.’%Y%m%d%H%M’
Output: