Skip to content

Instantly share code, notes, and snippets.

Diego Valle-Jones diegovalle

Block or report user

Report or block diegovalle

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
View sinaica_mayo.R
library(aire.zmvm)
library(rsinaica)
library(ggplot2)
library(tidyverse)
library(lubridate)
library(zoo)
library(hrbrthemes)
pm25_2019 <- sinaica_param_data("PM2.5", "2019-05-01", "2019-05-16")
View contingencia_extraordinaria.R
library(aire.zmvm) #devtools::install_github('diegovalle/aire.zmvm')
library(ggplot2)
library(tidyverse)
library(lubridate)
library(zoo)
library(hrbrthemes)
df <- get_station_month_data("HORARIOS", "PM25", 2019, 5)
df <- df %>%
filter(station_code %in% c("SAC", "NEZ")) %>%
View pm25_o3.R
library(lubridate)
library(aire.zmvm)
library(ggplot2)
library(dplyr)
library(hrbrthemes)
get_latest_imeca()
df <- get_zone_imeca("HORARIOS", "TC", "TZ", "2019-05-01", "2019-05-14")
df$datetime <- ymd_h(paste0(df$date, " ", df$hour))
View xmax-pollution.R
library(rsinaica)
library(dplyr)
library(zoo)
library(gghighlight)
df_pm25 <- sinaica_param_data("PM2.5", "2018-12-23", "2019-01-02")
df_pm10 <- sinaica_param_data("PM10", "2018-12-23", "2019-01-02")
plot_top <- function(df, title = "", ylab = "", exclude = c("")) {
df_max <- df %>%
View download_mapa_digital.sh
#! /bin/bash
# Projection compatible with Google Maps
PROJECTION="+proj=longlat +ellps=WGS84 +no_defs +towgs84=0,0,0"
# wget command
WGET="wget -w 5 --random-wait --tries=2 -nc"
# The mapa digital is available as 4 files
declare -a extensions=(".exe" "-1.bin" "-2.bin" "-3.bin")
$WGET "http://internet.contenidos.inegi.org.mx/contenidos/productos/prod_serv/contenidos/espanol/bvinegi/productos/nueva_estruc/promo/Instalador_proy_bas_inf_2017.zip" -O md.zip
@diegovalle
diegovalle / index.js
Last active Aug 23, 2018
openwhisk contact form with recaptcha
View index.js
// Contact form for www.ilsevalle.com
// The form requieres 4 parameters:
// SENDGRID_API - Sendgrid API key to send emails
// EMAIL_SENDER - address from which the mail is sent
// SEND_TO - address to which the mail is sent
// RECAPTCHA_SECRET - Server secret from Google's recaptcha service
// TIMEZONE - time zone in which to display the submission time (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
const request = require('request');
const sgMail = require('@sendgrid/mail');
@diegovalle
diegovalle / temp-cdmx.R
Last active Feb 1, 2018
Temperaturas diarias durante eneros de 2005 a 2018 por estación
View temp-cdmx.R
library(viridis)
library(ggridges)
library(aire.zmvm)
library(lubridate)
library(ggplot2)
library(dplyr)
library(tidyr)
library(stringr)
library(lubridate)
@diegovalle
diegovalle / january-temps.R
Last active Jan 31, 2018
Hourly January temperatures for all reporting sensors for 2016-2018
View january-temps.R
#based on https://cran.r-project.org/web/packages/ggjoy/vignettes/gallery.html
library(viridis)
library(ggridges)
library(aire.zmvm)
library(lubridate)
library(ggplot2)
library(dplyr)
library(tidyr)
library(stringr)
library(lubridate)
View homicide-northamerica.R
library(directlabels)
library(ggplot2)
library(scales)
library(tidyr)
df = data.frame(Canada = c(522, 609, 611),
US = c(15872, 17793, 19362),
Mexico = c(20010, 20762, 24559))
df = data.frame(apply(df, 2, function(x) x = x/x[1]))
df$year = 2014:2016
View his.R
pop <- read.csv("../downloader/data/pop_muns.csv") %>% filter(date == '2010-06-01 00:00:00')
mex <- injury.intent %>%
filter(year_reg == 2016 & intent %in% c("Homicide", "Legal Intervention")) %>%
group_by(state_occur_death, mun_occur_death) %>%
rename(state_code = state_occur_death, mun_code = mun_occur_death) %>%
summarise(count = n()) %>%
left_join(read.csv("../downloader/data/pop_muns.csv") %>% filter(date == '2016-06-01 00:00:00'),
by = c("state_code", "mun_code")) %>%
mutate(rate = count / population * 10^5) %>%
You can’t perform that action at this time.