-
Notifications
You must be signed in to change notification settings - Fork 80
Proposal: allow arbitrary dimensions #77
Copy link
Copy link
Closed
Labels
RefactoringCode-Refactoring needed hereCode-Refactoring needed hereenhancementNew feature or requestNew feature or request
Milestone
Description
Since we are planing to allow arbitrary dimensions in PyKrige, we need to prepare GSTools for that as well.
There are just a few modifications needed. The foundation for rotation and anisotropy in N-D, as discussed in issue GeoStat-Framework/PyKrige#138, could be implemented in GSTools.
The covariance model needs some updates:
- it could simply provide the respective transformation matrices
rot_mat,derot_mat,iso_matandaniso_matdepending on the given angles and anisotropy-ratios (as described in the PyKrige issue) - we have to update the workflow for checking dimensionality. The
fix_dimcould be acheck_dimroutine, that takes the wanted dimension and state if it is valid. anisandanglesneed to be treated based on the dimension. foranisthis already works and forangleswe need to consider, that there are(dim * (dim - 1)) // 2rotation angles in N-D (15e2d80)- The associated rotation planes are
[(i, j) for i in range(angles_no) for j in range(i + 1, angles_no)](15e2d80) - everything else should be already working (SFT and so on).
The SRF would need some special treatment:
- We need samples of the unit-sphere in N-D. Following this, we could modify
RNG.sample_spherefor dim>3 with: (a856ea2)coord = self.random.normal(size=coord.shape) while True: # loop until all norms are non-zero norm = np.linalg.norm(coord, axis=0) # check for zero norms zero_norms = np.isclose(norm, 0) # exit the loop if all norms are non-zero if not np.any(zero_norms): break # transpose, since the next transpose reverses axis order zero_samples = zero_norms.T.nonzero() # need to transpose to have dim-axis last new_shape = coord.T[zero_samples].shape # resample the zero norm samples coord.T[zero_samples] = self.random.normal(size=new_shape) # project onto sphere coord = coord / norm
- The generators for unstructured meshes are already prepared for arbitrary dimensions.
- For structured meshes, we could simply drop handling structured meshes separately and convert them always to unstructured (which is done already, if anisotropy is present) or we could keep this procedures for 1,2 and 3 dimensions.
- we need to get rid of this cumbersome
pos=(x,y,z)handling. We could simply handle it as an array and the spatial dimension is first array dimension.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
RefactoringCode-Refactoring needed hereCode-Refactoring needed hereenhancementNew feature or requestNew feature or request