Skip to content

Instantly share code, notes, and snippets.

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
@schwehr
schwehr / explore_enum.py
Created January 30, 2023 21:54
exploring enums in python
#!/usr/bin/env python3
"""Exploring python enum."""
import enum
# from typing import Sequence
class Simple(enum.Enum):
A = 'a'
B = 'b'
@schwehr
schwehr / keywords.txt
Created January 26, 2023 18:20
Earth Engine keywords as of 2023-01-26
16_day
30_year
3_hourly
3dep
4_day
8_day
aafc
aai
abi
aboveground
@schwehr
schwehr / BUILD
Created January 10, 2023 15:18
bazel build of hdf4
# SPDX-License-Identifier: Apache-2.0
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Description:
# NCSA Hierarchical Data Format library
hdf4_copts = [
"-fomit-frame-pointer",
"-DHAVE_CONFIG_H",
"-DBIG_LONGS",
@schwehr
schwehr / xdrposix.c
Last active January 7, 2023 00:22
hdf4 xdrposix.c cleanup ideas
/*
* XDR implementation on POSIX file interface, with buffering
*
* Copyright (C) 1992, University Corp for Atmospheric Research
*
* This set of routines implements a XDR on a POSIX file descriptor.
* XDR_ENCODE serializes onto the descriptor, XDR_DECODE de-serializes
* from the descriptor. As in stdio, we buffer i/o. This XDR is most
* useful when the descriptor actually represents a file. It
* corrects some performance problems with xdrstdio_getpos() and
@schwehr
schwehr / hdf_file_fuzzer.cc
Created December 24, 2022 18:31
An hdf4 fuzzer. This is way too simple, but it has found at least one bug.
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
#include "fuzzer_temp_file.h"
#include "third_party/hdf4/hdf/src/hdf.h"
@schwehr
schwehr / all_keys.py
Last active May 3, 2022 22:43
List all of the variables found across the entire set of ICOADS netcdf ICOADS R3.0.0 data
#!/usr/bin/env python3
# Copyright 2022 Google LLC.
# SPDX-License-Identifier: Apache-2.0
import pathlib
import pprint
import xarray as xr
ignore_attrs = [
@schwehr
schwehr / ORG_SUBORG_dataset_v5.json
Created April 18, 2022 21:13
Example STAC JSON output from Earth Engine catalog entry
{
"description": "Contents of `description.md`.\n",
"gee:type": "image",
"id": "ORG/SUBORG/dataset/v5",
"keywords": [
"coral",
"ocean"
],
"license": "CC-BY-4.0",
"links": [