Skip to content

Instantly share code, notes, and snippets.

Grant Williamson ozjimbob

Block or report user

Report or block ozjimbob

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ozjimbob
ozjimbob / him_anim.r
Created Jan 7, 2020
Example code to generate animation frames of Himawari-8 hotspots
View him_anim.r
# General data manipulation
library(tidyverse)
# Spatial data
library(sf)
# Thematic maps
library(tmap)
View f.r
# ignoring time=t, just modelling on dx for simplicity
frecent3 <- function(rank,dx){
a = 6.1625
cc = 1.6724
b = 0.2882
return(( a/(1e-04 * dx + cc)+b) * rank)
}
View hima_hs.r
library(tidyverse)
library(sf)
library(mapview)
library(furrr)
library(raster)
plan(multiprocess)
ex = extent(c(xmin=-112,xmax=155,ymin=-44,ymax=-10))
@ozjimbob
ozjimbob / access.r
Last active Nov 21, 2018
Example of downloading and plotting ACCESS met model data in R
View access.r
# Demonstration - Downloading and animating ACCESS forecast data
# grant.williamson@utas.edu.au
# General functions, including str_replace, map
library(tidyverse)
# threddscrawler is a useful package for parsing THREDDS data servers
# Install it with:
# devtools::install_github("BigelowLab/threddscrawler")
library(threddscrawler)
View pub_hols.r
library("reticulate")
library(tidyverse)
library(purrr)
# We use the python "holidays" package for the basic holidays
# Installed it using pip first
holidays <- import("holidays")
tas_holidays <- holidays$Australia(prov="TAS")
# List of all dates from 2000 to 2018
View ex.r
data = tibble(foo=c("Bah","Fuzz"))
my_column="foo"
data %>% filter(!!my_column := "Bah")
View blitz.r
## Load required packages
# you will need to install these, first do
# eg. install.packages("tidyverse")
# etc. to install them one by one
library(tidyverse)
library(httr)
library(sf)
library(tmap)
@ozjimbob
ozjimbob / sph_hillshade.r
Last active Aug 16, 2016
Example code to great a hillshade raster from a DEM in R using spherical environment mapping for the colour scheme.
View sph_hillshade.r
library(raster)
library(jpeg)
# Spherical environment mapping hillshade function
getv=function(i,a,s){
ct = dim(i)[1:2]/2
sx = values(s)/90 * ct[1]
sy = values(s)/90 * ct[2]
a = values(a) * 0.01745
px = floor(ct[1] + sx * -sin(a))
@ozjimbob
ozjimbob / demiowa.r
Created Feb 2, 2016
R Dem Iowa Caucus Graph
View demiowa.r
library(rjson)
library(httr)
turl="https://iowadems-caucussitecdn-prod2.azureedge.net/api/statecandidateresults"
a=GET(turl)
arr=c(content(a)$StateResults[[1]]$WinPercentage,content(a)$StateResults[[2]]$WinPercentage,content(a)$StateResults[[3]]$WinPercentage)
nam=c(content(a)$StateResults[[1]]$Candidate$DisplayName,content(a)$StateResults[[2]]$Candidate$DisplayName,content(a)$StateResults[[3]]$Candidate$DisplayName)
colr=c(content(a)$StateResults[[1]]$Candidate$Color,content(a)$StateResults[[2]]$Candidate$Color,content(a)$StateResults[[3]]$Candidate$Color)
rar=round(arr,3)*100
barplot(arr,names.arg=nam,col=colr)
View keybase.md

Keybase proof

I hereby claim:

  • I am ozjimbob on github.
  • I am jimbob (https://keybase.io/jimbob) on keybase.
  • I have a public key whose fingerprint is 7ABC 13B3 C2B3 2583 C3A2 C03C EC2D AA9F 5376 6533

To claim this, I am signing this object:

You can’t perform that action at this time.