Skip to content

Commit

Permalink
fixed a problem with extracting the date and time from raw files
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed Aug 30, 2024
1 parent 62de245 commit ceee7a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions oceanstream/process/folder_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,11 @@ def merge_json_files(output_folder):
def from_filename(file_name):
"""Extract creation time from the file name if it follows a specific pattern."""
# pattern = r'(\d{4}[A-Z])?-D(\d{8})-T(\d{6})\.raw'
pattern = r'.*-D(\d{8})-T(\d{6})(-\d+)?\.raw'
pattern = r'(\w+-)?D(\d{8})-T(\d{6})(-\d+)?\.raw'
match = re.search(pattern, file_name)
if match:
date_str = match.group(1)
time_str = match.group(2)
date_str = match.group(2)
time_str = match.group(3)
creation_time = datetime.strptime(date_str + time_str, '%Y%m%d%H%M%S')
return creation_time

Expand Down

0 comments on commit ceee7a4

Please sign in to comment.