Closed GiusCalamita closed 1 month ago
Hi @GiusCalamita,
Thank you for this. I was under the false impression SAF v1 only supported integer values from the digitizer (in counts) because all of the example files I had were formatted this way. I have changed the code here: 99f2d06, it now reads your file. It only involved a single line change: here. I will include these in the next maintenance release, but that will not be for a little while. In the meantime, I would suggest installing directly from GitHub with
python -m pip uninstall hvsrpy
and python -m pip install git+https://github.com/jpvantassel/hvsrpy@99f2d
. If you are on Windows (the command above with most likely not work) and you will need to download the code here, go to Code > Download ZIP and install from the .zip with python -m pip install .\hvsrpy-dev.zip
.
All the best, Joe
Hi @jpvantassel thank you very much for your rapid answer (... and sorry for my late reply), it solved the issue.
PS. I noticed HVSRpyweb has the same issue with reading SAF format. Would it be better to open an issue in the github page of HVSRpy-web?
All the best, Gius
@GiusCalamita,
Great, yes, I will need to do an update to HVSRweb to get this fix implemented. Opening an issue there, with a link back to this issue, to remind me would be appreciated.
Thanks, Joe
Hi, first af all, thank you for sharing you work with the community. I am writing this post because I am having problem to read in hvsrpy SAF ASCI format file (v.1).
I have uploaded here an example file (obtained exporting the trace, which has been registered with Tromino (Moho), from the Grilla software). EqualizedFile-HV01.zip
In the following I have pasted the error I get. As far as I can understand, it looks like, the 'type' is not recognized correctly; it appears to identify it as type equal to 'peer'
Thank you again Giuseppe
" .... HV_001part1/test5_001.saf does not include the NORTH_ROT keyword, assuming equal to zero. warnings.warn(msg, UserWarning)
ValueError Traceback (most recent call last) Cell In[9], line 1 ----> 1 srecords = hvsrpy.read(fnames) 2 srecords = hvsrpy.preprocess(srecords, preprocessing_settings) 3 hvsr = hvsrpy.process(srecords, processing_settings)
File ~\anaconda3\envs\HVSR\Lib\site-packages\hvsrpy\data_wrangler.py:701, in read(fnames, obspy_read_kwargs, degrees_from_north) 698 if len(fname) == 1: 699 fname = fname[0] --> 701 seismic_recordings.append(read_single(fname, 702 obspy_read_kwargs=read_kwargs, 703 degrees_from_north=degrees_from_north)) 705 return seismic_recordings
File ~\anaconda3\envs\HVSR\Lib\site-packages\hvsrpy\data_wrangler.py:619, in read_single(fnames, obspy_read_kwargs, degrees_from_north) 616 logger.info(f"Tried reading as {ftype}, got exception | {e}") 618 if ftype == "peer": --> 619 raise e 621 pass 622 else:
File ~\anaconda3\envs\HVSR\Lib\site-packages\hvsrpy\data_wrangler.py:612, in read_single(fnames, obspy_read_kwargs, degrees_from_north) 610 for ftype, read_function in READ_FUNCTION_DICT.items(): 611 try: --> 612 srecording_3c = read_function(fnames, 613 obspy_read_kwargs=obspy_read_kwargs, 614 degrees_from_north=degrees_from_north) 615 except Exception as e: 616 logger.info(f"Tried reading as {ftype}, got exception | {e}")
File ~\anaconda3\envs\HVSR\Lib\site-packages\hvsrpy\data_wrangler.py:468, in _read_peer(fnames, obspy_read_kwargs, degrees_from_north) 466 msg = "Must provide 3 peer files (one per trace) as list or tuple, " 467 msg += f"not {type(fnames)}." --> 468 raise ValueError(msg) 470 component_list = [] 471 component_keys = []
ValueError: Must provide 3 peer files (one per trace) as list or tuple, not <class 'str'>. "