# Mexico temperature notebook

Kodi B. Arfer

## How things were

Stages:

1. Mixed effects for grid cells with both satellite and ground data
2. Predict temperature in cells with satellite data but no ground data, using the mixed model(s) fit at stage 1
3. Predict temperature in cells with no satellite data using a spatial smoother

Rosenfeld et al. (2017) describes the method as applied to Israel.

## Time shenanigans

Hu, Brunsell, Monaghan, Barlage, and Wilhelmi (2014): "The overpass times provided by MODIS LST product are in local solar time, which is defined as the MODIS observation time in coordinated universal time (UTC) plus longitude in degrees divided by 15 (Williamson, Hik, Gamon, Kavanaugh, & Koh, 2013)."

MODIS documentation: "Note that the Day_view_time and Night_view_time are in local solar time, which is the UTC time plus grid’s longitude in degrees / 15 degrees (in hours , +24 if local solar time < 0 or - 24 if local solar time >= 24). The data day in the name of all the daily MOD11A1 files is in UTC so the data day in local solar time at each grid may be different from the data day in UTC by one day."

## Metereological missingness

Are there any days on which one of the ground-station meterological variables is missing from every station?

```sapply(
subset(select = -date, ground[,
by = date,
.SDcols = c(temp.ground.vars, nontemp.ground.vars),
lapply(.SD, function(v) all(is.na(v)))]),
any)
```
x
ground.temp.lo FALSE
ground.temp.mean FALSE
ground.temp.hi FALSE
wind.speed.mean FALSE

Fortunately, no.

## Satellite-temperature missingness

```r = rbindlist(lapply(available.years, function(y)
{d = model.dataset(y, mrow.set = "pred.area")
cbind(year = y, d[,
.SDcols = c("satellite.temp.day.imputed", "satellite.temp.night.imputed"),
lapply(.SD, mean)])}))
setnames(r, c("year", "day", "night"))
```
```rd(d = 2, as.data.frame(r))
```
year day night
1 2003 0.30 0.35
2 2004 0.52 0.50
3 2005 0.30 0.30
4 2006 0.31 0.36
5 2007 0.28 0.33
6 2008 0.29 0.30
7 2009 0.26 0.30
8 2010 0.32 0.33
9 2011 0.23 0.27
10 2012 0.31 0.35
11 2013 0.32 0.37
12 2014 0.32 0.35
13 2015 0.34 0.37
14 2016 0.34 0.36
15 2017 0.27 0.28
16 2018 0.29 0.34
17 2019 0.25 0.29

```as.data.frame(station.metadata())
```
network station region lon lat elev.m date.min date.max n.obs land.cover climate.type
1 emas ALTZOMONI Valle de México -98.655 19.119 3,959 2012-11-01 2019-12-30 2,335 High mountain meadow Subhumid semi-cold
2 emas APAN   -98.466 19.728 2,475 2015-05-13 2019-12-30 1,513 Annual rainfed agriculture Temperate subhumid
3 emas ATLACOMULCO   -99.877 19.799 2,568 2003-01-01 2019-12-30 5,722 Human settlements Temperate subhumid
4 emas CERRO CATEDRAL Toluca -99.519 19.542 3,385 2003-01-01 2019-12-30 5,533 Oyamel-fir forest Subhumid semi-cold
5 emas ECOGUARDAS Valle de México -99.204 19.271 2,578 2008-02-14 2019-12-30 2,991 Secondary (bushy type) vegetation of pine-oak forest Temperate subhumid
6 emas EL CHICO   -98.716 20.186 3,007 2012-11-02 2019-12-30 2,448 Oyamel-fir forest Subhumid semi-cold
7 emas ESCUELA NACIONAL DE CIENCIAS BIOLÓGICAS II, IPN. Valle de México -99.145 19.499 2,241 2010-01-01 2019-12-30 2,930 Human settlements Temperate subhumid
8 emas ESCUELA NACIONAL DE CIENCIAS BIOLÓGICAS, IPN. Valle de México -99.171 19.454 2,247 2003-01-01 2019-12-30 4,955 Human settlements Temperate subhumid
9 emas HUAMANTLA   -97.966 19.386 2,455 2003-01-01 2019-12-30 5,776 Annual rainfed agriculture Temperate subhumid
10 emas HUAUCHINANGO   -98.066 20.178 1,565 2008-05-02 2017-12-08 2,352 Human settlements Temperate humid
11 emas HUICHAPAN   -99.664 20.389 2,087 2006-09-01 2019-07-11 4,048 Annual rainfed agriculture Temperate semi-dry
12 emas HUIMILPAN   -100.283 20.390 2,279 2003-01-01 2019-12-30 5,457 Annual rainfed agriculture Temperate subhumid
13 emas IGUALA   -99.524 18.360 766 2004-11-01 2019-09-23 3,836 Human settlements Warm subhumid
14 emas INSTITUTO MEXICANO DE TECNOLOGÍA DEL AGUA Cuernavaca -99.157 18.882 1,360 2010-01-01 2019-12-30 3,288 Human settlements Warm subhumid
15 emas IZUCAR DE MATAMOROS   -98.452 18.617 1,310 2003-01-01 2019-12-30 4,974 Semi-permanent irrigation agriculture Warm subhumid
16 emas LA MALINCHE I   -98.044 19.298 2,922 2012-11-01 2019-12-30 2,003 Annual rainfed agriculture Subhumid semi-cold
17 emas LA MALINCHE II Puebla-Tlaxcala -98.032 19.141 2,728 2012-11-03 2019-12-30 2,300 Annual rainfed agriculture Temperate subhumid
18 emas LAGUNAS DE ZEMPOALA Cuernavaca -99.313 19.053 2,846 2012-11-01 2019-12-30 2,099 Pine forest Cold
19 emas MARIPOSA MONARCA I   -100.278 19.671 3,263 2012-11-03 2019-12-25 2,385 Oyamel-fir forest Subhumid semi-cold
20 emas MARIPOSA MONARCA II   -100.290 19.539 3,001 2012-11-14 2019-12-30 2,256 Oyamel-fir forest Temperate subhumid
21 emas NEVADO DE TOLUCA Toluca -99.771 19.126 4,084 2003-01-01 2019-12-30 5,855 High mountain meadow Subhumid semi-cold
22 emas PARQUE IZTA-POPO Valle de México -98.640 19.096 3,667 2008-02-14 2019-12-30 3,854 High mountain meadow Subhumid semi-cold
23 emas PRESA MADÍN Valle de México -99.268 19.524 2,374 2003-01-01 2019-11-29 5,713 Human-induced grassland Temperate subhumid
24 emas SIERRA DE HUAUTLA   -98.936 18.541 1,311 2012-11-10 2019-12-30 2,145 Secondary (bushy type) vegetation of dry broadleaf forest Warm subhumid
25 emas TEHUACAN   -97.617 18.314 1,737 2012-11-03 2019-12-30 2,405 Crassicaule shrublands Semi-dry semi-warm
26 emas TEPOZTLAN Cuernavaca -99.079 18.951 1,385 2004-10-22 2019-02-07 4,840 Secondary (bushy type) vegetation of dry broadleaf forest Semi-warm subhumid
27 emas TEZONTLE Valle de México -99.100 19.385 2,236 2003-01-01 2019-12-30 5,874 Human settlements Temperate semi-dry
28 emas TRES MARIAS Cuernavaca -99.249 19.051 2,832 2011-01-02 2019-12-30 2,142 Annual rainfed agriculture Temperate subhumid
29 emas UNIVERSIDAD TECNOLÓGICA DE TECAMACHALCO   -97.722 18.866 2,027 2003-01-01 2019-12-30 5,351 Annual rainfed agriculture Temperate subhumid
30 emas VALLE DE BRAVO   -100.085 19.376 2,514 2012-11-07 2019-12-30 1,859 Annual rainfed agriculture Temperate subhumid
31 esimes CEMCAS Valle de México -98.974 19.480 2,236 2014-05-01 2017-05-22 330 Halophilic grassland Temperate semi-dry
32 esimes CUERNAVACA Cuernavaca -99.215 18.943 1,634 2009-09-11 2019-12-30 2,724 Human settlements Semi-warm subhumid
33 esimes PACHUCA Pachuca -98.750 20.088 2,365 2013-01-01 2019-10-30 1,840 Human settlements Temperate semi-dry
34 esimes PUEBLA Puebla-Tlaxcala -98.163 19.055 2,190 2013-01-04 2019-12-30 2,133 Human settlements Temperate subhumid
35 esimes QUERETARO   -100.369 20.563 1,902 2013-01-10 2018-06-26 1,543 Human settlements Temperate semi-dry
36 esimes TACUBAYA Valle de México -99.197 19.404 2,301 2006-01-01 2017-12-22 3,449 Human settlements Temperate subhumid
37 esimes TLAXCALA Tlaxcala-Apizaco -98.247 19.325 2,232 2009-10-09 2019-12-30 3,002 Human settlements Temperate subhumid
38 esimes TOLUCA Toluca -99.714 19.291 2,726 2013-01-08 2019-12-30 2,103 Human settlements Temperate subhumid
39 esimes TULANCINGO Tulancingo -98.357 20.084 2,202 2006-01-01 2015-03-20 3,163 Human settlements Temperate semi-dry
40 esimes ZACATEPEC   -99.207 18.644 921 2013-03-16 2019-12-20 1,713 Human settlements Warm subhumid
41 simat ACO Valle de México -98.912 19.636 2,259 2011-07-01 2019-12-31 2,859 Human settlements Temperate semi-dry
42 simat AJM Valle de México -99.208 19.272 2,597 2015-01-01 2019-12-31 1,762 Human settlements Temperate subhumid
43 simat AJU Valle de México -99.163 19.154 2,940 2015-04-08 2019-12-31 1,078 Annual rainfed agriculture Subhumid semi-cold
44 simat BJU Valle de México -99.160 19.370 2,249 2015-08-01 2019-12-31 1,579 Human settlements Temperate subhumid
45 simat CES Valle de México -99.075 19.335 2,247 2003-01-01 2010-12-31 2,663 Human settlements Temperate subhumid
46 simat CHO Valle de México -98.886 19.267 2,242 2011-07-01 2019-12-31 2,974 Human settlements Temperate subhumid
47 simat CUA Valle de México -99.292 19.365 2,690 2003-01-01 2019-12-31 5,431 Human settlements Temperate subhumid
48 simat CUT Valle de México -99.199 19.722 2,260 2012-02-21 2019-12-31 2,347 Annual and semi-permanent irrigation agriculture Temperate subhumid
49 simat FAC Valle de México -99.244 19.482 2,288 2003-01-01 2019-12-31 5,950 Human settlements Temperate subhumid
50 simat FAR Valle de México -99.046 19.474 2,235 2019-03-01 2019-12-31 205 Human settlements Temperate semi-dry
51 simat GAM Valle de México -99.095 19.483 2,239 2015-12-01 2019-12-31 1,443 Human settlements Temperate subhumid
52 simat HAN Valle de México -99.084 19.421 2,234 2003-01-01 2006-05-31 1,200 Human settlements Temperate semi-dry
53 simat HGM Valle de México -99.152 19.412 2,241 2012-01-28 2019-12-31 2,093 Human settlements Temperate subhumid
54 simat IMP Valle de México -99.147 19.488 2,241 2008-01-03 2011-03-13 639 Human settlements Temperate subhumid
55 simat LAA Valle de México -99.147 19.484 2,241 2016-01-01 2019-12-31 1,406 Human settlements Temperate subhumid
56 simat MER Valle de México -99.120 19.425 2,238 2003-01-01 2019-12-31 6,054 Human settlements Temperate semi-dry
57 simat MGH Valle de México -99.203 19.404 2,327 2015-01-01 2019-12-31 1,815 Human settlements Temperate subhumid
58 simat MON Valle de México -98.903 19.460 2,246 2003-01-01 2019-12-31 4,759 Semi-permanent irrigation agriculture Temperate semi-dry
59 simat MPA Valle de México -98.990 19.177 2,582 2016-01-20 2019-12-31 1,317 Annual and permanent rainfed agriculture Temperate subhumid
60 simat NEZ Valle de México -99.028 19.394 2,234 2011-07-01 2019-12-31 2,495 Human settlements Temperate semi-dry
61 simat PED Valle de México -99.204 19.325 2,346 2003-01-01 2019-12-31 5,542 Human settlements Temperate subhumid
62 simat PLA Valle de México -99.200 19.366 2,320 2003-01-01 2010-12-31 2,833 Human settlements Temperate subhumid
63 simat SAC Valle de México -99.009 19.346 2,286 2019-03-01 2019-12-31 304 Human settlements Temperate subhumid
64 simat SAG Valle de México -99.030 19.533 2,236 2003-01-01 2019-12-31 5,431 Human settlements Temperate semi-dry
65 simat SFE Valle de México -99.263 19.357 2,589 2012-02-13 2019-12-31 2,747 Human settlements Temperate subhumid
66 simat SUR Valle de México -99.150 19.314 2,266 2008-08-01 2015-06-24 2,475 Human settlements Temperate subhumid
67 simat TAC Valle de México -99.202 19.454 2,261 2003-01-01 2010-12-31 2,344 Human settlements Temperate subhumid
68 simat TAH Valle de México -99.011 19.246 2,287 2003-01-01 2019-12-31 5,215 Human settlements Temperate subhumid
69 simat TLA Valle de México -99.205 19.529 2,285 2003-01-01 2019-12-31 5,551 Human settlements Temperate subhumid
70 simat TPN Valle de México -99.184 19.257 2,506 2003-02-01 2015-02-22 2,970 Oak forest Temperate subhumid
71 simat UAX Valle de México -99.104 19.304 2,238 2015-04-01 2019-12-31 1,680 Human settlements Temperate subhumid
72 simat UIZ Valle de México -99.074 19.361 2,239 2015-04-01 2019-12-31 1,565 Human settlements Temperate subhumid
73 simat VIF Valle de México -99.097 19.658 2,245 2003-01-01 2019-12-31 5,620 Human settlements Temperate subhumid
74 simat XAL Valle de México -99.082 19.526 2,245 2003-01-01 2019-12-31 5,487 Human settlements Temperate subhumid
75 smno 13022 Pachuca -98.748 20.128 2,437 2006-09-12 2016-12-31 635 Human settlements Temperate semi-dry
76 smno 13041 Tulancingo -98.357 20.084 2,203 2003-02-03 2010-02-28 749 Human settlements Temperate semi-dry
77 smno 15126 Toluca -99.714 19.291 2,726 2003-01-01 2009-07-31 2,114 Human settlements Temperate subhumid
78 smno 17067 Cuernavaca -99.233 18.892 1,391 2003-01-01 2010-06-30 1,884 Human settlements Semi-warm subhumid
79 smno 21065 Puebla-Tlaxcala -98.167 19.050 2,178 2003-01-01 2010-01-31 2,455 Human settlements Temperate subhumid
80 smno 21120 Puebla-Tlaxcala -98.201 18.996 2,138 2003-01-01 2004-08-31 555 Human settlements Temperate subhumid
81 smno 22013   -100.400 20.583 1,820 2003-01-01 2010-03-31 1,968 Human settlements Semi-dry semi-warm
82 smno 29031 Tlaxcala-Apizaco -98.244 19.312 2,280 2003-01-01 2010-07-31 1,722 Human settlements Temperate subhumid
83 smno 9048 Valle de México -99.196 19.404 2,300 2003-01-01 2018-12-31 5,258 Human settlements Temperate subhumid
84 unam CCA Valle de México -99.176 19.326 2,279 2008-01-01 2019-12-31 3,714 Human settlements Temperate subhumid
85 unam CCHA Valle de México -99.204 19.500 2,256 2003-01-28 2019-12-31 5,668 Human settlements Temperate subhumid
86 unam CCHN Valle de México -99.246 19.474 2,337 2004-07-10 2019-12-31 5,480 Human settlements Temperate subhumid
87 unam CCHO Valle de México -99.060 19.384 2,238 2003-01-01 2019-11-10 5,384 Human settlements Temperate semi-dry
88 unam CCHS Valle de México -99.199 19.312 2,350 2003-01-01 2019-12-31 5,620 Sarcocaul shrubland Temperate subhumid
89 unam CCHV Valle de México -99.141 19.484 2,241 2004-01-01 2019-12-31 4,817 Human settlements Temperate subhumid
90 unam ENP1 Valle de México -99.122 19.271 2,242 2003-01-01 2019-12-31 6,070 Human settlements Temperate subhumid
91 unam ENP2 Valle de México -99.100 19.384 2,236 2005-01-01 2019-12-31 3,592 Human settlements Temperate semi-dry
92 unam ENP3 Valle de México -99.095 19.482 2,239 2003-01-03 2019-12-31 5,866 Human settlements Temperate semi-dry
93 unam ENP5 Valle de México -99.133 19.307 2,244 2009-01-01 2019-04-30 2,853 Human settlements Temperate subhumid
94 unam ENP6 Valle de México -99.156 19.351 2,252 2010-01-01 2019-12-31 2,963 Human settlements Temperate subhumid
95 unam ENP7 Valle de México -99.127 19.420 2,236 2003-01-01 2019-09-04 5,797 Human settlements Temperate subhumid
96 unam ENP8 Valle de México -99.195 19.366 2,303 2003-01-01 2019-09-30 5,929 Human settlements Temperate subhumid
97 wunderground 012   -98.336 19.706 2,642 2018-08-27 2019-11-28 341 Annual and permanent rainfed agriculture Temperate subhumid
98 wunderground 013   -99.049 20.226 2,000 2018-11-08 2019-08-12 256 Annual and semi-permanent irrigation agriculture Temperate semi-dry
99 wunderground 060 Valle de México -99.253 19.398 2,492 2015-04-20 2019-12-31 1,573 Human settlements Temperate subhumid
100 wunderground 081 Valle de México -99.237 19.534 2,279 2018-08-16 2019-12-31 492 Human settlements Temperate subhumid
101 wunderground 087 Valle de México -99.098 19.613 2,362 2018-08-01 2019-12-24 90 Human-induced grassland Temperate subhumid
102 wunderground 089 Puebla-Tlaxcala -98.266 19.140 2,190 2019-02-17 2019-12-31 294 Annual irrigation agriculture Temperate subhumid
103 wunderground 121 Cuautla -98.945 18.916 1,449 2018-04-12 2019-09-07 294 Human settlements Semi-warm subhumid
104 wunderground 173   -97.852 18.471 1,862 2017-10-11 2019-12-31 735 Annual rainfed agriculture Temperate subhumid
105 wunderground 201 Toluca -99.502 19.292 2,574 2018-01-01 2019-11-04 478 Annual humidity based agriculture Temperate subhumid
106 wunderground 224 Valle de México -99.155 19.170 2,861 2019-02-19 2019-12-31 185 Annual rainfed agriculture Temperate subhumid
107 wunderground 226 Valle de México -99.229 19.324 2,430 2018-11-14 2019-12-31 257 Human settlements Temperate subhumid
108 wunderground 227 Valle de México -99.123 19.325 2,241 2019-04-21 2019-12-31 226 Human settlements Temperate subhumid
109 wunderground 228 Valle de México -99.134 19.336 2,242 2018-11-12 2019-12-31 366 Human settlements Temperate subhumid
110 wunderground 229 Valle de México -99.186 19.289 2,341 2018-01-10 2019-12-01 626 Human settlements Temperate subhumid
111 wunderground 230 Valle de México -99.133 19.512 2,243 2018-01-13 2019-12-31 703 Human settlements Temperate subhumid
112 wunderground 231 Valle de México -99.205 19.359 2,343 2018-11-04 2019-12-31 412 Human settlements Temperate subhumid
113 wunderground 232 Valle de México -99.279 19.334 2,694 2018-05-30 2019-12-31 576 Human settlements Temperate subhumid
114 wunderground 233 Valle de México -99.197 19.344 2,316 2017-07-26 2019-12-31 739 Human settlements Temperate subhumid
115 wunderground 234 Valle de México -99.198 19.336 2,312 2018-12-11 2019-12-24 314 Human settlements Temperate subhumid
116 wunderground 236 Valle de México -99.211 19.420 2,308 2016-10-08 2019-09-17 1,052 Human settlements Temperate subhumid
117 wunderground 253 Valle de México -99.263 19.422 2,422 2019-01-19 2019-12-31 282 Human settlements Temperate subhumid
118 wunderground 279 Puebla-Tlaxcala -98.247 19.068 2,125 2017-04-14 2019-12-31 944 Human settlements Temperate subhumid
119 wunderground 280 Puebla-Tlaxcala -98.166 19.080 2,229 2018-05-02 2019-12-31 555 Human settlements Temperate subhumid
120 wunderground 281 Puebla-Tlaxcala -98.245 18.993 2,118 2018-05-22 2019-12-31 428 Human settlements Temperate subhumid
121 wunderground 282 Puebla-Tlaxcala -98.264 19.065 2,137 2018-06-07 2019-12-31 565 Annual and semi-permanent irrigation agriculture Temperate subhumid
122 wunderground 283 Puebla-Tlaxcala -98.219 19.085 2,158 2018-06-07 2019-12-31 560 Human settlements Temperate subhumid
123 wunderground 284 Puebla-Tlaxcala -98.241 19.044 2,119 2019-04-09 2019-11-14 177 Human settlements Temperate subhumid
124 wunderground 332   -99.724 20.571 1,791 2018-08-12 2019-12-31 387 Annual rainfed agriculture Semi-dry semi-warm
125 wunderground 333   -97.919 18.939 2,200 2018-10-28 2019-12-31 290 Annual and semi-permanent irrigation agriculture Temperate subhumid
126 wunderground 349   -100.126 19.152 1,999 2019-01-04 2019-12-18 277 Pine forest Temperate subhumid
127 wunderground 444 Valle de México -99.187 19.247 2,631 2010-02-19 2019-12-31 3,444 Oak forest Temperate subhumid
128 wunderground 446 Valle de México -99.200 19.429 2,276 2015-02-16 2019-12-31 1,722 Human settlements Temperate subhumid
129 wunderground 447 Valle de México -99.206 19.329 2,343 2016-01-01 2019-12-31 1,298 Human settlements Temperate subhumid
130 wunderground 450 Valle de México -98.741 19.127 2,542 2016-01-01 2019-12-31 913 Annual rainfed agriculture Temperate subhumid
131 wunderground 451   -100.127 19.184 1,804 2014-09-08 2019-12-31 1,291 Human settlements Temperate subhumid
132 wunderground 452   -100.127 19.184 1,802 2015-02-27 2019-06-06 1,277 Human settlements Temperate subhumid
133 wunderground 453 Valle de México -98.847 19.531 2,272 2012-02-24 2019-12-31 2,679 Annual and semi-permanent irrigation agriculture Temperate subhumid
134 wunderground 461   -99.332 18.308 956 2014-09-14 2019-12-20 1,810 Human settlements Warm subhumid
135 wunderground 462   -99.538 18.345 744 2008-09-14 2019-12-20 1,752 Human settlements Warm subhumid
136 wunderground 475 Cuernavaca -99.243 18.978 1,844 2016-01-01 2019-12-31 1,384 Human settlements Temperate subhumid
137 wunderground 476 Cuernavaca -99.229 18.952 1,660 2016-06-20 2019-12-31 936 Human settlements Semi-warm subhumid
138 wunderground 477 Cuernavaca -99.234 18.839 1,243 2008-04-05 2019-12-31 1,987 Human settlements Warm subhumid
139 wunderground 478   -99.168 18.625 906 2015-07-21 2019-06-26 698 Human settlements Warm subhumid
140 wunderground 494   -97.594 19.496 2,352 2015-03-30 2019-12-31 1,646 Annual rainfed agriculture Temperate subhumid
141 wunderground 495 Puebla-Tlaxcala -98.221 18.978 2,104 2013-09-05 2019-12-31 1,266 Human settlements Temperate subhumid
142 wunderground 496 Puebla-Tlaxcala -98.194 19.013 2,139 2013-04-30 2019-12-31 2,107 Human settlements Temperate subhumid
143 wunderground 497 Puebla-Tlaxcala -98.140 19.076 2,255 2013-09-04 2019-12-31 1,486 Human settlements Temperate subhumid
144 wunderground 498 Puebla-Tlaxcala -98.184 19.003 2,137 2017-10-05 2019-11-17 668 Human settlements Temperate subhumid
145 wunderground 499 Puebla-Tlaxcala -98.196 19.044 2,152 2008-12-04 2019-12-05 3,709 Human settlements Temperate subhumid
146 wunderground 500   -97.416 18.490 1,674 2012-05-17 2019-12-31 2,502 Annual rainfed agriculture Semi-dry semi-warm
147 wunderground 505   -100.356 20.479 2,005 2006-08-17 2019-12-31 3,981 Annual irrigation agriculture Temperate semi-dry
148 wunderground 506   -100.270 20.370 2,287 2006-07-21 2019-12-31 4,001 Human-induced grassland Temperate subhumid
149 wunderground 507   -100.144 20.503 1,920 2006-06-29 2019-12-31 4,483 Human settlements Temperate semi-dry
150 wunderground 509   -100.350 20.578 1,999 2006-07-14 2019-12-31 4,004 Secondary (tree type) vegetation of dry broadleaf forest Temperate semi-dry
151 wunderground 510   -100.212 20.534 1,925 2006-10-04 2019-12-31 3,774 Annual and semi-permanent irrigation agriculture Temperate semi-dry
152 wunderground 515   -99.988 20.384 1,945 2007-04-19 2019-12-31 3,505 Human settlements Temperate semi-dry
153 wunderground 516   -100.002 20.370 1,940 2007-04-19 2019-12-26 3,733 Human settlements Temperate semi-dry
154 wunderground 562 Toluca -99.551 19.227 2,583 2014-07-30 2019-12-26 522 Annual rainfed agriculture Temperate subhumid
155 wunderground 563   -97.920 19.341 2,465 2012-11-22 2019-12-31 2,330 Human settlements Temperate subhumid
156 wunderground 805   -97.688 19.464 2,393 2019-06-06 2019-12-26 126 Human settlements Temperate subhumid
157 wunderground 817   -100.242 20.565 1,915 2019-05-18 2019-12-31 197 Annual and semi-permanent irrigation agriculture Temperate semi-dry
158 wunderground 832   -99.260 18.592 970 2019-06-04 2019-12-31 191 Annual rainfed agriculture Warm subhumid
159 wunderground 844 Valle de México -99.201 19.323 2,342 2017-09-25 2019-12-31 711 Human settlements Temperate subhumid
160 wunderground 862 Valle de México -99.268 19.476 2,419 2017-03-12 2019-12-15 645 Human settlements Temperate subhumid
161 wunderground 864 Puebla-Tlaxcala -98.220 19.128 2,188 2019-01-30 2019-07-14 80 Human settlements Temperate subhumid
162 wunderground 876 Valle de México -99.334 19.405 2,661 2019-05-22 2019-10-25 141 Human settlements Temperate subhumid
163 wunderground 886   -98.265 18.275 1,133 2019-05-10 2019-12-31 211 Annual rainfed agriculture Warm subhumid
164 wunderground 906 Puebla-Tlaxcala -98.232 19.022 2,105 2017-07-05 2019-12-02 589 Human settlements Temperate subhumid
165 wunderground 910   -100.142 20.188 2,623 2006-06-20 2019-12-31 3,929 Human settlements Temperate subhumid
166 wunderground 914   -99.885 20.520 1,878 2006-06-29 2019-12-31 4,456 Human settlements Temperate semi-dry
```db = dbConnect(SQLite(), stpath("wunderground-daily-mexico.sqlite"))
dbGetQuery(db, sprintf(
"select station_id, surface_type, neighborhood, station_type, software
from Stations
where stn in (%s)",
paste(collapse = ", ", get.ground()\$stations[
network == "wunderground",
stringr::str_extract(name, "\\d+")])))
```
station_id surface_type neighborhood station_type software
1 IALMOLOY3 composite-shingles Santiago Tetlapayac Davis Vantage Pro2 (Wireless) weatherlink.com 1.10
2 IARAMB3 cement Francisco I. Madero AcuRite 5-in-1 Weather Station with Wi-Fi
3 ICIUDADD99 shrubbery Bosques de las Lomas AcuRite Pro Weather Center myAcuRite
4 ICIUDADL14 gravel Vila Deco, bellavista Ambient Weather WS-2902 AMBWeatherV4.0.2
5 ICOACALC3 composite-shingles Maria Auxiliadora Ambient Weather WS-1400-IP (Wireless) Weather logger V3.0.5
6 ICORONAN2 cement Kuumkumi VWM Ambient Weather WS-2902 AMBWeatherV4.0.2
7 IFRACCIO2 grass Lomas de Cocoyoc AcuRite Pro Weather Center myAcuRite
8 IIXCAQUI2 composite-shingles Globalmet - Hortioriente Davis Vantage Pro2 (Wireless) weewx-3.5.0
9 ILERMA2 composite-shingles UAM LERMA Davis Vantage Pro2 Plus (Cabled) weewx-3.8.0
10 IMEXICOC50 rooftop (wood shingles) Bosque Residencial los Cedros - Empire of Dirt AcuRite 5-in-1 Weather Station with AcuRite Access myAcuRite
11 IMEXICOC47 composite-shingles San Jeronimo Lidice Ambient Weather WS-1001-WiFi (Wireless) WS-1001 V2.2.9
12 IMEXIC1 rooftop (composite-shingles) Coyoacán AcuRite Pro Weather Center myAcuRite
13 IMEXICOC46 composite-shingles TLALOC MIRAMONTES Ambient Weather WS-2090 (Wireless) EasyWeather V8.8.0
14 IMEXICOC34 spanish-tiles TLALPAN Davis Vantage Vue (Wireless) weatherlink.com 1.10
15 IMEXICOC35 cement Ticoman Netatmo Weather Station http://meteoware.com
16 IMEXICOC44 spanish-tiles Las Aguilas Ambient Weather WS-2000 AMBWeatherV4.0.2
17 IMEXICOC40 spanish-tiles Hacienda Muitles Ambient Weather WS-2902 AMBWeatherV3.0.3
18 IMEXICOC29 composite-shingles Miguel Hidalgo Netatmo Weather Station WeatherApp
19 IMEXICOC48 other Tizapan San Angel AcuRite Atlas Weather Station with AcuRite Access myAcuRite
20 IMIGUELH4 composite-shingles Lomas Virreyes Davis Vantage Pro2 (Wireless) meteobridge
21 INAUCALP34 composite-shingles Balcones de la Herradura Ambient Weather WS-2902 AMBWeatherV4.0.3
22 IPUEBLAC5 spanish-tiles PROTECCION CIVIL MUNICIPAL PUE02 Ambient Weather WS-900-IP (Wireless) Weather logger V3.1.2
24 IPUEBLAC13 composite-shingles Almacen Castillotla Davis Vantage Pro2 Plus (Cabled) weatherlink.com 1.10
25 IPUEBLAC14 composite-shingles Planta Quetzalcoatl Davis Vantage Pro2 Plus (Cabled) weatherlink.com 1.10
26 IPUEBLAC15 composite-shingles Planta Sulfurosa Davis Vantage Pro2 Plus (Cabled) weatherlink.com 1.10
27 IPUEBL5 other Puebla City other WH2600GEN_V2.2.5
28 ITECOZAU2 composite-shingles Yextho, Tecozautla AcuRite Pro Weather Center myAcuRite
29 ITEPEACA2 grass Hacienda Santa Ana Ambient Weather WS-2090 (Wireless) AMBWeatherV3.0.3
30 IVALLEDE36 composite-shingles Avandaro Ambient Weather WS-2902
31 IDFMEXIC11 composite-shingles Tlalpuente Davis weatherlink.com 1.10
32 IDISTRIT45 composite-shingles POLANCO Davis Vantage Pro2 (Cabled) Weather logger V3.1.0
33 IDISTRIT69 cement Volcan Netatmo Weather Station WeatherApp
34 IESTADOD44 grass Coapexco Ambient Weather WS-1400-IP (Wireless) WH2602 V4.5.8
35 IESTADOD4 trees Sta. Maria Ahuacatlan Davis Vantage Pro2 (Cabled) weatherlink.com 1.10
36 IESTADOD6 spanish-tiles Sta. Maria Ahuacatlan Netatmo Weather Station http://meteoware.com
37 IESTADOD2 grass El Batan, CIMMYT Davis Vantage Pro2 Plus Wunderground v.1.15 PWSDec 27 2007
38 IGUERRER8 spanish-tiles Huitzuco de los Figueroa Davis Vantage Vue (Wireless) weatherlink.com 1.10
39 IJALISCO24   Iguala Davis Vantage Pro 2 weatherlink.com 1.10
40 IMORELOS8 composite-shingles Colonia Universidad, Cuernavaca AcuRite Pro Weather Center myAcuRite
41 IMORELOS9 composite-shingles Cuernavaca SEP Davis Vantage Vue (Wireless) weatherlink.com 1.10
42 IJALISCO19 cement Temixco Morelos Davis Vantage Pro2 Plus (Wireless) weatherlink.com 1.10
43 IMORELOS7 cement Observatorio astronomico Urania Ambient Weather WS-1001-WiFi (Wireless) WS-1001 V2.2.2
44 IPUEBLAP18 trees LAS INFINITAS Ambient Weather WS-1001-WiFi (Wireless) WS-1001 V2.1.9
45 IPUEBLAP12 composite-shingles Los Heroes Davis Vantage Pro2 (Cabled) weatherlink.com 1.10
46 IPUEBLAP8 composite-shingles San Manuel Davis Vantage Pro Plus weatherlink.com 1.10
47 IPUEBLAP9 composite-shingles Cerro del Marquez Davis Vantage Pro2 (Cabled) weatherlink.com 1.10
48 IPUEBLAP4   RAMM13 - Lomas del Marmol Davis Vantage Pro weewx-3.9.1
49 IPUEPUEB2   RAMM12 - Centro Historico Davis Vantage Pro Wunderground v.1.15 PWSDec 27 2007
50 IPUEBLAT6 composite-shingles Aeropuerto de Tehuacan Vantage Pro2 weatherlink.com 1.10
51 IHUIMILP1   CEA EL MILAGRO VANTAGE PRO 2 PLUS Wunderground v.1.15 PWSDec 27 2007
52 IQUERETA19 composite-shingles CEA-HUIMILPAN VANTAGE PRO 2 PLUS Wunderground v.1.15 PWSDec 27 2007
53 IQUERETA10   CEA-PEDRO ESCOBEDO VANTAGE PRO 2 PLUS Wunderground v.1.15 PWSDec 27 2007
54 IQUERETA17 composite-shingles CEA-QCC VANTAGE PRO 2 PLUS weatherlink.com 1.10
55 IQUERETA23   CEA-TECMTY VANTAGE PRO PLUS Wunderground v.1.15 PWSDec 27 2007
56 IQUERETA13   CEA-JAPAM VANTAGE PRO 2 PLUS Wunderground v.1.15 PWSDec 27 2007
57 IQUERETA29 composite-shingles CEA-UNIVERSIDAD TECNOLOGICA Davis Vantage Pro2 Plus (Cabled) weatherlink.com 1.10
58 ISTATEOF3 grass CIMMYT, Toluca Station, San Sebastian Davis Vantage Pro2 Plus (Wireless) Wunderground v.1.15 PWSDec 27 2007
59 ITLAXCAL3   Cd Industrial II Davis Pro weatherlink.com 1.10
60 ICIUDA6 cement Ciudad De Libres AcuRite 5-in-1 Weather Station with AcuRite Access
61 IGENER13 cement General Lázaro Cárdenas AcuRite 5-in-1 Weather Station with AcuRite Access myAcuRite
62 IJOJUT4 rooftop (spanish tiles) Jojutla Ambient Weather WS-2902 AMBWeatherV4.2.8
63 IMEXICOC30 cement Fuentes del Pedregal Davis Vantage Pro2 Plus (Wireless) weatherlink.com 1.10
64 INAUCALP28 cement Vista del Valle II Ambient Weather WS-900-IP (Wireless) EasyWeather V8.8.0
65 IPUEBLAC19 composite-shingles Ecofenix AcuRite 5-in-1 Weather Station with Wi-Fi
66 ISANCR8 rooftop (composite-shingles) San Cristóbal Texcalucan AcuRite 5-in-1 Weather Station with AcuRite Access myAcuRite
67 ITEHUI2   Tehuitzingo Municipality Davis Vantage Pro2 (Wireless) weewx-3.5.0
68 IPUEBLAP11 composite-shingles San Francisco Davis Vantage Pro2 (Cabled) weatherlink.com 1.10
69 IAMEALCO2   CEA -AMEALCO VANTAGE PRO 2 PLUS Wunderground v.1.15 PWSDec 27 2007
70 IQUERETA11   CEA-TEQUISQUIAPAN Vantage Pro 2 Plus Wunderground v.1.15 PWSDec 27 2007

## Cross-validation results

```sr = summarize.cv.results(multi.run.cv(available.years))
```

Here are RMSE and R2 by year and DV, as well as the proportion of daily Moran's I statistics of the signed error that are significant at α = .05. `N` and `stn` denote the number of observations and stations in the megalopolis, for which predictions were made; stations in the larger region, which were only used for training, aren't counted. `sd.s` and `rmse.s` are spatially weighted RMSEs, in which each day and each sixteenth of a lon–lat cell are given total weight 1.

```library(data.table)
as.data.frame(rd(d = 2, sr\$overall))
```
year dv N stn sd rmse R2 sd.s rmse.s R2.spatial R2.temporal Moran ps < .05
1 2003 hi 9622 32 4.64 1.35 0.92 6.04 1.82 0.96 0.88 0.14
2 2003 lo 9622 32 4.08 1.46 0.87 4.85 1.93 0.90 0.85 0.34
3 2003 mean 9622 32 3.94 0.92 0.95 5.02 1.21 0.97 0.92 0.32
4 2004 hi 10453 35 4.58 1.35 0.91 6.33 1.76 0.94 0.86 0.11
5 2004 lo 10453 35 3.92 1.53 0.85 4.94 2.03 0.82 0.84 0.25
6 2004 mean 10453 35 3.80 1.04 0.92 5.20 1.37 0.93 0.89 0.23
7 2005 hi 11489 36 4.96 1.48 0.91 6.67 1.87 0.94 0.87 0.04
8 2005 lo 11489 36 4.02 1.61 0.84 5.10 2.16 0.87 0.82 0.16
9 2005 mean 11489 36 4.16 1.09 0.93 5.55 1.40 0.95 0.91 0.07
10 2006 hi 10882 36 4.76 1.47 0.90 6.29 1.84 0.94 0.84 0.04
11 2006 lo 10882 36 4.04 1.52 0.86 4.94 1.96 0.87 0.84 0.05
12 2006 mean 10882 36 3.94 1.11 0.92 5.17 1.40 0.95 0.87 0.04
13 2007 hi 9854 39 4.82 1.47 0.91 6.39 1.88 0.93 0.84 0.07
14 2007 lo 9854 39 3.90 1.50 0.85 4.85 1.86 0.88 0.79 0.11
15 2007 mean 9854 39 3.95 1.04 0.93 5.21 1.29 0.94 0.87 0.18
16 2008 hi 11430 41 4.85 1.59 0.89 6.78 1.96 0.88 0.85 0.31
17 2008 lo 11430 41 4.12 1.55 0.86 5.13 2.00 0.94 0.82 0.36
18 2008 mean 11430 41 4.05 1.11 0.92 5.52 1.44 0.96 0.89 0.43
19 2009 hi 13114 48 4.99 1.69 0.88 7.20 2.12 0.85 0.87 0.28
20 2009 lo 13114 48 4.02 1.58 0.85 5.33 2.05 0.88 0.80 0.50
21 2009 mean 13114 48 4.13 1.21 0.91 5.89 1.48 0.93 0.90 0.54
22 2010 hi 13980 51 5.36 1.67 0.90 7.73 2.30 0.93 0.88 0.16
23 2010 lo 13980 51 4.53 1.63 0.87 5.67 2.11 0.90 0.86 0.40
24 2010 mean 13980 51 4.50 1.26 0.92 6.35 1.71 0.95 0.91 0.28
25 2011 hi 14036 46 5.03 1.59 0.90 7.16 2.05 0.92 0.87 0.05
26 2011 lo 14036 46 4.25 1.60 0.86 5.28 1.97 0.90 0.83 0.21
27 2011 mean 14036 46 4.25 1.16 0.93 5.84 1.46 0.95 0.89 0.22
28 2012 hi 15161 53 4.71 1.46 0.90 6.57 1.83 0.91 0.87 0.19
29 2012 lo 15161 53 3.90 1.59 0.83 4.91 1.96 0.91 0.77 0.45
30 2012 mean 15161 53 3.93 1.06 0.93 5.38 1.35 0.96 0.87 0.50
31 2013 hi 17317 59 4.97 1.69 0.88 6.35 2.12 0.89 0.85 0.22
32 2013 lo 17317 59 4.16 1.71 0.83 4.89 1.98 0.90 0.75 0.58
33 2013 mean 17317 59 4.21 1.14 0.93 5.23 1.32 0.96 0.86 0.61
34 2014 hi 18685 62 4.66 1.65 0.87 6.13 2.03 0.89 0.83 0.28
35 2014 lo 18685 62 4.21 1.63 0.85 5.14 1.97 0.90 0.79 0.48
36 2014 mean 18685 62 4.02 1.10 0.92 5.21 1.29 0.96 0.86 0.58
37 2015 hi 20712 69 4.60 1.60 0.88 6.28 2.01 0.89 0.82 0.25
38 2015 lo 20712 69 3.96 1.63 0.83 5.16 1.84 0.87 0.75 0.47
39 2015 mean 20712 69 3.92 1.09 0.92 5.38 1.23 0.95 0.84 0.62
40 2016 hi 23716 74 4.82 1.64 0.88 6.15 2.05 0.89 0.87 0.28
41 2016 lo 23716 74 4.25 1.87 0.81 5.26 2.05 0.85 0.78 0.62
42 2016 mean 23716 74 4.18 1.24 0.91 5.37 1.33 0.94 0.88 0.56
43 2017 hi 23915 80 4.47 1.66 0.86 6.00 2.04 0.87 0.82 0.31
44 2017 lo 23915 80 4.54 1.92 0.82 5.60 2.26 0.84 0.82 0.58
45 2017 mean 23915 80 4.15 1.30 0.90 5.45 1.47 0.91 0.87 0.51
46 2018 hi 23558 91 4.18 1.58 0.86 5.66 1.82 0.85 0.86 0.39
47 2018 lo 23558 91 3.96 1.77 0.80 5.01 1.90 0.85 0.80 0.62
48 2018 mean 23558 91 3.77 1.26 0.89 5.09 1.29 0.90 0.88 0.56
49 2019 hi 29093 99 4.17 1.86 0.80 5.96 2.18 0.78 0.81 0.42
50 2019 lo 29093 99 3.88 1.83 0.78 5.15 2.02 0.81 0.76 0.70
51 2019 mean 29093 99 3.68 1.22 0.89 5.27 1.31 0.92 0.85 0.72

