swirlspy.rad package

Subpackages

Submodules

swirlspy.rad.grid_obj_creator module

swirlspy.rad.grid_obj_creator.grid_obj_creator(end_time, duration, x_ll, y_ll, x_ur, y_ur, lon_0, lat_0, proj, data, nx, ny)

Create a grid object.

end_time: str

The time when the grid stops accumulating.

duration: str

The period of time the grid has accumulated.

x_ll: int

projection x coordinate of lower left corner of lower left pixel.

y_ll: int

projection y coordinate of lower left corner of lower left pixel.

x_ur: int

projection x coordinate of upper right corner of upper right pixel.

y_ur: int

projection y coordinate of upper right corner of upper right pixel.

lon_0: float

PROJ.4 parameters, longitude of center.

lat_0: float

PROJ.4 parameters, latitude of center.

proj: str

PROJ.4 parameters, proj4-string.

data: ndarray

Array containing data to be put into the grid object. Default=None.

nx: Optional, int

Number of grids in the x-direction. Default=480.

ny: Optional, int

Number of grids in the y-direction. Default=480.

grid_obj: Class Grid from module “grid”

A cartesian grid object. Reflectivity data is in “data” attribute.

swirlspy.rad.sph2cart_interpolation module

swirlspy.rad.sph2cart_interpolation.sph2cart_interpolation(radius, azimuth, elevation, xllcenter, yllcenter, nrows, ncols, data)
Convert data from spherical coordinates to cartesian coordinates

by interpolation.

Masked values and negative values in the grid of cartesian coordinates are replaced by 0.

Parameters
  • radius (numpy.ndarray) – Contains the radial distances in meters.

  • azimuth (numpy.ndarray) – Contains the azimuthal angles in degree.

  • elevation (numpy.ndarray) – Contains the elevation angles in degree.

  • xllcenter (float) – Radar site longitude.

  • yllcenter (float) – Radar site latitude.

  • nrows (int) – Number of rows of the output interpolated cartesian grid.

  • ncols (int) – Number of columns of the output interpolated cartesian grid.

  • data (numpy.ndarray) – array of float, the data that should be interpolated on the cartesian grid.

Returns

Cartesian Grid – an array of float with a dimension of (nrows,ncols), the data that should be interpolated on the cartesian grid.

Return type

numpy.2darray

swirlspy.rad.time_update module

swirlspy.rad.time_update.time_update(initial, time_step_size)

Shift time by a certain amount.

Parameters
  • initial (str) – Base time, in YYYYMMDDhhmm.

  • time_step_size (str) – Amount of time to shift, in minutes.

Returns

end – Updated time, in YYYYMMDDhhmm.

Return type

str

swirlspy.rad.xr2d module

swirlspy.rad.xr2d.xr2d(np_array, end_time, duration)

Transform numpy array to xarray.DataArray.

Parameters
np_array: np.2darray

Must be 2-dimensional, dimension will be hardcoded as ‘x’ and ‘y’.

end_time: str

End time when your data stops accumulating [YYYYMMDDhhmm].

duration: str

Accumulation period of your data, in minutes.

Return

xr2d: xarray.DataArray (2-dimensional, in ‘x’ ‘y’) .. attribute:: dims

tuple Tuple of dimension names associated with this array. Hardcoded as ‘x’ and ‘y’.

swirlspy.rad.xr2d.values

np.ndarray The array’s data as a numpy.ndarray.

swirlspy.rad.xr2d.coords

dict_like Dictionary-like container of coordinate arrays of ‘x’ and ‘y’.

swirlspy.rad.xr2d.attrs

OrderedDict Dictionary storing arbitrary metadata with this array, including ‘end_time’ and ‘duration’.

swirlspy.rad.xrnd module

swirlspy.rad.xrnd.xrnd(*arg)

Concatenate multiple ‘xr2d’ into a single xarray, along a new axis called ‘end_time’. Use this function to make an xarray for qpf.

Parameters

Any number of ‘xr2d’ (xarray.DataArray).

Return
ndxr: xarray.DataArray

Number of ‘xr2d’ concatenated along ‘end_time’ axis depends on number of input.