Skip to content

Commit

Permalink
Merge pull request #282 from fnhirwa/docs
Browse files Browse the repository at this point in the history
[Docs] Fix the rendering issues in documentation docstrings
  • Loading branch information
observingClouds authored Jul 2, 2024
2 parents a995de2 + 81c2418 commit 59c5537
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 2 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Preparing Pull Requests
whenever you commit.

Now you have an environment called ``bitinfo`` that you can work in.
Youll need to make sure to activate that environment next time you want
You'll need to make sure to activate that environment next time you want
to use it after closing the terminal or your system.

You can now edit your local working copy and run/add tests as necessary.
Expand All @@ -117,9 +117,7 @@ Preparing Pull Requests

``pre-commit`` also runs::

* `mypy <http://mypy-lang.org/>`_ for static type checking on
`type hints <https://docs.python.org/3/library/typing.html>`_.
* `isort <https://pycqa.github.io/isort/>`_ sorting imports
* `ruff <https://docs.astral.sh/ruff/>`_ code formatter.
* `black <https://black.readthedocs.io/en/stable/>`_ code formatting
* `flake8 <https://flake8.pycqa.org/en/latest/>`_ code linting
..
Expand Down
2 changes: 2 additions & 0 deletions xbitinfo/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def add_bitinfo_labels(
Example
-------
Plotting a single-dimension coordinate dataset:
>>> ds = xr.tutorial.load_dataset("air_temperature")
>>> info_per_bit = xb.get_bitinformation(ds, dim="lon")
>>> inflevels = [1.0, 0.9999, 0.99, 0.975, 0.95]
Expand All @@ -72,6 +73,7 @@ def add_bitinfo_labels(
... ) # doctest: +ELLIPSIS
Plotting a multi-dimensional coordinate dataset
>>> v = "Tair"
>>> ds = xr.tutorial.load_dataset("rasm")
>>> dim = "y"
Expand Down
10 changes: 7 additions & 3 deletions xbitinfo/xbitinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,22 +678,26 @@ def get_prefect_flow(paths=[]):
Example
-------
Imagine n files of identical structure, i.e. 1-year per file climate model output:
>>> ds = xr.tutorial.load_dataset("rasm")
>>> year, datasets = zip(*ds.groupby("time.year"))
>>> paths = [f"{y}.nc" for y in year]
>>> xr.save_mfdataset(datasets, paths)
Create prefect.Flow and run sequentially
>>> flow = xb.get_prefect_flow(paths=paths)
>>> import prefect
>>> logger = prefect.context.get("logger")
>>> logger.setLevel("ERROR")
>>> st = flow.run()
Inspect flow state
>>> # flow.visualize(st) # requires graphviz
Run in parallel with dask:
>>> import os # https://docs.xarray.dev/en/stable/user-guide/dask.html
>>> os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE"
>>> from prefect.executors import DaskExecutor, LocalDaskExecutor
Expand All @@ -707,14 +711,14 @@ def get_prefect_flow(paths=[]):
>>> # flow.run(executor=executor, parameters=dict(overwrite=True))
Modify parameters of a flow:
>>> flow.run(parameters=dict(inflevel=0.9999, overwrite=True))
<Success: "All reference tasks succeeded.">
See also
--------
- https://examples.dask.org/applications/prefect-etl.html
- https://docs.prefect.io/core/getting_started/basic-core-flow.html
`ETL Pipelines with Prefect <https://examples.dask.org/applications/prefect-etl.html/>`__ and
`Run a flow <https://docs.prefect.io/core/getting_started/basic-core-flow.html>`__
"""

from prefect import Flow, Parameter, task, unmapped
Expand Down

0 comments on commit 59c5537

Please sign in to comment.