Skip to content

Instantly share code, notes, and snippets.

View rbavery's full-sized avatar

Ryan Avery rbavery

View GitHub Profile
@rbavery
rbavery / pystac_validation_error_mlm.txt
Created September 19, 2024 22:37
long difficult to decipher validation error from pystac
pystac.errors.STACValidationError: Validation failed for Feature at /home/rave/mlm-form/item.json with ID item against schema at https://crim-ca.github.io/mlm-extension/v1.2.0/schema.json
{'type': 'Feature', 'stac_version': '1.0.0', 'id': 'item', 'properties': {'start_datetime': '1900-01-01T00:00:00Z', 'end_datetime': '9999-01-01T00:00:00Z', 'description': 'An Item with Machine Learning Model Extension metadata.', 'datetime': None, 'mlm:framework': 'Pytorch', 'mlm:framework_version': '2.3.0', 'mlm:memory_size': 1, 'mlm:batch_size_suggestion': 3300, 'mlm:accelerator': 'cuda', 'mlm:accelerator_constrained': True, 'mlm:accelerator_summary': '', 'mlm:accelerator_count': 1, 'mlm:name': 'Eurosat classifier', 'mlm:architecture': 'Resnet-18', 'mlm:tasks': ['scene-classification'], 'mlm:input': [{'name': 'Sentinel-2 13 band input', 'bands': ['"B01"', '"B02"', '"B03"', '"B04"', '"B05"', '"B06"', '"B07"', '"B08"', '"B8A"', '"B09"', '"B10"', '"B11"', '"B12"'], 'input': {'shape': [-1, 13, 64, 64], 'dim_order': ['batch', '
from fasthtml.common import *
import json
app, rt = fast_app(hdrs=(picolink))
main_element_style = "padding-left: 25px;"
control_container_style = "display: flex; flex-direction: column; align-items: flex-start;"
text_input_style = "width: 400px; text-align: center;"
@rbavery
rbavery / planet_labs_order.sh
Last active September 30, 2020 00:25
Search for, submit and download large, long running orders with porder
# export pl api key if porder doesn't work after using planet init. you can use porder quota to check if it is authenticated
export PL_API_KEY=######################
# create an idlist from an aoi and date range. there are other filters in the porder docs for more complicated orders
porder idlist --input "full path to .geojson" --start "2018-02-01" --end "2020-09-28" --item "PSScene4Band" --asset "analytic_sr" --outfile "full path to idlist.csv" --cmax ".10" --overlap "15" --number 10000000
# splits idlist into multiple csvs with max order size length. you can make 10 orders of size 500 at a time for a total of 5000 assets being processed at a time
porder idsplit --idlist "full path to idlist.csv" --lines "500" --local "full path to splitcsvs folder"
# get list of csv filenames
cd "full path to splitcsvs folder"
csvs=$(ls *.csv)
cd ..
@rbavery
rbavery / gedi_to_vector.py
Last active January 16, 2023 00:17 — forked from KMarkert/gedi_to_vector.py
Python script to take GEDI level 2 data and convert variables to a geospatial vector format. This fork allows you to get whole-stand level variables such as fhd_normal and the BEAM ID (important for coverage vs power beam type). Usage `python gedi_to_vector.py <path> --variables [<var1>,<var2>,...,<varN>] --outFormat <extension> --filterBounds […
import os
import fire
import h5py
import glob
import tqdm
import numpy as np
import pandas as pd
import geopandas as gpd
# requires fire, h5py, tqdm, numpy, pandas, and geopandas