Skip to content

Conversation

@rcomer
Copy link
Member

@rcomer rcomer commented Mar 10, 2020

Adds some detail about the args and kwargs to the DimCoord.__init__ docstring. I noticed this omission this morning while helping an inexperienced user who needs to create a DimCoord from scratch.

I've given some thought to the descriptions for points, bounds and circular, but everything else is a direct copy/paste from the equivalent Coord docstring. I also tweaked the description for points in the Coord version, as this way scans better in my head.

A couple of things I'm not sure of:

  • I've used "numpy array-like" in the new points description. Is this a concept that we can assume users are familiar with, or is there a better way of saying it? If this is the best way, should I also use it for bounds, and for points and bounds in the Coord.__init__ docstring?
  • Really not sure I've understood the circular attribute, so what I've written could be nonsense!

Closes #3520

@rcomer
Copy link
Member Author

rcomer commented Mar 10, 2020

While I was getting to grips with the monotonicity rules, I realised it is possible to create a dimcoord whose points and bounds are monotonic in opposite directions. Not sure that's quite right, but it's beyond the scope of this PR.

@rcomer
Copy link
Member Author

rcomer commented Mar 10, 2020

Travis failed on image comparisons. I'm pretty sure I can't have caused this!

Args:
* points:
1D numpy array-like of values (or single value in the case of a
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that it’s specifically 1D, perhaps simply “Sequence of...” would be better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be wiser to stick with "numpy array-like", because I think that has come to be recognised as a common usage meaning "I can do an as_array() on it".
The idea may extend to other array types like CUDA or dask, as well as numpy.
In addition to iterables (of iterables), it can mean an object that provides .shape + .dtype, or __array_interface__ or __array__.
There's a nice discussion here : https://stackoverflow.com/a/40380014

@pp-mo
Copy link
Member

pp-mo commented Mar 11, 2020

Travis failed on image comparisons. I'm pretty sure I can't have caused this!

Yes, not your fault. Working on it ... #3682

@rcomer rcomer force-pushed the dimcoord-creation-doc branch from f33f382 to 104a84a Compare March 21, 2020 17:26
@rcomer
Copy link
Member Author

rcomer commented Mar 21, 2020

Rebased 😎

@bjlittle
Copy link
Member

@rcomer Thanks for this.... Don't quite understand why this is still unmerged, so I'm banking it 👍

@bjlittle bjlittle merged commit 37f4106 into SciTools:master Aug 23, 2020
tkknight added a commit to tkknight/iris that referenced this pull request Aug 29, 2020
* master:
  Support for climatological in Coord.from_coord() and DimCoord.from_regular(). (SciTools#3802)
  clarify unit handling (SciTools#3803)
  Add quality flags to whatsnew (SciTools#3801)
  add args/kwargs to DimCoord.__init__ docstring (SciTools#3681)
  Merge launch_ancils feature branch.
  Modify parsing of ff headers to avoid numpy.fromfile. (SciTools#3791)
@rcomer rcomer deleted the dimcoord-creation-doc branch September 16, 2020 10:48
rcomer added a commit to rcomer/iris that referenced this pull request Sep 16, 2020
@rcomer rcomer mentioned this pull request Sep 16, 2020
trexfeathers pushed a commit that referenced this pull request Sep 16, 2020
tkknight added a commit to tkknight/iris that referenced this pull request Sep 20, 2020
* master:
  Whatsnew for effects on aux factories of units defaulting to 'unknown'. (SciTools#3870)
  Whatsnew entry for SciTools#3867. (SciTools#3868)
  Developer guide overhaul (SciTools#3852)
  Update CF standard name table to v75 (SciTools#3867)
  Link to new classes and methods in the Ancillary variables whatsnew. (SciTools#3865)
  update black version (SciTools#3866)
  Fix whatsnew api links. (SciTools#3856)
  Add additional pre-commit hooks (SciTools#3862)
  update pre-commit flake8 version (SciTools#3863)
  whatsnew - update announcement (SciTools#3861)
  whatsnew - remove contents directive (SciTools#3859)
  whatsnew - links and versions (SciTools#3853)
  Replace deprecated IndexFormatter (SciTools#3857)
  whatsnew for SciTools#3681 (SciTools#3858)
  Whatsnew entry for SciTools#3846. (SciTools#3855)
  Image tests: set agg backend after rcdefaults (SciTools#3846)
  whatnew - announcements (SciTools#3850)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add detail to DimCoord.__init__ docstring

3 participants