-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed a bug in RKF time step accounting.
The set tolerances were not always respected.
- Loading branch information
1 parent
23fda70
commit 24e9001
Showing
5 changed files
with
147 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4d8a8e39-8429-43db-b71d-62c38611922f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import geopandas as gp\n", | ||
"import numpy as np\n", | ||
"import pandas as pd\n", | ||
"import shapely\n", | ||
"from shapely import Point" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "08335445-fffc-4641-bb97-cb2161270636", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"glaciers = gp.read_file(\"../glacier_flow_tools/data/greenland-flux-gates-5.gpkg\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "03a00076-8cbc-48dd-9670-2fb831d0fcb9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"distance = 20_000 # m\n", | ||
"spacing = 4_000 # m" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3400ba1c-1a35-4182-9279-17784006143e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%time\n", | ||
"glaciers_starting_points = []\n", | ||
"for _, glacier in glaciers.iterrows():\n", | ||
" x_c, y_c = glacier.geometry.centroid.coords[0]\n", | ||
" x = np.linspace(x_c - distance, x_c + distance, int(distance * 2 / spacing + 1))\n", | ||
" y = np.linspace(y_c - distance, y_c + distance, int(distance * 2 / spacing + 1))\n", | ||
" X, Y = np.meshgrid(x, y)\n", | ||
"\n", | ||
" gl = [glacier.copy() for _ in range(len(X.ravel()))]\n", | ||
" for m, (x, y) in enumerate(zip(X.ravel(), Y.ravel())):\n", | ||
" gl[m][\"pt\"] = m\n", | ||
" gl[m].geometry = Point(x, y)\n", | ||
"\n", | ||
" glaciers_starting_points.append(gp.GeoDataFrame(gl))\n", | ||
"\n", | ||
"glaciers_starting_points = pd.concat(glaciers_starting_points)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c5f9024b-c6d8-4437-bc06-24872ce57a18", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"glaciers_starting_points.to_file(f\"starting_pts-5-{spacing}m.gpkg\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3f781801-5e72-46f9-95e9-675ab947c2dc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters