Skip to content

Commit

Permalink
Update healpix gridspec documentation (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandorkertesz authored Nov 13, 2024
1 parent d1e9c28 commit a786930
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
34 changes: 34 additions & 0 deletions docs/gridspec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,37 @@ Example:
.. code-block::
{"grid": [1, 1]}
HEALPix nested grid
------------------------------------------

The ``grid`` format is::

HXXX

The ``ordering`` must be set to ``"nested"``. For details about this grid, see `here <https://en.wikipedia.org/wiki/HEALPix>`_.

Example:

.. code-block::
{"grid": "H512", "ordering": "nested"}
HEALPix ring grid
------------------------------------------

The ``grid`` format is::

HXXX

The ``ordering`` can be omitted or set to ``"ring"``. For details about this grid, see `here <https://en.wikipedia.org/wiki/HEALPix>`_.

Example:

.. code-block::
{"grid": "H512", "ordering": "ring"}
{"grid": "H512"}
7 changes: 6 additions & 1 deletion earthkit/regrid/sphinxext/generate_inventory_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
def to_str(gs):
if isinstance(gs, str):
return gs
return {"grid": gs["grid"]}

grid = gs["grid"]
if isinstance(grid, str) and grid.startswith("H"):
return {"grid": gs["grid"], "ordering": gs["ordering"]}
else:
return {"grid": gs["grid"]}


def make_gs_block(source, target):
Expand Down

0 comments on commit a786930

Please sign in to comment.