Skip to content

Instantly share code, notes, and snippets.

Avatar

Micah Woods micahwoods

View GitHub Profile
@micahwoods
micahwoods / om_mass_volume.R
Last active Dec 9, 2021
shows calculations for organic matter as mass/mass or volume/volume using a 1 square meter section to a 2 cm depth as an example
View om_mass_volume.R
## OM246 on a volume basis
## starting thought: what is 5% OM by mass on a volume basis?
library(ggplot2)
library(cowplot)
## assign bulk densities; these don't vary, nor does compressibility
bd_sand <- 1.56
bd_om <- 0.22
@micahwoods
micahwoods / p_high_ph.R
Created May 14, 2021
Reads MLSN data from GitHub and makes charts of Mehlich 3 P distribution
View p_high_ph.R
# load packages, then read in data from Github
library(VGAM)
library(ggplot2)
library(cowplot)
library(dplyr)
library(RColorBrewer)
# generates an mlsn value for a vector using log logistic distribution
mlsn <- function(x) {
@micahwoods
micahwoods / nasa_power_wisley.R
Created Jun 5, 2019
Gets global solar irradiance data from the NASA POWER agroclimatology data set, then plots it. This gist compares daily light integral near London, England, in the first 149 days of 2018 to the first 149 days of 2019.
View nasa_power_wisley.R
# to look at The Wisley location data 2018 and 2019 based on
# this Q from Tom Coulson https://twitter.com/TomCoulson85/status/1135905779242995712
library(nasapower)
library(ggplot2)
library(cowplot)
library(RColorBrewer)
library(zoo)
# get the 2018 data
@micahwoods
micahwoods / tokyo_time_series_animated_gp.R
Created Mar 10, 2019
makes animated line plots of Tokyo monthly temperatures
View tokyo_time_series_animated_gp.R
# do a chart animated for 100+ years of Tokyo temperatures
# and check the GP C3 and GP C4
# tokyo monthly mean temperatures
tokyo <- 'http://www.data.jma.go.jp/obd/stats/etrn/view/monthly_s3.php?prec_no=44&block_no=47662&year=&month=&day=&view='
library(zoo)
library(cowplot)
library(ggplot2)
library(gganimate)
@micahwoods
micahwoods / ten_thousand_analysis.R
Created Mar 7, 2018
makes some counts of tweets and words from an archive downloaded from Twitter
View ten_thousand_analysis.R
# analyse my first 10000 tweets
# based on https://juliasilge.com/blog/ten-thousand-tweets/
library(ggplot2)
library(lubridate)
library(dplyr)
library(cowplot)
# read my tweet archive that I downloaded from Twitter
d <- read.csv("data/tweets.csv",
View log2_twitter_followers_tweet_rate.R
# make a chart of tweets by followers and with log2 axes
# as shown in https://blog.codecentric.de/en/2017/07/combining-social-network-analysis-topic-modeling-characterize-codecentrics-twitter-friends-followers/
# and adapted from code at https://github.com/ShirinG/blog_posts_prep/blob/master/twitter/twitter_codecentric.Rmd
library(twitteR)
library(dplyr)
library(ggrepel)
library(cowplot)
api_key <- "your API_KEY here"
@micahwoods
micahwoods / 20160625_holly_springs_hourly.R
Created Jun 25, 2016
downloads Holly Springs data and plots it, specifically looking at air temperature, soil 10 cm temp, and soil 10 cm H2O
View 20160625_holly_springs_hourly.R
# get hourly Holly Springs and plot it
library("ggplot2")
library("lubridate")
library("dplyr")
library("cowplot")
library("reshape2")
hollyHourly2015 <- read.table("http://www1.ncdc.noaa.gov/pub/data/uscrn/products/hourly02/2015/CRNH0203-2015-MS_Holly_Springs_4_N.txt",
header = FALSE)
@micahwoods
micahwoods / gp_vs_gdd.R
Last active Jan 19, 2016
downloads temperature data for 4 cities in 2015 then calculates and makes plots of GP and GDD and permutations
View gp_vs_gdd.R
# compare C3 growth potential (GP) and growing degree days (GDD)
# at a few locations, start with Sydney, Minneapolis, Tokyo, London
# these data and charts are shown at http://www.blog.asianturfgrass.com/2016/01/g.html
# load libraries
library("dplyr")
library("lubridate")
library("ggplot2")
library("cowplot")
library("RColorBrewer")
@micahwoods
micahwoods / turf_twitter.R
Last active Dec 5, 2015
Counts the number of unique followers of selected turfgrass accounts on Twitter
View turf_twitter.R
# this code will download twitter follower information
# load packages
library("twitteR")
library("dplyr")
api_key <- "your api key"
api_secret <- "your api secret"
@micahwoods
micahwoods / before_and_after_interactions.R
Last active Aug 29, 2015
downloads user timeline and plots before and after interactions from a cutoff date and time
View before_and_after_interactions.R
# load packages
library("twitteR")
library("dplyr")
library("lubridate")
api_key <- "your key"
api_secret <- "your secret"