Skip to content

Instantly share code, notes, and snippets.

@gadomski
gadomski / test_stac_copy.sh
Created Jun 22, 2021
Testing `stac copy` with various catalog types
View test_stac_copy.sh
#!/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 Jun 9, 2021
Extracting a stactools subpackage to its own repository
View extract_stactools_subpackage.sh
#!/usr/bin/env sh
set -ex
if [ $# -ne 1 ]; then
echo "USAGE: $0 NAME"
exit 1
fi
name=$1
View CMakeLists.txt
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 Mar 28, 2017
CPD rigid with scaling
View rigid.cpp
#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;
View Makefile
UNAVCO_DATA_OUT:=data-out.unavco.org
SITES:=$(shell cat pbo-sites.txt)
DAYS:=$(shell seq 314 328)
pbo: $(foreach site,$(SITES),$(foreach day,$(DAYS),rinex/2016/$(day)/$(site)/$(site)$(day)0.16o.Z))
.PHONY: pbo
rinex/%: Makefile
mkdir -p $(dir $@)
wget --user=anonymous --password=pete@gadom.ski ftp://$(UNAVCO_DATA_OUT)/pub/highrate/1-Hz/rinex/$* -O $@
View Makefile
default:
.PHONY: default
cleaned: $(patsubst 3dd/%.3dd,laz/cleaned/%.laz,$(wildcard 3dd/*.3dd))
.PHONY: cleaned
txt/cleaned/%.txt: txt/original/%.txt
mkdir -p $(dir $@)
echo "X,Y,Z,Intensity" > $@
sed 's/, /,/g' $< >> $@
@gadomski
gadomski / Makefile
Last active Jun 11, 2020
Slope maps with GMT
View Makefile
XMIN:=-105.70
XMAX:=-105.62
YMIN:=40.37
YMAX:=40.41
OGR2GMT:=ogr2ogr -f GMT -spat $(XMIN) $(YMIN) $(XMAX) $(YMAX) -clipsrc spat_extent
default: build/hidden-valley.png
.PHONY: default
clean:
@gadomski
gadomski / pdal-translate.sh
Created Jan 13, 2017
Using a docker image to run `pdal translate` without having to specify volume paths
View pdal-translate.sh
#!/usr/bin/env sh
set -e
docker_image=gadomski/magic-bucket
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
View segfault
(lldb) bt
* thread #2: tid = 0x2fd3d7, 0x0000000100136c3b libentwine.dylib`std::__1::__function::__func<entwine::Tiler::insert(std::__1::function<bool (pdal::PointView&, entwine::BBox)> const&, BigUint const&, unsigned long, entwine::BBox const&, bool)::$_2, std::__1::allocator<entwine::Tiler::insert(std::__1::function<bool (pdal::PointView&, entwine::BBox)> const&, BigUint const&, unsigned long, entwine::BBox const&, bool)::$_2>, void ()>::operator()() [inlined] std::__1::__vector_base<char, std::__1::allocator<char> >::~__vector_base() at vector:452, stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x0000000100136c3b libentwine.dylib`std::__1::__function::__func<entwine::Tiler::insert(std::__1::function<bool (pdal::PointView&, entwine::BBox)> const&, BigUint const&, unsigned long, entwine::BBox const&, bool)::$_2, std::__1::allocator<entwine::Tiler::insert(std::__1::function<bool (pdal::PointView&, entwine::BBox)> const&, BigUint const&, unsigned long, entwine::BBox const&, bool)::$_2>, void
View gist:1962b87c5582595793e3
[1/41] Building CXX object src/CMakeFiles/pdalcpp.dir/filters/PCLBlock.cpp.o
FAILED: /usr/bin/c++ -DHAVE_PYTHON=1 -Dpdalcpp_EXPORTS -Wextra -Wall -Wno-unused-parameter -Wno-unused-variable -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Wredundant-decls -Wno-long-long -std=c++11 -g -fPIC -I../include/stubs -Iinclude -I../src/../include -I/usr/local/include -I/usr/include/libxml2 -isystem /usr/include/python2.7 -isystem /usr/local/lib/python2.7/site-packages/numpy/core/include -MMD -MT src/CMakeFiles/pdalcpp.dir/filters/PCLBlock.cpp.o -MF src/CMakeFiles/pdalcpp.dir/filters/PCLBlock.cpp.o.d -o src/CMakeFiles/pdalcpp.dir/filters/PCLBlock.cpp.o -c ../src/filters/PCLBlock.cpp
In file included from ../src/filters/PCLBlock.cpp:35:
../src/../include/pdal/PCLConversions.hpp:194:17: error: no matching constructor for initialization of 'pcl::SetIfFieldExists<typename PointCloud<PointNormal>::PointType, boost::uint32_t>'
pcl::SetIfFieldExists<typename CloudT::PointType, boost::uint32_t> (