Project

General

Profile

Download (5.6 KB) Statistics
| Branch: | Revision:
1
LST Climatology Evaluation
2
====
3
```{r,echo=FALSE,message=FALSE}
4
## get repo info
5
githash=system("git --git-dir /Users/adamw/work/environmental-layers/.git log --pretty=format:'%h' -n 1",intern=T)
6
ghead=paste("Compiled on",date()," using code version (git hash):",githash)
7
```
8

    
9
### Adam M. Wilson (`r ghead`)
10

    
11
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.  
12

    
13
```{r,echo=FALSE,results="hide",message=FALSE}
14
## some setup
15
uploadimages=F # upload all images to imgur.com for easy viewing on github
16
opts_knit$set(progress = TRUE, verbose = TRUE,root.dir="~/Downloads/nasa/", 
17
              upload.fun = ifelse(uploadimages,imgur_upload,NULL), base.url = NULL) 
18
opts_chunk$set(fig.width=5, fig.height=5, cache=TRUE)
19
library(rasterVis)
20
library(rgdal)
21
library(xtable)
22
library(reshape)
23
setwd("~/Downloads/nasa/")
24
````
25

    
26

    
27
## Download data from ECOcast and convert to raster stacks
28
```{r}
29
download=F
30
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/")
31

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

    
39
## create raster stacks
40
lst_mean=stack(f$path[f$type=="mean"])
41
names(lst_mean)=f$mn[f$type=="mean"]
42
NAvalue(lst_mean)=0
43

    
44
lst_nobs=stack(f$path[f$type=="nobs"])
45
names(lst_nobs)=f$mn[f$type=="nobs"]
46

    
47
lst_qa=stack(f$path[f$type=="qa"])
48
names(lst_qa)=f$mn[f$type=="qa"]
49

    
50
## define a function to summarize data
51
fst=function(x,na.rm=T) c("mean"=mean(x,na.rm=T),"min"=min(x,na.rm=T),"max"=max(x,na.rm=T))
52
rfst=function(r) cellStats(r,fst)
53
```
54

    
55
## Mean Monthly LST
56

    
57
Map of LST by month (with white indicating missing data).  Note that many inland regions have missing data (white) in some months (mostly winter).
58
```{r, message=FALSE, fig.width=11, fig.height=8}
59
colramp=colorRampPalette(c("blue","orange","red"))
60
dt_mean=rfst(lst_mean)
61
levelplot(lst_mean,col.regions=c(colramp(99)),at=seq(0,65,len=99),main="Mean Land Surface Temperature",sub="Tile H08v05 (California and Northern Mexico)")
62
```
63

    
64

    
65
Table of mean, min, and maximum LST for this tile by month.
66
```{r,results="asis"}
67
print(xtable(dt_mean), type = "html")
68
```
69

    
70
###  Boxplot of Monthly Mean LST
71
```{r, message=FALSE, fig.width=11, fig.height=8}
72
lst_tmean=melt(unlist(as.matrix(lst_mean)))
73
colnames(lst_tmean)=c("cell","month","value")
74
lst_tmean=lst_tmean[!is.na(lst_tmean$value),]
75
lst_tmean$month=factor(lst_tmean$month,levels=month.name,ordered=T)
76
bwplot(value~month,data=lst_tmean,ylab="Mean LST (c)",xlab="Month")
77
```
78

    
79

    
80
## Total number of available observations
81

    
82
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).  
83
```{r, message=FALSE, fig.width=11, fig.height=8}
84
dt_nobs=rfst(lst_nobs)
85
levelplot(lst_nobs,col.regions=c("grey",colramp(99)),at=c(-0.5,0.5,seq(1,325,len=99)),
86
          main="Sum Available Observations",sub="Tile H08v05 (California and Northern Mexico) \n Grey indicates zero observations")
87
```
88

    
89
Table of mean, min, and maximum number of observations for this tile by month.
90
```{r,results="asis", echo=FALSE}
91
print(xtable(dt_nobs), type = "html")
92
```
93

    
94
###  Boxplot of Number of Observations
95
The seasonal cycle of missing data is quite noisy, though there tend to be fewer observations in winter months (DJF).  
96
```{r, message=FALSE, fig.width=11, fig.height=8}
97
lst_tnobs=melt(unlist(as.matrix(lst_nobs)))
98
colnames(lst_tnobs)=c("cell","month","value")
99
lst_tnobs=lst_tnobs[!is.na(lst_tnobs$value),]
100
lst_tnobs$month=factor(lst_tnobs$month,levels=month.name,ordered=T)
101
bwplot(value~month,data=lst_tnobs,ylab="Number of availble observations",xlab="Month")
102
```
103

    
104

    
105
## Quality Assessment level used
106

    
107
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).
108
```{r, message=FALSE, fig.width=11, fig.height=8}
109
levelplot(lst_qa,col.regions=c("grey","red"),at=c(-0.5,0.5,1.5),cuts=2,
110
          main="Quality Assessment Filter",sub="Tile H08v05 (California and Northern Mexico)")
111
```
112

    
113

    
114
Proportion of cells in each month with QA=1 (including cells in the Pacific Ocean)
115
```{r,results="asis", echo=FALSE}
116
dt_qa=t(data.frame("ProportionQA_1"=cellStats(lst_qa,"mean")))
117
print(xtable(dt_qa), type = "html")
118
```
119

    
120

    
121
## Questions
122

    
123
A few open questions/comments (in my mind):
124

    
125
  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?
126
  2. How exactly are the different QA levels selected?  If QA=0 results in <33 obs, go to QA=1, etc.?  
127
  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 )  
128
  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.
129
  5.  Should we consider also saving the SD of the observations in each pixel (in addition to the mean and n of observations)?
130

    
(9-9/16)