swirlspy.qpf package

Subpackages

Submodules

swirlspy.qpf.persistence module

swirlspy.qpf.persistence.persistence(xr2d, timesteps, timesteps_size)

Forecast by persistence, accepting an observation xarray and returning a forecast xarray. Persistence means that the forecast is exactly same as the observation. While it sounds trivial, this is usefulf for benchmarking the performance of another QPF algorithm.

Parameters:
  • xr2d (xarray.DataArray (2-dimensional, in 'x' 'y')) – The xarray containing data to be forecast

  • timesteps (int) – Number of timesteps to be forecast

  • timesteps_size (int) – Time interval between each steps, in minutes.

Returns:

persistence_xrnd – Data values in ‘xr2d’ being copied along the ‘end_time’ axis, coordinates of ‘end_time’ axis have a unique value for each timestep.

Return type:

xarray.DataArray

swirlspy.qpf.rover module

swirlspy.qpf.rover.rover(qpf_xarray, start_level=1, max_level=7, rho=9.0, alpha=2000.0, sigma=1.5, gray_scale=True, atan_dBZ_min=-1.482, atan_dBZ_max=1.412, ashift=33.0, afact=4.0, zero_value=None)

Running rover to generate u and v motion fields for QPF. fall back wrapper

Parameters:
  • qpf_xarray (xarray.DataArray) – Contains reflectivity data. First element of array corresponds to the geographic upper left corner.

  • start_level (int) – Starting level used as base in multigrid algorithm. Higher=coarser. Defaults to 1.

  • max_level (int) – Maximum level to be reached in multigrid algorithm. Higher=coarser. Defaults to 7.

  • rho (float) – Gaussian smoothing parameter. Defaults to 9.0.

  • alpha (float) – Regularisation parameter in the energy functional. Defaults to 2000.0.

  • sigma (float) – Gaussian smoothing parameter. Defaults to 1.5.

  • atan_dBZ_min (float) – Minimum arc tangent value. Defaults to -1.482.

  • atan_dBZ_max (float) – Maximum arc tangent value. Defaults to 1.412.

  • ashift (float) – Point of inflection. Defaults to 33 dBZ.

  • afact (float) – Sharpness of inflection. Defaults to 4.0 dBZ.

  • zero_value (int) – Value that assigned to be no data. Default: 9999 (If zero_value is None, numpy.nan will be used)

Returns:

  • motion_u (xarray.DataArray) – x component of motion field.

  • motion_v (xarray.DataArray) – y component of motion field.

Notes

Default values of start_level, max_level, rho, alpha and sigma are those of ROVER-A.

swirlspy.qpf.sla module

swirlspy.qpf.sla.sla(qpf_xarray, motion_u, motion_v, steps=6, zero_value=9999)

Calculates forecast reflectivity using Semi-Lagrangian Advection from horizontal and vertical motion fields. fall back wrapper

Parameters:
  • qpf_xarray (xarray.DataArray) – Contains reflectivity data. First element of array corresponds to the geographic upper left corner.

  • motion_u (xarray.DataArray) – x component of motion field.

  • motion_v (xarray.DataArray) – y component of motion field.

  • steps (int, optional) – Number of time steps to forecast. Default: 6

  • zero_value (int) – Value that assigned to be no data. Default: 9999 (If zero_value is None, numpy.nan will be used)

Returns:

forecast – A xarray.DataArray populated with forecast reflectivity and metadata.

Return type:

xarray.DataArray

Notes

The program will automatically use GPU to run extrapolation if your computer has a CUDA-capable GPU and has installed a NVIDIA driver.

Please follow CUDA Installation Instruction to install NVIDIA driver. If you use Ubuntu 18.04, execute the below commands to install the driver:

sudo apt-get install linux-headers-$(uname -r)
wget -P /tmp/sla_gpu https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.2.89-1_amd64.deb
sudo dpkg -i /tmp/sla_gpu/cuda-repo-ubuntu1804_10.2.89-1_amd64.deb
wget -P /tmp/sla_gpu https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv /tmp/sla_gpu/cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get install cuda-drivers -y

After installing the driver, regardless of which linux distribution you are using, you need to reboot your computer for the driver to function properly.

Module contents

Quantitative precipitation forecast methods.