# NOT RUN {
# locate example polar volume file:
pvolfile <- system.file("extdata", "volume.h5", package = "bioRad")
# load polar volume
example_pvol <- read_pvolfile(pvolfile)
# load the corresponding vertical profile for this polar volume
data(example_vp)
# calculate the range-corrected ppi on a 50x50 pixel raster
my_ppi <- integrate_to_ppi(example_pvol, example_vp, nx = 50, ny = 50)
# plot the vertically integrated reflectivity (VIR) using a 0-2000 cm^2/km^2 color scale:
plot(my_ppi, zlim = c(0, 2000))
# }
# NOT RUN {
# calculate the range-corrected ppi on finer 2000m x 2000m pixel raster:
my_ppi <- integrate_to_ppi(example_pvol, example_vp, res = 2000)
# plot the vertically integrated density (VID) using a 0-200 birds/km^2 color scale:
plot(my_ppi, param = "VID", zlim = c(0, 200))
# to overlay ppi objects on a background map, first
# download a basemap, and map the ppi:
bm <- download_basemap(my_ppi)
map(my_ppi, bm)
# the ppi can also be projected on a user-defined raster, as follows:
# first define the raster:
template_raster <- raster::raster(raster::extent(12, 13, 56, 57), crs = sp::CRS("+proj=longlat"))
# project the ppi on the defined raster:
my_ppi <- integrate_to_ppi(example_pvol, example_vp, raster = template_raster)
# extract the raster data from the ppi object:
raster::brick(my_ppi$data)
# calculate the range-corrected ppi on an even finer 500m x 500m pixel raster,
# cropping the area up to 50000 meter from the radar.
my_ppi <- integrate_to_ppi(example_pvol, example_vp,
res = 500,
xlim = c(-50000, 50000), ylim = c(-50000, 50000)
)
plot(my_ppi, param = "VID", zlim = c(0, 200))
# }
Run the code above in your browser using DataLab