shaharkadmiel/pySW4

Numpy array for data in patch?

Closed this issue · 4 comments

Hi Shahar -

I want to use pySW4 to access, manipulate and output image data. Is there a way to access the regular 2D raster data of a patch object? For example the values of topo, gridz, vs, mag at the surface (z=0) or cross-section (not intersected by mesh refinement).

I can read SW4 image files into Image objects, but is there an attribute for the array of data that makes up the image, something like patch.data ?

I think I found it:

topo.patches[0].data

Hi Artie,

Yes, indeed. In pySW4 we followed the Obspy data model:

Stream . traces [list]
          |--> Trace . data [numpy array]
          |     |--> .  stats
          |     |--> ...
          |
          |--> Trace ...

In pySW4 this would be:

Image . patches [list]
          |--> Patch . data [numpy array]
          |     |--> .  header
          |     |--> ...
          |
          |--> Patch ...

If you want to contribute a nice example of this functionality you are more than welcome.

Cheers

Looks like this one can be closed..