Yearly Archives: 2014

移除极长路径工具

名称: Remove Long Path
版本: v1.0 initial release
build: 2014.12.11
南卓铜 Zhuotong Nan (giscn@msn.com)
http://nanzt.info

本工具可以移除极长路径。这些路径在Windows资源管理器中无法被删除。目前有一些收费和免费的工具,作者在本机上测试了一个目录深度达1500以上的例子,这些已有工具要不效率低下,要不在运行过程中出现错误(弹出Stop working)。本工具可以有效工作在Windows 32位和64位。

使用方法:

1. 解压缩至一个目录下

2. 在资源管理器里,打开该目录(removelongpath.exe所在目录),按shift的同时点击右键,在弹出菜单里选择“在此打开命令窗口”

3. 在命令窗口里敲入removelongpath.exe,可以看到使用方法提示。

4. 命令格式是 removelongpath [longpath] {time_interval}

[longpath]指定要移除的目录,此目录以下的任何深度的任何子目录和文件均将被删除。如果路径包括空格,请使用双引号。

{time_interval}是删除每个文件或目录的间隔,在Windows下,过快删除将导致系统拒绝后续删除操作。单位是秒,默认是1秒,可以是任何数字甚至小数,比如0.5表示半秒。

例子:removelongpath .temp 0.5

将移除当前目录下的temp目录下的任何子目录和文件。

5. 命令执行时,需要按两次y,由于命令将删除指定下的任何内容,需要格外慎重。除y或Y以外的任何按键,会取消此命令的执行。

Tips:

1. 如果没有删除干净,可以多次重复使用删除。并试着延长设置更长的间隔时间。

当前版本的md5 sum:

4f46c34a349186d1bd8b6cd5085dabdb  removelongpath.exe
c4b4409f186da70fcf2bcc60d5f05489  libgcc_s_dw2-1.dll
dbda60d92e774b4acb3b1cd71f909426  mingwm10.dll
db57cd45846d1b6188412ed69f51eec0  QtCore4.dll

下载:removelongpath.b20141211.zip (百度云盘)

如需源代码,请联系作者。

^_^

Continue reading

配置 qt creator 3.2.2 debugger for mingw

新版本的qt creator 3.2.2 要求 GDB 7.6以上,且支持python。所以老版本的,也包括从mingw官网里下载过来如GDB 7.6的都不能用。

新版的Qt往往自带qt creator,直接安排就好,但老版本的,比如qt 4.8版本就需要自己配置。很费一翻劲。

qt 4.8要求mingw GCC 4.4.0,现在qt官网上都已经不提供。我以前从nokia ftp上下载来的mingw-gcc440_1.zip,可以用。但里面自带的gdb是6.8版本,不能被新版本的qt creator所用。如果不想用qt creator 3.x,那得倒退到2.0以前的版本吧(我测试过creator 2.5.2版是不能用的)。

然后从非官方的gdb for mingw下载支持python版的gdb。地址是http://sourceforge.net/projects/gdbmingw/files/?source=navbar。我的测试是目前最新的gdb2014-05023.zip就可以用。

将下来的gdb-python解压缩覆盖到 mingw的安装目录,会提示覆盖,覆盖即是。

此外还需要安装 python 2.7,从python官网下载即是,但最好是 2.7.5版本以上,我的是2.7.8。gdb好像不支持python 3.x。

然后在creator里手工配置Tools > Options > Build & Run 里的 Qt versions, Compilers, 和Debuggers,保存后,配置Kits。即可。

一个启示是如果我们想编译qt 4.x  for mingw版本,qt creator可以不必是基于mingw,但gdb必须是基于mingw,且是被qt creator识别的支持python版本的。

一种简单有效的MODIS LST内插方法

一种简单有效的MODIS LST内插方法

Zhuotong Nan (giscn@msn.com, 南卓铜)

本软件实现了一种新的基于相似性原理的MODIS陆表温度(LST)的插值方法。这种LST数据空间插值方法利用具有相似温度变化特征的已知LST像元集合推算缺失的LST。在青藏高原的案例表明传统的地统计方法基本无法处理大范围连续的数据丢失(比如因为云),而本方法明显优于传统方法,可能较合理的得到缺失LST。此方法尤其适用于大范围山地区域。

This tool implements a new interpolation method for MODIS land surface temperature (LST) following the theory of similarity. It estimates the missing LST pixels by known LST pixel sets which bear similar characteristics of LST variation as the missing pixels. A case study on the Qinghai Tibet plateau has already been carried out, showing its obvious advantages over the traditional geostatistic methods, the latter was unable to do with a large area and temporally continuous data missing situations. This approach is especially good for a study area with a large area and mountainous terrain.

6704d1efb515c7a26d93914d72b14448

fig 1a, with this approach

315bdc690406652281a46f305a2e6697

fig 1b, with Kriging

Continue reading

A document for stream data used in DHSVM

Zhuotong Nan (南卓铜, giscn@msn.com)

Three files related to stream data are required to run DHSVM. One is the stream network file, which include information for each stream segment. The second is the stream mapping file, which contains stream information on a cell by cell basis. The last one is a look up table file specifying the information of each channel class. In addition, a soil depth grid is also related to the stream data.

In this document, I used the following example files.

  • Stream.network.dat: stream network file
  • Stream.map.dat: stream mapping file
  • Stream.class.dat: stream class file
  • Soild: soil depth grid

The first three data files are in text format which can be opened with any text editors. The last is in ESRI ArcGIS Grid format that can be viewed with ArcMap or any GIS with support of this format.

See the 7-page document for details.

image

pdf, 186KB

Workflow of Preparing Stream Data for DHSVM

Workflow of Preparing Stream Data for DHSVM

Zhuotong Nan (南卓铜, giscn@msn.com)

Preparing stream data for DHSVM is very complicated. Many AML scripts as well as Java are involved. Through the example showed below, I want to examine what the preparation really does and what happens behind the scripts. The scripts need ArcGIS workstation, which is not commonly installed. Thus I wrote this article, in the hope that without installation of ArcGIS workstation, you can see clearly the processes and if you want you can re-implement it with other languages.

I created a folder named “highplandpark” on the desktop, whose actual path is c:usersnztdesktophighlandpark. The contents in this folder include,

  • Arcscripts, directory, the aml scripts copied from DHSVM.
  • Programs, directory, the java codes copied from DHSVM
  • Dembuilding_my.asc, file, dem file
  • Mask.asc, file, the mask file for the area of interest

Those files can be found here.

In order to repeat the following steps, ArcGIS Desktop and Workstation, Java Runtime Environment JRE, shall be installed as prerequisites. I used version 10.0 for both ArcGIS Desktop and Workstation and JRE 7. My OS is Windows 7 x64.

image
Generated soil depth grid

Read the 18-page full document, pdf (478KB)

Two attached files

奇虎360 google字体的问题

因为google font被国内封掉,使用360的代替google fonts (fonts.useso.com),详细见此帖子,但在chrome里总出现错误,导致google字体无法在后台显示。比如在是在,

http://nanzt.info/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=

出现 Cross-origin Resource Sharing Policy的问题,如图所示。

882516f0aa11711ce50d8907fc19b6ec

 

但如果切换成google fonts 的原始网址(fonts.googleapis.com),则没有这个问题,后台正常显示字体。

以上问题在ie里不出现。

这应该是 360本身的问题。强迫不管http还是https均使用科大的google字体,在 USESO_TAKE_OVER_GOOGLE插件的代码里做了如下简单修改。以上问题得到解决。

function useso_take_over_google_str_handler($matches)