Here are the RMSEs (and Moran's I p-values for the per-station mean signed error) by meteorological season:

```as.data.frame(rd(d = 2, sr\$by.season))
```
year dv season N stn sd rmse sd - rmse Moran p
1 2003 hi ColdDry 3215 32 4.29 1.34 2.96 0.35
2 2003 hi Rainy 4788 32 4.53 1.37 3.15 0.58
3 2003 hi WarmDry 1619 32 4.21 1.32 2.90 0.34
4 2003 lo ColdDry 3215 32 3.49 1.69 1.80 0.68
5 2003 lo Rainy 4788 32 3.07 1.21 1.87 0.01
6 2003 lo WarmDry 1619 32 3.50 1.66 1.84 0.37
7 2003 mean ColdDry 3215 32 3.49 0.96 2.53 0.33
8 2003 mean Rainy 4788 32 3.57 0.89 2.67 0.34
9 2003 mean WarmDry 1619 32 3.70 0.91 2.79 0.28
10 2004 hi ColdDry 3518 35 4.74 1.35 3.39 0.93
11 2004 hi Rainy 5286 34 4.13 1.38 2.75 0.78
12 2004 hi WarmDry 1649 29 4.86 1.25 3.61 0.33
13 2004 lo ColdDry 3518 35 3.58 1.78 1.80 0.50
14 2004 lo Rainy 5286 34 2.83 1.33 1.50 0.51
15 2004 lo WarmDry 1649 29 3.53 1.54 1.99 0.12
16 2004 mean ColdDry 3518 35 3.70 1.12 2.57 0.24
17 2004 mean Rainy 5286 34 3.23 1.01 2.22 0.78
18 2004 mean WarmDry 1649 29 4.03 0.95 3.08 0.22
19 2005 hi ColdDry 3773 36 4.42 1.46 2.96 0.65
20 2005 hi Rainy 5673 36 4.83 1.50 3.33 0.82
21 2005 hi WarmDry 2043 35 4.85 1.47 3.38 0.85
22 2005 lo ColdDry 3773 36 3.35 1.70 1.65 0.74
23 2005 lo Rainy 5673 36 3.34 1.52 1.82 0.14
24 2005 lo WarmDry 2043 35 3.73 1.72 2.01 0.66
25 2005 mean ColdDry 3773 36 3.55 1.07 2.48 0.56
26 2005 mean Rainy 5673 36 3.85 1.14 2.72 0.55
27 2005 mean WarmDry 2043 35 4.00 1.02 2.98 0.46
28 2006 hi ColdDry 3598 36 4.51 1.53 2.98 0.39
29 2006 hi Rainy 5207 35 4.50 1.49 3.01 0.76
30 2006 hi WarmDry 2077 35 4.59 1.33 3.25 0.69
31 2006 lo ColdDry 3598 36 3.67 1.63 2.03 0.89
32 2006 lo Rainy 5207 35 3.15 1.35 1.80 0.40
33 2006 lo WarmDry 2077 35 3.59 1.68 1.91 0.95
34 2006 mean ColdDry 3598 36 3.65 1.11 2.54 0.81
35 2006 mean Rainy 5207 35 3.54 1.13 2.40 0.73
36 2006 mean WarmDry 2077 35 3.84 1.03 2.80 0.75
37 2007 hi ColdDry 3566 39 4.52 1.52 3.00 0.38
38 2007 hi Rainy 4737 37 4.81 1.49 3.33 0.15
39 2007 hi WarmDry 1551 30 4.96 1.32 3.63 0.73
40 2007 lo ColdDry 3566 39 3.28 1.64 1.64 0.63
41 2007 lo Rainy 4737 37 3.46 1.37 2.09 0.00
42 2007 lo WarmDry 1551 30 3.87 1.54 2.34 0.22
43 2007 mean ColdDry 3566 39 3.53 1.09 2.44 0.03
44 2007 mean Rainy 4737 37 3.79 1.01 2.78 0.00
45 2007 mean WarmDry 1551 30 4.23 1.04 3.20 0.33
46 2008 hi ColdDry 3873 41 4.67 1.56 3.12 0.33
47 2008 hi Rainy 5699 39 4.88 1.67 3.22 0.08
48 2008 hi WarmDry 1858 39 4.16 1.39 2.76 0.87
49 2008 lo ColdDry 3873 41 3.31 1.70 1.60 0.38
50 2008 lo Rainy 5699 39 3.48 1.44 2.04 0.00
51 2008 lo WarmDry 1858 39 3.41 1.54 1.87 0.74
52 2008 mean ColdDry 3873 41 3.76 1.14 2.62 0.01
53 2008 mean Rainy 5699 39 3.81 1.14 2.67 0.00
54 2008 mean WarmDry 1858 39 3.58 0.97 2.61 0.04
55 2009 hi ColdDry 4114 47 4.90 1.69 3.22 0.83
56 2009 hi Rainy 6689 46 4.77 1.73 3.05 0.49
57 2009 hi WarmDry 2311 43 4.40 1.62 2.79 0.51
58 2009 lo ColdDry 4114 47 3.50 1.73 1.77 0.05
59 2009 lo Rainy 6689 46 3.24 1.45 1.79 0.00
60 2009 lo WarmDry 2311 43 3.59 1.62 1.97 0.69
61 2009 mean ColdDry 4114 47 3.74 1.17 2.58 0.00
62 2009 mean Rainy 6689 46 3.79 1.25 2.53 0.03
63 2009 mean WarmDry 2311 43 3.81 1.15 2.66 0.08
64 2010 hi ColdDry 4429 50 5.07 1.55 3.53 0.81
65 2010 hi Rainy 7219 48 5.03 1.66 3.38 0.76
66 2010 hi WarmDry 2332 45 4.98 1.91 3.07 0.60
67 2010 lo ColdDry 4429 50 3.74 1.80 1.93 0.18
68 2010 lo Rainy 7219 48 3.58 1.51 2.07 0.00
69 2010 lo WarmDry 2332 45 3.71 1.63 2.08 0.00
70 2010 mean ColdDry 4429 50 3.89 1.21 2.69 0.02
71 2010 mean Rainy 7219 48 3.96 1.26 2.70 0.25
72 2010 mean WarmDry 2332 45 4.19 1.35 2.84 0.07
73 2011 hi ColdDry 4557 46 4.61 1.45 3.16 0.88
74 2011 hi Rainy 7196 45 4.98 1.68 3.30 0.67
75 2011 hi WarmDry 2283 41 5.01 1.59 3.42 0.82
76 2011 lo ColdDry 4557 46 3.63 1.69 1.94 0.87
77 2011 lo Rainy 7196 45 3.80 1.56 2.25 0.09
78 2011 lo WarmDry 2283 41 4.09 1.59 2.50 0.67
79 2011 mean ColdDry 4557 46 3.80 1.07 2.73 0.60
80 2011 mean Rainy 7196 45 4.03 1.23 2.80 0.10
81 2011 mean WarmDry 2283 41 4.39 1.07 3.32 0.39
82 2012 hi ColdDry 4810 52 4.54 1.50 3.04 0.48
83 2012 hi Rainy 7685 50 4.51 1.47 3.04 0.34
84 2012 hi WarmDry 2666 49 4.34 1.36 2.98 0.62
85 2012 lo ColdDry 4810 52 3.53 1.72 1.81 0.08
86 2012 lo Rainy 7685 50 3.30 1.48 1.82 0.00
87 2012 lo WarmDry 2666 49 3.55 1.66 1.89 0.44
88 2012 mean ColdDry 4810 52 3.70 1.13 2.57 0.01
89 2012 mean Rainy 7685 50 3.57 1.03 2.54 0.01
90 2012 mean WarmDry 2666 49 3.69 0.99 2.70 0.15
91 2013 hi ColdDry 5853 58 4.66 1.67 2.99 0.21
92 2013 hi Rainy 8739 59 4.81 1.68 3.13 0.35
93 2013 hi WarmDry 2725 53 5.57 1.76 3.81 0.51
94 2013 lo ColdDry 5853 58 3.70 1.89 1.81 0.15
95 2013 lo Rainy 8739 59 3.58 1.47 2.12 0.00
96 2013 lo WarmDry 2725 53 4.68 1.97 2.71 0.22
97 2013 mean ColdDry 5853 58 3.85 1.21 2.64 0.00
98 2013 mean Rainy 8739 59 3.91 1.06 2.85 0.00
99 2013 mean WarmDry 2725 53 4.94 1.21 3.72 0.03
100 2014 hi ColdDry 6194 62 4.54 1.57 2.97 0.41
101 2014 hi Rainy 9305 59 4.33 1.69 2.64 0.85
102 2014 hi WarmDry 3186 59 4.70 1.72 2.98 0.33
103 2014 lo ColdDry 6194 62 3.99 1.83 2.17 0.36
104 2014 lo Rainy 9305 59 3.49 1.41 2.08 0.00
105 2014 lo WarmDry 3186 59 4.02 1.82 2.20 0.29
106 2014 mean ColdDry 6194 62 3.93 1.17 2.76 0.01
107 2014 mean Rainy 9305 59 3.55 1.05 2.49 0.11
108 2014 mean WarmDry 3186 59 4.16 1.11 3.04 0.01
109 2015 hi ColdDry 6527 68 4.40 1.56 2.84 0.70
110 2015 hi Rainy 10971 66 4.42 1.63 2.79 0.45
111 2015 hi WarmDry 3214 64 5.14 1.59 3.55 0.89
112 2015 lo ColdDry 6527 68 3.86 1.83 2.04 0.01
113 2015 lo Rainy 10971 66 3.36 1.42 1.94 0.02
114 2015 lo WarmDry 3214 64 4.10 1.84 2.27 0.13
115 2015 mean ColdDry 6527 68 3.80 1.14 2.66 0.00
116 2015 mean Rainy 10971 66 3.55 1.03 2.52 0.03
117 2015 mean WarmDry 3214 64 4.46 1.19 3.27 0.03
118 2016 hi ColdDry 7816 74 4.56 1.61 2.95 0.82
119 2016 hi Rainy 11895 74 4.37 1.64 2.73 0.97
120 2016 hi WarmDry 4005 71 5.55 1.70 3.85 0.49
121 2016 lo ColdDry 7816 74 3.97 2.11 1.86 0.04
122 2016 lo Rainy 11895 74 3.51 1.57 1.95 0.00
123 2016 lo WarmDry 4005 71 4.28 2.16 2.12 0.03
124 2016 mean ColdDry 7816 74 3.81 1.29 2.51 0.01
125 2016 mean Rainy 11895 74 3.72 1.16 2.55 0.11
126 2016 mean WarmDry 4005 71 4.63 1.35 3.28 0.02
127 2017 hi ColdDry 7907 79 4.08 1.57 2.51 0.79
128 2017 hi Rainy 11890 79 4.48 1.72 2.76 0.98
129 2017 hi WarmDry 4118 74 4.70 1.68 3.02 0.85
130 2017 lo ColdDry 7907 79 4.02 2.20 1.82 0.95
131 2017 lo Rainy 11890 79 3.54 1.62 1.93 0.00
132 2017 lo WarmDry 4118 74 4.21 2.12 2.08 0.34
133 2017 mean ColdDry 7907 79 3.79 1.35 2.44 0.17
134 2017 mean Rainy 11890 79 3.77 1.25 2.52 0.30
135 2017 mean WarmDry 4118 74 4.35 1.36 2.99 0.30
136 2018 hi ColdDry 7124 88 3.88 1.59 2.29 0.23
137 2018 hi Rainy 12402 87 3.85 1.53 2.32 0.09
138 2018 hi WarmDry 4032 77 4.09 1.72 2.37 0.89
139 2018 lo ColdDry 7124 88 3.87 2.00 1.87 0.59
140 2018 lo Rainy 12402 87 3.00 1.61 1.40 0.00
141 2018 lo WarmDry 4032 77 3.65 1.82 1.82 0.43
142 2018 mean ColdDry 7124 88 3.52 1.29 2.23 0.01
143 2018 mean Rainy 12402 87 3.23 1.24 1.99 0.14
144 2018 mean WarmDry 4032 77 3.69 1.26 2.42 0.30
145 2019 hi ColdDry 9278 96 3.88 1.72 2.17 1.00
146 2019 hi Rainy 14924 95 4.07 1.95 2.12 0.29
147 2019 hi WarmDry 4891 92 3.93 1.87 2.06 0.41
148 2019 lo ColdDry 9278 96 3.64 1.97 1.66 0.00
149 2019 lo Rainy 14924 95 3.15 1.67 1.48 0.00
150 2019 lo WarmDry 4891 92 3.88 1.99 1.89 0.00
151 2019 mean ColdDry 9278 96 3.46 1.21 2.25 0.00
152 2019 mean Rainy 14924 95 3.34 1.22 2.13 0.00
153 2019 mean WarmDry 4891 92 3.60 1.22 2.38 0.00
```as.data.frame(rd(d = 2, sr\$by.region))
```
dv region N stn sd rmse sd - rmse
1 hi Cuautla 196 1 2.54 1.22 1.32
2 hi Cuernavaca 1717 7 4.41 1.93 2.47
3 hi Pachuca 132 1 4.29 3.42 0.87
4 hi Tlaxcala-Apizaco 224 1 2.71 1.73 0.98
5 hi Toluca 1015 4 6.50 2.49 4.01
6 hi Valle de México 16859 64 3.60 1.45 2.14
7 hi Puebla-Tlaxcala 3415 13 2.99 1.57 1.42
8 lo Cuautla 196 1 1.41 1.51 -0.09
9 lo Cuernavaca 1717 7 4.21 1.70 2.51
10 lo Pachuca 132 1 3.48 2.14 1.34
11 lo Tlaxcala-Apizaco 224 1 2.94 2.54 0.40
12 lo Toluca 1015 4 3.44 2.34 1.10
13 lo Valle de México 16859 64 3.56 1.76 1.80
14 lo Puebla-Tlaxcala 3415 13 3.22 1.61 1.61
15 mean Cuautla 196 1 1.59 1.04 0.55
16 mean Cuernavaca 1717 7 4.31 1.22 3.09
17 mean Pachuca 132 1 3.28 1.10 2.18
18 mean Tlaxcala-Apizaco 224 1 2.16 1.11 1.06
19 mean Toluca 1015 4 4.59 1.59 2.99
20 mean Valle de México 16859 64 3.18 1.27 1.91
21 mean Puebla-Tlaxcala 3415 13 2.75 1.15 1.61

These by-region results are only for 2018.

```as.data.frame(rd(d = 2, sr\$by.network))
```
dv network N stn sd rmse sd - rmse
1 hi emas 2740 14 7.50 2.10 5.40
2 hi esimes 823 4 3.31 2.15 1.16
3 hi simat 7787 25 3.22 1.26 1.96
4 hi smno 285 1 2.85 1.45 1.39
5 hi unam 3187 12 2.82 0.94 1.88
6 hi wunderground 8736 35 3.54 1.77 1.76
7 lo emas 2740 14 5.66 1.92 3.75
8 lo esimes 823 4 3.72 2.47 1.25
9 lo simat 7787 25 3.34 1.75 1.59
10 lo smno 285 1 2.72 1.07 1.65
11 lo unam 3187 12 2.76 1.04 1.72
12 lo wunderground 8736 35 3.66 1.89 1.77
13 mean emas 2740 14 6.53 1.50 5.02
14 mean esimes 823 4 2.93 1.10 1.82
15 mean simat 7787 25 2.77 1.04 1.73
16 mean smno 285 1 2.41 0.74 1.67
17 mean unam 3187 12 2.47 0.72 1.74
18 mean wunderground 8736 35 3.20 1.51 1.68

These by-network results are only for 2018.

```time.series.plot()
```
```pred.error.plot()
```

### With vs. without training Wunderground

```x = lapply(c(F, T), function(train.wunder)
summarize.cv.results(multi.run.cv(year(earliest.date) : latest.year,
train.wunder = train.wunder), test.wunder = F)\$overall)
x = cbind(x[[1]][, .(year, dv, N, rmseF = rmse.s)],
rmseT = x[[2]]\$rmse.s)
x[, diff := rmseF - rmseT]
```
```rd(as.data.frame(x))
```
year dv N rmseF rmseT diff
1 2003 hi 9622 1.816 1.816 0.000
2 2003 lo 9622 1.932 1.932 0.000
3 2003 mean 9622 1.205 1.205 0.000
4 2004 hi 10453 1.765 1.765 0.000
5 2004 lo 10453 2.027 2.027 0.000
6 2004 mean 10453 1.368 1.368 0.000
7 2005 hi 11489 1.875 1.875 0.000
8 2005 lo 11489 2.158 2.158 0.000
9 2005 mean 11489 1.403 1.403 0.000
10 2006 hi 10882 1.839 1.836 0.003
11 2006 lo 10882 1.968 1.959 0.009
12 2006 mean 10882 1.400 1.397 0.003
13 2007 hi 9854 1.874 1.880 -0.006
14 2007 lo 9854 1.850 1.858 -0.007
15 2007 mean 9854 1.295 1.285 0.010
16 2008 hi 11378 1.799 1.942 -0.142
17 2008 lo 11378 1.982 1.996 -0.013
18 2008 mean 11378 1.387 1.440 -0.053
19 2009 hi 12743 2.027 2.098 -0.071
20 2009 lo 12743 2.068 2.071 -0.003
21 2009 mean 12743 1.462 1.480 -0.018
22 2010 hi 13357 1.788 2.302 -0.514
23 2010 lo 13357 2.070 2.157 -0.087
24 2010 mean 13357 1.411 1.741 -0.330
25 2011 hi 13376 1.974 2.030 -0.056
26 2011 lo 13376 2.001 1.984 0.017
27 2011 mean 13376 1.473 1.464 0.009
28 2012 hi 14074 1.813 1.828 -0.015
29 2012 lo 14074 1.969 1.937 0.031
30 2012 mean 14074 1.392 1.376 0.015
31 2013 hi 15622 2.102 2.145 -0.044
32 2013 lo 15622 1.979 1.957 0.022
33 2013 mean 15622 1.342 1.335 0.006
34 2014 hi 16907 2.049 2.066 -0.017
35 2014 lo 16907 1.992 1.965 0.027
36 2014 mean 16907 1.300 1.291 0.009
37 2015 hi 18598 1.990 2.002 -0.012
38 2015 lo 18598 1.845 1.841 0.004
39 2015 mean 18598 1.192 1.208 -0.016
40 2016 hi 19899 2.011 2.028 -0.017
41 2016 lo 19899 2.090 2.075 0.015
42 2016 mean 19899 1.260 1.294 -0.034
43 2017 hi 18459 1.977 2.012 -0.035
44 2017 lo 18459 2.284 2.310 -0.026
45 2017 mean 18459 1.365 1.425 -0.060
46 2018 hi 14822 1.731 1.808 -0.077
47 2018 lo 14822 1.904 1.946 -0.041
48 2018 mean 14822 1.100 1.241 -0.141
49 2019 hi 17058 1.954 2.128 -0.174
50 2019 lo 17058 2.040 2.054 -0.014
51 2019 mean 17058 1.127 1.285 -0.158

`rmseF` is the spatial RMSE obtained from a CV that tests on non-Wunderground stations and trains on non-Wunderground stations. `rmseT` is similar except Wunderground stations are allowed in training. `diff` is `rmseF - rmseT`, so positive `diff` means an improvement in RMSE when Wunderground is included in training.

```round(d = 5, mean(x[year > 2005, diff]))
```
value
-0.04761

## Learning curve

```learning.curve.plot()
```

## New predictions

```# d = predict.temps("~/Jdrive/PM/Just_Lab/projects/PROGRESS_physical_activity/data/intermediate/allvar_aug8.rds")
```
```temp.quantiles.map(2018L)
```

Above are the .95 quantiles of the lows and highs, respectively, in 2018.

```pop.map("POB65_MAS")
```

Above is the gridded population density in 2010 for the whole area (counting only people ages 65 and up).

```pop.map("POB65_MAS", thresholds.tempC = c(5, 30))
```

Above is the person-days of exposure to extreme lows or highs, respectively, in 2010. The total exposure, summed across all pixels, is:

kind total person-days
1 ≤ 5 °C 51,842,088
2 ≥ 30 °C 18,242,720

## References

Hu, L., Brunsell, N. A., Monaghan, A. J., Barlage, M., & Wilhelmi, O. V. (2014). How can we use MODIS land surface temperature to validate long-term urban model simulations? Journal of Geophysical Research, 119(6), 3185–3201. doi:10.1002/2013JD021101

Rosenfeld, A., Dorman, M., Schwartz, J., Novack, V., Just, A. C., & Kloog, I. (2017). Estimating daily minimum, maximum, and mean near surface air temperature using hybrid satellite models across Israel. Environmental Research, 159, 297–312. doi:10.1016/j.envres.2017.08.017

Williamson, S. N., Hik, D. S., Gamon, J. A., Kavanaugh, J. L., & Koh, S. (2013). Evaluating cloud contamination in clear-sky MODIS Terra daytime land surface temperatures using ground-based meteorology station observations. Journal of Climate, 26(5), 1551–1560. doi:10.1175/JCLI-D-12-00250.1