-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rename / refactor / deprecate scan_to_spdf #293
Comments
Should we use |
I can see the point of not having setwd('~/bioRad')
devtools::load_all()
#> Loading bioRad
#> Welcome to bioRad version 0.5.0.9289
#> Docker daemon running, Docker functionality enabled (vol2bird version 0.5.0)
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
# when working with rasters the following approach can be used:
template_raster<-raster::raster(raster::extent(12,13,56,57), crs=sp::CRS('+proj=longlat'))
microbenchmark::microbenchmark(times=5,
my_ppi<-integrate_to_ppi(example_pvol, example_vp, res=template_raster) ,
my_ppi<-integrate_to_ppi_spdf(example_pvol, example_vp, res=template_raster)
)
#> Unit: seconds
#> expr
#> my_ppi <- integrate_to_ppi(example_pvol, example_vp, res = template_raster)
#> my_ppi <- integrate_to_ppi_spdf(example_pvol, example_vp, res = template_raster)
#> min lq mean median uq max neval cld
#> 2.586905 2.600590 4.603803 3.418319 3.950116 10.463086 5 a
#> 1.260590 1.282675 2.162907 2.179974 2.685364 3.405934 5 a
template_raster<-raster::raster(raster::extent(12,13,56,57), crs=sp::CRS('+proj=longlat'), res=.01)
microbenchmark::microbenchmark(times=5,
my_ppi<-integrate_to_ppi(example_pvol, example_vp, res=template_raster) ,
my_ppi<-integrate_to_ppi_spdf(example_pvol, example_vp, res=template_raster)
)
#> Unit: seconds
#> expr
#> my_ppi <- integrate_to_ppi(example_pvol, example_vp, res = template_raster)
#> my_ppi <- integrate_to_ppi_spdf(example_pvol, example_vp, res = template_raster)
#> min lq mean median uq max neval cld
#> 3.090922 3.152694 3.485145 3.160893 3.217325 4.803889 5 b
#> 1.322290 1.392180 1.412335 1.413996 1.415329 1.517883 5 a
require(uvaRadar)
#> Loading required package: uvaRadar
example_pvol<-get_pvol('NL/HRW')
example_vp<-get_vp('NL/HRW')
template_raster<-raster::raster(raster::extent(5,6,51,52), crs=sp::CRS('+proj=longlat'), res=.01)
microbenchmark::microbenchmark(times=5,
my_ppi<-integrate_to_ppi(example_pvol, example_vp, res=template_raster) ,
my_ppi<-integrate_to_ppi_spdf(example_pvol, example_vp, res=template_raster)
)
#> Warning in integrate_to_ppi(example_pvol, example_vp, res = template_raster):
#> ignoring 90 degree birdbath scan
#> Warning in integrate_to_ppi(example_pvol, example_vp, res = template_raster):
#> ignoring 90 degree birdbath scan
#> Warning in integrate_to_ppi(example_pvol, example_vp, res = template_raster):
#> ignoring 90 degree birdbath scan
#> Warning in integrate_to_ppi(example_pvol, example_vp, res = template_raster):
#> ignoring 90 degree birdbath scan
#> Warning in integrate_to_ppi_spdf(example_pvol, example_vp, res =
#> template_raster): ignoring 90 degree birdbath scan
#> Warning in integrate_to_ppi_spdf(example_pvol, example_vp, res =
#> template_raster): ignoring 90 degree birdbath scan
#> Warning in integrate_to_ppi_spdf(example_pvol, example_vp, res =
#> template_raster): ignoring 90 degree birdbath scan
#> Warning in integrate_to_ppi_spdf(example_pvol, example_vp, res =
#> template_raster): ignoring 90 degree birdbath scan
#> Warning in integrate_to_ppi_spdf(example_pvol, example_vp, res =
#> template_raster): ignoring 90 degree birdbath scan
#> Warning in integrate_to_ppi(example_pvol, example_vp, res = template_raster):
#> ignoring 90 degree birdbath scan
#> Unit: seconds
#> expr
#> my_ppi <- integrate_to_ppi(example_pvol, example_vp, res = template_raster)
#> my_ppi <- integrate_to_ppi_spdf(example_pvol, example_vp, res = template_raster)
#> min lq mean median uq max neval cld
#> 15.195955 15.855693 16.328769 16.644581 16.668140 17.279474 5 b
#> 4.984612 5.084243 5.792908 5.967457 6.027665 6.900564 5 a Created on 2020-02-05 by the reprex package (v0.3.0) |
sounds good |
Hi @bart1, but Lines 216 to 220 in 9d89575
The main difference difference with
A solution may be to refactor |
makes me wonder if |
The pvol to raster function makes sense, I have been thinking of doing something like that but then to require(raster)
#> Loading required package: raster
#> Loading required package: sp
b <- brick(system.file("external/rlogo.grd", package="raster"))
names(b)<-c('DBZH', 'TH', 'VRADH')
b<-brick(list(b,b))
b<-setZ(b,rep(c(.5,.8), each=3),'elevationAngle')
b
#> class : RasterBrick
#> dimensions : 77, 101, 7777, 6 (nrow, ncol, ncell, nlayers)
#> resolution : 1, 1 (x, y)
#> extent : 0, 101, 0, 77 (xmin, xmax, ymin, ymax)
#> crs : +proj=merc +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
#> source : memory
#> names : DBZH.1, TH.1, VRADH.1, DBZH.2, TH.2, VRADH.2
#> min values : 0, 0, 0, 0, 0, 0
#> max values : 255, 255, 255, 255, 255, 255
#> elevationAngle: 0.5, 0.5, 0.5, 0.8, 0.8, 0.8 But I find the usage of names like Maybe we can make scan_to_raster not use |
I avoided changes to |
That would be a nice solution |
True, so maybe wait for a moment when we feel like porting to |
I now kind of realize what makes this a bit more involved, since after re projecting the raster is not a grid anymore (X and Y distances are not equal/uniform) it would be required for |
right ... but parsing a list of points to the The use case for That makes me think we have to write a |
I think we ultimately need a |
Let's keep |
I think this is better solved when moving to |
scan_to_spdf
? It's a helper function that is used inintegrate_to_ppi
for projecting a scan onto a pre-defined grid. Why can't we use the existingscan_to_raster()
function for that?note that rasterToPoints() used in the statement where you call
scan_to_spdf
throws out any raster points with NA values, is that the desired behaviour? If so, please explain in documentation.Could you add a user example to the roxygen documentation, preferably using bioRad's native
example_scan
object or theexample_pvol
object that can be loaded as follows:Instead of recycling the
res
argument for parsing user-definable rasters, I think it's better to introduce a new input parameter for this, and clarify in the documentation that when specified it overrides res and other arguments.any requirements for the user-definable raster? like CRS requirements?
The text was updated successfully, but these errors were encountered: