Skip to content

Instantly share code, notes, and snippets.

View tommylees112's full-sized avatar
🐘

Tommy Lees tommylees112

🐘
View GitHub Profile
@tommylees112
tommylees112 / Makefile
Created March 27, 2017 14:58 — forked from ramnathv/Makefile
R Markdown to IPython Notebook
example.md: example.Rmd
./knit
example.ipynb: example.md
notedown example.md | sed 's/%%r/%%R/' > example.ipynb
@tommylees112
tommylees112 / intro_to_simulation.R
Created March 27, 2017 22:45 — forked from cjbayesian/intro_to_simulation.R
Introduction to simulation using R
#########################################################
## Intro to Simulation - R/Stats Intro Series
## Designed by: Corey Chivers, 2013
## Department of Biology, McGill University
#########################################################
##@ 0.1 @##
rm(list=ls()) # Housekeeping
#setwd('<my working directory>') # set working dir
@tommylees112
tommylees112 / rspatialresources.md
Created May 9, 2017 14:59 — forked from sboysel/rspatialresources.md
R Spatial Analysis Notes

R Spatial Analysis Notes

Spatial Analysis in R

Key Packages

  • sp - defines the set of base classes for spatial data in R. Most useful for creating, converting, merging, transforming (e.g. projection), and plotting (see spplot) Spatial* objects.
  • rgdal - wrapper
@tommylees112
tommylees112 / SETUP_DAY.md
Created January 4, 2021 09:31
Starting my gh command line journey

Hello Tommy here 👋

@tommylees112
tommylees112 / SETUP_DAY.md
Created January 6, 2021 15:25
Starting my coding journey...

Hello World 👋

@tommylees112
tommylees112 / SETUP_DAY.md
Created January 21, 2021 22:49
Starting my coding journey...

Hello WORLD 👋 New laptop! 😄

@tommylees112
tommylees112 / run_cumulusMX.py
Created March 27, 2021 18:04
script to run CumulusMX in the background (has to work on python2.7)
# outF = open("run_cumulusMX.sh", "w")
# line = “mono /home/pi/CumulusMX/CumulusMX.exe &”
# outF.write(line)
# outF.close()
import os
os.system("mono /home/pi/CumulusMX/CumulusMX.exe &")
@tommylees112
tommylees112 / run_cumulusMX.sh
Created March 27, 2021 18:13
Shell to run cumulusMX
mono /home/pi/CumulusMX/CumulusMX.exe &
@tommylees112
tommylees112 / clip_netcdf_to_shapefile.py
Created March 28, 2021 09:33
chopping a shapefile from netcdf files
"""
Mask xarray dataset using a shapefile [closed]
https://stackoverflow.com/a/64587946/9940782
"""
from typing import Tuple
import geopandas as gpd
import xarray as xr
import rasterio as rio
from pathlib import Path
import numpy as np
@tommylees112
tommylees112 / environment_rioxarray.sh
Last active February 1, 2023 09:50
Working environment for rioxarray + tools
# environment_rioxarray.sh
conda create -n rioxarray --yes
conda activate rioxarray
conda install -c conda-forge geopandas --yes
conda install -c conda-forge rioxarray rasterio --yes
conda install -c conda-forge matplotlib tqdm jupyterlab ipython pip ruamel.yaml xarray descartes statsmodels scikit-learn black mypy --yes
# test it has worked
ipython -c "import geopandas; import rioxarray; import xarray"