-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathR_code_radiance.r
46 lines (28 loc) · 1.33 KB
/
R_code_radiance.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# R_code_radiance
library(raster)
toy <- raster(ncol=2, nrow=2, xmn=1, xmx=2, ymn=1, ymx=2) # create a new raster dataset
values(toy) <- c(1.13,1.44,1.55,3.4)
plot(toy)
text(toy, digits=2) # put the information on the pixel
toy2bits <- stretch(toy,minv=0,maxv=3) # we traslate the information = radiance in bits information
storage.mode(toy2bits[]) = "integer" # the way to starage our information
plot(toy2bits)
text(toy2bits, digits=2)
toy4bits <- stretch(toy,minv=0,maxv=15) # we can change the information from 2bits to 4bits
storage.mode(toy4bits[]) = "integer"
plot(toy4bits)
text(toy4bits, digits=2)
# passing from 4 bits to 8
toy8bits <- stretch(toy,minv=0,maxv=255)
storage.mode(toy8bits[]) = "integer"
plot(toy8bits)
text(toy8bits, digits=2)
par(mfrow=c(1,4))
plot(toy)
text(toy, digits=2)
plot(toy2bits)
text(toy2bits, digits=2)
plot(toy4bits)
text(toy4bits, digits=2)
plot(toy8bits)
text(toy8bits, digits=2)