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

Grid docstrings #732

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Grid docstrings #732

wants to merge 1 commit into from

Conversation

ecomodeller
Copy link
Member

No description provided.

@ecomodeller ecomodeller linked an issue Oct 15, 2024 that may be closed by this pull request
@jsmariegaard
Copy link
Member

Thanks - I am still a bit confused about this (issue + PR). Why did you remove the axis_name? Is it no longer possible to indicate that an axis is "z" instead of "x" as an example? And x0?

Now I see you moved the docstring from the top of class to the init method, but will I then get inline help, when I am creating a new Grid1D? (and I agree that I did confuse the arguments of the initialiser with the properties of the class)

@ecomodeller
Copy link
Member Author

ecomodeller commented Oct 16, 2024

_axis_name and _x0 are private attributes, do you think they should be read-only properties? We could make axis_name a settable property, if it is useful?

>>> from mikeio import Grid1D
>>> g = Grid1D(x=[0,1], axis_name="z")
>>> g
<mikeio.Grid1D>
x: [0, 1] (nx=2, dx=1)
>>> g._axis_name
'z'
>>> g._x0
np.int64(0)
>>> g2 = Grid1D(x0=0.1, dx=1, nx =2, axis_name="y")
>>> g2
<mikeio.Grid1D>
x: [0.1, 1.1] (nx=2, dx=1)
>>> g2._x0
0.1
>>> g2._axis_name
'y'
  • Add _axis_name to __str__ and __repr__

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

Successfully merging this pull request may close these issues.

Docstring of Grid1D shows non-existent attributes
2 participants