FloPy is a Python package to create, run, and post-process MODFLOW-based models
Agent Success
Agent success rate when using this tile
66%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.14x
Baseline
Agent success rate without this tile
58%
Create a program that analyzes a groundwater model grid and provides spatial query capabilities. Your program should:
Create a 3D model grid with the following specifications:
Implement a function get_cell_info(row, col, layer) that returns a dictionary with keys:
'center': tuple of (x, y, z) coordinates of the cell center'vertices': list of (x, y) coordinate tuples representing cell corners in map view'volume': cell volume in cubic metersImplement a function find_cells_at_point(x, y) that accepts real-world x, y coordinates and returns a list of (row, column) tuples identifying which cells contain that point (returns one tuple per layer where the point falls within a cell)
Implement a function get_cross_section_vertices(row) that extracts vertices for a cross-section along a specified row
Provides groundwater modeling and grid utilities.
File: test_grid.py { .filepath }
Test: Create the grid and verify dimensions
# Grid should have correct dimensions
assert grid.nrow == 15
assert grid.ncol == 20
assert grid.nlay == 5File: test_grid.py { .filepath }
Test: Get cell info for cell (0, 0, 0)
cell_info = get_cell_info(0, 0, 0)
# Should return dictionary with center, vertices, and volume
assert 'center' in cell_info
assert 'vertices' in cell_info
assert 'volume' in cell_info
assert len(cell_info['center']) == 3
assert len(cell_info['vertices']) == 4 # 4 corners for rectangular cell
assert isinstance(cell_info['volume'], (int, float))File: test_grid.py { .filepath }
Test: Find cells containing a specific point
# Query a point that should fall within the grid
cells = find_cells_at_point(1500, 2500)
# Should return a list of (row, col) tuples
assert isinstance(cells, list)
assert len(cells) > 0
assert all(isinstance(cell, tuple) and len(cell) == 2 for cell in cells)File: test_grid.py { .filepath }
Test: Extract cross-section vertices
# Cross-section along row 7 should return vertices
vertices = get_cross_section_vertices(7)
# Should have vertices for each layer and column intersection
assert len(vertices) > 0tessl i tessl/pypi-flopy@3.9.0docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10