Skip to content

Instantly share code, notes, and snippets.

View SteveViss's full-sized avatar

Steve Vissault SteveViss

View GitHub Profile

Crop GHRSST in R terra.

I've ignored all our detailed stuff for our COG creation - this crops into memory, converts to Celsius, writes to file (I've set up a place to set the output directory but it writes to working directory atm) - I tested from compute in California and it was fast. With that you should be able to generate the days you want with seq(as.Date(), by = "1 day") kind of construct and loop. Note that some days are missing, we have reported them so maybe fixed now, but it's worth wrapping the rast(dsn) call in a try in case the read fails

## https://urs.earthdata.nasa.gov/documentation/for_users/user_token
## the token is a long text string, the header is "Authorization: Bearer {token}"
@ibartomeus
ibartomeus / clean_species
Last active January 23, 2017 08:34
Cleaning species taxonomy using taxize. I want to correct synonyms and typo's and drop incomplete cases.
#I have >1000 bees to check its name, so I want to automatize taxize for
# fixing misspellings when possible
# updating synonims to accepted names
# keeping ONLY accepted species (fully resolved at species level)
# this uses taxize > 0.7.6.9157 If you are using older version (e.g. what its now on CRAN) see the history of this file.
library(taxize)
library(dplyr)
#example: good, synomin, typo, unexisting, genus only.
@twolfson
twolfson / README.md
Last active January 26, 2025 07:52
Setting up SOPS

I'm learning about SOPS and setting it up as my preferred mechanism for storing secrets. Here are my notes.

PGP

It’s security mechanism is that we (i.e. client) use a PUBLIC key from the receiver (i.e. server) and encode it with a random key (I’m saying nonce but it could be reused)

This varies from RSA and SSH because the server uses a PUBLIC key to identify the client.

Web of trust

Web of trust operates by still using PGP (i.e. encoding with recipient’s public key) but additionally, we can encrypt/sign the data as our own by signing it with the client’s private key.

This means the recipient will initially decrypt via our (i.e. client’s) public key (verifying the source) and then decrypting via their (i.e. server’s) private key to get the data.

Crossref free search

setup

Install

@vitalbone
vitalbone / eslint-atom.md
Last active June 28, 2018 17:20
Configuring eslint for Atom

Configuring eslint for Atom

Dan Abramov does a really good job explaining why and how in 'Lint Like It’s 2015'

For the tl;dr version

// install atom's linter && linter-eslint
apm install linter
apm install linter-eslint
@superhighfives
superhighfives / gulpfile.js
Created August 13, 2014 16:09
Gulp / Harp with BrowserSync
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var deploy = require('gulp-gh-pages');
var cp = require('child_process');
var harp = require('harp')
/**
* Serve the Harp Site
*/

Overview

In general, it seems there are roughly five (5) ways to get "file data" (e.g. a GeoTIFF) out of a PostGIS geoprocessing workflow:

  • Export just the raster field as an ASCII grid
  • Connect to the database using a desktop client (e.g. QGIS) [1]
  • Use a procedural language (like PLPGSQL or PLPYthon) [2]
  • Use the COPY declaration to get a hex dump out and convert it to a binary file
  • Fill a 2D NumPy array with a byte array and serialize it to a binary file using GDAL or psycopg2 [3, 4]
  • Use ST_AsTiff() or the more general ST_AsGDALRaster() to get a byte array, which can be written to a binary file
@dfalster
dfalster / addNewData.R
Last active February 19, 2023 00:29
The function addNewData.R modifies a data frame with a lookup table. This is useful where you want to supplement data loaded from file with other data, e.g. to add details, change treatment names, or similar. The function readNewData is also included. This function runs some checks on the new table to ensure it has correct variable names and val…
##' Modifies 'data' by adding new values supplied in newDataFileName
##'
##' newDataFileName is expected to have columns
##' c(lookupVariable,lookupValue,newVariable,newValue,source)
##'
##' Within the column 'newVariable', replace values that
##' match 'lookupValue' within column 'lookupVariable' with the value
##' newValue'. If 'lookupVariable' is NA, then replace *all* elements
##' of 'newVariable' with the value 'newValue'.
##'
@apux
apux / update_multiple_git_repositories.sh
Last active October 7, 2017 06:29
Update multiple git repositories
#!/bin/sh
dirs=`ls -1d */`
for d in $dirs
do
echo $d
echo '======================'
IFS=$'\n' lines=($(cd $d; git pull))
for l in $lines
do
echo $l
@lg0
lg0 / markdown.xml
Created April 10, 2012 19:58
Markdown Syntax Highlighting for Sublime text 2
<!-- copy this to YOUR_THEME.tmTheme-->
<dict>
<key>name</key>
<string>diff: deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#EAE3CA</string>