adokter / bioRad

R package for analysis and visualisation of biological signals in weather radar data
http://adokter.github.io/bioRad
Other
28 stars 16 forks source link

`list_vpst_aloft` fails on `hdf5` #647

Open bart1 opened 6 months ago

bart1 commented 6 months ago

I have not investigated in detail but it seems this function fails unjustified because the code looks for an object only creates for a csv:

require(bioRad)
#> Loading required package: bioRad
#> Welcome to bioRad version 0.7.3
list_vpts_aloft(
  format='hdf5',
  date_min = "2019-10-01",
  date_max = "2019-11-30",
  radars = c("frcol", "frcae")
)
#> Error in list_vpts_aloft(format = "hdf5", date_min = "2019-10-01", date_max = "2019-11-30", : object 'found_vpts_aloft' not found

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

peterdesmet commented 4 months ago

The function documents that "Currently only csv urls are supported.", but I agree that should be extended. The issue with hdf5 files is that one cannot predict the file name (this in contrast with the daily or monthly), you have to look them up. That can be provided with the aws.s3 package like so:

library(aws.s3)
library(dplyr)

region = "eu-west-1"
df <- get_bucket_df(
  "aloftdata",
  prefix = "baltrad/hdf5/bejab/2018/", # Directory
  max = 2000, # Maximum number of files to get
  region = region
)

files <- pull(df, Key)

I would actually do the same for the csv files (look them up), so only valid (and not potential) URLs are returned. I would also limit the function to 1 radar at a time.

I'll look into this (but not right now 😊).