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

VP and VPTS object use 0/1 rather than false/true for gap #635

Open
peterdesmet opened this issue Sep 12, 2023 · 4 comments
Open

VP and VPTS object use 0/1 rather than false/true for gap #635

peterdesmet opened this issue Sep 12, 2023 · 4 comments
Assignees
Milestone

Comments

@peterdesmet
Copy link
Collaborator

VPTS CSV defines gap as a boolean, with true and false values. In ODIM bird profile, gap is an integer, with 1 and 0 values.

bioRad converts gap from incoming data (via read_vpfiles() or read_vpts()) to 0 and 1, but I would argue to follow the VPTS CSV specs and use false and true. Note that we already have day as another boolean field.

library(bioRad)
library(dplyr)
# # https://aloftdata.s3-eu-west-1.amazonaws.com/baltrad/hdf5/dkste/2023/09/03/dkste_vp_20230903T000000Z_0xf0040b.h5
# vp <- read_vpfiles("dkste_vp_20230903T000000Z_0xf0040b.h5")
# vp %>% as.data.frame() %>% head() %>% select(gap)

vpts <- read_vpts("https://aloftdata.s3-eu-west-1.amazonaws.com/baltrad/daily/dkste/2023/dkste_vpts_20230903.csv")
vpts %>% as.data.frame() %>% head() %>% select(gap)
#>   gap
#> 1   0
#> 2   0
#> 3   0
#> 4   0
#> 5   1
#> 6   1

Created on 2023-09-12 with reprex v2.0.2

Note that e.g. the column day uses boolean values already.

@bart1
Copy link
Collaborator

bart1 commented Sep 12, 2023

boolean seems more logical to me

@adokter
Copy link
Owner

adokter commented Sep 12, 2023

Seems we have lost the boolean type along the way, since the example object example_vpts still has gap as a boolean. So let's restore it to what it was.

@adokter
Copy link
Owner

adokter commented Sep 12, 2023

function vol2birdR::vol2bird() does write a boolean in VPTS CSV format, but it stores gap as a float in .h5 format. In both cases bioRad function read_vpts() returns 1/0:

pvolfile <- system.file("extdata", "volume.h5", package = "bioRad")
vpout_csv=tempfile(fileext=".csv")
vpout_h5=tempfile(fileext=".h5")
vol2birdR::vol2bird(pvolfile, vpfile=vpout_csv)
vol2birdR::vol2bird(pvolfile, vpfile=vpout_h5)
vpts_h5=read_vpts(vpout_h5)
vpts_csv=read_vpts(vpout_csv)

# 0/1 output, not boolean:
vpts_csv$data$gap 

# 0/1 output, not boolean:
vpts_h5$data$gap

@adokter
Copy link
Owner

adokter commented Sep 12, 2023

fixes are needed to both read_vpts_csv() and read_vpts_hdf5() (which calls read_vpfiles()), assigning to @iskandari who worked on these recently

@adokter adokter removed their assignment Sep 29, 2023
@adokter adokter added this to the 1.0.0 milestone Sep 29, 2023
@adokter adokter modified the milestones: 1.0.0, 0.7.3 Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants