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
from rasterio import windows | |
def snap(window): | |
""" Handle rasterio's floating point precision (sub pixel) windows """ | |
# Adding the offset differences to the dimensions will handle case where width/heights can 1 pixel too small | |
# after the offsets are shifted. | |
# This ensures pixel contains the bounds that were originally passed to windows.from_bounds() | |
col_off, row_off = math.floor(window.col_off), math.floor(window.row_off) | |
col_diff, row_diff = window.col_off - col_off, window.row_off - row_off |
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
# https://gis.stackexchange.com/a/462686/2856 | |
# CC-BY-SA 4.0 | |
import os | |
import zipfile | |
from osgeo import gdal | |
gdal.UseExceptions() | |
input = "/path/to/terr50_gagg_gb.zip" |
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
# -*- coding: utf-8 -*- | |
import os | |
import arcpy | |
from osgeo import gdal | |
class Toolbox(object): | |
def __init__(self): | |
self.label = "AddCOG Toolbox" |
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
# dask geopandas rasterstats distributed demo | |
from dask.dataframe import from_delayed | |
from dask.distributed import Client, LocalCluster, as_completed | |
import dask_geopandas as dgpd | |
import geopandas as gpd | |
import pandas as pd | |
import scipy.stats | |
from rasterstats import zonal_stats |
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
from functools import partial | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
from rasterstats import gen_zonal_stats # if using ArcGIS Pro, clone arcgispro-py3 and install rasterstats into the clone. | |
def histogram(arr, bins=10): | |
"""Generate a histogram |
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
#!/usr/bin/python3 | |
#licensed under the Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0 | |
""" Copy GTK themes to flatpak runtimes """ | |
import sys | |
import shutil | |
import subprocess | |
from pathlib import Path | |
encoding = sys.getfilesystemencoding() |
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
# 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 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 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 enum import Enum | |
import numpy as np | |
class Transform(Enum): | |
linear = 'linear' | |
log = 'log' | |
equal = 'equal' | |
halfcauchy = 'halfcauchy' |
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
#!/usr/bin/env python3 | |
# -*- coding: iso-8859-1 -*- | |
###################################################################### | |
# Copyright: lpinner 2021 | |
# License: Apache 2.0 | |
##################################################################### | |
import os | |
import subprocess |
NewerOlder