{

$str = $matches[0];

/*if (!is_ssl()) {

$str = str_ireplace(‘//fonts.googleapis.com/’, ‘//fonts.useso.com/’, $str);

$str = str_ireplace(‘//ajax.googleapis.com/’, ‘//ajax.useso.com/’, $str);

} else {*/

$str = str_ireplace(‘//fonts.googleapis.com/’, ‘//fonts.lug.ustc.edu.cn/’, $str);

$str = str_ireplace(‘//ajax.googleapis.com/’, ‘//ajax.lug.ustc.edu.cn/’, $str);

/*}*/

return $str;

}

关于twentytwelve主题中使用google字体的问题

经Bruno网友的提醒,原来国内禁止访问google字体,我使用的主题twentytwelve默认是使用了google的open sans开源字体。

因为google字体的存在,博客网页在显示前试图访问googleapis.com网站,会延迟很长时间。怪不得此前有朋友反映很慢,我还以为是电信网访问科技网速度慢的问题(当然这也是慢的另一个原因)。

Bruno有相关的插件可以考虑,如这个地址:http://www.brunoxu.com/wordpress-google-fonts-plugin-removal-remove-google-fonts-references.html,可以很好处理各处使用google字体的情况。但也许有性能下降的担忧,同时过滤掉了google字体,默认采用的字体也许不是想要的。

我使用了Bruno的Useso take over Google插件,使用奇虎360缓存的google字体。该插件可以从wordpress.org的插件库里找到。作者主页地址是http://www.brunoxu.com/useso-take-over-google.html

Matlab科学数据处理:如何补上缺失的时间序列

Matlab科学数据处理:如何补上缺失的时间序列

Zhuotong Nan (南卓铜, giscn@msn.com)

问题提出

假设我们有一个时间序列文件,内容如下

286880 19480223 -5.7

286880 19480227 10.8

286880 19480229 7.7

286880 19480301 -15.7

286880 19480302 3.2

286880 19480303 7.7

286880 19480305 21.2

第一列是站点名,第二列是时间信息,第三列是温度值。时间并不连接,我们经常需要把时间补全,这些时间上的观测以缺失值(比如999.9)替代。即,我们希望是,

286880 19480223 -5.7

286880 19480224 999.9

286880 19480225 999.9

286880 19480226 999.9

286880 19480227 10.8

286880 19480228 999.9

286880 19480229 7.7

286880 19480301 -15.7

286880 19480302 3.2

286880 19480303 7.7

286880 19480304 999.9

286880 19480305 21.2

那么在matlab里要如何实现呢。

基本思路 Continue reading

将Global AVHRR NDVI 3g转换为ESRI ASCII Grid栅格的Matlab代码

我在前面的帖子(previous post)介绍了用ArcGIS读取GIMMS AVHRR NDVI 3g格式的数据文件的方法,但并不十分好用。所以写了一点代码,用于方便的将之转换为ESRI ASCII Grid栅格,后者可以很容易的被GIS软件支持。

从这个帖子可以下载到相关的代码和样例ndvi3g数据。

注意运行代码需要 Matlab的支持。

Purpose: Convert GIMMS Global AVHRR NDVI 3g files to ESRI ASCII Grid, which is very easy to be accessed with popular GIS software.
Author: Zhuotong Nan (giscn@msn.com)
Web: http://nanzt.info
Date: Sep 11,2014

Last update: Nov 3,2014

Please distribute codes with this header attached.

Usage:

type convert_ndvi3g_ascii in Matlab to run

Open convert_ndvi3g_ascii.m, modify the ndvi3gfl variable to make it point to the ndvi 3g file you wanto to convert.

After run, three grid files will be created. One is the grid
corresponding to the 3g data file, the other is the ndvi grid extracted from the 3g data file, and the last one is its associated flag grid.

Files included with this code:

  • convert_ndvi3g_ascii.m, the main matlab script
  • geo82dec15a.n07-VI3g, example avhrr ndvi 3g file
  • geo82dec15a.n07-VI3g.asc, ascii grid file corresponding to geo82dec15a.n07-VI3g
  • geo82dec15a.n07-VI3g.ndvi.asc, ascii grid file of the extracted ndvi
  • geo82dec15a.n07-VI3g.flag.asc, grid file of associated flags
  • header.txt, esri grid header information, used in code
  • Readme.txt, this file.

The meaning of the FLAG:
FLAG = 7 (missing data)
FLAG = 6 (NDVI retrieved from average seasonal profile, possibly snow)
FLAG = 5 (NDVI retrieved from average seasonal profile)
FLAG = 4 (NDVI retrieved from spline interpolation, possibly snow)
FLAG = 3 (NDVI retrieved from spline interpolation)
FLAG = 2 (Good value)
FLAG = 1 (Good value)

Nov 3, 2014
Fix bugs that wrongly computing ndvi.asc and flag.asc

Sep 11, 2014
Initial version

Download codes (9,875KB)

78ae077b84d7455913382971da7731ef  soft.ndvi3g.11032014.zip

Download codes (6,483KB)

MD5:  006d2d630a5c94f3ca629fc9f751d7f1  soft.ndvi3g.zip