Model limits from shapefile? #776
Replies: 6 comments 12 replies
-
Hi @lucianomarquetto, extent = np.array([729550.0, 751500.0, 1913500.0, 1923650.0, -1800.0, 800.0]) |
Beta Was this translation helpful? Give feedback.
-
Ok I think I see the problem, I'll try to go step by step and hope it's helpful. Maybe first of all - when you plot your model without a successful computation (or before you acutally run the model computation) gempy will default to just showing the input data with an extent that fits it - that is why you get the 3D plot. |
Beta Was this translation helpful? Give feedback.
-
Hi all! I just thought about coming back here to share the code I used to rotate my model as Jan suggested in the comments, in case anyone like me (a beginner in python and gempy) needs it. As Jan mentioned, the coordinates of the rotated model need to be transformed back in case one needs the real coordinates for anything else, but other than that the model seems ok. Any suggestions on how to improve the code are also welcome! '''Defining the extent of the model and creating a rotation matrix in order to model only the necessary area:''' #Define the extent - in my case it matches with the yellow rectangle drawn in the images I posted earlier in this discussion: #Define the rotation angle in degrees #Convert the angle to radians #Define the rotation matrix #Apply the rotation matrix to the extent #Extract the desired extent values
'''Creating a rotation matrix for the dataset, and writing the new coordinates (rotated X and rotated Y) to the csv file. Note that here the original coordinates are the columns 'X_original' and 'Y_original', while the rotated coordinates are 'X' and 'Y' because Gempy looks for the latter when plotting the points and computing the model.''' #Read in the CSV file with data points #Extract the x and y coordinates as separate arrays # Define the rotation matrix # Apply the rotation matrix to the x and y columns of the dataframe #Apply the rotation matrix to the x and y columns of the dataframe #Save the modified dataframe to the original csv file #After that can create and initialize the model.` |
Beta Was this translation helpful? Give feedback.
-
Hi all! I am opening this discussion again instead of creating a new post as I think this is the continuation of my issue. This might be a tough question (at least it seems for me that do not understand a lot of programming). I was able to rotate my model as suggested by @javoha , by applying a 2D matrix rotation in the model extent + surface&orientation points. Results are awesome, and this definitely helped me work only on my area of interest (I was able to focus and detail on the 3600 km² of my area instead of modeling ~9600 km²). Nonetheless, now I want to rotate my model back, but I am not sure if just rotating back the coordinates in the the output files is enough. My model is already useful as it is, but would be great to have the real coordinates so I (or other people) could use it further. I notice the 'gp.save_model' generates 11 files, from which 6 show coordinates (2 .npy files and 4 .csv files). Those are listed below (considering my model name as 'Final_model'): Final_model_extent.npy Final_model_extent.npy and Final_model_resolution.npy are easy to replace with the original coordinates, as well as Final_model_orientations.csv and Final_model_surface_points.csv. (although those last two do contain more than just coordinates, i.e. 'X_c', 'Y_c' columns that I don't know if I need to adjust somehow). Then we get to the Final_model_rescaling_data.csv and Final_model_surfaces.csv, which seem harder to work with. Final_model_rescaling_data.csv has two columns: 'rescaling factor' and 'centers', the latter is a field of coordinates. So my main question here is, how easy would be to rotate my model back again? Do I need to worry only with coordinates or there are other fields I have to convert (somehow) as well? Thanks! Luciano. |
Beta Was this translation helpful? Give feedback.
-
@lucianomarquetto, Just playing with some example data. I wrote a function using Shapely Methods to perform the rotation of the extent, the interfaces, and the orientations. Works like a charm so far :) Input for the extent is either a NumPy Array with four corner coordinates, a Shapely Polygon or a GeoDataFrame/Shapefile containing the bounding box. The angle to rotate the box will be calculated automatically to rotate the bounding box horizontally or vertically. A new bounding box will be created from the rotated box to get the total bounds of the box and will be returned as new extent for the modeling in GemPy. |
Beta Was this translation helpful? Give feedback.
-
@lucianomarquetto, I have created a new tutorial for GemGIS that outlines the functionality of how to rotate GemPy Input Data: https://gemgis.readthedocs.io/en/latest/getting_started/tutorial/67_rotating_gempy_input_data.html The functionality ( |
Beta Was this translation helpful? Give feedback.
-
Hi community,
I am new to gempy and have little knowledge of python, but have been learning both in the past months. I wonder if it is possible to define my model extent from a shapefile or even just from a rotated rectangle. My area of interest is at an angle ~30° with north-south (see image below, yellow polygon).
I am using gempy 2.2.11. Any help would be welcome - sorry if I need to specify more information here, it is the first time I post a question on the discussions. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions