# Uncalibrated results and non-recognition of timestamp with Meta function of PAMGuide in R

I need to calculate calibrated soundscape metrics for 2 months continuous recordings made with SoundTraps HF600, so I thougth about using PAMGuide (Merchant et al. 2015). I've tried using the Meta function in R with several different settings (calibrating and not calibrating the data, using an averaging welch factor or not, adding timestamp or not, etc.) but it always results with an as.POSIXlt.character error message:

Meta(atype = "PSD",
plottype = "Stats",
envi = "Wat",
r = 50,
winname = 'Hann',
calib = 1,
ctype = "EE",
Si= -175.9, # calibration value from SoundTrap
linlog = "Log",
lcut = 20,
welch = 10,  # for 5s time resolution
timestring = "6690.%y%m%d%H%M%S.wav",
outwrite = 1, #
)

No. of WAV files in selected directory:  4239
Time stamp start time:  2022-05-02 13:34:14
Analysis type: PSD
Plot type: None
Underwater measurement
Hydrophone sensitivity: -36 dB re 1 V/uPa
Preamplifier gain: 0 dB
Time segment length: 96000 samples = 1 s
Window function: Hann
Window overlap: 50 %
System sensitivity correction factor, S =  -39.0  dB
Error in as.POSIXlt.character(x, tz, ...) :
character string is not in a standard unambiguous format
Error in as.POSIXlt.character(x, tz, ...) :
character string is not in a standard unambiguous format


The same goes for the "PAMGuide" function. I have used PAMGuide in the past to study other marine soundscapes data collected with other equipment, but now I can't run any of the PAMGuide functions in R nor in Matlab.

Has anyone had to deal with this problem before? Can it be related to data being collected with SoundTraps?

Edit: 3 files with 1-minute and standard SoundTrap filenames can be accessed here.

• Hi Lara and welcome! Please edit the main title so it is a specific question. As it stands, your title is a short phrase that doesn't let readers know what information you're looking for. See guide for: "How do I ask a good question" Aug 16, 2022 at 14:50
• Hello @DanStowell! Thanks for the suggestion, I hope I got the title a little better Aug 16, 2022 at 15:26
• title is still ambiguous/ too detailed Aug 17, 2022 at 8:47

Nothing is wrong with Soundtrap files, but SW seems buggy.

Using the original PAMGuide from Sourceforge I found a couple of Bugs that can easily be edited

In Meta.R:

• in "Meta <- function(..." replace "stype='MF'" by "ctype='TS'"
• in "Meta <- function(..." replace "plottype='None'" to "plottype=plottype"
• in "A <- PAMGuide_Meta(nowfile,...", replace "stype=stype" by "ctype=ctype"

in PAMGuide_Meta.R:

• in "if (envi == 'Wat') {cat('In-air measurement\n')}" (line 75) replace "Wat" by "Air"
• in "if (tstamp != ""){t <- t+tstamp" (line 287) replace "!= "")" by ">0)"

In PAMGuide.R

• in "if (envi == 'Wat') {cat('In-air measurement\n')}" (line 77) replace "Wat" by "Air"
• in "if (tstamp != ""){t <- t+tstamp" (line 295) replace "!= "")" by ">0)"

Caveat: I'm not using PAMGuide or R, so there may be more Bugs in the code, but with this modifications OP is running, End-to-End calibration is applied and plottype input is respected.

• well that is not it because even if I try not to use a timestamp (not using the argument "timestring" of the function) it does not run. I also try removing the "6690." and ".wav" without success. Also, I think it is being able to correctly recognize the timestamp, as you can see the correct time in the output Time stamp start time: 2022-05-02 13:34:14 . Aug 15, 2022 at 16:33
• The error shown in the OP is certainly a time format error (the "lt" in POSIXlt is local time and tz is for timezone). Checking the R-code, the timestamp is extracted from filename via strptime. Checking the documentation is says that to extract year you should use "%Y" (capital Y) and that the "%y" means something different. I edit my answer. Let us know if it changes anything
– WMXZ
Aug 16, 2022 at 6:03
• filenames from Soundtrap have the pattern: SoundTrapID.yymmddHHMMSS.wav (example: 6690.220510000423). I tried changing the timestring code from %y to %Y and also adding 4 digits for year (so changing to 6690.20220510000423) but still no success. Aug 16, 2022 at 12:48
• At this point, one would need a short example file, to debug the code.
– WMXZ
Aug 16, 2022 at 13:07
• ok @WMXZ, I added 3 1-minute files with the standard SoundTrap file name here at the link (also added in to the question). You think that is enough? Aug 16, 2022 at 13:24