配置 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 ([email protected], 南卓铜)

本软件实现了一种新的基于相似性原理的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 (南卓铜, [email protected])

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 (南卓铜, [email protected])

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字体无法在后台显示。比如在是在,

https://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 (南卓铜, [email protected])

问题提出

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

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 ([email protected])
Web: https://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); Link2 (Baidu)

78ae077b84d7455913382971da7731ef  soft.ndvi3g.11032014.zip

Download codes (6,483KB)

MD5:  006d2d630a5c94f3ca629fc9f751d7f1  soft.ndvi3g.zip

自己或他人衣服着火如何自救或救人?–stop, drop and roll

温州两大学生在烧烤店就餐,因服务员不慎女学生不幸被大火烧着重伤。太悲惨的事了,花季姑娘就这样被无知的服务员毁掉了。那么如何自救或救人。

Image美国学校教导小朋友关于着火自救,叫stop, drop and roll。我们大家也应该学会,并且教导给自己的小朋友们。

第一步:stop。停下来,不要乱动或跑动,任何动作会使得火更大。保持镇静(实际上可能没有专门训练是很难做到的)。

第二步:drop。马上倒在地上,用手把自己的脸掩住,保护脸不被烧伤。

第三步:roll。在地上滚动。滚动可以把大量的火熄灭。如果附近有毯子,往毯子方向滚,毯子可以帮助灭火。

作为边上的人,除了大声求救外,应该大声喊叫,让着火人马上做stop, drop, roll的动作(着火人慌张之下往往忘记)。然后使用毛毯、自己的衣服(不能是尼龙等容易着火的衣服)在着火人滚动的过程中帮助熄火。呼喊其他人找水。如果附近有灭火器,可以结合使用。

等火灭后,不要喂水,因为这时着火人喉咙往往是肿的;不要试图脱着火人受伤的衣服,这时衣服往往已经融进皮肤。安慰着火人,等待救援。

英文许可的朋友请移步阅读美国防火协会的这个小朋友训练材料

http://www.nfpa.org/~/media/Files/Safety%20information/Public%20educators/Education%20programs/learn%20not%20to%20burn/Level%201/lntblevel1stopdroproll.pdf

家长应该多次训练自己的小孩子stop, drop and roll的自救手段。家长可以与小孩子一起做这个练习。

* 本文材料参考英文wikipedia,美国国家防火协会等材料。