Project

General

Profile

Download (5.52 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
opts_knit$set(progress = TRUE, verbose = TRUE,root.dir="~/Downloads/nasa/", upload.fun = imgur_upload, base.url = NULL) # upload all images to imgur.com
16
opts_chunk$set(fig.width=5, fig.height=5, cache=TRUE)
17
library(rasterVis)
18
library(rgdal)
19
library(xtable)
20
library(reshape)
21
setwd("~/Downloads/nasa/")
22
````
23

    
24

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

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

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

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

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

    
48
## define a function to summarize data
49
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))
50
rfst=function(r) cellStats(r,fst)
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
```{r, message=FALSE, fig.width=11, fig.height=8}
57
colramp=colorRampPalette(c("blue","orange","red"))
58
dt_mean=rfst(lst_mean)
59
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)")
60
```
61

    
62

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

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

    
77

    
78
## Total number of available observations
79

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

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

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

    
102

    
103
## Quality Assessment level used
104

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

    
111

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

    
118

    
119
## Questions
120

    
121
A few open questions/comments (in my mind):
122

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

    
(5-5/12)