Skip to content
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

class Section """docu""" and problems with addSegment #4

Open
lucasMueller opened this issue Mar 26, 2010 · 1 comment
Open

class Section """docu""" and problems with addSegment #4

lucasMueller opened this issue Mar 26, 2010 · 1 comment

Comments

@lucasMueller
Copy link
Collaborator

Since this is the first time I take a closer look to the code I followed the example present in docu of class Section and....it does not work...
The documentation is old, I think it should be like this:
"""
It defines attributes and methods for a river cross-section.
It's possible to define sub-segments of the section,
each one with a different roughness.
Example of usage:

coord = np.array([[0,10],[0,0],[10,0],[20,0],[20,10]])
sect = Section(0, coord)
sect.addSegment(sect.coord[0:2], 35)
sect.addSegment(sect.coord[2:], 40)
"""

The np implementation was missing and the sect.yzcoord is an old version? If what I report here is correct I can push it to the repo. I think we should always check the docu of a Class, Method, etc if we change the code, in order that it is updated!.

Moreover, following the example, I tried to add a subsection with addSegment:

sect.addSegment(sect.coord[0:2],35)
sect.segment
[<main.Section instance at 0x29a3cf8>]
? no idea what is going wrong.

@zarch
Copy link
Owner

zarch commented Mar 26, 2010

Hi Lucas!
to guaranteer that documentation is valid you should use the doc test... You could just write something like:
"""
It defines attributes and methods for a river cross-section.
It's possible to define sub-segments of the section,
each one with a different roughness.
Example of usage:

>>> coord = np.array([[0,10],[0,0],[10,0],[20,0],[20,10]])
>>> sect = Section(0, coord)
>>> sect.addSegment(sect.coord[0:2], 35)
>>> sect.addSegment(sect.coord[2:], 40)
"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants