Skip to content

Instantly share code, notes, and snippets.

@schwehr
schwehr / extelt.c
Created February 16, 2024 16:35
Patches to get extelt.c to work in a read only src environment (bazel inside of google3 forge)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF. The full HDF copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. *
* If you do not have access to either file, you may request a copy from *
@schwehr
schwehr / jpeginfo_test.py
Created October 13, 2023 17:35
jpeginfo: Possible starter test
#!/usr/bin/env python3
# Copyright 2023 Google Inc. All Rights Reserved.
"""Tests for jpeginfo command line app."""
import json
import subprocess
import unittest
@schwehr
schwehr / passing_data.py
Created July 5, 2023 16:41
Passing data in multiple different ways
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright 2023 Google Inc. All Rights Reserved.
# I recommend that dataclass decorator option.
import collections
import dataclasses
@schwehr
schwehr / USGS_NLCD_RELEASES_2020_REL_NALCMS.json
Created June 12, 2023 23:42
USGS_NLCD_RELEASES_2020_REL_NALCMS with accents
{
"description": "The 2020 North American Land Cover 30-meter dataset was produced as part of\nthe North American Land Change Monitoring System (NALCMS), a trilateral\neffort between Natural Resources Canada, the United States Geological\nSurvey, and three Mexican organizations including the National Institute of\nStatistics and Geography (Instituto Nacional de Estadística y\nGeografía),\nNational Commission for the Knowledge and Use of the Biodiversity\n(Comisión\nNacional Para el Conocimiento y Uso de la Biodiversidad), and the National\nForestry Commission of Mexico (Comisión Nacional Forestal). The\ncollaboration is facilitated by the Commission for Environmental\nCooperation, an international organization created by the Canada, Mexico,\nand United States governments under the North American Agreement on\nEnvironmental Cooperation to promote environmental collaboration between the\nthree countries.\n\nThe general objective of NALCMS is to devise, through collective effort,
@schwehr
schwehr / NEON_CHM.json
Created May 22, 2023 19:34
NEON CHM STAC preview
{
"description": "Height of the top of canopy above bare earth (Canopy Height Model; CHM);\ndata are mosaicked over the AOP footprint onto a spatially uniform grid at 1\nm spatial resolution. The CHM is generated by creating a continuous surface\nof canopy height estimates across the entire spatial domain of the LiDAR\nsurvey, derived from the LiDAR point cloud. The point cloud is separated\ninto classes representing the ground and vegetation returns. The ground\nclassified points allow for calculation of a height normalized point cloud\nto provide a relative estimate of vegetation elevation. A surface is then\ngenerated using the height normalized vegetation points to produce the\nCHM. Any canopy heights less than 2m are set to zero for data collected with\nthe Optech Gemini LiDAR sensors, and less than 2/3m for the Riegl and Optech\nGalaxy sensors.\n\nSee [NEON Data Product DP3.30015.001](\nhttps://data.neonscience.org/data-products/DP3.30015.001) for\nmore details.\n\nDocumentation: [NEON DP3.30015.001
@schwehr
schwehr / rcmap_trends_manifest.json
Last active May 15, 2023 22:08
USGS rcmap manifests
<!-- This HTML template is used to generate preview dataset descriptions. --> <!-- See google3/geo/gestalt/common/javascript/templates/dataset.soy for --> <!-- the template used in the code editor and --> <!-- google3/geo/gestalt/data/products/templates/devsite_dataset.html for the --> <!-- devsite template. --> <body style="width: 500; font-family: Roboto,Arial,sans-serif; font-size: 13;"> <h1 class="title">National Intertidal Digital Elevation Model 25m 1.0.0</h1> <p><div class="header">Version: 1.0.0</div><br></p> <p><div class="header">Start Date: 1986-08-16T00:00:00Z</div><br></p> <p><div class="header">End Date: 2017-07-31T23:59:59Z</div><br></p> <p><img src="https://developers.google.com/earth-engine/datasets/images/ngis-cat/projects_ngis-cat_assets_DEA_NIDEM_sample.png" alt=""></p> <div class="field description"> <p>The National Intertidal Digital Elevation Model (NIDEM; Bishop-Taylor et al. 2018, 2019) is a continental-s
local id = 'USGS/NLCD_RELEASES/2019_REL/NALCMS';
local subdir = 'USGS';
local version = '1';
local ee_const = import 'earthengine_const.libsonnet';
local ee = import 'earthengine.libsonnet';
local spdx = import 'spdx.libsonnet';
local units = import 'units.libsonnet';
local license = spdx.cc0_1_0;
@schwehr
schwehr / another_attempt.jsonnet
Last active March 17, 2023 20:34
Experiments with crafting unit strings in jsonnet
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 Google Inc. All Rights Reserved.
// Created by Dan Pencoske
local unit_obj = {
label: error 'provide a label',
pow(exp): '%s^%d' % [self.label, exp],
per(denom): '%s / %s' % [
self.label,
@schwehr
schwehr / lp64_test.cc
Created February 5, 2023 17:41
Exploring issues around xdr_int and xdr_long in hdf4 putget.c
// SPDX-License-Identifier: Apache-2.0
// Copyright 2023 Google Inc. All Rights Reserved.
/*
https://www.shrubbery.net/solaris9ab/SUNWdev/SOL64TRANS/p16.html
_LP64
The _LP64 feature test macro is used to specify the LP64 data model where ints