2016-01-01から1年間の記事一覧

Raster Stackの計算

R

Githubにて。 https://github.com/naru-T/Rscripts/blob/master/raster_calc_function.mdもうちょっとmarkdownの書き方べんきょうせねば。

try user-defined function approach

this does not necessary to prepare large amount of RAM.```{r} na_func x[x return(as.vector(x)) }stk system.time(ans summary(ans) ``` user system elapsed 10.585 0.254 10.898 #### calculation for temporal interpolating NA values in raster st…

try normal approach

this approach depends on RAM. it is only faster when using smaller raster data. Do not try this way if you use big raster data.```{r} system.time(stk[stk summary(stk) ``````{r} system.time(stk[stk summary(stk) ``` user system elapsed 0.984…

set up raster stack

```{r} library(raster) r r1 r2 r3 r4 r5 r6 stk ```

try user-defined function approach

this does not necessary to prepare large amount of RAM.```{r} na_func x[x return(as.vector(x)) }stk system.time(ans summary(ans) ``` user system elapsed 10.585 0.254 10.898 #### calculation for temporal interpolating NA values in raster st…

try normal approach

this approach depends on RAM. it is only faster when using smaller raster data. Do not try this way if you use big raster data.```{r} system.time(stk[stk summary(stk) ``````{r} system.time(stk[stk summary(stk) ``` user system elapsed 0.984…

set up raster stack

```{r} library(raster) r r1 r2 r3 r4 r5 r6 stk ```

メモ. Rでpasteをdplyrっぽく

こちらのネタです。マルチパイプもいけます https://twitter.com/R_Programming/status/713217963801710594 `%s%` これだけ。> "A" %s% "B"%s% "C" [1] "ABC"

memo: Ubuntu. gifをつくる

Ubuntu, imagemajick上にて. convert -delay 50 `ls -v ABC_*.png` output.gif delayのあとの数字は1/100sec `ls -v ABC_*.png` ワイルドカードは数字を順番にならべてくれない(1, 10,11, 12, 2, 3,...)ので、 ls -vでならべる

ggplotで複数プロット(スケール一緒)を描く

library(ggplot2) library(reshape2) tmp tmp.melt tmp.ggmap ベクターデータをggplot用に変換する) tmp.ggmap PC1 value)) + geom_polygon() + coord_map() + facet_wrap(~variable) + ##こいつが複数描く scale_fill_gradient2(low="blue", high="red", m…

全球土地被覆データMCD12Q1の作成 HDFダウンロード〜GeoTiffの抽出・マージ(モザイク)〜投影法の変換まで

シェルとGDALのみでいきます。 1.HDFダウンロード wget -r -l 1 -A hdf http://e4ftl01.cr.usgs.gov/MOTA/MCD12Q1.051/2009.01.01/2. 各HDFファイルからTIFFに変換。今回はLand Cover Type 1 (2001): IGBP global vegetation classification schemeのみをピ…