Skip to content

DatasetCrossSection gives error with a cross-section model (of 1 row) #442

@rubencalje

Description

@rubencalje

When the model contains only one row, DatasetCrossSection gives an error. This code:

import nlmod
ds = nlmod.get_ds([0, 1000, 0, 100], delr=100)
line = [(0, 50), (1000, 50)]
dcs = nlmod.plot.DatasetCrossSection(ds, line)

gives the following error

Traceback (most recent call last):

  Cell In[5], line 1
    dcs = nlmod.plot.DatasetCrossSection(ds, line)

  File ~\Documents\GitHub\nlmod\nlmod\plot\dcs.py:92 in __init__
    xys = self.line_intersect_grid(line)

  File ~\Documents\GitHub\nlmod\nlmod\plot\dcs.py:154 in line_intersect_grid
    gr_line = LineString(zip([x, x], self.yedge[[0, -1]]))

IndexError: index 0 is out of bounds for axis 0 with size 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions