From c6fec15135a019e8278e96256e79da77f195ba8b Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 18 Dec 2024 00:53:30 +0800 Subject: [PATCH 1/5] Add enums to the API documentation --- doc/_templates/autosummary/enums.rst | 7 +++++++ doc/api/index.rst | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 doc/_templates/autosummary/enums.rst diff --git a/doc/_templates/autosummary/enums.rst b/doc/_templates/autosummary/enums.rst new file mode 100644 index 00000000000..26883239f1b --- /dev/null +++ b/doc/_templates/autosummary/enums.rst @@ -0,0 +1,7 @@ +{{ fullname | escape | underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :members: + :member-order: bysource diff --git a/doc/api/index.rst b/doc/api/index.rst index 01fac7d7a89..f54723afa7e 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -195,6 +195,19 @@ Getting metadata from tabular or grid data: info grdinfo +Enums +----- + +.. currentmodule:: pygmt.enums + +.. autosummary:: + :toctree: generated + :nosignatures: + :template: autosummary/enums.rst + + GridFormat + +.. currentmodule:: pygmt Miscellaneous ------------- @@ -205,8 +218,6 @@ Miscellaneous which show_versions -.. currentmodule:: pygmt - Datasets -------- From 640a01b4614adb66bf8c1cac843f7bceddce6bc0 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 24 Sep 2024 10:57:01 +0800 Subject: [PATCH 2/5] Add enums GridReg and GridType for grid registration and type --- pygmt/enums.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pygmt/enums.py b/pygmt/enums.py index 7c0984eccb9..1bc42627913 100644 --- a/pygmt/enums.py +++ b/pygmt/enums.py @@ -37,3 +37,21 @@ class GridFormat(IntEnum): GD = 22 #: Import through GDAL EI = 23 #: ESRI Arc/Info ASCII Grid Interchange format (ASCII integer) EF = 24 #: ESRI Arc/Info ASCII Grid Interchange format (ASCII float) + + +class GridReg(IntEnum): + """ + Enum for the grid registration. + """ + + GRIDLINE = 0 #: Gridline registration + PIXEL = 1 #: Pixel registration + + +class GridType(IntEnum): + """ + Enum for the grid type. + """ + + CARTESIAN = 0 #: Cartesian grid + GEOGRAPHIC = 1 #: Geographic grid From 6b112bb0ab67ebcbaf1c4fd3c969db3aab9c86d5 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 19 Dec 2024 10:32:00 +0800 Subject: [PATCH 3/5] Add GridReg and GridType to the API docs --- doc/api/index.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/index.rst b/doc/api/index.rst index f54723afa7e..3c39267bd09 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -205,7 +205,8 @@ Enums :nosignatures: :template: autosummary/enums.rst - GridFormat + GridReg + GridType .. currentmodule:: pygmt From ba8773fa01be95398415dac17b4d2905ed2675b5 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 19 Dec 2024 10:45:31 +0800 Subject: [PATCH 4/5] Rename GridReg to GridRegistration --- pygmt/enums.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/enums.py b/pygmt/enums.py index 1bc42627913..34419a57e06 100644 --- a/pygmt/enums.py +++ b/pygmt/enums.py @@ -39,7 +39,7 @@ class GridFormat(IntEnum): EF = 24 #: ESRI Arc/Info ASCII Grid Interchange format (ASCII float) -class GridReg(IntEnum): +class GridRegistration(IntEnum): """ Enum for the grid registration. """ From dcc30dc47fc3a1ab49586f520e531eaf375146a9 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 19 Dec 2024 10:45:38 +0800 Subject: [PATCH 5/5] Rename GridReg to GridRegistration in docs --- doc/api/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/index.rst b/doc/api/index.rst index 3c39267bd09..07f76aff217 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -205,7 +205,7 @@ Enums :nosignatures: :template: autosummary/enums.rst - GridReg + GridRegistration GridType .. currentmodule:: pygmt