CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-flopy

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%

Overview
Eval results
Files

task.mdevals/scenario-10/

Grid Coordinate Analysis Tool

Problem

Create a program that analyzes a groundwater model grid and provides spatial query capabilities. Your program should:

  1. Create a 3D model grid with the following specifications:

    • 15 rows, 20 columns, and 5 layers
    • Variable row spacing: 100 meters for the first 5 rows, 150 meters for rows 6-10, and 200 meters for rows 11-15
    • Uniform column spacing of 100 meters
    • Layer bottom elevations: [100, 80, 50, 20, 0] meters
    • Top elevation: 120 meters
    • Grid origin at coordinates (1000, 2000)
    • Grid rotated 15 degrees clockwise
  2. 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 meters
  3. Implement 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)

  4. Implement a function get_cross_section_vertices(row) that extracts vertices for a cross-section along a specified row

Requirements

  • All returned coordinates must be in real-world coordinates (accounting for rotation and offset)
  • Handle the variable row spacing correctly when building the grid
  • The grid rotation is specified in degrees (positive = clockwise)

Dependencies { .dependencies }

flopy { .dependency }

Provides groundwater modeling and grid utilities.

Test Cases

Test 1: Grid Creation { .test }

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 == 5

Test 2: Cell Information { .test }

File: 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))

Test 3: Point Query { .test }

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)

Test 4: Cross-Section Extraction { .test }

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) > 0
tessl i tessl/pypi-flopy@3.9.0

tile.json