Learn R Programming

⚠️There's a newer version (0.9.1) of this package.Take me there.

bioRad

bioRad provides standardized methods for extracting and reporting biological signals from weather radars. It includes functionality to inspect low-level radar data, process these data into meaningful biological information on animal speeds and directions at different altitudes in the atmosphere, visualize these biological extractions, and calculate further summary statistics.

To get started, see:

More vignettes:

  • Range correction: estimate spatial images of vertically integrated density corrected for range effects.

Documentation for the latest development version can be found here.

Installation

bioRad depends on packages from both the CRAN and Bioconductor repositories. Enable both with:

setRepositories(ind = 1:2)

You can install the released version of bioRad from CRAN with:

install.packages("bioRad")

Alternatively, you can install the latest development version from GitHub with:

devtools::install_github("adokter/bioRad")

Then load the package with:

library(bioRad)
#> Welcome to bioRad version 0.5.0
#> Docker daemon running, Docker functionality enabled (vol2bird version 0.5.0, MistNet available)

Required system libraries on Linux (Ubuntu)

The following system libraries are required before installing bioRad on Linux systems. In terminal, install these with:

sudo apt install libcurl4-openssl-dev
sudo apt install libssl-dev
sudo apt install libgdal-dev

Docker (optional)

You need to install Docker to:

  • Process radar data into vertical profiles of biological targets with calculate_vp().
  • Read NEXRAD radar data or IRIS RAW data with read_pvolfile(). Docker is not required for reading ODIM radar data.
  • Convert NEXRAD radar data to ODIM format with nexrad_to_odim().
  • Use the MistNet neural network with calculate_vp() or apply_mistnet()

Why? bioRad makes use of a C implementation of the vol2bird algorithm through Docker to do the above. All other bioRad functions will work without a Docker installation.

Installing Docker

  1. Go to Docker Desktop.
  2. Download Docker for Windows or Mac (free login required) and follow the installation instructions. Note that Docker for Windows requires Microsoft Windows 10 Professional or Enterprise 64-bit: installing Docker Toolbox for previous Windows versions will not work.
  3. Open the Docker application. The Docker (whale) icon will appear in your menu or task bar and indicate if it is running correctly.
  4. Make local drive(s) available for Docker containers:
    • On Windows: right click the Docker icon > Settings > Shared drives > Select the drive(s) where you will be processing radar files > Click Apply.
    • On Mac: click the Docker icon > Preferences > File sharing > Add the drive(s) where you will be processing radar files > Click Apply & Restart.
  5. In R do check_docker().
  6. You can now use the bioRad functionality that requires Docker.

Known issues with Docker

  1. Hyper-V / Virtualbox conflicts on Windows. Docker requires Hyper-V enabled, but Hyper-V can not run together with Virtualbox. To use Virtualbox you will need to disable Hyper-V, which also disables Docker, and requires a reboot of the system.
  2. For firewall issues on Windows, see this issue
  3. For permission issues when running docker, specifically the error Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock, see this solution. Running sudo usermod -a -G docker $USER in a terminal will fix this problem.

Usage

Radar data example

bioRad can read weather radar data (= polar volumes) in the ODIM format and formats supported by the RSL library, such as NEXRAD data. NEXRAD data (US) are available as open data and on AWS.

Here we read an example polar volume data file with read_pvolfile(), extract the scan/sweep at elevation angle 3 with get_scan(), project the data to a plan position indicator with project_as_ppi() and plot the radial velocity of detected targets with plot():

library(tidyverse) # To pipe %>% the steps below
system.file("extdata", "volume.h5", package = "bioRad") %>%
  read_pvolfile() %>%
  get_scan(3) %>%
  project_as_ppi() %>%
  plot(param = "VRADH") # VRADH = radial velocity in m/s

Radial velocities towards the radar are negative, while radial velocities away from the radar are positive, so in this plot there is movement from the top right to the bottom left.

Vertical profile data example

Weather radar data can be processed into vertical profiles of biological targets using calculate_vp(). This type of data is available as open data for over 100 European weather radars.

Once vertical profile data are loaded into bioRad, these can be bound into time series using bind_into_vpts(). Here we read an example time series, project it on a regular time grid with regularize_vpts() and plot it with plot():

example_vpts %>%
  regularize_vpts() %>%
  plot()
#> projecting on 300 seconds interval grid...

The gray bars in the plot indicate gaps in the data.

The altitudes in the profile can be integrated with integrate_profile() resulting in a dataframe with rows for datetimes and columns for quantities. Here we plot the quantity migration traffic rate (column mtr) with plot():

my_vpi <- integrate_profile(example_vpts)

plot(my_vpi, quantity = "mtr") # mtr = migration traffic rate

To know the total number of birds passing over the radar during the full time series, we use the last value of the cumulative migration traffic (column mt):

my_vpi %>%
  pull(mt) %>% # Extract column mt as a vector
  last()
#> [1] 173023.8

For more exercises, see this tutorial.

Meta

  • We welcome contributions including bug reports.
  • License: MIT
  • Get citation information for bioRad in R doing citation("bioRad").
  • Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Copy Link

Version

Install

install.packages('bioRad')

Monthly Downloads

758

Version

0.5.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Adriaan M. Dokter

Last Published

February 19th, 2020

Functions in bioRad (0.5.0)

add_expected_eta_to_scan

adds expected eta to a scan
beam_height

Calculate radar beam height
beam_distance

Calculate radar beam distance
check_date_format

Check if character date is in specific format
calculate_vp

Calculate a vertical profile (vp) from a polar volume (pvol)
check_docker

Check if Docker is running
beam_width

Calculate radar beam width
beam_range

Calculate radar beam range
filter_vpts

Time selection in a time series of vertical profiles ('vpts')
bioRad-deprecated

Deprecated functions and data in package bioRad
bind_into_vpts

Bind vertical profiles (vp) into time series (vpts)
get_elevation_angles

Get elevation angles of a polar volume (pvol) or scan (scan)
eta_to_dbz

Convert reflectivity to reflectivity factor
example_vp

Example object of class vp
gaussian_beam_profile

Gaussian beam profile as a function of height
as.data.frame.vp

Convert a vertical profile (vp) to a Data Frame
rcs

Get radar cross section
plot.vp

Plot a vertical profile (vp)
get_odim_object_type

Check the ODIM data class of a polar volume file
plot.vpi

Plot an integrated profile (vpi)
c.vp

Concatenate vertical profiles (vp) into a list of vertical profiles
as.data.frame.vpts

Convert a time series of vertical profiles (vpts) to a data frame
read_cajun

Read a vertical profile (vp) from UMASS Cajun text file
bioRad-package

bioRad: Biological Analysis and Visualization of Weather Radar Data
example_scan

Example object of class scan
scan_to_raster

convert a polar scan into a raster
dbz_to_eta

Convert reflectivity factor to reflectivity
regularize_vpts

Regularize a time series of vertical profiles (vpts) on a regular time grid
composite_ppi

Create a composite of multiple plan position indicators (ppi)
summary.pvol

Class pvol: a polar volume
summary.scan

Class scan: a scan of a polar volume
vol2bird_version

Check version of the vol2bird algorithm used by bioRad
vplist_to_vpts

Bind vertical profiles (vp) into time series (vpts)
get_param

Get a scan parameter (param) from a scan (scan)
get_scan

Get a scan (scan) from a polar volume (pvol)
example_vpts

Example object of class vpts
map

Map a plan position indicator (ppi)
get_quantity

Get a quantity of a vertical profile (vp) or time series of vertical profiles (vpts)
match_filenames

Match a set of regular expressions to a list of files
beam_profile

Calculate vertical radiation profile
read_vpfiles

Read a vertical profile (vp) or a list of vertical profiles (vp) from files
project_as_ppi

Project a scan (scan) or parameter (param) to a plan position indicator (ppi)
read_vpts

Read a time series of vertical profiles (vpts) from file
rcs<-

Set radar cross section
nexrad_to_odim

Convert a NEXRAD polar volume file to an ODIM polar volume file
nyquist_velocity

Nyquist velocity for a given pulse repetition frequency (PRF)
integrate_profile

Vertically integrate profiles (vp or vpts) to an integrated profile (vpi)
is.nan.data.frame

Identify NaN in a dataframe.
integrate_to_ppi

Calculate a plan position indicator (ppi) of vertically integrated density adjusted for range effects
print.vpts

Print method for class vpts
summary.vpts

Class vpts: a time series of vertical profiles
summary.vp

Class vp: a vertical profile of animals
read_pvolfile

Read a polar volume (pvol) from file
read_vp

Read a vertical profile (vp) from file
beam_profile_overlap

Calculate overlap between a vertical profile ('vp') of biological scatterers and the vertical radiation profile emitted by the radar
sd_vvp_threshold

Get threshold of the VVP-retrieved radial velocity standard deviation
sunrise_sunset

Calculate sunrise or sunset for a time and place
plot.vpts

Plot a time series of vertical profiles (vpts)
select_vpfiles

Select vertical profile (vp) files from computer
print.ppi

Print method for class ppi
check_night

Check if it is night at a given time and place
summary.param

Class param: a parameter of a scan of a polar volume
print.pvol

Print method for class pvol
proj_to_wgs

print.param

Print method for class param
download_vpfiles

Download vertical profile (vp) files from the ENRAM data repository
download_basemap

Download a basemap for map(ppi)
update_docker

Update Docker image from Docker hub
check_radar_codes

Check if radar codes are exactly 5 characters
summary.ppi

Class ppi: a plan position indicator
is.vpfile

Check if a local file is a vertical profile (vp)
is.pvolfile

Check if a local file is a polar volume (pvol)
plot.ppi

Plot a plan position indicator (ppi)
print.scan

Print method for class scan
plot.scan

Plot a scan (scan) in polar coordinates
sd_vvp_threshold<-

Set threshold of the VVP-retrieved radial velocity standard deviation
scan_to_spatial

convert a polar scan into a spatial object.
[.vpts

Subset a time series of vertical profiles (vpts)
[.ppi

Subset a plan position indicator (ppi)
print.vp

Print method for class vp
wgs_to_proj

apply_mistnet

Apply MistNet segmentation to a polar volume
calculate_param

Calculate a new scan parameter