Look at this existing tutorial https://lerryws.xyz/posts/PyQGIS-in-Jupyter-Notebook
This file contains hidden or 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
| import os | |
| import shutil | |
| import numpy | |
| import pygeoprocessing | |
| import pygeoprocessing.routing | |
| from osgeo import gdal | |
| def doit(dem_path, flow_dir_weights, watershed_source_vector, workspace): |
This file contains hidden or 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
| """Tracer for floodplain extraction function with custom parameters.""" | |
| import logging | |
| import os | |
| import sys | |
| import pygeoprocessing | |
| import pygeoprocessing.routing | |
| import numpy | |
| logging.basicConfig( |
This file contains hidden or 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 small example shows you how to access JS-based requests via Selenium | |
| # Like this, one can access raw data for scraping, | |
| # for example on many JS-intensive/React-based websites | |
| # | |
| from time import sleep | |
| from selenium import webdriver | |
| from selenium.webdriver import DesiredCapabilities |
This file contains hidden or 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
| # Copyright 2019 Luke Pinner | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or 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
| from glob import glob | |
| import multiprocessing | |
| from concurrent.futures import ProcessPoolExecutor | |
| import cv2 | |
| from PIL import Image | |
| import imagehash | |
| from tqdm import tqdm |
This file contains hidden or 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
| def iterate_all(iterable, returned="key"): | |
| """Returns an iterator that returns all keys or values | |
| of a (nested) iterable. | |
| Arguments: | |
| - iterable: <list> or <dictionary> | |
| - returned: <string> "key" or "value" | |
| Returns: |
This file contains hidden or 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
| CREATE OR REPLACE FUNCTION voronoi(table_name text,geom_col text) returns SETOF record as $$ | |
| ############################################################################# | |
| # | |
| # Voronoi diagram calculator/ Delaunay triangulator | |
| # Translated to Python by Bill Simons | |
| # September, 2005 | |
| # | |
| # Additional changes by Carson Farmer added November 2010 | |
| # |
This file contains hidden or 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
| # | |
| # Open a DEM, do a gaussian blur, then save it again | |
| # Heavily based on: | |
| # http://gis.stackexchange.com/questions/9431/what-raster-smoothing-generalization-tools-are-available | |
| # | |
| # Syntax for running snippet: | |
| # python smoothDem.py input.tif output.tif 5 | |
| # |