Project

General

Profile

Download (9.11 KB) Statistics
| Branch: | Revision:
1
LST Climatology Evaluation
2
====
3

    
4

    
5

    
6
### Adam M. Wilson (Compiled on Tue Mar  4 14:57:04 2014  using code version (git hash): 0b07113)
7

    
8
A short script to visualize and explore the updated Land Surface Climatology algorithm that 'lowers the standards' in some areas to increase the number of available observations.  
9

    
10

    
11
```
12
## Warning: 'x' is NULL so the result will be NULL
13
```
14

    
15
```
16
## Error: replacement has length zero
17
```
18

    
19

    
20

    
21
## Download data from ECOcast and convert to raster stacks
22

    
23
```r
24
download = F
25
if (download) system("wget -e robots=off -L -r -np -nd -p 20140304_LST -nc -A tif http://ecocast.arc.nasa.gov/data/pub/climateLayers/LST_new/")
26

    
27
## organize file names
28
f = data.frame(full = T, path = list.files("20140304_LST", pattern = "tif$", 
29
    full = T), stringsAsFactors = F)
30
f$month = as.numeric(do.call(rbind, strsplit(basename(f$path), "_|[.]"))[, 7])
31
f$type = do.call(rbind, strsplit(basename(f$path), "_|[.]"))[, 1]
32
f = f[order(f$month), ]
33
f$mn = month.name[f$month]
34

    
35
## create raster stacks
36
lst_mean = stack(f$path[f$type == "mean"])
37
names(lst_mean) = f$mn[f$type == "mean"]
38
NAvalue(lst_mean) = 0
39

    
40
lst_nobs = stack(f$path[f$type == "nobs"])
41
names(lst_nobs) = f$mn[f$type == "nobs"]
42

    
43
lst_qa = stack(f$path[f$type == "qa"])
44
names(lst_qa) = f$mn[f$type == "qa"]
45

    
46
## define a function to summarize data
47
fst = function(x, na.rm = T) c(mean = mean(x, na.rm = T), min = min(x, na.rm = T), 
48
    max = max(x, na.rm = T))
49
rfst = function(r) cellStats(r, fst)
50
```
51

    
52

    
53
## Mean Monthly LST
54

    
55
Map of LST by month (with white indicating missing data).  Note that many inland regions have missing data (white) in some months (mostly winter).
56

    
57
```r
58
colramp = colorRampPalette(c("blue", "orange", "red"))
59
dt_mean = rfst(lst_mean)
60
levelplot(lst_mean, col.regions = c(colramp(99)), at = seq(0, 65, len = 99), 
61
    main = "Mean Land Surface Temperature", sub = "Tile H08v05 (California and Northern Mexico)")
62
```
63

    
64
![plot of chunk unnamed-chunk-4](http://i.imgur.com/LTEp1xT.png) 
65

    
66

    
67

    
68
Table of mean, min, and maximum LST for this tile by month.
69

    
70
```r
71
print(xtable(dt_mean), type = "html")
72
```
73

    
74
<!-- html table generated in R 3.0.2 by xtable 1.7-1 package -->
75
<!-- Tue Mar  4 14:19:55 2014 -->
76
<TABLE border=1>
77
<TR> <TH>  </TH> <TH> January </TH> <TH> February </TH> <TH> March </TH> <TH> April </TH> <TH> May </TH> <TH> June </TH> <TH> July </TH> <TH> August </TH> <TH> September </TH> <TH> October </TH> <TH> November </TH> <TH> December </TH>  </TR>
78
  <TR> <TD align="right"> mean </TD> <TD align="right"> 15.01 </TD> <TD align="right"> 18.41 </TD> <TD align="right"> 25.81 </TD> <TD align="right"> 32.05 </TD> <TD align="right"> 39.49 </TD> <TD align="right"> 44.18 </TD> <TD align="right"> 44.70 </TD> <TD align="right"> 41.96 </TD> <TD align="right"> 38.59 </TD> <TD align="right"> 30.84 </TD> <TD align="right"> 21.77 </TD> <TD align="right"> 14.33 </TD> </TR>
79
  <TR> <TD align="right"> min </TD> <TD align="right"> 1.43 </TD> <TD align="right"> 1.98 </TD> <TD align="right"> 1.08 </TD> <TD align="right"> 1.28 </TD> <TD align="right"> 2.37 </TD> <TD align="right"> 5.03 </TD> <TD align="right"> 12.04 </TD> <TD align="right"> 12.96 </TD> <TD align="right"> 12.72 </TD> <TD align="right"> 6.90 </TD> <TD align="right"> 2.77 </TD> <TD align="right"> 2.76 </TD> </TR>
80
  <TR> <TD align="right"> max </TD> <TD align="right"> 31.31 </TD> <TD align="right"> 36.74 </TD> <TD align="right"> 45.88 </TD> <TD align="right"> 52.29 </TD> <TD align="right"> 58.66 </TD> <TD align="right"> 60.88 </TD> <TD align="right"> 61.15 </TD> <TD align="right"> 60.99 </TD> <TD align="right"> 57.07 </TD> <TD align="right"> 48.82 </TD> <TD align="right"> 39.17 </TD> <TD align="right"> 29.42 </TD> </TR>
81
   </TABLE>
82

    
83

    
84
###  Boxplot of Monthly Mean LST
85

    
86
```r
87
lst_tmean = melt(unlist(as.matrix(lst_mean)))
88
colnames(lst_tmean) = c("cell", "month", "value")
89
lst_tmean = lst_tmean[!is.na(lst_tmean$value), ]
90
lst_tmean$month = factor(lst_tmean$month, levels = month.name, ordered = T)
91
bwplot(value ~ month, data = lst_tmean, ylab = "Mean LST (c)", xlab = "Month")
92
```
93

    
94
![plot of chunk unnamed-chunk-6](http://i.imgur.com/5Knr2zX.png) 
95

    
96

    
97

    
98
## Total number of available observations
99

    
100
This section details the spatial and temporal distribution of the number of LST observations that were not masked by quality control (see section below).  Note that the regions with no data in the map above have missing data (nobs=0) here as well, but also the areas surrounding those regions have low numbers of observations in some months (blue colors).  
101

    
102
```r
103
dt_nobs = rfst(lst_nobs)
104
levelplot(lst_nobs, col.regions = c("grey", colramp(99)), at = c(-0.5, 0.5, 
105
    seq(1, 325, len = 99)), main = "Sum Available Observations", sub = "Tile H08v05 (California and Northern Mexico) \n Grey indicates zero observations")
106
```
107

    
108
![plot of chunk unnamed-chunk-7](http://i.imgur.com/n7HfvPt.png) 
109

    
110

    
111
Table of mean, min, and maximum number of observations for this tile by month.
112
<!-- html table generated in R 3.0.2 by xtable 1.7-1 package -->
113
<!-- Tue Mar  4 14:21:49 2014 -->
114
<TABLE border=1>
115
<TR> <TH>  </TH> <TH> January </TH> <TH> February </TH> <TH> March </TH> <TH> April </TH> <TH> May </TH> <TH> June </TH> <TH> July </TH> <TH> August </TH> <TH> September </TH> <TH> October </TH> <TH> November </TH> <TH> December </TH>  </TR>
116
  <TR> <TD align="right"> mean </TD> <TD align="right"> 107.97 </TD> <TD align="right"> 100.06 </TD> <TD align="right"> 140.35 </TD> <TD align="right"> 152.19 </TD> <TD align="right"> 177.02 </TD> <TD align="right"> 178.22 </TD> <TD align="right"> 156.86 </TD> <TD align="right"> 169.87 </TD> <TD align="right"> 180.29 </TD> <TD align="right"> 167.68 </TD> <TD align="right"> 136.12 </TD> <TD align="right"> 102.86 </TD> </TR>
117
  <TR> <TD align="right"> min </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> <TD align="right"> 0.00 </TD> </TR>
118
  <TR> <TD align="right"> max </TD> <TD align="right"> 272.00 </TD> <TD align="right"> 238.00 </TD> <TD align="right"> 281.00 </TD> <TD align="right"> 293.00 </TD> <TD align="right"> 319.00 </TD> <TD align="right"> 304.00 </TD> <TD align="right"> 319.00 </TD> <TD align="right"> 324.00 </TD> <TD align="right"> 310.00 </TD> <TD align="right"> 305.00 </TD> <TD align="right"> 271.00 </TD> <TD align="right"> 260.00 </TD> </TR>
119
   </TABLE>
120

    
121

    
122
###  Boxplot of Number of Observations
123
The seasonal cycle of missing data is quite noisy, though there tend to be fewer observations in winter months (DJF).  
124

    
125
```r
126
lst_tnobs = melt(unlist(as.matrix(lst_nobs)))
127
colnames(lst_tnobs) = c("cell", "month", "value")
128
lst_tnobs = lst_tnobs[!is.na(lst_tnobs$value), ]
129
lst_tnobs$month = factor(lst_tnobs$month, levels = month.name, ordered = T)
130
bwplot(value ~ month, data = lst_tnobs, ylab = "Number of availble observations", 
131
    xlab = "Month")
132
```
133

    
134
![plot of chunk unnamed-chunk-9](http://i.imgur.com/G9g9qQw.png) 
135

    
136

    
137

    
138
## Quality Assessment level used
139

    
140
Map of the Quality Assessment (QA) level used to fill the pixels. It goes from 0 (highest quality) to 3(low). For h08v05 all pixels are filled with either 0 or 1. So red indicates areas with the lower quality data (most of the tile).
141

    
142
```r
143
levelplot(lst_qa, col.regions = c("grey", "red"), at = c(-0.5, 0.5, 1.5), cuts = 2, 
144
    main = "Quality Assessment Filter", sub = "Tile H08v05 (California and Northern Mexico)")
145
```
146

    
147
![plot of chunk unnamed-chunk-10](http://i.imgur.com/LWLYRXJ.png) 
148

    
149

    
150

    
151
Proportion of cells in each month with QA=1 (including cells in the Pacific Ocean)
152
<!-- html table generated in R 3.0.2 by xtable 1.7-1 package -->
153
<!-- Tue Mar  4 14:23:35 2014 -->
154
<TABLE border=1>
155
<TR> <TH>  </TH> <TH> January </TH> <TH> February </TH> <TH> March </TH> <TH> April </TH> <TH> May </TH> <TH> June </TH> <TH> July </TH> <TH> August </TH> <TH> September </TH> <TH> October </TH> <TH> November </TH> <TH> December </TH>  </TR>
156
  <TR> <TD align="right"> ProportionQA_1 </TD> <TD align="right"> 0.47 </TD> <TD align="right"> 0.47 </TD> <TD align="right"> 0.42 </TD> <TD align="right"> 0.40 </TD> <TD align="right"> 0.38 </TD> <TD align="right"> 0.37 </TD> <TD align="right"> 0.42 </TD> <TD align="right"> 0.40 </TD> <TD align="right"> 0.38 </TD> <TD align="right"> 0.38 </TD> <TD align="right"> 0.43 </TD> <TD align="right"> 0.47 </TD> </TR>
157
   </TABLE>
158

    
159

    
160

    
161
## Questions
162

    
163
A few open questions/comments (in my mind):
164

    
165
  1. Why are there only two QA classes for this tile (0 and 1) rather than 4 (0-3)?  There are still missing data in some months, is the plan to do it or was there another reason to not consider all classes for this tile?
166
  2. How exactly are the different QA levels selected?  If QA=0 results in <33 obs, go to QA=1, etc.?  
167
  3.  Please name monthly output in a way that it sorts chronologically  (e.g. mean_LST_Day_1km_h08v05_04.tif instead of mean_LST_Day_1km_h08v05_apr_4.tif )  
168
  4.  Please name directories on ECOcast with dates rather than "new".  E.g. LST/20140304/*   That will make it easier to see which is the new version.
169
  5.  Should we consider also saving the SD of the observations in each pixel (in addition to the mean and n of observations)?
170

    
(11-11/16)