Skip to content

Instantly share code, notes, and snippets.

View chryss's full-sized avatar

Chris Waigl chryss

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chryss
chryss / gist:7593127
Last active October 21, 2019 15:33
pygaarst doc snippets 1 - how to open and plot VIIRS HDF5 and GeoTIFF data, including plotting on a map.
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@chryss
chryss / wrf39_source_file.ipynb
Created August 17, 2018 16:27
Fuego volcano source file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chryss
chryss / wrf39_source_file.ipynb
Created August 17, 2018 16:27
Fuego volcano source file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chryss
chryss / getthething.py
Created June 8, 2018 20:28
What to do when an API returns EITHER a scalar/string OR a list of scalars/strings, and you want the first one
mylist = ['a', 'b']
mynotalist = 'a'
def getthething(athing):
return list(athing)[0]
print(getthething(mylist))
print(getthething(mynotalist))
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <stdio.h>
#include <string.h>
#include <locale.h>
int main (void) {
struct lconv locale_structure;
struct lconv *locale_ptr = &locale_structure;
char *a = "ä";
#!/usr/bin/env python
# encoding: utf-8
"""
localetest.py - tests collation / sort order for various Latin-script locales
Correct output:
The order for German is:
LATIN SMALL LETTER A
import json
import numpy as np
from osgeo import gdal, gdal_array
typemap = {}
typenames = {}
for name in dir(np):
obj = getattr(np, name)
if hasattr(obj, 'dtype'):
try: