Docs: make all API reference examples self-contained

Abierto
#61 0 comentarios 0 reacciones 1 asignado Ver en GitHub

@sadielbartholomew ya está trabajando en esto.

Desde el 17/4/2020.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

documentation enhancement

Some code examples for functions & methods (etc.) in the API reference of the documentation start from a pre-defined state where required fields have already been setup by unspecified code, e.g. (from here) the cf.Bounds.has_property example begins with an undefined f of nature irrelevant:

>>> f.set_property('project', 'CMIP7')
>>> f.has_property('project')
True

whereas the remainder are 'sefl-contained' in that they can be executed directly without error in Python, assuming only an appropriate environment & having run import cf, e.g (from here) where d is defined before it is used for illustration:

>>> d = cf.Data([[4, 2, 1], [1, 2, 3]], 'metre')
>>> d.unique()
<CF Data: [1, 2, 3, 4] metre>

We should convert those in the former state to the latter state by specifying required setup steps. Not only would it make it more useful to users so they can explore the examples more readily, it is a prerequisite to adding docstring example checking (see #57).

Preferably, fields etc. of the required nature would be created using cf construction methods, to promote those. Failing that, they can be created &/or adapted form one of the cf.example_field field constructs, & as part of this work it may be useful to extend the number of those for variety to minimise such example setup.

Lenguaje dominante
Python
Estrellas
150
Forks
23
Merge medio
1 d 11 h
PR fusionados (30 d)
2

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NCAS-CMS/cf-python

Todos los issues de NCAS-CMS/cf-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.