-
Notifications
You must be signed in to change notification settings - Fork 317
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
issue import modelgrid from gridgen #2364
Comments
Hello. If I understand correctly, this is similar to #2283 which has been fixed since 3.8.0 (https://github.com/modflowpy/flopy/releases/tag/3.8.0). Can you check if this gets fixed upon updating your FloPy to a newer version? |
Hello, I work with version 3.8.2. (recently installed) |
I just realized that your "imported modelgrid" is the one coming from the Does it work if you do something like this upon importing the modelgrid?: mg_test = gwf_quadtree_test.modelgrid
mg_test.set_coord_info(crs="EPSG:31370") |
Hello, no, I get still the same error, when I only adjust the crs, the plot of the mg_test seems on the wright position, but the print gives = 0, and I cannot do the resampling, with error unsupported operand type, when I both correct coordinates and crs, the plot is on the wrong location and I get the error Raster and modelgrid do not intersect. |
Oh okay. I'm starting to run out of ideas 😅. I'm wondering why printing the |
@martclanor and @MichelCraninx When gridgen builds a VertexGrid from a StructuredGrid that has offsets applied to it (in FloPy_, gridgen will calculate the vertices for the new VertexGrid from the offset original grid. Therefore, the VertexGrid's vertices are specified in the correct place and no offsets need to be applied to the new grid. Hense, xoff=0, yoff=0, angrot=0 when you load the new modelgrid. If you then apply the offsets to it, you are translating vertices that are in the correct place by whatever offset distance you applied. In short, xoffset and yoffset should both equal 0 on your new grid (do not apply offsets to it) as the actual vertices that are defined for each cell correspond to the geographic coordinates of the StructuredGrid it was created from. |
Thank you very much martclanor and jlarsen! So I have to find a manner to load correctly the base_grid after gridgen. When I print the properties of the grid after import from the sim object, it is a "vertexgrid" with fine and rough resolutions, as constructed during with gridgen. However, I cannot explain the errors when I use the modelgrid for resampling for example: "unsupported operand type". It is already good to know that is not related with the coordinates. |
@MichelCraninx |
I see what's going on. Your if local_grid_option == 1:
gridprops = g.get_gridprops_vertexgrid()
base_grid = flopy.discretization.VertexGrid(nlay=1, **gridprops) Also gwf = sim.get_model("my model name")
head_obj = gwf.head()
head_array_data = head_obj.get_alldata() # 4d array of (time, nlay, nrow, ncol) |
Hello
I have set-up a quadtree model with gridgen (disv-object). Because this takes a long time to calculate I would like to save the modelgrid and import it. For this I have run a simulation so I can import the disv-object and model. When I import the modelgrid the spatial data is missing when I print mg (mg = gwf.modelgrid). However when I plot the modelgrid (mg.plot()), the modelgrid is displayed with the correct coordinates? When I follow the steps: https://flopy.readthedocs.io/en/latest/Notebooks/modelgrid_examples.html, I can change the coordinates to the correct coordinates, however when I plot the new modelgrid the modelgrid is not on the correct position. How can I correct load the modelgrid, resulting from the gridgen calculations?
The text was updated successfully, but these errors were encountered: