shaharkadmiel / pySW4

Setup, run, post process, and visualize numerical simulations. Primarily SW4
http://shaharkadmiel.github.com/pySW4
GNU General Public License v3.0
28 stars 14 forks source link

Numpy array for data in patch? #12

Closed ArthurRodgers closed 6 years ago

ArthurRodgers commented 6 years ago

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 ?

ArthurRodgers commented 6 years ago

I think I found it:

topo.patches[0].data

shaharkadmiel commented 6 years ago

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

ArthurRodgers commented 6 years ago

Hi Shahar –

I found the solution by just doing what seemed obvious and it worked. So kudos for adopting an intuitive data model.

I need to use pySW4 more to get more proficient. I’m working on a request to provide simulation results to a Museum for visualization. I’m working on a jupyter notebook to illustrate how data can be read and plotted. The Museum viz guys will output data into their formats.

Thanks, Artie

From: Shahar Shani-Kadmiel notifications@github.com Reply-To: shaharkadmiel/pySW4 reply@reply.github.com Date: Wednesday, March 28, 2018 at 12:17 AM To: shaharkadmiel/pySW4 pySW4@noreply.github.com Cc: Arthur Rodgers rodgers7@llnl.gov, Author author@noreply.github.com Subject: Re: [shaharkadmiel/pySW4] Numpy array for data in patch? (#12)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/shaharkadmiel/pySW4/issues/12#issuecomment-376786342, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APW-cMPxm0LZEh--lFEdApq0LHEmP2azks5tizjrgaJpZM4S-Drv.

megies commented 6 years ago

Looks like this one can be closed..