Wednesday, March 30, 2016

[Discard]TeX: CTeX+TeXMaker

CTeX是方便中文TeX用户的TeX编译环境,但是它包含的WinEdit编辑器是收费软件,不符合自由流通、使用原则,所以这里应用CTeX+TeXMaker配置方案,兼顾CTeX支持中文优点及TeXMaker优秀的编辑环境。
这两款的最新安装文件都可以在各自的官方站点下载,分别按照向导安装。这里只要注意:CTeX安装时不勾选WinEdit
各自安装完成后,CTeX不须配置,TeXMaker需要进行配置。打开Texmaker,工具栏Options->Configure Texmaker,配置如下:
Fig. 1
其中Pdf Viewer选择安装机器的Pdf浏览器即可,这里是Adobe Acrobat。
配置完成后,试用下面代码对效果进行简单测试:
有时下段代码运行不成功,提示“! Package CJK Error: Invalid character code.”错误,此时造成错误的原因在于该段代码保存的文本不是UTF8编码格式,只需将该文件另存为UTF8编码即可。
\documentclass[UTF8]{ctexart}
\begin{document}
\section{文字}
测试部分!
\section{数学}
\[
  a ^2+ b^2=c^2
\]

这是数学公式!
\end{document}

References

Tuesday, March 29, 2016

Tips: Land Use Data

土地利用类型图是很多研究中必不可少或至关重要的基础数据。但是,研究时段往往与已有的土地利用类型图在时间上并不匹配,若要取得时间重叠的土地利用数据可能代价过大,这时是否可以将已有的土地利用类型图视为同期数据加以采用,部分文献的数据处理过程确有这样的应用,请参考下表列出的部分文献:

编号研究数据年代对应土地覆盖数据年份间隔引用

11989~19932000(1 km)≥7 a朱文泉, 潘耀忠, 张锦水. 中国陆地植被净初级生产力遥感估算. 植物生态学报, 2007, 31(3): 413~424.

21989~19932000(1 km)≥7 aZhu, Pan, He, et al.. Simulation of maximum light use efficiency for some typical vegetation types in China. Chinese Science Bulletin, 2006, 51(4): 457~463.

320001995(30 m)5 aHonnay, Piessens, Landuyt, et al.. Satellite based land use and landscape complexity indices as predictors for regional plant species diversity. Landscape and Urban Planning, 2003, 63: 241~250.

419901992~19932~3 aFrolking, Xiao, Zhuang, et al.. Agricultural land-use in China: a comparison of area estimates from ground-based census and satellite-borne remote sensing. Global Ecology and Biogeography, 1999, 8, 407~416.

51998~20132000(1 km)2~3 aLiu, Zhu, Zhu, et al.. Changes in Spring Phenology in the Three-Rivers Headwater Region from 1999 to 2013. Remote Sensing, 2014, 6: 9130~9142.

71982~20061992~1993(1 km)0~14 aZhu, Tian, Xu, et al.. Extension of the growing season due to delayed autumn over mid and high latitudes in North America during 1982–2006. Global Ecology and Biogeography, 2012, 21(2): 260-271.

81982~19991981~19940~10+ aDeyong Yu, Wenquan Zhu* and Yaozhong Pan. The Role of Atmospheric Circulation System playing in Coupling Relationship between Spring NPP and Precipitation in East Asia Area. Environmental Monitoring and Assessment, 2008, 145: 135-143.

Wednesday, March 23, 2016

Tips: 横向评价、纵向评价、全局评价

Introduction

A longitudinal survey(纵向调查) is a correlational research study that involves repeated observations of the same variables over long periods of time, often many decades. It is often a type of observational study, although they can also be structured as longitudinal randomized experiments. Longitudinal studies are often used in psychology, to study developmental trends across the life span, and in sociology, to study life events throughout lifetimes or generations. The reason for this is that unlike cross-sectional studies, in which different individuals with the same characteristics are compared, longitudinal studies track the same people and so the differences observed in those people are less likely to be the result of cultural differences across generations. Longitudinal studies thus make observing changes more accurate and are applied in various other fields.
这里讨论基于地理空间数据的横向评价、纵向评价以及全局评价。地理空间数据是指包含地理位置的二维栅格数据,典型如NDVI数据。二维栅格数据的评价工作往往以单个的栅格单元为评价单位,评价结果是得到多期数据的评估量化数值,区分它们的优劣等差异程度。
以1982~2013年中国某地七月的NDVI数据为例,辨析横向评价、纵向评价及全局评价的内涵与外延。NDVI数值表示健康植被的状况,所以它是效益型指标,该数值越大越有利于生态系统健康状态。Fig. 1显示某地2003年七月的NDVI,图上上下两个像元数值依次是0.6610、0.5950,以下的分析还将围绕着这一年的数据以及这两个像元为实例展开讨论。这里的评价方法选择灰靶决策,由于仅就单一指标进行评价和排序,所以评价过程不涉及多权重的计算。
Fig. 1

横向评价

如果我想对比Fig. 1上两个像元NDVI数值在整幅图像上的相对状况,那么就以这幅影像上的最优标准(靶心)评价这二者,计算他们的靶心度,我们就可以得知这两个像元在当年当地达到的水平,这就是典型的横向评价。
Fig. 2
Fig. 2显示2003年七月NDVI横向评价结果。Fig 1~2使用相同的色带渲染,渲染范围同样是0至1之间。这期NDVI数据最大值是0.9,它也就是横向评价的靶心值。很显然,NDVI-0.6610比0.5950更接近于靶心位置,所以上下两个像元的靶心系数表现为上大于下,同时这两个像元以及整幅影像的像元均可以进行比较,这是由于他们共用同一靶心值。但是,不同时间的各个像元(即使是同一位置)却不能进行对比,因为各自评价的靶心值不同。
Fig. 3
Fig. 3显示整幅影像的评价单元之间的对比情况,上下两个像元的相对位置如图中所示。

纵向评价

我们再设想一下,同一位置(像元)与自身以往的情况进行对比,并定位自身在以往过程中的位置,这就是纵向评价。对于二维空间数据而言,此时评价一幅影像的靶心值则以同样行列的矩阵形式呈现。任意位置(像元)的评价结果是它比照以往自身的最优状态(靶心)得到的靶心系数,也就是这一靶心系数表示当前状态与它自身最优状态的接近程度。可以想见,不同位置的靶心系数虽属同一时期,但之间的靶心系数不能直接对比,原因在于各自的靶心值不同。
本示例中各位置(像元)的评价靶心值是它们以往数值中的最大值。
Fig. 4
Fig. 4左右依次是2003年七月NDVI纵向评价的得分结果及其排序。左图黄色至深绿表示数值在0~1之间逐渐增大,上下两像元评价值分别是0.5612、0.6658,这二数值不能直接比较,也不能直接说明孰优孰虑(实际上,上像元NDVI大于下像元),他们仅表示下像元比上像元更接近于自身的最优状态(靶心)。右图是逐像元纵向评价的排序结果(降序),由绿色至蓝色表示排名逐步靠后,上像元在2003年7月的状态位列33a的第七位,同期的下像元状态也位列自身的第七位。
Fig. 5
从两像元33a纵向评价结果与排序来看,二者的状态变化可能比较同步,如1986年上下像元的状态依次位列自身的29、28位,也可能差距甚大,如2008年他们又分别各自位列1、29位。

全局评价

如果全部时间不同位置(像元)的最优状态一律设置为同一靶心值,则此时的评价结果将可在不同时间及任意位置(像元)之间进行比较,这种评价能够兼顾横向及纵向对比,这就是全局评价。
Fig. 6
全局评价1981~2013年某地NDVI指标评价的靶心值为1,2003年七月NDVI评价靶心系数如Fig. 4所示,图上两像元评价结果可以直接进行比较,上一像元比之下方像元更加接近靶心,状态优于后者。
两像元多年序列的评价结果可以一同进行对比分析,即为不同时间与不同位置的横向及纵向对比。Fig. 7显示两像元在33a之间的评价结果,多数年份上像元状态优于下像元,但个别年份则不然,如1982、1983、1987、2007、2011、2012年。
Fig. 7

References

TeX: 初步学习TeXMaker

LaTeX在线资源:http://www.ctan.org。
由于TeXMaker仅是一个编辑器,所以在安装TeXMarker之前要先安装TeX Distribution(MiKTeX),其实之后安装也是可以的。

Videos

References

Monday, March 21, 2016

Tips: 中文字号对照表


中文字号英文字号(磅)毫米像素

一英寸72pt25.30mm95.6px

大特号63pt22.14mm83.7px

特号54pt18.97mm71.7px

小初36pt12.70mm48px

一号26pt9.17mm34.7px

小一24pt8.47mm32px

二号22pt7.76mm29.3px

小二18pt6.35mm24

三号16pt5.64mm21.3px

小三15pt5.29mm20px

四号14pt4.94mm18.7px

小四12pt4.23mm16px

五号10.5pt3.70mm14px

小五9pt3.18mm12px

六号7.5pt2.56mm10px

小六6.5pt2.29mm8.7px

七号5.5pt1.94mm7.3px

八号5pt1.76mm6.7px

Reference

[1] 字号尺寸大小对照表.

Sunday, March 20, 2016

Math: 客观赋权方法列表

熵权法:
\[{w_j} = \frac{{1 - k\sum\limits_{i = 1}^m {{f_{ij}}\ln {f_{ij}}} }}{{n - \sum\limits_{j = 1}^n {\left( {k\sum\limits_{i = 1}^m {{f_{ij}}\ln {f_{ij}}} } \right)} }},{f_{ij}} = \frac{{{r_{ij}}}}{{\sum\limits_{i = 1}^m {{r_{ij}}} }},k = \frac{1}{{\ln m}}\]
变异系数法:
\[{w_j} = \frac{{{\raise0.7ex\hbox{${\sqrt {\frac{1}{m}\sum\limits_{i = 1}^m {{{\left( {{r_{ij}} - \overline {{r_{ij}}} } \right)}^{\left( 2 \right)}}} } }$} \!\mathord{\left/ {\vphantom {{\sqrt {\frac{1}{m}\sum\limits_{i = 1}^m {{{\left( {{r_{ij}} - \overline {{r_{ij}}} } \right)}^{\left( 2 \right)}}} } } {\left| {\overline {{r_j}} } \right|}}}\right.\kern-\nulldelimiterspace} \!\lower0.7ex\hbox{${\left| {\overline {{r_j}} } \right|}$}}}}{{\sum\limits_{j = 1}^n {\left( {{\raise0.7ex\hbox{${\sum\limits_{i = 1}^m {{{\left( {{r_{ij}} - \overline {{r_j}} } \right)}^{\left( 2 \right)}}} }$} \!\mathord{\left/ {\vphantom {{\sum\limits_{i = 1}^m {{{\left( {{r_{ij}} - \overline {{r_j}} } \right)}^{\left( 2 \right)}}} } {\left| {\overline {{r_j}} } \right|}}}\right.\kern-\nulldelimiterspace} \!\lower0.7ex\hbox{${\left| {\overline {{r_j}} } \right|}$}}} \right)} }},\overline {{r_j}} = \frac{1}{m}\sum\limits_{i = 1}^m {{r_{ij}}} \]
均方差法
\[{w_j} = \frac{{\sqrt {\frac{1}{m}\sum\limits_{i = 1}^m {{{\left( {{r_{ij}} - \overline {{r_j}} } \right)}^2}} } }}{{\sum\limits_{j = 1}^n {\sqrt {\frac{1}{m}\sum\limits_{i = 1}^m {{{\left( {{r_{ij}} - \overline {{r_j}} } \right)}^2}} } } }},\overline {{r_j}} = \frac{1}{m}\sum\limits_{i = 1}^m {{r_{ij}}} \]
离差最大化法
\[{w_j} = {\textstyle{{\sum\limits_{i = 1}^m {\sum\limits_{k = 1}^m {\left| {{r_{ij}} - {r_{kj}}} \right|} } } \over {\sum\limits_{j = 1}^m {\sum\limits_{i = 1}^n {\sum\limits_{k = 1}^n {\left| {{r_{ij}} - {r_{kj}}} \right|} } } }}}\]
复相关系数法
\[{w_j} = \frac{{{\raise0.7ex\hbox{$1$} \!\mathord{\left/ {\vphantom {1 {{p_j}}}}\right.\kern-\nulldelimiterspace} \!\lower0.7ex\hbox{${{p_j}}$}}}}{{\sum\limits_{j = 1}^n {\left( {{\raise0.7ex\hbox{$1$} \!\mathord{\left/ {\vphantom {1 {{p_j}}}}\right.\kern-\nulldelimiterspace} \!\lower0.7ex\hbox{${{p_j}}$}}} \right)} }}\]
式中:pjxjx1……xn的复相关系数。

