ericaddison / pyjseisio

JavaSeis IO for python: wrapping the C++ jseisiO library
0 stars 2 forks source link

TODO: More reading convenience methods #2

Open ericaddison opened 7 years ago

ericaddison commented 7 years ago

Add convenience methods to jsdataset for reading that use frame values instead of logical frame index. I would like to the following APIs:

readTrace( traceTuple )         # return 1D numpy array 
readFrame( frameTuple )      # return 2D numpy array 
readVolume( volumeTuple ) # return 3D numpy array 
readHyper( hyperValue )       # return 4D numpy array 

Where the *tuple is a tuple describing the framework location of the requested data. For example, if I wanted to extract frame 1001 from volume 200 in hypercube 3, I would call

frame = data.readFrame( (3,200,1001) ) 

Or, if the dataset is only 4D (no hyper dimension), I would call

frame = data.readFrame( (200,1001) ) 

Also pluralized versions that accept lists in the tuples would be helpful, i.e.

# read frames 1000-2000 in hyper 3, volume 200
frame = data.readFrames( (3,200,[1000,2000]) )   # or something like that!
ericaddison commented 7 years ago

Working for the readFrame() method, which just required implementing the readFrame(int* position...) methods in jsFileReader.

Have not done so for readTrace() yet.