This file contains 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
# Ben Fasoli | |
library(sp) | |
library(rgdal) | |
shape <- readOGR(dsn = 'data', layer = 'four_samples') | |
head(shape@polygons[[1]]@Polygons[[1]]@coords) | |
# [,1] [,2] | |
# [1,] -111.6227 40.75247 |
This file contains 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(ggmap) | |
library(tidyverse) | |
# Fetch SLC-centric grayscale Google Map terrain layer | |
basemap <- get_googlemap(center = c(lon = -112.0, lat = 40.6), zoom = 10, | |
scale = 2, maptype = 'terrain', color = 'bw') | |
# Display downloaded map | |
ggmap(basemap) |
This file contains 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
<form action="https://formspree.io/[email protected]" method="POST"> | |
<input type="text" name="name" placeholder="Name"> | |
<input type="email" name="_replyto" placeholder="Email Address"> | |
<textarea name="message" placeholder="Message"></textarea> | |
<input type="submit" value="Send"> | |
</form> |
This file contains 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
#!/usr/bin/env python3 | |
import numpy as np | |
import os | |
import pandas as pd | |
DATA_PATH = '/home/data/alta_udot/grimm_1109/' | |
BIN_SIZE_UPPER = np.array([0.25, | |
0.28, |
This file contains 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
# Ben Fasoli | |
# Wait for rslurm::slurm_apply to complete | |
library(rslurm) | |
fun <- function(x) { | |
Sys.sleep(x) | |
return(T) | |
} |
This file contains 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
# Ben Fasoli | |
# Testing for met file identification | |
rm(list = ls()) | |
# Source find_met_files() | |
# https://github.com/uataq/stilt/blob/master/r/src/find_met_files.r | |
source('https://raw.githubusercontent.com/uataq/stilt/master/r/src/find_met_files.r') | |
# Create pseudo-met files | |
system('touch ex_d01.arl ex_d02.arl ex_d03.arl') |
This file contains 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
# Ben Fasoli | |
# Check that rslurm::slurm_apply accepts a list as a dataframe column | |
library(rslurm) | |
slurm_options <- list( | |
time = '300:00:00', | |
account = 'lin-kp', | |
partition = 'lin-kp' | |
) |
This file contains 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
#' Generates a KMZ file | |
#' @author Ben Fasoli | |
#' | |
#' \code{make_kmz} generates a KMZ representation of surface observations. | |
#' | |
#' @param data to be plotted on Z axis | |
#' @param time vector of times for data observations | |
#' @param lat latitude, in dd.dddd | |
#' @param lon longitude, in dd.dddd | |
#' @param filepath character path to output file, ending in '.kmz' |
This file contains 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
#!/usr/bin/env python3 | |
# Automated backup of lin-group CHPC resources | |
# Ben Fasoli | |
# | |
# Requires rclone to be installed | |
# Depends on access_token found in ~/.config/rclone/rclone.conf | |
# To create an access token, run | |
# module load rclone | |
# rclone config | |
# Name: {anything short, e.g. gcloud} |
This file contains 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
#!/usr/bin/env Rscript | |
library(parallel) | |
fun <- function(x) { | |
x^2 | |
} | |
cl <- makeForkCluster(nnodes = 2, outfile = '') | |
out <- parSapply(cl, 1:2, fun) |