浏览代码

Add additional GRASS info to the main example notebook (#1686)

* Add links to documentation.
* List content of the current location (g.list, search path).
* List GRASS modules (g.search.modules).
Caitlin H 3 年之前
父节点
当前提交
78feee7c26
共有 1 个文件被更改,包括 74 次插入27 次删除
  1. 74 27
      doc/notebooks/example_notebook.ipynb

+ 74 - 27
doc/notebooks/example_notebook.ipynb

@@ -1,23 +1,8 @@
 {
 {
- "metadata": {
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": 3
-  },
-  "orig_nbformat": 2
- },
- "nbformat": 4,
- "nbformat_minor": 2,
  "cells": [
  "cells": [
   {
   {
+   "cell_type": "markdown",
+   "metadata": {},
    "source": [
    "source": [
     "# Try GRASS GIS in Jupyter Notebook with Python\n",
     "# Try GRASS GIS in Jupyter Notebook with Python\n",
     "\n",
     "\n",
@@ -35,9 +20,7 @@
     "## Start\n",
     "## Start\n",
     "\n",
     "\n",
     "There are several ways to use GRASS GIS. When using Python in a notebook, we usually find GRASS GIS Python packages first, import them, initialize GRASS GIS session, and set several variables useful for using GRASS GIS in a notebook."
     "There are several ways to use GRASS GIS. When using Python in a notebook, we usually find GRASS GIS Python packages first, import them, initialize GRASS GIS session, and set several variables useful for using GRASS GIS in a notebook."
-   ],
-   "cell_type": "markdown",
-   "metadata": {}
+   ]
   },
   },
   {
   {
    "cell_type": "code",
    "cell_type": "code",
@@ -77,14 +60,14 @@
    ]
    ]
   },
   },
   {
   {
+   "cell_type": "markdown",
+   "metadata": {},
    "source": [
    "source": [
     "## Raster buffer\n",
     "## Raster buffer\n",
     "\n",
     "\n",
     "Set computational region and create multiple buffers in given distances\n",
     "Set computational region and create multiple buffers in given distances\n",
     "around lakes represented as raster:"
     "around lakes represented as raster:"
-   ],
-   "cell_type": "markdown",
-   "metadata": {}
+   ]
   },
   },
   {
   {
    "cell_type": "code",
    "cell_type": "code",
@@ -101,15 +84,15 @@
    ]
    ]
   },
   },
   {
   {
+   "cell_type": "markdown",
+   "metadata": {},
    "source": [
    "source": [
     "## Vector buffer\n",
     "## Vector buffer\n",
     "\n",
     "\n",
     "Create a negative buffer around state boundary represented as a vector.\n",
     "Create a negative buffer around state boundary represented as a vector.\n",
     "Vector modules typically don't follow computational region,\n",
     "Vector modules typically don't follow computational region,\n",
     "but we set it to inform display modules about our area of interest."
     "but we set it to inform display modules about our area of interest."
-   ],
-   "cell_type": "markdown",
-   "metadata": {}
+   ]
   },
   },
   {
   {
    "cell_type": "code",
    "cell_type": "code",
@@ -126,6 +109,70 @@
     "gs.run_command('d.legend.vect', at=(10, 35))\n",
     "gs.run_command('d.legend.vect', at=(10, 35))\n",
     "Image(filename=\"map.png\")"
     "Image(filename=\"map.png\")"
    ]
    ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Additional GRASS Information and Tutorials\n",
+    "\n",
+    "To find more information on what one can do with GRASS GIS APIs, check out:\n",
+    "    \n",
+    " - [GRASS GIS Manual](https://grass.osgeo.org/grass-stable/manuals)\n",
+    "    \n",
+    " - [GRASS Python API Manual](https://grass.osgeo.org/grass-stable/manuals/libpython)\n",
+    "\n",
+    "For more Jupyter Notebook GRASS GIS tutorials, visit:\n",
+    " - [Try GRASS GIS online](https://grass.osgeo.org/learn/tryonline/)\n",
+    "\n",
+    "## What else is in the sample North Carolina dataset?"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "print(gs.read_command(\"g.list\", type=\"all\"))"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## What other GRASS modules can I try in this notebooks?"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "print(gs.read_command(\"g.search.modules\", flags=\"g\"))"
+   ]
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3",
+   "language": "python",
+   "name": "python3"
+  },
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 3
+   },
+   "file_extension": ".py",
+   "mimetype": "text/x-python",
+   "name": "python",
+   "nbconvert_exporter": "python",
+   "pygments_lexer": "ipython3",
+   "version": "3.8.5"
   }
   }
- ]
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
 }
 }