Skip to content
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

Add a more explicit a way to update the origin in TensorMeshes #287

Open
santisoler opened this issue Aug 10, 2022 · 1 comment
Open

Add a more explicit a way to update the origin in TensorMeshes #287

santisoler opened this issue Aug 10, 2022 · 1 comment

Comments

@santisoler
Copy link
Member

In some cases it's desirable to define a TensorMesh that spans through a very specific region but that it also has some padding around it. For example, if a given survey is defined on a (300, 1500, -400, 600) region (defined in West, East, South, North) one might want to define a TensorMesh below it with fine cells inside that region, but with a couple of larger cells around it (the padding). To do so, one need to pass a h parameter like this one:

hx = [
    (d_east, n_pad_east, -stretch_factor),
    (d_east, n_east),
    (d_east, n_pad_east, stretch_factor),
]
hy = [
    (d_north, n_pad_north, -stretch_factor),
    (d_north, n_north),
    (d_north, n_pad_north, stretch_factor),
]
hz = [(d_z, n_z)]
h = [hx, hy, hz]

The issue is that it's not trivial to set what the origin of the mesh should be before actually building it. A way to solve this problem is to create the mesh with a default origin of (0, 0, 0) and then change the origin property. Nevertheless, editing the origin parameter is not explicitly stated on the documentation.

A possible solution to this would be to add a TensorMesh.set_origin() method that sets the origin to a new given value. This method shouldn't be adding any new functionality, but exposing a clear interface on how the origin property could be changed.

I would gladly implement it if this is something that you might want to have in discretize.

Related to ##21

@jcapriot
Copy link
Member

The documentation doesn't make it transparent that you can change the origin of any of the BaseRegularMesh. I would personally be in favor of elevating this availability in the documentation with examples in the origin docstring, and also in the TensorMesh example in its docstring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants