Skip to content

Instantly share code, notes, and snippets.

{"type": "FeatureCollection", "features": [{"geometry": {"type": "MultiPolygon", "coordinates": [[[[-180.0, 3.5], [-179.983346, 3.5], [-179.983346, -4.98335], [-155.0, -5.0], [-145.0, 3.5], [-120.0, 3.5], [-120.0, 30.0], [-120.833333, 30.75], [-123.25, 34.5], [-124.2, 36.0], [-125.833333, 35.5], [-126.933333, 36.450012], [-127.0, 37.500006], [-127.0, 40.833333], [-126.9, 40.983333], [-126.5, 45.0], [-127.916675, 48.166667], [-128.0, 48.333333], [-133.75, 51.0], [-135.0, 52.716667], [-137.0, 53.366668], [-151.75, 56.750012], [-153.0, 56.0], [-160.0, 53.5], [-167.816667, 51.4], [-176.566667, 50.116683], [-179.98335, 49.68334], [-180.0, 47.6433115], [-180.0, 3.5]]], [[[180.0, 47.6433115], [162.91666699999996, 45.7], [165.0, 43.0], [164.98334999999997, 26.98335], [154.98334999999997, 26.98335], [154.98334999999997, 21.0], [129.98334999999997, 20.98335], [130.0, 7.0], [133.0, 3.5], [141.0, 3.5], [141.0, 0.0], [159.98334999999997, 0.0], [159.98334999999997, 3.5], [179.98334999999997, 3.5], [180.0, 3.5], [180.0, 47.
@gadomski
gadomski / .pre-commit-config.yaml
Created October 6, 2023 13:19
My base pre-commit config for new Python project
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
@gadomski
gadomski / download.sh
Created September 11, 2023 22:55
Download imagery from Earth Search, the Planetary Computer, and USGS Landsat (requires active AWS credentials)
#!/usr/bin/env sh
set -e
lat=39.9992
lon=-105.2815
intersects="{\"type\":\"Point\",\"coordinates\":[$lon,$lat]}"
outdir=data
stac-client search https://earth-search.aws.element84.com/v1 \
@gadomski
gadomski / audit.sh
Created February 9, 2023 20:38
Audit stactools-packages
#!/usr/bin/env zsh
source ~/.zshrc
set -e
if [ "$#" -ne 1 ]; then
echo "Must pass one param"
echo "USAGE: ./audit.sh <name>"
exit 1
@gadomski
gadomski / pc-raster-footprint.md
Created February 3, 2023 16:12
Planetary Computer raster footprint evalualtion

Final results

After visualization, the following collections could do with a raster footprint update:

  • gnatsgo-rasters
  • nrcan-landcover
  • chesapeake-lu
  • chesapeake-lc-7
  • chesapeake-lc-13

Current layout:

  • pystac-client provides a CLI named stac-client, using argparse
  • stactools provides a CLI named stac, using click
graph LR

pystac[PySTAC]
pystac-client-cli[pystac-client CLI]
@gadomski
gadomski / test_stac_copy.sh
Created June 22, 2021 12:19
Testing `stac copy` with various catalog types
#!/usr/bin/env sh
set -ex
print_links () {
jq '.links[]' $1/catalog.json
jq '.links[]' $1/20170831_172754_101c_3b_Visual/20170831_172754_101c_3b_Visual.json
}
stac copy https://storage.googleapis.com/open-cogs/test-stac/catalog.json test-stac
@gadomski
gadomski / extract_stactools_subpackage.sh
Last active June 9, 2021 17:57
Extracting a stactools subpackage to its own repository
#!/usr/bin/env sh
set -ex
if [ $# -ne 1 ]; then
echo "USAGE: $0 NAME"
exit 1
fi
name=$1
cmake_minimum_required(VERSION 3.1)
project(pdal-downstream)
find_package(PDAL REQUIRED)
add_executable(pdal-downstream main.cpp)
target_link_libraries(pdal-downstream PRIVATE ${PDAL_LIBRARIES})
target_include_directories(pdal-downstream PRIVATE ${PDAL_INCLUDE_DIRS})
@gadomski
gadomski / rigid.cpp
Created March 28, 2017 13:05
CPD rigid with scaling
#include <cpd/jsoncpp.hpp>
#include <cpd/rigid.hpp>
#include <fstream>
#include <iostream>
int main(int argc, char** argv) {
if (argc != 4) {
std::cout << "ERROR: invalid usage" << std::endl;
std::cout << "USAGE: cpd-rigid <fixed> <moving> <outfile>" << std::endl;
return 1;