Closed adokter closed 6 years ago
See https://github.com/adokter/bioRad/issues/51#issuecomment-374747768 for how to handle deprecation/renaming of arguments such that package remains backward compatible
This issue is related to issue #94. I noticed some functions have been ticked there, even when their parameter names are not optimal (e.g. containing dots)
Agreed, it is something we should tackle: I’ll add a todo list to this issue.
Ok for creating branch and contacting editor. Would be nice if #108 and #117 are accepted and included.
Updated #94: that should only concern documentation, not parameters.
@adokter, we'll let you make a suggestion for standardized and logical parameter names, before we provide further input.
beam_width(range, beam_angle = 1)
calculate_vp(pvolfile, vpfile = "", pvolfile_out = "", autoconf = FALSE, verbose = FALSE, mount = dirname(pvolfile), sd_vvp_threshold = 2, rcs = 11, dual_pol = FALSE, rho_hv = 0.95, elev_min = 0, elev_max = 90, azim_min = 0, azim_max = 360, range_min = 5000, range_max = 25000, n_layer = 20L, h_layer = 200, dealias = TRUE, nyquist_min = if (dealias) 5 else 25, dbz_quantity = "DBZH")
composite_ppi(x, quantity = "DBZH", dim = c(100, 100))
param <-> quantitydbz_to_eta(dbz, wavelength, K = 0.93)
eta_to_dbz(eta, wavelength, K = 0.93)
get_scan(x, elev)
integrate_profile(x, alt_min, alt_max, alpha = NA, interval_max = Inf)
integrate_profile(x, alt_min = 0, alt_max = Inf, alpha = NA, interval_max = Inf)
integrate_profile(x, alt_min = 0, alt_max = Inf, alpha = NA, interval_max = Inf)
integrate_profile(x, alt_min = 0, alt_max = Inf, alpha = NA, interval_max = Inf)
map(x, map, quantity, alpha = 0.7, xlim, ylim, zlim = c(-20, 20), ratio, radar_size = 3, radar_color = "red", n_color = 1000, ...)
param <-> quantitynexrad_to_odim(pvolfile_nexrad, pvolfile_odim, verbose = FALSE, mount = dirname(pvolfile_nexrad))
plot(x, quantity, xlim, ylim, zlim = c(-20, 20), ratio = 1, ...)
param <-> quantityplot(x, quantity, xlim = c(0, 100), ylim = c(0, 360), zlim = c(-20, 20), ...)
param <-> quantityplot(x, quantity = "dens", xlab = expression("volume density [#/km"^3 * "]"), ylab = "height [km]", line_col = "red", line_lwd = 1, ...)
here quantity is used in implementationplot(x, quantity = "mtr", xlab = "time", ylab = "migration traffic rate [#/km/h]", main = "MTR", night_shade = TRUE, elev = -0.268, lat = NULL, lon = NULL, ylim = NULL, ...)
here quantity is used in implementationplot(x, xlab = "time", ylab = "height [m]", quantity = "dens", log = T, barbs = T, barbs_height = 10, barbs_time = 20, barbs_dens_min = 5, zlim, legend_ticks, main, ...)
here quantity is used in implementationproject_as_ppi(x, grid_size = 500, range_max = 50000, project = FALSE, ylim = NULL, xlim = NULL)
project_as_ppi(x, grid_size = 500, range_max = 50000, project = FALSE, ylim = NULL, xlim = NULL)
project_as_ppi(x, grid_size = 500, range_max = 50000, project = FALSE, ylim = NULL, xlim = NULL)
is.pvolfile(file)
get_odim_object_type(file)
read_pvolfile(file, param = c("DBZH", "VRADH", "VRAD", "RHOHV", "ZDR", "PHIDP", "CELL"), sort = TRUE, lat, lon, height, elev_min = 0, elev_max = 90, verbose = TRUE, mount = dirname(filename))
regularize_vpts(ts, interval = "auto", date_min = ts$daterange[1], date_max = ts$daterange[2], units = "mins", fill = FALSE, verbose = TRUE)
sd_vvp(x) <- value
not sure what to changesd_vvp(x)
not sure what to changeselect_vpfiles(directory, date_min, date_max, country = NULL, radar = NULL)
is.vpfile(file)
color_scale(quantity, zlim)
param <-> quantitycolor_scale_fill(quantity, zlim)
param <-> quantityadd_color_transparency(color, alpha = 1)
earth_radius(a, b, lat)
get_zlim(quantity)
param <-> quantitynexrad_to_odim_tempfile(pvolfile, verbose = FALSE, mount = dirname(pvolfile))
sample_polar(quantity, grid_size, range_max, project, latlim, lonlim)
here quantity is used in implementationpolar_to_index(coords_polar, rangebin = 1, azimbin = 1)
is.odimfile(file)
read_pvolfile_scan(file, scan, param, radar, datetime, geo)
read_pvolfile_quantity(file, quantity, radar, datetime, geo)
read_vp(file)
: function should be hidden@peterdesmet @stijnvanhoey Any chance you can have a look at this before the training school in Oklahoma starting August 14? I'd like to push for a new release by then with corrected function arguments.
Hi @adokter I created a file with all the parameters for all functions: parameters.txt. Makes it easier to compare these. Here's my review:
Be consistent with underscore:
min
/max
use underscore 👍👍azimbin
-> azim_bin
(cf. azim_min
/azim_max
)rangebin
-> range_bin
(cf. range_min
/range_max
)Use underscore where it might make sense (i.e. these parameters don't have an underscore yet, but it would makes sense to do it). These are suggestions:
row.names
-> row_names
indexx
-> index_x
indexy
-> index_y
latdeg
-> lat
Adriaan: I'm not sure about the changes below, because many of R's default functions use xlab, xlim etc. Many people are there very much used to it. I added latlim/lonlim myself to match the R convention. lab stands for label. Maybe @stijnvanhoey can weigh on this as well? > Keep as is.
latlim
-> lat_lim
lonlim
-> lon_lim
xlab
-> x_lab
lab
stand for? > label)xlim
-> x_lim
ylab
-> y_lab
ylim
-> y_lim
zlim
-> z_lim
What is the difference between (should they get the same name?):
proj4string
vs project
file
vs filename
should be the samefiles
vs filelist
should be the sameK
vs k
localpath
vs path
should be the samere
vs regexlist
Unintuitive names:
sign_angle
autoconf
line_lwd
: lwd?rho_hv
rp
ts
vps
Maybe write in full:
coords
-> coordinates
coords_polar
-> coordinates_polar
okThanks @peterdesmet, added some thoughts in italic
Ok!
row.names
: okxlab
and co: fine to keep as is. @stijnvanhoey is on holidayproj4string
: if part of proj4, maybe call it proj4_string
then? Adriaan: I would stick with proj4string, this is the argument that is also used in the widely used sp package.file
then? Adriaan: OKfiles
then? Adriaan: Or also file
for consistency? E.g. in read_vpfiles can also be used to read a single file.path
or maybe directory
(to differentiate from file
) then? Adriaan: ok, no preferencecoords_polar
: would only update if we change coords
as well, so best to keep it as is. Adriaan: ok, it's a hidden function anyhow, so not very importantSounds good these names, added comments in your comment above
proj4string
: ok to keep5/6. I would keep the difference between file
and files
. Using file
for all makes it less clear which functions do support more than a single file (and not all functions do). For those that do support more, I think files
is intuitive enough that you can supply a list of one. Note regarding filename
vs file
: readr also uses file
, which aligns nicely. 👍 Combined with directory
, we would get:
download_vpfiles(start_date, end_date, country, radar, directory = ".")
is.pvolfile(file)
get_odim_object_type(file)
read_pvolfile(file, ...)
read_vpfiles(files)
read_vpts(file, ...)
read_vpfiles(files)
read_vpts(file, ...)
select_vpfiles(directory, ...)
is.vpfile(file)
# internal
is.odimfile(file)
read_pvolfile_scan(file, ...)
read_pvolfile_quantity(file, ...)
read_vp(file)
quantity_name(file, ...)
read_odim_profile_data(file, ...)
match_filenames((filelist, regexlist)) # this is an internal function, I would keep the arguments as such, maybe but with underscore
col
to color
in the internal function add_color_transparency(col, alpha = 1)
If you agree, can you update the list at https://github.com/adokter/bioRad/issues/112#issuecomment-394833402, so we have an overview of what needs to be changed?
Update the list at https://github.com/adokter/bioRad/issues/112#issuecomment-394833402. Only check items have changes
For the project_as_ppi
, we adapted latlim
and lonlim
to ylim
and xlim
respectively, but here we keep the lat
and lon
description? Keep that as such of should we always use either y/x or lat/lon?
Regarding the param
versus quantity
usage as argument, I do think we are introducing some inconsistencies with the above proposed set:
param.R # scan parameter
read_pvolfile.R: read_pvolfile(file, param,...) # scan parameter
composite_ppi(x, quantity = "DBZH",...) # scan parameter <- ISSUE
get_quantity(...) # quantity of a vp/vpts
map.R: map(x, map, quantity,...) # scan parameter <- ISSUE
plot.ppi.R: plot(x, quantity,...) # scan parameter <- ISSUE
plot.scan.R: plot(x, quantity,...) # scan parameter <- ISSUE
plot.vp.R: plot(x, quantity = "dens",...) # quantity of a vp/vpts
plot.vpi.R: plot(x, quantity = "mtr",...) # quantity
plot.vpts.R: plot(x, xlab = "time", ylab = "height [m]", quantity,...) # quantity
color_scale.R: color_scale(quantity,... <- ISSUE
color_scale.R: color_scale_fill(quantity,... <- ISSUE
map.R: get_zlim(quantity) <- ISSUE
sample_polar(quantity,... <- ISSUE
For each of the items with <- ISSUE
I will NOT use quantity
as argument, but param
, corresponding to the scan parameter see https://github.com/adokter/bioRad/commit/985884d1ee29544668036105d9cc1d85fb234751
Notice, in the overview the functionsd_vvp
is defined, but the function has been renamed to sd_vvp_threshold
https://github.com/adokter/bioRad/commit/34e42a2ca869687436e4c9b3d978bf872b62fbcb
Regarding param
versus quantity
in https://github.com/adokter/bioRad/issues/112#issuecomment-409850808, it might actually be more easy for users to always have quantity
, the difference between a scan parameter or a derived quantity is pretty subtle, and most people might not understand it.
https://github.com/adokter/bioRad/issues/112#issuecomment-409827982: you're right this might be confusing. I would be ok with replacing latlim
with ylim
and lonlim
with xlim
While implementing and checking docs etc. I felt having a difference between the scan parameters according to the OPERA data information versus vp/vpts/... quantities is less confusing than quantities everywhere (more intuition than real argument). @peterdesmet any thoughts?
I think we have had the param
vs quantity
argument before and opted to keep param
as that is the (unchangeable) name that is used in a pvol file: pvol > scan > param
?
There might be some gain in using a single name for param
/quantity
, but not sure how much. I notice that in the bird profile things are called quantity
. @adokter I'll let you decide this one.
Note: I have updated https://github.com/adokter/bioRad/issues/112#issuecomment-394833402 to only include those functions that we change (you can still see the full list at the beginning of this issue or in the version history of the comment). I'll check them off when reviewing https://github.com/adokter/bioRad/pull/127.
@peterdesmet @stijnvanhoey I think we have to go with quantity
only. Currently indeed we have quantity
refer to different data columns in a vp
, and param
refer to different data sweeps in a scan
. But these get mixed up already, e.g. we have DBZH
as a quantity in a vp, but also as a param in a scan. Also, I might add in the future the option to plot scan parameters like DBZH as a transformed quantity (e.g. as reflectivity eta, which is currently only a quantity in a profile).
In short: the two are getting mixed up already, so I think the least confusing is to stick to one.
Makes sense, “quantity” it is. @stijnvanhoey, can you update this in #127? @adokter, does this affect the figure/text in the paper?
So, if we only keep quantity
, what happens with the file param.R
?
#' Object of class \code{param}: a parameter of a scan of a polar volume
#'
...
#' @details
#' Scan parameters are simple matrices, with the following specific attributes:
will this become a quantity
class? and do we speak about Scan quantities are...
?
I do think the class param
is counterintuitive with using scan quantities.
@adokter https://github.com/adokter/bioRad/pull/127 was merged, but there is still the open issue of scan param vs quantity to be resolved. Let us know what you decide.
Hi @peterdesmet, you're right that one is still open, @stijnvanhoey got me doubting again. Letting go of param breaks the OPERA/ODIM convention, which formed the backbone of the naming conventions. So I'm hesitant to introduce scan quantities
when OPERA uses scan parameters
. So there is sense in keeping param strictly for the quantities in the low-level data after all (polar volumes and scans), as you wrote in https://github.com/adokter/bioRad/issues/112#issuecomment-411070067, and use quantity strictly for data columns in profiles, and for derived/transformed quantities.
I already have (soon to be included in bioRad) functionality that makes rasters (stored as ppi objects) of derived quantities (i.e. raster images of vertically integrated bird density, using information of multiple elevations scans to make one image). However, these ppi's always have only one quantity in the raster, therefore there is no need to specify a quantity/param argument when plotting them with map
or plot.ppi
. A ppi with multiple raster layers in fact only occurs now when making a ppi of a scan, and these only contain params.
So I think we can keep param, and nothing needs to be changed.
Here a listing of functions with param/quantity arguments for future reference
color_scale
: param (ok for now, has only param color scales)color_scale_fill
: param (ok for now, has only param color scales)composite_ppi
: parammap
: paramget_zlim
: param (ok for now, checks only param scales)plot.ppi
: paramplot.scan
: paramplot.vp
: quantityplot.vpi
: quantitysample_polar
: paramthink we can close this one:)
So far we have focussed on renaming the function names, but the function argument names also need improvements. E.g.
integrate_profile
hasalt.min
argument, which still has the dot convention we want to deprecate. This is still quite a lot of work..., but I think we cannot push anything to master until this is done.We could contact the editors of Ecograpy to forward install instructions to the editors of the paper to a branch that has not yet renamed arguments, only function names. Then we don't have to release to the public yet and have more time.
Functions
beam_height(range, elev, k = 4/3, lat = 35, re = 6378, rp = 6357)
beam_width(range, angle = 1)
bind_into_vpts(x, ...)
bind_into_vpts(...)
bind_into_vpts(x, ...)
bind_into_vpts(..., attributes_from = 1)
calculate_vp(vol.in, vp.out = "", vol.out = "", autoconf = FALSE, verbose = FALSE, mount = dirname(vol.in), sd_vvp = 2, rcs = 11, dualpol = FALSE, rhohv = 0.95, elev.min = 0, elev.max = 90, azim.min = 0, azim.max = 360, range.min = 5000, range.max = 25000, nlayer = 20L, hlayer = 200, dealias = TRUE, nyquist.min = if (dealias) 5 else 25)
check_night(x, ..., elev = -0.268)
check_night(lon, lat, date, elev = -0.268)
check_night(x, ..., elev = -0.268)
check_night(x, ..., elev = -0.268)
check_night(x, ..., elev = -0.268)
check_night(x, ..., elev = -0.268)
composite_ppi(x, param = "DBZH", cells.dim = c(100, 100))
dbz_to_eta(dbz, wavelength, Km = 0.93)
eta_to_dbz(eta, wavelength, Km = 0.93)
check_docker(verbose = TRUE)
update_docker()
download_basemap(x, verbose = TRUE, zoom, alpha = 1, ...)
download_vpfiles(start_date, end_date, country, radar, localpath = ".")
get_elevation_angles(x)
get_elevation_angles(x)
get_elevation_angles(x)
get_quantity(x, quantity)
get_quantity(x, quantity = "dens")
get_quantity(x, quantity = "dens")
get_quantity(x, quantity = "dens")
get_scan(x, angle)
integrate_profile(x, alt.min, alt.max, alpha = NA, interval.max = Inf)
integrate_profile(x, alt.min = 0, alt.max = Inf, alpha = NA, interval.max = Inf)
integrate_profile(x, alt.min = 0, alt.max = Inf, alpha = NA, interval.max = Inf)
integrate_profile(x, alt.min = 0, alt.max = Inf, alpha = NA, interval.max = Inf)
map(x, ...)
map(x, map, param, alpha = 0.7, xlim, ylim, zlim = c(-20, 20), ratio, radar.size = 3, radar.color = "red", n.color = 1000, ...)
nexrad_to_odim(vol.in, vol.out, verbose = FALSE, mount = dirname(vol.in))
summary(object, ...)
is.param(x)
print(x, digits = max(3L, getOption("digits") - 3L), ...)
plot(x, param, xlim, ylim, zlim = c(-20, 20), ratio = 1, ...)
plot(x, param, xlim = c(0, 100), ylim = c(0, 360), zlim = c(-20, 20), ...)
plot(x, quantity = "dens", xlab = expression("volume density [#/km"^3 * "]"), ylab = "height [km]", line.col = "red", line.lwd = 1, ...)
plot(x, quantity = "mtr", xlab = "time", ylab = "migration traffic rate [#/km/h]", main = "MTR", nightshade = TRUE, elev = -0.268, lat = NULL, lon = NULL, ylim = NULL, ...)
plot(x, xlab = "time", ylab = "height [m]", quantity = "dens", log = T, barbs = T, barbs.h = 10, barbs.t = 20, barbs.dens = 5, zlim, legend.ticks, main, ...)
[(x, i)
print(x, digits = max(3L, getOption("digits") - 3L), ...)
summary(object, ...)
is.ppi(x)
dim(x)
project_as_ppi(x, cellsize = 500, range.max = 50000, project = FALSE, latlim = NULL, lonlim = NULL)
project_as_ppi(x, cellsize = 500, range.max = 50000, project = FALSE, latlim = NULL, lonlim = NULL)
project_as_ppi(x, cellsize = 500, range.max = 50000, project = FALSE, latlim = NULL, lonlim = NULL)
summary(object, ...)
is.pvol(x)
print(x, digits = max(3L, getOption("digits") - 3L), ...)
is.pvolfile(filename)
get_odim_object_type(filename)
rcs(x) <- value
rcs(x)
read_pvolfile(filename, param = c("DBZH", "VRADH", "VRAD", "RHOHV", "ZDR", "PHIDP", "CELL"), sort = TRUE, lat, lon, height, elangle.min = 0, elangle.max = 90, verbose = TRUE, mount = dirname(filename))
read_vpfiles(files)
read_vpts(file, radar, wavelength = "C")
regularize_vpts(ts, interval = "auto", t.min = ts$daterange[1], t.max = ts$daterange[2], units = "mins", fill = FALSE, verbose = TRUE)
rvsd(x) <- value
rvsd(x)
summary(object, ...)
is.scan(x)
dim(x)
print(x, digits = max(3L, getOption("digits") - 3L), ...)
select_vpfiles(path, start_date, end_date, country = NULL, radar = NULL)
sunrise(lon, lat, date, elev = -0.268)
sunset(lon, lat, date, elev = -0.268)
summary(object, ...)
is.vp(x)
dim(x)
print(x, digits = max(3L, getOption("digits") - 3L), ...)
as.data.frame(x, row.names = NULL, optional = FALSE, quantities = names(x$data), suntime = TRUE, geo = TRUE, elev = -0.268, lat = NULL, lon = NULL, ...)
c(...)
is.vpfile(filename)
summary(object, ...)
is.vpts(x)
dim(x)
[(x, i)
print(x, digits = max(3L, getOption("digits") - 3L), ...)
as.data.frame(x, row.names = NULL, optional = FALSE, quantities = names(x$data), suntime = TRUE, geo = TRUE, elev = -0.268, lat = NULL, lon = NULL, ...)
Internal functions
color_scale(param, zlim)
color_scale_fill(param, zlim)
add_color_transparency(col, alpha = 1)
earth_radius(a, b, latdeg)
vplist_to_vpts(x, radar = NA)
vp_to_vpts_helper(vps)
mount_docker_container(mount = "~/")
check_url_existence(url)
get_zlim(param)
nexrad_to_odim_tempfile(vol.in, verbose = FALSE, mount = dirname(vol.in))
sample_polar(param, cellsize, range.max, project, latlim, lonlim)
wgs_to_proj(lon, lat, proj4string)
proj_to_wgs(x, y, proj4string)
cartesian_to_polar(coords, elev = 0)
safe_subset(data, indexx, indexy)
polar_to_index(coords.polar, rangebin = 1, azimbin = 1)
is.odimfile(filename)
read_pvolfile_scan(filename, scan, param, radar, datetime, geo)
read_pvolfile_quantity(filename, quantity, radar, datetime, geo)
read_vp(filename)
: function should be hiddenquantity_name(file, group)
read_odim_profile_data(file, group)
match_filenames((filelist, regexlist))
get_suntime(lon, lat, date, sign_angle, elev = -0.268)
vpts_to_vp(x, i)