-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecoregion.r
136 lines (117 loc) · 3.45 KB
/
ecoregion.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File: UtahLevel3Design.R
# Purpose: Example area GRTS survey design for Omernik level 3 ecoregions within Utah
# Programmer: Tony Olsen
# Date: February 28, 2005
#######
Load SP library
#######
#######
# Load psurvey.design library
#######
# Read dbf file
att <- read.dbf('eco_l3_ut')
head(att)
###### Four Example GRTS designs are given. Each can be run independently.
##### Equal probability GRTS survey design
Equaldsgn <- list(None=list(panel=c(PanelOne=115),
seltype='Equal'
)
)
sample(100000000,1) # run to get random seed
Equalsites <- grts(design=Equaldsgn,
src.frame='shapefile',
in.shape='eco_l3_ut',
att.frame=att,
type.frame='area',
DesignID='UTEco3EQ',
shapefile=TRUE,
prj='eco_l3_ut',
out.shape='Eco3.EqualSites'
)
##### Unequal Probability GRTS survey design.
# what are the ecoregions?
levels(att$LEVEL3_NAM)
UnEqualdsgn <- list(None=list(panel=c(PanelOne=115),
seltype='Unequal',
caty.n=c("Central Basin and Range"=25,
"Colorado Plateaus"=25,
"Mojave Basin and Range"=10,
"Northern Basin and Range"=10,
"Southern Rockies"=10,
"Wasatch and Uinta Mountains"=25,
"Wyoming Basin"=10)
)
)
sample(100000000,1) # run to get random seed
UnEqualsites <- grts(design=UnEqualdsgn,
src.frame='shapefile',
in.shape='eco_l3_ut',
att.frame=att,
type.frame='area',
mdcaty='LEVEL3_NAM',
DesignID='UTEco3UN',
shapefile=TRUE,
prj='eco_l3_ut',
out.shape='Eco3.UnEqualSites'
)
#summarize sites selected
addmargins( table( UnEqualsites$mdcaty,UnEqualsites$panel) )
##### Stratified GRTS survey design.
Stratdsgn <- list("Central Basin and Range"=list(panel=c(PanelOne=25),
seltype='Equal'),
"Colorado Plateaus"=list(panel=c(PanelOne=25),
seltype='Equal'),
"Mojave Basin and Range"=list(panel=c(PanelOne=10),
seltype='Equal'),
"Northern Basin and Range"=list(panel=c(PanelOne=10),
seltype='Equal'),
"Southern Rockies"=list(panel=c(PanelOne=10),
seltype='Equal'),
"Wasatch and Uinta Mountains"=list(panel=c(PanelOne=25),
seltype='Equal'),
"Wyoming Basin"=list(panel=c(PanelOne=10),
seltype='Equal')
)
sample(100000000,1) # run to get random seed
Stratsites <- grts(design=Stratdsgn,
src.frame='shapefile',
in.shape='eco_l3_ut',
att.frame=att,
type.frame='area',
stratum='LEVEL3_NAM',
DesignID='UTEco3ST',
shapefile=TRUE,
prj='eco_l3_ut',
out.shape='Eco3.Stratify.Sites'
)
# summarize sites selected
addmargins( table( Stratsites$stratum,Stratsites$panel) )
##### Panels for surveys over time with unequal probability GRTS survey design with over sample.
#
Paneldsgn <- list(None=list(panel=c(Panel_1=50, Panel_2=50, Panel_3=50,
Panel_4=50, Panel_5=50),
seltype='Unequal',
caty.n=c("Central Basin and Range"=64,
"Colorado Plateaus"=63,
"Mojave Basin and Range"=15,
"Northern Basin and Range"=15,
"Southern Rockies"=15,
"Wasatch and Uinta Mountains"=63,
"Wyoming Basin"=15),
over=100
)
)
sample(100000000,1) # run to get random seed
Panelsites <- grts(design=Paneldsgn,
src.frame='shapefile',
in.shape='eco_l3_ut',
att.frame=att,
type.frame='area',
mdcaty='LEVEL3_NAM',
DesignID='UTEco3Pan',
shapefile=TRUE,
prj='eco_l3_ut',
out.shape='Eco3.PanelSites'
)
# summarize sites selected
addmargins( table(Panelsites$mdcaty,Panelsites$panel) )