Skip to content

Instantly share code, notes, and snippets.

View erget's full-sized avatar
🏃‍♂️
Zipping along

Daniel Lee erget

🏃‍♂️
Zipping along
View GitHub Profile
@erget
erget / parallelizer.py
Created August 7, 2012 07:01
Elegant parallelization in GRASS
#!/usr/bin/env python
# This script is derived from GPL 2+ code
# Cudos to Hamish for providing the example it's based on.
# Also see the following link for an example of parallelization
# using the multiprocessing library.
# https://trac.osgeo.org/grass/browser/grass/trunk/scripts/i.landsat.rgb/i.landsat.rgb.py
import os
import grass.script as grass
@erget
erget / function_interpretation.py
Created August 8, 2012 08:54
Example of how functions interpret arguments
def example_function(argument1, argument2):
'''
The function takes whatever is given to it as argument1 and argument2.
It then assigns the values it was given to the variables argument1 and argument2.
'''
print('argument1 is ' + str(argument1))
print('argument2 is ' + str(argument2))
print("I'll now call the function with the values 2 and 135. \n")
example_function(2, 135)
@erget
erget / profile_packing_types.py
Last active March 4, 2016 12:35
A handy tool for profiling different aspects of packing methods used in ecCodes / GRIB API.
#!/bin/env python
"""
Measure write, read time and memory consumption for different packingTypes
"""
from __future__ import print_function
import argparse
@erget
erget / profundities.cpp
Last active March 23, 2016 09:20
Bull generator
#include <iostream>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <vector>
std::vector<std::string> OPENINGS = {
"My organisation believes in",
"The solution can only be",
"The consultants recommend",
@erget
erget / Packing in GRIB.ipynb
Last active April 5, 2016 15:32
GRIB packing precision
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@erget
erget / CCSDS Validation.ipynb
Last active July 14, 2016 07:24
An evaluation of using the proposed GRIB template 5.42 (CCSDS encoding) with ecCodes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@erget
erget / 0001-Squashed-commits.patch
Created May 12, 2016 15:25
Patch for ecCodes / GRIB API for correct CCSDS encoding
diff --git a/definitions/grib2/template.5.42.def b/definitions/grib2/template.5.42.def
index 21bcb3e..f8e9229 100644
--- a/definitions/grib2/template.5.42.def
+++ b/definitions/grib2/template.5.42.def
@@ -15,7 +15,7 @@ include "grib2/template.5.original_values.def";
unsigned[1] ccsdsFlags : dump;
flagbit AEC_DATA_SIGNED_OPTION_MASK(ccsdsFlags,0) = 0;
-flagbit AEC_DATA_3BYTE_OPTION_MASK(ccsdsFlags,1) = 0;
+flagbit AEC_DATA_3BYTE_OPTION_MASK(ccsdsFlags,1) = 1;
@erget
erget / plot_expenses.py
Last active December 4, 2020 10:07
Plot bank account balance in CSV-MT940 format based on a starting balance.
#!/usr/bin/env python3
"""Plot bank account balance in CSV-MT940 format based on a starting balance."""
import matplotlib.pyplot as plt
import pandas as pd
import argparse
import os
@erget
erget / download_meteosat.py
Created October 7, 2016 13:11
Download most recent Meteosat RGB composite at 0°
#!/usr/bin/env python3
# -*- coding: <encoding name> -*-
"""Download most recent Meteosat RGB composite at 0°"""
from selenium import webdriver
from urllib.request import urlopen
from argparse import ArgumentParser
URL = "http://oiswww.eumetsat.org/IPPS/html/MSG/RGB/NATURALCOLOR/FULLRESOLUTION/index.htm"
@erget
erget / IPET-DRMM-PFC-II_distribution.docx
Last active November 18, 2016 10:09
Technical validation for GRIB Edition 2 product definition templates 67 and 68