Skip to content

Instantly share code, notes, and snippets.

View richpsharp's full-sized avatar

Richard Sharp richpsharp

View GitHub Profile
@richpsharp
richpsharp / Dockerfile
Last active April 15, 2020 19:03
Docker build for Python 3.8 GDAL 3.0.4, w/ ZSTD extensions, and PyGeoprocessing 2.0 release
FROM python:3.8-slim-buster as builder
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
cmake build-essential wget ca-certificates unzip pkg-config \
zlib1g-dev libfreexl-dev libxml2-dev
# making directory to avoid this JDK installation bug: https://github.com/geerlingguy/ansible-role-java/issues/64
RUN mkdir /usr/share/man/man1
RUN apt-get install -y openjdk-11-jdk-headless
@richpsharp
richpsharp / run_sdr.py
Created April 6, 2020 06:03
Example file of how to run SDR with the c-factor extension in a script
"""Example of how to use experimental SDR c-factor."""
import sys
import logging
import natcap.invest.sdr.sdr
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
args = {
'biophysical_table_path': './data/biophysical_SDR.csv',
@richpsharp
richpsharp / pygeoprocessing_build_log.txt
Created March 13, 2020 19:09
Build log from broken pgp build
root@6de621f3074a:/usr/local/pygeoprocessing# python setup.py install
running install
running bdist_egg
running egg_info
creating pygeoprocessing.egg-info
writing pygeoprocessing.egg-info/PKG-INFO
writing dependency_links to pygeoprocessing.egg-info/dependency_links.txt
writing requirements to pygeoprocessing.egg-info/requires.txt
writing top-level names to pygeoprocessing.egg-info/top_level.txt
writing manifest file 'pygeoprocessing.egg-info/SOURCES.txt'
@richpsharp
richpsharp / planet_bb_query_demo.py
Created March 3, 2020 21:53
Planet Bounding Box quad query demo for Sam
import argparse
import requests
def demo(mosaic_id, planet_api_key):
"""Demo of searching multiple bounding boxes.
Parameters:
mosaic_id (str): planet mosaic id.
planet_api_key (str): Planet API key.
@richpsharp
richpsharp / axis_map_test.py
Created February 25, 2020 17:31
example of axis mapping strategy effects on GDAL 3.0
from osgeo import osr
wgs84 = osr.SpatialReference()
wgs84.ImportFromEPSG(4326)
utm10 = osr.SpatialReference()
utm10.ImportFromEPSG(26910)
# Play with these settings, you'll find the utm10 strategey makes no difference bu
# the wgs84 one needs traditional order
wgs84.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)