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

Combining hdf5 and csv VP files #653

Open
CeciliaNilsson709 opened this issue Feb 9, 2024 · 1 comment
Open

Combining hdf5 and csv VP files #653

CeciliaNilsson709 opened this issue Feb 9, 2024 · 1 comment
Assignees
Milestone

Comments

@CeciliaNilsson709
Copy link
Collaborator

CeciliaNilsson709 commented Feb 9, 2024

I downloaded hdf5 VP files from aloft to cover periods where csv VP files have not get been generated, but I am not able to combine them. With bind_into_vpts() I get the error:

Vertical profiles have different quantities

There seems to be several differences between the csv files and the hdf5 files, the csv have "data" quantities in different order, "vcp" had been added and "what" is missing from attributes.

Should we be able to combine VP files that are generated slightly differently?

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(bioRad)
#> Welcome to bioRad version 0.7.3
#> using vol2birdR version 1.0.1 (MistNet not installed)

tempdir <- tempdir()

hdf5_1 <- file.path(tempdir, "sehem_vp_20230505T235000Z_0xb.h5")
download.file(
  url = "https://aloftdata.s3-eu-west-1.amazonaws.com/baltrad/hdf5/sehem/2023/05/05/sehem_vp_20230505T235000Z_0xb.h5",
  destfile = hdf5_1
)

hdf5_2 <- file.path(tempdir, "sehem_vp_20230505T235500Z_0xb.h5")
download.file(
  url = "https://aloftdata.s3-eu-west-1.amazonaws.com/baltrad/hdf5/sehem/2023/05/05/sehem_vp_20230505T235500Z_0xb.h5",
  destfile = hdf5_2
)

vpts_hdf5<- bind_into_vpts(read_vpfiles(c(hdf5_1, hdf5_2)))

vpts_csv <-read_vpts("https://aloftdata.s3-eu-west-1.amazonaws.com/baltrad/daily/sehem/2023/sehem_vpts_20230506.csv")

bind_into_vpts(vpts_hdf5, vpts_csv)
#> Error in bind_into_vpts.vpts(vpts_hdf5, vpts_csv): Vertical profiles have different quantities

str(vpts_hdf5$data)
#> List of 15
#>  $ ff       : num [1:25, 1:2] NaN 7.75 15.34 NaN NaN ...
#>  $ dbz      : num [1:25, 1:2] -26.2 -16.9 -17.9 -26.5 -28.9 ...
#>  $ dens     : num [1:25, 1:2] 0.079 0.6637 0.5356 0.0727 0.0425 ...
#>  $ u        : num [1:25, 1:2] NaN -5.05 -10.6 NaN NaN ...
#>  $ v        : num [1:25, 1:2] NaN 5.88 11.09 NaN NaN ...
#>  $ gap      : num [1:25, 1:2] 1 0 0 1 1 1 1 1 1 1 ...
#>  $ w        : num [1:25, 1:2] NaN 105.2 31.2 NaN NaN ...
#>  $ n_dbz    : num [1:25, 1:2] 5160 29191 28710 25698 20488 ...
#>  $ dd       : num [1:25, 1:2] NaN 319 316 NaN NaN ...
#>  $ n        : num [1:25, 1:2] 20 364 196 66 50 7 14 5 0 0 ...
#>  $ DBZH     : num [1:25, 1:2] -26.18 5.19 -10.17 -18.62 -28.87 ...
#>  $ n_dbz_all: num [1:25, 1:2] 5160 30152 29100 25835 20488 ...
#>  $ eta      : num [1:25, 1:2] 0.869 7.301 5.892 0.8 0.468 ...
#>  $ sd_vvp   : num [1:25, 1:2] NaN 4.75 3.58 NaN NaN ...
#>  $ n_all    : num [1:25, 1:2] 20 371 200 71 50 7 14 5 0 0 ...

str(vpts_csv$data)
#> List of 16
#>  $ u        : num [1:25, 1:288] NaN -6.19 -10.36 -8.59 NaN ...
#>  $ v        : num [1:25, 1:288] NaN 3.37 11.35 10.9 NaN ...
#>  $ w        : num [1:25, 1:288] NaN 114.9 12.5 29.5 NaN ...
#>  $ ff       : num [1:25, 1:288] NaN 7.05 15.36 13.87 NaN ...
#>  $ dd       : num [1:25, 1:288] NaN 299 318 322 NaN ...
#>  $ sd_vvp   : num [1:25, 1:288] NaN 4.55 3.15 3.9 NaN ...
#>  $ gap      : num [1:25, 1:288] 1 0 0 0 1 1 1 1 1 1 ...
#>  $ eta      : num [1:25, 1:288] 4.8 7.59 2.94 1 1.18 ...
#>  $ dens     : num [1:25, 1:288] 0.4364 0.6902 0.2675 0.0911 0.1077 ...
#>  $ dbz      : num [1:25, 1:288] -18.8 -16.8 -20.9 -25.6 -24.8 ...
#>  $ n        : num [1:25, 1:288] 30 330 173 68 46 4 6 1 2 0 ...
#>  $ DBZH     : num [1:25, 1:288] -18.76 2.82 -11.66 -16.97 -24.83 ...
#>  $ n_dbz    : num [1:25, 1:288] 5129 29912 28963 25635 20479 ...
#>  $ n_all    : num [1:25, 1:288] 30 336 175 70 46 4 6 1 2 0 ...
#>  $ n_dbz_all: num [1:25, 1:288] 5129 30125 29112 25834 20479 ...
#>  $ vcp      : num [1:25, 1:288] NA NA NA NA NA NA NA NA NA NA ...

Created on 2024-02-09 with reprex v2.1.0

@iskandari
Copy link
Collaborator

iskandari commented Feb 20, 2024

@CeciliaNilsson709 good observation. Ideally they should be combinable, even if some optional fields are missing in one vpts object and not in the other

@iskandari iskandari modified the milestones: 0.8.0, 1.0.0 Jul 15, 2024
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

2 participants