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

Install system libraries

For OS X and Linux the GNU Scientific Library (GSL), PROJ and HDF5 libraries need to be installed as system libraries prior to installation, which are required by dependency package vol2birdR:

SystemCommand
OS X (using Homebrew)brew install hdf5 proj gsl
Debian-based systems (including Ubuntu)sudo apt-get install libhdf5-dev libproj-dev gsl-bin libgsl-dev
Systems supporting yum and RPMssudo yum install hdf5-devel proj-devel gsl gsl-devel

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

Install bioRad

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:

# install.packages("devtools")
devtools::install_github("adokter/bioRad")

Then load the package with:

library(bioRad)
#> Welcome to bioRad version 0.8.1
#> Attempting to load MistNet from:/Users/amd427/Library/R/x86_64/4.3/library/vol2birdR/lib
#> MistNet successfully initialized.
#> using vol2birdR version 1.0.3 (MistNet installed)

(optional) Enable MistNet

To enable MistNet, the following vol2birdR commands should be executed:

vol2birdR::install_mistnet()
vol2birdR::install_mistnet_model()

Read the vol2birdR documentation for more details.

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()

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] 129491.5

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.8.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Adriaan M. Dokter

Last Published

July 30th, 2024

Functions in bioRad (0.8.1)

beam_range

Calculate radar beam range
bind_into_vpts

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

Look up day of year (doy) or night of year (noy)
bioRad-deprecated

Deprecated bioRad functions and data
convert_legacy

Convert legacy bioRad objects
c.vp

Concatenate vertical profiles (vp) into a list of vertical profiles
bioRad-package

bioRad: Biological Analysis and Visualization of Weather Radar Data
dbz_to_eta

Convert reflectivity factor (dBZ) to reflectivity (eta)
example_vp

Vertical profile (vp) example
example_scan

Scan (scan) example
calculate_param

Calculate a new scan parameter
calculate_vp

Calculate a vertical profile (vp) from a polar volume (pvol) file
check_date_format

Check if character date is in specific format
check_night

Check if it is night at a given time and place
get_elevation_angles

Get elevation angles of a polar volume (pvol), scan (scan) or parameter (param)
beam_width

Calculate radar beam width
plot.ppi

Plot a plan position indicator (ppi)
plot.scan

Plot a scan (scan) in polar coordinates
is.pvolfile

Check if a file is a polar volume (pvol)
get_iris_raw_task

Check the task type of an IRIS RAW file
is.nan.data.frame

Identify NaN in a dataframe
download_vpfiles

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

Download polar volume (pvol) files from the NEXRAD archive
get_scan

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

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

Map a plan position indicator (ppi) on a map
check_radar_codes

Check if radar codes are exactly 5 characters
composite_ppi

Create a composite of multiple plan position indicators (ppi)
sd_vvp_threshold<-

Set threshold of the radial velocity standard deviation
example_vpts

Time series of vertical profiles (vpts) example
match_filenames

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

Filter a time series of vertical profiles ('vpts') by a start and end time. Use argument night = TRUE to select only time stamps between sunset and sunrise, or night = FALSE to select daytime (sunrise to sunset). Selection for night and day uses check_night().
gaussian_beam_profile

Gaussian beam profile as a function of height
integrate_to_ppi

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

Vertically integrate profiles (vp or vpts) into an integrated profile (vpi)
project_as_ppi

Project a scan (scan) or parameter (param) to a plan position indicator (ppi)
rcs<-

Set radar cross section
read_pvolfile

Read a polar volume (pvol) from file
read_stdout

Read a time series of vertical profiles (vpts) from file
eta_to_dbz

Convert reflectivity (eta) to reflectivity factor (dBZ)
sd_vvp_threshold

Get threshold of the radial velocity standard deviation
is.vpfile

Check if a file is a vertical profile (vp)
get_param

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

Check the data type of an ODIM HDF5 file
[.ppi

Subset a plan position indicator (ppi)
scan_to_raster

convert a polar scan into a raster
scan_to_spatial

convert a polar scan into a spatial object.
summary.param

Inspect a parameter (param)
summary.scan

Inspect a scan (scan)
read_vpts

Read time series of vertical profiles (vpts) from file(s)
list_vpts_aloft

List aloft urls for time series of vertical profiles (vpts) of radar stations
plot.vpts

Plot a time series of vertical profiles (vpts)
regularize_vpts

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

A wrapper for sp::spTransform(). Converts projected coordinates to geographic (WGS84) coordinates.
select_vpfiles

Select vertical profile (vp) files from computer
plot.vp

Plot a vertical profile (vp)
extract_string

extract strings from a vector using regex, analog to stringr::str_extract
skip_if_no_aws.s3

Skip test if no aws.s3
summary.vp

Inspect a vertical profile (vp)
vpts_schema

ENRAM-defined VPTS schema
vplist_to_vpts

Bind vertical profiles (vp) into time series (vpts)
summary.ppi

Inspect a plan position indicator (ppi)
summary.vpi

Inspect an integrated profile (vpi)
summary.pvol

Inspect a polar volume (pvol)
summary.vpts

Inspect a time series of vertical profiles (vpts)
nexrad_to_odim

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

Calculate sunrise or sunset for a time and place
read_vp

Read a vertical profile (vp) from file
nyquist_velocity

Calculate Nyquist velocity for a given pulse repetition frequency (PRF)
read_vpfiles

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

Read a vertical profile (vp) from UMASS Cajun text file
rcs

Get radar cross section
skip_if_no_tidyselect

Skip test if no tidyselect
skip_if_no_vol2birdR

Skip test if vol2birdR not installed
plot.vpi

Plot an integrated profile (vpi)
write_pvolfile

Write a polar volume (pvol) object to ODIM HDF5 file
wgs_to_proj

A wrapper for sp::spTransform(). Converts geographic (WGS84) coordinates to a specified projection
skip_if_no_mapping

Skip test if missing dependencies for mapping
skip_if_no_mistnet

Skip test if no mistnet
tidyverse

Tidyverse methods for bioRad objects
beam_distance

Calculate radar beam distance
add_expected_eta_to_scan

Adds expected eta to a scan
attribute_table

Extract a volume coverage pattern table with all attributes
beam_height

Calculate radar beam height
apply_mistnet

Apply MistNet segmentation to a polar volume
as.vpts

Convert a dataframe into a vpts object
as.data.frame.vp

Convert a vertical profile (vp) or time series of vertical profiles (vpts) to a data frame
beam_profile

Calculate vertical radiation profile
Math.scan

Mathematical and arithmetic operations on param's, scan's and pvol's
beam_profile_overlap

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