This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygmt | |
fig = pygmt.Figure() | |
fig.coast(region="-122/23/-65/48r", frame=False, land="#666666", water="skyblue", projection="A-100/30/4.5i") | |
# fig.show() | |
fig.savefig("usa.pdf") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(magick) | |
image_write_gif(image_join(lapply(list.files("path/to/folder", pattern = "png", | |
include.dirs = TRUE, full.names = TRUE), image_read)), "output.gif", delay = 4.5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create a GTiff from an ascii grid with no raster metadata | |
# | |
# Examples | |
# # 4320: ncols | |
# # 2124: nrows | |
# # -180: xllcorner | |
# # -88.5: yllcorner | |
# # 0.0833333: cellsize | |
# touch test.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sf) | |
library(mapview) | |
erie_outline <- st_read("data/erie_outline.shp") | |
st_geometry_type(erie_outline) | |
st_crs(erie_outline) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Papers" | |
description: > | |
My papers! | |
output: | |
html_document: | |
theme: | |
version: 4 | |
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(gganimate) | |
library(sf) | |
lg_extent <- c(xmin = -97.9036, ymin = 34.6176, xmax = -66.9989, ymax = 49.4194) | |
lg_extent <- sf::st_as_sfc(sf::st_bbox(lg_extent), crs = 4326) | |
earth <- sf::st_as_sf( | |
rnaturalearth::ne_states(country = "United States of America")) | |
views <- data.frame(rbind( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mapping some lake data | |
# Reference: https://r-spatial.org/r/2018/10/25/ggplot2-sf.html | |
library(sf) # create geospatial layers | |
library(rnaturalearth) # basemap | |
library(ggplot2) # plotting | |
library(tidyr) | |
library(scales) | |
dt <- read.csv("lake_data_file.csv", stringsAsFactors = FALSE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(purrr) | |
library(dplyr) | |
library(broom) | |
mtcars %>% | |
split(.$cyl) %>% # from base R | |
map(~ lm(mpg ~ wt, data = .)) %>% | |
map(summary) %>% | |
map_dbl("r.squared") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import holoviews as hv | |
import xarray as xr | |
hv.extension('bokeh') | |
test = xr.open_rasterio(raster_file) | |
gg = hv.Image(test, kdims = ['x', 'y']) | |
gg.opts(opts.Image(tools=['hover'])) | |
hv.save(gg, 'curve.html', backend='bokeh') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create a new Jupyter notebook from the command line | |
# | |
# Examples | |
# jupyinit env_name py_file.py py_file.ipynb | |
touch $2 | |
jupytext --set-kernel $1 $2 | |
jupytext --to notebook --execute $2 | |
jupytext --set-formats ipynb,py $3 |