1
|
### Brief script to explore the total size of the 1km daily (1970-2010) dataset
|
2
|
|
3
|
## Time
|
4
|
dates=seq(as.Date("1970-01-01"),as.Date("2010-01-01"),by=1)
|
5
|
n.dates=length(dates)
|
6
|
|
7
|
## Total area
|
8
|
n.globe=510072000 #km2, from http://en.wikipedia.org/wiki/Earth
|
9
|
|
10
|
## Land Area
|
11
|
n.land=148940000 #km2, from http://en.wikipedia.org/wiki/Earth
|
12
|
|
13
|
## total values (space x time)
|
14
|
n.landtime=n.dates*n.land
|
15
|
n.globetime=n.dates*n.globe
|
16
|
|
17
|
n.landtime
|
18
|
n.globetime
|
19
|
|
20
|
formatC(n.landtime, format="f",digits=0, big.mark=',')
|
21
|
|
22
|
|
23
|
### approximate storage size for various data types
|
24
|
types=as.data.frame(matrix(c(
|
25
|
"short int","Short integer",-32768, 32767,2,
|
26
|
"long int","Long integer", -2147483648,2147483647,4,
|
27
|
"single","Single-precision floating-point", -3.4e38,1.2e38,4,
|
28
|
"double","Double-precision floating-point", -2.2e308,1.8e308,8
|
29
|
),ncol=5,byrow=T,dimnames=list(1:4,c("type","longtype","min","max","bytes"))),stringsAsFactors=F)
|
30
|
types$min=as.numeric(types$min);types$max=as.numeric(types$max);types$bytes=as.numeric(types$bytes)
|
31
|
types
|
32
|
|
33
|
### now estimate TB storage for total values
|
34
|
|
35
|
types$storage.landtime.TB=round(n.landtime*types$bytes/2^40,1)
|
36
|
types$storage.globetime.TB=round(n.globetime*types$bytes/2^40,1); types
|
37
|
|
38
|
types[,-c(2:4)]
|