Skip to content

Commit f5bfa96

Browse files
committed
add original_filename, fix station network location
1 parent aacf855 commit f5bfa96

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pyxlma/lmalib/io/read.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import numpy as np
44
import gzip
55
import datetime as dt
6+
from os import path
67

78
class open_gzip_or_dat:
89
def __init__(self, filename):
@@ -201,6 +202,7 @@ def to_dataset(lma_file, event_id_start=0):
201202
ds.attrs['history'] = "LMA source file created "+lma_file.file_created
202203
ds.attrs['event_algorithm_name'] = lma_file.analysis_program
203204
ds.attrs['event_algorithm_version'] = lma_file.analysis_program_version
205+
ds.attrs['original_filename'] = path.basename(lma_file.file)
204206

205207
# -- Populate the station mask information --
206208
# int, because NetCDF doesn't have booleans
@@ -361,7 +363,7 @@ def __init__(self,filename):
361363
file_created = line.decode().split(':')[1:]
362364
self.file_created = ':'.join(file_created)[:-1]
363365
if line.startswith(b'Location:'):
364-
self.network_location = ':'.join(line.decode().split(':')[1:])[:-1]
366+
self.network_location = ':'.join(line.decode().split(':')[1:])[:-1].replace(' ','')
365367
if line.startswith(b'Data start time:'):
366368
timestring = line.decode().split()[-2:]
367369
self.startday = dt.datetime.strptime(timestring[0],'%m/%d/%y')

0 commit comments

Comments
 (0)