-
Notifications
You must be signed in to change notification settings - Fork 2
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
Big docs reorganise and expand. #109
base: main
Are you sure you want to change the base?
Conversation
@trexfeathers welcome and thanks for looking !
Great also to have anyone else comment on this, |
OK I have now reviewed all the API docs builds, fixed (hopefully) for correctness and updated, generally smoothed over and introduced some more cross-links into newer docs sections where it seemed obvious. So I reckon this is up to scratch now, pending any suggestions about structural improvements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I've read most of it. It is impressively comprehensive 💐
To-do for @trexfeathers:
- Review the
details
section - Consider the overall structure/approachability
>>> if "_fillvalue" in var.attributes: | ||
>>> var.attributes.rename("_fillvalue", "_FillValue") | ||
... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing indenting
|
||
Accepts paths, pathstrings, open :class:`netCDF4.Dataset`\\s or :class:`NcData` objects. | ||
Accepts paths, pathstrings, open :class:`netCDF4.Dataset`\s or :class:`NcData` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sphinx domains not rendering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coincidentally, just fixed this docstring in a parallel PR : #112
(should now come good when this is rebased or merged from main)
Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the rest of my review.
General thoughts
I think this is some of the most complete documentation we have, because it caters to all the different types of readers.
It is laid out in an approachable way that is also low maintenance, so I'm happy to merge with the current structure 👍👍👍
However
Given the excellent breadth of 'all-angles' content, it feels like a missed opportunity to not go all-in on Diataxis. From offline conversations this sounds deliberate, but I'm hoping we can come back in future to 'finish the job'?
In practice, Iris, Xarray and Ncdata are all capable of scanning netCDF files and interpreting their metadata, while | ||
not reading all the core variable data contained in them. | ||
|
||
This generates objects containing `Dask arrays <https://docs.dask.org/en/stable/array.html>`_ with deferred access |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have Intersphinx for Dask, so I recommend using it.
To achieve a link to this specific page, you can use this syntax (not sure about correct way to pluralise):
This generates objects containing `Dask arrays <https://docs.dask.org/en/stable/array.html>`_ with deferred access | |
This generates objects containing Dask :external+dask:doc:`array` s with deferred access |
More:
- Official documentation
- Working example in Iris:
docs/userdocs/user_guide/howtos.rst
Outdated
>>> variable.set_attr("x", 3.) | ||
>>> variable.get_attr("x") | ||
3.0 | ||
>>> variable.set_attr("x", "string-value") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not the same as
__setattr__
, because that would be like avariable.x = 'string-value'
But this is a
variable.attributes["x"].value = 'string-value'
Confusing, eh ?!
OK then __setitem__
. Ignoring my technical inaccuracy, I'm still interested about whether this design philosophy is a potential direction to explore in future, or whether it's just impossible. The current need for documentation shows that we're not adhering to the least-surprise principle.
Progress : New commit 3433c29 covers, I think, all the "original" review comments Meanwhile I start to think about the "newer set" of suggestions |
@trexfeathers thanks for your careful attention ! Probable exceptions, issues you've raised which I think I want to "pin" for now :
Please check it out + see what you think. On inspection, I think I probably don't need to merge from main before completing this (read on...) Differences currently waiting on main are only those from #112, to do with unpinning numpy to v2. Associated changes affect array printout and its tests. That does not create major problems here, as changes here are all docs with no functional effect. |
Hang on .... I just realised the initial "Introduction" tutorial has chunks of code that ought to be in rst "code-block"s. |
OK done that. Not sure what else I'm still missing at the last minute though 😥 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! We're down to 4 outstanding options, plus a final 5th conversation that needs no action.
>>> for name in wanted: | ||
... data.variables.add(data.variables[name]) | ||
... | ||
>>> to_nc4('output.nc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> for name in wanted: | |
... data.variables.add(data.variables[name]) | |
... | |
>>> to_nc4('output.nc') | |
>>> for name in wanted: | |
... data.variables.add(data2.variables[name]) | |
... | |
>>> to_nc4(data, 'output.nc') |
Very briefly : | ||
|
||
* types (1) and (2) are equivalent to Python strings and may include unicode | ||
* type (2) are equivalent to character (byte) arrays, and normally represent only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* type (2) are equivalent to character (byte) arrays, and normally represent only | |
* type (3) are equivalent to character (byte) arrays, and normally represent only |
docs/userdocs/user_guide/howtos.rst
Outdated
>>> variable.set_attr("x", 3.) | ||
>>> variable.get_attr("x") | ||
3.0 | ||
>>> variable.set_attr("x", "string-value") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think?
I was gonna make a branch to illustrate, but I think that would need too much time.
The current handling of self.attributes
is moved into self._attributes
. You no longer have to warn people against working with it directly - it's implicit/self-explaining, especially since it's undocumented. But it's still easily accessible for ncdata developers, and is the object that is in charge.
A new self.attributes
is created as the 'public face'. This has a __setitem__
and __getitem__
, which perform the work currently done by set_attrval
get_attrval
, writing/reading from self._attributes
.
IMO this would be the best of both worlds.
I consider my original comment to be actioned. Please feel free to Resolve conversation
once you have read this.
Closes #80
Refactored version of #105
Adds new sections on core data and general operations.
Integrates the how-to sections also
Todos: