Skip to content

Instantly share code, notes, and snippets.

View cynici's full-sized avatar

Cheewai cynici

View GitHub Profile
@cynici
cynici / firedanger_chart.html
Created January 24, 2013 08:59
firedanger plot using jquery flot library written as python django template
{% extends "base.html" %}
{% load i18n %}
{% block css %}
<style type="text/css">
.calendar {
font-family: 'Trebuchet MS', Tahoma, Verdana, Arial, sans-serif;
font-size: 0.9em;
background-color: #EEE;
color: #333;
@cynici
cynici / gist:4500585
Created January 10, 2013 08:57
Fire pixel clustering javascript code from http://www.unorthodox.com.au/fire/js/cluster.bin.js unobfuscated using method described in http://www.mikepostma.com/blog/unobfuscate-javascript
(function () {
var d = null;
function e(a) {
return function (b) {
this[a] = b
}
}
function h(a) {
return function () {
@cynici
cynici / fireloc_cluster.py
Created December 20, 2012 07:43
Identify clusters of oft-repeated fire pixels with a date range to create non-fire mask (polygon)
#!/usr/bin/env python
import os, sys
from optparse import OptionParser
from datetime import datetime
import logging
import psycopg2, psycopg2.extras
import math
from collections import defaultdict
#
@cynici
cynici / run_cspp_image_only.sh
Created December 10, 2012 10:32
NPP: wrapper script to run CSPP software and Pytroll mpop to produce truecolor and natural PNG
#! /bin/bash
#
#20120828 clai@csir.co.za
# Run CIMSS CSPP software on incoming NPP raw data files from EOS FES.
# This script is called when a separate script detects new file
#
#20120928 clai@csir.co.za
# Added CrIS SDR processing
@cynici
cynici / download_gdas.sh
Created December 10, 2012 09:00
NPP: Download GDAS cron script
#! /bin/bash
#
# This script downloads all gdas1.PGrbF00.*.*.z of previous day or
# whichever day specified by '-d' options given to 'date' command
# into current directory.
#
# Download GDAS of a specific day using '-d' option of date command.
#
# The Global Data Assimilation System (GDAS) files are required
@cynici
cynici / list_prior_file.py
Created December 7, 2012 09:37
NPP: List best-matching ancillary file required by DRL algorithm
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, logging, re
from optparse import OptionParser
from datetime import datetime, timedelta
from glob import iglob as glob
help_text = """%prog [options] -t TYPE npp_dat_file
@cynici
cynici / list_matching_gdas.py
Created December 7, 2012 07:23
NPP: List GDAS file for VIIRS TrueColorGen algorithm in descending order of preference
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, logging, re
from optparse import OptionParser
from datetime import datetime, timedelta
help_text = """%prog npp_dat_file
Given a NPP raw data filename e.g. NPP.20120827.114454.dat,
@cynici
cynici / run_drl.sh
Created December 6, 2012 13:09
NPP: Run DRL software for NPP raw data to produce truecolor GeoTiff image
#! /bin/bash
#
# Use DRL software suite to process NPP data and produce
# geolocated truecolor GeoTiff image
#
if [ $# -lt 1 ] || [ ! -f "$1" ]; then
echo "usage: $0 NPP_DAT" >&2
exit 1
@cynici
cynici / http-get-wunderground.py
Created December 5, 2012 05:44
Get weather data from Wunderground stations listed in input JSON and output to a CSV file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
from optparse import OptionParser
import string
import urllib2
import simplejson
import logging
from datetime import datetime
import time
@cynici
cynici / wunderground-harvest-stations.py
Last active October 13, 2015 13:27
Harvest Wunderground.com weather stations in a specific country
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
from optparse import OptionParser
import string
import urllib2
import simplejson
import logging
help_text = """usage: %prog [options] ISO_country_code ...