Skip to content

Commit

Permalink
Update 50_cartoee_quickstart.ipynb (#1948)
Browse files Browse the repository at this point in the history
* Colaboratory를 통해 생성됨

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
osgeokr and pre-commit-ci[bot] authored Mar 19, 2024
1 parent 62def63 commit 0e75cce
Showing 1 changed file with 67 additions and 25 deletions.
92 changes: 67 additions & 25 deletions examples/notebooks/50_cartoee_quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
{
"cell_type": "markdown",
"id": "0",
"metadata": {},
"metadata": {
"id": "0"
},
"source": [
"<a href=\"https://githubtocolab.com/gee-community/geemap/blob/master/examples/notebooks/50_cartoee_quickstart.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open in Colab\"/></a>\n",
"\n",
"Uncomment the following line to install [geemap](https://geemap.org) and [cartopy](https://scitools.org.uk/cartopy/docs/latest/installing.html#installing) if needed. Keep in mind that cartopy can be challenging to install. If you are unable to install cartopy on your computer, you can try Google Colab with this the [notebook example](https://colab.research.google.com/github/gee-community/geemap/blob/master/examples/notebooks/cartoee_colab.ipynb). \n",
"Uncomment the following line to install [geemap](https://geemap.org) and [cartopy](https://scitools.org.uk/cartopy/docs/latest/installing.html#installing) if needed. Keep in mind that cartopy can be challenging to install. If you are unable to install cartopy on your computer, you can try Google Colab with this the [notebook example](https://colab.research.google.com/github/gee-community/geemap/blob/master/examples/notebooks/cartoee_colab.ipynb).\n",
"\n",
"See below the commands to install cartopy and geemap using conda/mamba:\n",
"\n",
Expand All @@ -25,7 +27,9 @@
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {},
"metadata": {
"id": "1"
},
"outputs": [],
"source": [
"# !pip install cartopy scipy\n",
Expand All @@ -35,7 +39,9 @@
{
"cell_type": "markdown",
"id": "2",
"metadata": {},
"metadata": {
"id": "2"
},
"source": [
"# How to create publication quality maps using `cartoee`\n",
"\n",
Expand All @@ -46,13 +52,16 @@
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {},
"metadata": {
"id": "3"
},
"outputs": [],
"source": [
"%pylab inline\n",
"\n",
"import ee\n",
"import geemap\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# import the cartoee functionality from geemap\n",
"from geemap import cartoee"
Expand All @@ -62,7 +71,9 @@
"cell_type": "code",
"execution_count": null,
"id": "4",
"metadata": {},
"metadata": {
"id": "4"
},
"outputs": [],
"source": [
"geemap.ee_initialize()"
Expand All @@ -71,7 +82,9 @@
{
"cell_type": "markdown",
"id": "5",
"metadata": {},
"metadata": {
"id": "5"
},
"source": [
"## Plotting an image\n",
"\n",
Expand All @@ -82,7 +95,9 @@
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {},
"metadata": {
"id": "6"
},
"outputs": [],
"source": [
"# get an image\n",
Expand All @@ -93,7 +108,9 @@
"cell_type": "code",
"execution_count": null,
"id": "7",
"metadata": {},
"metadata": {
"id": "7"
},
"outputs": [],
"source": [
"# geospatial region in format [E,S,W,N]\n",
Expand All @@ -105,7 +122,9 @@
"cell_type": "code",
"execution_count": null,
"id": "8",
"metadata": {},
"metadata": {
"id": "8"
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(15, 10))\n",
Expand All @@ -122,13 +141,15 @@
"# add coastlines using the cartopy api\n",
"ax.coastlines(color=\"red\")\n",
"\n",
"show()"
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "9",
"metadata": {},
"metadata": {
"id": "9"
},
"source": [
"This is a decent map for minimal amount of code. But we can also easily use matplotlib colormaps to visualize our EE results to add more color. Here we add a `cmap` keyword to the `.get_map()` and `.add_colorbar()` functions."
]
Expand All @@ -137,7 +158,9 @@
"cell_type": "code",
"execution_count": null,
"id": "10",
"metadata": {},
"metadata": {
"id": "10"
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(15, 10))\n",
Expand All @@ -161,13 +184,15 @@
"\n",
"ax.set_title(label=\"Global Elevation Map\", fontsize=15)\n",
"\n",
"show()"
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "11",
"metadata": {},
"metadata": {
"id": "11"
},
"source": [
"## Plotting an RGB image\n",
"\n",
Expand All @@ -178,7 +203,9 @@
"cell_type": "code",
"execution_count": null,
"id": "12",
"metadata": {},
"metadata": {
"id": "12"
},
"outputs": [],
"source": [
"# get a landsat image to visualize\n",
Expand All @@ -192,7 +219,9 @@
"cell_type": "code",
"execution_count": null,
"id": "13",
"metadata": {},
"metadata": {
"id": "13"
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(15, 10))\n",
Expand All @@ -209,13 +238,15 @@
"# add the coastline\n",
"ax.coastlines(color=\"yellow\")\n",
"\n",
"show()"
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "14",
"metadata": {},
"metadata": {
"id": "14"
},
"source": [
"By default, if a region is not provided via the `region` keyword the whole extent of the image will be plotted as seen in the previous Landsat example. We can also zoom to a specific region of an image by defining the region to plot."
]
Expand All @@ -224,7 +255,9 @@
"cell_type": "code",
"execution_count": null,
"id": "15",
"metadata": {},
"metadata": {
"id": "15"
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(15, 10))\n",
Expand All @@ -242,13 +275,15 @@
"# add coastline\n",
"ax.coastlines(color=\"yellow\")\n",
"\n",
"show()"
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "16",
"metadata": {},
"metadata": {
"id": "16"
},
"source": [
"## Adding north arrow and scale bar"
]
Expand All @@ -257,7 +292,9 @@
"cell_type": "code",
"execution_count": null,
"id": "17",
"metadata": {},
"metadata": {
"id": "17"
},
"outputs": [],
"source": [
"fig = plt.figure(figsize=(15, 10))\n",
Expand Down Expand Up @@ -287,19 +324,24 @@
"\n",
"ax.set_title(label=\"Landsat False Color Composite (Band 5/4/3)\", fontsize=15)\n",
"\n",
"show()"
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18",
"metadata": {},
"metadata": {
"id": "18"
},
"outputs": [],
"source": []
}
],
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
Expand Down

0 comments on commit 0e75cce

Please sign in to comment.