{ "cells": [ { "cell_type": "markdown", "id": "355e0c61", "metadata": {}, "source": [ "# New Zealand DEM remake\n", "\n", "See the original notebook [here](https://nbviewer.org/github/royalosyin/Work-with-DEM-data-using-Python-from-Simple-to-Complicated/blob/master/Sup03-Ridgelines%20Map%20of%20DEM.ipynb)." ] }, { "cell_type": "code", "execution_count": 1, "id": "9d10728d", "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:38:36.146440Z", "iopub.status.busy": "2024-04-17T07:38:36.146184Z", "iopub.status.idle": "2024-04-17T07:38:36.464439Z", "shell.execute_reply": "2024-04-17T07:38:36.464116Z" } }, "outputs": [], "source": [ "import pandas as pd\n", "\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "4d778c93", "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:38:36.466035Z", "iopub.status.busy": "2024-04-17T07:38:36.465850Z", "iopub.status.idle": "2024-04-17T07:38:36.468086Z", "shell.execute_reply": "2024-04-17T07:38:36.467882Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "7faa0eb9", "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:38:36.469253Z", "iopub.status.busy": "2024-04-17T07:38:36.469073Z", "iopub.status.idle": "2024-04-17T07:38:36.470756Z", "shell.execute_reply": "2024-04-17T07:38:36.470580Z" } }, "outputs": [], "source": [ "def dataset_array_to_dataframe(dataset_array):\n", " df = pd.DataFrame.from_records([\n", " (j, i, a)\n", " for i, r in enumerate(dataset_array)\n", " for j, a in enumerate(r)\n", " ], columns=[\"x\", \"y\", \"h\"])\n", " return df" ] }, { "cell_type": "code", "execution_count": 4, "id": "439267fa", "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:38:36.471732Z", "iopub.status.busy": "2024-04-17T07:38:36.471618Z", "iopub.status.idle": "2024-04-17T07:38:36.857892Z", "shell.execute_reply": "2024-04-17T07:38:36.857616Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(1095, 3)\n" ] }, { "data": { "text/html": [ "\n", " | x | \n", "y | \n", "h | \n", "
---|---|---|---|
505 | \n", "105 | \n", "2 | \n", "130.991302 | \n", "
507 | \n", "107 | \n", "2 | \n", "19.021566 | \n", "
910 | \n", "110 | \n", "4 | \n", "39.025543 | \n", "
914 | \n", "114 | \n", "4 | \n", "4.319343 | \n", "
915 | \n", "115 | \n", "4 | \n", "41.220718 | \n", "