Skip to content

Instantly share code, notes, and snippets.

@jscarto
jscarto / ocean.json
Last active July 28, 2017 12:42
Colors for a palette based on the Ocean from Moana (https://twitter.com/jscarto/status/890914861760348160). Inspired by the amazing colormaps from @rejectedbanana https://github.com/rejectedbanana/Hei-Hei
['#003d50','#003e51','#003f52','#003f53','#003f53','#014054','#014256','#014256','#014357','#014458','#01455a','#01445a','#02455b','#02465c','#02475d','#02485d','#02485f','#034a60','#034a60','#034b61','#034b62','#034c64','#034c64','#044e65','#044f66','#045068','#045068','#055169','#05526a','#05526b','#05536b','#06536d','#06556e','#06566f','#06566f','#075770','#075872','#075873','#075973','#085a74','#085a75','#095b77','#095b77','#095d78','#095d79','#0a5e7b','#0a5f7b','#0a607c','#0b617d','#0b627e','#0b627f','#0c6380','#0c6481','#0c6482','#0d6683','#0d6683','#0d6685','#0e6786','#0e6887','#0e6987','#0f6a89','#0f6b8a','#0f6b8b','#106c8c','#106d8c','#116e8d','#126e8e','#14708e','#15708e','#16718f','#16718f','#18728f','#19738f','#1a7490','#1b7690','#1c7790','#1d7790','#1d7791','#1e7891','#1f7991','#207a92','#217c92','#227c92','#227d92','#237e93','#237f93','#248093','#258094','#268294','#278394','#278395','#288495','#288495','#298595','#2a8796','#2b8896','#2b8896','#2c8a97','#2c8a97','#2d8a97','#2d8c97','#2e8c98','#2
# Script modified from original by Anita Graser: https://twitter.com/underdarkGIS/status/716389969850404864
# To use: Enter a paletteName, paste array of hex codes into colors, and run!
# Re-running with the same name will update the previous color ramp
############################################################################
from PyQt4.QtGui import QColor
paletteName = '' # give the palette a name
colors = [] # replace with hex values
@jscarto
jscarto / pansharpen.js
Last active July 19, 2022 02:45
Pan-sharpen and display a Landsat 8 scene in Google Earth Engine
// Band combinations
var natural = ['B4', 'B3', 'B2'];
var swir = ['B6', 'B5', 'B3'];
var urban = ['B7', 'B6', 'B4'];
var veg = ['B5', 'B4', 'B3'];
// Get a Landsat scene
var scene = ee.Image('LANDSAT/LC8_L1T_TOA/LC80450332015263LGN00');
// Convert the RGB bands to the HSV
@jscarto
jscarto / temp_data
Created June 26, 2015 18:00
dput of depth data
structure(list(depth = c(0, 10, 20, 30, 50, 75, 100, 0, 10, 20,
30, 50, 75, 100, 0, 10, 20, 30, 50, 75, 100, 0, 10, 20, 30, 50,
75, 100, 0, 10, 20, 30, 50, 75, 100, 0, 10, 20, 30, 50, 75, 100,
0, 10, 20, 30, 50, 75, 100, 0, 10, 20, 30, 50, 75, 100, 0, 10,
20, 30, 50, 75, 100, 0, 10, 20, 30, 50, 75, 100), time = c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L,
10L, 10L, 10L, 10L, 10L, 10L), temp = c(0.121490292040404, -0.00597569922857918,
+++++++2313
fr cf]6
m
/////////////////////////42jk[ v'yb8--50+
hhg ,hhg nh h... . nhnhn nn`
hnñ
Y h///5h814+1898h8j8
†¥lnllLLLlllllllllllgim
h
@jscarto
jscarto / TwitterExample5.html
Last active August 29, 2015 13:56
Fifth Leaflet example. This time, we'll add a pop-up to the tweets to reveal the tweet's text.
<!DOCTYPE html>
<html>
<head>
<title>My First Leaflet Map</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
@jscarto
jscarto / TwitterExample4.htm
Created February 28, 2014 17:59
Fourth Leaflet example. Adding basic interaction to drawn tweets.
<!DOCTYPE html>
<html>
<head>
<title>My First Leaflet Map</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
@jscarto
jscarto / TwitterExample3.htm
Created February 28, 2014 17:57
Third Leaflet example that scales drawn tweets by character count.
<!DOCTYPE html>
<html>
<head>
<title>My First Leaflet Map</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
@jscarto
jscarto / TwitterExample2.htm
Created February 28, 2014 17:56
Second example of a simple Leaflet map that displays collected Tweets.
<!DOCTYPE html>
<html>
<head>
<title>My First Leaflet Map</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
@jscarto
jscarto / TwitterExample1.htm
Created February 28, 2014 17:55
Example HTML for Simple Leaflet Map (including JQuery)
<!DOCTYPE html>
<html>
<head>
<title>My First Leaflet Map</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>