Skip to content

Instantly share code, notes, and snippets.

View AndrewILWilliams's full-sized avatar

Andrew Williams AndrewILWilliams

View GitHub Profile
@AndrewILWilliams
AndrewILWilliams / xarray_regress_two_fields.py
Last active March 4, 2020 00:22
xarray_regress_two_fields.py
# Andrew Williams - 2020
# Written in response to: https://stackoverflow.com/questions/38960903
import numpy as np
import xarray as xr
# Define a linear trend function to use
def linear_trend(x, y):
pf = np.polyfit(x, y, 1)
return xr.DataArray(pf[0])
@AndrewILWilliams
AndrewILWilliams / .bashrc_localmachine
Created March 3, 2020 17:26
SSH to jasmin-sci3 with forwarding for Jupyter Lab/Notebooks
function jasmin(){
# SSH to the jasmin-sci3 node (most memory) on jasmin
# with forwarding set up so that it can easily tunnel to a local browser !
#
# Run with: jasmin PORTNUMBER
ssh -A -XY andreww@jasmin-login1.ceda.ac.uk -L ${1}:localhost:${1} -t ssh -A -XY jasmin-sci3 -L ${1}:localhost:${1}
}
@AndrewILWilliams
AndrewILWilliams / packages.txt
Last active March 3, 2020 15:54
laptop conda packages from `conda list --export >> packages.txt`. Can now use `conda install --file packages.txt` to install these easily
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
_ipyw_jlab_nb_ext_conf=0.1.0=py37_0
alabaster=0.7.12=py37_0
anaconda=2019.10=py37_0
anaconda-client=1.7.2=py37_0
anaconda-navigator=1.9.7=py37_0
anaconda-project=0.8.3=py_0
antlr-python-runtime=4.7.2=py37_1000
@AndrewILWilliams
AndrewILWilliams / .bashrc
Last active March 3, 2020 15:28
bashrc_jasmin_sciencenode_login
function jasminsci(){
# SSH to a specific science node on jasmin
# Note, you need the -t flag for the tunneling, else it fails
ssh -t -A andreww@jasmin-login1.ceda.ac.uk ssh jasmin-sci$1
}
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda-latest-Linux-x86_64.sh
./Miniconda-latest-Linux-x86_64.sh