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 requests | |
| import os | |
| # Replace 'your_personal_access_token' with your actual token | |
| token = "your_personal_access_token" | |
| headers = { | |
| 'Authorization': f'token {token}' | |
| } | |
| # GitHub API URL for gists |
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
| # extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip | |
| # under public domain terms | |
| country_bounding_boxes = { | |
| 'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)), | |
| 'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)), | |
| 'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)), | |
| 'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)), | |
| 'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)), | |
| 'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)), |
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
| ############### DATA COLLECTION ######################### | |
| ## scaping the edinburgh university website | |
| library(rvest) | |
| # Gather the optional courses for Earth Observation and Geoinformation Management | |
| MScOptionsURLS<-function(MSc){ | |
| if(MSc=="EOGM"){ | |
| MSc<-"https://www.ed.ac.uk/geosciences/postgraduate/taught-masters/msc-earth-observation/structure-teaching-assessment/optional-courses" | |
| url<-MSc %>% | |
| read_html()%>% |
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 /////////////////////////////////// | |
| // Load from Google repository | |
| var hansenImage = ee.Image('UMD/hansen/global_forest_change_2015'); | |
| // Load from Fusion table | |
| var BOUND = ee.FeatureCollection('ft:1cNBoXaEh9Ye5J31ESUQOBOrnkVBflJDodKlqdQs_', 'geometry'); |
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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(query_start, clock_timestamp()), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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(reshape2) | |
| library(ggplot2) | |
| library(scales) | |
| # read in data | |
| setwd("~/Google Drive") | |
| poll<-read.csv("England_pollutants.csv") | |
| # time between start and end | |
| poll$Start.Date2<-strptime(poll$Start.Date, format="%d/%m/%y") |
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(dygraphs) | |
| # ISS data import | |
| df<-read.csv("ISS Passes Overhead - Sheet1.csv", header=FALSE) | |
| df$datetime<-strptime(df$V1," %B %d,%Y at %I:%M %p") | |
| df$datetime<-as.POSIXct(df$datetime,tz = "GMT") | |
| df$date<-strptime(df$V1," %B %d,%Y") | |
| ISS <- xts(df$V3,order.by=df$datetime,frequency=365) | |
| # shiny output |
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(shinythemes) | |
| shinyUI(fluidPage( | |
| theme = shinytheme("cosmo"), | |
| mainPanel( | |
| dygraphOutput("dygraph") | |
| ) | |
| ) | |
| ) |
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(openair) | |
| Edinburgh = importAURN(site = 'ED3', year = 2015) | |
| calendarPlot(Edinburgh, pollutant = "o3") |