Skip to content

Instantly share code, notes, and snippets.

Ryan J. Dillon ryanjdillon

  • Norway
View GitHub Profile
ryanjdillon /
Last active Feb 20, 2019
Sync data to S3 with `aws s3 sync`, an AWS `rsync` emulator
# Install the aws cli
source your-venv/bin/activate
pip install awscli
# Setup your credentials
aws configure
# Check out what is going to get transfered first
aws s3 sync ./path/to/data s3://bucket-name --exclude "*" --include "*.nc" --dryrun
ryanjdillon /
Created Sep 8, 2017
Percent body compositions from percent lipids
def perc_bc_from_lipid(perc_lipid, perc_water=None):
'''Calculate body composition component percentages based on % lipid
Calculation of percent protein and percent ash are based on those presented
in Reilly and Fedak (1990).
perc_lipid: ndarray
1D array of percent lipid values from which to calculate body composition
ryanjdillon /
Created Aug 23, 2017
Working on getting retrieving Kartverket map data
A Package for retrieving Kartverket image data for specified areas.
Exampl URLs
NOAA (not active/testable):,-90.0,180.0,90.0&EXCEPTION=application/vnd.ogc.se_xml&DIM_COADS_CLIMATOLOGY_CDF_TIME=15-Jan
ryanjdillon /
Last active Jul 3, 2017
Example routine for calculating modified body density of seals
def calc_mod_density(mass_kg, dens_kgm3, n_blocks, block_type):
'''Calculate the modified density with attached blocks
mass_kg: float
mass of the seal (kg)
dens_kgm3: float
mass of the seal (kg/m^3)
block_type: str
ryanjdillon /
Last active Jun 22, 2017
Seal lipid to body density calculation
def lip2dens(p_lipid, lipid_dens=0.9007, prot_dens=1.34, water_dens=0.994, a_dens=2.3):
'''Derive tissue density from lipids
Translated to python from R code written by Martin Biuw
p_comps = perc_bc_from_lipid(p_lipid)
p_comps['density'] = (lipid_dens * (0.01 * p_comps['perc_lipid'])) + \
ryanjdillon /
Created Mar 13, 2017
Algae light response - Calculate the level of oxygen at a give light level
import seaborn
def light_response(light, EC50, hillslop=2.5):
'''Typical response function for EC50 tests'''
import numpy
# Response to concentration
dose_min = light.min()
dose_max = light.max()
You can’t perform that action at this time.