Answers.Body: <p>This is a modified answer:</p>
  <p>Nothing is wrong with Soundtrap files, but SW seems buggy.</p>
  <p>Using the original PAMGuide from <a href="https://sourceforge.net/projects/pamguide/" rel="nofollow noreferrer">Sourceforge</a> I found a couple of Bugs that can easily be edited</p>
  <p>In Meta.R:</p>
  <ul>
  <li>in &quot;Meta &lt;- function(...&quot; replace &quot;stype='MF'&quot; by &quot;ctype='TS'&quot;</li>
  <li>in &quot;Meta &lt;- function(...&quot; replace &quot;plottype='None'&quot; to &quot;plottype=plottype&quot;</li>
  <li>in &quot;A &lt;- PAMGuide_Meta(nowfile,...&quot;, replace &quot;stype=stype&quot; by &quot;ctype=ctype&quot;</li>
  </ul>
  <p>in PAMGuide_Meta.R:</p>
  <ul>
  <li>in &quot;if (envi == 'Wat') {cat('In-air measurement\n')}&quot; (line 75) replace &quot;Wat&quot; by &quot;Air&quot;</li>
  <li>in &quot;if (tstamp != &quot;&quot;){t &lt;- t+tstamp&quot; (line 287) replace &quot;!= &quot;&quot;)&quot; by &quot;&gt;0)&quot;</li>
  </ul>
  <p>In PAMGuide.R</p>
  <ul>
  <li>in &quot;if (envi == 'Wat') {cat('In-air measurement\n')}&quot; (line 77) replace &quot;Wat&quot; by &quot;Air&quot;</li>
  <li>in &quot;if (tstamp != &quot;&quot;){t &lt;- t+tstamp&quot; (line 295) replace &quot;!= &quot;&quot;)&quot; by &quot;&gt;0)&quot;</li>
  </ul>
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-15T16:33:04.283Z
Answers.Text: 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` .
Answers.UserDisplayName: LaraLopes
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-16T06:03:33.973Z
Answers.Text: 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
Answers.UserDisplayName: WMXZ
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-16T12:48:25.027Z
Answers.Text: 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.
Answers.UserDisplayName: LaraLopes
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-16T13:07:32.483Z
Answers.Text: At this point, one would need a short example file, to debug the code.
Answers.UserDisplayName: WMXZ
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-16T13:24:03.810Z
Answers.Text: ok @WMXZ, I added 3 1-minute files with the standard SoundTrap file name here at the [link](https://drive.google.com/drive/folders/1hnn9vE7Vp68ftH_0da-obFAFwvwA0Vqy?usp=sharing) (also added in to the question). You think that is enough?
Answers.UserDisplayName: LaraLopes
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-16T17:50:18.863Z
Answers.Text: Ok @WMXZ, I tried downloading PAMGuide again from Sourceforge and ran the examples with Meta resulting in no error, unless when I  try to specify the timestring pattern, as you suggested. I tried changing filenames to different patterns (without 6690, adding year with 4 digits...) but none were accepted. 
  In addition, now the PSD Spectrum plot is not calibrated in spite of me adding End-to-end calibration infos. Did that occured to you as well?
Answers.UserDisplayName: LaraLopes
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-16T18:20:51.837Z
Answers.Text: Yes, edited my answer
Answers.UserDisplayName: WMXZ
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-18T11:41:20.267Z
Answers.Text: Ok, I gave up on trying to use filename timestamp and after changing the code as you suggested, I can get the calibrated results (which is the most important thing for my analysis). Thanks a lot for the help @WMXZ !!
Answers.UserDisplayName: LaraLopes
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-15T15:25:37.867Z
Answers.LastActivityDate: 2022-08-18T04:21:00.117Z
Answers.LastEditDate: 2022-08-18T04:21:00.117Z
Answers.UserDisplayName: WMXZ
Body: <p>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:</p>
  <pre><code>Meta(atype = &quot;PSD&quot;, 
       plottype = &quot;Stats&quot;, 
       envi = &quot;Wat&quot;,  
       r = 50, 
       winname = 'Hann',
       calib = 1, 
       ctype = &quot;EE&quot;, 
       Si= -175.9, # calibration value from SoundTrap
       linlog = &quot;Log&quot;, 
       lcut = 20, 
       welch = 10,  # for 5s time resolution
       timestring = &quot;6690.%y%m%d%H%M%S.wav&quot;, 
       outwrite = 1, #
       outdir = &quot;D:/PBS_Monitoramento acústico/Analises/PSD_resultados/Dep01_220502-220623/Dep01_S01_ST6690/2205&quot;
       ) 
  
  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
  ADC peak voltage: 1.414 V
  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
  In addition: Warning message:
   Error in as.POSIXlt.character(x, tz, ...) : 
   character string is not in a standard unambiguous format
  </code></pre>
  <p>The same goes for the &quot;PAMGuide&quot; 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.</p>
  <p>Has anyone had to deal with this problem before? Can it be related to data being collected with SoundTraps?</p>
  <p>Edit: 3 files with 1-minute and standard SoundTrap filenames can be accessed <a href="https://drive.google.com/drive/folders/1hnn9vE7Vp68ftH_0da-obFAFwvwA0Vqy?usp=sharing" rel="nofollow noreferrer">here</a>.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-16T14:50:00.713Z
Comments.Text: 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"](https://stackoverflow.com/help/how-to-ask)
Comments.UserDisplayName: Dan Stowell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-16T15:26:58.563Z
Comments.Text: Hello @DanStowell! Thanks for the suggestion, I hope I got the title a little better
Comments.UserDisplayName: LaraLopes
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-17T08:47:12.350Z
Comments.Text: title is still ambiguous/ too detailed
Comments.UserDisplayName: Chloe
Tags: <analysis><soundscape><r><software><soundtrap>
Title: Uncalibrated results and non-recognition of timestamp with Meta function of PAMGuide in R
ThreadText: # Uncalibrated results and non-recognition of timestamp with Meta function of PAMGuide in R
  
  (Asked by: username_0 on 2022-08-15)
  
  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, #
       outdir = "D:/PBS_Monitoramento acústico/Analises/PSD_resultados/Dep01_220502-220623/Dep01_S01_ST6690/2205"
       ) 
  
  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
  ADC peak voltage: 1.414 V
  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
  In addition: Warning message:
   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.
  
  **Tags:** analysis, soundscape, r, software, soundtrap
  
  > **Comments:**
  > **username_1**: 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"](https://stackoverflow.com/help/how-to-ask)  
  > **username_0**: Hello @DanStowell! Thanks for the suggestion, I hope I got the title a little better  
  > **username_2**: title is still ambiguous/ too detailed  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2022-08-15. Score: 0 | Accepted answer
  
  This is a modified answer:
  
  Nothing is wrong with Soundtrap files, but SW seems buggy.
  
  Using the original PAMGuide from [Sourceforge](https://sourceforge.net/projects/pamguide/) 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.
  
  > **Comments:**
  > **username_0**: 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` .  
  > **username_3**: 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  
  > **username_0**: 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.  
  > **username_3**: At this point, one would need a short example file, to debug the code.  
  > **username_0**: ok @username_3, I added 3 1-minute files with the standard SoundTrap file name here at the [link](https://drive.google.com/drive/folders/1hnn9vE7Vp68ftH_0da-obFAFwvwA0Vqy?usp=sharing) (also added in to the question). You think that is enough?  
  > **username_0**: Ok @username_3, I tried downloading PAMGuide again from Sourceforge and ran the examples with Meta resulting in no error, unless when I  try to specify the timestring pattern, as you suggested. I tried changing filenames to different patterns (without 6690, adding year with 4 digits...) but none were accepted.  In addition, now the PSD Spectrum plot is not calibrated in spite of me adding End-to-end calibration infos. Did that occured to you as well?  
  > **username_3**: Yes, edited my answer  
  > **username_0**: Ok, I gave up on trying to use filename timestamp and after changing the code as you suggested, I can get the calibrated results (which is the most important thing for my analysis). Thanks a lot for the help @username_3 !!  
  
  ---
  
  