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

Groundwater Model Boundary Condition Visualizer

Build a tool to visualize boundary conditions from a MODFLOW groundwater model with color-coded markers for different boundary condition types.

Requirements

Create a Python function that generates a map view plot of boundary conditions from a loaded MODFLOW model. The function should:

  1. Accept a MODFLOW model object as input
  2. Create a matplotlib figure with a map view of the model
  3. Plot the model grid as a background
  4. Display multiple boundary condition types with distinct colors:
    • Wells (WEL) in red
    • Rivers (RIV) in blue
    • Drains (DRN) in yellow
    • General Head Boundaries (GHB) in cyan
    • Constant Head (CHD) in navy
  5. Add a legend identifying each boundary condition type
  6. Return the matplotlib figure and axes objects

The function should work with both MODFLOW-2005 and MODFLOW 6 models.

Test Cases

  • Given a MODFLOW model with well boundary conditions, the plot displays red markers at well locations @test
  • Given a MODFLOW model with multiple boundary condition types (WEL, RIV, CHD), the plot displays each type with its assigned color @test
  • Given a MODFLOW model, the returned plot includes a legend with labels for each boundary condition type present @test

Implementation

@generates

API

import matplotlib.pyplot as plt
from matplotlib.figure import Figure
from matplotlib.axes import Axes

def plot_boundary_conditions(
    model: object,
    figsize: tuple[float, float] = (12, 10),
    layer: int = 0
) -> tuple[Figure, Axes]:
    """
    Create a map view plot of boundary conditions from a MODFLOW model.

    Args:
        model: A FloPy MODFLOW model object (MODFLOW-2005, NWT, or MODFLOW 6)
        figsize: Figure size as (width, height) in inches
        layer: Model layer to visualize (0-indexed)

    Returns:
        A tuple of (figure, axes) containing the boundary condition plot
    """
    pass

Dependencies { .dependencies }

flopy { .dependency }

Provides MODFLOW model handling and plotting utilities.

matplotlib { .dependency }

Provides plotting functionality.

tessl i tessl/pypi-flopy@3.9.0

tile.json