Skip to content

Instantly share code, notes, and snippets.

Avatar

Evert Rol evertrol

View GitHub Profile
View config.toml
# Notes about values in the TOML config file:
# - strings should always be quoted. Multi-line strings are possible
# using triple-quotes, but should not be necessary in this config file
# - floating point values require a decimal dot, or an exponent (or
# both). Otherwise, they are interpreted as integers.
# More information about the TOML config format: https://github.com/toml-lang/toml
# Scenarios to use.
# This defines only the names and epoch.
@evertrol
evertrol / julia_comprehension_generator_examples.txt
Last active Feb 6, 2020
Julia array / list comprehension and generator expression examples
View julia_comprehension_generator_examples.txt
julia> VERSION
v"1.3.0"
julia> # Julia documention on array) comprehensions and generator expressions:
julia> # https://docs.julialang.org/en/v1/manual/arrays/#Comprehensions-1
julia> # https://docs.julialang.org/en/v1/manual/arrays/#Generator-Expressions-1
julia> # The code below uses generator expressions
julia> # Double list comprehension for the first fifty-one terms of the power series of the exponential function
julia> sum(prod(1/i for i in 1:n) for n in 1:50) + 1
@evertrol
evertrol / environment.yml
Last active Jun 24, 2019
Rhine temperature response
View environment.yml
name: base
channels:
- conda-forge
- defaults
dependencies:
- iris=2.2.0=py36_1003
- iris-sample-data=2.1.0=py_0
- cftime=1.0.3.4=py36hd352d35_1001
- numpy=1.16.2=py36_blas_openblash1522bff_0
- pandas=0.23.4=py36h637b7d7_1000
View main_log_debug.txt
2018-10-16 08:43:28,966 UTC [50059] INFO esmvaltool._main:123
______________________________________________________________________
_____ ____ __ ____ __ _ _____ _
| ____/ ___|| \/ \ \ / /_ _| |_ _|__ ___ | |
| _| \___ \| |\/| |\ \ / / _` | | | |/ _ \ / _ \| |
| |___ ___) | | | | \ V / (_| | | | | (_) | (_) | |
|_____|____/|_| |_| \_/ \__,_|_| |_|\___/ \___/|_|
______________________________________________________________________
ESMValTool - Earth System Model Evaluation Tool
View Rust Fibonacci one-liner
/// Rust Fibonacci one-liner using `fold`
///
/// Not very practical: only for one time use,
/// since it will have to re-calculate all terms again and again
/// if used in a loop to create multiple items.
/// The use of `_` also suggests this is not an ideal solution.
fn main() {
let n = 10;
let x = (0..n).fold((0, 1), |x, _| (x.0+x.1, x.0)).0;
println!("{}: {}", n, x);
View sims-classification.html
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>Thumbnail classification</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style type="text/css">
/*!
*
@evertrol
evertrol / Makefiles.md
Last active Jul 27, 2020
Makefile cheat sheet
View Makefiles.md

Makefile cheat sheet

Mostly geared towards GNU make

I've used ->| to indicate a tab character, as it's clearer to read than

  • Set a target, its dependencies and the commands to execute in order
target: [dependencies]
->| <shell command>
View astrometry-gone-wrong.md

Astrometry gone wrong

SExtractor (source extractor) is a convenient tool to run on a FITS image and return a bunch of detected sources, with their fluxes and magnitudes. Unfortunately, being written quite a while ago, it hasn't fully kept up-to-date with developments in astrometry, in particular the introduction of Simple Imaging Polynomial (SIP) corrections. SExtractor uses an older style WCS correction, which has become abandoned over the years, not least because of the avaibility of Astrometry.net (which uses SIP corrections).

View compute-overlap.py
import sys
import numpy as np
import healpy as hp
from astropy.io import fits
from astropy.wcs import WCS
from astropy.coordinates import SkyCoord
from astropy import units
from spherical_geometry.polygon import SphericalPolygon
You can’t perform that action at this time.