gempy
gempy copied to clipboard
Anisotropic range
At the moment the interpolation of the scalar field is done with an isotropic range. This gives problems when the data is not well distributed across the 3 dimension and homogeneously spread (see #322). This is normally the case in geology where X and Y are much larger than Z
To solve this we would need to find a function that transforms the input data to look isotropic (think of an sphere), then doing the interpolation and then transform back the result.
The good news is that gempy interpolates already in a transformed domain -- right now only scaled down between 0 and 1 -- we should be able to enhance the Rescaling class to deal also with anisotropies.
TO - DO:
- [x] Add the option to have different ranges for different scalar fields
- [x] Implement a manual rescaling of the Z direction, i.e. just multiply all the Z coordinates for a factor
- [ ] Find a fancy transformation to address not only the difference in Z but local differences
@Leguark could you document this issue?
@AndrewAnnex there you go
@Leguark so as I interpret it, currently the rescaling class already deals with the "stretching" of the data on the axes from the rescaling_factor but does not take into account the "rotational" component of the anisotropy, is that correct?
adding a rotation parameter to the rescaling class should be a good place to start.
as for the todo-list, those items seem specific to the mentioned issue regarding the Z axis. As I read it, the second checkbox is already satisfied by the Z_r parameter correct?
I've started a wip branch to begin the process of adding this functionality, please continue to update this issue with suggestions and code contributions!
@Leguark I sort of lost the thread on my pr #341 but in re-reading this issue I think I understand the issue more correctly now, please expand/correct me on the following:
- at a first level the pr should update the rescaling class to have three different range values, (x_range, y_range, z_range) that are used to rescale the data.
- a rotational anisotropy correction is a related, but secondary issue to this
Currently the rescaling class is effectively doing a min max rescaling on all axes by using a rescaling factor on the axis with the biggest range correct?
It seems like a lot of the data preprocessing routines from sklearn could be used.
yes, exactly. At the moment we rescale all data between 0-1 and but the relative positions with each other are the same as the original input.
In the long term we would like to have a fancy transformation that "rescale" the data in a way most of the points are approximately at the same distance of each other (maybe 1/4-1/8 the range value or something like that). Doing this is tricky because we need rotation and somehow local transformations and I agree that exploring sklearn would be the first attempt.
Now in the sort term, many problems are coming simply because X and Y coordinates are 1 or sometime 2 order of magnitude larger than in Z. The easiest anisotropy that can solve 80% of the artifacts is just to check how many times larger is XY and multiply Z by that factor.
@Leguark I had been experimenting with the PowerTransformer in sklearn (https://scikit-learn.org/stable/auto_examples/preprocessing/plot_all_scaling.html#sphx-glr-auto-examples-preprocessing-plot-all-scaling-py) on one of my datasets and depending on the parameters it seemed to work well. Currently I see that gempy treats a distribution centered around (0.5, 0.5, 0.5) as isotropic, but other packages assume a center of 0,0,0. I think it is relatively easy to switch between the two but does the model implementation prefer one over the other?