-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling pre-built structured grids #61
Comments
Also, is there no advantage for the kriging when using structured pointsets? It looks like structured grids are cast to unstructured when solving the kriging problem...what exactly is happening here? GSTools/gstools/krige/ordinary.py Lines 88 to 94 in 5326163
|
Just FYI... casting to an unstructured point set works fine: field = srf.unstructured([mesh.x[:,:,0].ravel(),
mesh.y[:,:,0].ravel()])
srf.plot()
plt.axis("image")
plt.show() So really, my question revolves around whether using |
Structured fields give some advantages in the SRF class, since the cython generator has an optimized routine for that case. I know, that coming from VTK, the term "structured" means a lot there. But we only support rectilinear grids for our structured meshes. In general it is best to use unstructured grids as you supposed, that is why this is the standard value for I think it would be nice, if we could generate fields directly on pyvista meshes like you have proposed in #59 where these meshes are always recasted to unstructured meshes. Therefore it would also be nice to have a better handling of different generated fields in the class. |
Can I recommend changing the term "structured" to "rectilinear" in the API to make this more clear?
That'll work perfectly then - with a little bit a trickery, we cast the pyvista meshes to unstructured for GSTools to solve on them, then collect the result back on to structured grids |
One more advantage of explicitly handling rectilinear grids, is the much easier handling of directional variograms. On all other grid types, you have to set an origin, a direction and at least one angle to span a cone, in which the directional variogram is estimated. The structured representation of the fields saves some memory, which is lost again, if you would use a structure like What about the terms |
@banesullivan GSTools now internally handles everthing as unstructured grids to simplify the code. The interface for |
@banesullivan I reopened #59 since we decided to make the |
Time to close this one.
|
the structured methods in this library (to my knowledge) only support 1-D arrays representing the axial coordinates of a rectilinear grid (the inputs to the
numpy.meshgrid
) for structured points. This is okay... but in cases of curvilinear structured grids where the user has their own tooling for building those grids, we may want to pass prebuilt coordinate arrays.For example, take this curvilinear structured grid: curvi_mesh.vts.zip
This type of grid cannot be made with NumPy's
meshgrid
function as it cannot be represented as 3 1D coordinate arrays. This is a set of structured coordinates just like whatnumpy.meshgrid
yields. These structured coordinates can be accessed by thex
,y
, andz
attributes of a PyVistaStructuredGrid
object.Note that this is something that is really common outside of PyVista too - take
discretize
'sCurvilinearMesh
class for instance.So how can we pass these kinds of pre-built structured points to the field classes such that we can leverage any performance/optimization for structured grids and plotting routines?
Just to drive home that this is a pretty common thing, even matplotlib can handle these types of structured coordinates:
So basically, how might I use that structured gird with GSTools without just sending the points as an unstructured pointset. e.g.
This is the wrong shape as it should be (17, 17) but it instead flattened the
x
andy
arrays that I passed and used all of those coordinates... (17*17=289)This is not the plot that I would expect.
The text was updated successfully, but these errors were encountered: