-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into pedro/ci_test
- Loading branch information
Showing
16 changed files
with
382 additions
and
338 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# When updating the version, one must also update the docs/source/_static/switcher.json file | ||
version = 1.0 | ||
minor_version = "0" | ||
minor_version = "1" | ||
release_name = "Rio de Janeiro" | ||
|
||
release_version = f"{version}.{minor_version}" |
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
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,26 @@ | ||
# Inspired by https://www.matecdev.com/posts/shapely-polygon-gridding.html | ||
from math import ceil | ||
|
||
import geopandas as gpd | ||
import numpy as np | ||
from shapely.geometry import Polygon | ||
|
||
|
||
def geometry_grid(model_area, srid) -> gpd.GeoDataFrame: | ||
minx, miny, maxx, maxy = model_area.bounds | ||
# Some rough heuristic to get the number of points per sub-polygon in the 2 digits range | ||
subd = ceil((len(model_area.exterior.coords) / 32) ** 0.5) | ||
dx = (maxx - minx) / subd | ||
dy = (maxy - miny) / subd | ||
elements = [] | ||
x1 = minx | ||
for i in range(subd): | ||
j1 = miny | ||
for j in range(subd): | ||
elements.append(Polygon([[x1, j1], [x1, j1 + dy], [x1 + dx, j1 + dy], [x1 + dx, j1]])) | ||
j1 += dy | ||
x1 += dx | ||
|
||
gdf = gpd.GeoDataFrame({"id": np.arange(len(elements))}, geometry=elements, crs=srid) | ||
|
||
return gdf.clip(model_area) |
Oops, something went wrong.