bioRad icon indicating copy to clipboard operation
bioRad copied to clipboard

`list_vpst_aloft` fails on `hdf5`

Open bart1 opened this issue 1 year ago • 1 comments

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

bart1 avatar Dec 13 '23 13:12 bart1

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 😊).

peterdesmet avatar Feb 09 '24 16:02 peterdesmet