xarray icon indicating copy to clipboard operation
xarray copied to clipboard

add doctest examples for core xarray APIs

Open nicpittman opened this issue 3 months ago • 1 comments

This PR Implements part of the request in issue #6793 by adding simple and runnable doctest-ready examples for a subset of core APIs. Other methods noted in the issue remain out-of-scope for this PR. It also fixes a couple of outdated/broken examples and adds some more See Also links.

New examples were added for some of my favourite methods including:

  • load_dataset
  • load_dataarray
  • open_dataset
  • open_dataarray
  • open_groups
  • open_mfdataset
  • infer_freq
  • polyval
  • decode_cf
  • Dataset.compute
  • Dataset.persist
  • Dataset.drop_dims
  • get_options
  • unify_chunks

This PR fixes several outdated or inconsistent doctests: updating the monthly frequency example in save_mfdataset and modernising See Also references.

Happy to adjust formatting (e.g., skip flags, repr looseness, stylistic preferences) based on maintainer feedback.

  • [x] References #6793
  • [x] Tests added (doctests across multiple modules)

nicpittman avatar Nov 28 '25 11:11 nicpittman

Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient. If you have questions, some answers may be found in our contributing guidelines.

welcome[bot] avatar Nov 28 '25 11:11 welcome[bot]