uafgeotools / waveform_collection

Collect seismic/infrasound waveforms and metadata from IRIS/WATC/AVO servers, local miniSEED files, etc.
https://uaf-waveform-collection.readthedocs.io/
MIT License
11 stars 6 forks source link

Add smart24.py #2

Closed atwinkelman closed 4 years ago

atwinkelman commented 4 years ago

Add capability to read CD-1.1 formatted files from Geotech SMART24 digitizers and start providing structure for adding more read-from-file formats.

liamtoney commented 4 years ago

Okay, so if I understand this correctly — and to [attempt to] use proper Python terminology — you made a subpackage called local that now contains modules local and smart24?

And the line from . import local runs the __init__.py of the local subpackage, thereby exposing the function read_local() and the class Smart24?

atwinkelman commented 4 years ago

Okay, so if I understand this correctly — and to [attempt to] use proper Python terminology — you made a subpackage called local that now contains modules local and smart24?

More or less. Check out how obspy has their __init__.py files organized for some motivation.

And the line from . import local runs the __init__.py of the local subpackage, thereby exposing the function read_local() and the class Smart24?

Yes, from . import local acts just like if you ran that command manually in an interpreter.

atwinkelman commented 4 years ago

What do you think about renaming the class smart24 to Smart24 to match Python class naming convention?

Sure. Done.

liamtoney commented 4 years ago

Hmm... after pulling in the changes I'm now getting this error when I attempt

import waveform_collection

Error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-1-2f98d1172391> in <module>
----> 1 import waveform_collection

~/repos/waveform_collection/waveform_collection.py in <module>
      4 __import__('pkg_resources').require('waveform-collection==0.0.0')
      5 __file__ = '/Users/ldtoney/repos/waveform_collection/waveform_collection.py'
----> 6 with open(__file__) as f:
      7     exec(compile(f.read(), __file__, 'exec'))

FileNotFoundError: [Errno 2] No such file or directory: '/Users/ldtoney/repos/waveform_collection/waveform_collection.py'

Does setup.py need to be modified? I wouldn't think so, given that I'm using find_packages()...

liamtoney commented 4 years ago

Weird. It works with Python but not IPython... see below.

error
atwinkelman commented 4 years ago

My best guess is you're having an environment issue. The FileNotFoundError is telling you it cannot find the file /Users/ldtoney/repos/waveform_collection/waveform_collection.py. Looking back in time on git shows that this project used to be just a waveform_collection.py file. Perhaps you need to update your install?

atwinkelman commented 4 years ago

Are you sure the ipython you're running has the latest waveform_collection installed? In the current env, where does which ipython point?

liamtoney commented 4 years ago

Solved this in a different environment by running conda update ipython. So it must have been a stale path issue as you suggest. Kind of frustrating!