Hi everyone,
I have the following code but need to fix a couple of things.
First of all the data$lat_lowetmode and lon_lowestmode are latitude and longitude. When I run the function, the latitude and longitudes are cut short (go from 31.11111111 to 31.1111). I would like to preserve the precision of the lat and long values.
Second, the shot_number is turned to NA. I've tried using data$sht_number[bit64conversion = 'bit64'] but it didn't do anything
Lastly, data$rh causes the function to stop working. I think it has to do with the fact that rh is not just one vector like the other variables, but is in fact a bunch of variables labeled rh0 rh1 rh2.... rh100 representing height variables (I'm working with lidar data). They're in a table of their own so I need to figure out some bit of code to add to data$rh to include rh in the data frame.
path_to_h5 = "D:/GEDI_Thesis_Data/L2A"
f = dir(pattern = "*.h5", path_to_h5)
hdf5_extractor = function(fname){
data = h5read(file = fname, name = "BEAM0000")
return(data_frame(
data$lat_lowestmode,
data$lon_lowestmode,
data$shot_number,
data$degrade_flag,
data$quality_flag,
data$beam,
data$rh
))
}
df_dim =
f %>%
set_names(.) %>%
map_dfr(hdf5_extractor, .id = "file.ID")