From 665fed285a1d4d21833db74e8bcf59b0d86b56d0 Mon Sep 17 00:00:00 2001 From: srinijammula Date: Thu, 7 Nov 2024 16:12:08 -0500 Subject: [PATCH] Arctan warning in dem.ipynb --- book/chapters/dem.ipynb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/book/chapters/dem.ipynb b/book/chapters/dem.ipynb index 0ff64a8..562240c 100644 --- a/book/chapters/dem.ipynb +++ b/book/chapters/dem.ipynb @@ -248,6 +248,7 @@ }, { "cell_type": "markdown", + "id": "55ffbb9d", "metadata": {}, "source": [ "Extract various terrain features from the DEM, such as slope, aspect, curvature, northness, and eastness, and save the results." @@ -443,7 +444,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "5c04ab81", "metadata": {}, "outputs": [], @@ -452,8 +453,8 @@ " with rasterio.open(dem_file) as dataset:\n", " dem_data = dataset.read(1)\n", " dy, dx = np.gradient(dem_data, dataset.res[0], dataset.res[1])\n", - " northness = np.arctan(dy / np.sqrt(dx**2 + dy**2))\n", - " eastness = np.arctan(dx / np.sqrt(dx**2 + dy**2))\n", + " northness = np.arctan2(dy , np.sqrt(dx**2 + dy**2))\n", + " eastness = np.arctan2(dx , np.sqrt(dx**2 + dy**2))\n", " return northness, eastness\n" ] },