References

[1] 倪广亚, 刘学录, 李沁汶, 等. 基于数据信息特征的土地资源评价客观赋权方法的研究. 中国农学通报, 2014, 30(20): 255~262.

Tuesday, March 15, 2016

Design: ANUSPLIN空间插值植被指数

Fig. 1
Fig. 2

Python: Installing Pandas

在运行PySAL时,系统提醒我Pandas adapters not loaded,在Google上搜索之后才了解pandas是一个Python package,这里介绍安装方法。
依照环境配置选择安装文件,这里环境是64 bit与Python 2.7.3,所以应选的安装文件名称是pandas-0.18.0-cp27-cp27m-win_amd64.whl。CMD的当前目录调整至安装文件所在文件夹下,键入如下命令:
pip install pandas-0.18.0-cp27-cp27m-win_amd64.whl
安装完成的提示界面如下。

References

Monday, March 14, 2016

Python: Installing PySAL

下载PySAL安装程序并解压,CMD当前目录切换至在解压后的目录下,键入如下:
pip install pysal

Friday, March 11, 2016

Data: 航遥中心信息共享与服务网

Introduction

航遥中心的遥感数据共享网站,高分一号、二号卫星数据,需要注册。

References

[1] http://gf.agrs.cn/isss/dataservice.do.

Matlab: MODIS Products

Introduction

这里整理一些MODIS产品可以通用的代码。
月值数据从文件名称返回年月信息:
 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
% Created by LI Xu
% Version 1.0
% March 11, 2016

% Description:
% Recognize the sample time in YYYYMM format

% If you have any question about this code,
% please do not hesitate to contact me via E-mail: 
% jeremy456@163.com

% Blog:
% http://blog.sciencenet.cn/u/lixujeremy
% http://lixuworld.blogspot.com/

function yymm=ReYYMM(filename)

    yymm=strsplit(filename, '.');
    yymm=yymm{2};
    yymm(1)=[];
    yy=yymm(1:4);
    yy=str2num(yy);
    mm=yymm(end-2:end);
    mm=str2num(mm);
    
    for ii=1:12
        dd=eomday(yy, ii);
        mm=mm-dd;
        if mm<0
            break;
        end
        
    end
    yymm=yy*100+ii;

end

Thursday, March 10, 2016

ENVI+IDL+Matlab: Pixel Aggregate without Average

Introduction

在Fine Resolution向Coarse Resolution重采样过程中,ENVI已有的重采样算法Pixel Aggregate是将临近像元数值平均后得到输出像元数值。
Fig. 1
但,有时降采样的目的是要将Fine Resolution像元数值合并到Coarse Resolution像元数值,即后者是前者的累计之和,这种情况多见于人口密度分布等情况。
举例:Fig. 1左边Fine Resolution像元尺寸4×4 m,降采样至右边Coarse Resolution像元尺寸6×6 m,要求是合并输出新数值。如Fig. 2所示,以输出像元(2, 1)为例,说明处理过程,IDL表示像元在矩阵中的位置以列先行后为序,均起始于0,它由如下像元而得:
100%的输入(3, 2)=15;
50%的输入(3, 1)=9;
50%的输入(4, 2)=16;
25%的输入(4, 1)=10;
则该输出像元(2, 1)是由各部分合并之和得到的,如下:
1×15+0.5×9+0.5×16+0.25*10=30
Fig. 2
如上所述,全部输出像元数值:
(0, 0):0×1+0.5×1+0.5×6+0.25×7=5.25
(1, 0):0.5×1+1×2+0.5×8+0.25×7=8.25
(2, 0):1×3+0.5×4+0.5×9+0.25×10=12
(3, 0):1×5+0.5×4+0.5×11+0.25×10=15
(0, 1):12+0.5×6+0.5×13+0.25×7=23.25
(1, 1):14+0.5×8+0.5×13+0.25×7=26.25
(2, 1):15+0.5×9+0.5×16+0.25×10=30
(3, 1):17+0.5×16+0.5×11+0.25×10=33
(0, 2):18+0.5×24+0.5×19+0.25×25=45.75
(1, 2):20+0.5×19+0.5×26+0.25×25=48.75
(2, 2):21+0.5×22+0.5×27+0.25×28=52.5
(3, 2):23+0.5×22+0.5×29+0.25×28=55.5
(0, 3):30+0.5×24+0.5×31+0.25×25=63.75
(1, 3):32+0.5×31+0.5×26+0.25×25=66.75
(2, 3):33+0.5×27+0.5×34+0.25×28=70.5
(3, 3):35+0.5×34+0.5×29+0.25×28=73.5
得到降采样后的矩阵如下:
Fig. 3
简述处理过程,首先,ENVI+IDL处理输入数据以Pixel Aggregate(Average)方法重采样,得到6×6 m空间分辨率的输出结果,但此时的输出结果是ENVI Standard格式;第二步,转换为Geotiff格式文件;第三步,参阅文献[1],将栅格数据乘以转换因子,祛除Average换为Summation,这一因子是目标分辨率(Coarse Resolution)与原始分辨率(Fine Resolution)之比值,最终得到像元数值表示累计之和的结果。注意:此处仅仅适用于影像空间分辨率X/Y相等的情况,对于X/Y不等的情况暂不适用。
示例影像降采样前后的空间覆盖范围完全一致。
Fig. 4

References

Wednesday, March 9, 2016

Code: Archiver Code

博士论文数据

[9] 提取生态安全指数(年度归纳).
[10] 归纳评价生态安全指数贡献率(全局纵向).
[11] 归纳权重识别(全局纵向).
[12] 重心识别(年度、归纳).
[15] 归纳评价得分之子系统分量占比(全局、纵向).

25指标

[2] 年度指标分量贡献提取(全局纵向).
[3] 栅格年度指标分量(全局纵向).
[4] 栅格多年指标分量(全局纵向).
[5] 多年指标分量贡献提取(全局纵向).
[6] 逐年准则层指标分量贡献(全局纵向).
[7] 多年准则层指标分量贡献(全局纵向).
[17] 等级比重6等级(逐年多年).
[21] 移动平均三子系统指数分量(全局纵向).
[22] 移动平均指标层指数分量(全局纵向).
[30] 敏感度系数(逐年移动平均).

Matlab: Global Geary's C

Introduction

Geary's C is a measure of spatial autocorrelation or an attempt to determine if adjacent observations of the same phenomenon are correlated. Geary's C is also known as Geary's contiguity ratio or simply Geary's ratio. While Moran's I measures global spatial autocorrelation, Geary's C is more sensitive to local spatial autocorrelation. Geary's C is related to Moran's I, but it is not identical.
Global Geary's C is defined as
\[C = \left( {n - 1} \right)\frac{{\sum\limits_{i = 1}^n {\sum\limits_{j = 1}^n {{w_{ij}}{{\left( {{x_i} - {x_j}} \right)}^2}} } }}{{2n{S^2}\sum\limits_{i = 1}^n {\sum\limits_{j = 1}^n {{w_{ij}}} } }}\] \[{S^2} = \frac{1}{n}\sum\limits_{i = 1}^n {{{\left( {{x_i} - \overline x } \right)}^2}} \]
where xi denotes the observed value at location i, xbar is the mean of the variable x over the n locations and wij are the elements of the spatial weights matrix, defined as 1 if location i is contiguous to location j and 0 otherwise.
Given the null hypothesis is one of no global spatial autocorrelation, the expected value of Geary's C equals 1. As with Moran's I, inference is based on z-scores:
\[{Z_C} = \frac{{C - 1}}{{\sqrt {{\rm{Var}}\left[ C \right]} }}\] \[\begin{array}{c} {\rm{Var}}\left[ C \right] = \frac{1}{{n\left( {n - 2} \right)\left( {n - 3} \right)S_0^2}}\\ \times \left\{ {S_0^2\left[ {{n^2} - 3 - {{\left( {n - 1} \right)}^2}{S_3}} \right]} \right.\\ + {S_1}\left( {n - 1} \right)\left[ {{n^2} - 3n + 3 - \left( {n - 1} \right){S_3}} \right]\\ \left. { + \frac{1}{4}{S_2}\left( {n - 1} \right)\left[ {{S_3}\left( {{n^2} - n + 2} \right) - \left( {{n^2} + 3n - 6} \right)} \right]} \right\} \end{array}\] \[{S_0} = \sum\limits_{i = 1}^n {\sum\limits_{j = 1}^n {{w_{ij}}} } \] \[{S_1} = \frac{1}{2}\sum\limits_{i = 1}^n {\sum\limits_{j = 1}^n {{{\left( {{w_{ij}} + {w_{ji}}} \right)}^2}} } \] \[{S_2} = \sum\limits_{i = 1}^n {{{\left( {\sum\limits_{j = 1}^n {{w_{ij}}} + \sum\limits_{j = 1}^n {{w_{ji}}} } \right)}^2}} \] \[{S_3} = \frac{{{{\left( {\sum\limits_{i = 1}^n {\left( {{x_i} - \overline x } \right)} } \right)}^4}}}{{{{\left( {\sum\limits_{i = 1}^n {{{\left( {{x_i} - \overline x } \right)}^2}} } \right)}^2}}}\]
The p-value for the null hypothesis is given as
\[p = {\rm{erfc}}\left( {\frac{{\left| {C - {\rm{E}}\left[ C \right]} \right|}}{{\sqrt {2{\rm{Var}}\left[ C \right]} }}} \right)\] \[{\rm{E}}\left[ C \right] = 1\]
this formula sources from Aki-Hiro Sato. Applied Data-Centric Social Sciences: Concepts, Data, Computation and Theory. Japan, Springer, 2014. pp. 138-139.
The value of Geary's C lies between 0 and 2. 1 means no spatial autocorrelation. Values lower than 1 demonstrate increasing positive spatial autocorrelation, whilst values higher than 1 illustrate increasing negative spatial autocorrelation.
栅格数据的权重规则:In its simplest form, these weights will take values 1 for close neighbours, and 0 otherwise,按照三种邻接模式Rooks case, Bishops case, Queens case,分别计算Global Geary's C.

References

Monday, March 7, 2016

Matlab: Global Moran's I

Introduction

In statistics, Moran's I is a measure of spatial autocorrelation developed by Patrick Alfred Pierce Moran. Spatial autocorrelation is characterized by a correlation in a signal among nearby locations in space. Spatial autocorrelation is more complex than one-dimensional autocorrelation because spatial correlation is multi-dimensional (i.e. 2 or 3 dimensions of space) and multi-directional.
Negative/positive values indicate negative/positive spatial autocorrelation. Values range from -1 (indicating perfect dispersion) to 1 (perfect correlation). A zero value indicates a random spatial pattern. For statistical hypothesis testing, Moran’s I values can be transformed to z-scores in which values greater than 1.96 or smaller than -1.96 indicate spatial autocorrelation that is significant at the 5% level.
Fig. 1
Global Moran's I is defined as
\[I = \frac{n}{{{S_0}}}\frac{{\sum\limits_{i = 1}^n {\sum\limits_{j = 1}^n {{w_{ij}}\left( {{x_i} - \overline x } \right)\left( {{x_j} - \overline x } \right)} } }}{{\sum\limits_{i = 1}^n {{{\left( {{x_i} - \overline x } \right)}^2}} }}\]
where wij is the weight between observation i and j, and S0 is the sum of all wij's, n is equal to the total number of pixels.
\[{S_0} = \sum\limits_{i = 1}^n {\sum\limits_{j = 1}^n {{w_{ij}}} } \]
The zI-score for the statistic is computed as:
\[{z_I} = \frac{{I - {\rm{E}}\left[ I \right]}}{{\sqrt {{\rm{V}}\left[ I \right]} }}\]
Where:
\[{\rm{E}}\left[ I \right] = \frac{{ - 1}}{{n - 1}}\] \[{\rm{V}}\left[ I \right] = {\rm{E}}\left[ {{I^2}} \right] - {\rm{E}}{\left[ I \right]^2}\] \[\begin{array}{c} {\rm{E}}\left[ {{I^2}} \right] = \frac{{A - B}}{C}\\ A = n\left[ {\left( {{n^2} - 3n + 3} \right){S_1} - n{S_2} + 3S_0^2} \right]\\ B = D\left[ {\left( {{n^2} - n} \right){S_1} - 2n{S_2} + 6S_0^2} \right]\\ C = \left( {n - 1} \right)\left( {n - 2} \right)\left( {n - 3} \right)S_0^2\\ D = \frac{{\sum\limits_{i = 1}^n {{{\left( {{x_i} - \overline x } \right)}^4}} }}{{{{\left( {\sum\limits_{i = 1}^n {{{\left( {{x_i} - \overline x } \right)}^2}} } \right)}^2}}}\\ {S_1} = \frac{1}{2}\sum\limits_{i = 1}^n {\sum\limits_{j = 1}^n {{{\left( {{w_{ij}} + {w_{ji}}} \right)}^2}} } \\ {S_2} = \sum\limits_{i = 1}^n {{{\left( {\sum\limits_{j = 1}^n {{w_{ij}}} + \sum\limits_{j = 1}^n {{w_{ji}}} } \right)}^2}} \end{array}\]
the p-value for the null hypothesis is written as
\[p = {\rm{erfc}}\left( {\frac{{\left| {I - {\rm{E}}\left[ I \right]} \right|}}{{\sqrt {2{\rm{V}}\left[ I \right]} }}} \right)\]
this formula sources from Aki-Hiro Sato. Applied Data-Centric Social Sciences: Concepts, Data, Computation and Theory. Japan, Springer, 2014. pp. 137-138.
栅格数据的权重规则:In its simplest form, these weights will take values 1 for close neighbours, and 0 otherwise,按照三种邻接模式Rooks case, Bishops case, Queens case,分别计算Global Moran's I.
Fig. 2
ArcGIS计算栅格数据的Global Moran's I,首先将该栅格数据转换为Points(注意此处的栅格数据类型必须是整型,若是浮点型则先转换为整型数据),而后再按照要求配置参数,OK后等待输出结果。
代码计算Global Moran's I的栅格最好将数据类型由整型转换为浮点型,转换之后并不改变指数结果,但有益于代码计算。

References

Sunday, March 6, 2016

Matlab: 识别与生产背景影像

Introduction

有一种情况,多幅影像(行列相同)虽然以相同的矢量边界裁剪,但因其覆盖的有效区域有所差异,导致各幅影像的背景区域有一些差别,主要集中在有效区域到背景区域的像元或多或少的是为背景数值。
以Matlab代码识别多幅影像的背景,提取他们的共同背景范围,也就是背景区域最大、有效区域最小的状态:
 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
% Created by LI Xu
% Version 1.0
% March 7, 2016

% Description:
% Recognize the background extent from input images

% If you have any question about this code,
% please do not hesitate to contact me via E-mail: 
% jeremy456@163.com

% Blog:
% http://blog.sciencenet.cn/u/lixujeremy
% http://lixuworld.blogspot.com/

clear;
clc;

% Source Directory
SouDir='output';
% All Input Files
files=dir(fullfile(SouDir, '*.tif'));

% Background Value
backvalue=0;
% Geoinfo
[file, geo]=geotiffread(fullfile(SouDir, files(1).name));
info=geotiffinfo(fullfile(SouDir, files(1).name));
mask=zeros(size(file))+1;

for ii=1:length(files)
    filename=files(ii).name;
    filepath=fullfile(SouDir, filename);
    file=imread(filepath);
    index_back=find(file==backvalue);
    if isempty(index_back);
        continue;
    end
    mask(index_back)=0;
       
end


mask=uint8(mask);
% Export
geotiffwrite('mask_30m.tif', mask, geo, 'GeoKeyDirectoryTag', info.GeoTIFFTags.GeoKeyDirectoryTag);


disp('*******************************************');
提取的背景与有效区域见Fig. 1,输出结果的背景像元数量大于等于任一输入影像。
Fig. 1

Matlab: Rendering

References

Thursday, March 3, 2016

Geography: Population

Population Density

人口的空间分布是指一定时点上人口在各地区中的分布状况,是人口过程在空间上的表现形式。一般县域尺度的人口密度计算方法,依像元分解思路,低分辨率像元被视为由高分辨率像元组合而得,低分辨率像元中的人口数量是高分辨率像元中人口之和,计算公式如下:
Fig. 1
\[{P_{ij}} = \sum\limits_{k = 1}^n {{a_k} \cdot {x_{ij,k}} + {B_{ij}}} \]
式中,Pij表示Coarse数据像元的ith行jth列像元之人口;ak表示当地第k类土地利用类型的人口系数(inhabitant/km2);xij,k表示Coarse数据像元的ith行jth列像元之中第k类土地面积(km2),此处的面积对应Fine resolution;k对应Fine resolution数据的土地利用类型数量。基于“无土地则无人口”的现实情况,作为截距的Bij应设置为0。
在实际情况中,人类生产、生活的必需条件就决定其不可能在一定海拔或坡度之上仍有较大的人口分布,所以当以上式得到人口分布数据之后,还要对一定海拔、坡度等地区进行修正,使之能够更接近于合理的人口分布情况。
最终,一定区域(行政区)内的人口密度之和应与当地的总人口相符。

References

[1] 江东, 杨小唤, 王乃斌, 等. 基于RS、GIS的人口空间分布研究. 地球科学进展, 2002, 17(5): 734~738.
[2] Yang, Huang, Dong, et al.. An updating system for the gridded population database of China based on remote sensing, GIS and spatial database technologies. Sensors, 2009, (9): 1128~1140.
[3] 杨小唤, 江东, 王乃斌, 等. 人口数据空间化的处理方法. 地理学报, 2002, 57(Supp.): 70~75.

Wednesday, March 2, 2016

RS: MCD12Q1

Introduction

The MODIS Land Cover Type product (Short Name: MCD12Q1) provides data characterizing five global land cover classification systems. In addition, it provides a land-cover type assessment, and quality-control information.

References