Numpy array for data in patch?
Closed this issue · 4 comments
ArthurRodgers commented
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
I think I found it:
topo.patches[0].data
shaharkadmiel commented
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
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 GitHub<#12 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/APW-cMPxm0LZEh--lFEdApq0LHEmP2azks5tizjrgaJpZM4S-Drv>.
megies commented
Looks like this one can be closed..