zarch / openriver

A set of fluvial engineering tools
5 stars 2 forks source link

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

Open lucasMueller opened 14 years ago

lucasMueller commented 14 years ago

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 commented 14 years ago

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)
"""