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 pandas as pd | |
datasets={ | |
"PH_Top 10% of service overlap for _PH conservation": { | |
'fig_title' :"Top 10% of service overlap for , PH conservation", | |
'country' :"PH", | |
'labels' :["1 service","2 services","3 services","4 services"], | |
'visParams':{ | |
'min':1, | |
'max':4, |
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 pandas as pd | |
repeating_dec_12ths = ['0833', '1666', '3333', '4166', '5833', '6666', '8333', '9166'] | |
# 0.0833 - 1/12 | |
# 0.1666 - 1/6 | |
# 0.3333 - 1/3 | |
# 0.4166 - 5/12 | |
# 0.5833 - 7/12 | |
# 0.6666 - 2/3 |
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
# run as: | |
# docker run --rm -it -v %CD%:/usr/local/workspace --volume=%CD%/gurobi.lic:/opt/gurobi/gurobi.lic:ro --volume=%CD%/models:/models:ro prioritizr ./run-prioritizations.R | |
FROM gurobi/optimizer | |
RUN apt-get update -qq | |
RUN apt-get install -y libgdal-dev | |
RUN apt-get install -y r-base r-base-dev | |
RUN apt-get install -y libudunits2-dev | |
RUN apt-get install -y libssl-dev |
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
"""Convert isimib2 to geotiff.""" | |
import os | |
import glob | |
import xarray as xr | |
from osgeo import gdal | |
from osgeo import osr | |
LOCAL_RASTER_CREATION_OPTIONS = ( | |
'TILED=YES', 'BIGTIFF=YES', 'COMPRESS=LZW', |
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 numpy | |
import scipy.optimize | |
evi_vs_c = [ | |
(0.02874, 0.95), | |
(0.18186, 0.25), | |
(0.3643000126, 0.13575), | |
(0.33039, 0.07075), | |
(0.54826, 0.035425), | |
(0.65346, 0.0001), |
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
vector = gdal.OpenEx(vector_path, gdal.OF_VECTOR) | |
layer = vector.GetLayer() | |
layer.SetAttributeFilter('Country="USA"') # or whatever... | |
feature = layer.GetNextFeature() | |
geom = feature.GetGeometryRef() | |
envelope = geom.GetEnvelope() | |
target_bb = [envelope[i] for i in [0, 2, 1, 3]]) | |
geom = None | |
feature = None |
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 numpy | |
import matplotlib.pyplot | |
slope_in_radians_list = numpy.linspace(0.089, 0.785, 100) | |
beta_list = [] | |
m_list = [] | |
for slope_in_radians in slope_in_radians_list: | |
beta = ((numpy.sin(slope_in_radians) / 0.0896) / | |
(3 * numpy.sin(slope_in_radians)**0.8 + 0.56)) | |
m_list.append(beta/(1+beta)) |
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
"""InVEST Sediment Delivery Ratio (SDR) module. | |
The SDR method in this model is based on: | |
Winchell, M. F., et al. "Extension and validation of a geographic | |
information system-based method for calculating the Revised Universal | |
Soil Loss Equation length-slope factor for erosion risk assessments in | |
large watersheds." Journal of Soil and Water Conservation 63.3 (2008): | |
105-111. | |
""" | |
import os |
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
clear all | |
close all | |
addpath(genpath(pwd)) | |
% channel init threshold [km2] | |
Ad_ini=1; | |
% length threshold [m] |
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
"""SQLAlchemy models for STAC view.""" | |
from ..db import db | |
class Job(db.Model): | |
"""Stores info about a non-trivial running job invoked from the API.""" | |
__tablename__ = "job_table" | |
job_id = db.Column(db.String, primary_key=True) |
NewerOlder