张金龙的博客分享 http://blog.sciencenet.cn/u/zjlcas 物种适应性、分布与进化

博文

大型森林样地样方的命名与坐标转换

已有 9506 次阅读 2017-10-18 16:19 |个人分类:科研笔记|系统分类:科研笔记

大型森林监测样地一般是指面积在16公顷以上的样地,在样地内部, 所有胸径大于1cm的木本植物及其分枝都要测量平面直角坐标,胸径等。在调查过程中,一般是先确定样地范围,然后用全站仪打点,确定样地的四角,以及每个20m样方顶点位置,为了方便计算,一般以西南点为原点, x轴指向正东,向东为正,单位为m;y轴指向正北,向北为正,单位为m。

为了调查方便,一般先将样地划分成20m的样方,每个样方按照在xy轴出现的顺序命名。名字一般为4位,例如0518,前两位表示从原点开始算,向东计第5个20m样方,后两位表示从原点开始计,向北计第18个样方。因此,大样地西南角的样方名总是0101。对于东西方向宽400m,南北方向长500m的大样地,东北角的样方名为2025,西北角的样方名为0125,东南角的样方名为2001。

要在20m样方内部测量每棵树的xy坐标仍然困难。所以实际调查中一般是将20m的样方再进一步划分成16个5m*5m的小样方,每个5m的小样方均以自己的西南点为原点,xy轴的方向与20m样方相同。这样在调查中就可以较方便的测量每棵树的坐标。每个20m样地内的16个小样方一般按照蛇形顺序调查,以减少调查人员在样地内的走动。5m小样方习惯上一般命名为1到16。

按照这种调查方法,从野外调查获得的每棵树坐标位置实际上为该个体在5m小样方内的坐标。在生态学数据分析中,要进行空间分析、点格局分析、变换空间尺度时,需要每棵树在样地尺度的平面直角xy坐标。这就需要将5m的坐标按照样方名称等,转换为样地尺度的xy坐标。这也是大样地数据标准化的重要一步。

本文以一个东西宽400m*南北长500m的样地为例,简要介绍如何将调查数据转换为样地尺度。先生成模拟数据,再基于模拟数据演示如何处理。

调查后输入Excel的数据,20m样方的名称通常为0105, 0203, 0505,不过excel常常将名称自动转换为105, 203, 505等只包含三位数字;而有些样方号并不以0开头,例如1820, 2022,这些样方在Excel自动转换后包含四位数字。由于这会带来处理上的不便,所以最好统一为4位,在R中可以用stringr程序包的str_pad 函数,在3位数字的字符串前面加0,转换为0105,0203,0505等。

图1. 森林监测样地20m样方的命名




图 2. 20m样方内部, 边长为5m的小样方的命名, 以及一般的调查顺序。


下面我们生成一套模拟数据,假设我们的样地设定在河南省内乡县宝天曼自然保护区,缩写为BTM。所有胸径大于1cm的,都已经挂牌,并已经测量了在5m样方内的横纵坐标位置。

假设样地内共调查到88325个个体,没有考虑分枝。每个个体有如下的信息:

(1)tag:树的号牌,原则上讲,从号牌上需要能看出每棵树所在的20m样方号,然后在每个样方号内顺序增加。因为这里是模拟数据,就暂时不考虑了。这里按照以下方式命名 BTM000001 - BTM088325;
(2)plot20_names:该个体对应的20m样方名;
(3)g5x:该个体在5m样方内的x坐标,单位为m;
(4)g5y:该个体在5m样方内的y坐标,单位为m;
(5)subplot5:该个体所在的小样方名称,按照蛇形顺序命名,从1-16;
(6)dbh:该个体的胸径,单位为cm

#### 以下代码先生成模拟的调查数据

library(stringr)

#### 生成模拟数据,假设整个样地有88325个个体

nindividual <-88325

#### 生成树牌号

tag <-paste("BTM", str_pad(1:nindividual, 6, pad ="0"), sep ="")

#### 生成20m样地的名称

plot20_x <- str_pad(1:20, 2, pad ="0")

plot20_y <- str_pad(1:25, 2, pad ="0")

names_temp <- expand.grid(plot20_x, plot20_y)

plot20_names <-paste(names_temp[,1],names_temp[,2], sep ="")

survey_plot20_names <-sample(plot20_names,nindividual, replace=TRUE)

#### 随机生成5m样地内,调查个体的坐标

g5x <-round(runif(nindividual)*5, 2)

g5y <-round(runif(nindividual)*5, 2)

#### 生成5m小样方的名称

subplot5 <-sample(1:16, nindividual, replace=TRUE)

#### 模拟生成每棵树的胸径dbh, 假设服从指数分布

dbh <-round(rexp(nindividual,rate =2)*50+1, 1)

#### 所有生成的数据合并到一个dataframe

btmdat <- data.frame(tag, survey_plot20_names, subplot5, g5x, g5y, dbh)

#### 做简单排序

btmdat <- btmdat[order(btmdat$survey_plot20_names, btmdat$subplot5),]

############## 以上生成模拟数据结束 ####################

#### 以下代码用于转换5m坐标到大样地尺度的平面直角坐标

#######################################################

#### 生成定义5m样方在20m样方x位置的中间变量

btmdat$location5x <-rep(NA, nrow(btmdat))

btmdat$location5y <-rep(NA, nrow(btmdat))

#### 因为是蛇形调查顺序,所以5m的样方名要分别找出x轴和y轴的对应编号

btmdat$location5x[btmdat$subplot5 ==1]<-1

btmdat$location5x[btmdat$subplot5 ==2]<-2

btmdat$location5x[btmdat$subplot5 ==3]<-3

btmdat$location5x[btmdat$subplot5 ==4]<-4

btmdat$location5x[btmdat$subplot5 ==5]<-4

btmdat$location5x[btmdat$subplot5 ==6]<-3

btmdat$location5x[btmdat$subplot5 ==7]<-2

btmdat$location5x[btmdat$subplot5 ==8]<-1

btmdat$location5x[btmdat$subplot5 ==9]<-1

btmdat$location5x[btmdat$subplot5 ==10]<-2

btmdat$location5x[btmdat$subplot5 ==11]<-3

btmdat$location5x[btmdat$subplot5 ==12]<-4

btmdat$location5x[btmdat$subplot5 ==13]<-4

btmdat$location5x[btmdat$subplot5 ==14]<-3

btmdat$location5x[btmdat$subplot5 ==15]<-2

btmdat$location5x[btmdat$subplot5 ==16]<-1

#### 生成定义5m样方在20m样方y位置的中间变量

btmdat$location5y[btmdat$subplot5 ==1]<-1

btmdat$location5y[btmdat$subplot5 ==2]<-1

btmdat$location5y[btmdat$subplot5 ==3]<-1

btmdat$location5y[btmdat$subplot5 ==4]<-1

btmdat$location5y[btmdat$subplot5 ==5]<-2

btmdat$location5y[btmdat$subplot5 ==6]<-2

btmdat$location5y[btmdat$subplot5 ==7]<-2

btmdat$location5y[btmdat$subplot5 ==8]<-2

btmdat$location5y[btmdat$subplot5 ==9]<-3

btmdat$location5y[btmdat$subplot5 ==10]<-3

btmdat$location5y[btmdat$subplot5 ==11]<-3

btmdat$location5y[btmdat$subplot5 ==12]<-3

btmdat$location5y[btmdat$subplot5 ==13]<-4

btmdat$location5y[btmdat$subplot5 ==14]<-4

btmdat$location5y[btmdat$subplot5 ==15]<-4

btmdat$location5y[btmdat$subplot5 ==16]<-4

#### 20m样方的名称补充完整为4

btmdat$survey_plot20_names <- as.character(str_pad(btmdat$survey_plot20_names, 4, pad ="0"))

#### 提取20m样方名的前两位,作为20m样方的x坐标

x20 <-substr(btmdat$survey_plot20_names,start=1, stop=2)

#### 提取20m样方名的后两位,作为20m样方的y坐标

y20 <-substr(btmdat$survey_plot20_names,start=3, stop=4)

#### 计算每个个体的以大样地原点为原点的坐标

#### 无论是x轴,还是y轴,注意这里要-1

btmdat$gx <- g5x +(btmdat$location5x -1)*5+(as.numeric(x20)-1)*20

btmdat$gy <- g5y +(btmdat$location5y -1)*5+(as.numeric(y20)-1)*20

#### 去掉不需要的中间变量

final_btmdat <-subset(btmdat, select =!colnames(btmdat)%in%c("location5x", "location5y"))

head(final_btmdat)

summary(final_btmdat)




https://wap.sciencenet.cn/blog-255662-1081363.html

上一篇:学英语记
下一篇:广义线性模型中的逻辑斯蒂回归
收藏 IP: 113.28.150.*| 热度|

2 沈志强 信忠保

该博文允许注册用户评论 请点击登录 评论 (1 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-20 23:47

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部