Hey all, This seems like a very basic question but I'm struggling to find the answer. I'd like to create a loop that appends data to an HDF5 file.
The background is that I'm looking to store large spectrograms (up to 150k columns and many ~183600 rows) and then be able to calculate summary stats over certain times and frequencies. In creating these spectrograms, audio data are loaded into r, the fft is created and the power spectral density is calculated over each one minute period. I'd like to just append this to an existing deployment data using something like the following.
For example:
# Create the hdf5 file
h5createFile("AudioRecorder.h5")
# create group for location 1
h5createGroup("AudioRecorder.h5", "location1")
# iterate thought the 'wav' files, here just simulated
for(ii in 1:30){
# time and frequency limits- time is a positctx but for irrelevant for the example
timeVals = (1:10)
freqVals =1:75000
# Simulated spectrogram data- 10 min 75k columns
simAPSD<-matrix(rnorm(10*75000), ncol=75000)
# Add or append the data
h5write(
simAuido,
file = "AudioRecorder.h5",
paste('location1',"simAPSD",sep="/"))
h5write(
as.character(timeVals),
file = "AudioRecorder.h5",
paste('location1',"time",sep="/"))
print(ii)
}
I was expecting something like h5wite(... append=TRUE) but this doesn't seem to be the case. Thanks in advance for your help!
Thanks Mike, that was super helpful!