# \donttest{
# make sure you have installed the MistNet libraries and install if necessary:
if (requireNamespace("vol2birdR", quietly = TRUE) && vol2birdR::mistnet_installed()){
# if mistnet has not been installedi yet, run the following:
if(!vol2birdR::mistnet_exists()){
vol2birdR::install_mistnet()
vol2birdR::install_mistnet_model()
}
# start a temporary file to store polar volume
tempfile=tempfile("KBGM_example")
# Download a NEXRAD file and save as KBGM_example
download.file(
"https://noaa-nexrad-level2.s3.amazonaws.com/2019/10/01/KBGM/KBGM20191001_000542_V06",
method="libcurl", mode="wb", tempfile
)
# Calculate MistNet segmentation
mistnet_pvol <- apply_mistnet(tempfile)
# Print summary info for the segmented elevation scan at the 0.5 degree,
# verify new parameters BIOLOGY, WEATHER, BACKGROUND and CELL have been added
scan <- get_scan(mistnet_pvol, 0.5)
scan
# Project the scan as a ppi
ppi <- project_as_ppi(scan, range_max = 100000)
# Plot the reflectivity parameter
plot(ppi, param = "DBZH")
# Plot the MistNet class probability [0-1] for weather
plot(ppi, param = "WEATHER")
# Plot the MistNet class probability [0-1] for biology
plot(ppi, param = "BIOLOGY")
# Plot the final segmentation result, with values >1 indicating
# areas classified as weather, and value 1 pixels that fall within an
# additional 5 km fringe around weather areas
plot(ppi, param = "CELL")
# Remove file
file.remove(tempfile)
}
# }
Run the code above in your browser using DataLab