Skip to content
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

bird insect partitioning and post-hoc precipitation filter #698

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
720046b
add prototype clean_mixture function
adokter Mar 12, 2024
0768d8b
add documentation
adokter Mar 12, 2024
0c9d859
add assertions
adokter Mar 12, 2024
db10191
update to new formulation in paper
adokter Jun 3, 2024
a75688b
Merge branch 'master' into bird_insect_mixture
adokter Aug 26, 2024
52d339c
add vp and vpts method for clean_mixture
adokter Aug 26, 2024
effb25c
add missing arguments, rebuild documentation
adokter Aug 27, 2024
d6bd140
fix access to rcs attribute
adokter Aug 27, 2024
da72750
expand examples
adokter Aug 27, 2024
633c74b
add posthoc precipitation filter
adokter Aug 29, 2024
0903089
update defaults
adokter Sep 13, 2024
16f664c
Merge branch 'master' into bird_insect_mixture
adokter Sep 24, 2024
cc5ba25
Merge branch 'master' into bird_insect_mixture
adokter Oct 1, 2024
886261c
Merge branch 'master' into bird_insect_mixture
adokter Jan 16, 2025
557662d
fix type of gap field
adokter Feb 26, 2025
2ccba65
add as.vp() function
adokter Feb 26, 2025
58ce948
update documentation clean_mixture() and add tests
adokter Feb 26, 2025
c91a494
Merge branch 'master' into bird_insect_mixture
adokter Feb 26, 2025
f6f3e8a
update news
adokter Feb 26, 2025
60101bf
Merge branch 'bird_insect_mixture' of https://github.com/adokter/bioR…
adokter Feb 26, 2025
4f3056f
add missing functions
adokter Feb 26, 2025
e961351
fix devtools::check() notes and warnings
adokter Feb 27, 2025
9d2ce32
update news
adokter Feb 27, 2025
af0e181
fix yaml
adokter Feb 27, 2025
aa51101
fix typo
adokter Feb 27, 2025
a67e89c
small documentation improvements
adokter Feb 27, 2025
77ef402
documentation fix [skip actions]
adokter Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions R/as.vp.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#' Convert a dataframe into a vp object
#'
#' @param data a dataframe created from a VPTS CSV file
#' @returns a bioRad vp object
#' @examples
#' # load vp data as a data.frame:
#' df <- as.data.frame(example_vp)
#' # convert the data.frame to a vp object:
#' as.vp(df)
#' @export
as.vp <- function(data) {
assertthat::assert_that(inherits(data,"data.frame"))

vpts <- as.vpts(data)

assertthat::assert_that(length(vpts$datetime) == 1, msg="multiple timestamps found, data is not a single vertical profile")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to extent this check to if height bins are duplicated. Also do height bins need to be regularly spaced?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe those checks are performed already by as.vpts() which is used under the hood, but I'll double check

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rows can be removed, so no check for regular spacing currently:

df=as.data.frame(example_vp, suntime=F)
as.vp(df[-5,])

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related to #697, which requires a fix before next release


vpts_to_vp(vpts)
}
23 changes: 23 additions & 0 deletions man/as.vp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/testthat/test-as.vp.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test_that("as.vp() returns valid data", {
df <- as.data.frame(example_vp, suntime=FALSE)
expect_s3_class(as.vp(df), "vp")
df <- as.data.frame(example_vpts, suntime=FALSE)
expect_error(as.vp(df),"not a single vertical profile")
})